( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?php
include('../Connections/videoondemand.php');
require_once("includes/inc_files.php");
if(!$session->is_logged_in()) {redirect_to("login.php");}
$user = User::find_by_id($_SESSION['euserid']);
$invites = Invites::find_invites($user->catalogid);
$invite_count = Invites::count_all($user->catalogid);
$location = "gold_settings.php";
// Remember to give your form's submit tag a name="submit" attribute!
if (isset($_POST['submit'])) { // Form has been submitted.
$user_email = $user->user_email;
$catalogname = trim($_POST['catalogname']);
$tel = trim($_POST['tel']);
$current_password = trim($_POST['current_password']);
$password = trim($_POST['password']);
$repeat_password = trim($_POST['repeat_password']);
$user_email = trim($_POST['email']);
$gender = $_POST['gender'];
$country = $_POST['country'];
$whitelist = $_POST['whitelist'];
$ip_whitelist = $_POST['ip_whitelist'];
// $staff_user_email = $admin->user_email;
$check_email = User::check_user('user_email', $user_email);
$encrypted_password = md5($current_password);
$check_password = User::check_current_password($user_email, $encrypted_password);
if (DEMO_MODE == 'ON') {
$message = "<div class='text-white'><p>Sorry, you can't do that while demo mode is enabled.</p><a href='#' class='notification-close warning-notification-close'>x</a></div><!--.notification-box .notification-box-warning end-->";
} else {
if ($current_password != "" && $catalogname != "" && $tel != "" && $user_email != "") {
if ($encrypted_password == $check_password) {
// if current password is correct
if ($password != "" && $repeat_password != "") {
// if new password fields are not empty, check to see if they match.
if ($password == $repeat_password) {
// new password match
$new_password = md5($password);
$user->update_account('1', $catalogname, $tel, $new_password, $user_email, $password, $country, $gender, $whitelist, $ip_whitelist);
} else {
$message = "<div class='text-white'><p>Sorry, new passwords don't match.</p><a href='#' class='notification-close warning-notification-close'>x</a></div><!--.notification-box .notification-box-warning end-->";
}
} else {
// if new password fields are empty
$user->update_account('2', $catalogname, $tel, $password, $user_email, $password, $country, $gender, $whitelist, $ip_whitelist);
}
} else {
$message = "<div class='text-white'><p>Sorry, the current password that you entered does not match our records.</p><a href='#' class='notification-close warning-notification-close'>x</a></div><!--.notification-box .notification-box-warning end-->";
}
} else {
$message = "<div class='text-white'><p>Please complete all required fields</p><a href='#' class='notification-close warning-notification-close'>x</a></div><!--.notification-box .notification-box-warning end-->";
}
}
} else { // Form has not been submitted.
$user_email = $user->user_email;
$password = "";
$current_password = "";
$repeat_password = "";
$catalogname = $user->catalogname;
$tel = $user->tel;
$user_email = $user->user_email;
$lock_status = "";
$lock_status_message = "";
$code = "";
$whitelist = $user->whitelist;
$ip_whitelist = $user->ip_whitelist;
}
if (isset($_POST['activate_lock'])) {
if (DEMO_MODE == 'ON') {
$message = "<div class='text-white'><p>Sorry, you can't do that while demo mode is enabled.</p><a href='#' class='notification-close warning-notification-close'>x</a></div><!--.notification-box .notification-box-warning end-->";
} else {
Account_Lock::set_account_lock($user_email, $user_email, $user->catalogid, $location);
}
}
if (isset($_POST['deactivate_lock'])) {
$code = trim($_POST['code']);
if (!$code == "") {
if (DEMO_MODE == 'ON') {
$message = "<div class='text-white'><p>Sorry, you can't do that while demo mode is enabled.</p><a href='#' class='notification-close warning-notification-close'>x</a></div><!--.notification-box .notification-box-warning end-->";
} else {
Account_Lock::check_lock_status($user->catalogid, $code, $location);
}
} else {
$message = "<div class='text-white'><p>No unlock code entered.</p><a href='#' class='notification-close warning-notification-close'>x</a></div><!--.notification-box .notification-box-warning end-->";
}
}
if (isset($_POST['resend_code'])) {
if (DEMO_MODE == 'ON') {
$message = "<div class='text-white'><p>Sorry, you can't do that while demo mode is enabled.</p><a href='#' class='notification-close warning-notification-close'>x</a></div><!--.notification-box .notification-box-warning end-->";
} else {
Account_Lock::check_resend_code($user->catalogid, $user->user_email, $location);
}
}
if (isset($_POST['create_invite'])) {
if (DEMO_MODE == 'ON') {
$message = "<div class='text-white'><p>Sorry, you can't do that while demo mode is enabled.</p><a href='#' class='notification-close warning-notification-close'>x</a></div><!--.notification-box .notification-box-warning end-->";
} else {
Invites::create_invite($user->catalogid, $user->user_email, $location);
}
}
if((!empty($_GET['delete_code']))){
if (DEMO_MODE == 'ON') {
$message = "<div class='text-white'><p>Sorry, you can't do that while demo mode is enabled.</p><a href='#' class='notification-close warning-notification-close'>x</a></div><!--.notification-box .notification-box-warning end-->";
} else {
$code = $_GET['delete_code'];
Invites::delete_invite($code, "gold_settings.php");
}
}
if ($user->account_lock == 0) {
$lock_status = '';
$lock_icon = 'open';
$lock_text = 'Account Lock <span>Dissapproved</span>';
$lock_info = 'Your account settings are currently unlocked and insecure, please activate your lock to prevent your settings from being changed without your permission.';
$lock_buttons = '<form action="gold_settings.php" method="post"><input class="button blue" type="submit" name="activate_lock" value="Activate Account Lock" /></form>';
} else if ($user->account_lock == 1) {
$lock_status = 'disabled="disabled"';
$lock_icon = 'closed';
$lock_text = 'Account Lock <span class="green">Approved</span>';
$lock_info = 'Your account settings are currently locked and secure from unauthorised change.';
$lock_buttons = '<form action="gold_settings.php" method="post"><input type="text" id="code" name="code" value="'.htmlentities($code).'" /> <input class="button blue" type="submit" name="deactivate_lock" value="Deactivate Lock" /> <input class="button blue" type="submit" name="resend_code" value="Resend Code" /></form>';
$code = "";
}
?>
<?php require_once("includes/templates/header.tpl"); ?>
<?php include("../pages/splash/subscribe.php");?>
<section class="title"><?php /*?>Brand Access<?php */?> </section>
<div class="container">
<?php echo output_message($message); ?>
<?php /*?> <section class="account_lock">
<div class="lock_icon <?php echo $lock_icon ?>"></div><!--.lock_icon end-->
<div class="lock_unlock_text">
<div class="status"><?php echo $lock_text ?></div><!--.status end-->
<div class="info"><?php echo $lock_info ?></div><!--.info end-->
</div><!--.lock_unlock_text end-->
<div class="lock_unlock_buttons"><?php echo $lock_buttons ?></div><!--.lock_unlock_buttons end-->
<div class="clear"></div><!--.clear end-->
</section><!--.account_lock end--><?php */?>
<form action="gold_settings.php" method="post" class="formee">
<section id="main" class="formee">
<?php /*?> <div class="grid-4-12">
</div>
<div class="grid-4-12">
</div>
<div class="clear"></div><!--.clear end-->
<div class="clear"></div><!--.clear end--><?php */?>
<?php /*?><div class="grid-3-12 center">
<h2>Funds</h2>
<label><div class="tlarge" style="color:#666;"><?php echo number_format($user->tokens, 0, '.', ',') ?></div>Kshs</label>
</div>
<div class="grid-3-12 center">
<h2>Currently Banked</h2>
<label><div class="tlarge"><?php echo number_format($user->bank_tokens, 0, '.', ',')?></div>Funds</label>
</div>
<div class="grid-6-12">
<div class="token_btns" style="padding-left:100px">
<a href="buy_tokens.php" class="btn btn-lg btn-warning" >Buy Package</a>
<a href="spend_tokens.php" class="button"> Subscribe </a>
</div>
</div><?php */?>
<div class="clear"></div><!--.clear end-->
<div class="line line-dashed"></div>
<h2><?php echo "<strong>Subscription Level :</strong> ".convert_admin($user->admin);?></h2>
<div class="grid-12-12">
<table width="910" cellpadding="10" cellspacing="10" class="mtopm8" id="fullwidth" style="color:#666">
<?php
$sql = "SELECT * FROM gold_transaction WHERE catalogid = '{$user->catalogid}' ORDER BY datetime DESC";
$result = $database->query($sql);
if($database->num_rows($result)) {
?>
<tr style="color:#666">
<th>Transaction</th>
<th> Plan</th>
<th>Status</th>
<th>Date Time</th>
</tr>
<tr style="color:#666">
<th> </th>
<th> </th>
<th> </th>
<th> </th>
</tr>
<?php
while ($gold_transaction = $database->fetch_array($result)){ ?>
<tr>
<td>USD <?php echo $gold_transaction['tokens']; ?></td>
<td><?php echo $gold_transaction['package_name']; ?></td>
<td>Success : <?php echo convert_token_status($gold_transaction['status']); ?></td>
<td><?php echo datetime_to_text($gold_transaction['datetime']); ?></td>
</tr>
<?php } } else echo "<strong>This account has not had any transactions.</strong><br /><br />";
/* header("Location: buy_tokens.php"); */
?>
</table>
<?php if(ALLOW_REGISTRATIONS == "NO") {
if (ALLOW_INVITES == "YES") :?>
<div class="grid-12-12">
<table id="fullwidth" style="color:#666;">
<tr>
<th>Invite Code <?php echo "(".$invite_count."/".MAX_INVITES.")" ?></th>
<th>Delete</th>
</tr>
<?php
foreach($invites as $invite) : ?>
<tr>
<td><?php echo $invite->code; ?></td>
<td><a href="gold_settings.php?delete_code=<?php echo $invite->code; ?>">ss<img src="img/delete.png" alt="edit" class="edit_button" /></a></td>
</tr>
<?php endforeach; ?>
<?php if ($invite_count < MAX_INVITES) : ?>
<tr>
<td></td>
<td></td>
</tr>
<?php endif; ?>
</table>
<?php endif; } ?><br>
<br>
<?php echo "<strong>Expiry Date:</strong> ".date_to_text($user->expiry_datetime);
echo "<br />";
echo "<strong>Credits Accumulated:</strong> ".$user->tokens;
echo "<br />";
echo "<strong>Creation Date:</strong> ".date_to_text($user->date);
echo "<br />";
echo "<strong>Last Login:</strong> ".datetime_to_text($user->last_login);
echo "<br />";
echo "<strong>Signup IP:</strong> ".$user->users_ip;
echo "<br />";
echo "<strong>Last IP:</strong> ".$user->last_ip;
/* echo "<br />";
echo "<strong>Subscription Level :</strong> ".convert_admin($user->admin);*/
?></div>
</div>
</section><!--#main end-->
</form>
<div class="clear"></div><!--.clear end-->
</div><!--.container end-->
<?php require_once("includes/templates/footer.tpl"); ?>