Exemplo n.º 1
0
function checkLogin_B4_Action()
{
    if (!$_SESSION["uname"]) {
        session_unset();
        session_destroy();
        send_Action_Response('Fail', 'Invalid Session!');
        exit;
    }
}
Exemplo n.º 2
0
 public function deleteProject($projectName)
 {
     if ($projectName == DEFAULTPROJECT) {
         // do let delete the default project
         // TODO return error
         send_Action_Response('Fail', 'Can not delete default project!');
         return;
     }
     if (!$this->canProjectBeDeleted($projectName)) {
         send_Action_Response('Fail', 'Can not delete project with works!');
         return;
     }
     $query = mysql_query("delete from `projects` where `ProjectName` = '{$projectName}' ");
 }
Exemplo n.º 3
0
// HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
// HTTP/1.0
$ACTION = $_POST["action"];
switch ($ACTION) {
    case 'createNewClient':
        $fullname = @$_POST["fullName"];
        $subDomain = @$_POST["subDomain"];
        $packageid = @$_POST["packageid"];
        $adminEmail = @$_POST["adminEmail"];
        $adminPass = @$_POST["adminPass"];
        createNewClientAccount($fullname, $subDomain, $packageid, $adminEmail, $adminPass);
        send_Action_Response('Success', 'new Client Created');
        exit;
        break;
    case 'deleteClient':
        $subdomain = @$_POST["subdomain"];
        deleteClientAccount($subdomain);
        send_Action_Response('Success', 'deleted');
        exit;
        break;
    case 'suspendActivate':
        $subdomain = @$_POST["subdomain"];
        changeClientStatus($subdomain);
        send_Action_Response('Success', 'updated');
        exit;
        break;
    default:
        break;
}
Exemplo n.º 4
0
function execute_sqlUpdate($my_table, $update_array, $where_array)
{
    // update values in table
    //	execute_sqlUpdate("tablename", array(col1=>$val1, col2=>$val2) , array(col3=>"val3", col4=>720) );
    // Sends the following query:
    //	update 'tablename' set col1='$val1', col2='$val2' where col3='val3' and col4=720 ;
    $tmp_setArray = array();
    $tmp_whereArray = array();
    foreach ($update_array as $key => $value) {
        if (!is_numeric($value)) {
            $tmp_setArray[] = $key . "='" . $value . "' ";
        } else {
            $tmp_setArray[] = $key . "=" . $value;
        }
    }
    foreach ($where_array as $key => $value) {
        if (!is_numeric($value)) {
            $tmp_whereArray[] = $key . "='" . $value . "' ";
        } else {
            $tmp_whereArray[] = $key . "=" . $value;
        }
    }
    // Compose the query
    $sql = "update {$my_table} ";
    $sql .= "set " . implode(", ", $tmp_setArray) . " ";
    $sql .= " where " . implode(" and ", $tmp_whereArray);
    $result = @mysql_query($sql) or send_Action_Response('Error', "#ESU001 {$sql}");
    return $result ? true : false;
}
Exemplo n.º 5
0
$USERNAME = $_SESSION['loggedinUser'];
// $_SESSION['loggedinUser'] = $_SERVER['PHP_AUTH_USER'] ;
switch ($ACTION) {
    case 'updatePwd':
        $currentPwd = @$_POST["currentPwd"];
        $newPwd = @$_POST["newPwd"];
        execute_sqlUpdate("users", array(user_pwd => $newPwd), array(username => $USERNAME, user_pwd => $currentPwd));
        send_Action_Response('Success', 'password updated !');
        exit;
        break;
    case 'deleteTask':
        $taskid = @$_POST["taskid"];
        $query = mysql_query("delete from journalentries where jid='{$taskid}' and task_user='******'");
        send_Action_Response('Success', 'Entry deleted !');
        exit;
        break;
    case 'addnewtask':
        $nutask_date = @$_POST["nutask_date"];
        $nutask_duration = @$_POST["nutask_duration"];
        $nutask_desc = @$_POST["nutask_desc"];
        $nutask_project = @$_POST["nutask_project"];
        // if(  $nutask_date == getTomorrowCaldate(-1) || $nutask_date == getTomorrowCaldate(0) || $nutask_date == getTomorrowCaldate(1) ){
        //
        // }else{
        // 	send_Action_Response('Fail' , 'You can enter journal for only today & yesterday !');
        // }
        $success = execute_sqlInsert("journalentries", array('task_day' => $nutask_date, 'task_mins' => $nutask_duration, 'task_desc' => $nutask_desc, 'task_user' => $USERNAME, 'task_project' => $nutask_project));
        send_Action_Response('Success', 'Added !');
        exit;
        break;
}