Hi all,
I have a log in and activation script but im trying to parse some information to use along the way, namely the usersid (the person who owns the database)
I have set up a form with the hidden tag field but I cant seem to get it to add the userid from the rest of the page into the hidden tag.
I've posted the script below. I know the variable $userid is parsed from the last page as it opens and ammends the correct table in the database.
<?php require_once('********/******.php'); ?>
<?php
/* Let's do some checking and ensure that the user's email address or username
does not exist in the database */
$sql_tel_check = ("SELECT m_tel FROM $userid WHERE m_tel='$m_tel'");
mysql_select_db($database_smslist, $smslist);
$sqlu = mysql_query($sql_tel_check, $smslist) or die(mysql_error());
$tel_check = mysql_num_rows($sqlu);
if(($tel_check > 0)){
echo "Please fix the following errors: <br />";
if($tel_check > 0){
echo "The telephone number you have enterd is already been entered in our database.<br />";
unset($username);
}
echo "<a href='javascript: history.go(-1)'>click here to try again</a>";
exit(); // exit the script so that we do not create this account!
}
//insert info to database
function makeRandomCode() {
srand((double)microtime()*1000000);
return rand(1001,9999);
}
$randc = makeRandomCode();
$insertSQL = ("INSERT INTO $userid (first_name, surname, m_prefix, m_tel, email, signup_date, randc)
VALUES('$first_name', '$surname', '$m_prefix', '$m_tel', '$email', NOW(), '$randc')");
mysql_select_db($database_smslist, $smslist);
$sql = mysql_query($insertSQL, $smslist) or die(mysql_error());
if(!$sql){
echo 'There has been an error creating your account. Please contact the webmaster.';
} else {
//sms the user their activation code, remember to change to correct email
$to_address = "blabla@bla.com";
SNIP
mail($to_address, $subject, $message, "From: SMSList<admin@.co.uk>\nX-Mailer: PHP/" . phpversion());
echo '<form action="user_activate.php" method="post" name="activate" id="activate">
<table width="80%" border="1" cellspacing="0" cellpadding="2">
<tr>
<td>First Name</td>
<td><input name="first_name" type="text" id="first_name"></td>
</tr>
<tr>
<td>activation code</td>
<td><input name="code" type="text" id="code"></td>
</tr>
<tr>
<td>"<input type=hidden value=\"".$userid."\" name=\"userid\">"</td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table></form>'; } ?>
Its this form at the bottom that the script displays that wont include the userid, the above example is one of many that i have tried.
Gurus to the rescue please!!