Go back

'; $db->query('select date,type,amount from t_counter_payments where id='.$cookie['id'].' order by date desc'); print ''; while($db->next_record()) { $date = date($date_format,$db->f('date')); switch($db->f('type')) { case '1': $type = 'Monthly'; break; case '2': $type = 'Yearly'; break; case '3': $type = 'Lifetime'; break; } $amount = '$'.$db->f('amount'); print ''; } print '
DateMembership typeAmount
'.$date.''.$type.''.$amount.'

'; print 'Go back
'; } function change_referer() { global $db, $cookie; $new_referer = $_REQUEST['counter_referer']; $db->query('update t_counter_profiles set referer=\''.$new_referer.'\' where id='.$cookie['id']); print 'Location of the counter is changed, Go back.
'; } function do_payment() { global $db, $cookie; $payment_type = $_REQUEST['payment_type']; $payment_processor = $_REQUEST['payment_processor']; $db->query('select monthly,yearly,lifetime,paypal_email from t_counter_payment_options where id=\'1\''); $db->next_record(); $monthly = $db->f('monthly'); $yearly = $db->f('yearly'); $lifetime = $db->f('lifetime'); $paypal_email = $db->f('paypal_email'); switch($payment_type) { case '1': $amount = $monthly; $item_name = 'Monthly upgrade of account with ID '.$cookie['id']; $custom = $cookie['id'].'|1'; break; case '2': $amount = $yearly; $item_name = 'Yearly upgrade of account with ID '.$cookie['id']; $custom = $cookie['id'].'|2'; break; case '3': $amount = $lifetime; $item_name = 'Lifetime upgrade of account with ID '.$cookie['id']; $custom = $cookie['id'].'|3'; break; } if($payment_processor == 'paypal') { header("location:https://www.paypal.com/xclick?business=$paypal_email&item_name=$item_name&custom=$custom&amount=$amount¬ify_url=http://$_SERVER[HTTP_HOST]".dirname($_SERVER[PHP_SELF])."/pp_ipn.php&return=http://$_SERVER[HTTP_HOST]".$_SERVER[PHP_SELF]); } } function upgrade_account() { global $db, $cookie; $db->query('select paid,expires from t_counter_profiles where id=\''.$cookie['id'].'\''); $db->next_record(); $paid = $db->f('paid'); $expires = $db->f('expires'); $now = time(); if($paid != '0' && $now < $expires) { print 'Your account is already upgraded and your membership has not expired yet, Go back.'; } else { $url = $_SERVER['PHP_SELF']; $db->query('select monthly,yearly,lifetime,paypal_email from t_counter_payment_options where id=\'1\''); $db->next_record(); $monthly = $db->f('monthly'); $yearly = $db->f('yearly'); $lifetime = $db->f('lifetime'); $paypal_email = $db->f('paypal_email'); if($monthly != 0) $type_options .= ''; if($yearly != 0) $type_options .= ''; if($lifetime != 0) $type_options .= ''; if($paypal_email != '') $processor_options .= ''; $tpl = new FastTemplate('templates'); $tpl->define(array(upgrade => 'upgrade.php')); $tpl->assign(array(URL => $url, TYPE_OPTIONS => $type_options, PROCESSOR_OPTIONS => $processor_options)); $tpl->parse('MAIN','upgrade'); $tpl->FastPrint(); } } function change_pass_final() { global $db, $cookie, $site_name, $admin_email; $old_pass = $_REQUEST['old_pass']; $new_pass1 = $_REQUEST['new_pass1']; $new_pass2 = $_REQUEST['new_pass2']; if(($new_pass1 != $new_pass2) || $new_pass1 == '' || $new_pass2 == '') { print 'New passwords are different or empty, Go back to correct.'; } else { $db->query('select 1 from t_counter_profiles where id=\''.$cookie['id'].'\' and pass=\''.$old_pass.'\''); if($db->num_rows()) { $db->query('update t_counter_profiles set pass=\''.$new_pass1.'\' where id=\''.$cookie['id'].'\''); $db->query('select email from t_counter_profiles where id=\''.$cookie['id'].'\''); $db->next_record(); $email = $db->f('email'); mail($email,'Change Notification from '.$site_name,"

New password: $new_pass1

","Content-Type: text/html\nFrom: $admin_email\n\n"); print 'Password is changed, go back.'; } else { print 'Old password is wrong, Go back to correct.'; } } } function change_pass() { $url = $_SERVER['PHP_SELF']; $tpl = new FastTemplate('templates'); $tpl->define(array(change_pass => 'change_pass.php')); $tpl->assign(array(URL => $url)); $tpl->parse('MAIN','change_pass'); $tpl->FastPrint(); } function main_area() { global $db, $cookie, $site_name; $url = $_SERVER['PHP_SELF']; $db->query('select total from t_counter_totals where id='.$cookie['id']); $db->next_record(); $total = $db->f('total'); $db->query('select count(*) from t_counter_uniques where id='.$cookie['id']); $db->next_record(); $unique = $db->f(0); $db->query('select paid,expires,secret,referer from t_counter_profiles where id='.$cookie['id']); $db->next_record(); $paid = $db->f('paid'); $expires = $db->f('expires'); $secret = $db->f('secret'); $referer = $db->f('referer'); if($referer != '') { $important = '
Change this value if you move your counter to some other location.
'; } $now = time(); $sec_left = $expires - $now; switch($paid) { case '0': $status = 'You are a free member!'; break; case '3': $status = 'You have a lifetime membership!'; break; default: if($sec_left <= 86400 && $sec_left > 0) { $remainder = $sec_left % 3600; $min = ceil($remainder/60); $hour = floor($sec_left/3600); $left = 'less than a day left - '.$hour.'h '.$min.'min'; $status = 'Membership expires: '.$left.''; } else if($sec_left > 86400) { $days = ceil($sec_left/86400); $left = $days.' day(s) left'; $status = 'Membership expires: '.$left.''; } else if($sec_left < 0) { $status = 'You are a free member!'; $db->query('update t_counter_profiles set paid=\'0\', expires=0 where id='.$cookie['id']); } break; } $code = ''."\n"; $code .= ''."\n"; $code .= ''."\n"; $tpl = new FastTemplate('templates'); $tpl->define(array(index => 'member_area.php')); $tpl->assign(array(URL => $url, ID => $cookie['id'], INFO => $info, STATUS => $status, TOTAL => $total, UNIQUE => $unique, CODE => $code, IMPORTANT => $important)); $tpl->parse('MAIN','index'); $tpl->FastPrint(); } function logout() { delete_cookie('counter_member'); login(); } function check_login() { global $db,$cookie; $db->query('select pass from t_counter_profiles where id='.$cookie['id']); $db->next_record(); if(strcmp($db->f('pass'),$cookie['pass']) != 0 || !$db->num_rows()) { include_once('templates/header.php'); include_once('templates/member_login_form.php'); include_once('templates/footer.php'); exit; } } function login() { global $db,$cookie; $db->query('select pass from t_counter_profiles where id='.$_REQUEST['id']); $db->next_record(); $pass = $db->f('pass'); if(!strcmp($pass,$_REQUEST['pass']) && $pass != '' && $_REQUEST['pass'] != '' && $db->num_rows()) { $time = -1; if($_REQUEST['remember'] == 1) $time = 24*60*60; set_cookie('counter_member',array('id' => $_REQUEST['id'], 'pass' => $_REQUEST['pass']),$time); $cookie['id'] = $_REQUEST['id']; $cookie['pass'] = $_REQUEST['pass']; } else { include_once('templates/header.php'); print '
Wrong id or password!

'; include_once('templates/member_login_form.php'); include_once('templates/footer.php'); exit; } } ?>