dalert($L['balance_lack']); } if ($need_password && !is_payword($_username, $password)) { dalert($L['error_payword']); } if ($MG['add_limit']) { $last = $db->get_one("SELECT addtime FROM {$table} WHERE {$sql} ORDER BY itemid DESC"); if ($last && $DT_TIME - $last['addtime'] < $MG['add_limit']) { dalert(lang($L['add_limit'], array($MG['add_limit']))); } } $msg = captcha($captcha, $need_captcha, true); if ($msg) { dalert($msg); } $msg = question($answer, $need_question, true); if ($msg) { dalert($msg); } if (isset($post['islink'])) { unset($post['islink']); } //$post['clear_link'] = $MOD['clear_link']; if ($do->pass($post)) { $CAT = get_cat($post['catid']); if (!$CAT || !check_group($_groupid, $CAT['group_add'])) { dalert(lang($L['group_add'], array($CAT['catname']))); } $post['addtime'] = $post['level'] = $post['fee'] = 0; $post['style'] = $post['template'] = $post['note'] = $post['filepath'] = ''; $need_check = $MOD['check_add'] == 2 ? $MG['check'] : $MOD['check_add'];
function writebody() { global $db, $domain, $sitename, $cachelife, $template, $gamesfolder, $thumbsfolder, $limitboxgames, $seo_on, $blogentriesshown, $enabledcode_on, $comments_on, $directorypath, $autoapprovecomments, $gamesonpage, $abovegames, $belowgames, $showwebsitelimit, $supportemail, $showblog, $blogentriesshown, $blogcharactersshown, $blogcommentpermissions, $blogcommentsshown, $blogfollowtags, $blogcharactersrss, $usrdata, $userid; function question() { global $db, $domain, $sitename, $domain, $template, $gamesfolder, $thumbsfolder, $limitboxgames, $seo_on, $blogentriesshown, $enabledcode_on, $comments_on, $directorypath, $autoapprovecomments, $gamesonpage, $abovegames, $belowgames, $showwebsitelimit, $supportemail, $showblog, $blogentriesshown, $blogcharactersshown, $blogcommentpermissions, $blogcommentsshown, $blogfollowtags, $blogcharactersrss, $usrdata, $userid; if (isset($_POST['submit'])) { $answer = clean($_POST['answer']); $username = clean($_GET['username']); if (!$username || !$answer) { echo '<div class=\'error\'>You\'ve not filled all required fields in.</div>'; return; } $r = $db->query(sprintf('SELECT * FROM fas_users WHERE username=\'%s\'', $username)); $ir = $db->fetch_row($r); $salt = $ir['salt']; //check if the salt exists if (empty($salt)) { $salt = createSalt(); //creates a 3 character string } $answer = checkPass($answer, $salt); if (!$db->num_rows($r)) { //check if user exists and answer is corect echo '<div class=\'error\'>Your username is incorrect. Please try again!</div>'; return; } elseif ($answer != $ir['pass_answer']) { echo '<div class=\'error\'>Your security answer is incorrect. Please try again!</div>'; return; } else { $email = clean($ir['email']); $pass_word = rand(); $subject = 'Password Reset'; $message = 'Hello ' . $username . ',<br><br>You are receiving this notification because you have (or someone pretending to be you has) requested a new password be sent for your account on <a href="' . $domain . '">' . $sitename . '</a>.<br> Your password has been reset, your new password is: ' . $pass_word . '.<br><br> You can of course change this password yourself via the profile page. If you have any difficulties please contact the board administrator. <br><br>Best regards,<br>' . $sitename . ' administration'; $headers = 'From: ' . $supportemail . '' . "\r\n" . 'Content-Type: text/html; charset=\\"iso-8859-1\\"' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($email, $subject, $message, $headers); $pass = setPass($pass_word, $salt); mysql_query("UPDATE fas_users SET password='******', salt='{$salt}' WHERE username='******' AND pass_answer='{$answer}'"); echo '<div class=\'msg\'><font color=red>Your password has been reset, please check your email for the new password!</font></div>'; } } else { $username = clean($_GET['username']); $r = $db->query(sprintf('SELECT * FROM fas_users WHERE username=\'%s\'', $username)); $ir = $db->fetch_row($r); $question = $ir['pass_question']; if (!$db->num_rows($r)) { echo '<div class=\'error\'>Our records show there is no account with the username: <i>' . $username . '</i>!</div>'; return; } else { $surl = '' . $domain . '/index.php?action=forgotpassword&case=question&username='******''; echo '<form action=\'' . $surl . '\' method=\'post\'> <table width=\'100%\' border=\'0\' align=\'center\'> <tr> <th colspan=\'2\' align=\'center\' class=\'header\'>Forgot Password?</th> </tr> <tr> <td class=\'content\'>' . $question . ':</td> <td class=\'content\'><input type=\'text\' name=\'answer\' size=\'35\' /></td> </tr> <tr> <td colspan=\'2\' align=\'center\' class=\'content\'><input type=\'submit\' name=\'submit\' value=\'Get new pass!\' /></td> </tr> </table> </form> '; } } } function username() { global $db, $domain, $sitename, $domain, $template, $gamesfolder, $thumbsfolder, $limitboxgames, $seo_on, $blogentriesshown, $enabledcode_on, $comments_on, $directorypath, $autoapprovecomments, $gamesonpage, $abovegames, $belowgames, $showwebsitelimit, $supportemail, $showblog, $blogentriesshown, $blogcharactersshown, $blogcommentpermissions, $blogcommentsshown, $blogfollowtags, $blogcharactersrss, $usrdata, $userid; $surl = '' . $domain . '/index.php?action=forgotpassword&case=getlink'; echo '<form action=\'' . $surl . '\' method=\'post\'> <table width=\'100%\' border=\'0\' align=\'center\'> <tr> <th colspan=\'2\' align=\'center\' class=\'header\'>Forgot Password?</th> </tr> <tr> <td class=\'content\'>Your username:</td> <td class=\'content\'><input type=\'text\' name=\'username\' size=\'35\' /></td> </tr> <tr> <td colspan=\'2\' align=\'center\' class=\'content\'><input type=\'submit\' name=\'submit\' value=\'Next\' /></td> </tr> </table> </form>'; } function getlink() { $username = clean($_POST['username']); echo '<head> <meta http-equiv="refresh" content=".1; url=index.php?action=forgotpassword&case=question&username='******'"> </head>'; //echo "<center><a href='index.php?action=forgotpassword&case=question&username=$username'><font color='red' size='+3'>----> Next ----></font></a></center>"; } if (!isset($_GET['case'])) { $_GET['case'] = NULL; } switch ($_GET['case']) { default: username(); break; case 'getlink': getlink(); break; case 'question': question(); break; } }
?> <tr> <th width="100"> </th> <td> 请通过下面的验证后,再提交登录 </td> </tr> <?php } if ($_SCONFIG['questionmode']) { ?> <tr> <th width="100" style="vertical-align: top;">请先回答问题</th> <td> <p><?php question(); ?> </p> <input type="text" id="seccode" name="seccode" value="" tabindex="1" class="t_input"<?php if (empty($_SGLOBAL['input_seccode'])) { ?> onBlur="checkSeccode()"<?php } ?> /> <span id="checkseccode"> </span> </td> </tr> <?php } else { ?> <tr>
} echo "<input type =\"hidden\" name=\"correct\" value=\"{$answer_4}\">\n\t\t\t\t\t\t\t<input type=\"submit\" value=\"Submit\"></form>"; } } else { header("location: complete.php"); } } // Checks to see if it's the first time the user is on the script if (!isset($_COOKIE["topic_id"])) { // Takes the submitted data $topic_id = $_POST["topic"]; // Creates and sets the cookies setcookie("topic_id", $topic_id); setcookie("score", 0); // Ensures the cookie is set $_COOKIE["topic_id"] = $topic_id; // Runs the question function with the value of 1 if it's the first time question(1); } else { // Runs the question function with updated number $topic_id = $_COOKIE["topic_id"]; $question_number = $_COOKIE["question_number"]; question($question_number); } // Closes the connection mysqli_close($connection); ?> </div> </body> </html>
<li><?php $id = $_GET['questionid']; echo "<a href='back_reponses_form.php?ajout={$id}'>Nouvelle Réponse</a>"; ?> </li> <li id='li'><a href="home.php">Accueil</a></li> <li><a href="back_questions.php">Toutes les questions</a></li> <li><a href="index.php?deconnecte=">Déconnexion</a></li> </ul> </div> </div> </div> <div class="container"> <?php $id = $_GET['questionid']; $question = question($id); if ($question == null) { die("question invalide."); } $contenu = $question['contenu']; $user = userfromid($question['auteur']); $pseudo = $user['pseudo']; echo "<div class='well'>\n <p id='p'> {$pseudo}: </p><p id='m'> {$contenu}</p>"; if ($question['auteur'] == $_SESSION['userid']) { echo "<a id='c' href='back_questions_form.php?edite={$id}'>éditer</a>"; } echo "</div>"; ?> <?php echo "<h1>Liste des réponses:</h1>"; $reponses = reponses($_GET['questionid']);
dalert($L['check_sign'] . '(1)'); } $post['passport'] = isset($post['passport']) && $post['passport'] ? $post['passport'] : $post['username']; if ($MOD['passport'] == 'uc') { $passport = convert($post['passport'], DT_CHARSET, $MOD['uc_charset']); require DT_ROOT . '/api/uc.inc.php'; list($uid, $rt_username, $rt_password, $rt_email) = uc_user_login($passport, $post['password']); if ($uid == -2) { dalert($L['register_msg_passport'], '', 'parent.Dd("passport").focus();'); } } $msg = captcha($captcha, $MOD['captcha_register'], true); if ($msg) { dalert($msg, '', reload_captcha()); } $msg = question($answer, $MOD['question_register'], true); if ($msg) { dalert($msg, '', reload_question()); } $post['email'] = trim($post['email']); $RG = array(); foreach ($GROUP as $k => $v) { if ($k > 4 && $v['vip'] == 0) { $RG[] = $k; } } $reload_captcha = $MOD['captcha_register'] ? reload_captcha() : ''; $reload_question = $MOD['question_register'] ? reload_question() : ''; in_array($post['regid'], $RG) or dalert($L['register_pass_groupid'], '', $reload_captcha . $reload_question); if ($could_emailcode) { if (!preg_match("/^[0-9]{6}\$/", $post['emailcode']) || $_SESSION['email_code'] != md5($post['email'] . '|' . $post['emailcode'])) {
$need_question = $MOD['question_price'] == 2 ? $MG['question'] : $MOD['question_price']; require DT_ROOT . '/include/post.func.php'; if ($_userid) { $user = userinfo($_username); $company = $user['company']; $truename = $user['truename']; $telephone = $user['telephone'] ? $user['telephone'] : $user['mobile']; $email = $user['mail'] ? $user['mail'] : $user['email']; $qq = $user['qq']; $msn = $user['msn']; $ali = $user['ali']; $skype = $user['skype']; } if ($submit) { captcha($captcha, $need_captcha); question($answer, $need_question); $title = htmlspecialchars(trim($title)); if (!$title) { message($L['msg_type_title']); } $content = htmlspecialchars(trim($content)); if (!$content) { message($L['msg_type_content']); } if (!$_userid) { $truename = htmlspecialchars(trim($truename)); if (!$truename) { message($L['msg_type_truename']); } $telephone = htmlspecialchars(trim($telephone)); if (!$telephone) {
<?php /* Inversion of control */ $input = fopen('php://stdin', 'r'); echo "\nDigita il tuo nome: "; $nome = fread($input, 200); registra_nome($nome); echo "\nDigita il tuo cognome: "; $cognome = fread($input, 200); registra_cognome($cognome); echo "\nDigita il tuo indirizzo: "; $indirizzo = fread($input, 200); registra_indirizzo($indirizzo); require 'shell.php'; $shell = new Shell(); $shell . question("Digita il tuo nome: ", 'registra_nome'); $shell . question("Digita il tuo cognome: ", 'registra_conome'); $shell . question("Digita il tuo indirizzo: ", 'registra_indirizzo'); $shell . execute(); /* Dependency Injection container */ $flickr_api = $container->get('flickr_api'); //... $photo_sets = $flickr_api->getPhotoSets(); //... $recent_photos = $flickr_api->getRecentPhotos(12); //... /* Uso del DIC */ $container = new DIC(); $response = $container->get('http_kernel')->handle(Request::createFromGlobals()); $response->sendHeaders(); $response->sendContent();
function info($name, $display = 'none', $style = '') { $info = current(table_array("Peev_info", "WHERE name='" . $name . "'")); if (count($info)) { // echo "<div style='position:relative;left:96%;top:-34px;'>"; $body = "<h1 style='text-align:center;'>" . $info['title'] . "</h1>"; $body .= "<p>" . str_replace("\n", "<br>", $info['info']) . "</p>"; $body = str_replace(array("<ul>", "</ul>"), array("</p><ul>", "</ul><p>"), $body); question($body, "info_" . $info['name'], '', $display, $style); // echo "</div>"; } }
$_TP = sort_type($TYPE); require MD_ROOT . '/' . $ext . '.class.php'; $do = new $ext(); $typeid = isset($typeid) ? intval($typeid) : 0; $destoon_task = rand_task(); if ($itemid) { $do->itemid = $itemid; $item = $do->get_one(); $item or dheader($url); extract($item); if ($submit) { if ($verify == 1) { captcha($captcha, 1); } if ($verify == 2) { question($answer, 1); } $could_vote = true; $condition = $_username ? "AND username='******'" : "AND ip='{$DT_IP}'"; $r = $db->get_one("SELECT rid FROM {$DT_PRE}vote_record WHERE itemid={$itemid} {$condition}"); if ($r) { $could_vote = false; } if ($fromtime && $DT_TIME < $fromtime) { $could_vote = false; } if ($totime && $DT_TIME > $totime) { $could_vote = false; } if (!check_group($_groupid, $groupids)) { $could_vote = false;
//Question 2 $qst2_opt = array("Go", "NoSQL", "Django", "AES"); $qst2_ans = "Go"; $qst2 = question($obj, "Q2. Amongst the following what is a Programming Language?", $qst2_opt, $qst2_ans); //Question 3 $qst3_opt = array("Van Neuman", "Kernighan", "Rasmus Lerdorf", "Belly Deriath"); $qst3_ans = "Rasmus Lerdorf"; $qst3 = question($obj, "Q3. Who is the developer of PHP?", $qst3_opt, $qst3_ans); //Question 4 $qst4_opt = array("Library Function", "Initialization Function", "Module Initialization Scheme", "Extension .so/.dll"); $qst4_ans = "Module Initialization Scheme"; $qst4 = question($obj, "Q4. What is the MINIT in PHP?", $qst4_opt, $qst4_ans); //Question 5 $qst5_opt = array("echo()", "print()", "fread()", "printf()"); $qst5_ans = "printf()"; $qst5 = question($obj, "Q5. Amongst which takes unlimited arguments?", $qst5_opt, $qst5_ans); $result = $qst1 + $qst2 + $qst3 + $qst4 + $qst5; switch ($result) { case "50": $obj->dialogCreateAlert("You are awesome. You scored 50/50"); $obj->dialogNeutralButtonText("See ya"); $obj->dialogShow(); $obj->makeToast("Thank You for playing"); $object->exit(); exit(0); break; case "0": $obj->dialogCreateAlert("You should learn. You scored 0/50"); $obj->dialogNeutralButtonText("See ya"); $obj->dialogShow(); $obj->makeToast("Thank You for playing");
supprVote2($reponse['id']); supprReponse($reponse['id']); } header("Location: back_reponses.php?questionid={$questionid}"); die; } else { if ($_POST['contenu'] == "") { $msg = "Veuillez remplir le champ ci-dessous"; } else { $auteur = $_SESSION['userid']; ajoutQuestion($auteur, $_POST['contenu']); header("Location: back_questions.php"); } } } elseif (isset($_GET['edite'])) { $question = question($_GET['edite']); if ($question == null) { die("question invalide."); } $id = $question['id']; $contenu = $question['contenu']; } ?> <html lang='fr'> <head> <meta charset='utf8'> <link href="./bootstrap.css" rel="stylesheet"> <link href="./offcanvas.css" rel="stylesheet"> <title><?php echo blogTitle(); ?>