コード例 #1
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', 'EDITLINK');
// 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'];
// Pre-set values
$error_buffer = array();
$warn_new_link = false;
// 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);
// Link ID
$id_old = preg_replace('/[^0-9a-zA-Z_\\-\\.]/', '', pj_REQUEST('id'));
// Link ID exists?
if (strlen($id_old) < 1 || !isset($ccount_database[$id_old])) {
    $_SESSION['PJ_MESSAGES']['ERROR'] = 'Invalid link ID';
コード例 #2
0
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
        $_SESSION['LOGGED_IN'] = true;
        // Remember user?
        if (pj_POST('remember') == 'yes') {
            setcookie('ccount_hash', pj_Pass2Hash($ccount_settings['admin_pass']), strtotime('+1 year'));
        }
        // Redirect to admin
        header('Location: admin.php');
        die;
    } else {