how can i get a token that a user has requested if he/she clicks cancel NOTE the user doesnt have to input anything if cancel is clicked that particular token is deleted from the d.b and the user is redirected to index.php i really dont know where and how to start so bear with me thanks anyway below is the token.php
<?php
error_reporting(0);
session_start();
$token=$_GET['token'];
include("settings.php");
connect();
if(isset ($_POST['submit'])){
$q="select email from tokens where token='".$token."' and used=0";
$r=mysql_query($q);
while($row=mysql_fetch_array($r))
{
$email=$row['email'];
}
If ($email!=''){
$_SESSION['email']=$email;
}
else die("Invalid link or Password already changed <a href='../index.php'>Click here to go back to the HOME PAGE<a/>");}
$pass=$_POST['password'];
$email=$_SESSION['email'];
if(isset($_POST['password'])&&isset($_SESSION['email']))
{
$q="update registration set password='".md5($pass)."' where email='".$email."'";
$r=mysql_query($q);
if($r)mysql_query("update tokens set used=1 where token='".$token."'");echo "Your password is changed successfully <a href='../index.php'>Click here to go back to the HOME PAGE<a/>";
if(!$r)echo "An error occurred";
}
and below is the formreset.php
<h3><strong>Forgot Password</strong></h3>
<form name="forgot" method="POST" id="forgot" action="includes/reset.php?token=<?php echo $_GET['token']; ?>">
<div align="center">
<table width="372" border="0">
<tr>
<td width="181"><p> </p>
<p><strong>Password</strong></p></td>
<td width="181"><span id="sprytextfield1"><span id="sprypassword1">
<label for="password2"></label>
<br />
<input type="password" name="password" id="password2" />
<br />
<span class="passwordRequiredMsg">Your PASSWORD is need</span></span>
<label for="label"></label>
</span></td>
</tr>
<tr>
<td height="22"><p>
<p><strong>Confirm Password</strong></p></td>
<td><span id="spryconfirm2">
<label for="password"></label>
<span id="spryconfirm1">
<label for="password1"></label>
<br />
<input type="password" name="password1" id="password1" />
<br />
<span class="confirmRequiredMsg">Please re-confirm your PASSWORD</span><span class="confirmInvalidMsg">The PASSWORDS don't match.</span></span></span></td>
</tr>
</table>
</div>
<div align="center">
<p> </p>
<table width="372" border="0">
<tr>
<th width="132" scope="row"><input type="submit" name="submit" id="submit" value="submit" /></th>
<th width="113" scope="row"><a href="includes/cancel.php?token=<?php echo $_GET['token']; ?>">Cancel</a></td></th>
<th width="113" scope="row"><input type="reset" name="clear" id="clear" value="Clear" /></th>
</tr>
</table>
</div>
<div align="center">
<table width="372" border="0">
<tr> </tr>
<tr> </tr>
</table>
</div>thanks in advance
</form>
so how do i go about this