<?
include "header.php";

if(isset($_POST['task'])) { $task = $_POST['task']; } else { $task = "warning"; }

if($task == "cancel") {
header("Location: index.php");
exit;
}

if($task == "delete") {
if($user_info[price] == 0) {
mysql_query("DELETE FROM ims WHERE u_id='$user_info[u_id]'");
mysql_query("DELETE FROM ims_image WHERE u_id='$user_info[u_id]'");
mysql_query("DELETE FROM ims_folders WHERE u_id='$user_info[u_id]'");
if(str_replace(" ", "", $user_info[u_id]) != "") { @deleteuse("./u/$user_info[u_id]/"); }

$n = "cancel_success.php";
include "vars.php";
echo $header;
echo "
<table cellpadding='0' cellspacing='0' width='520'>
<tr><td>
<b>Account Cancellation</b><br>
You have successfully cancelled your account.<br>
Your images have been deleted, and you will no longer be able to login.
<br><br>
<b>Thank you for hosting your images with us!</b>
</td></tr></table>
";
echo $footer;
exit();
} else {
$paypal_email = str_replace("@", "%40", $user_info[paypal_email]);
header("Location: https://www.paypal.com/cgi-bin/webscr?cmd=_subscr-find&alias=$paypal_email");
exit();
}}


if($task == "warning") {
echo $header;


echo "
<table width='520' cellpadding='0' cellspacing='0'>
<tr>
<td>
<b>Cancel Your $admin_info[site_name] Account?</b><br>
<b><font color='#FF0000'>WARNING: </font></b>Are you sure you want to cancel your account? 
All of your images and account information will be permanently erased,
and your PayPal subscription will be cancelled - you will no longer
be able to login!
<br><br>
Note: If you have more than one hosting account, be sure to cancel the subscription that
was created for this account!
</td></tr></table>
<br>

<table cellpadding='0' cellspacing='0'>
<tr>
<form action='cancel.php' method='POST'>
<td>
<input type='submit' class='button' value='No, Do NOT Cancel My Account'>&nbsp;
<input type='hidden' name='task' value='cancel'>
</td>
</form>
<form action='cancel.php' method='POST'>
<td>
<input type='submit' class='button' value='Yes, Cancel My Account'"; if($admin_info[demo_feature] == "on" & $user_info[email] == "$admin_info[demo_email]") { echo " DISABLED"; } echo ">
<input type='hidden' name='task' value='delete'>
</td>
</form>
</tr>
</table>
";


echo $footer;
exit;
}


?>