Reply to comment

kalau aku malah kebalikannya, ndak suka wandering around dengan magic_quotes di variabel. fungsi untuk stripslashes:

function g($x) { return isset($_GET[$x])?(get_magic_quotes_gpc()?stripslashes($_GET[$x]):$_GET[$x]):''; }

function p($x) { return isset($_POST[$x])?(get_magic_quotes_gpc()?stripslashes($_POST[$x]):$_POST[$x]):''; }

function c($x) { return isset($_COOKIE[$x])?(get_magic_quotes_gpc()?stripslashes($_COOKIE[$x]):$_COOKIE[$x]):''; }

// quote sql
// usage:
// list($uname, $pwd) = q($uname, $pwd);
// $sql = "INSERT INTO users VALUES ('$uname', '$pwd')";
function q() {
$args=func_get_args(); $r=array();
foreach($args as $arg) $r[] = mysql_escape_string($arg);
return count($arg) == 1 ? $r[0] :$r;
}

alasan: biar kita tau kalau slash itu dari magic_quotes atau slash dari addslashes

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options