include("include.php");
include '/home/abcs/www/diydating/admin/remove_messages.php';
global $slave;
$slave = connectsqli_slave(); // defined in include
mysqli_select_db($slave, $databasename);
global $updated;
if(empty($updated))
{
$updated = "N";
}
// not logged in.. send them to login page
if (empty($ckid))
{
if ($SESSID){
header ("Location: notloggedin.php?SESSID=$SESSID");
} else {
header ("Location: notloggedin.php");
}
exit();
}
// if password is false, log them out.. they are most likely trying to hack..
if (!checkpassword($ckid, $ckpassword))
{
if ($SESSID){
header ("Location: logout.php?SESSID=$SESSID");
} else {
header ("Location: logout.php");
}
// header ("Location: logout.php?SESSID=$SESSID");
exit();
}
$result = mysqli_query($slave, "SELECT fullmember, username FROM profiles where id='$ckid'");
$row = mysqli_fetch_array($result);
// ask if sure to delete profile
if (!empty($deleteprofile))
{
include("header.php");
echo "
Are you completely sure you want to delete your profile? By deleting your profile you will lose all access to this website
";
if ($row[fullmember]=='Y')
{
echo "cancel my subcription";
}
include("footer.php");
exit();
}
// delete the profile
if (!empty($deleteprofilesure))
{
$myres = mysqli_query($slave, "SELECT maildomain FROM users WHERE id='$SITEID'");
$myrow = mysqli_fetch_array($myres);
$prres = mysqli_query($slave, "SELECT transactionhistory.transref, transactionhistory.duration FROM profiles LEFT JOIN transactionhistory ON profiles.transid=transactionhistory.id WHERE profiles.id='$ckid'");
$prrow = mysqli_fetch_array($prres);
$duration = $prrow[duration];
if ($row[fullmember]=='Y')
{
$date = date("jS F Y - g:i a");
$master = connectsqli_master();
mysqli_select_db($master, $databasename);
mysqli_query($master, "INSERT INTO netbanxcancels (userid,siteid,date,status, transref) VALUES ('$ckid','$SITEID',NOW(),'NOTRUN','$prrow[transref]')");
$mysqlerror = mysqli_error($master);
mail("garry@diydating.com","DEBUG Membership cancelled preferences.php ($ckid)",
"
'$row[username]' has deleted their profile.
'INSERT INTO netbanxcancels (userid,siteid,date,status, transref) VALUES ('$ckid','$SITEID',NOW(),'NOTRUN','$prrow[transref]')'
$mysqlerror
Date: $date
UID : $ckid
Just canceling membership: $justmembership
", "From: cancel@$myrow[maildomain]");
mysqli_query($master, "DELETE from jabber.users where userid='$ckid'");
// cancel them off automatically.
$results = mysqli_query($master, "select users.maildomain as maildomain,
users.hostname as hostname,
profiles.emailaddress,
profiles.id,
profiles.username,
profiles.transref,
users.hostname,
profiles.siteid,
(TO_DAYS(expire)-TO_DAYS(NOW())) as daystillcancel,
date_format(expire, '%M %D, %Y') as expiredate
from profiles
left join users on profiles.siteid=users.id
where profiles.id='$ckid';");
$myrow = mysqli_fetch_array($results);
$table="profiles";
$sql = "SELECT $table.expire,
$table.subdate,
$table.price,
$table.fullmember,
$table.username,
$table.emailnotice,
transactionhistory.status,
transactionhistory.reason,
transactionhistory.transref,
transactionhistory.siteid,
transactionhistory.duration,
paysite.hostname as paysite,
paysite.priceplan as priceplan
FROM $table left join transactionhistory on transactionhistory.id=$table.transid
LEFT JOIN users as paysite on $table.siteid=paysite.id
WHERE $table.id='$ckid'";
$result = mysqli_query($master,$sql);
$row = mysqli_fetch_assoc($result);
$subject = "Cancel Confirmation - ".$myrow['hostname'];
$content = "This email is to confirm that your subscription will be cancelled within the next 3 working days.";
mail($myrow['emailaddress'],$subject,$content,"From: admin@$myrow[maildomain]\nReply-To: admin@$myrow[maildomain]\nX-Mailer: PHP");
mysqli_close($master);
$updated = "Y";
}
$multiplier=1;
while (($multiplier <100) && ($rowcheck[testdate]<1) && ($duration>0))
{
$interval=$duration*$multiplier;
$sql="select
if(date_add(date_format('$row[subdate]','%Y-%m-%d'),INTERVAL $interval MONTH)>now(),'1','0') as testdate,
date_format(date_add(date_format('$row[subdate]','%Y-%m-%d'),INTERVAL $interval MONTH),'%Y-%m-%d') as newexpiry,
date_format(date_add(date_add(date_format('$row[subdate]','%Y-%m-%d'),INTERVAL $interval MONTH), INTERVAL 1 DAY),'%Y-%m-%d') as newexpiryplusoneday,
date_format(date_add(date_add(date_format('$row[subdate]','%Y-%m-%d'),INTERVAL $interval MONTH), INTERVAL 1 DAY),'%d') as newdaynumber
";
$resultcheck= mysqli_query($slave,$sql);
$rowcheck = mysqli_fetch_assoc($resultcheck);
$multiplier=$multiplier+1;
}
if ($rowcheck[newdaynumber]=='1')
{
$rowcheck[newexpiry] = $rowcheck[newexpiryplusoneday];
}
if(!empty($rowcheck[newexpiry]))
{
$xpire = @strtotime($rowcheck[newexpiry]);
$xpire = @date("jS F Y", $xpire);
}
else
{
$xpire = "the last day of your payment period.";
}
if (empty($justmembership))
{
$master = connectsqli_master();
mysqli_select_db($master, $databasename);
$userres = mysqli_query($master, "SELECT emailaddress FROM profiles WHERE id='$ckid'");
$userrow = mysqli_fetch_array($userres);
mail("$userrow[emailaddress]","Profile deleted!",
"
Hi,
This is to confirm that your profile has been deleted. We're interested to know if your visit to our site was succcessful. What would you change about the site? What could we do to improve it?
If you would like to reply then please reply to this e-mail,
Thanks,
$SITENAME
$SITEURL"
, "From: $SITENAME");
// glup
// mysqli_query($master, "INSERT into profilesdeleted select * from profiles where id='$ckid'");
// mysqli_query($master, "DELETE FROM profiles WHERE id='$ckid'");
// mysqli_query($master, "DELETE FROM buddylist WHERE id='$ckid'");
// mysqli_query($master, "DELETE FROM buddylist WHERE buddy='$ckid'");
// mysqli_query($master, "DELETE FROM profileviews WHERE viewer='$ckid'");
// mysqli_query($master, "DELETE FROM profileviews WHERE profile='$ckid'");
// mysqli_query($master, "DELETE FROM profilesold where id='$ckid'");
$multisql = "INSERT into profilesdeleted select * from profiles where id='$ckid';";
$multisql .= "DELETE FROM profiles WHERE id='$ckid';";
$multisql .= "DELETE FROM buddylist WHERE id='$ckid';";
$multisql .= "DELETE FROM buddylist WHERE buddy='$ckid';";
$multisql .= "DELETE FROM profileviews WHERE viewer='$ckid';";
$multisql .= "DELETE FROM profileviews WHERE profile='$ckid';";
$multisql .= "DELETE FROM profilesold where id='$ckid'";
mysqli_multi_query( $master, $multisql );
mysqli_close($master);
$updated = "Y";
// steve delete the users messages.
//
delete_messages( $ckid );
header ("Location:logout.php");
}
else
{
include("header.php");
echo "
We have cancelled your membership.
Your current full membership will end on $xpire
We have sent confirmation of this to your e-mail address $myrow[emailaddress]";
include("footer.php");
exit();
}
exit();
}
// data submitted
if ($formsubmitted==1)
{
$master = connectsqli_master();
mysqli_select_db($master, $databasename);
// update email notice variable
mysqli_query($master, "UPDATE profiles SET emailnotice='$emailnotice', mailinglist='$mailinglist', timezone='$timezone', blockunseeking='$blockothers' WHERE id='$ckid'");
$sesstimezoneoffset=$timezone;
$updated = "Y";
include("header.php");
echo "
Your preferences have been changed.
";
if ($emailnotice==0)
echo "You will not be notified of new messages by Email.";
else
echo "You will be notified of new messages by Email.";
if ($anonbrowse=="y")
{
session_register('xanonbrows');
$xanonbrows = "Y";
}
include("footer.php");
exit();
}
include("header.php");
if($updated == "Y")
{
$link = connectsqli_master();
mysqli_select_db($link, $databasename);
}
else
{
$link = $slave;
}
$exsql = "SELECT fullmember, expire, blockunseeking,timezone, mailinglist, emailnotice, DATE_FORMAT(expire, '%D %M %Y') AS exdateform ,(expire < date_add(now(),INTERVAL 366 DAY)) as setexpired FROM profiles WHERE id='$ckid' ";
$exres = mysqli_query($link, $exsql);
$exrow = mysqli_fetch_array($exres);
if(($exrow[fullmember]=='Y')&&($exrow[setexpired]))
{
echo "Your current membership is due to expire on $exrow[exdateform]