error 404 after trying to login, Help!

Hi

I’m making a website and I’m making a login for admins and a login for users.

I was able to manually create an admin user using phpmyadmin and when I tried to login it worked.

but I did the same this on the user page but I keep getting and error404 everytime i try to login

I’ve not made a register page I entered a user manually using phpmyadmin

here is the code for my user login page:

[php]<?php

session_start();
if (isset($_SESSION[“manager”])) {
header(“location: index.php”);
exit();
}
?>

<?php // Parse the log in form if the user has filled it out and pressed "Log In" if (isset($_POST["username"]) && isset($_POST["password"])) { $manager = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["username"]); // filter everything but numbers and letters $password = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["password"]); // filter everything but numbers and letters // Connect to the MySQL database include "../storescripts/connect_to_mysql.php"; $sql = mysql_query("SELECT id FROM user WHERE username='$manager' AND password='$password' LIMIT 1"); // query the person // ------- MAKE SURE PERSON EXISTS IN DATABASE --------- $existCount = mysql_num_rows($sql); // count the row nums if ($existCount == 1) { // evaluate the count while($row = mysql_fetch_array($sql)){ $id = $row["id"]; } $_SESSION["id"] = $id; $_SESSION["manager"] = $manager; $_SESSION["password"] = $password; header("location: index.php"); exit(); } else { echo 'That information is incorrect, try again Click Here'; exit(); } } ?> User Login
<?php include_once("../template_header.php");?>

Please Login:

Username:


Password:



     <input type="submit" name="button" id="button" value="Log In" />
   
  </form>
  <p>&nbsp; </p>
</div>
<br />


<?php include_once("../template_footer.php");?>
[/php]

and this is the page it should redirect me to after logging in, index.php:

[php]<?php

session_start();
if (!isset($_SESSION[“manager”])) {
header(“location: user_login.php”);
exit();
}
// Be sure to check that this manager SESSION value is in fact in the database
$managerID = preg_replace(’#[^0-9]#i’, ‘’, $_SESSION[“id”]); // filter everything but numbers and letters
$manager = preg_replace(’#[^A-Za-z0-9]#i’, ‘’, $_SESSION[“manager”]); // filter everything but numbers and letters
$password = preg_replace(’#[^A-Za-z0-9]#i’, ‘’, $_SESSION[“password”]); // filter everything but numbers and letters
// Run mySQL query to be sure that this person is an admin and that their password session var equals the database information
// Connect to the MySQL database
include “…/storescripts/connect_to_mysql.php”;
$sql = mysql_query(“SELECT * FROM user WHERE id=’$managerID’ AND username=’$manager’ AND password=’$password’ LIMIT 1”); // query the person
// ------- MAKE SURE PERSON EXISTS IN DATABASE ---------
$existCount = mysql_num_rows($sql); // count the row nums
if ($existCount == 0) { // evaluate the count
echo “Your login session data is not on record in the database.”;
exit();
}
?>

Store Admin Area
<?php include_once("template_header_user_login.php");?>

hello this works



<?php include_once("template_footer_user_login.php");?>
[/php]

please help me figure out this error.

thankyou :slight_smile:

Hello lahsoona, I found that your using wrong php file in form action used for user login. You are using below code currently [php] //here you are using admin_login.php. i think this is used for check admin side user. which is working fine for you as you mention in your post. // think it should be as define below. [/php] I hope this will point you in right direction. Reply your feedback. ~~SR~~

lol I knew i missed something, just couldn’t figure out what

thanks a lot :slight_smile:

Hello lahsoona, it's really nice to see that your issue is resolve. :) ~~SR~~
Sponsor our Newsletter | Privacy Policy | Terms of Service