Jump to content

Revil_Wevil

New Members
  • Posts

    1
  • Joined

  • Last visited

Revil_Wevil's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. i have been working on minor project this is login script of that page i am facing some problem i want to echo if user name password and category both 3 conditions dont match with error "wrong username/password" in form i have tried everything as per my knowledge please help me in this i am new to php so dont have much experience and knowledge of php <?php $msg=''; $con=mysql_connect('localhost','root',''); if(!$con) { die("Error While connecting......."); } else { mysql_select_db("sms",$con); if(isset($_POST['btnlog'])) { $res=mysql_query("select * from tbl_login where un='".$_POST['username']."' and pw='".$_POST['password']."' and cat='".$_POST['cat']."'"); while($r=mysql_fetch_array($res)) { mail("notification@receiver.com".$_POST['username']."Successfully Logged In"."From:notification@sender.com"); if($r['cat']=="admin") header("Location:admin/admin.php"); elseif($r['cat']=="faculty") header("Location:faculty/faculty.php"); else $msg="Incorrect Username/Password"; } } } ?> <body> <section class="login_container"> <div class="login_box"> <h1>Login</h1> <form method="post"> <center><?php echo $msg; ?></center> <p><input type="text" name="username" value="" placeholder="Username"></p> <p><input type="password" name="password" value="" placeholder="Password"></p> <center><select class="select" name="cat">Category <option selected="selected">Select A Category</option> <option value="admin">Administrator</option> <option value="faculty">Faculty</option> </select></center> <p class="submit"><input type="submit" name="btnlog" value="Login"> <input type="reset" value="Clear" /></p> </form> </div> </section>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.