public function register() { if (is_post()) { $this->loadHelper('Validator'); if (captcha()) { $data = ['email' => validate('email', 'email'), 'username' => validate('required', 'username'), 'password' => password_hash(validate('required', 'register_token'), PASSWORD_BCRYPT), 'token' => str_rand(40)]; if (validator($data)) { if ($this->user->checkExistUser($data['email'])) { $data2 = ['firstname' => validate('required', 'firstname'), 'lastname' => validate('required', 'lastname'), 'nickname' => validate('required', 'nickname'), 'major' => validate('required', 'major')]; if (validator($data2)) { $this->user->createUser($data, $data2); $validate = $this->user->validate($data['email'], $_POST['register_token']); if (!empty($validate)) { $_SESSION['auth'] = $validate; $_SESSION['user'] = $this->user->getDetail($validate['id']); cache_forgot('user.members.' . user('major')); cache_forgot('user.get.members.' . user('major')); } } } } } } return redirect(''); }
function regform() { $value = captcha(5); $_SESSION['code'] = $value; $form = '<h1>Register</h1> <form action="index.php?var=register" method="POST"> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td width="25%">Name:</td> <td width="75%"><input name="uname" id="uname" type="text" maxchars="255" size="20" /></td> </tr><tr> <td width="25%">Password:</td> <td width="75%"><input name="pass1" id="pass1" type="password" maxchars="255" size="20" /></td> </tr><tr> <td width="25%">Repeat Password:</td> <td width="75%"><input name="pass2" id="pass2" type="password" maxchars="255" size="20" /></td> </tr><tr> <td width="25%">Email:</td> <td width="75%"><input name="email1" id="email1" type="text" maxchars="255" size="20" /></td> </tr><tr> <td width="25%">Repeat Email:</td> <td width="75%"><input name="email2" id="email2" type="text" maxchars="255" size="20" /></td> </tr><tr> <td><img src="images/verify.jpeg" /></td> <td>Verification Code:<br><input type="text" name="img" id="img" maxchars="5" size="20"/></td> <tr><td></td><td><input type="submit" value="Register!" /></td></tr> </table> </form>'; return $form; }
function output() { global $db, $ums, $user; $code = captcha(5); $out = "<form action=\"?var=regsub\" method=\"POST\">\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tr>\n<td>Username:</td>\n<td><input type=\"text\" name=\"uname\" width=\"20\" maxchars=\"255\" /></td>\n</tr>\n<tr>\n<td>Password:</td>\n<td><input type=\"password\" name=\"pass1\" width=\"20\" maxchars=\"255\" /></td>\n</tr>\n<tr>\n<td>Confirm Password:</td>\n<td><input type=\"password\" name=\"pass2\" width=\"20\" maxchars=\"255\" /></td>\n</tr>\n<tr>\n<td>Email:</td>\n<td><input type=\"text\" name=\"email1\" width=\"20\" maxchars=\"255\" /></td>\n</tr>\n<tr>\n<td>Confirm Email:</td>\n<td><input type=\"text\" name=\"email2\" width=\"20\" maxchars=\"255\" /></td>\n</tr>\n<tr>\n<td><img src=\"images/verify.jpeg\" /></td>\n<td>Verification Code:<br />\n<input type=\"text\" name=\"code\" width=\"20\" maxchars=\"255\" /></td>\n</tr>\n<tr>\n<td></td>\n<td><input type=\"submit\" value=\"Register\" /></td>\n</tr>\n</table>\n</font>"; $_SESSION['code'] = $code; return $out; }
/** * バリデーションが正しく通ることをテストします */ public function testValidationSuccess() { captcha(); $phrase = session('captcha.phrase'); $this->request['name'] = 'testing'; $this->request['email'] = '*****@*****.**'; $this->request['password'] = '******'; $this->request['password_confirmation'] = 'testing'; $this->request['captcha_code'] = $phrase; $this->assertNull($this->request->validate()); }
function secure_tracks() { $scod = substr(microtime(), 2, 4); $im = plugin('imgtxt', $scod, "crackman", "ok"); $ret = hidden('secur', 'trkscr', captcha($scod)); if (!rstr(15)) { return $ret . hidden('', 'trkscrvrf', $scod); } if (prms('nogdf') or !$im) { $ret .= btn('txtcadr', $scod); } else { $ret .= $im; } $ret .= autoclic('secure" id="trkscrvrf', helps('track_captcha'), '14', '5', '') . ' '; return $ret; }
if (HEBERGEUR_INSTALLATION == 'multi-structures') { $structure_denomination = DB_WEBMESTRE_PUBLIC::DB_recuperer_structure_nom_for_Id($BASE); if ($structure_denomination === NULL) { exit_error('Établissement manquant', 'Établissement non trouvé dans la base d\'administration !'); } } else { $DB_TAB = DB_STRUCTURE_PUBLIC::DB_lister_parametres('"webmestre_denomination"'); if (!empty($DB_TAB)) { $structure_denomination = $DB_TAB[0]['parametre_valeur']; } else { exit_error('Base incomplète', 'Base de l\'établissement incomplète ou non encore installée !'); } } } // Protection contre les attaques par force brute des robots (piratage compte ou envoi intempestif de courriels) list($html_imgs, $captcha_soluce) = captcha(); $_SESSION['FORCEBRUTE'][$PAGE] = array('TIME' => $_SERVER['REQUEST_TIME'], 'DELAI' => 5, 'CAPTCHA' => $captcha_soluce); $is_etablissement_virtuel = IS_HEBERGEMENT_SESAMATH && ($BASE == ID_DEMO || $BASE >= CONVENTION_ENT_ID_ETABL_MAXI || substr($structure_denomination, 0, 5) == 'Voir ') ? TRUE : FALSE; ?> <?php if ($PROFIL == 'structure' && !$is_etablissement_virtuel) { ?> <form id="form_lost" action="#" method="post"> <h2>Cas n°1 : une adresse de courriel est associée à votre compte</h2> <div id="step1"> <p>Alors utilisez ce formulaire afin d'obtenir de nouveaux identifiants :</p> <div><label class="tab">Établissement :</label><input id="f_base" name="f_base" type="hidden" value="<?php echo $BASE; ?> " /><em><?php
function form($array, $legend, $submit, $first, $last, $captcha = false) { if ($first) { echo "<form method='post' action=''>"; } echo '<fieldset>'; echo '<legend>' . $legend . '</legend>'; foreach ($array as &$value) { if ($value['type'] != 'radio' && $value['label'] != '') { echo '<label for="' . $value['name-id'] . '">' . $value['label'] . '</label>'; } // Text, Email, Password if ($value['type'] == 'text' || $value['type'] == 'email' || $value['type'] == 'password') { echo '<input type="' . $value['type'] . '" name="' . $value['name-id'] . '" id="' . $value['name-id'] . '" value="'; if ($value['value']) { if ($_POST) { echo $_POST[$value['name-id']]; } elseif (!empty($value['valuebyuser'])) { echo $value['valuebyuser']; } } elseif (!empty($value['valuebyuser'])) { echo $value['valuebyuser']; } echo '" />'; } if ($value['type'] == 'textarea') { echo '<textarea cols="' . $value['cols'] . '" rows="' . $value['rows'] . '" name="' . $value['name-id'] . '" id="' . $value['name-id'] . '">'; if ($value['value']) { if ($_POST) { echo $_POST[$value['name-id']]; } elseif (!empty($value['valuebyuser'])) { echo $value['valuebyuser']; } } elseif (!empty($value['valuebyuser'])) { echo $value['valuebyuser']; } echo '</textarea>'; } if ($value['type'] == 'radio') { echo '<input type="' . $value['type'] . '" name="' . $value['name-id'] . '" id="' . $value['name-id'] . '" value="' . $value['value'] . '"'; if ($value['checked']) { echo ' checked="checked" '; } echo '/>' . $value['label']; } if ($value['type'] == 'select') { echo '<select name="' . $value['name-id'] . '" id="' . $value['name-id'] . '">'; foreach ($value['options'] as $key => $v) { echo '<option value="' . $key . '">' . $v . '</option>'; } echo '</select>'; } } echo "</fieldset>"; if ($captcha) { captcha(); } if ($last) { echo "<input type='submit' value='" . $submit . "'/>"; echo "</form>"; } }
$need_question = $MOD['question_add'] == 2 ? $MG['question'] : $MOD['question_add']; $could_color = check_group($_groupid, $MOD['group_color']) && $MOD['credit_color'] && $_userid; if ($submit) { if ($fee_add && $fee_add > ($fee_currency == 'money' ? $_money : $_credit)) { 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'])));
<?php header("Content-Type: image/png"); session_start(); captcha(); function captcha() { $md5_hash = md5(rand(0, 999)); //some random number between 0 to 999 change to md5 and assign it to a variable $security_code = substr($md5_hash, 15, 5); // $_SESSION['capt'] = $security_code; ///assigning values produced into the session //this point below it changes the variable into an image $im = imagecreate(40, 20) or die("Cannot Initialize new GD image stream"); $background_color = imagecolorallocate($im, 255, 255, 255); $text_color = imagecolorallocate($im, 233, 14, 91); imagestring($im, 2, 3, 3, $security_code, $text_color); imagepng($im); imagedestroy($im); }
<input type="text" name="email" id="email" value="" size="20" maxlength="80" tabindex="2"/> </div> <div> <label for="comment">Your Comment: <span class="required">*</span> <?php if (isset($errors) && in_array('comment', $errors)) { echo "<span class='warning'>Please enter your comment</span>"; } ?> </label> <div id="comment"><textarea name="comment" rows="10" cols="50" tabindex="3"></textarea></div> </div> <div> <label for="captcha">Nhập giá trị số cho câu hỏi sau:<?php echo captcha(); ?> <span class="required">*</span> <?php if (isset($errors) && in_array('captcha', $errors)) { echo "<span class='warning'>Please give a correct answer</span>"; } ?> </label> <input type="text" name="captcha" id="captcha" value="" size="20" maxlength="5" tabindex="4"/> </div> <div class="website"> <label for="webside">Nếu bạn nhìn thấy trường này, thì ĐỪNG điền gì vô hết</label> <input type="text" name="url" id="url" value="" size="20" maxlength="20"/> </div>
$errors[] = 'Parolanızı girmediniz.'; } else { if ($_POST['password'] != $_POST['password_confirm']) { // parola girilmişse ve confirm alanı ile aynı ise... $errors[] = 'Girdiğiniz iki parola birbirinden farklı.'; } else { if (!preg_match("/^((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#\$%]).{6,20})\$/", $_POST['password'])) { $errors[] = 'Parolanız 6-20 karakter aralığında olmalıdır. Minimum 1 küçük, 1 büyük harf ve 1 rakam içermelidir. @#$% özel karakterlerinden birisini içermelidir.'; } } } if (empty($errors)) { // bütün alanlar kontrol edildiyse ($errors dizisi boş ise) // kullanıcıdan gelen veriler filtreleniyor $name = mysql_real_escape_string($_POST['name']); $surname = mysql_real_escape_string($_POST['surname']); $email = mysql_real_escape_string($_POST['email']); $username = mysql_real_escape_string($_POST['username']); $password = sha1($_POST['password']); // parola sha1 algoritması ile hashleniyor // kayıt veri tabanına ekleniyor $query = mysql_query("INSERT INTO users\r\n (name, surname, email, username, password)\r\n VALUES\r\n ('{$name}', '{$surname}', '{$email}', '{$username}', '{$password}')\r\n ") or die(mysql_error()); // register_complete.php adresine yönlendirilme yapılıyor header("Location: " . DOC_ROOT . "/register_complete.php"); exit; } } $_SESSION['my_captcha'] = captcha(); require 'views/layout/header.php'; require 'views/register.php'; require 'views/layout/footer.php';
} else { $mobile = $_SESSION['f_key']; $mobile == $t['mobile'] && $t['vmobile'] or exit('ko'); $_SESSION['mobile_code'] == md5($t['mobile'] . '|' . $code) or exit('ko'); set_cookie('username', $mobile); } $salt = random(8); $pass = dpassword($password, $salt); $db->query("UPDATE {$DT_PRE}member SET password='******',passsalt='{$salt}' WHERE userid='{$userid}'"); session_destroy(); exit('ok'); break; case 'check': isset($type) or exit('ko'); $captcha = isset($captcha) ? convert(input_trim($captcha), 'UTF-8', DT_CHARSET) : ''; $msg = captcha($captcha, 1, true); if ($msg) { exit('captcha'); } if ($type == 'mobile') { $could_mobile or exit('ko'); is_mobile($mobile) or exit('ko'); $t = $db->get_one("SELECT userid FROM {$DT_PRE}member WHERE mobile='{$mobile}' AND vmobile=1"); if ($t) { $_SESSION['f_uid'] = $t['userid']; $_SESSION['f_key'] = $mobile; exit('ok'); } exit('no'); } else { if ($type == 'email') {
function testWheninputIs2121ResultShouldBe1MultiplyOne() { $this->assertEquals("1 * One", captcha(2, 1, 3, 1)); }
echo getSettingValue("gepiSchoolName"); ?> : Récupération de compte et mot de passe...</title> <link rel="stylesheet" type="text/css" href="./style.css" /> <script src="lib/functions.js" type="text/javascript" language="javascript"></script> <link rel="shortcut icon" type="image/x-icon" href="./favicon.ico" /> <link rel="icon" type="image/ico" href="./favicon.ico" /> <?php // Styles paramétrables depuis l'interface: if ($style_screen_ajout == 'y') { // La variable $style_screen_ajout se paramètre dans le /lib/global.inc // C'est une sécurité... il suffit de passer la variable à 'n' pour désactiver ce fichier CSS // et éventuellement rétablir un accès après avoir imposé une couleur noire sur noire echo "<link rel='stylesheet' type='text/css' href='{$gepiPath}/style_screen_ajout.css' />\n"; } echo "\n</head>\n"; if (isset($suite)) { if (getSettingAOui('Imprimer_obtenir_compte_et_motdepasse')) { echo "<body>\n<div style='margin:1em;'>\n<h2>" . getSettingValue('gepiSchoolName') . " : Demande de compte</h2>\n\n<p>Je souhaite obtenir (<em>ou récupérer</em>) un compte et mot de passe pour accéder aux données me concernant ou concernant mon ou mes enfants scolarisés dans l'établissement.</p>\n\n<table class='boireaus boireaus_alt'>\n\t<tr><td>Nom</td><td>{$nom}</td></tr>\n\t<tr><td>Prénom</td><td>{$prenom}</td></tr>\n\t<tr><td>Email</td><td>{$email}</td></tr>\n\t<tr><td>Statut</td><td>{$statut_demandeur}</td></tr>\n\t<tr>\n\t\t<td valign='top'>Description de la demande :</td>\n\t\t<td>\n\t\t\t" . preg_replace("/\\\\n/", "<br />", nl2br($description)) . "\n\t\t</td>\n\t</tr>\n</table>\n<p>Le " . strftime("%d/%m/%Y à %H:%M") . ".</p>\n<p>Signature :</p>\n<p><br /></p>\n<p><br /></p>\n<p style='text-decoration:blink; color:red;' class='noprint'>Document à imprimer et à remettre à l'Administration.</p>\n<p class='noprint'><a href='./login.php'><img src='./images/icons/back.png' alt='Retour' class='back_link'/> Retour à la page de connexion</a></p>\n\n</div>"; } else { echo "<body>\n<div style='margin:1em;'>\n<h2>" . getSettingValue('gepiSchoolName') . " : Demande de compte</h2>\n\n<p>Votre demande a été enregistrée.</p>\n\n<p class='noprint'><a href='./login.php'><img src='./images/icons/back.png' alt='Retour' class='back_link'/> Retour à la page de connexion</a></p>\n\n</div>"; } require "./lib/footer.inc.php"; die; } echo "<body onload=\"document.getElementById('nom').focus()\">\n\n<div class='norme' style='text-align:center;'>\n\t<p class='bold'>\n\t\t<a href='./login.php'><img src='./images/icons/back.png' alt='Retour' class='back_link'/> Retour à la page de connexion</a>\n\t</p>\n</div>\n\n<h2 class='gepi'>Demande de compte/mot de passe</h2>\n\n<div align='center'>\n\n\t<span style='color:red'>{$msg}</span>\n\n\t<p>Vous avez oublié vos compte et mot de passe, ou vous souhaitez obtenir un compte pour accéder aux données concernant votre enfant.<br />\n\tVeuillez compléter le formulaire ci-dessous.</p>\n\n\t<form enctype=\"multipart/form-data\" name= \"formulaire\" action=\"" . $_SERVER['PHP_SELF'] . "\" method='post'>\n\t<table class='boireaus boireaus_alt'>\n\t\t<tr><td>Nom</td><td><input type='text' name='nom' size='40' value=\"{$nom}\" /></td></tr>\n\t\t<tr><td>Prénom</td><td><input type='text' name='prenom' size='40' value=\"{$prenom}\" /></td></tr>\n\t\t<tr><td>Email</td><td><input type='text' name='email' size='40' value=\"{$email}\" /></td></tr>\n\t\t<tr>\n\t\t\t<td>Statut</td>\n\t\t\t<td>\n\t\t\t\t<select name='statut_demandeur'>\n\t\t\t\t\t<option value='parent'>parent ou responsable</option>\n\t\t\t\t\t<option value='eleve'>élève</option>\n\t\t\t\t\t<option value='autre'>autre</option>\n\t\t\t\t</select>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td valign='top'>Enfants/élèves</td>\n\t\t\t<td>\n\t\t\t\t<p>Dans le cas d'une demande parent/responsable, veuillez préciser les nom, prénom et classe<br />de l'un au moins de vos enfants scolarisés dans l'établissement.<br />\n\t\t\t\tDans le cas d'une demande élève, veuillez préciser vos nom, prénom et classe.</p>\n\t\t\t\t<textarea name='description' cols='50' rows='4'>" . preg_replace("/\\\\n/", "\n", $description) . "</textarea>\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n\n\t<strong><a href='http://fr.wikipedia.org/wiki/Captcha' target='_blank' title=\"Captcha : Dispositif destiné à contrôler que c'est bien un humain et non une machine/robot qui valide le formulaire.\">Captcha</a></strong><br />\n\t<label for='captcha'>Combien font " . captcha() . " ?</label><br /><input type='text' name='captcha' id='captcha' autocomplete=\"off\" /><br />\n\t<span style='font-size:x-small'>(réponse attendue en chiffres)</span>\n\t<br />\n\n\t<input type='hidden' name='is_posted' value='y' />\n\t<input type='submit' value='Valider' />\n\n\t</form>\n\n</div>\n\n<p><br /></p>\n\n<p><em>NOTES :</em></p>\n<ul>"; if (getSettingAOui('Imprimer_obtenir_compte_et_motdepasse')) { echo "\n\t<li>\n\t\tUn document va être généré.<br />\n\t\tVous devrez imprimer le document et votre enfant devra déposer cette demande à l'Administration de l'établissement pour finaliser la demande.<br />\n\t\tCette démarche est destinée à éviter des usurpations d'identité.\n\t</li>"; } echo "\n\t<li>\n\t\tEn précisant votre adresse mail, vous pourrez par la suite recevoir par mail les informations demandées.<br />\n\t\t(<em>Il est généralement plus facile de copier/coller les informations reçues que de les taper</em>)\n\t</li>\n</ul>\n\n</body>\n</html>\n";
if ($_userid) { $auth = ''; } if ($auth) { $auth = decrypt($auth, DT_KEY . 'LOGIN'); $_auth = explode('|', $auth); if ($_auth[0] == 'LOGIN' && check_name($_auth[1]) && strlen($_auth[2]) >= $MOD['minpassword'] && $DT_TIME >= intval($_auth[3]) && $DT_TIME - intval($_auth[3]) < 30) { $submit = 1; $username = $_auth[1]; $password = $_auth[2]; $MOD['captcha_login'] = $captcha = 0; } } $action = 'login'; if ($submit) { captcha($captcha, $MOD['captcha_login']); $username = trim($username); $password = trim($password); if (strlen($username) < 3) { message($L['login_msg_username']); } if (strlen($password) < 5) { message($L['login_msg_password']); } $goto = isset($goto) ? true : false; if ($goto) { $forward = $MOD['linkurl']; } $cookietime = isset($cookietime) ? 86400 * 30 : 0; $api_msg = $api_url = ''; $option = isset($option) ? trim($option) : 'username';
break; } if (preg_match("/^" . str_replace('*', '[0-9]{1,3}', $v) . "\$/", $DT_IP)) { $pass = true; break; } } if (!$pass) { dalert('未被允许的IP段', $MODULE[2]['linkurl'] . 'logout.php?forward=' . urlencode(DT_PATH)); } } if ($DT['close']) { $DT['captcha_admin'] = 0; } if ($submit) { captcha($captcha, $DT['captcha_admin']); if (!$username) { msg('请输入用户名'); } if (!$password) { msg('请输入密码'); } include load('member.lang'); $MOD = cache_read('module-2.php'); require DT_ROOT . '/include/module.func.php'; require DT_ROOT . '/module/member/member.class.php'; $do = new member(); $user = $do->login($username, $password); if ($user) { if ($user['groupid'] != 1 || $user['admin'] < 1) { msg('您无权限访问后台', $MODULE[2]['linkurl'] . 'logout.php?forward=' . urlencode(DT_PATH));
$size = 64; $marge = 15; $font = '../fonts/angelina.ttf'; $matrix_blur = array(array(1, 1, 1), array(1, 1, 1), array(1, 1, 1)); $box = imagettfbbox($size, 0, $font, $mot); $largeur = $box[2] - $box[0]; $hauteur = $box[1] - $box[7]; $largeur_lettre = round($largeur / strlen($mot)); $img = imagecreate($largeur + $marge, $hauteur + $marge); $blanc = imagecolorallocate($img, 255, 255, 255); $noir = imagecolorallocate($img, 0, 0, 0); $couleur = array(imagecolorallocate($img, 0x99, 0x0, 0x66), imagecolorallocate($img, 0xcc, 0x0, 0x0), imagecolorallocate($img, 0x0, 0x0, 0xcc), imagecolorallocate($img, 0x0, 0x0, 0xcc), imagecolorallocate($img, 0xbb, 0x88, 0x77)); for ($i = 0; $i < strlen($mot); ++$i) { $l = $mot[$i]; $angle = mt_rand(-35, 35); imagettftext($img, mt_rand($size - 7, $size), $angle, $i * $largeur_lettre + $marge, $hauteur + mt_rand(0, $marge / 2), $couleur[array_rand($couleur)], $font, $l); } imageline($img, 2, mt_rand(2, $hauteur), $largeur + $marge, mt_rand(2, $hauteur), $noir); imageline($img, 2, mt_rand(2, $hauteur), $largeur + $marge, mt_rand(2, $hauteur), $noir); imageconvolution($img, $matrix_blur, 10, 10); imageconvolution($img, $matrix_blur, 10, 0); imagepng($img); imagedestroy($img); } $rand = motHasard(5); $_SESSION["CaptchaKey"] = $rand; header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Content-type: image/png"); captcha($rand);
public function registrasi() { $data['captcha'] = captcha(); $this->load->view('view_registrasi', $data); }
<?php /* Template Name: Contact Page 2 */ session_start(); include HT_INCLUDES_PATH . "captcha/captcha.php"; get_header(); global $data; $_SESSION['captcha'] = captcha(); $_SESSION['seccode'] = $_SESSION['captcha']['code']; $override_title = get_post_meta($post->ID, '_override_title', true); $teaser = !empty($override_title) ? $override_title : get_the_title(); embed_fullscreen_bg(); ?> <div id="wrap" class="clearfix <?php echo ht_sidebar_layout(); ?> "> <div id="main"> <div id="entries"> <h2 class="page-title"><?php echo $teaser; ?> <i class="entries-toggle arrow-toggle"></i> <?php if ($data['breadcrumb_inner']) { ?> <div id="breadcrumb"> <?php if (class_exists('simple_breadcrumb')) {
<?php defined('IN_DESTOON') or exit('Access Denied'); require DT_ROOT . '/module/' . $module . '/common.inc.php'; $MOD['link_enable'] or dheader(DT_PATH); require DT_ROOT . '/include/post.func.php'; $TYPE = get_type('link', 1); require MD_ROOT . '/link.class.php'; $do = new dlink(); $typeid = isset($typeid) ? intval($typeid) : 0; if ($action == 'reg') { $MOD['link_reg'] or message($L['link_reg_close']); if ($submit) { captcha($captcha, 1); $post = dhtmlspecialchars($post); if ($do->pass($post)) { $r = $db->get_one("SELECT itemid FROM {$DT_PRE}link WHERE linkurl='{$post['linkurl']}' AND username=''"); if ($r) { message($L['link_url_repeat']); } $post['status'] = 2; $post['level'] = 0; $post['areaid'] = $cityid; $do->add($post); message($L['link_check'], './'); } else { message($do->errmsg); } } else { $type_select = type_select('link', 1, 'post[typeid]', $L['link_choose_type'], 0, 'id="typeid"'); $head_title = $L['link_reg'] . $DT['seo_delimiter'] . $L['link_title'];
message($L['has_expired']); } $item['status'] == 3 or message($L['not_exists']); $item['username'] or message($L['com_not_member']); $_username != $item['username'] or message($L['sign_self']); $today = $today_endtime - 86400; $sql = $_userid ? "username='******'" : "addtime>{$today} AND ip='{$DT_IP}'"; $t = $db->get_one("SELECT id FROM {$table_order} WHERE id={$itemid} AND {$sql}"); if ($t) { message($L['sign_again']); } $linkurl = $MOD['linkurl'] . $item['linkurl']; $need_captcha = $MOD['captcha_sign'] == 2 ? $MG['captcha'] : $MOD['captcha_sign']; require DT_ROOT . '/include/post.func.php'; if ($submit) { captcha($captcha, $need_captcha); $amount = intval($amount); if ($amount < 1) { $amount = 1; } $company = dhtmlspecialchars($company); $truename = dhtmlspecialchars($truename); if (strlen($truename) < 2 * DT_CHARLEN) { message($L['msg_type_truename']); } if (!is_mobile($mobile)) { message($L['msg_type_mobile']); } $areaid = intval($areaid); $address = dhtmlspecialchars($address); preg_match("/^[0-9]{6}\$/", $postcode) or $postcode = '';
/** * captchaメソッドのテスト */ public function testCaptchaRender() { $captcha = captcha(); $this->assertInternalType('string', $captcha); $this->assertSessionHas('captcha.phrase'); }
/** * Insert captcha into registration table * @global array */ function insert_captcha() { global $config; captcha(); echo '<table width="80%" cellpadding="5" cellspacing="0" class="post">' . "\n"; echo '<tr>' . "\n"; echo '<td>'; echo '<label for="captcha">' . lang('captcha_title') . '</label>'; echo '</td>' . "\n"; echo '</tr>' . "\n"; echo '<tr>' . "\n"; echo '<td>'; echo '<table><tr><td width="18%"><image src="plugins/captcha/secure.jpg" alt="security" /></td>'; echo '<td><input type="text" id="captcha" name="captcha" style="width: 99.3%;" class="border" /></td></tr></table>'; echo '</td>' . "\n"; echo '</tr>' . "\n"; echo '</table>'; }
$b = 0.87; for ($i = 1; $i <= $circles; $i++) { $value = rand(200, 255); $randomcolor = imagecolorallocate($im, $value * $r, $value * $g, $value * $b); imagefilledellipse($im, rand(0, $width - 10), rand(0, $height - 3), rand(20, 70), rand(20, 70), $randomcolor); } // Create the text imagerectangle($im, 0, 0, $width - 1, $height - 1, $text_color); imagestring($im, $font, $offset_x, $offset_y, $security_code, $text_color); // Create the lines (horizontal) for ($i = 0; $i < $h_lines; $i++) { $y = rand($offset_x, $height); $randomcolor = imagecolorallocate($im, 0, 0, rand(100, 255)); imageline($im, 0, $y, $width, $y, $randomcolor); } // Create the lines (vertical) for ($i = 0; $i < $v_lines; $i++) { $x = rand($offset_y, $width); $randomcolor = imagecolorallocate($im, 0, 0, rand(100, 255)); imageline($im, $x, 0, $x, $height, $randomcolor); } // Tell the browser what kind of file is come in header('Content-Type: image/png'); // Output the newly created image in jpeg format imagepng($im); // Free up resources imagedestroy($im); } // Create CAPTCHA image captcha(security_code());
along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. To contact any of the authors about special permissions send an e-mail to cerescp@gmail.com */ session_start(); include_once 'config.php'; // loads config variables if (!isset($GET_img)) { exit(0); } $session = $_SESSION[$CONFIG_name . 'sessioncode']; $code = $session[$GET_img]; $code = substr(strtoupper(md5("Mytext" . $code)), 0, 6); captcha(135, 40, $code); exit(0); function captcha($width, $height, $code) { $font = "./font/ChalkboardBold.ttf"; $font_size = 17; $image = imagecreate($width, $height); $background_color = imagecolorallocate($image, 255, 255, 255); $text_color = imagecolorallocate($image, 20, 40, 100); $noise_color = imagecolorallocate($image, 100, 120, 180); for ($i = 0; $i < $width * $height / 3; $i++) { imagefilledellipse($image, mt_rand(0, $width), mt_rand(0, $height), 1, 1, $noise_color); } for ($i = 0; $i < $width * $height / 150; $i++) { imageline($image, mt_rand(0, $width), mt_rand(0, $height), mt_rand(0, $width), mt_rand(0, $height), $noise_color); }
$content = ob_template('welcome', 'mail'); if ($MOD['welcome_message']) { send_message($username, $title, $content); } if ($MOD['welcome_email'] && $DT['mail_type'] != 'close') { send_mail($post['email'], $title, $content); } } session_destroy(); } exit('ok'); break; case 'post': if ($MOD['captcha_register']) { $captcha = isset($captcha) ? convert(input_trim($captcha), 'UTF-8', DT_CHARSET) : ''; $msg = captcha($captcha, $MOD['captcha_register'], true); if ($msg) { exit('captcha'); } } $post = array(); $post['regid'] = isset($regid) ? intval($regid) : 0; $post['username'] = isset($username) ? input_trim($username) : ''; $post['password'] = isset($password) ? input_trim($password) : ''; $post['email'] = isset($email) ? input_trim($email) : ''; $post['mobile'] = isset($mobile) ? input_trim($mobile) : ''; $post['truename'] = isset($truename) ? convert(input_trim($truename), 'UTF-8', DT_CHARSET) : ''; $post['company'] = isset($company) ? convert(input_trim($company), 'UTF-8', DT_CHARSET) : ''; $post['passport'] = $post['username']; $post['cpassword'] = $post['password']; $RG = array();
<?php defined('IN_DESTOON') or exit('Access Denied'); login(); require DT_ROOT . '/module/' . $module . '/common.inc.php'; $MG['sendmail'] or dalert(lang('message->without_permission_and_upgrade'), 'goback'); require DT_ROOT . '/include/post.func.php'; if (isset($preview)) { $title = isset($title) ? trim(stripslashes($title)) : ''; $content = isset($content) ? trim(stripslashes($content)) : ''; include template('send', 'mail'); exit; } if ($submit) { captcha($captcha); $email = trim($email); if (!is_email($email)) { message($L['sendmail_pass_mailto']); } $title = trim(stripslashes($title)); if (strlen($title) < 5) { message($L['pass_title']); } $content = trim(stripslashes($content)); if (strlen($content) < 10) { message($L['pass_content']); } clear_upload($content); $content = dsafe(save_local($content)); $content = ob_template('send', 'mail'); $DT['mail_name'] = $_company;
<?php include __DIR__ . '/baseRules.php'; $rules['login'] = array('_method' => array('post' => array('ver', 'access_token', 'deviceToken', 'plat', 'type', 'u_tags')), 'ver' => ver(), 'access_token' => array('required' => 1, 'filters' => 'trim', 'msg' => '11051'), 'deviceToken' => array('required' => 0, 'length' => array(14, 64), 'regex' => '/^[a-zA-Z0-9]+$/', 'filters' => 'trim', 'msg' => '11051'), 'plat' => array('required' => 1, 'range' => array(1, 3), 'filters' => 'trim', 'msg' => '11051'), 'type' => array('required' => 1, 'range' => array(1, 3), 'filters' => 'trim', 'msg' => '11111'), 'u_tags' => array('required' => 1, 'filters' => 'trim', 'length' => array(10, 32), 'msg' => '11051')); $rules['reg'] = array('_method' => array('post' => array('ver', 'mobi', 'pass', 'session', 'deviceToken', 'u_tags', 'plat', 'name', 'pic', 'type', 'cver', 'captcha')), 'ver' => ver(), 'mobi' => mobile(), 'pass' => password(), 'session' => array('required' => 1, 'filters' => 'trim', 'msg' => '11111'), 'deviceToken' => array('required' => 1, 'length' => array(14, 64), 'regex' => '/^[a-zA-Z0-9]+$/', 'filters' => 'trim', 'msg' => '10010'), 'u_tags' => array('required' => 1, 'filters' => 'trim', 'length' => array(10, 32), 'msg' => '11051'), 'plat' => array('required' => 1, 'range' => array(1, 3), 'filters' => 'trim', 'msg' => '11051'), 'name' => array('required' => 1, 'length' => array(1, 12), 'filters' => 'trim', 'msg' => '10011'), 'pic' => array('required' => 0, 'filters' => 'trim', 'msg' => '10011'), 'type' => array('required' => 1, 'range' => array(1, 3), 'filters' => 'trim', 'msg' => '11111'), 'cver' => array('required' => 0, 'filters' => 'trim', 'msg' => '11111'), 'captcha' => captcha()); $rules['bind'] = array('_method' => array('post' => array('ver', 'token', 'access_token', 'plat', 'u_tags')), 'ver' => ver(), 'token' => token(), 'access_token' => array('required' => 1, 'filters' => 'trim', 'msg' => '11051'), 'plat' => array('required' => 1, 'range' => array(1, 3), 'filters' => 'trim', 'msg' => '11051'), 'u_tags' => array('required' => 1, 'filters' => 'trim', 'length' => array(10, 32), 'msg' => '11051')); $rules['del'] = array('_method' => array('post' => array('ver', 'token', 'plat')), 'ver' => ver(), 'token' => token(), 'plat' => array('required' => 1, 'range' => array(1, 3), 'filters' => 'trim', 'msg' => '11051')); return $rules;
function salesforce_form($options, $is_sidebar = false, $errors = null, $form_id = 1) { if (!isset($options['forms'][$form_id])) { return; } $content = ''; /* if (!empty($content)) $content = wpautop('<strong>'.$content.'</strong>'); */ if ($options['usecss']) { wp_enqueue_style('sfwp2lcss', plugins_url('/assets/css/sfwp2l.css', __FILE__)); } $label_location = salesforce_get_option('labellocation', $form_id, $options); $sidebar = ''; if ($is_sidebar) { $sidebar = ' sidebar'; } if (!$label_location) { $label_location = 'top-aligned'; } if ($is_sidebar) { $label_location = salesforce_get_option('labellocationsidebar', $form_id, $options); } if ($label_location == 'placeholders') { wp_enqueue_script('sfwp2ljqph', plugins_url('/assets/js/jquery-placeholder/jquery.placeholder.js', __FILE__)); } if ($options['wpcf7css'] && $options['wpcf7jsfix']) { wp_dequeue_script('contact-form-7'); } $custom_css = '/salesforce-wordpress-to-lead/custom.css'; if (file_exists(get_stylesheet_directory() . $custom_css)) { wp_enqueue_style('sfwp2lcsscustom', get_stylesheet_directory_uri() . $custom_css); } if ($options['wpcf7css']) { $content .= '<section class="form-holder clearfix"><div class="wpcf7">'; } $sf_form_id = get_salesforce_form_id($form_id, $sidebar); $action = '#sf_form_' . $sf_form_id; $action = apply_filters('salesforce_w2l_form_action', $action); $content .= "\n" . '<form id="sf_form_' . $sf_form_id . '" class="' . ($options['wpcf7css'] ? 'wpcf7-form' : 'w2llead' . $sidebar) . ' ' . $label_location . '" method="post" action="' . $action . '">' . "\n"; $reqtext = stripslashes(salesforce_get_option('requiredfieldstext', $form_id, $options)); $date_fields = array(); if (!empty($reqtext) && salesforce_get_option('requiredfieldstextpos', $form_id, $options) == 'top') { $content .= '<p class="sf_required_fields_msg" id="requiredfieldsmsg"><sup><span class="required">*</span></sup> ' . esc_html($reqtext) . '</p>'; } foreach ($options['forms'][$form_id]['inputs'] as $id => $input) { if (!$input['show']) { continue; } $val = ''; if (isset($_POST[$id])) { $val = $_POST[$id]; if (is_array($val)) { $val = array_map('esc_attr', array_map('salesforce_clean_field', $val)); } else { $val = esc_attr(strip_tags(stripslashes($val))); } } else { if (isset($input['value'])) { $val = esc_attr(strip_tags(stripslashes($input['value']))); } } $val = apply_filters('salesforce_w2l_field_value', $val, sanitize_html_class($id), $form_id); $val = apply_filters('salesforce_w2l_field_value_' . absint($form_id) . '_' . $id, $val); if ($input['type'] != 'hidden' && $input['type'] != 'current_date') { $content .= '<div class="sf_field sf_field_' . $id . ' sf_type_' . $input['type'] . '">'; } $error = ' '; if (isset($input['error']) && $input['error']) { $error = ' error '; } if ($input['type'] == 'date') { $date_fields[$id] = $input; } if ($input['type'] != 'hidden' && $input['type'] != 'current_date') { if ($options['wpcf7css']) { $content .= '<p>'; } if ($input['type'] == 'checkbox') { if (isset($_POST[$id])) { $post_val = $_POST[$id]; } else { $post_val = ''; } $content .= "\t\n\t" . '<input type="checkbox" id="sf_' . $id . '" class="w2linput checkbox" name="' . $id . '" value="' . $val . '" ' . checked($post_val, $val, false) . ' />' . "\n\n"; } $placeholder = ''; if ($label_location == 'placeholders' && $input['type'] != 'checkbox') { $placeholder = stripslashes(strip_tags($input['label'])); if ($input['required'] && $input['type'] != 'hidden' && $input['type'] != 'current_date' && $input['type'] != 'select' && $input['type'] != 'multi-select') { $placeholder .= ' *'; } //$placeholder = ' placeholder="'.$placeholder.'" '; } else { $required = ''; if ($input['required']) { $required = 'required'; } if (!empty($input['label'])) { $content .= "\t" . '<label class="w2llabel ' . $required . ' ' . $error . $input['type'] . ($input['type'] == 'checkbox' ? ' w2llabel-checkbox-label' : '') . '" for="sf_' . $id . '">' . ($input['opts'] == 'html' && $input['type'] == 'checkbox' ? stripslashes($input['label']) : esc_html(stripslashes($input['label']))); if (!in_array($input['type'], array('checkbox', 'html')) && !salesforce_get_option('donotautoaddcolontolabels', $form_id, $options)) { $content .= ':'; } } } } if ($label_location != 'placeholders') { if ($input['required'] && $input['type'] != 'hidden' && $input['type'] != 'current_date') { $content .= ' <sup><span class="required">*</span></sup>'; } if ($input['type'] != 'hidden' && $input['type'] != 'current_date') { $content .= '</label>' . "\n"; if ($options['wpcf7css']) { $content .= '<span class="wpcf7-form-control-wrap">'; } } } if ($input['type'] == 'text') { $content .= "\t" . '<input type="text" placeholder="' . $placeholder . '" value="' . $val . '" id="sf_' . $id . '" class="'; $content .= $options['wpcf7css'] ? 'wpcf7-form-control wpcf7-text' : 'w2linput text'; $content .= $options['wpcf7css'] && $input['required'] ? ' wpcf7-validates-as-required required' : ''; $content .= '" name="' . $id . '" ' . (!empty($input['opts']) ? ' placeholder="' . $input['opts'] . '" title="' . $input['opts'] . '"' : '') . ' />' . "\n\n"; } else { if ($input['type'] == 'email') { $content .= "\t" . '<input type="email" placeholder="' . $placeholder . '" value="' . $val . '" id="sf_' . $id . '" class="'; $content .= $options['wpcf7css'] ? 'wpcf7-form-control wpcf7-text' : 'w2linput text'; $content .= $options['wpcf7css'] && $input['required'] ? ' wpcf7-validates-as-required required' : ''; $content .= '" name="' . $id . '" ' . (!empty($input['opts']) ? ' placeholder="' . $input['opts'] . '" title="' . $input['opts'] . '"' : '') . ' />' . "\n\n"; } else { if ($input['type'] == 'date') { $content .= "\t" . '<input type="text" placeholder="' . $placeholder . '" value="' . $val . '" id="sf_' . $id . '" class="'; $content .= $options['wpcf7css'] ? 'wpcf7-form-control wpcf7-text' : 'w2linput text'; $content .= $options['wpcf7css'] && $input['required'] ? ' wpcf7-validates-as-required required' : ''; $content .= '" name="' . $id . '" />' . "\n\n"; } else { if ($input['type'] == 'textarea') { $content .= "\t" . (!$options['wpcf7css'] ? "\n\n" : '') . "\n\t" . '<textarea id="sf_' . $id . '" class="'; $content .= $options['wpcf7css'] ? 'wpcf7-form-control wpcf7-textarea' : 'w2linput textarea'; $content .= $options['wpcf7css'] && $input['required'] ? ' wpcf7-validates-as-required required' : ''; $content .= '" name="' . $id . '"' . (!empty($input['opts']) ? ' placeholder="' . $input['opts'] . '" title="' . $input['opts'] . '"' : '') . ' placeholder="' . $placeholder . '">' . $val . '</textarea>' . "\n\n"; } else { if ($input['type'] == 'hidden') { $content .= "\t\n\t" . '<input type="hidden" id="sf_' . $id . '" class="w2linput hidden" name="' . $id . '" value="' . $val . '" />' . "\n\n"; } else { if ($input['type'] == 'current_date') { $content .= "\t\n\t" . '<input type="hidden" id="sf_' . $id . '" class="w2linput hidden" name="' . $id . '" value="' . date($input['opts']) . '" />' . "\n\n"; } else { if ($input['type'] == 'html') { $content .= '<br>' . stripslashes($input['opts']) . "\n\n"; } else { if ($input['type'] == 'select' || $input['type'] == 'multi-select') { $content .= "\t\n\t" . '<select id="sf_' . $id . '" class="'; $content .= $options['wpcf7css'] ? 'wpcf7-form-control wpcf7-select style-select' : 'w2linput select'; $content .= $options['wpcf7css'] && $input['required'] ? ' wpcf7-validates-as-required required' : ''; if ($input['type'] == 'multi-select') { $content .= '" name="' . $id . '[]"'; $content .= ' multiple="multiple" '; } else { $content .= '" name="' . $id . '"'; } $content .= '>'; if ($placeholder) { if ($input['required']) { $content .= '<option value="" default disabled selected="selected">' . trim($placeholder) . ': *</option>' . "\n"; } else { $content .= '<option value="" default selected="selected">' . trim($placeholder) . ':</option>' . "\n"; } } if (is_array($val)) { $values = $val; } else { $values = array($val); } // remove excess whitespace to avoid false positive checks for newlines $input['opts'] = trim($input['opts']); if (strpos($input['opts'], "\n") !== false && substr_count($input['opts'], "|\n") <= 1 && substr_count($input['opts'], "|\r\n") <= 1) { // Newlines and pipes $delim1 = "\n"; $delim2 = "|"; } else { // pipes and colons $delim1 = "|"; $delim2 = ":"; } if (strpos($input['opts'], $delim1) !== false) { $opts = explode($delim1, trim($input['opts'])); foreach ($opts as $opt) { if (strpos($opt, $delim2) !== false) { list($k, $v) = explode($delim2, $opt); } else { $k = $v = $opt; } $v = trim(esc_attr(strip_tags(stripslashes($v)))); if ($placeholder) { $content .= '<option value="' . esc_attr($v) . '">' . trim(stripslashes($k)) . '</option>' . "\n"; } else { $content .= '<option value="' . esc_attr($v) . '" ' . selected(in_array($v, $values), true, false) . '>' . trim(stripslashes($k)) . '</option>' . "\n"; } } } $content .= '</select>' . "\n\n"; //$content .= '<pre>'.print_r( $values, 1 ).'</pre>'; } } } } } } } } if ($errors && !$errors[$id]['valid']) { $content .= "\t\n\t<span class=\"error_message\">" . $errors[$id]['message'] . '</span>'; } if ($input['type'] != 'hidden' && $input['type'] != 'current_date') { if ($options['wpcf7css']) { $content .= '</span></p>'; } $content .= '<div class="clearfix"></div></div>'; } } //captcha if (salesforce_get_option('captchaform', $form_id, $options) == 'enabled' || salesforce_get_option('captchaform', $form_id, $options) == '' && $options['captcha']) { // attempt to disable caching if (!defined('DONOTCACHEPAGE')) { define('DONOTCACHEPAGE', true); } if (!defined('DONOTCACHEOBJECT')) { define('DONOTCACHEOBJECT', true); } include "lib/captcha/captcha.php"; $captcha = captcha(); //$content .= 'CODE='.$captcha['code'].'<hr>'; $sf_hash = sha1($captcha['code'] . NONCE_SALT); set_transient($sf_hash, $captcha['code'], 60 * 15); $label = __('Type the text shown: *', 'salesforce'); $content .= '<div class="sf_field sf_field_captcha sf_type_captcha">'; $content .= '<label class="w2llabel">' . $label . '</label>' . "\n\n" . ' <img class="w2limg" src="' . $captcha['image_src'] . '&hash=' . $sf_hash . '" alt="CAPTCHA image" />' . "\n\n"; $content .= '<input type="text" class="w2linput text captcha" name="captcha_text" value="" />'; if ($errors && !$errors['captcha']['valid']) { $content .= "<span class=\"error_message\">" . $errors['captcha']['message'] . '</span>'; } $content .= '<input type="hidden" class="w2linput hidden" name="captcha_hash" value="' . $sf_hash . '" />'; $content .= '</div>'; } //send me a copy if ($options['showccuser']) { $label = $options['ccusermsg']; if (empty($label)) { $label = __('Send me a copy', 'salesforce'); } $content .= "\t\n\t" . '<div class="sf_field sf_field_cb sf_type_checkbox sf_cc_user"><label class="w2llabel checkbox w2llabel-checkbox-label"><input type="checkbox" name="w2lcc" class="w2linput checkbox" value="1" ' . checked(1, salesforce_get_post_data('w2lcc'), false) . ' /> ' . esc_html($label) . "</label></div>\n"; } //spam honeypot $content .= "\t" . '<input type="text" name="message" class="w2linput" value="" style="display: none;" />' . "\n"; //form id $content .= "\t" . '<input type="hidden" name="form_id" class="w2linput" value="' . $form_id . '" />' . "\n"; //daddy analytics if (isset($options['da_token']) && $options['da_token'] && isset($options['da_url']) && $options['da_url']) { $da_token = $options['da_token']; $da_url = $options['da_url']; $content .= "\t" . '<input type="hidden" id="Daddy_Analytics_Token" name="' . esc_attr($da_token) . '" class="w2linput" value="" style="display: none;" />' . "\n"; $content .= "\t" . '<input type="hidden" id="Daddy_Analytics_WebForm_URL" name="' . esc_attr($da_url) . '" class="w2linput" value="" style="display: none;" />' . "\n"; } $submit = stripslashes(salesforce_get_option('submitbutton', $form_id, $options)); if (empty($submit)) { $submit = "Submit"; } $content .= "\t"; if ($options['wpcf7css']) { $content .= '<p class="punt">'; } else { $content .= '<div class="w2lsubmit">'; } $content .= '<input type="submit" name="w2lsubmit" class="'; if ($options['wpcf7css']) { $content .= 'wpcf7-form-control wpcf7-submit btn'; } else { $content .= 'w2linput submit'; } $content .= '" value="' . esc_attr($submit) . '" />' . "\n"; if ($options['wpcf7css']) { $content .= '</p>'; } else { $content .= '</div>'; } $content .= '</form>' . "\n"; if (!empty($reqtext) && salesforce_get_option('requiredfieldstextpos', $form_id, $options) == '') { $content .= '<p class="sf_required_fields_msg" id="requiredfieldsmsg"><sup><span class="required">*</span></sup> ' . esc_html($reqtext) . '</p>'; } /* if (!$options['hide_salesforce_link']) { $content .= '<div id="salesforce"><small>'.__('Powered by','salesforce').' <a href="http://www.salesforce.com/">Salesforce CRM</a></small></div>'; } */ if ($options['wpcf7css']) { $content .= '</section>'; } if ($label_location == 'placeholder') { $content .= '<script>jQuery( document ).ready( function($) { $(".salesforce_w2l_lead input, .salesforce_w2l_lead textarea").placeholder(); } ); </script>'; } if (true) { $content = str_replace("\n", '', $content); } if ($date_fields) { wp_enqueue_script('jquery-ui-datepicker'); wp_enqueue_style('jquery-style', '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css'); $content .= "<script>jQuery(document).ready(function( \$ ) {"; foreach ($date_fields as $id => $date_field) { $options = trim(stripslashes($date_field['opts'])); if (!$options) { $options = "dateFormat : 'yy-mm-dd',"; } $content .= "\n\t\t\t jQuery('#sf_" . $id . "').datepicker({\n\t\t\t " . $options . "\n\t\t\t });\n\t\t\t\t"; } $content .= "});</script>"; } $content = apply_filters('salesforce_w2l_form_html', $content); return $content; }
<?php include __DIR__ . '/baseRules.php'; $rules['reg'] = array('_method' => array('post' => array('ver', 'mobi', 'captcha', 'pass', 'file', 'type', 'deviceToken', 'cver')), 'ver' => ver(), 'mobi' => mobile(), 'captcha' => captcha(), 'pass' => password(), 'type' => array('required' => 1, 'range' => array(1, 3), 'filters' => 'trim', 'msg' => '11111'), 'deviceToken' => array('required' => 0, 'length' => array(14, 64), 'regex' => '/^[a-zA-Z0-9]+$/', 'filters' => 'trim', 'msg' => '10010'), 'cver' => array('required' => 0, 'filters' => 'trim', 'msg' => '11111')); $rules['login'] = array('_method' => array('post' => array('ver', 'mobi', 'pass', 'type', 'deviceToken', 'cver')), 'ver' => ver(), 'mobi' => mobile(), 'pass' => password(), 'type' => array('required' => 1, 'range' => array(1, 3), 'filters' => 'trim', 'msg' => '11111'), 'deviceToken' => array('required' => 0, 'length' => array(14, 64), 'regex' => '/^[a-zA-Z0-9]+$/', 'filters' => 'trim', 'msg' => '10010'), 'cver' => array('required' => 0, 'filters' => 'trim', 'msg' => '11111')); $rules['change'] = array('_method' => array('post' => array('ver', 'token', 'captcha', 'passnew')), 'ver' => ver(), 'token' => token(), 'captcha' => captcha(), 'passnew' => password()); $rules['edit'] = array('_method' => array('post' => array('ver', 'token', 'uname')), 'ver' => ver(), 'token' => token(), 'uname' => array('required' => 0, 'length' => array(1, 12), 'filters' => 'trim', 'msg' => '10011')); $rules['trial'] = array('_method' => array('post' => array('ver', 'lat', 'lng')), 'ver' => ver(), 'lat' => array('required' => '1', 'filters' => 'trim', 'msg' => '10024'), 'lng' => array('required' => '1', 'filters' => 'trim', 'msg' => '10024')); $rules['logout'] = array('_method' => array('post' => array('ver', 'token', 'deviceToken')), 'ver' => ver(), 'token' => mobile(), 'token' => array('required' => 0, 'filters' => 'trim', 'length' => 32, 'msg' => '00000'), 'deviceToken' => array('required' => 0, 'length' => array(14, 64), 'regex' => '/^[a-zA-Z0-9]+$/', 'filters' => 'trim', 'msg' => '10010')); return $rules;