function loginUser($uname, $uepwd) { global $DE_GLOBALS_USERLOGINERR; if ($uname == "sadmin") { $password = getVariableFromSadminTbl('sadminpass'); } else { $password = executesql_returnArray("select password from users where username='******' and user_status='A' ;"); } if (!$password || $password != $uepwd) { send_Action_Response('Fail', $DE_GLOBALS_USERLOGINERR); } $_SESSION["uname"] = "{$uname}"; if (get_POST_var('setcuky') == 'true') { $cookieid = getaRandomString(32); setcookie(USERCOOKIENAME, $cookieid, time() + 7 * 24 * 3600); $success = execute_sqlInsert('cookies', array(username => $uname, cookieid => $cookieid, cookietime => 'CURRENT_TIMESTAMP')); } logUserEvent($uname . ' (User) Logged In'); alertAppAdmin($uname . ' (User) Logged In'); send_Action_Response('Success', 'To Welcome Page'); exit; }
$processemail_debugoutput = "Added Reminder on {$reminder_emailWhen} \n for {$reminder_emailBody}"; } if ($before_underscore == 'comments') { if (preg_match('/TN(?<digit>\\d+)(.*)/i', $thisemail_subject, $matches)) { $manageWorks = new manageWorks(); // $matches[2] = trim($matches[2]); rest of the subject after 'TNXXX' $WORK_ID = $matches[1]; $manageWorks->addComment($WORK_ID, $SUBDOMAIN_USER, $thisemail_body); $processemail_debugoutput = "Added Comment to Task {$WORK_ID} \n Comment: {$thisemail_body} "; // If the email received has attachments , put attach those files to this task $attachments = $Parser->getAttachments(); if (count($attachments)) { $tmp_uploadedOn = get_currentPHPTimestamp(); foreach ($attachments as $attachment) { $upload_filename = $attachment->filename; $TMP_SOMENAME = '/tmp/' . getaRandomString(9); if ($fp = fopen($TMP_SOMENAME, 'w')) { while ($bytes = $attachment->read()) { fwrite($fp, $bytes); } fclose($fp); $fp = fopen($TMP_SOMENAME, 'r'); $TMP_SOMENAME_SIZE = filesize($TMP_SOMENAME); $TMP_SOMENAME_CONTENT = bin2hex(fread($fp, $TMP_SOMENAME_SIZE)); $success = execute_sqlInsert('attachments', array('workid' => $WORK_ID, 'uploadname' => $upload_filename, 'uploadedby' => $SUBDOMAIN_USER, 'filecontent' => $TMP_SOMENAME_CONTENT, 'filesize' => $TMP_SOMENAME_SIZE, 'uploadedOn' => $tmp_uploadedOn)); fclose($fp); unlink($TMP_SOMENAME); } } } }
function generate_newRandomFile() { global $given_file_parts; global $UPload_ToThisFolder; $random_filename = getaRandomString(32) . "." . $given_file_parts['extension']; $UPload_ToThisFile = $UPload_ToThisFolder . "/" . $random_filename; if (file_exists($UPload_ToThisFile)) { $random_filename = generate_newRandomFile(); } return $random_filename; }
public function createUnique_FID($no_of_digits) { $pass = getaRandomString($no_of_digits); $check_fid = mysql_num_rows(mysql_query("SELECT fileCode FROM tbl_chatFiles WHERE fileCode='{$pass}'")); return $check_fid > 0 ? $this->createUnique_FID($no_of_digits) : $pass; }
break; case 'updateTasksStatus': $dclid = get_POST_var('dclid'); $task_status = get_POST_var('task_status'); $result = execute_sqlUpdate("dailychecklist", array(status => $task_status), array(username => $USERNAME, dclid => $dclid)); send_Action_Response('Success', "Status Reset !"); exit; break; case 'deleteDailyRoutineTask': $dclid = get_POST_var('dclid'); $result = mysql_query("delete from dailychecklist where username='******' and dclid='{$dclid}' "); send_Action_Response('Success', "deleted daily routine task !"); exit; break; case 'newIcalURL': $new_Key = getaRandomString(32); $result = execute_sqlUpdate("users", array('remindersicalkey' => $new_Key), array('username' => $USERNAME)); send_Action_Response('Success', "ical key was reset !"); exit; break; case 'getJsonEventsForCalendarView': $tasks = array(); $twomonths_ago = date("Y-m-d", strtotime("-2 month")); $fourmonths_fromnow = date("Y-m-d", strtotime("+4 month")); $sqlquery = "select work_deadLine, workID, work_briefDesc, work_RTID from works_todolist where work_deadLine > '{$twomonths_ago}' and work_deadLine < '{$fourmonths_fromnow}' and work_userAssigned = '{$USERNAME}' "; $query = mysql_query($sqlquery) or die("Invalid query: " . mysql_error()); while ($row = @mysql_fetch_array($query)) { // extract($row) ; // $work_deadLine, workID, work_briefDesc, work_RTID list($evYear, $evMonth, $evDay) = explode('-', $row['work_deadLine']); $ntask = array(); $ntask['tY'] = $evYear;