Jump to content

Recommended Posts

Hello i am trying to make the admin login in a webpage and after I completed the page i uploaded it and now the page is not loading

 

Here is the script

<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
exit();
?>
<?php
session_start();
if (!isset($_SESSION["manager"])){
  header("location:admin_login.php");
  exit();
}
exit();
?>
<?php
if(isset($_POST["username"])&&isset($_POST["password"])){
  $manager=preg_replace('#[^A-Za-z0-9]#i','',$_POST["username"]);
  $password=preg_replace('#[^A-Za-z0-9]#i','',$_POST["password"]);

  include"../storescripts/connect_to_mysql.php";
  $sql=mysql_querey("SELECT id FROM admin WHERE username='$manager' AND password='$password' LIMIT 1");
  if($existCount == 1){
    while($row = mysql_fetch_array($sql)){
      $id = $rpw["id"];
    }
    $_SESSION["id"] = $id;
    $_SESSION["manager"] = $manager;
    $_SESSION["password"] = $password;
    header("location:index.php");
    exit();
  } else {
    echo 'That Information is incorrect, try again <a href="index.php">Click Here</a>';
    exit();
  }
}

?>
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Admin Login</title>
  <link rel="stylesheet" href="k../style/style.css" type="text/css" media=="screen" />
  <script type="text/javascript" src="//use.typekit.net/jxp6vds.js"></script>
  <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
</head>
<body>
  <div align="centre" id="mainWrapper">
    <?php include_once("../template_header.php") ?>
    <div id="pageConntent">
      <h2>Please Log In To Manage The store</h2>
      <form id="form1" name="form1" meathod="post" action="admin_login.php">
        Username:<br/>
      <input name="username" type="text" id="username" size="40"/>
      <br/><br/>
      Password<br/>
      <input name="password" type="password" id="password" size="40"/>
      <br/>
      <br/>
      <br/>
        <input type="submit" name="button" id="button" value="Log In" />
      </form>
      </div>
    <?php include_once("../footer.php"); ?>
  </div>
</body>
</html>
 

Thank you in advance

 

Look at lines 4 and 12... gives you a clue.

 

Also why are you going in and out of php mode on lines 5 and 6 and 13 and 14? This is pointless if you are not going to output anything between closing and opening php tags.

Edited by Ch0cu3r

What are you doing there, RyanCain97? :(

 

You store the password as plaintext? And then you put it into the session so that all precious passwords end up in unprotected files in the temporary folder? And then you restrict the password to alphanumerics? And this is all for the admin accounts? WTF?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.