Emmysuit's Posts
Nairaland Forum › Emmysuit's Profile › Emmysuit's Posts
1 (of 1 pages)
please i need help to with the code of the one below. am trying to create a login page the select username from one table and select password from another table but am confused now please help me with correct code of the on below <? include("connect.php" ; $tbl_name1="student"; // Table name $tbl_name2="pin_generate"; // Table name $registration_number=$_POST['registration_number']; // username sent from form $pin=$_POST['pin']; // pin sent from form // To protect MySQL injection $registration_number = stripslashes($registration_number); $pin = stripslashes($pin); $registration_number = mysql_real_escape_string($registration_number); $pin = mysql_real_escape_string($pin); //Query $sql="SELECT registration_number pin FROM $tbl_name1, $tbl_name2 WHERE registration_number='$registration_number' and pin='$pin'"; $result=mysql_query($sql); // Mysql_num_row is counting table row while ($row = mysql_fetch_assoc($result)) { if ($row['count'] == '0') { header('location: user1.html'); //User1 session_register("registration_number" ;session_register("pin" ;} else if ($row['count'] == '1') { header('location: user2.html'); //User2 $_SESSION['login_user'] = $registration_number; session_register("registration_number" ;session_register("pin" ; echo "<script>alert('Access Denied!'); .location='index.php'; </script>"; } } //Direct pages with different user levels ?> |
1 (of 1 pages)
;