예제 #1
0
*      Email: alex@cgi-central.net
*        Web: http://www.cgi-central.net
*    Details: Affiliate commission
*    FileName $RCSfile$
*    Release: 3.1.8PRO ($Revision: 2029 $)
*
* Please direct bug reports,suggestions or feedback to the cgi-central forums.
* http://www.cgi-central.net/forum/
*                                                                          
* aMember PRO is a commercial software. Any distribution is strictly prohibited.
*
*/
include "../config.inc.php";
$t = new_smarty();
include "login.inc.php";
admin_check_permissions('affiliates');
$vars = get_input_vars();
function display_banners()
{
    global $db, $t, $config;
    /////
    $links = array();
    foreach ((array) $config['aff']['links'] as $i => $l) {
        $l['url'] = aff_make_url($l['url'], 'l' . $i, -1);
        $l['code'] = "<a href=\"{$l['url']}\">{$l['title']}</a>";
        $links[$i] = $l;
    }
    $t->assign('links', $links);
    /////////
    foreach ((array) $config['aff']['banners'] as $i => $l) {
        $l['url'] = aff_make_url($l['url'], 'b' . $i, -1);
예제 #2
0
*      Email: alex@cgi-central.net
*        Web: http://www.cgi-central.net
*    Details: Admin Info /
*    FileName $RCSfile$
*    Release: 3.1.8PRO ($Revision: 2926 $)
*
* Please direct bug reports,suggestions or feedback to the cgi-central forums.
* http://www.cgi-central.net/forum/
*                                                                          
* aMember PRO is a commercial software. Any distribution is strictly prohibited.
*
*/
include "../config.inc.php";
$t = new_smarty();
include "login.inc.php";
admin_check_permissions('backup_restore');
check_lite();
function mysql_escape_value($v)
{
    return "'" . mysql_escape_string($v) . "'";
}
function do_restore()
{
    global $config, $plugin_config, $db;
    $file = $_FILES['file']['tmp_name'];
    $f = file($file);
    $first_line = trim($f[0]);
    $second_line = trim($f[1]);
    global $t;
    $t->assign('backup_header', "{$first_line}<br />{$second_line}");
    $f = join('', $f);
예제 #3
0
*    FileName $RCSfile$
*    Release: 3.1.8PRO ($Revision: 3211 $)
*
* Please direct bug reports,suggestions or feedback to the cgi-central forums.
* http://www.cgi-central.net/forum/
*                                                                          
* aMember PRO is a commercial software. Any distribution is strictly prohibited.
*
*/
require "../config.inc.php";
if (!defined('AM_DEBUG')) {
    die("Disabled by default, you have to edit admin/sql.php to enable SQL Monitor");
}
$t = new_smarty();
require "login.inc.php";
admin_check_permissions('super_user');
check_demo();
define('AM_DEBUG', 1);
$vars = get_input_vars();
$sql = $vars['sql'];
$h_sql = htmlentities($sql);
$t->display('admin/header.inc.html');
print <<<CUT
<center>
<h2>SQL Monitor</h2>
<hr>
<form method=post>
<textarea name="sql" cols="80" rows="5">{$h_sql}</textarea>
<br />
<input type=submit value="Go" style='width: 200px;'>
</form>
<?php

$avoid_timeout = 1;
include "../config.inc.php";
$t = new_smarty();
include "login.inc.php";
ignore_user_abort(true);
@set_time_limit(0);
check_lite();
admin_check_permissions('email');
///////////////////////////////////////////////////////////////
function display_members_list()
{
    global $db, $t, $vars;
    global $all_count, $count, $start;
    $count = 20;
    $all_count = $db->get_members_list_c('', array($vars['tr']));
    $ml =& $db->get_members_list($start, $count, '', array($vars['tr']));
    $t->assign('ml', $ml);
    $t->display('admin/newsletter_view_members.html');
}
//////////////////// main ////////////////////////////////////////
$vars = get_input_vars();
if (isset($vars['start'])) {
    $start = $vars['start'];
}
display_members_list();
예제 #5
0
*        Web: http://www.cgi-central.net
*    Details: Admin index
*    FileName $RCSfile$
*    Release: 3.1.8PRO ($Revision: 3431 $)
*
* Please direct bug reports,suggestions or feedback to the cgi-central forums.
* http://www.cgi-central.net/forum/
*                                                                          
* aMember PRO is a commercial software. Any distribution is strictly prohibited.
*
*/
include "../config.inc.php";
$t = new_smarty();
include "login.inc.php";
check_lite();
admin_check_permissions('report');
$_reports = array();
function add_report($name, $title)
{
    global $_reports;
    $_reports[] = array('name' => $name, 'title' => $title);
}
function load_reports()
{
    global $config;
    $d = opendir($pdir = $config['root_dir'] . '/admin/reports');
    if (!$d) {
        die("Cannot open {$config[root_dir]}/admin/reports/");
    }
    while ($f = readdir($d)) {
        if (!preg_match('/^[^\\._].+php$/', $f)) {
예제 #6
0
*    Details: Protect folders
*    FileName $RCSfile$
*    Release: 3.1.8PRO ($Revision: 2926 $)
*
* Please direct bug reports,suggestions or feedback to the cgi-central forums.
* http://www.cgi-central.net/forum/
*
* aMember PRO is a commercial software. Any distribution is strictly prohibited.
*
*/
include "../config.inc.php";
$t = new_smarty();
require "login.inc.php";
require "protection_methods.inc.php";
check_demo();
admin_check_permissions('protect_folders');
function get_folders()
{
    global $db;
    $q = $db->query("SELECT * FROM {$db->config[prefix]}folders");
    $res = array();
    while ($a = mysql_fetch_assoc($q)) {
        $a['files_content'] = $db->decode_data($a['files_content']);
        $res[$a['folder_id']] = $a;
    }
    return $res;
}
function display_folders_list()
{
    global $t;
    $t->assign('folders', get_folders());
예제 #7
0
*        Web: http://www.cgi-central.net
*    Details: Admin Payments
*    FileName $RCSfile$
*    Release: 3.2.3PRO ($Revision: 4981 $)
*
* Please direct bug reports,suggestions or feedback to the cgi-central forums.
* http://www.cgi-central.net/forum/
*                                                                          
* aMember PRO is a commercial software. Any distribution is strictly prohibited.
*
*/
include "../config.inc.php";
$t = new_smarty();
include "login.inc.php";
$vars = get_input_vars();
admin_check_permissions('list_payments');
extract($vars, EXTR_OVERWRITE);
function get_payments_by_date($vars)
{
    global $db, $t;
    $count = 20;
    list($all_count, $all_amount, $all_tax) = $db->get_payments_c($vars['beg_date'], $vars['end_date'], intval($vars['only_completed']), $vars['list_by']);
    $list = $db->get_payments($vars['beg_date'], $vars['end_date'], intval($vars['only_completed']), $vars['start'], $count, $vars['list_by']);
    return array($all_count, $all_amount, $list, $all_tax);
}
function get_payments_by_string($vars)
{
    global $db, $t;
    $count = 20;
    list($all_count, $all_amount, $all_tax) = $db->get_payments_c($vars['beg_date'], $vars['end_date'], intval($vars['only_completed']), $vars['list_by'], null, 1, $vars['q'], $vars['q_where']);
    $list = $db->get_payments($vars['beg_date'], $vars['end_date'], intval($vars['only_completed']), $vars['start'], $count, $vars['list_by'], null, 1, $vars['q'], $vars['q_where']);
예제 #8
0
        $comment = htmlentities($nb['comment']);
        echo "<td colspan={$colspan} class={$cl}><a href=\"{$href}\" title=\"{$comment}\">{$name}</a></td>\n";
        if ($cnt % $rowc == $rowc - 1) {
            echo "</tr>\n";
        }
        $cnt++;
    }
    if ($ost = $cnt % $rowc) {
        $ost = $rowc - $ost;
        echo "<td colspan={$ost} class=notsel>&nbsp;</td></tr>";
    }
    echo "\n";
}
#####################################################
require "{$config['root_dir']}/admin/config.inc.php";
admin_check_permissions('setup');
$vars = get_input_vars();
$error = array();
if (!$vars['notebook']) {
    $vars['notebook'] = $_default_notebook;
}
$vars['notebook'] = preg_replace('[\\\\/]', '', $vars['notebook']);
if ($vars['save']) {
    check_demo();
    save_config_notebook($vars['notebook'], $vars);
} else {
    if ($vars['notebook'] == 'License') {
        check_demo();
    }
    if ($vars['notebook'] == 'Countries') {
        show_config_countries($vars['notebook']);
예제 #9
0
*    FileName $RCSfile$
*    Release: 3.1.8PRO ($Revision: 1917 $)
*
* Please direct bug reports,suggestions or feedback to the cgi-central forums.
* http://www.cgi-central.net/forum/
*                                                                          
* aMember PRO is a commercial software. Any distribution is strictly prohibited.
*
*/
include "../config.inc.php";
$t = new_smarty();
$t->assign('import_f', 1);
include "login.inc.php";
@set_time_limit(3600);
check_lite();
admin_check_permissions('import');
function display_form()
{
    global $t, $db;
    $fields_list = array();
    for ($i = 0; $i < 16; $i++) {
        $fields_list['FIELD-' . $i] = "Field " . ($i + 1);
    }
    $t->assign('fields', $fields_list);
    $t->assign('fields_gen', array('GENERATE' => 'Generate') + $fields_list);
    $t->assign('fields_gen_fixed', array('GENERATE' => 'Generate', 'FIXED' => 'Fixed') + $fields_list);
    $t->assign('fields_emp', array('' => '-- Please select --') + $fields_list);
    $products = array();
    foreach ($db->get_products_list() as $p) {
        $products[$p['product_id']] = $p['title'];
    }
예제 #10
0
function display_aff_sales()
{
    global $member_id, $vars;
    global $db, $t;
    $t->assign('year_month_options', get_ym_options());
    $t->assign('default_month', get_default_ym());
    admin_check_permissions('affiliates');
    if ($vars['year_month'] == '') {
        $vars['year_month'] = get_default_ym();
    }
    list($y, $m) = split('_', $vars['year_month']);
    $m = sprintf('%02d', $m);
    $dat1 = "{$y}-{$m}-01";
    $dat2 = date('Y-m-t', strtotime($dat1));
    $dattm1 = date('Ymd000000', strtotime($dat1));
    $dattm2 = date('Ymd235959', strtotime($dat2));
    $totaldays = date('t', strtotime($dat1));
    $days = array();
    $total = array();
    for ($i = 1; $i <= $totaldays; $i++) {
        $days[$i] = array('dat' => sprintf("{$y}-{$m}-%02d", $i));
    }
    // get clicks for the month
    $q = $db->query("SELECT DAYOFMONTH(ac.time), COUNT(log_id), COUNT(DISTINCT(remote_addr))\n        FROM {$db->config[prefix]}aff_clicks ac\n        WHERE aff_id={$member_id} AND ac.time BETWEEN {$dattm1} AND {$dattm2}\n        GROUP BY DAYOFMONTH(ac.time)\n    ");
    while (list($d, $r, $u) = mysql_fetch_row($q)) {
        $days[$d]['raw'] = $r;
        $days[$d]['uniq'] = $u;
    }
    // get total clicks for the month
    $q = $db->query("SELECT COUNT(log_id), COUNT(DISTINCT(remote_addr))\n        FROM {$db->config[prefix]}aff_clicks ac\n        WHERE aff_id={$member_id} AND ac.time BETWEEN {$dattm1} AND {$dattm2}\n    ");
    while (list($r, $u) = mysql_fetch_row($q)) {
        $total['raw'] = $r;
        $total['uniq'] = $u;
    }
    // get comissions for the month
    $q = $db->query("SELECT DAYOFMONTH(ac.date), COUNT(commission_id),\n        SUM(IF(record_type='debit', amount, 0)), \n        SUM(IF(record_type='credit', amount, 0)),\n        SUM(IF(record_type='debit', 1, 0))\n        FROM {$db->config[prefix]}aff_commission ac\n        WHERE aff_id={$member_id} AND ac.date BETWEEN '{$dat1}' AND '{$dat2}'\n        GROUP BY DAYOFMONTH(ac.date)\n    ");
    while (list($d, $cnt, $deb, $cre, $deb_count) = mysql_fetch_row($q)) {
        $days[$d]['trans'] = $cnt;
        $days[$d]['debit'] = $deb != 0 ? -$deb . " ({$deb_count})" : '';
        $days[$d]['credit'] = $cre;
        $dat = "{$y}-{$m}-{$d}";
        if ($deb || $cre) {
            $rr = $db->query_all("SELECT c.amount as c_amount, c.payment_id, p.member_id, \n        \t\t\tpr.title as pr_title,\n        \t\t\tm.login, m.name_f, m.name_l, p.amount as p_amount, c.tier as tier, c.record_type\n        \t\tFROM {$db->config[prefix]}aff_commission c \n        \t\tLEFT JOIN {$db->config[prefix]}payments p USING (payment_id)\n        \t\tLEFT JOIN {$db->config[prefix]}members m ON p.member_id = m.member_id\n        \t\tLEFT JOIN {$db->config[prefix]}products pr ON p.product_id = pr.product_id \n        \t\tWHERE c.date = '{$dat}' AND c.aff_id={$member_id} \n        \t");
            $days[$d]['detail'] = $rr;
        }
        if ($deb || $cre) {
            $days[$d]['total'] = $cre - $deb;
        }
        $total['trans'] += $cnt;
        $total['debit'] += $deb;
        $total['credit'] += $cre;
        $total['total'] += $days[$d]['total'];
    }
    $total['debit'] = $total['debit'] != 0 ? -$total['debit'] : '';
    $t->assign('days', $days);
    $t->assign('total', $total);
    /// top 20 referrers
    $q = $db->query("SELECT referrer, COUNT(log_id), COUNT(DISTINCT(remote_addr))\n        FROM {$db->config[prefix]}aff_clicks ac\n        WHERE aff_id={$member_id} AND referrer > '' AND ac.time BETWEEN {$dattm1} AND {$dattm2}\n        GROUP BY referrer\n        #ORDER BY COUNT(log_id) DESC, COUNT(DISTINCT(remote_addr)) DESC\n        #LIMIT 0,20\n    ");
    $refs = array();
    while (list($ref, $raw, $uniq) = mysql_fetch_row($q)) {
        $refs[] = array('raw' => $raw, 'uniq' => $uniq, 'ref' => $ref);
    }
    $t->assign('u', $db->get_user($member_id));
    $t->assign('refs', $refs);
    $t->display("admin/user_aff_stats.html");
}
예제 #11
0
*    Details: Admin Payments
*    FileName $RCSfile$
*    Release: 3.1.9PRO ($Revision: 4723 $)
*
* Please direct bug reports,suggestions or feedback to the cgi-central forums.
* http://www.cgi-central.net/forum/
*
* aMember PRO is a commercial software. Any distribution is strictly prohibited.
*
*/
include "../config.inc.php";
$t = new_smarty();
include "login.inc.php";
check_lite();
@set_time_limit(0);
admin_check_permissions('export');
$user_fields = array('login' => 'Username', 'pass' => 'Password', 'email' => 'Email', 'name' => 'Name (first and last)', 'name_f' => 'First Name', 'name_l' => 'Last Name', 'street' => 'Street Address', 'city' => 'City', 'state' => 'State', 'zip' => 'ZIP', 'country' => 'Country', 'is_male' => 'Male-1/Female-0', 'member_id' => 'Internal Member#', 'remote_addr' => 'IP Address', 'unsubscribed' => 'Unsubscribed', 'aff_id' => 'Affiliate ID');
foreach ($member_additional_fields as $f) {
    if ($f['sql']) {
        $user_fields[$f['name']] = $f['title'];
    } else {
        $user_fields['data.' . $f['name']] = $f['title'];
    }
}
$payment_fields = array('product_name' => 'Product/Subscription Type Name', 'product_id' => 'Product/Subscription Type #', 'begin_date' => 'Begin Date', 'expire_date' => 'Expire Date', 'amount' => 'Amount', 'completed' => 'Completed', 'paysys_id' => 'Payment System', 'receipt_id' => 'Receipt #', 'time' => 'Last Updated Time - usually payment date', 'payment_id' => 'Internal Payment#', 'member_id' => 'Internal Member#');
$subscription_types = array('any' => 'All subscriptions', 'active' => 'Active subscriptions (non-expired and completed)', 'not_completed' => 'Not-Completed Subscriptions', 'completed' => 'Completed Subscriptions only', 'expired' => 'Expired Subscriptions only', 'expired_users' => 'Expired Members only(without subscription fields)');
$multi_types = array('discard' => 'Discard additional subscriptions, use
                       first one', 'rows' => 'Output additional rows for every subscription', 'cols' => 'Output additional columns for every subscription');
global $db;
$prod_names = array();
$q = $db->query("SELECT * FROM {$db->config[prefix]}products");
예제 #12
0
        $p = array('member_id' => $member_id, 'product_id' => $vars['product_id'], 'begin_date' => $b, 'expire_date' => $e, 'completed' => 1, 'paysys_id' => 'manual', 'receipt_id' => $vars['receipt_id'], 'amount' => $vars['amount']);
        $db->add_payment($p);
        $added++;
    }
    admin_log("Mass Subscribe {$sf} to Product #{$vars['product_id']}", "products", $vars['product_id']);
    $t->assign('text', "{$added} subscriptions added succesfully.");
    $t->assign('link', "products.php");
    $t->display("admin/mass_subscribed.html");
}
////////////////////////////////////////////////////////////////////////////
//
//                      M A I N
//
////////////////////////////////////////////////////////////////////////////
$vars = get_input_vars();
admin_check_permissions('manage_payments');
$error = array();
switch ($vars['action']) {
    case 'mass_subscribe':
        check_lite();
        check_demo();
        mass_subscribe();
        break;
    case 'mass_subscribe_confirm':
        check_lite();
        check_demo();
        mass_subscribe_confirm();
        break;
    case 'browse':
    case '':
        display_form();
예제 #13
0
        admin_log("Product deleted {$vars['product_id']}");
        $t->assign('msg', 'Product deleted');
        $t->assign('url', "products.php");
        $t->display("admin/product_saved.html");
    }
}
////////////////////////////////////////////////////////////////////////////
//
//                      M A I N
//
////////////////////////////////////////////////////////////////////////////
$vars = get_input_vars();
if ($vars['product_id'] != "") {
    $vars['product_id'] = intval($vars['product_id']);
}
admin_check_permissions('products');
$error = array();
$t->assign('period_options', array('d' => 'Days', 'm' => 'Months', 'y' => 'Years', 'lifetime' => 'Lifetime subscription', 'fixed' => 'Exact date (yyyy-mm-dd)'));
$t->assign('trial_period_options', array('d' => 'Days', 'm' => 'Months', 'y' => 'Years'));
switch ($vars['action']) {
    case 'edit':
        edit_product();
        break;
    case 'edit_save':
        check_demo();
        edit_save();
        break;
    case 'add':
        add_product();
        break;
    case 'add_save':
예제 #14
0
*    Web: http://www.cgi-central.net
*    Details: Coupons management
*    FileName $RCSfile$
*    Release: 3.2.3PRO ($Revision: 5135 $)
*
* Please direct bug reports,suggestions or feedback to the cgi-central forums.
* http://www.cgi-central.net/forum/
*                                                                          
* aMember PRO is a commercial software. Any distribution is strictly prohibited.
*
*/
include "../config.inc.php";
$t = new_smarty();
include "login.inc.php";
check_lite();
admin_check_permissions('manage_coupons');
$count = 20;
function display_batches_list()
{
    global $db, $t;
    global $start, $count, $all_count;
    $list = $db->get_coupon_batches();
    $all_count = count($list);
    $t->assign('batches', @array_slice($list, $start, $count));
    $t->display('admin/coupon_batches.html');
}
function display_generate_form()
{
    global $db, $t, $vars;
    global $start, $count, $all_count;
    $t->assign('discount_types', array('%' => '%', '' => 'USD'));