function pj_REQUEST($in, $default = false)
{
    return isset($_GET[$in]) ? pj_input(pj_GET($in)) : (isset($_POST[$in]) ? pj_input(pj_POST($in)) : $default);
}
<?php

define('IN_SCRIPT', 1);
define('THIS_PAGE', 'BACKUPS');
// Require the settings file
require '../ccount_settings.php';
// Load functions
require '../inc/common.inc.php';
// Start session
pj_session_start();
// Are we logged in?
pj_isLoggedIn(true);
// The settings file is in parent folder
$ccount_settings['db_file'] = '../' . $ccount_settings['db_file'];
// Download backup?
if (pj_GET('download') && pj_token_check()) {
    // Check demo mode
    pj_demo('backups.php');
    // Send the backup file as an attachment
    header("Pragma: ");
    # To fix a bug in IE when running https
    header("Cache-Control: ");
    # To fix a bug in IE when running https
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Length: ' . filesize($ccount_settings['db_file']));
    header('Content-Disposition: attachment; filename=CCount_backup_' . date('Y-M-d') . '.php');
    readfile($ccount_settings['db_file']);
    exit;
}
// Restore backup?
Example #3
0
// The settings file is in parent folder
$ccount_settings['db_file'] = '../' . $ccount_settings['db_file'];
// Get links
if (file_exists($ccount_settings['db_file'])) {
    // Get links database
    $data = explode('//', file_get_contents($ccount_settings['db_file']), 2);
    // Convert contents into an array
    $ccount_database = isset($data[1]) ? unserialize($data[1]) : array();
    unset($data);
    // Any special actions?
    $action = pj_GET('action');
    if ($action && pj_token_check()) {
        // Check demo mode
        pj_demo();
        // Link ID
        $modified_id = preg_replace('/[^0-9a-zA-Z_\\-\\.]/', '', pj_GET('id'));
        // Link ID exists?
        if ($action != 'reset_all' && (strlen($modified_id) < 1 || !isset($ccount_database[$modified_id]))) {
            $_SESSION['PJ_MESSAGES']['ERROR'] = 'Invalid link ID';
            header('Location: admin.php');
            exit;
        }
        // Do the action
        if ($action == 'reset') {
            $ccount_database[$modified_id]['C'] = 0;
            $ccount_database[$modified_id]['U'] = 0;
            $success_message = 'Link with ID ' . $modified_id . ' has been reset';
        } elseif ($action == 'delete') {
            unset($ccount_database[$modified_id]);
            $success_message = 'Link with ID ' . $modified_id . ' has been deleted';
        } elseif ($action == 'reset_all') {
Example #4
0
*  Removing any of the copyright notices without purchasing a license
*  is expressly forbidden. To remove copyright notice you must purchase
*  a license for this script. For more information on how to obtain
*  a license please visit the page below:
*  http://www.phpjunkyard.com/buy.php
*******************************************************************************/
define('IN_SCRIPT', 1);
define('THIS_PAGE', 'INDEX');
// Require the settings file
require '../ccount_settings.php';
// Load functions
require '../inc/common.inc.php';
// Start session
pj_session_start();
// Is this a LOGOUT request?
if (pj_GET('logout', false) !== false && pj_token_check()) {
    // Expire session variable
    $_SESSION['LOGGED_IN'] = false;
    // Delete cookie
    setcookie('ccount_hash', '');
    // Stop session
    pj_session_stop();
    // Define a success message
    $_SESSION['PJ_MESSAGES']['SUCCESS'] = 'You have logged out successfuly.';
} elseif (pj_isLoggedIn()) {
    header('Location: admin.php');
    die;
} elseif ($_SERVER['REQUEST_METHOD'] == 'POST') {
    // Check password etc
    if (stripslashes(pj_input(pj_POST('pass', false))) == $ccount_settings['admin_pass']) {
        // Set session variable