function __construct($Pivot = null, $Active = null) { if ($Pivot) { $this->SetPivot($Pivot); } else { $this->SetPivot(reg("jf/i18n/pivot")); } if ($Active) { $this->SetActive($Active); } else { $this->SetActive(reg("jf/i18n/active")); } $this->Languages = reg("jf/i18n/langs"); }
} } else { echo '信息填写不完整'; } break; case 'reg': if (!isset($_POST['username'])) { exit('用户名不能为空'); } if (!isset($_POST['email'])) { exit('邮箱不能为空'); } if (!isset($_POST['pwd'])) { exit('密码不能为空'); } echo reg($_POST['username'], $_POST['email'], $_POST['pwd']); loginByName($_POST['username'], $_POST['pwd']); break; /* case 'isNameReged': if(isset($_GET['username'])){ $username = $_GET['username']; if(is_name_reged($username)){ echo '1'; }else{ echo '0'; } }else{ echo '0'; } break;
echo " <script>window.location='reg.php';</script> "; } if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $info_ok = 0; echo ' <script>alert("邮箱地址错误")</script> '; echo " <script>window.location='reg.php';</script> "; } if ($info_ok) { //do reg //默认信息 $pass ss密码 $transfer 流量 $port 端口 $pass = get_temp_pass(); $transfer = $a_transfer; $r = new \Ss\User\Reg(); $last_port = $r->get_last_port(); $port = $last_port + rand(2, 7); //邀请码数量 $invite_num = rand($user_invite_min, $user_invite_max); $rt = reg($username, $email, $pwd, $pass, $transfer, $port, $invite_num, 0.0); if ($rt) { echo ' <script>alert("注册成功,返回登录!")</script> '; echo " <script>window.location='login.php';</script> "; //删除邀请码 if ($invite_only) { $ic->invite_code_del(); } } else { echo ' <script>alert("未知错误!")</script> '; echo " <script>window.location='reg.php';</script> "; } } }
} if ($svar == 4) { $msg = "<p class='misslykket'>Passordet må være på minimum 8 tegn!</p>"; } echo "<br>\r\n <a href='?side=administrator'><< Tilbake</a>\r\n <br><br>\r\n <h3>Registrer bruker</h3>\r\n <p>Ved ny bruker - be personen om å endre passordet under \"Endre passord\" i adminpanelet med <br>en gang de har logget på<br></p>\r\n <form method='post' action='' name='registrerBruker' id='registrerBruker'>\r\n <p>Brukernavn: <input type='text' name='brukernavn' id='brukernavn' value='{$navnebruker}'><br>\r\n Passord: <input type='password' name='pass' id='pass'> <br>\r\n Status: <select name='type'>\r\n <option value='moderator'>Moderator</option>\r\n <option value='administrator'>Administrator</option>\r\n </select>\r\n <br>\r\n <i>NB: Kun de som skal gi andre tilgang til adminpanelet skal ha status Administrator</i><br><br>\r\n <input type='submit' name='registrer' id='registrer' value='Registrer bruker'>\r\n </form></p>\r\n "; echo "{$msg}"; unset($_SESSION["brukernavn"]); } else { if (isset($_POST["registrer"])) { $brukernavn = htmlspecialchars($_POST["brukernavn"]); $pass = htmlspecialchars($_POST["pass"]); $rolle = $_POST["type"]; session_start(); $_SESSION["brukernavn"] = $brukernavn; if (!$brukernavn || !$pass) { header("Location: " . $siteurl . "&action=registrer-bruker&svar=1"); } else { if (strlen($pass) < 8) { header("Location: " . $siteurl . "&action=registrer-bruker&svar=4"); } else { if (reg($loggedUser, $brukernavn, $pass, $rolle)) { header("Location: " . $siteurl . "&action=registrer-bruker&svar=2"); } else { header("Location: " . $siteurl . "&action=registrer-bruker&svar=3"); } } } } } } }
<style> * { font-size:small; } </style> <?php $Op = reg(); echo nl2br(str_replace(" ", " ", htmlspecialchars(str_replace("=> stdClass Object", "", print_r($Op, true)))));
# - если ввести последовательно `reg test test`, `reg test test`, `unreg test test`, `unreg test test test`, `reg test test` может случиться нехилый баттхёрт # - директории сздаются со специфическими правами, стоит сообразить какие всё же права следует устанавливать директории пользователя при создании /** * Регистрация нового пользователя. Синтаксис: reg $email $pass [$nickname] * @param string $email - если указан некорректный email адрес воспринимается как никнейм (@ вырезается) * @param string $pass - пароль, может быть любым, но минимум 4 символа * @param string [$nickname] - псевдоним пользователя * @return string $result - результат */ if (isset($_SESSION['cd']['default'])) { chdir($_SESSION['cd']['default']); } return reg($arg[1], $arg[2], $arg[3]); if (isset($_SESSION['cd']['user'])) { chdir($_SESSION['cd']['user']); } function reg($email, $pass, $nickname) { global $db, $database, $ajax, $fold; # email filter: a4@a4.r4, a-b@a-b.a-b, ya@ya.ru # pass filter: 1111, aaaa, \\\\ if (!preg_match('!....+!', $email)) { throw new Exception('<strong style="color:red">Первый параметр (e-mail/nickname) должен содержать хотя бы 4 символа</strong>'); # $err_auth_wrong_email = $msg['cmd']['auth']['wrong_email'] } if (!preg_match('!....+!', $pass)) { throw new Exception('<strong style="color:red">Пароль должен содержать минимум 4 символа</strong>');
exit; } else { echo 0; exit; } } elseif (isset($_GET['username'])) { if (Uniqueusername($_GET['username'], $_GET['cus_id'])) { echo 1; exit(1); } else { echo 0; exit; } } else { if (verif($_POST['verification'])) { if (Uniqueusername($_POST['username'], $_POST['cus_id'])) { $username = $_POST['username']; $password = md5($_POST['password']); $mail = $_POST['mail']; $cus_id = $_POST['cus_id']; exit(reg($username, $password, $mail, $cus_id)); } else { echo json_encode(array('err' => '2', 'msg' => '用户名不唯一')); exit; } } else { echo json_encode(array('err' => '2', 'msg' => '验证码错误')); exit; } } mysql_close($conn);
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html <?php tr('dir="ltr"'); ?> > <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title><?php echo reg("app/title"); ?> </title> <link rel="shortcut icon" href="/img/jlogo.png" /> <script src='/script/jquery/132min.js'></script> <script src='/script/jquery/reflect.js'></script> </head> <body> <?php if (!isset($_GET['noheader'])) { ?> <style> body { background-color: #0E2E3E; margin: 0px; } p { border: 0px; outline: none; margin: 0px; padding: 0px; }
<?php require './post.php'; $email = $_POST['email']; $pass = $_POST['pass']; $name = $_POST['name']; reg($email, $pass, $name);
function __toString() { return "<div class=\"error\">Exception {$this->getCode()}:\n\t\t{$this->getMessage()}\n\t\tin File:{$this->getFile()} on line :{$this->getLine()}</div>"; //改写异常抛出 } } function reg($reginfo = null) { if (empty($reginfo) || !isset($reginfo)) { throw new Exception("参数非法"); } if (empty($reginfo['email'])) { throw new emailException("邮件为空"); } if ($reginfo['pwd'] != $reginfo['repwd']) { throw new pwdException("两次密码不一致"); } echo "注册成功"; } try { reg(array('email' => '*****@*****.**', 'pwd' => 123456, 'repwd' => 123454678)); } catch (emailException $ee) { $ee->getMessage(); } catch (pwdException $ep) { echo $ep; echo PHP_EOL, "特殊处理"; } catch (Exception $e) { echo $e->getTraceAsString(); echo $e->getMessage(); echo PHP_EOL, '其他情况,统一处理'; }
$len = count($re); $min = reg($start - $per_query, $per_page); if ($min < 0) { $min = 0; } $prev = reg($start - $per_page, $per_page); if ($prev < 0) { $prev = 0; } $max = $min + 2 * $per_query; if ($max > $total_records - 1) { $max = reg($total_records - 1, $per_page); } $next = ($start + $per_page) / $per_page * $per_page; if ($next > $total_records - 1) { $next = reg($total_records - 1, $per_page); } $ss1 = $start + 1; $ss2 = $ss1 + $per_page - 1; if ($ss2 > $total_records) { $ss2 = $total_records; } if ($ss2 >= $ss1) { $str = "显示第 {$ss1} 条到 第 {$ss2} 条记录。"; } else { $str = ""; } echo "<p><b>查到 {$total_records} 条记录。</b> {$str}</p>"; $stop_index = $start % $per_query + $per_page; if ($stop_index > $len) { $stop_index = $len;
} ?> </div> <span style='font-size: smaller;'>Note: do not select descendants of a role if its own is selected.</span> <br /> <br /> Now select users you want your selected roles to be assigned to : <br /> <?php foreach ($this->Users as $U) { ?> <input type='checkbox' class='uid' name='uid[]' value='<?php echo $U[jf_Users_Table_UserID]; ?> ' /><?php echo $U[reg("jf/users/table/Username")]; ?> <span class="id">(<?php echo $U[jf_Users_Table_UserID]; ?> )</span> <br /> <?php } ?> <div style='font-size: small;'><a href='#' onclick=' $(".uid").attr("checked",true); '>All</a> | <a href='#' onclick=' $(".uid").attr("checked",false); '>None</a></div>
<!-- Critical Logs --> <tr> <td colspan='4'><h2><?php tr("Critical Logs"); ?> </h2></td> <td colspan='4'> </td> </tr> <tr> <td colspan='8'> <?php $Logs = j::SQL("SELECT * FROM `" . reg("jf/log/table/name") . "` WHERE `" . reg("jf/log/table/Severity") . "`>=5 ORDER BY `" . reg("jf/log/table/Timestamp") . "` DESC LIMIT 50"); if (is_array($Logs)) { $n = 0; foreach ($Logs as $L) { echo "<strong>" . ++$n . ". " . $L['Subject'] . " (" . $L['Severity'] . ")</strong> " . $L['Data'] . " <i>(" . date("Y-m-d H:i:s", $L['Timestamp']) . ")</i>" . BR; } ?> <form action='../logs/view' onsubmit='return confirm("Are you sure?");' method='post'> <input type='hidden' name='DelSeverity' value='7' /> <input type='submit' value='Clear All Logs' /> </form> <?php } ?> </td> </tr>
{ function __toString() { return "<div class=\"error\">Exception{$this->getCode()}:{$this->getMessage()} in File:{$this->getFile()} on line:{$this->getLine()} </div>"; // 改写抛出异常结果 } } function reg($reginfo = null) { if (empty($reginfo) || !isset($reginfo)) { throw new Exception("非法参数"); } if (empty($reginfo['email'])) { throw new emailException("邮件为空"); } if ($reginfo['pwd'] != $reginfo['repwd']) { throw new pwdException("两次密码不一致"); } echo '注册成功'; } try { reg(array('email' => '*****@*****.**', 'pwd' => 0, 'repwd' => 1)); } catch (emailException $ee) { echo $ee->getMessage(); } catch (pwdException $ep) { echo $ep; echo PHP_EOL, '特殊处理'; } catch (Exception $e) { echo $e->getTraceAsString(); echo PHP_EOL, '其他情况,统一处理'; }
<!--add--> <?php if (!isset($_SESSION['lang'])) { $lang = selLang(); } else { $lang = selLang($_SESSION['lang']); } if (isset($_POST['aunt']) and !empty($_POST['aunt'])) { aunt(clearData($_POST['login']), clearData($_POST['pass'])); } if (isset($_POST['exit'])) { session_destroy(); header("Location: index.php"); } if (isset($_POST['reg'])) { reg(clearData($_POST['login']), clearData($_POST['pass']), clearData($_POST['email'])); } ?> <title>PHP+MYSQL+JAVASCRIPT+CSS </title> </head> <body background='bg.jpg'> <table align='center' width='760' border='10' bordercolor='lightblue' background='bgtable.jpg' cellpadding='10' cellspacing='0'> <!--шапка--> <tr width='100%'> <td colspan='2'> <div> <?php include 'top.php'; ?> </div>
break; */ case 'reg': if (!isset($_POST['username'])) { exit('Invalid requset'); } if (!isset($_POST['email'])) { exit('Invalid request'); } if (!isset($_POST['password'])) { exit('Invalid request'); } if (strpos($_POST['username'], '@') === true) { exit('@ can not be included in username'); } echo reg($_POST['username'], $_POST['email'], $_POST['password']); break; case 'isNameReged': if (isset($_GET['username'])) { if (strpos($_GET['username'], '@') === true) { echo 'true'; exit; } if (is_name_reged($_GET['username'])) { echo 'true'; } else { echo 'false'; } } else { echo 'Invalid request'; }
<?php require_once 'include.php'; $act = $_REQUEST['act']; if ($act === "reg") { $mes = reg(); } elseif ($act === "login") { $mes = login(); } elseif ($act === "userOut") { userOut(); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <?php if ($mes) { echo $mes; } ?> </body> </html>
} else { $mode = "empty"; } switch ($mode) { case "avaleht": include_once "views/head2.html"; include "views/avaleht.html"; include_once "views/footer.html"; break; case "tooted": include_once "views/head.html"; include "views/tooted.html"; include_once "views/footer.html"; break; case "register": reg(); break; case "login": login(); break; case "logout": logout(); break; case "hinnad": post(); break; default: include_once "views/head2.html"; include "views/avaleht.html"; include_once "views/footer.html"; break;
<?php header('content-type:text/html; charset=utf-8'); function reg($type, $name, $place) { echo "<input type='{$type}' name='{$name}' placeholder='{$place}'>"; } function sub($type, $name, $value) { echo "<input type='{$type}' name='{$name}' value='{$value}'>"; } $text = "text"; $user = "******"; $holder = "enter username..."; echo "<form action='' method='post'>"; echo "LOG IN"; echo "<p>Enter User NAME:</p>"; reg($text, $user, $holder); echo "<p>Enter PASSWORD : </p>"; reg('password', 'password', 'enter password...'); echo "<p>ENTER</p>"; sub('submit', 'submit', 'LOG IN'); echo "</form>";