Greetings all. I am writing a profile creator script where a user gets
a URL invite in their mail in the form of;
Things are working well except for a small annoyance in which someone
might have a solution to.
In the event that someone accesses profile-create.php without an
access_code the script generates a warning. If there is an access_code
that matches the access code entered in the MySQL database then they
are directed to the profile creation page. My problem is;
If someone accesses profile-create.php with an access_code but it
doesn't match any entries in the database I would like to generate a
warning.
When I try to do this with an else statement it produces an error for
every access code listed in the database which isn't the correct one,
so I could end up with a successful profile creation page with a bunch
of errors.
I've played with break and pattern matching but no results. Here is
the script below.
[color=blue]
>---------------------------------------------------------------<[/color]
<?php
$access_code = $_GET['access_code'];
if ($access_code) {
echo db_connect();
$result = mysql_query('SE LECT random_link FROM invites');
while ($row = mysql_fetch_arr ay($result, MYSQL_NUM)) {
$random_link_db = $row[0];
if ($random_link_d b == $access_code) {
echo profile_creator _page();
}
// Would like to insert an error warning here
}
}
else {
echo "Error!"
}
function profile_creator _page() {
echo "All's well!";
}
?>
[color=blue]
>---------------------------------------------------------------<[/color]
Any ideas?
Regards,
Luc
a URL invite in their mail in the form of;
Things are working well except for a small annoyance in which someone
might have a solution to.
In the event that someone accesses profile-create.php without an
access_code the script generates a warning. If there is an access_code
that matches the access code entered in the MySQL database then they
are directed to the profile creation page. My problem is;
If someone accesses profile-create.php with an access_code but it
doesn't match any entries in the database I would like to generate a
warning.
When I try to do this with an else statement it produces an error for
every access code listed in the database which isn't the correct one,
so I could end up with a successful profile creation page with a bunch
of errors.
I've played with break and pattern matching but no results. Here is
the script below.
[color=blue]
>---------------------------------------------------------------<[/color]
<?php
$access_code = $_GET['access_code'];
if ($access_code) {
echo db_connect();
$result = mysql_query('SE LECT random_link FROM invites');
while ($row = mysql_fetch_arr ay($result, MYSQL_NUM)) {
$random_link_db = $row[0];
if ($random_link_d b == $access_code) {
echo profile_creator _page();
}
// Would like to insert an error warning here
}
}
else {
echo "Error!"
}
function profile_creator _page() {
echo "All's well!";
}
?>
[color=blue]
>---------------------------------------------------------------<[/color]
Any ideas?
Regards,
Luc
Comment