Page 1 of 1

problem with using define() in php

Posted: Thu Aug 27, 2009 7:20 am
by insight
I have the following code:

Code: Select all

define("TBL_USERS", "insight_users");
define("TBL_ACTIVE_USERS",  "insight_active_users");
define("TBL_ACTIVE_GUESTS", "insight_active_guests");
define("TBL_BANNED_USERS",  "insight_banned_users");
And in my database I have the following tables:

insight_user
insight_active_users
insight_active_guests
insight_banned_users

I am creating a login script (well I got one online and am simply modifying to suit my website) and when I register I get a Registration Failed which can be seen in this line of code here:

Code: Select all

else if(isset($_SESSION['regsuccess'])){
   /* Registration was successful */
   if($_SESSION['regsuccess']){
      echo "<h1>Registered!</h1>";
      echo "<p>Thank you <b>".$_SESSION['reguname']."</b>, your information has been added to the database, "
          ."you may now <a href=\"main.php\">log in</a>.</p>";
   }
   /* Registration failed */
   else{
      echo "<h1>Registration Failed</h1>";
      echo "<p>We're sorry, but an error has occurred and your registration for the username <b>".$_SESSION['reguname']."</b>, "
          ."could not be completed.<br>Please try again at a later time.</p>";
   }
   unset($_SESSION['regsuccess']);
   unset($_SESSION['reguname']);
}
Problem is is that the original code works perfectly fine and I don't know why my modified code isn't working. The only difference is the below code here:

Code: Select all

define("TBL_USERS", "users");
define("TBL_ACTIVE_USERS",  "active_users");
define("TBL_ACTIVE_GUESTS", "active_guests");
define("TBL_BANNED_USERS",  "banned_users");
and the database tables are:

users
active_users
active_guests
banned_users

As you can see I've changed very little of the code. Can someone be kind enough to help me. For more information on the login script I'm using you can find it here: http://www.evolt.org/node/60384

Re: problem with using define() in php

Posted: Thu Aug 27, 2009 8:40 am
by insight
Nobody has an answer :?: :(

Re: problem with using define() in php

Posted: Thu Aug 27, 2009 8:46 am
by Mark Baker
Start diagnosing this by echoing the sql query that you're running, to see if it really is what you expect