function haveChina($content) { $i = ''; $j = ''; $haveChina = false; for ($i = 1; $i <= len($content); $i++) { $j = asc(mid($content, $i, 1)); //是汉字累加 if ($j < 0) { if (($j <= -22033 && $j >= -24158) == false) { $haveChina = true; return @$haveChina; } } } return @$haveChina; }
if ($stmt->fetch()) { $message = <<<MESSAGE Thank you for requesting a new password at SHC Manager. We have created a new password for your account. Your new password is %s. Please keep this information secure. Sincerely, The SHC Manager team MESSAGE; // Generate a new password for them $password = ''; for ($i = 0; $i < 12; $i++) { $password .= chr(rand(asc('a'), asc('z'))); } $hash = hash('sha512', $password . $salt); $subquery = "UPDATE users SET hashed_password=? WHERE username=?"; $substmt = $mysqli->prepare($subquery); $substmt->bind_param('ss', $hash, $_POST['username']); $substmt->execute(); if (!$substmt->errno) { $message = sprintf($message, $password); mail($email, "Password reset", $message, "From:{$admin_address}\r\n"); $result_message = "Your password has been reset. The new password\n for your account has been sent by e-mail."; } else { $result_message = "An error occured in resetting your password."; } $substmt->close(); } else {
function HTMLToAscChr($title) { $i = ''; $s = ''; $c = ''; $c = ''; for ($i = 1; $i <= len($title); $i++) { $s = mid($title, $i, 1); $c = $c . 'Chr(' . asc($s) . ')&'; } if ($c != '') { $c = left($c, len($c) - 1); } $HTMLToAscChr = $c; //HTMLToAscChr = "<" & "%=" & C & "%" & ">" return @$HTMLToAscChr; }
function setCutTDStr($content, $TDWidth, $MoreColor) { $i = ''; $s = ''; $c = ''; $n = ''; $EndNumb = ''; $YesMore = ''; $content = cStr($content . ''); if ($content == '') { $setCutTDStr = $content; return @$setCutTDStr; } if ($TDWidth == '') { $setCutTDStr = $content; return @$setCutTDStr; } //TDWidth为空,则为自动 $n = 0; $YesMore = false; $EndNumb = int($TDWidth / 6.3); for ($i = 1; $i <= len($content); $i++) { $s = mid($content, $i, 1); if ($n >= $EndNumb) { $YesMore = true; break; } else { $c = $c . $s; } if (asc($s) < 0) { $n = $n + 2; } else { $n = $n + 1; } } if ($YesMore == true) { //需要处理Title标题的HTML $c = '<span Title="' . displayHtml($content) . '" style="background-color:' . $MoreColor . ';">' . $c . '</span>'; } $setCutTDStr = $c; return @$setCutTDStr; }
function getLen($content) { $i = ''; $s = ''; $n = ''; $n = 0; for ($i = 1; $i <= len($content); $i++) { $s = asc(mid(cStr($content), $i, 1)); if ($s < 0) { $n = $n + 2; } else { $n = $n + 1; } } $getLen = $n; return @$getLen; }