View Single Post
ישן 07-02-11, 18:34   # 7
elialum
חבר בקהילה
 
מיני פרופיל
תאריך הצטרפות: Apr 2007
מיקום: מעלה אדומים
גיל: 46
הודעות: 132

elialum לא מחובר  

eregi כבר לא בשימוש בגרסאות החדשות של PHP.
הצעת ייעול - סידרתי לך את זה קצת אחרת, עם פחות elseים.
(לא בדקתי, כתבתי את זה עם notepad)

הדרך הנכונה לדעתי היא לכתוב פונקציה שעושה סניטציה ל-URL (חלק מהבדיקות \ "נקיונות" כבר מוטמעות בתוך PHP) ולעבוד עם הפונקציה.
הקוד יהיה יותר קריא וענייני.



PHP קוד:
@session_start();
/*
If this security working so Shad0w wrote it ,if not so i dont know who wrote it
*/

if($_SESSION["banned"] == "true")
{
    print 
"<html><head><title>Secured By Shad0w</title></head><body>Blocked !</body></html>"// I have to find a better job
        
exit;
}

$ip $_SERVER["REMOTE_ADDR"];
$agent $_SERVER["HTTP_USER_AGENT"];
$query strolower($_SERVER["QUERY_STRING"]);
$url $_SERVER["PHP_SELF"];
$m "mail@shad0w.info"//Your mail

$o fopen("logs.txt"x+) or die("Goto hell error");
if(
file_exit("logs.txt")) {
    
$o fopen("logs.txt"a+) or die("Hostuon ,we have a problem");
}

if(
eregi("union"$query) || eregi("select"$query) || eregi("where"$query) || eregi("from"$query) || eregi("<"$query) || eregi(">"$query) || eregi("'"$query))
{
    
$_SESSION["banned"] = "true";
    print 
"<html><head><title>Secured By Shad0w</title></head><body>Blocked !</body></html>"//If you deleting this line its said you l4m3 man
    
fwrite($o"IP: {$ip} \n Agent: {$agent} \n url = {$url}");
    
mail($m"Security Logs - {$ip}""IP: {$ip} \n Agent: {$agent} \n url = {$url} \r\n Secured By Shad0w"); 
        exit;

__________________

Last edited by elialum; 07-02-11 at 18:37..