WAPCS

Wapmaster PHP, HTmL, MySQL, XtGEm

HOMEABOUTBLOG
Buat Function Anti Inject PHP - Situs Tempat Belajar PHP, HTML, MySQL

NEW UPDATE

Tags: Function php

Buat Function Anti Inject PHP

Asskum
Berikut kode nya silahkan di salin..

function clean($str) {
$str = @trim($str);
if(get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
return mysql_real_escape_string($str);
}

function anti_injection($data){
$filter = mysql_real_escape_string(stripslashes(strip_tags(htmlspecialchars($data, ENT_QUOTES ))));
return $filter;
}
?>


Simpan kode di atas berinama func.php
bonus function pencarian atau tag keyword silahkan di gasak juga

//copy code
<?php
function gettags($text){
$tags = explode(" ",str_replace(',','',$text));
foreach($tags as $key => $value) $show .= $value.',';
return $show;
}

function tags($text){
$tags = explode(",",$text);
foreach($tags as $key => $value)
$show .= '<a href="search.php?q='.$value.'" title="Tags artikel '.$value.'">'.$value.'</a>,';
return $show;
}
?>


Selesai post kali ini wassalam

Back to posts
Comments:
[2014-12-19 00:59:00] Cyber4rt.wapsite.me:

hmm.. baru tahu yg kek ginian. nice post sob


Post a comment

ON : 1 | Hari : 1 | Total : 132969