/** * * Check if Tweet was liked * **/ function tweetLikes($tweets) { // Assure Twitter API connection checkError($tweets); foreach ($tweets as $tweet) { if ($tweet["favorite_count"] > 0) { echo 'This tweet was liked ' . $tweet["favorite_count"] . ' time(s)!'; } else { echo "This tweet was not liked!"; } echo "<br />"; } }
function createComboBox_tow($tables, $id_field, $value_field, $id_value, $field_name, $required = "", $actions = "", $cond = "") { $result = '<select name="' . $field_name . '" id="' . $field_name . '" class="' . $required . '" ' . $actions . ' >\\n'; if ($required == '') { $result .= "<option></option>\n"; } $arr_tables = explode(',', $tables); foreach ($arr_tables as $table) { $result .= "<optgroup label='{$table}'>"; $sql_combo = "SELECT {$id_field} , {$value_field} from {$table} {$cond} ORDER BY {$value_field}"; $def = substr($table, 0, 1); $result_combo = MYSQL_QUERY($sql_combo); checkError($result_combo, $sql_combo); $rows_combo = MYSQL_NUM_ROWS($result_combo); $i = 0; while ($i < $rows_combo) { $id = MYSQL_RESULT($result_combo, $i, $id_field); $filds = explode(",", $value_field); $ind = 0; $value = ""; while ($ind < count($filds)) { $value .= MYSQL_RESULT($result_combo, $i, $filds[$ind]) . " "; $ind++; } $result .= "<option "; if ($id_value != null && $id_value != "" && $id_value == $def . $id) { $result .= "selected "; } $result .= "value=\"{$def}{$id}\">" . stripslashes($value) . "</option>\n"; $i++; } $result .= "</optgroup>"; } $result .= "</select>\n"; return $result; }
$strWaring .= GetMessage('MAIN_TP_ERROR_SAVE_FILE', array('#FILE#' => 'footer.php')); } } if (strlen($STYLES) == 0) { $STYLES = ' '; } if (!$APPLICATION->SaveFileContent($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/tmp/templates/__bx_preview/styles.css", $STYLES)) { $strWaring .= GetMessage('MAIN_TP_ERROR_SAVE_FILE', array('#FILE#' => 'styles.css')); } if (strlen($TEMPLATE_STYLES) == 0) { $TEMPLATE_STYLES = ' '; } if (!$APPLICATION->SaveFileContent($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/tmp/templates/__bx_preview/template_styles.css", $TEMPLATE_STYLES)) { $strWaring .= GetMessage('MAIN_TP_ERROR_SAVE_FILE', array('#FILE#' => 'template_styles.css')); } checkError($strWaring); ?> <script type="text/javascript" bxrunfirst="true"> BX.adminPanel.closeWait(); __status = true; </script> <?php } function unifyPHPfragment($str) { if (substr($str, -1) == ';') { $str = substr($str, 0, -1); } $str = strtolower($str); $str = preg_replace("/\\s/i", "", $str); return $str;
} /** * Checks if the captcha was completed, and if it was it * sends the message the user entered to an e-mail address. */ if (isset($_POST['email'])) { $email = $_POST['email']; $message = $_POST['message']; $name = $_POST['name']; // Checks for the reCAPTCHA if ($resp != null && $resp->success) { $captchaError = ""; } else { $captchaError = "Please complete the captcha to register."; } if ($_POST['email'] && checkError($captchaError)) { $msg = "Your message has been sent."; } $to = "*****@*****.**"; $subject = "Duke's Herald - Message from {$name}"; $headers = "MIME-Version: 1.0" . "\r\n"; $headers = "From: {$email}" . "\r\n"; $headers .= "Reply-To: {$email}" . "\r\n"; $headers .= "Content-Type:text/html;charset=UTF-8" . "\r\n"; mail($to, $subject, $message, $headers); } ?> <script> /** * Function that shows the user if the e-mail address they entered
function getColoumnAsArray($table, $coloumn1, $coloumn2) { if ($coloumn2) { $sql = "SELECT {$coloumn1},{$coloumn2} FROM {$table}"; $result = MYSQL_QUERY($sql); $rows_result = MYSQL_NUM_ROWS($result); checkError($result, $sql); $arra = array(); $i = 0; while ($i < $rows_result) { $j = MYSQL_RESULT($result, $i, $coloumn2); $arra[$j] = MYSQL_RESULT($result, $i, $coloumn1); $i++; } } else { $sql = "SELECT {$coloumn1} FROM {$table}"; $result = MYSQL_QUERY($sql); $rows_result = MYSQL_NUM_ROWS($result); checkError($result, $sql); $arra = array(); $i = 0; while ($i < $rows_result) { $arra[$i] = MYSQL_RESULT($result, $i, $coloumn1); $i++; } } return $arra; }
/** * {@inheritdoc} */ protected function getUserByToken($token) { $response = $this->getHttpClient()->get('https://api.weixin.qq.com/sns/userinfo', ['query' => ['access_token' => $token, 'openid' => $this->openId, 'lang' => 'zh_CN']]); return checkError(json_decode($response->getBody(), true)); }
<input type="submit" name="submit" id="submit" value="Save" /><br> <div class='boxConfig'> <h2><?php echo "Error checker"; ?> </h2> <!--<div id="divError">-No errors-</div>--> <?php if (isset($_GET['error'])) { checkError($cnfUsers, 2); checkError($cnfUploads, 1); checkError($cnfUploadsImage, 0); checkError($cnfUploadsVideo, 0); checkError($cnfUploadsAudio, 0); checkError($cnfUploadsFile, 0); $blogMode = 0; if (!is_file("cat.php")) { if (decoct(fileperms('.') & 0777) >= 777) { echo decoct(fileperms('.') & 0777); } else { $errorReport = 1; echo "Your blog hasn't permissions in main folder we try to add its... <br>"; if (chmod($fileCheck, 0777)) { echo "<h4 class='h4Good'>We just added permissions to " . $fileCheck . "! :)</h4><br>"; } else { echo "<h4 class='h4Bad'>We cant add permissions to main folder. Do it manually from cpanel or ftp and add 755 permissions<><br>"; } } } }
echo $msg; die; } //################################################ //XML GENERATED BY OPENEMR //################################################ //$fh=fopen('click_xml.txt','w'); //fwrite($fh,$xml); //echo $xml; //die; //################################################ if (!extension_loaded('curl')) { echo htmlspecialchars(xl('PHP CURL module should be enabled in your server.'), ENT_NOQUOTES); die; } $error = checkError($xml); if ($error == 0) { if ($page == 'compose') { sqlQuery("update patient_data set soap_import_status=1 where pid=?", array($pid)); } elseif ($page == 'medentry') { sqlQuery("update patient_data set soap_import_status=3 where pid=?", array($pid)); } $prescArr = explode(':', $prescIds); foreach ($prescArr as $prescid) { sqlQuery("update prescriptions set erx_uploaded='1', active='0' where patient_id=? and id=?", array($pid, $prescid)); } ?> <script language='JavaScript'> <?php require $GLOBALS['srcdir'] . "/restoreSession.php"; ?>
$count++; $name_error = true; } if (!preg_match($reg_exp_surname, $surname)) { $count++; $sname_error = true; } if (!preg_match($reg_exp_email, $from)) { $count++; $email_error = true; } if (!is_numeric($phone)) { $count++; $phone_error = true; } checkError($count, $to, $name, $surname, $phone, $from, $comments, $phone_error, $email_error, $name_error, $sname_error); ?> <?php function checkError($count, $to, $name, $surname, $phone, $from, $comments, $phone_error, $email_error, $name_error, $sname_error) { $error_messages = ''; $loopResult = ''; if ($name_error) { $error_messages = $error_messages . "" . $name . " is not a valid name" . "<br>"; } if ($sname_error) { $error_messages = $error_messages . "" . $surname . " is not a valid surname" . "<br>"; } if ($email_error) { $error_messages = $error_messages . "" . $from . " is not a valid email address" . "<br>"; }
<?php // Configuration require 'includes/config.php'; // Construct URL $url = 'https://api.twitter.com/1.1/statuses/user_timeline.json'; $getfield = '?screen_name=' . $handle . '&count=3200' . '&include_rts=1'; $requestMethod = 'GET'; // Make authenticated call to Twitter API $twitter = new TwitterAPIExchange($settings); // store returned JSON in associative array $tweets = json_decode($twitter->setGetfield($getfield)->buildOauth($url, $requestMethod)->performRequest(), $assoc = TRUE); // Assure connection to Twitter API checkError($tweets); // Iterate through tweets to find the Top Tweet! $sorted = array(); foreach ($tweets as $key => $row) { // Add # of likes to sorted array $sorted[$key] = $row['favorite_count']; } // Sort array in descending order based on likes array_multisort($sorted, SORT_DESC, $tweets); ?> <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <link rel='stylesheet' type='text/css' href='styles/stylesheet.css'> <link href='https://fonts.googleapis.com/css?family=Raleway:500' rel='stylesheet' type='text/css'> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
} // Gets Google's response if (isset($_POST["g-recaptcha-response"])) { $resp = $reCaptcha->verifyResponse($_SERVER["REMOTE_ADDR"], $_POST["g-recaptcha-response"]); } // Checks for the reCAPTCHA if ($resp != null && $resp->success) { $captchaError = ""; } else { $captchaError = "Please complete the captcha to register."; } /** * If there are no errors, it then connects to the database, inserts the * user's details into the database and sends them a verification email. */ if (checkError($usernameError, $emailError, $passwordError, $dobError, $sexError)) { dbconnect(); $hash = password_hash($passwd, PASSWORD_DEFAULT); $res = dbquery("INSERT INTO users (username, email, passwd, dob, sex)\n VALUES (:username, :email, :passwd, :dob, :sex);", array('username' => $_POST['username'], 'email' => $_POST['email'], 'passwd' => $hash, 'dob' => $_POST['dob'], 'sex' => $_POST['sex'])); // If the user's details have been entered successfully, then send him an e-mail. if ($res) { $msg = "Thank you for registering, " . $username . ". A verification e-mail has been sent to " . $email . ". If you haven't received an email within a few seconds, then please check your spam folder. Otherwise contact the admin for further assistance."; $to = $email; $subject = "Duke's Herald - E-mail verification"; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "From: admin@dukesherald.com \r\n"; $headers .= "Reply-To: admin@dukesherald.com \r\n"; $headers .= "Content-Type:text/html;charset=UTF-8" . "\r\n"; $message = "\n <html>\n <head>\n <title>E-mail Verification></title>\n </head>\n <body>\n <div>\n <h1>E-mail Verification</h1>\n <div>\n <p>Hello {$username}, thank you for registering! Click <a href='in09.webdb.fnwi.uva.nl/index.php?page=verification&username="******"'>here</a> to verify your Duke's Herald account.</p>\n </div>\n </div>\n </body>\n </html>\n "; mail($to, $subject, $message, $headers); } else {
<?php echo checkError("firstname"); ?> </div> <div> <label for="lastname">Last name</label> <br> <input id="lastname" type="text" name="lastname" value="<?php echo $lastname; ?> "> <?php echo checkError("lastname"); ?> <div> <label for="email">email</label> <br> <input id="email" type="text" name="email" value="<?php echo $email; ?> "> <?php echo checkError("email"); ?> </div> <button type="submit">Submit</button> </form> </body> </html>