Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. Login with the user ID of 1 using the password test and post the output of this script again. What the script does here is reset the password for the user ID of 1 to the md5 hash of test which is 098f6bcd4621d373cade4e832627b4f6
  2. The file you linked to here: http://sd52gop.internetkeep.net/test/session.php is displaying what is known as the BOM character save session.php as ASCII (or UTF-8 without BOM) and sessions will work as normal.
  3. The following error can be a problem httpd.exe: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName Open Apaches httpd.conf and find a line that starts with ServerName. Make sure it reads ServerName localhost:80 Save the httpd.conf and restart Apache.
  4. What are your versions of Apache. Xdebug is compatible with certain API versions. I have Apache2.2.11 and PHP5.2.8 xdebug (v5.2VC9) works for me
  5. run phpinfo() and post what the Loaded Configuration File line reads.
  6. variables are only parse able within double quotes.
  7. refresh.php has nothing to do with Apache. refresh.php is used to build the WAMP tray menu. Also I think the log you where seeing was the php_error.log make sure you was loading Apaches error log.
  8. You restarted Apache I am only following the installation instructions here
  9. You dont need to add php_xdebug.dll to the extension= list you only need to add the block of configuration that you added. Make sure zend_extension_ts= points to the dll file you just downloaded After making changes to the php.ini restart your http server. Also as you're using php5.2.x you should of downloaded 5.2 VC6 not 5.3 VC9
  10. Okay try this. Create a new php file with the following code and run it only once. <?php if(isset($_GET['run'])) { die('password reset'); } mysql_query("UPDATE `clients` SET `password`='".md5('test')."' WHERE `ID`=1"); header('Location '.$_SERVER['PHP_SELF'].'?run'); ?> That will reset the the password for the user ID 1. Try your login code again if it works. Then it means either you used a different password when you added the first user or there is problem with the code that adds the user to clients table.[/code]
  11. When wamp is running in Offline mode it means it'll only accept connections from the ip address 127.0.0.1 (which is what localhost resolves to). To allow connections from any ip address left click the WAMP tray icon and select Put Online If the icon is white then there are no problems. if its yellow then it means either a configuration issue or not all services are running (the only available services are Apache or MySQL). If its red then WAMP is not running
  12. Ok the passwords differ. The md5 for the password you used is 098f6bcd4621d373cade4e832627b4f6 however the encrypted password in your database is 44c7d73a1fa98c2302f2de67bd80ce95 which is completely different and thus your login is failing. Are you using the correct password for user ID 1? How do you insert users into the clients table, post your code here? the login script is working correctly its now to do with the data in your database that is wrong.
  13. have you got a programme called skype installed by chance? skype uses port 80 the same as Apache. Either disable/uninstall skype or configure Apache to use a port other than port 80. To do so left click the WAMP tray icon and select Apache > httpd.conf Scroll down and find Listen 80 Change 80 to 8080 Scroll down futher and find ServerName localhost:80 again change 80 to 8080 Save the httpd.conf and restart WAMP. To access WAMP go to http://localhost:8080/
  14. First check to see if there is nothing before the opening <?php tag, if there is nothing there then this error is normally caused because you're saving the file as UTF-8 encoding. Either save it as ANSII or UTF-8 without BOM these options should be available within your text editors save dialog.
  15. You'll have to detect them by the following escape characters \r\n windows \r mac \n *nix
  16. session_register and its counter part session_is_registered are depreciated. you should be using the newer $_SESSION superglobal variable. file1.php <?php session_start() // add a new item to the session array. $_SESSION['data'] = 'hello there'; ?> <a href="file2.php">Retrieve session</a> file2.php <?php session_start() // retrieve the data item from the session array echo $_SESSION['data']; ?>
  17. We'll try debugging your script <?php session_start(); include 'config.php'; if(isset($_GET['login']) && $_GET['login'] == "login") { echo 'Attempting login...<br />'; if(!isset($_POST['username_post'], $_POST['password_post'])) { echo "<b>Error: Username and password required for login</b>"; exit; } echo 'Username/Password provided...<br />'; echo '<pre>$_POST data:<br />'.print_r($_POST, true).'</pre>'; echo 'User: ' . $_POST["username_post"] . '<br />'; $user = mysql_real_escape_string($_POST["username_post"]); echo 'Password: '.$_POST["password_post"] .'<br />'; echo 'MD5 Password... '; // the password will not need to be `escaped` as md5 only returns a 32bit encrypted alphanumeric string (lettters and digits). $pass = md5($_POST["password_post"]); echo $pass.'<br />'; echo 'Perform query... '; $qry = "SELECT * FROM `clients` WHERE ID='$user' AND password='$pass' LIMIT 1"; echo '<pre>'.htmlentities($qry, ENT_QUOTES).'</pre>'; $sql = mysql_query($qry); echo '<br />Query succesfully executed<br />'; echo 'Results:'; if(mysql_num_rows($sql) == 1) { $result = mysql_fetch_assoc($sql); echo '<pre>'.print_r($result, true).'</pre>'; $ID = $result["ID"]; $_SESSION['session_username'] = $ID; $_SESSION['session_level'] = $result['level']; $_SESSION['session_ip'] = $_SERVER['REMOTE_ADDR']; // Disabled redirect //echo "<meta http-equiv=\"refresh\" content=\"0;url=clients.php?action=edit$ID\">"; //exit; echo "Redirect disabled, click to <a href=\"clients.php?action=edit$ID\">Continue...</a>"; } else { echo "<b><u>Error: The Username/Password Incorrect<br></u></b>"; /* DEBUGGING */ echo 'OK lets debug it!.<br />'; echo 'Perform query... '; $qry = "SELECT * FROM `clients` WHERE ID='$user'"; echo '<pre>'.htmlentities($qry, ENT_QUOTES).'</pre>'; $sql = mysql_query($qry); echo '<br />Query succesfully executed<br />'; echo 'There are '.mysql_num_rows($sql).' with the ID `'.$user.'`<br />'; echo 'Results:'; if(mysql_num_rows($sql) == 1) { $result = mysql_fetch_assoc($sql); echo '<pre>'.print_r($result, true).'</pre>'; echo 'Comparing password... '; if($result['password'] == $pass) echo 'OK'; else { echo 'FAIL'; echo '<br />'.$pass.' ($pass) '.strlen($pass).'<br />'.$result['password'].'($result[password]) '.strlen($result['password']); } } } } ?> All ive done is added some echo statements which just spits out messages so we know whats going on whiles the scripts executes. Post the results here when done.
  18. Click reply button followed by clicking the Addition Options link under the reply box.
  19. No need for that. We just got to debug your script. How are you storing your passwords in your database? Are they plain text or encrypted. if they're plain text then your script will not work as your login script is encrypting the users password and comparing it to a non-encrypted password in the database. All you need to fix it is encrypt the passwords in your database which can be archived simply
  20. So the user has to enter his/her ID in to the Username field? for example 11024 .If so then your code should work. EDIT: Whos code are you using? My cleaned up version or your current code here. If you're using the code from that post then I just noticed something, this line: if(mysql_num_rows($sql)!= 0) { exit; } Will cause your script to stop if the username/password do match. You should change != 0 to == 0
  21. yes but attach the file to your post by clicking the Reply button. (bottom right of advertisement below).
  22. Prehaps attach common.php and we'll post suggestions on how to make your code cleaner/more efficient.
  23. I think you need to setup a field in your table to hold the usernames. Currently you're comparing the username the user enters to the ID field in your table. Is this how its supposed to be?
  24. Do: if($contents = file_get_contents('path.to.file')) { // do something with $contents } else { // display error message }
  25. The size of the file (as in filesize or number of lines) has no affect on server load. However its the efficiently of the code that will have an affect. What do you have going on in common.php? Maybe there is something in there which is causing unnecessary load on the server.
×
×
  • 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.