Hello,

I made a registration confirmation code that emails you a random md5 in the form of

www.yoururl.com/confirmation.php?key=as19239avjkajesdfkj

and key is the confirmation code. However I am trying to implement a 2 part confirmation code (one sent to your email and one sent to your cell phone) so I want to make a field where once it gets the key from the url it will also display a standard html form to ask for the cellphone code (5 random letters/numbers)

I have tried different ways of doing this but every time it calls the html for the form they key part of the url erases and I dont get the email key anymore.

Any ideas how to do this?

Thanks!

Since you didn't provide any code I am guessing a bit as to how you structured it. If you have a page that then has a form to go to another page and if you need to retain variables that were available on the first page: then you need to make them hidden variables in the form (or session variables) to make them available on the second page.

Since you didn't provide any code I am guessing a bit as to how you structured it. If you have a page that then has a form to go to another page and if you need to retain variables that were available on the first page: then you need to make them hidden variables in the form (or session variables) to make them available on the second page.

Ill post the code in 10 minutes. Sorry I revised it so the person has to enter two codes so it doesnt really show what I am talking about. Ill change it back and send it to you.

Confirmation.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>
<form name="confirm" method="post" action="confirmation.php">
<table border="0" width="225" align="center">
    <tr>
        <td width="219" bgcolor="#999999">
            <p align="center"><font color="white"><span style="font-size:12pt;"><b>Enter Codes:</b></span></font></p>
        </td>
    </tr>
    <tr>
        <td width="219">
            <table border="0" width="220" align="center">
              
                <tr>
                    <td width="71"><span style="font-size:10pt;">Cell Code:</span></td>
                    <td width="139"><input type="text" name="confirm_code2" maxlength="5"></td>
                </tr>
                <tr>
                    <td width="71">&nbsp;</td>
                        <td width="139">
                            <p align="right"><input type="submit" name="submit" value="Submit"></p>
                        </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td width="219" bgcolor="#999999"><font color="white">Not Registered? </font><a href="registration.html" target="_self"><font color="white">Register</font></a><font color="white"> </font><b><i><font color="white">Now!</font></i></b></td>
    </tr>
</table>
</form>
</body>
</html>

Confirmation.php

<?
include('config.php');
$tconfirm_code = $_GET['key'];
$tconfirm_code2 = $_POST['confirm_code2'];


$confirm_code =  strtoupper($tconfirm_code);
$confirm_code2 =  strtoupper($tconfirm_code2);

$confirm_code3 = $confirm_code . $confirm_code2;


$tbl_name1= "users_temp";

$sql1="SELECT * FROM $tbl_name1 WHERE confirm_code ='$confirm_code3'";

$result1=mysql_query($sql1);

if($result1){

$count=mysql_num_rows($result1);

if($count==1){

$rows=mysql_fetch_array($result1);
$fname=$rows['fname'];
$lname=$rows['lname'];
$email=$rows['email'];
$carrier=$rows['carrier'];
$cell=$rows['cell'];
$username=$rows['username'];
$password=$rows['password'];
$cellemail=$rows['cellemail'];

$tbl_name2="users";

$sql3="INSERT INTO $tbl_name2 (fname, lname, email, cell, carrier, username, password, cellemail)
VALUES('$fname', '$lname','$email','$cell','$carrier','$username', '$password', '$cellemail')";

$result3=mysql_query($sql3);
}

else {
echo "Wrong Confirmation code(s). You will be sent back in 5 seconds.";
echo "<script language=\"JavaScript\">\n";
echo "<!-- hide code from displaying on browsers with JS turned off\n\n";
echo "function redirect() {\n";
echo "window.location = \"" . 'http://.com/confirmation.html' . "\";\n";
echo "}\n\n";
echo "timer = setTimeout('redirect()', '" . (5*1000) . "');\n\n";
echo "-->\n";
echo "</script>\n";
 
}

if($result3){

echo "Your account has been activated. You will now be sent to the login page. Thanks!";

$sql4="DELETE FROM $tbl_name1 WHERE confirm_code = '$confirm_code3'";
mysql_query($sql4) or die(mysql_error());
mysql_close();
echo "<script language=\"JavaScript\">\n";
echo "<!-- hide code from displaying on browsers with JS turned off\n\n";
echo "function redirect() {\n";
echo "window.location = \"" . 'http://.com/login.html' . "\";\n";
echo "}\n\n";
echo "timer = setTimeout('redirect()', '" . (5*1000) . "');\n\n";
echo "-->\n";
echo "</script>\n";
 

}

}


?>

I want the php file to take the confirmation code from the email link and the confirmation code typed in in the html form in confirmation.html join them using "." into confirm_code3 and run confirm_code3 to see where the user is and confirm the user...

Thanks!

I think you need to make the first module a PHP module as well. After line 10 add:

<?PHP echo "<input type=hidden name=key value=".$_GET['key'].">"; ?>

In the second module you would then access it on line 3 as $_POST

I am not getting much success with that...

So the link would be

www.yoursite.com/register.html?key=asdfa3fasf
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.