Diether Posted November 26, 2012 Share Posted November 26, 2012 (edited) Good day ,, can someone help me with this?.. i encounter this upon submission of username and password. it says that my object was not found. although i have it in my directory. thanks in advance. error: Object not found! The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error. If you think this is a server error, please contact the webmaster. Error 404 localhost Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7 the code use: //home.php <?php include("storeAdmin/admin_login.php"); doLogin() ?> //admin_login.php <?php function doLogin() { // if we found an error save the error message in this variable $errorMessage = ''; $userName = mysql_real_escape_string(!empty( $_POST['txtUsername'])) ? $_POST['txtUsername'] : '' ; $passWord = mysql_real_escape_string(!empty( $_POST['txtPassword'])) ? $_POST['txtUsername'] : '' ; // first, make sure the username & password are not empty if ($userName == '') { $errorMessage = 'You must enter your username'; } else if ($password == '') { $errorMessage = 'You must enter the password'; } else { // check the database and see if the username and password combo do match $sql = "SELECT id FROM user WHERE username = '$userName' AND password = '$password'"; $result = dbQuery($sql); if (dbNumRows($result) == 1) { $row = dbFetchAssoc($result); $_SESSION['plaincart_user_id'] = $row['id']; // log the time when the user last login $sql = "UPDATE user SET user_last_login = NOW() WHERE id = '{$row['id']}'"; dbQuery($sql); // now that the user is verified we move on to the next page // if the user had been in the admin pages before we move to // the last page visited if (isset($_SESSION['login_return_url'])) { header('Location: ' . $_SESSION['login_return_url']); exit; } else { header('Location:index.php'); exit; } } else { $errorMessage = 'Wrong username or password'; } } return $errorMessage; } ?> <html> <form id="form1" name="form1" method="post" action="admin_login.php"> <p align="center">username:<input type="text" name="txtUsername" id="username" /> </p> <p align="center">password:<input type="password" name="txtPassword" id="password" /> </p> <p align="center"> </p> </blockquote> <p align="center"> <input type="submit" name="log_in" id="log_in" value="Log in" /> </p> </form> </html> My folder structure: Edited November 26, 2012 by Diether Quote Link to comment Share on other sites More sharing options...
Christian F. Posted November 26, 2012 Share Posted November 26, 2012 That's a standard HTTP 404 error. Meaning that the web server was unable to find the document referenced in the URL you tried to visit. It has nothing to do with your PHP code, just that you tried to visit a page not found on the web server (in the specified location). Quote Link to comment Share on other sites More sharing options...
Diether Posted November 26, 2012 Author Share Posted November 26, 2012 (edited) ah i see.. i know now the error came from: localhost/online/admin_login.php which is not existed but my url location is to be like this: localhost/online/storeadmin/admin_login.php my question is where to put that in my code? how to be in that directory when i submit? Edited November 26, 2012 by Diether Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.