<?php

//Include the PS_Pagination class
require_once 'php/db_interface/autoload.php';
session_start();
if (!isset($_SESSION['userid'])) {
    header('Location: /');
}
$username = "******";
$user = new user();
$uid = $_SESSION['userid'];
$user->set_variable('users_id', $uid);
$admin = new admins();
$admin->set_variable('admin_user_id', $user->get_variable('users_id'));
$isAdmin = false;
if ($admin->load()) {
    $isAdmin = true;
} else {
    header('Location: /');
}
$referral = new referral();
$referral->set_variable("referral_id", intval($_POST['rid']));
if ($referral->load()) {
    $isPaid = $_POST['isPaid'] == "true" ? 1 : 0;
    $referral->set_variable("referral_paid", $isPaid);
    echo $referral->debug();
    $referral->update();
    echo "SUCCESS";
} else {
    echo "FAILURE";
}
Esempio n. 2
0
require_once 'php/db_interface/autoload.php';
session_start();
if (!isset($_SESSION['userid'])) {
    header('Location: /');
}
$username = "******";
$user = new user();
$uid = $_SESSION['userid'];
$user->set_variable('users_id', $uid);
$userCreationDate;
if ($user->load()) {
    $username = $user->get_variable('users_username');
    $userCreationDate = $user->get_variable('users_creationdate');
}
$admin = new admins();
$admin->set_variable('admin_user_id', $uid);
$isAdmin = false;
$showToAdminClass = '';
if ($admin->load()) {
    $isAdmin = true;
    $showToAdminClass = '';
}
if (isset($_GET['lo'])) {
    session_destroy();
    header('Location: /');
}
$showClass = "";
$trialTimeClass = "none";
$showData = true;
$paymentDates = payment_info::getPaymentDates($uid);
$trialMessage = "";
Esempio n. 3
0
 static function LoginCheckAndRedirect(&$isAdmin, &$username)
 {
     session_start();
     if (!isset($_SESSION['userid'])) {
         header('Location: /');
     }
     $username = "******";
     $user = new user();
     $user->set_variable('users_id', $_SESSION['userid']);
     if ($user->load()) {
         $username = $user->get_variable('users_username');
     }
     $admin = new admins();
     $admin->set_variable('admin_user_id', $user->get_variable('users_id'));
     $isAdmin = false;
     if ($admin->load()) {
         $isAdmin = true;
     } else {
         header('Location: /');
     }
     if (isset($_GET['lo'])) {
         session_destroy();
         header('Location: /');
     }
     return $isAdmin;
 }