Skip to content

Commit

Permalink
lsp: several bug fixes with registration
Browse files Browse the repository at this point in the history
  • Loading branch information
liushuyu committed May 15, 2021
1 parent 6050a66 commit 02aa856
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion public/lsp/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function try_add_user($login , $pass, $pass2, $realname, $session, $is_admin, $a
function check_antispam($antispam) {
if (isset($antispam)) {
for ($i = 0; $i < 25; $i++) {
$md5 = md5(session_id() + $i);
$md5 = md5(intval(session_id()) + $i);
if (strpos($antispam, substr($md5, strlen("$md5") - 4, strlen("$md5"))) !== false) {
return true;
}
Expand Down
3 changes: 3 additions & 0 deletions public/lsp/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ function read_project($file_id) {
case '.mmpz' :
// Open binary file for reading
$handle = fopen($DATA_DIR . $file_id, "rb");
if (!$handle) {
return null;
}
// Skip the first 4 bytes for compressed mmpz files
fseek($handle, 4);
$data = fread($handle, filesize($DATA_DIR . $file_id) - 4);
Expand Down
7 changes: 0 additions & 7 deletions public/utils.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
<?php

function str_contains($haystack, $needle, $ignorecase = FALSE) {
if ($ignorecase) {
return strpos(strtolower($haystack), strtolower($needle)) !== FALSE;
}
return strpos($haystack, $needle) !== FALSE;
}

function str_startswith($haystack, $needle, $ignorecase = FALSE) {
if ($ignorecase) {
return $needle === "" || strpos(strtolower($haystack), strtolower($needle)) === 0;
Expand Down

0 comments on commit 02aa856

Please sign in to comment.