Bill Cosby is my Father
Gender:
Posts: 4
28 credits Members referred : 0
Happy with what you have to be happy with.
« on: Nov 13, 2006, 11:12:38 PM »
Hi Olaf-
Thanks for sharing your work! I have implemented this class in my application, but I seem to be stuck on one small thing. When a user registers, the confirmation message is sent and that works with no problem.
The problem is when the user follows the link and comes back to the login.php, the page is blank. From my testing I can see that the account IS getting activated. If I refresh the page, then the login.php page shows up fine, but displays the message"There is no account to activate."
Funny thing I just tried while typing this in. If I copy delete some characters from the validation string and then load that, the login page shows fine with the "Sorry, this activation key is not valid!" message.
It seems like this only fails for me when the activation is success.
I have all of this loaded to my test server if you would like to have a look. http://kram.crimsonenterprises.com Most of the links don't work yet, but you can try to register.
Thanks for having a look!
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6486
39748 credits Members referred : 374
It's time to use PHP5!
« Reply #1 on: Nov 13, 2006, 11:22:51 PM »
Hi,
this row is wrong: $my_access->send_confirmation = true;
$my_access = new Access_user; $my_access->login_reader(); // $my_access->language = "de"; // use this selector to get messages in other languages if (isset($_GET['activate']) && isset($_GET['ident'])) { // this two variables are required for activating/updating the account/password $my_access->auto_activation = true; // use this (true/false) to stop the automatic activation //$my_access->send_confirmation = true; $my_access->activate_account($_GET['activate'], $_GET['ident']); // the activation method } if (isset($_GET['validate']) && isset($_GET['id'])) { // this two variables are required for activating/updating the new e-mail address $my_access->validate_email($_GET['validate'], $_GET['id']); // the validation method } if (isset($_POST['Submit'])) { $my_access->save_login = (isset($_POST['remember'])) ? $_POST['remember'] : "yes"; // use a cookie to remember the login $my_access->count_visit = true; // if this is true then the last visitdate is saved in the database $my_access->login_user($_POST['login'], $_POST['password']); // call the login method } $error = $my_access->the_msg; ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script type="text/javascript" language="javascript" src="js/md_stylechanger.js"></script> <script type="text/javascript" src="js/iehover-fix.js"></script> <title>Login</title> <link rel="stylesheet" type="text/css" href="style/style.css" media="screen" />
<!-- Notice! you have to change this links here, if the files are not in the same folder --> <p>Not registered yet? <a href="./register.php">Click here.</a></p> <p><a href="./forgot_password.php">Forgot your password?</a></p> </div><!-- close homebox div-->
</div><!-- close left div--><div class="homeBoxBottom"> </div><br /> </div>
</body> </html>
Thanks! ~ Scott
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6486
39748 credits Members referred : 374
It's time to use PHP5!
« Reply #3 on: Nov 13, 2006, 11:49:28 PM »
what happens if you use the orig. login file with the ORIGINAL class file?
I'm wondering why you used this wrong row, thats not documented somewhere...
Bill Cosby is my Father
Gender:
Posts: 4
28 credits Members referred : 0
Happy with what you have to be happy with.
« Reply #4 on: Nov 14, 2006, 12:08:59 AM »
I can see why you would wonder that. It was just a dumb mistake by me. I read the code too quickly and thought that send_confirmation was something I could set.
I have made very few modifications to access_user class, only to add new fields to user registration. Here is my activate_account function:
Code:
function activate_account($activate_key, $key_id) { if ($activate_key != "" && strlen($activate_key) == 32 && $key_id > 0) { $this->id = $key_id; if ($this->check_user("active")) { if ($this->auto_activation) { $upd_sql = sprintf("UPDATE %s SET active = 'y' WHERE id = %s AND MD5(pw) = '%s'", $this->table_name, $key_id, $activate_key); if (mysql_query($upd_sql)) { if ($this->send_confirmation($key_id)) { $this->the_msg = $this->messages(18); } else { $this->the_msg = $this->messages(14); } } else { $this->the_msg = $this->messages(19); } } else { if ($this->send_mail($this->admin_mail, 40, 39)) { $this->the_msg = $this->messages(36); } else { $this->the_msg = $this->messages(14); } } } else { $this->the_msg = $this->messages(20); } } else { $this->the_msg = $this->messages(21); } }
Bill Cosby is my Father
Gender:
Posts: 4
28 credits Members referred : 0
Happy with what you have to be happy with.
« Reply #5 on: Nov 14, 2006, 12:39:30 AM »
I AM AN IDIOT
Reading your reply got me to thinking... .o O (Wait a minute, why didn't I get a confirmation message back after account activation?)
This project is not one I work on every day. I often go weeks at a time without touching it. Anway, a few weeks ago I was working on this and was having problems with the send mail functions so I replaced them with send_smtp_mail.
In one line in the send_confirmation function I had an extra _ character, making the call to send__smtp_mail instead.
I corrected my mistake and
I'm VERY sorry to have wasted your time and thanks for your prompt response.
~ Scott
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6486
39748 credits Members referred : 374