Jump to content

OK, something wrong with my syntax :P


AbydosGater

Recommended Posts

Hi, I have just coded the layout for my registration script.. Basicly it displays a form, user inputs account info, this is stored in a database with an 'active' and 'acode' fields... When the info is stored in the db, it sends the user an activation email with a link to the next registration step, if the acode, and user_id, match in the database with the member id and acode in the database... The user is activated..

Simple really.. I set up the following layout.. I cant really see anything wrong, im just wondering if anyone can see any way to update it to make it run better..

Sorry if i didnt close an IF or else along the way i can fix that after i run it..

Sorry its such a mess.. so many ifs and elses within more ifs and more elses :P:P

[code]
<?php
if (!$_GET['step']){
//New user to the page, display the form asking for the basic user information...
} elseif ($_GET['step'] == "2"){
//User has submitted the form... Send an activation email, and inform user they need to click the link in the email...
} elseif ($_GET['step'] == "3"){
//User has clicked the link in the email... Now check if the activation code is in the url.
if (!$_GET['uid'] || !$_GET['acode']){
//The user has run the script for this set, but without the member id and activation code...Display error
} else {
//User has click the link in the email.. and now i need to check the acode in the url, to the activation code in the url..
$member_id = $_GET['uid'];
$database_activation_code = "123456789" // Run a query here to get it..
if ($_GET['acode'] == $database_activation_code){
//Right information supplyed.. Display an alert that everythings ok, and a link to step 4 to activate the account!!
} else (
//The information the user entered is false.. Display warning and get to click link in the email...
}
}
} elseif ($_GET['step'] == "4"){
//User has entered the right activation code, run an update here and activate the users account... When done redirect to the members area
}
?>

[/code]

Anyone see any weak points?

Thanks Abydos

EDIT:: [b]Have a look at my next post.. Im having problems with my IF inside an IF[/b]
Link to comment
https://forums.phpfreaks.com/topic/28120-ok-something-wrong-with-my-syntax-p/
Share on other sites

Ok I have edited the script a bit, just the comments to echos and ending some ifs..

[code]
<?php
if (!$_GET['step']){
echo "New user to the page, display the form asking for the basic user information";
} elseif ($_GET['step'] == "2"){
echo "User has submitted the form... Send an activation email, and inform user they need to click the link in the email...";
} elseif ($_GET['step'] == "3"){
//User has clicked the link in the email... Now check if the activation code is in the url.
if (!$_GET['uid'] || !$_GET['acode']){
echo "The user has run the script for this set, but without the member id and activation code...Display error";
} else {
echo "User has click the link in the email.. and now i need to check the acode in the url, to the activation code in the url..";
$member_id = $_GET['uid'];
$database_activation_code = "123456789" // Run a query here to get it..
//NEXT IF HERE IS LINE 77 FOR ACODE AND DB ACODE
if ($_GET['acode'] == $database_activation_code){
echo " Right information supplyed.. Display an alert that everythings ok, and a link to step 4 to activate the account!!";
} else (
echo "The information the user entered is false.. Display warning and get to click link in the email...";
}
} elseif ($_GET['step'] == "4"){
echo "User has entered the right activation code, run an update here and activate the users account... When done redirect to the members area";
}
?>
[/code]

But when i run the script.. Im getting...unexpected T_IF...blah blah on line 77.

Any idea why? you can run an if inside another cant you? ive done it loads before,,

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.