<?php
$username = "system";
$password = "Mwasif2001";
$connectionString = "localhost/ORCL";
$conn = oci_connect($username, $password, $connectionString);
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
// username and password sent from form
$tbl_name = 'USERS';
if(isset($_POST['username']) && isset($_POST['pass']))
{
$username=$_POST['username'];
$password=$_POST['pass'];
}
else
{
echo ('i am here');
}
// To protect MySQL injection
$username = stripslashes($username);
$password = stripslashes($password);
$username = mysqli_real_escape_string($conn, $_POST['username']);
$password = mysqli_real_escape_string($conn, $_POST['pass']);
$sql="SELECT * FROM $tbl_name WHERE username='$username'";
echo $sql;
$stid = oci_parse($conn, "SELECT * FROM $tbl_name where username='$username'");
$result = oci_execute($stid);
$count = oci_num_rows($stid);
$stid1 = oci_parse($conn, "SELECT * FROM $tbl_name where user_password='$password'");
$result1 = oci_execute($stid1);
$count1 = oci_num_rows($stid1);
// If result matched $username and $password, table row must be 1 row
if($count == 1 && $count1 == 1)
{
// Register $username, $password and redirect to file "login_success.php"
session_start();
$_SESSION["username"] = $username;
header("location:login.php");
}
else if($count == 0) {
$failed = 1;
header("location:check.php?msg=failed");
}
else if($count1 == 0) {
$failed = 1;
header("location:main.php?msg1=failed");
}
?>
Hey!!!
I am getting error when i try to submit my form that is undefined index please helpme.