function getImageName($file, $dir) { $path = '/images/uploads/'; //$dir = $_SERVER['DOCUMENT_ROOT'] . "/images/uploads/"; $oldfile = str_replace($dir, "", $file); $oldfileext = split("[.]", $oldfile); //$oldfileext = "jpg"; $oldfile = generateNewName(); if ($oldfile != "") { if (file_exists($dir . $oldfile . "." . end($oldfileext))) { $cnt = 1; $flag = false; } while ($flag == false) { $newfile = $oldfile . '' . $cnt . "." . end($oldfileext); if (file_exists($dir . $newfile)) { $cnt++; } else { $flag = true; $uploadval = $newfile; return $uploadval; } if ($cnt > 50) { $flag = true; } } } }
} $mysql->exec('update watchlist set failed=0 where id=' . $_SERVER['QUERY_STRING']); //之前不知道抽什么风莫名其妙标记温馨提示 echo '若没有自动跳转, <a href="' . $check['url'] . ($res['pass'] !== '0' ? '#' . $res['pass'] : '') . '">点我手动跳转</a>。 <script>window.onload=function(){window.location="' . $check['url'] . ($res['pass'] !== '0' ? '#' . $res['pass'] : '') . '"};</script>'; } elseif (!$check['user_valid']) { echo '<h1>用户登录失效</h1>'; wlog('记录ID ' . $_SERVER['QUERY_STRING'] . '在补档时登录信息失效', 2); die; } elseif (!$check['valid']) { $path = $res['name']; $suffix = ''; if (strrpos($path, '.') !== false) { $suffix = substr($path, strrpos($path, '.')); } $newname = generateNewName() . $suffix; $newfullpath = substr($path, 0, 1 - strlen(strrchr($path, '/'))) . $newname; $need_rename = true; if ($res['usermd5'] && !$meta['info'][0]['isdir']) { //文件,执行换md5补档 $md5 = $res['block_list'] ? json_decode($res['block_list']) : $meta['info'][0]['block_list']; //检测当前文件用的是哪个MD5 $res['usermd5'] = json_decode($res['usermd5']); foreach ($res['usermd5'] as $k => $v) { $current_md5_key = $k; $current_md5 = $v; if (array_search($v, $md5) !== false) { break; } } $md5[] = $current_md5;