OMG!I am geek
Posts: 55
366 credits Members referred : 0
« on: Jul 13, 2006, 06:33:20 pm »
Hi
I am new to the board and new to PHP. I was able to get your fantastic code to work in just an hour or so and seems to be working well. The question I have is the date field on the update_user_profile page. This field needs to be filled out each time that an update is made to the profile? It seems to also reset to blank when the page is re-entered. Is there a way of removing this field all together?
I also downloaded the latest version and if I do not put in the date, I get an "Undefined Offset" error within the Access_User_Class. I would hate to have the user get this error message each time.
Any help with this would be great. I think you script is fantastic and very happy that I found it. Thank you for offering your hard work to everyone
GMAN
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #1 on: Jul 13, 2006, 07:11:06 pm »
Hello,
yes, you need to fill all attributes of the update method but you can enter empty values if you don't a fiield:
OMG!I am geek
Posts: 55
366 credits Members referred : 0
« Reply #2 on: Jul 13, 2006, 08:02:36 pm »
Olaf
FANTASTIC!!!! Thank you very much. I still have to play around with all of the functions and I would like to add additional fields for Company Name etc.
Thank you again for the help GMAN
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #3 on: Jul 13, 2006, 10:46:56 pm »
Quote
I still have to play around with all of the functions and I would like to add additional fields for Company Name etc.
you got this working?
OMG!I am geek
Posts: 55
366 credits Members referred : 0
« Reply #4 on: Jul 14, 2006, 04:13:28 am »
I did get it to work by following your example. The only thing is that the date field, if entered, does not stay. So if I needed to make this a date of birth field, or another date, it is not saving
Also, I messed up the code by trying to add a field called "company" before the address field and it pushed all the data down. Each time I try to update the user profile, it increments that data down to the next field. This is just me messing around with the code. So if you know of a simple way that I can add another field like this, I would appreciate your assistance.
You sounded surprised that I YOU got it to work...nice job Olaf!!!! I appreciate it
GMAN
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #5 on: Jul 14, 2006, 08:56:36 am »
I used this script in several projects with and without the profile table.
inside the update profile example there are regular formfields used or a custom function to build the formelement.
If you place only a regular formfield into the form you need to take care about the value. Maybe this will help you too:
Locate the method for the update inside the class extension and echo the sql string, then you will see what value is wrong. Check also the order of all arguments used by the method / function.
OMG!I am geek
Posts: 55
366 credits Members referred : 0
« Reply #6 on: Jul 14, 2006, 06:29:06 pm »
I was planning on trying to use the same progamming method that you have used by using the echo command to create the additional fields that I need...i.e. Company Name
But my question is where you have within the update_user_profile.php
Code:
$update_profile->save_profile_date($_POST['id'], $_POST['language'], $_POST['company'], $_POST['address'], $_POST['postcode'], $_POST['city'], $_POST['country'], $_POST['phone'], $_POST['fax'], $_POST['homepage'], $_POST['notes'], $_POST['field_one'], $_POST['field_one'], "my_date"); // note the last trailing string, this used to optimize the value as a euro date.
Does the order here have to match this code below?
Code:
<?php echo $update_profile->create_form_field("company", "Company Name:"); echo $update_profile->create_form_field("address", "Address:"); echo $update_profile->create_form_field("postcode", "Postcode:", 10); echo $update_profile->create_form_field("city", "City:"); echo $update_profile->create_country_menu("country", "Country:"); echo $update_profile->create_form_field("phone", "Phone:"); echo $update_profile->create_form_field("fax", "Fax:"); echo $update_profile->create_form_field("homepage", "Homepage:"); echo $update_profile->create_text_area("notes", "Some text..."); // You have to use the same field like the variable in the class echo $update_profile->create_form_field("field_one", "Userfield 1:"); echo $update_profile->create_form_field("field_two", "Date dd-mm-yyyy: ", 10); echo $update_profile->language_menu("Language"); ?>
Does any other file need to be updated with the new fields that are to be added?
OMG!I am geek
Posts: 55
366 credits Members referred : 0
« Reply #7 on: Jul 14, 2006, 08:02:33 pm »
Olaf
I was able to successfully figure it all out. Adding the company field prior to address was added to both the update_user_profile and the ext_user_profile files...no errors received and all fields are saved upon exit and re-entry into the user profile table
Thanks for the help with this
GMAN
OMG!I am geek
Posts: 55
366 credits Members referred : 0
« Reply #8 on: Jul 14, 2006, 08:55:07 pm »
I guess I spoke too soon ;-)
I wiped all of my data in the SQL DB and went to register a new user...all of that went fine, until I tried to update the user profile, I get the error
Column count doesn't match value count at row 1
Any ideas?...I had read something about the NOW() function may not work all the time? Just a thought
Thanks
OMG!I am geek
Posts: 55
366 credits Members referred : 0
« Reply #9 on: Jul 14, 2006, 09:04:34 pm »
Sorry to keep posting but I think I may have found out the problem...it seems to work now
Within the ext_user_profile file, for each field that is added, You have to also update this section by adding %s
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #12 on: Jul 15, 2006, 12:38:26 am »
... this code is the original version? is there something wrong (that you have changed)?
and keep posting, everything what you ask is helpfull for other people
OMG!I am geek
Posts: 55
366 credits Members referred : 0
« Reply #13 on: Jul 15, 2006, 02:31:25 am »
For the most part it is the actual code. But I added the COMPANY field before Address field. I added it wherever I could but I was getting the insert error because I had forgotten to add the %s for the COMPANY field on this line of code before the NOW()
$sql = sprintf("INSERT INTO ......
So if anyone should try to add fields, don't forget you have to place the %s for each field to be inserted
Now I have to figure out how to make this login.php 128bit secure...any ideas?
I have a folder called "clients" that is password protected, but I do not want them to have access unless their secrity level is set to a min of 5
Thanks Olaf
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #14 on: Jul 15, 2006, 08:18:35 am »
Quote
For the most part it is the actual code. But I added the COMPANY field before Address field. I added it wherever I could but I was getting the insert error because I had forgotten to add the %s for the COMPANY field on this line of code before the NOW()
don't change the code, just use the TBL_USERFIELD_1 values (there are 4)
Quote
Now I have to figure out how to make this login.php 128bit secure...any ideas?
I didn't used the class on a ssl server until now, is this what you want to do?
Quote
I have a folder called "clients" that is password protected, but I do not want them to have access unless their secrity level is set to a min of 5
please start a new thread about this
OMG!I am geek
Posts: 55
366 credits Members referred : 0
« Reply #15 on: Jul 15, 2006, 10:37:16 pm »
Thanks Olaf
As I am still learning this code and PHP all together, it is fun to change the code ;-) But I will certainly keep that in mind to use those 4 fields.
I would like the username/password on SSL but not sure how to go about doing that. I am still investigating it. Do you have any suggestions?
Thanks again
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6691
34714 credits Members referred : 374
It's time to use PHP5!
« Reply #16 on: Jul 16, 2006, 10:57:20 am »
Quote
As I am still learning this code and PHP all together, it is fun to change the code ;-) But I will certainly keep that in mind to use those 4 fields.
Right this is fun but never modify classes, think about later updates, try to write extensions of a class (this is really fun )
Quote
I would like the username/password on SSL but not sure how to go about doing that. I am still investigating it. Do you have any suggestions?
I have not really an idea, but start a post about how to use SSL with php in the general php forum here...
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=3264