The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

I started development after the introduction of PHP 4.2. I have had a look at Kevin's article that he suggested (4.2 and after) but now I am totally confused as I have the previous example and the new example baffling me all over the place.

Don't worry you are not being thick, I rewrote the 'kev' script before he wrote his new article. The sad thing is I don't have a copy here at the moment - can you wait until monday? I basically re wrote kev script to work with php globals off etc, dead easy (although I will admit it took a while!!)

can you do anything else until then? or maybe flick register globals on in the php.ini to test and get the rest looking good and then I will pop back in Monday am with some help?

I would revamp the one you posted - BUT its friday night I am 1/2 way down a bottle of wine - and honestly can not really be bothered - is that ok? (us advisors are human after all )

at the top of the script. But it really should be recoded to handle it correctly. If you look at the article I mentioned earlier, you can pass an array to my getpost_ifset() function and register all the variables at once.

Sarah.. that's wonderful, thanks.. I can wait 'til Monday..in the meantime I have plenty to be getting on with! I hope you enjoyed your Friday night!! I don't drink but I enjoyed staying in and watching an old favourite which got me motivated for the gym tomorrow - Rocky 2!

sweatje.. thanks for your help, will look at that in the meantime.

Kevin.. thanks for your reply once again, I look forward to the updated article. Let me know when you have it done?

Trying it out..

Hi

I am trying out the newly updated article now.

When I run 'signup.php' I get the following error msg:

Warning: mail() [function.mail]: SMTP server response: 503 No recipient(s). in d:\inetpub\wwwroot\session_test\signup.php on line 130User registration successful!Your userid and password have been emailed to someaddresshere@somedomain.whatever, the email address you just provided in your registration form. To log in, click here to return to the login page, and enter your new personal userid and password.

Obviously since your using your local machine and you normally wouldn't have an email server, you'll get this message ? Upload the scripts etc to your web space and try again using a known valid email address instead. If not, then download an email server of your own and configure it Try www.mailenabled.com although at the moment the website has .htaccess so try again later to see if they're finished uploading their updates ? Note: it is not easy (I know from experience) to configure your own email server so you may as well use your ISP to access the mail() function, or sign up to an ISP with email access...

So far..

Hi

Yeah I love all of the Rocky series. Most people think that it's all about boxing but it isn't much really.. at least not the first three! I have the anthology on DVD.. pretty great! Damn, I wish I could play the new Rocky... (dreamland)

Anyway, I have gotten Kevin's great tutorial working. If you recall, my sign-up script goes along the following lines:

1. Firstly, is this sufficient for a sign-up script?
2. When the user enters ALL valid data, they are e-mailed their login details. Should I then make it that they are automatically logged in.. OR.. divert them to the index page to login?

Okay.. once I get this stuff a bit clearer, I will ask a bit more about sessions.

On a side note.. I love Sly movies too.. am a big fan in-fact!! Rocky is just the best! Love the films (mainly 1-3) and the soundtrack . I didn't know they made a Rambo 4? Agreed, Rambo 2 and 3 were not as good as First Blood.. that is a classic! However, Rambo 3 did have a good storyline in terms of showing the suffering of the Afghan people and then Rambo comes in to help with their uprise against the Russians. Ironic that Mr Bin-Laden was part of this 'uprising' that the US helped and later turned on! ![img]images/smilies/eek.gif[/img] [img]images/smilies/mad.gif[/img]

Okay, so for the sign-up script as I have it, I don't really need sessions then do I?

So once the user is signed up, they are diverted (or provided with a link as well as e-mail) to the login page (i.e. the main page of the site).

Now, for the main page of the site, apart from all the usual paraphernalia, I should provide them with a log-in section. Here, I need to iron out a query..

I have made it so that the user has a unique 'username'. Hence, should they log in with their username, or, should they log in with their e-mail? (Hence, implying, only one registration per e-mail?).

Umm... Generally though the email address is their username, no ? And this field (email) is UNIQUE. Helps if you provide a password as well... Remember to use SESSIONs in all your pages you want a user to have access to once they've signed in/logged in/whatever though...

Umm... First I'd change the start to something that actually checks to see if a session has previously been set it's self; and not through $_POST as you've done, ie:

PHP Code:

if(!isset($_SESSION['Email'])) {
$_SESSION['Email'] = '';
}
.

And then set this session to hold the email once the FORM has been submitted; although in your case you've used an IMG - does the script work before you used an IMG ? If not then remove the IMG with a normal SUBMIT button, which leads me to this to check for FORM submission;

Now, remember to have the session part on every page where you need the Email ? As to how and why your FORM isn't being submitted as is (ie using IMG) I don't know since I never use IMGs anyway for FORM submission... although I suspect from what I've read you need to give an x and y co-ord or x/y variable ? Not too sure there;

Anyway, remove the IMG with a normal SUBMIT button and see how it goes ? Hope this'll help...

Going to get some sleep now; although I store password, username and ID to sessions,... look at your script later ? To suggest that your getting the Access Denied though could be the condition ? Maybe a brace out of place somewhere... ? ZZzzz... Yawn