Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old March 25th, 2004, 04:47 PM
treelo treelo is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 121 treelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 28 m 39 sec
Reputation Power: 2
log-in script problem

iv got the following as a registeration script(there is more after but its not relevant)

php Code:
Original - php Code
  1. <?
  2. include("../connect.php");
  3.  
  4. /**
  5. * Returns true if the username has been taken
  6. * by another user, false otherwise.
  7. */
  8. function usernameTaken($username){
  9.    global $conn;
  10.       $username = addslashes($username);
  11.    }
  12.    $q = "select username from users where username = '$username'";
  13.    $result = mysql_query($q,$conn);
  14.    return (mysql_numrows($result) > 0);
  15. }
  16.  
  17. /**
  18. * Inserts the given (username, password) pair
  19. * into the database. Returns true on success,
  20. * false otherwise.
  21. */
  22. function addNewUser($username, $password, $email){
  23.    global $conn;
  24.    $q = "INSERT INTO users VALUES ('$username', '$password', '$email')";
  25.    return mysql_query($q,$conn);
  26. }
  27.  
  28. /**
  29. * Displays the appropriate message to the user
  30. * after the registration attempt. It displays a
  31. * success or failure status depending on a
  32. * session variable set during registration.
  33. */
  34. function displayStatus(){
  35.    $uname = $_SESSION['reguname'];
  36.    if($_SESSION['regresult']){
  37. ?>
  38.  
  39.  
  40. Thank you <b><? echo $uname; ?></b>, your information has been added to the database, you may now <a href="index.php" title="Login"><b>log in</b></a>.
  41.  
  42. <?
  43.    }
  44.    else{
  45. ?>
  46.  
  47. We're sorry, but an error has occurred and your registration for the username <b><? echo $uname; ?></b>, could not be completed.<br>
  48. Please try again at a later time.
  49. <?
  50.    }
  51.    unset($_SESSION['reguname']);
  52.    unset($_SESSION['registered']);
  53.    unset($_SESSION['regresult']);
  54. }
  55. if(isset($_SESSION['registered'])){
  56. /**
  57. * This is the page that will be displayed after the
  58. * registration has been attempted.
  59. */
  60. ?>


im getting the 'error has occured' message everytime i try and register someone for the site

i have managed to register 2 people in the past but it wont let me register anyone else

anyone have any clues why?

Reply With Quote
  #2  
Old March 29th, 2004, 03:56 AM
Nicky's Avatar
Nicky Nicky is offline
Contributing User
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: Neverland
Posts: 606 Nicky User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 3 m 26 sec
Reputation Power: 2
RE: log-in script problem

There is no if statement in your code - just the else ... could you please post the code again.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > log-in script problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT