Jump to content

White_Lily

Members
  • Posts

    531
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by White_Lily

  1. If i wanted the password to be hashed i would of asked how to, but thats not what im asking - im asking why is it only letting the first user login and no other user? >_>
  2. New problem found with logging in. With the code I have, it only only allows the first user in the database to login, when ever a different user tries to login it days for them to go back and enter a valid username. The username & password I entered were valid because I copied and pasted them from the database.
  3. Doesn't having 2 queries break the script and show a 500 error? or thats what happens whenever ive done 2 queries in one script...
  4. Hi, I want to do a registration form where once submitted will go to "register_handler.php" which will check and insert all the information entered in the form prior to this page. I was wondering how I go about doing 2 SQL queries in one script?
  5. this is iwhat is in my php.ini file at the moment: error_reporting = -1 display errors = On upload tmp dir = /tmp/
  6. If session_register() can't be used, what else do i use? In the php.ini file how do i turn on error reporting?
  7. The little guy: The connection is brought in further up the page in the header - this works as the other pages are fine with the connection. PFM: Read my original question AGAIN and you will see ive already tried error reporting >_>
  8. Try replacing "===" with "==" i think you may have to many equal signs when your checking to see if one is equal to another.
  9. Okay - so i wrote a login script for a site im building. However when you click "Login" it goes to a login-handler.php script, which seems to only show an Internal Server Error 500. I've tried using error checking to no success as it still shows the same screen. I'm hoping someone will be able to tell me what I have done wrong. <?php $log_user = $_POST["username"]; $log_pass = $_POST["password"]; if(empty($log_user)) { die "Please go back and fill in your username."; } if(empty($log_pass)) { die "Please go back and fill in your password."; } $sql = "SELECT * FROM users"; $res = mysql_query($sql); if(mysql_num_rows($res) != 0) { $row = mysql_fetch_assoc($res); $dbuser = $row["username"]; $dbpass = $row["password"]; if($log_user != $dbuser) { echo 'Please go back and enter a valid username.'; } if($log_pass != $dbpass) { echo 'Please go back and enter a valid password.'; } if($log_user == $dbuser && $log_pass == $dbpass) { session_register($log_user); session_register($log_pass); header("Location: index.php"); } } else { echo "There doesn't appear to be any users in the database."; } ?>
  10. im just saying it may be worth searching the web for a different hashing method, never know - the different one may even be better
  11. Ive read through this quite carefully and like you i can't see any errors, however the script does look a bit awkward in the way of proccessing - maybe try searching the web for a pre-built secure login system, and just modify it to suit your needs - you may even find videos on youtube which you can follow, this way your learning to.
  12. Anyway - a few errors poped up with your code, however i fixed them and my problem is solved. Fixed code: <?php include "sql/conf.php"; include "sql/connect.php"; $page = "Welcome"; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[url=http://www.w3.org/TR/html4/loose.dtd]http://www.w3.org/TR/html4/loose.dtd[/url]"> <html> <head> <title><?php echo $GLOBALS["siteName"]." - ".$page; ?></title> <link rel="stylesheet" type="text/css" href="css/main.css"> <link rel="stylesheet" type="text/css" href="css/sub-css.css"> <link rel="stylesheet" type="text/css" href="css/tags.css"> </head> <body> <div class="wrapper"> <div class="header"> <div class="head"> <img src="images/logo.png" alt="HTML Bites Logo"> <> <> <div class="sub-wrapper"> <div class="navigation"> <div id="navigation"> <a href="index.php">Home</a> <a href="#">News</a> <a href="#">Gallery</a> <a href="#">Tutorials</a> <a href="#">Downloads</a> <a href="#">Contact</a> <> <> <div class="content"> <div class="center-column"> <?php //$page_name = $_POST['page']; $sql = 'SELECT * FROM pages WHERE title = "'.$page.'"'; $res = mysql_query($sql); while($row = mysql_fetch_assoc($res)) { $title = $row["title"]; $content = $row["content"]; echo "<h1>".$title."</h1>"; echo $content; } if(mysql_num_rows($res) == 0) { echo "<h1>Oops...</h1>"; echo "<p>This page doesn't appear to exsist!</p>"; echo "<p>Use the 'Quick Contact' box to contact the webmaster and tell them about the page you are requesting.</p>"; } ?>
  13. my $page variable is always defined before the doctype, this way i can use it in the pages <title> tags.
  14. wont "$_POST["page"]" only work if there was a form prior to this line?
  15. the connection is established in "connect.php". thanks premiso the page is now displaying however its is now echoing the "else" statement - the rows that were specified do actually exsist in the database. and they have content. http://tutorials.janedealsart.co.uk <-- This is the "else" statement im getting.
  16. Hi, I made a bit of code that would get a pages title and content from a database, however every time i put this bit of code into the file, and upload that file, i then get an "Internal Server Error (500)". Whereas if i take the code out, and uplaod the file - the webpage is fine? <?php $sql = "SELECT * FROM pages WHERE title = '$page'"; $res = mysql_query($sql); if($row = mysql_fetch_assoc($res) { $title = $row["title"]; $content = $row["content"]; echo "<h1>".$title."</h1>"; echo $content; } else { echo "<h1>Oops...</h1>"; echo "<p>This page doesn't appear to exsist!</p>"; echo "<p>Use the 'Quick Contact' box to contact the webmaster and tell them about the page you are requesting.</p>"; } ?> Not sure where ive gone wrong.
  17. i don't remember saying anything about column-width >_> i said try setting heights: e.g: "min-height: px;" and "height: auto;" <-- nothing there about column-width >_>
  18. Forget this - I managed to find a different way to do it.
  19. Hi, I have written some code that once the form prior to this page is completed and submitted should update the users password. Problem im having is that everytime i submit the form for testing, it comes up with a blank page, which is usually a Internal Server Error 500. However i cannot see where the code has gone wrong! Any help appreciated. <div class="form_form"> <?php $old = $_POST["old"]; $new = $_POST["new"]; $conf = $_POST["conf"]; if(!$user && !$pass) { echo "You need to be logged in to change any passwords."; } else { $sql = "SELECT * FROM members WHERE password = '$old'"; $res = mysql_query($sql); $row = mysql_fetch_assoc($res); if($old != $row["password"]) { die "The old password you provided did not match the database, go back and try again."; } if($new != $conf) { die "The new passwords you entered did not match each other, go back and try again."; } $sql = "UPDATE members SET password = '$new' WHERE password = '$old'"; $res = mysql_query($sql); if(!$res) { die "Could not update your password. Error: ".mysql_error(); } else { echo "You password has been changed."; } } ?> </div>
  20. I can only answer the first question, i dont tend to work with mobile devices so the second question is out of my knowledge. as for the width of the sub-nav, try setting the width to something like 100-150px, and set the height to auto, this way anything longer should just stretch to two lines.
  21. I dont like using blob. i tend to use VARCHAR in phpMyAdmin, and it works fine for me. and from what my code is the php is pretty simple, although im using the code for avatars and banner images. What i do is store the image in a directory, and the filename in the database.
  22. okay - simple thing to solve. In the CSS file replace "float:left;" with: margin: auto;
×
×
  • 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.