Date is set to 01-JAN-1970 upon registration

Mod that adds a birthday field to the users profile, theire age are displayed beside the posts, and on there birthday they will have a greeting popup
Forum rules
The content in this forum is dated Dec. 21 2005 and can be used as Archive only. This Forum is LOCKED and READ ONLY !

Date is set to 01-JAN-1970 upon registration

Postby passerby on Mon 28. Apr, 2003 06:29

I am running into some problem here with the birthday mod, I would appreciate some help with it. I've spent too much time trying to figure this out, I have gone over and over and over the install document, and I cannot find the problem.

When I register as a new user, and enter a birthday, it stores it in the database as 01-JAN-1970. I can later go into and edit my profile to the proper date and it stays. I understand there is a problem with my line, but I don't know what it is. I have tried moving the fields around, etc with no luck.. PLEASE HELP ME BEFORE I GO INSANE.. Thanks :D


Here is how the data looks, pulled from MySQL and formatted in Excel. http://www.thaltech.com/Page.htm

=======The Insert Line========

$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_gender, user_level, user_allow_pm, user_birthday, user_next_birthday_greeting, user_active, user_actkey)
VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popuppm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, '$gender', '$birthday','$next_birthday_greeting', 0 ,1,";

=======(EOL)========
passerby
Poster
Poster
 
Posts: 1
Joined: Mon 28. Apr, 2003 05:35

Postby kooky on Mon 28. Apr, 2003 22:52

Check your usercp_register.php
You added a wrong line or missed a part ?
kooky
brilliant supporter
 
Posts: 1329
Joined: Tue 31. Dec, 2002 17:52
Location: Au pays des rêves

Postby jobbesat on Tue 29. Apr, 2003 16:51

I think this is a problemwhich deserves a bit more attention. I don't think he missed something, for exmaple i have the same problem but I didn't miss anything at all, i'm using this mod since 2.0 and I always had the same problem and I still have it :(
The problem comes when you install something else, another mod which involves usercp_register file, for example mass_pm mod, but even custom_title mod which is not by Niels. In this "stage", if i would resolve the problem, I should deinstall all mods and reinstall keeping birthday mod as last to install. Does it not exist an easy way to solve this problem? Because I'm sure every users who installed this mod first or then will have the same problem as soon as they would install another mod.
If you have the time, can you please take a look here?
As you can see, if you look @code changes in part 1 of birthday mod, there are lines which I added for other mods and now I have the problem; I have a gut feeling it should be mass_pm mod which created a bit of caos.
Only when you have time and thanks a lot in advance kooky :)

Tuck
jobbesat
Special supporter
 
Posts: 191
Joined: Tue 07. May, 2002 16:21

Postby kooky on Tue 29. Apr, 2003 20:20

i have not the time to check all your file
but before adding a mod i test it a lot a check all functions to be sure it works

For birthday mod, the better thing is to add it as first, then install other mods after birthday code

you should try to add this line after birthday code:
Code: Select all
   // Verify the user is allowed to alter their custom title.  If not, replace it with their old one.
   if ($custom_title_activated == FALSE)
   {
      $custom_title = addslashes($userdata['user_custom_title']);
   }

   // Check the length of the custom title.  Prevents people from editing the HTML to get a longer one.
   if (strlen($custom_title) > $board_config['custom_title_maxlength'])
   {
      if ($custom_title != addslashes($userdata['user_custom_title'])) {
         $custom_title = addslashes($userdata['user_custom_title']);
         $error = TRUE;
         if (isset($error_msg)) $error_msg .= '<br />';
         $error_msg .= $lang['Custom_title_toolong'];
      }
   }


i have over 50 to 60 mods added to my phpBB, and not any problem with all mods (OK i 've not installed Mass PM :roll: so i can't test it )
kooky
brilliant supporter
 
Posts: 1329
Joined: Tue 31. Dec, 2002 17:52
Location: Au pays des rêves

Re: Date is set to 01-JAN-1970 upon registration

Postby warmweer on Tue 29. Apr, 2003 21:26

passerby wrote:$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_gender, user_level, user_allow_pm, user_birthday, user_next_birthday_greeting, user_active, user_actkey)
VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popuppm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, '$gender', '$birthday','$next_birthday_greeting', 0 ,1,";


OK, the problem (at least the easily identified one) is in the order of the variables in the SQL.

Aftre messing up my own installation once I decided the reference point should be the 0,1 (at the end of the Values section). This 0 , 1 references user_level and user_allow_pm.

So the last part(s) of the SQL should have the following order (start after the gender part) (first the field name, then the variable)

user_level, >>>>>>>> 0
user_allow_pm, >>>>>> 1
user_birthday, >>>>>>>> '$birthday'
user_next_birthday_greeting, >>>>>>> '$next_birthday_greeting'
user_active, >>>>>> nothing is necessary here
user_actkey >>>>>> nothing is necessary here

I suggest you check the order of the other fields also (and probably also the UPATE SQL.

I have a feeling this is the most common error when installing the mod (which by the way works perfectly). The order is very important (and watch out when modding and repositioning the 0 , 1 - , just imagine setting user_active = 0 and user_actkey = 1 :lol: .

BTW One the fastest way of finding out where things have gone wrong is to open the database (use phpMyAdmin) and look at the field user_birthday. If you find a whole series of similar or equal values there, the insert or update is surely wrong.

Good luck
A bug is a feature which didn't make it to the manual
warmweer
Poster
Poster
 
Posts: 25
Joined: Mon 10. Feb, 2003 21:55
Location: Belgium

Re: Date is set to 01-JAN-1970 upon registration

Postby Magik on Wed 30. Apr, 2003 05:42

warmweer wrote:
passerby wrote:$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_gender, user_level, user_allow_pm, user_birthday, user_next_birthday_greeting, user_active, user_actkey)
VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popuppm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, '$gender', '$birthday','$next_birthday_greeting', 0 ,1,";


OK, the problem (at least the easily identified one) is in the order of the variables in the SQL.

Aftre messing up my own installation once I decided the reference point should be the 0,1 (at the end of the Values section). This 0 , 1 references user_level and user_allow_pm.

So the last part(s) of the SQL should have the following order (start after the gender part) (first the field name, then the variable)

user_level, >>>>>>>> 0
user_allow_pm, >>>>>> 1
user_birthday, >>>>>>>> '$birthday'
user_next_birthday_greeting, >>>>>>> '$next_birthday_greeting'
user_active, >>>>>> nothing is necessary here
user_actkey >>>>>> nothing is necessary here

I suggest you check the order of the other fields also (and probably also the UPATE SQL.

I have a feeling this is the most common error when installing the mod (which by the way works perfectly). The order is very important (and watch out when modding and repositioning the 0 , 1 - , just imagine setting user_active = 0 and user_actkey = 1 :lol: .

BTW One the fastest way of finding out where things have gone wrong is to open the database (use phpMyAdmin) and look at the field user_birthday. If you find a whole series of similar or equal values there, the insert or update is surely wrong.

Good luck


Now all i have to say.....is flipping THANKS man.

You are golden, and that just fixed the problem that "I" was having. i been fighting with the usercp_register file for a long time......i got it working the same way that passerby did.......and i been keeping an eye on a couple of posts similar to this one. you rock!

That was the easiest thing to fix, once it was actually broken down to what goes where, and what points to what.

I got a good grip on the coding portion, but i never thought that the last two entries werent neccesray.....thanks thanks thanks.....!!!

THANKS AGAIN!!!
User avatar
Magik
Poster
Poster
 
Posts: 18
Joined: Mon 14. Apr, 2003 20:23

Postby jobbesat on Wed 30. Apr, 2003 17:16

Hope someone can help in solve my problem too; when you have 30/40 new users per day, let's figure what I will have on index.php on January 1st 2004 :P
Users with a birthday today: ~ 5000 usernames!!!
Well, you could reply, just remove the changes on index_body.tpl for a day and it's done. you're right, but if I can solve the problem I would feel better.
Thanks a lot in advance and anyway dudes.

Tuck
jobbesat
Special supporter
 
Posts: 191
Joined: Tue 07. May, 2002 16:21

Postby warmweer on Thu 01. May, 2003 19:54

jobbesat wrote:Hope someone can help in solve my problem too; when you have 30/40 new users per day, let's figure what I will have on index.php on January 1st 2004 :P


Well, for one you could ask your users to enter their correct birthday again, probably won't have much success with that though :cry:

Another workaround would be to run an SQL changing all birthdays on Jan 1rst to 1 Februari or something, and after Jan 1 run anther SQL setting all those birthdays back.

Personally I think it's not worth the trouble... although for 5000 users (hopefully not all having a birthday on Jan 1) I would probably make a new group ("WRONG AGE"), add all those with birthday 1 jan 1970 and exclude them from the birthdaylist (just a check on user_id if it belongs to that group). When a member corrects his birthday just remove him from the group.

But, with 30/40 new users each day, I hope the birthday is registered correctly. :roll:
A bug is a feature which didn't make it to the manual
warmweer
Poster
Poster
 
Posts: 25
Joined: Mon 10. Feb, 2003 21:55
Location: Belgium

Next

Return to Birthday [2.0.10/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron