function uploadFile($userid, $fileName, $fileSize, $fileType, $content) { if ($userid) { $response = Query("INSERT INTO upload (userid, name, size, type, content) \n\t\t\tVALUES ({$userid}, '{$fileName}', '{$fileSize}', '{$fileType}', '{$content}')", debug_backtrace()); return errorChecking($response); } return NULL; }
function insertOption($userid, $optionName, $optionValue = NULL) { if ($userid && $optionName) { $response = Query("INSERT INTO `contacts`.`settings` (`userid`, `option_name`, `option_value`) \n\t\t\tVALUES (" . $userid . ", '" . $optionName . "', '" . $optionValue . "');", debug_backtrace()); return errorChecking($response); } else { return NULL; } }
function downloadFile($userid, $fileId, $fileName = "") { $response = NULL; if ($fileId || $fileName) { $response = Query("SELECT name, type, size, content FROM upload \n\t\t\tWHERE userid = {$userid} AND (fileId = {$fileId} OR name = '{$fileName}');", debug_backtrace()); } else { return NULL; } return errorChecking($response); }
function deletePerson($personid) { $response = NULL; if ($personid) { $response = Query("DELETE FROM `persons` WHERE (`personid`= " . $personid . ")", debug_backtrace()); } else { return NULL; } return errorChecking($response); }
function get_option($var_name, $user_id = 0) { $response = NULL; if ($user_id) { //Επιστροφή ρυθμίσεων που αφορούν έναν συγκεκριμένο χρήστη. $response = Query("SELECT option_value \n\t\tFROM settings\n\t\tWHERE option_name = '{$var_name}' AND userid = '{$user_id}'", debug_backtrace()); } else { //Επιστροφή γενικών ρυθμίσεων που αφορούν όλους τους χρήστες.. } if (errorChecking($response) != NULL) { return $response[0]['option_value']; } else { return NULL; } }
<?php session_start(); list($checkedCase, $checkedSymbol, $checkedNumber) = cachedCheckBox(); $selected_words = ''; if (isset($_GET['WordCount'])) { $NumWordCount = $_GET['WordCount']; $selected_words = errorChecking($NumWordCount); } else { if ($_GET['WordCount'] = '') { } else { $NumWordCount = 4; } } if ($words = file('words.txt')) { $regex = array("\r\n", "\r", "\n"); $words = str_replace($regex, "", $words); $selected_words = array(); // Check is count is less than 1 and greater than 10 and return a error if ($_GET['WordCount'] <= 1 or $_GET['WordCount'] >= 11) { $selected_words = 'Pick a number between 2 and 10'; } else { // Return a random number of words by the amount of words $rand_keys = array_rand($words, $NumWordCount); for ($i = 0; $i < count($rand_keys); $i++) { $selected_words[$i] = $words[$rand_keys[$i]]; } $selected_words = changes($selected_words); } } // Leave a checkbox checked if check