Results 1 to 5 of 5

Thread:

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User a_panov's Avatar
    Join Date: Mar:2005
    Location: Sofia
    Posts: 45

    Exclamation

    . - . , . "" . -. UTF-8, .

    - .
    Code:
    function utf8_substr($str,$from,$len)
    {
    	if (mb_strlen($str) > $len)
    	{
    		return mb_substr($str,$from,$len,'utf-8');
    	}
    	else
    	{
    		return $str;
    	}
    }
    
    if (!isset($_POST['des']))
    {
    	header ("Location: http://www.evitatrade.com/");
    	exit;
    }
    
    $des = trim($_POST['des']);
    $des = str_replace("\t", " ", $des);
    $des = str_replace("\n", " ", $des);
    $des = str_replace("\r", " ", $des);
    
    if (empty($des))
    {
    	header ("Location: http://www.evitatrade.com/");
    	exit;
    }
    
    $des = utf8_substr($des, 0, 1200);
    if (!preg_match("#^[\s\-_,.!?)(0-9A-Za-z--]+$#u", $des)) // !preg_match( "#^[- _0-9a-z-]+$#i",    !ereg("^[- _,.!0-9A-Za-z--]+$",
    {
    	header ("Location: http://www.evitatrade.com/");
    	exit;
    }

  2. #2
    hmm BornToDrink's Avatar
    Join Date: Aug:2005
    Location: .
    Posts: 11,573
    - " "?
    :
    evitatrade.com/index.php?a=adds&b=index
    :
    Code:
    $des = strip_tags($des);
    $des = addslashes($des);
    .. , , SQL ( ).
    .
    ...

    PS - $_POST['des'], , , .
    Last edited by BornToDrink; 12th August 2009 at 11:16.
    Hey, mother, I come bearing a gift. I'll give you a hint. It's in my diaper and it's not a toaster.
    .

  3. #3
    Registered User a_panov's Avatar
    Join Date: Mar:2005
    Location: Sofia
    Posts: 45
    Quote Originally Posted by BornToDrink View Post
    - " "?
    :
    evitatrade.com/index.php?a=adds&b=index
    :
    Code:
    $des = strip_tags($des);
    $des = addslashes($des);
    .. , , SQL ( ).
    .
    ...
    addslashes ?
    , SQL-!
    ?
    PS - $_POST['des'], , , .
    , , word ?
    !

  4. #4
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    , - preg_match(). , . (.. ), .

    stripslashes() -.
    private static function _remove_magic_quotes($s) {
    if (get_magic_quotes_gpc()) return stripslashes($s);
    return $s;
    }

    addslashes (- mysql_real_escape_string()) . .

    UTF8, , , , .

  5. #5
    TEKIL4O's Avatar
    Join Date: Feb:2007
    Location: Rousse/Sofia
    Posts: 341
    PHP Filter, !
    EP 9NPA+ U (HR-05/IFX)| 4200+X2@2.8GHz (IFX-14) | 2x1GB KINGSTON (DDR430 3-4-3-6-1T@2.7V) | GB 8800GT (512MB) | WD6401AALS | CFT-750-14CS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |