This Message Forum is no longer in use

Please use the new Bravenet Help Forums FOUND HERE

General Forum
This Forum is Locked
Author
Comment
please tell me what i did wrong

you can see the codes at http://gamecrasyfreak.bravehost.com/help.htmlplease tell me what i did wrong or email me at
gunz13580@hotmail.com

Browser: IE 7

Re: please tell me what i did wrong

If you have a free account you can't use php so this won't work. If you don't have a free account then post more details. What isn't working, any error messages, a link to the page, and anything else you think may be useful.

-Scut

Browser: Mozilla Firefox 3.6.*

OS: Windows 7

Re: please tell me what i did wrong

Scut,

A link was provided. I think "kingjackIVV" already understands that he won't be able to run any of this on a free site. He is currently testing on a installation of "WampServer".

Anyone trying to follow this thread may not know what "WampServer" is. It is a application that installs an Apache web server with MySQL and PHP capabilities on your PC. If you are developing web applications that require MySQL and PHP, this is a handy thing to have. You can work out all the bugs in the privacy of your own server.

kingjackIVV,

I don't get a lot of time during the week to answer questions. So I will try answering a little bit at a time. In between times you will probably figure out a lot of issues yourself.

So let's start with "register.php". You are expecting it to do double duty. You want it to display the registration form and process the registration form data. But you haven't provided any way for the script to tell the difference. When you access it from the link in your "index.php", the "register.php" is expecting a data stream from a form. So the first group of errors are because there is no data stream and the indexes for your "$_POST" operations can not be resolved.

A simple way of fixing the issue is to split "register.php" into two files. One which only contains the registration form (register.html), and the other which processes the form (register.php). The registration form processor, "register.php", may still need to have the form in it, in case of a user input error. Then it could redisplay the registration form.

Another way of fixing might be to pass a variable to the "register.php" script and then use that variable ($_GET["op_id"]) to determine whether the form data is processed or the registration form is displayed.

Code:
<a href='register.php?op_id=display'>Click here</a> to register


I haven't had a chance to actually try some fixes, but I will have to wait for the weekend.

Browser: Firefox

OS: Solaris, Redhat, Fedora, Suse

Re: please tell me what i did wrong

I didn't scroll all the way to the end of the page, apologies for that.

The duplicate usernames are a fairly easy fix: on line 21 of register.php (as copied form the help page) find
'&username'
near the end and of the line change to
'$username'
This line tells the database to check if the username already exists in the database.

I'll upload the code to my site later or tomorrow to try and debug some of the other issues.

Browser: Mozilla Firefox 3.6.*

OS: Windows 7

Re: please tell me what i did wrong

thanks for the help

Browser: IE 7

Re: please tell me what i did wrong

kingjackIVV,

OK, here is a link to some fixes that I have done so far. I put it in a format similar to yours and included a some explanation. For the most part, the code was correct. Except for the cosmetic fixes to the forms, the fixes I made were not big.

Login Code Fixes

I can put everything in a ZIP file that you can download, if you like. If there are other issues, let us know and we will see if we can help.

Browser: Firefox

OS: Solaris, Redhat, Fedora, Suse

Re: please tell me what i did wrong

thanks for the help but i found 3 errors 1:the activation link for some reason doesn`t work it says error 404 file not found when i have the activation file
2:i cant get the question marks to work that apear on the registration page
and 3:when i manualy changed the acivatiion to 1 and logged in it sayed that i had succesfully logged in but when i click the link to go to the member page it says i have to log in even though i did already

and one more question how do i get the persons session to time out after 2 hours if they stop doing anything when there logged in?

thanks in advance for any answers

Browser: IE7

Re: please tell me what i did wrong

I'll leave the first three points to Philo, or until I have more time, but the session timeout is relatively simple.

You just need to set a timestamp into a session variable when the user logs in. Any time the user visits a page when logged in, even ones that don't require a login you check the timestamp.

If it was set less than two hours in the past then you update it to the current time, otherwise you remove it.

If you do this before any login check then you can simply check for the existence of the timestamp when checking for a login.

Sample code is here, let me know if you have any issues with it.

Browser: Mozilla Firefox 3.6.*

OS: Windows 7

Re: please tell me what i did wrong

Okay, I got some time this evening, and I went over the other few problems. I found some more along the way.

First create a folder called 'css' and one called 'js'. The .css file goes into the css folder, and the .js file goes in the js folder. This will fix the question-mark helpers on the register.php page.

As for the rest, make the following changes:

To fix the activation link 404 change register.php line 76. "http://localhost/login/activate.php" changes to "activate.php"
This will need to be replaced with a full url if you want it to work via email.

In activate.php change "if ($id&&$code) {" to "if (isset($id,$code)) {" because, for me at least, this failed when id=0.

To give access to the members area (and other member pages) on login.php change line 27 "$_SESSION['username']==$dbusername;" to "$_SESSION['username']=$dbusername;"
The == checks if a condition is true, while = sets a variable.

To allow successful changing of passwords in changepassword.php change line 22 "WHERE='$user'" to "WHERE username='$user'"
The column to check was missing.

Browser: Mozilla Firefox 3.6.*

OS: Windows 7

Re: please tell me what i did wrong

thanks ile try it out

Browser: IE 7

Re: please tell me what i did wrong

thanks everything is now working except that when i click the activation link to activate the new account it says data missing also it isnt suppose to let you use the same username and password but it does

please tell me how to fix these last 2 problems and then the php login logout register change password and activate account system will be perfect in my eyes

Browser: IE 7

Re: please tell me what i did wrong

It lets you use the same password again, but the username must be unique. Check that you're using the code linked to by Philo Kvetch and that the username query (around line 26 or 27) in register.php uses $username rather than &username.

The activation link must contain an id and a code parameter. The link sent by register.php should look something like "activate.php?id=4&code=25552321". If not, find where the link is output from register.php (line 76 on my copy) and make sure the line reads:

Browser: Mozilla Firefox 3.6.*

OS: Windows 7

Re: please tell me what i did wrong

thanks now its finally complete maybe ile actualy use it when ever i feel like getting pro hosting

Browser: IE 7

Re: please tell me what i did wrong

There's a site (000webhost.com) that offers free web hosting with php.

Browser: Mozilla Firefox 3.6.*

OS: Windows 7