function createurl($fp) { $urlstr = 'http://weixin.qq.com/r/uzpudh3EOEBHrVkV92_p?trace_code='; $uniqid = getGuid(); $uniqid2 = getGuid(); $url = $urlstr . "" . $uniqid; $url2 = $urlstr . "" . $uniqid2; $data_end = $url . "," . $url2; $data_arr3 = "\r\n" . $data_end; $data_str4 = iconv('utf-8', 'gb2312', $data_arr3); return $data_str4; }
/** * [__construct description] * @method __construct * @param string $emailAddress [description] * @param string $firstName [description] * @param string $lastName [description] */ public function __construct($emailAddress = "", $firstName = "", $lastName = "") { parent::__construct(); // ensure root object properties are initialized $this->emailAddress = $emailAddress; $this->firstName = $firstName; $this->lastName = $lastName; $this->confirmationToken = getGuid(); $this->dates = new \GeniusFactor\Fibr\BaseObjects\GFDate(); $this->gender = new \GeniusFactor\Fibr\BaseObjects\GFGender(); $this->isActive = false; }
/** * Handle LTI requests of type `content-item` * * @return void */ public function onContentItem() { $this->initSession(); /* blindly copied from Vickers' Rating demo app */ $_SESSION[__CLASS__] = ['consumer_key' => $this->consumer->getKey(), 'resource_id' => getGuid(), 'resource_id_created' => false, 'user_consumer_key' => $this->consumer->getKey(), 'user_id' => 'System', 'isStudent' => false, 'isContentItem' => true, 'lti_version' => $_POST['lti_version'], 'return_url' => $this->return_url, 'title' => postValue('title'), 'text' => postValue('text'), 'data' => postValue('data'), 'document_targets' => $this->documentTargets]; $this->redirectURL = $this->assignRedirect('content-item'); }
<?php function getGuid($userCourseName) { $url = 'http://mobile.nottingham.ac.uk/hack/data/timetabling/2015/courses'; $data = json_decode(file_get_contents($url)); $schools = $data->Courses->School; foreach ($schools as $school) { $schoolsCourses = $school->Course; foreach ($schoolsCourses as $schoolsCourse) { if ($schoolsCourse->Name == $userCourseName) { return $schoolsCourse->Guid; } } } } require 'sql-connect.php'; try { $query = $db->prepare("SELECT * FROM user_info WHERE username=:username"); $query->execute(array('username' => $_REQUEST['username'])); $user_info = $query->fetch(); } catch (PDOException $e) { die($e->getMessage()); } $currentAcademicYear = date('Y', strtotime("-9 months")); //2015-16 is counted as just 2015 - works out current academic year startting 1st spet $userStartingYear = $user_info[start_year]; $userInYear = $currentAcademicYear - $userStartingYear + 1; $COURSEGUID = getGuid("{$user_info['course_name']}/{$userInYear}"); $url = "http://mobile.nottingham.ac.uk/hack/data/timetabling/{$currentAcademicYear}/activities/course/{$COURSEGUID}"; include 'calgen.php';
$first_name = cleanInput($fb_fetch['first_name']); $last_name = cleanInput($fb_fetch['last_name']); $is_admin = intval($fb_fetch['is_admin']); try { $fb_update = "UPDATE `members` SET `access` = :access_date, `fb_id` = :temp_fb_id WHERE `id` = :userid"; $fb_update_do = $db->prepare($fb_update); $fb_update_do->bindParam(':access_date', $access_date, PDO::PARAM_STR); $fb_update_do->bindParam(':temp_fb_id', $temp_fb_id, PDO::PARAM_INT); $fb_update_do->bindParam(':userid', $userid, PDO::PARAM_INT); $fb_update_do->execute(); } catch (PDOException $e) { /* catch and log errors over here. */ } } else { /* creating a random key for the user */ $temp_key = getGuid(); $temp_password = createRandomPassword(); $temp_password = generate_encrypted_password($temp_password); /* fetching the user's first and last name from their facebook profile. */ $first_name = $user->first_name; $last_name = $user->last_name; try { $fb_insert = "INSERT INTO `members`(`first_name`, `last_name`, `password`, `email`, `key`, `verified`, `join`, `access`, `fb_id`) VALUE(:first_name, :last_name, :temp_password, :fb_email, :temp_key, 1, :access_date, :access_date, :temp_fb_id)"; $fb_insert_do = $db->prepare($fb_insert); $fb_insert_do->bindParam(':first_name', $first_name, PDO::PARAM_STR); $fb_insert_do->bindParam(':last_name', $last_name, PDO::PARAM_STR); $fb_insert_do->bindParam(':temp_password', $temp_password, PDO::PARAM_STR); $fb_insert_do->bindParam(':fb_email', $fb_email, PDO::PARAM_STR); $fb_insert_do->bindParam(':temp_key', $temp_key, PDO::PARAM_STR); $fb_insert_do->bindParam(':access_date', $access_date, PDO::PARAM_STR); $fb_insert_do->bindParam(':temp_fb_id', $temp_fb_id, PDO::PARAM_INT);
$file = fopen("install/database.sql", "r"); $read = fread($file, filesize("install/database.sql")); $read = explode(";", $read); foreach ($read as $query) { mysql_query($query); } unset($query); fclose($file); $update_s1 = mysql_query("UPDATE `settings` SET `option_value` = '{$websitepath}' WHERE `option_name` = 'website'") or die(mysql_error()); $update_s2 = mysql_query("UPDATE `settings` SET `option_value` = '{$adminemail}' WHERE `option_name` = 'admin_email'") or die(mysql_error()); $update_s3 = mysql_query("UPDATE `settings` SET `option_value` = '{$adminemail}' WHERE `option_name` = 'sending_email'") or die(mysql_error()); $join = date("Y-m-d H:i:s"); /* getGuid() function generates a random unique 32 character unique key. */ $key = getGuid(); /* encrypting the password using the required format. */ $adminpass = generate_encrypted_password($adminpass); /* create first user with the admin rights. */ $create_admin = "INSERT INTO `members`(`first_name`, `last_name`, `password`, `email`, `key`, `verified`, `join`, `is_admin`) VALUE('Site', 'Admin', '{$adminpass}', '{$adminemail}', '{$key}', 1, '{$join}', 1)"; $execute_query = mysql_query($create_admin) or die(mysql_error()); if ($execute_query) { ?> <div class="page-header"> <h1>Final Step</h1> </div>
public function chooseOrgUserSave() { $org_id = getFormGetPostValue('org_id'); $uids = getFormGetPostValue('uids'); $array = explode(',', $uids); if ($array && count($array) > 0) { $dataList = array(); foreach ($array as $id) { $dataList[] = array('id' => getGuid(), 'org_id' => $org_id, 'user_id' => $id); } $Model = M("SysOrgUser"); $Model->addAll($dataList); } $this->ajaxReturn(returnStatus()); }
try { $q = "SELECT * FROM `members` WHERE `email` = :email"; $q_do = $db->prepare($q); $q_do->bindParam(':email', $email, PDO::PARAM_STR); $q_do->execute(); $number = $db->query("SELECT FOUND_ROWS()")->fetchColumn(); } catch (PDOException $e) { $log->logError($e . " - " . basename(__FILE__)); } if (!empty($number)) { $f = $q_do->fetch(PDO::FETCH_ASSOC); $uid = intval($f['id']); /* generate a random reset key for generating a random password. */ $reset_key = getGuid(); $temp_time = time(); $expires_at = $temp_time + 86400; try { $update_forgot = "UPDATE `members` SET `pass_reset_key` = :reset_key, `expires_at` = :expires_at WHERE `id` = :uid"; $update_forgot_do = $db->prepare($update_forgot); $update_forgot_do->bindParam(':reset_key', $reset_key, PDO::PARAM_STR); $update_forgot_do->bindParam(':expires_at', $expires_at, PDO::PARAM_INT); $update_forgot_do->bindParam(':uid', $uid, PDO::PARAM_INT); $update_forgot_do->execute(); } catch (PDOException $e) { $log->logError($e . " - " . basename(__FILE__)); } forgotpass_email($email, $reset_key); $err = "<div class=\"alert alert-success\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button><strong>" . _("Password reset link sent.") . "</strong><br/>" . _("You will receive an email with password reset link shortly. Use the link to reset your password and start accessing our services.") . "</div>"; } else {
// windows differs from *nix // kernel version = windows version // os version = build number $kernel_v = $server_arr[3]; } else { if (strpos($server, 'Linux') !== false) { $os = 'Linux'; } else { $os = 'Unix'; } } } return $os . '|' . $kernel_v . '|' . $os_v; } function sendForm($data) { $url = 'http://ktnetwork.knowledgetree.com/call_home.php'; $data = http_build_query($data); $ch = curl_init($url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_exec($ch); curl_close($ch); } $post_str = getGuid() . '|' . getUserCnt() . '|' . getDocCnt() . '|' . getKTVersion() . '|' . getKTEdition() . '|' . getOSInfo(); $data['system_info'] = $post_str; sendForm($data); $default->log->debug('System information collection script finishing.'); exit(0);