Page 1 of 1

somebody please help me

Posted: Mon May 26, 2014 2:41 pm
by toyo
i dont know what's wrong with my code, but it kept on giving me error and wont log in. can someone please debug it for me. i am doing my project right now and i am on a tight schedule...


Code: Select all

<?php
  error_reporting(0);
      session_start();
      include_once ('oesdb.php');

      /***************************** Step 2 ****************************/
      if(isset($_POST['admsubmit']))
      {
          
          $result=mysql_query("select * from adminlogin where admname='".htmlspecialchars($_REQUEST['name'],ENT_QUOTES)."' and admpassword='".md5(htmlspecialchars($_POST['password'],ENT_QUOTES))."'");
        
         // $result=mysql_query("select * from adminlogin where admname='".htmlspecialchars($_REQUEST['name'])."' and admpassword='".md5(htmlspecialchars($_REQUEST['password']))."'");
		
          if(mysql_num_rows($result)>0)
          {
              
              $r=mysql_fetch_array($result);
              if(strcmp($r['admpassword'],md5(htmlspecialchars($_REQUEST['password'],ENT_QUOTES)))==0)
              {
                  $_SESSION['admname']=htmlspecialchars_decode($r['admname'],ENT_QUOTES);
                  unset($_GLOBALS['message']);
                  header('Location: admwelcome.php');
              }else
          {
             $_GLOBALS['message']="Check Your user name and Password.";
                 
          }

          }
          else
          {
              $_GLOBALS['message']="Check Your user name and Password.";
              
          }
          closedb();
      }
 ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>Administrator Login</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <link rel="stylesheet" type="text/css" href="../oes.css"/>
  </head>
  <body>
<!--
*********************** Step 1 ****************************
-->
      <?php
      
        if(isset($_GLOBALS['message']))
        {
         echo "<div class=\"message\">".$_GLOBALS['message']."</div>";
        }
      ?>
      <div id="container">
                <div class="header">
                <img style="margin:10px 2px 2px 10px;float:left;" height="80" width="200" src="../images/logo.gif" alt="OES"/><h3 class="headtext"> &nbsp;Pre-JAMB Test </h3><h4 style="color:#ffffff;text-align:center;margin:0 0 5px 5px;"><i>...Preparing you for the task ahead</i></h4>
            </div>
      <div class="menubar">
        &nbsp;
      </div>
      <div class="page">
              <form id="indexform" action="index.php" method="post">
              <table cellpadding="30" cellspacing="10">
              <tr>
                  <td>Admin Name</td>
                  <td><input type="text" name="name" value="" size="16" /></td>

              </tr>
              <tr>
                  <td> Password</td>
                  <td><input type="password" name="password" value="" size="16" /></td>
              </tr>

              <tr>
                  <td colspan="2">
                      <input type="submit" value="Log In" name="admsubmit" class="subbtn" />
                  </td><td></td>
              </tr>
            </table>

        </form>

      </div>

      <div id="footer">
          <p style="font-size:70%;color:#000000;"> Developed By-<b>Elijah Abolaji</b><br/> </p><p></p>
      </div>
      </div>
  </body>
</html>

Re: somebody please help me

Posted: Mon May 26, 2014 3:01 pm
by Celauran
error_reporting(0) isn't doing you any favours. You need that turned on for development. That aside, "it kept on giving me error" is not particularly helpful. What errors are you encountering specifically?

Re: somebody please help me

Posted: Mon May 26, 2014 4:09 pm
by toyo
ok. thx. this is what i kept on seeing: "Check Your user name and Password" and the user name and password is correct, and in md5 mode jus as in the code. dont know why

Re: somebody please help me

Posted: Tue May 27, 2014 3:43 am
by toyo
i really need your help to debug this code. i have very limited time