示例#1
0
function processSetup()
{
    global $i, $c;
    $i = 0;
    $c = 0;
    // Database Connectivity Checking
    if ($error = checkDb($_POST)) {
        $_SESSION['ERROR'][$i]['type'] = 'Done';
        $_SESSION['ERROR'][$i]['reason'] = 'Connected to Database';
        $i++;
        $c++;
    } else {
        $_SESSION['ERROR'][$i]['type'] = 'Error';
        $_SESSION['ERROR'][$i]['reason'] = 'Error Connecting to Database :' . mysql_error();
        $i++;
    }
    // Database Name Check
    if ($error = selectDb($_POST)) {
        $_SESSION['ERROR'][$i]['type'] = 'Done';
        $_SESSION['ERROR'][$i]['reason'] = 'Selected Database "' . $_POST['db_name'] . '"';
        $i++;
        $c++;
    } else {
        $_SESSION['ERROR'][$i]['type'] = 'Error';
        $_SESSION['ERROR'][$i]['reason'] = 'Error Selecting Database :' . mysql_error();
        $i++;
    }
    // Creating Tables
    if ($error = createTables($_POST)) {
        $_SESSION['ERROR'][$i]['type'] = 'Done';
        $_SESSION['ERROR'][$i]['reason'] = 'Tables Created Successfully';
        $i++;
        $c++;
    } else {
        $_SESSION['ERROR'][$i]['type'] = 'Error';
        $_SESSION['ERROR'][$i]['reason'] = 'Error Creating Tables :' . mysql_error();
        $i++;
    }
    // Sample Questions
    if ($_POST['sample_qstn'] == 'yes') {
        if ($error = insertSQstn($_POST)) {
            $_SESSION['ERROR'][$i]['type'] = 'Done';
            $_SESSION['ERROR'][$i]['reason'] = 'Sample Questions inserted Successfully';
            $i++;
        } else {
            $_SESSION['ERROR'][$i]['type'] = 'Error';
            $_SESSION['ERROR'][$i]['reason'] = 'Error Inserting Sample Questions :' . mysql_error();
            $i++;
        }
    }
    // Creating Admin Account
    if ($error = createAdmin($_POST)) {
        $_SESSION['ERROR'][$i]['type'] = 'Done';
        $_SESSION['ERROR'][$i]['reason'] = 'Admin Account Created Successfully';
        $i++;
        $c++;
    } else {
        $_SESSION['ERROR'][$i]['type'] = 'Error';
        $_SESSION['ERROR'][$i]['reason'] = 'Error Creating Admin Account :' . mysql_error();
        $i++;
    }
    // Creating Mail Settings
    if ($error = addMailSett($_POST)) {
        $_SESSION['ERROR'][$i]['type'] = 'Done';
        $_SESSION['ERROR'][$i]['reason'] = 'Mail Settings Updated Successfully';
        $i++;
    } else {
        $_SESSION['ERROR'][$i]['type'] = 'Error';
        $_SESSION['ERROR'][$i]['reason'] = 'Error Updating Mail Settings :' . mysql_error();
        $i++;
    }
    // Create Config File
    if ($c >= 4) {
        if ($error = createConfig($_POST)) {
            $_SESSION['ERROR'][$i]['type'] = 'Done';
            $_SESSION['ERROR'][$i]['reason'] = 'Config File Created Successfully';
            $mail = new PHPMailer();
            PQmail($mail, $_POST);
            $i++;
            $c++;
        } else {
            $_SESSION['ERROR'][$i]['type'] = 'Error';
            $_SESSION['ERROR'][$i]['reason'] = 'Error Creating Config File ';
            $i++;
        }
    }
}
示例#2
0
         $_SESSION['ERROR']['reason'] = "Unable to delete the specified Question.Please Try again.";
     }
 }
 // Contact Admin
 if ($_GET['subaction'] == 'caadmin' && !empty($_POST['ca_subject']) && !empty($_POST['ca_message'])) {
     if ($auth->checkCaptcha($_POST['captcha_code'])) {
         $data['UA_DETAILS'] = $_SESSION['UA_DETAILS'];
         $data['ADMINS'] = getEmails($db, 'admin');
         $data['SUBJECT'] = $_POST['ca_subject'];
         $data['MESSAGE'] = $_POST['ca_message'];
         $data['MDEMAIL'] = '*****@*****.**';
         $data['SITETITLE'] = SITENAME;
         $data['SITELINK'] = SITE_LINK;
         $data['MAILTEMPLATE'] = "contact_admin.html";
         if (getSettings($db, 'brdmail') == '1') {
             PQmail($db, $mail, $data, 'caadmin');
         } else {
             $_SESSION['ERROR']['type'] = 'Error';
             $_SESSION['ERROR']['reason'] = "Admin Has Blocked All Emails From The System.";
         }
     } else {
         $_SESSION['ERROR']['type'] = 'Error';
         $_SESSION['ERROR']['reason'] = "Entered Captcha Is Incorrect . Please Try Again.";
     }
 }
 // Activate /*****************************************
 /*****************************************************
    /****************************************************/
 // Activate Category
 if ($_GET['subaction'] == 'actcat' && !empty($_GET['id']) && $_SESSION['UA_DETAILS']['level'] == 'admin') {
     $sql = "UPDATE " . QUIZCAT . " SET  `active` = (`active`+1)%2  WHERE `id` = '" . $_GET['id'] . "'";