Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,158,305 members, 7,836,330 topics. Date: Wednesday, 22 May 2024 at 05:10 AM |
Nairaland Forum / Emmysuit's Profile / Emmysuit's Posts
(1) (of 1 pages)
Programming / Login Username From One Table And Password From Table 2 by Emmysuit: 10:27am On Jul 07, 2017 |
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)
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 4 |