Jump to content

Daryl B

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Daryl B's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi All, on my 'Register Member Page', if a user successfully fill's in all the fields, then they get sent to a new page where it say's "You have successfully Registered" if( (!$fname == null) or (!$sname == null) or (!$email == null) or (!$username == null) or (!$password == null)) { $query = "INSERT INTO members (Firstname, Surname, email, username, password) VALUES('$fname', '$sname', '$email', '$username', '$password')"; mysql_query($query) or die(mysql_error()); mysql_close(); echo "You have successfully Registered"; } endif; What i wanted to do was show this page for about 10 seconds then, the user gets automatically directed to the login page. Any information is great. Many thanks :-\
  2. Regarding the if constructs in PHP: I have just learnt myself using Mike McGeth's PHP5 book and the net. It must be a valid syntax as it does work. Which part of the code did pick up on the syntax issue? I have sorted the orginal issue, thanks. You post helped.
  3. Hey, cant seem to get it working: this is my code: <?php session_start(); include('db.php'); if(isset($_POST['submit'])) : // Check if the form has been submitted. // Username and password sent from signup form // First we remove all HTML-tags and PHP-tags, then we create a sha1-hash $username = strip_tags($_POST['username']); $password = sha1(strip_tags($_POST['password'])); // Make the query a wee-bit safer $query = sprintf("SELECT ID FROM members WHERE username = '%s' AND password = '%s' LIMIT 1;", mysql_real_escape_string($username), mysql_real_escape_string($password)); $result = mysql_query($query); if(1 != mysql_num_rows($result)) : // MySQL returned zero rows (or there's something wrong with the query) header('Location: index.php?msg=login_failed'); else : // We found the row that we were looking for $row = mysql_fetch_assoc($result); // Register the user ID for further use $_SESSION['member_ID'] = $row['ID']; header('Location: members-only.php'); endif; endif; if( ($username == null) or ($password == null) ) {header("location:index.php"); exit();} ?> Edited by SA: Please use the [code][/code] tags!
  4. cheers guys. I will give this a go and let you know how i get on. Looks good though
  5. Hi Guys, I have Index.php which contains the HTML form with a username and password field + submit button, action: is my check.php. Say for example the user only input's a username and miss out the password field; when he clicks the submit button. I want the same page to be refreshed with a error message appearing below the submit button saying "error, please fill all in". I can get this to display on another page. but want this to be on refereshed on the log-in page. If anyone can help that would be great. Thanks ???
×
×
  • 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.