php - authentication of admin and retrieve specified filename from database -


i want code authenticating admin , thereafter if successful admin must enter filename file contents file id etc retrieved database

the html code: <html>     <head>         <title>login page</title>  <style> body{ background-image: url("wall0003.png"); width: 200%; height: 200%; background-position: top; background-repeat: no-repeat;}  </style> </head>  <body text="black" align="left">         <form action="connectivity.php" onsubmit="post"> <br/> <br/> <br/> <br/> <br/> <br/> <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>             user          <input type="text" name="userid"/>  <br/><br/>             pswd<input type="password" name="pswrd"/> <br/><br/>             <input type="submit" value="login" name="login"/>             <input type="reset" value="cancel"/>          </form>  <script language="javascript">            function check(form) {  /*function check userid & password                 following code checkes whether entered userid , password matching*/                 if(form.userid.value == "myuserid" && form.pswrd.value == "mypswrd")  {                     window.open('target.html')     //opens target page while id & password matches                 }                 else {                     alert("error password or username")  // displays error message                 }             }         </script>     </body> </html>  php code: <?php define('db_host', 'localhost'); define('db_name', 'practice'); define('db_user','root'); define('db_password','admin');  $con=mysql_connect(db_host,db_user,db_password) or die("failed connect mysql: " . mysql_error()); //connect mysql $db=mysql_select_db(db_name,$con) or die("failed connect mysql: " . mysql_error()); //select mysql database /* $id = $_post['user']; $password = $_post['pass']; */ function signin() { session_start();   //starting session user profile page if(!empty($_post['user']))   //checking 'user' name login.html...is empty or has text? {     $query = mysql_query("select *  username username = '$_post[user]' , pass = '$_post[pass]'") or die(mysql_error());//send mysql query database     $row = mysql_fetch_array($query) or die(mysql_error()); //fetch row result     if(!empty($row['username']) , !empty($row['pass']))     {         $_session['username'] = $row['pass'];         echo "successfully login user profile page...";      }     else     {         echo "sorry... enterd wrong id , password... please retry...";     } } } if(isset($_post['submit'])) {     signin(); }  ?> 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -