当前位置: 首页>>代码示例>>PHP>>正文


PHP antiinjection函数代码示例

本文整理汇总了PHP中antiinjection函数的典型用法代码示例。如果您正苦于以下问题:PHP antiinjection函数的具体用法?PHP antiinjection怎么用?PHP antiinjection使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了antiinjection函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: session_start

 <?php 
session_start();
//memulai session
include "lib/koneksi.php";
function antiinjection($data)
{
    $filter_sql = mysql_real_escape_string(stripslashes(strip_tags(htmlspecialchars($data, ENT_QUOTES))));
    return $filter_sql;
}
$passwordlama = antiinjection($_POST['oldPass']);
$passwordbaru1 = antiinjection($_POST['newPass1']);
$passwordbaru2 = antiinjection($_POST['newPass2']);
$username = $_SESSION['username'];
$nip = $_SESSION['nip_baru'];
// cek benar tidaknya password yang lama
$query = "select * from user where username='{$username}' and status_user='aktif'";
$hasil = mysql_query($query);
$data = mysql_fetch_array($hasil);
$tglkini = date('Y-m-d');
//cek kesesuain password
$pengacak = "AJWKXLAJSCLWLW";
$passwordbaruenkrip = md5($pengacak . md5($passwordbaru1) . $pengacak);
$query = "UPDATE user SET password = '{$passwordbaruenkrip}' WHERE username = '{$username}' and nip_baru='{$nip}' ";
$hasil = mysql_query($query);
mysql_query("INSERT INTO historybcf15(namaaksi,tanggalaksi,nama_user,nip_user,userdiupdate,nipuserdiupdate)VALUES('updatepassword','{$tglkini}','" . $_SESSION['nm_lengkap'] . "','" . $_SESSION['nip_baru'] . "','" . $_SESSION['nm_lengkap'] . "','" . $_SESSION['nip_baru'] . "')");
if ($hasil) {
    echo "<div><img  src='images/new/warning.png'/> <font color='blue' size='4'>Reset Password Sukses</font></div> ";
}
echo '<script type="text/javascript">window.location="index.php?hal=home"</script>';
开发者ID:ali-ghanas,项目名称:sitampan,代码行数:29,代码来源:resetpassproses.php

示例2: antiinjection

    $keterangan = antiinjection($_POST['keterangan']);
    mysqli_query($connecDB, "INSERT INTO submenu (idMenu, namaSubMenu, modul, keterangan) \n                             VALUES ('{$idMenu}', '{$namaSubMenu}', '{$modul}', '{$keterangan}')");
    header('Location: ./menu/');
}
if (isset($_POST['editSubMenu'])) {
    header('Content-Type: text/plain');
    function antiinjection($data)
    {
        $filter_sql = mysql_real_escape_string(stripslashes(strip_tags(htmlspecialchars($data, ENT_QUOTES, 'UTF-8'))));
        return $filter_sql;
    }
    $id = antiinjection($_POST['id']);
    $idMenu = antiinjection($_POST['idMenu']);
    $namaSubMenu = antiinjection($_POST['namaSubMenu']);
    $modul = antiinjection($_POST['modul']);
    $keterangan = antiinjection($_POST['keterangan']);
    mysqli_query($connecDB, "UPDATE submenu SET idMenu = '{$idMenu}',\n                                                namaSubMenu = '{$namaSubMenu}',\n                                                modul = '{$modul}',\n                                                keterangan = '{$keterangan}' WHERE idSubmenu = '{$id}'");
    header('Location: ./menu/');
}
if (isset($_POST['bannerAdd'])) {
    $target_dir = "../images/";
    $target_file = $target_dir . basename($_FILES["banner"]["name"]);
    $uploadOk = 1;
    $imageFileType = pathinfo($target_file, PATHINFO_EXTENSION);
    // Check if image file is a actual image or fake image
    if (isset($_POST["submit"])) {
        $check = getimagesize($_FILES["banner"]["tmp_name"]);
        if ($check !== false) {
            echo "File is an image - " . $check["mime"] . ".";
            $uploadOk = 1;
        } else {
开发者ID:portsign,项目名称:equalizer,代码行数:31,代码来源:record.php

示例3: antiinjection

<head>
   
    <title></title>
    
   
   
</head>
<body>
    <?php 
    function antiinjection($data)
    {
        $filter_sql = mysql_real_escape_string(stripslashes(strip_tags(htmlspecialchars($data, ENT_QUOTES))));
        return $filter_sql;
    }
    if (isset($_POST['submit'])) {
        $passbaru = antiinjection($_POST['passbaru']);
        $id = $_POST['iduser'];
        $pengacak = "AJWKXLAJSCLWLW";
        $passwordbaruenkrip = md5($pengacak . md5($passbaru) . $pengacak);
        $query = "UPDATE user SET password = '{$passwordbaruenkrip}' WHERE iduser='{$id}' ";
        $hasil = mysql_query($query);
        echo "<div><img  src='images/new/warning.png'/> <font color='blue' size='4'>Reset Password Sukses</font></div> ";
        echo "<script type='text/javascript'>window.location='index.php?hal=user&pilih=manajemenuserresetpass&id={$id}'</script>";
    } else {
        $id = $_GET['id'];
        // menangkap id
        $sql = "SELECT * FROM user WHERE iduser={$id}";
        // memanggil data dengan id yang ditangkap tadi
        $query = mysql_query($sql);
        $data = mysql_fetch_array($query);
        ?>
开发者ID:ali-ghanas,项目名称:sitampan,代码行数:31,代码来源:resetpass.php

示例4: trim

$komentar = trim($_POST['isi_komentar']);
if (empty($nama)) {
    echo "Anda belum mengisikan NAMA<br />\n  \t      <a href=javascript:history.go(-1)><b>Ulangi Lagi</b>";
} elseif (empty($komentar)) {
    echo "Anda belum mengisikan KOMENTAR<br />\n  \t      <a href=javascript:history.go(-1)><b>Ulangi Lagi</b>";
} elseif (strlen($_POST['isi_komentar']) > 1000) {
    echo "KOMENTAR Anda kepanjangan, dikurangin atau dibagi jadi beberapa bagian.<br />\n  \t      <a href=javascript:history.go(-1)><b>Ulangi Lagi</b>";
} else {
    function antiinjection($data)
    {
        $filter_sql = mysql_real_escape_string(stripslashes(strip_tags(htmlspecialchars($data, ENT_QUOTES))));
        return $filter_sql;
    }
    $nama_komentar = antiinjection($_POST['nama_komentar']);
    $url = antiinjection($_POST['url']);
    $isi_komentar = antiinjection($_POST['isi_komentar']);
    if (!empty($_POST['kode'])) {
        if ($_POST['kode'] == $_SESSION['captcha_session']) {
            // Mengatasi input komentar tanpa spasi
            $split_text = explode(" ", $isi_komentar);
            $split_count = count($split_text);
            $max = 57;
            for ($i = 0; $i <= $split_count; $i++) {
                if (strlen($split_text[$i]) >= $max) {
                    for ($j = 0; $j <= strlen($split_text[$i]); $j++) {
                        $char[$j] = substr($split_text[$i], $j, 1);
                        if ($j % $max == 0 && $j != 0) {
                            $v_text .= $char[$j] . ' ';
                        } else {
                            $v_text .= $char[$j];
                        }
开发者ID:Syndrom2211,项目名称:Aplikasi-Website-BBLM,代码行数:31,代码来源:simpankomentar.php

示例5: antiinjection

<?php

require "../config/config.php";
require '../function/antiinjection.php';
if (isset($_POST['input'])) {
    $nama_partner = antiinjection($_POST['nama_partner']);
    if (isset($_FILES['logo'])) {
        $logo = "";
        $sumber = $_FILES['logo']['tmp_name'];
        $tujuan = "../../images/partner/" . $_FILES['logo']['name'];
        $tujuan1 = "/images/partner/" . $_FILES['logo']['name'];
        //////////////////////
        $logo = $_FILES['logo']['name'];
        //////////////////////
        move_uploaded_file($sumber, $tujuan);
        /////////////////////
    }
    $insertquery = "insert into t_partner (id_partner, nama_partner, logo, tgl) values ('','{$nama_partner}','{$logo}',now())";
    $sql = mysql_query($insertquery);
    if ($sql) {
        echo "\n\t\t\t\t<div class='alert alert-success'>                \n\t\t\t\t\t<strong>Success!</strong>Successfully Saved\n\t\t\t\t\t<button type='button' class='close' data-dismiss='alert'>&times;</button>\n\t\t\t\t</div>\n\t\t\t\t";
    } else {
        echo "\n\t\t\t\t<div class='alert alert-error'>                \n\t\t\t\t<strong>Error !</strong> Failed to Save\n\t\t\t\t<button type='button' class='close' data-dismiss='alert'>&times;</button>\n\t\t\t\t</div>\n\t\t\t\t";
    }
}
?>

    
    <script type='text/javascript' src='../assets/js/validationengine/languages/jquery.validationEngine-en.js'></script>
    <script type='text/javascript' src='../assets/js/validationengine/jquery.validationEngine.js'></script>
    <script type='text/javascript' src='../assets/js/maskedinput/jquery.maskedinput.min.js'></script>
开发者ID:BayuWijayaPermanaPutra,项目名称:BDF,代码行数:31,代码来源:sponsor_tambah.php

示例6: header

<?php

if (isset($_POST['createAccount'])) {
    include "config/connection.php";
    header('Content-Type: text/plain');
    function antiinjection($data)
    {
        $filter_sql = mysql_real_escape_string(stripslashes(strip_tags(htmlspecialchars($data, ENT_QUOTES, 'UTF-8'))));
        return $filter_sql;
    }
    $namaLengkap = $_POST['namaLengkap'];
    $username = $_POST['username'];
    $password = antiinjection($_POST['password']);
    $repassword = antiinjection($_POST['repassword']);
    $salt = '~!@#$%^&*(1111)_+ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
    $pass = sha1(md5($salt . $password));
    $repass = sha1(md5($salt . $repassword));
    if ($pass !== $repass) {
        header('Location: installation/3/errorpassword');
        die;
    } else {
        mysqli_query($connecDB, "INSERT INTO administrator (namaAuthor, profesi, linkGoogle, username, password) \r\n\t\t\t\t\t\t\t VALUES ('{$namaLengkap}', '', '', '{$username}', '{$pass}')") or die(mysql_error());
        rename('statusInstallation.txt', 'config/statusInstallation.txt');
        header('Location: installation/finish');
    }
}
开发者ID:portsign,项目名称:equalizer,代码行数:26,代码来源:step3.php

示例7: session_start

<?php

session_start();
require 'config/config.php';
require 'function/antiinjection.php';
if (isset($_POST['login'])) {
    $ket_admin = "admin";
    $ket_user = "user";
    $user = antiinjection($_POST['user']);
    $pass = antiinjection($_POST['pass']);
    $query = "select id_admin, username, password from t_admin where username = '{$user}' and password = '{$pass}' ";
    $sql = mysql_query($query);
    $hasil = mysql_fetch_array($sql);
    $id = $hasil['id_admin'];
    $username = $hasil['username'];
    $password = $hasil['password'];
    if ($user == $username && $pass == $password) {
        //menciptakan session
        $_SESSION['login'] = $user;
        //menuju ke halaman pemerikasaan session
        header('Location:dashboard/index.php');
    } else {
        if ($user == $username && $pass == $password) {
            //menciptakan session
            $_SESSION['login'] = $user;
            //menuju ke halaman pemerikasaan session
            header('Location:dashboard/home_db.php');
        } else {
            if ($user == $username && $pass == $password) {
                //menciptakan session
                $_SESSION['login'] = $user;
开发者ID:BayuWijayaPermanaPutra,项目名称:BDF,代码行数:31,代码来源:cek_login.php

示例8: antiinjection

<?php

include "../config/koneksi.php";
function antiinjection($data)
{
    $filter_sql = mysql_real_escape_string(stripslashes(strip_tags(htmlspecialchars($data, ENT_QUOTES))));
    return $filter_sql;
}
$username = antiinjection($_POST['username']);
$pass = antiinjection($_POST['password']);
$login = mysql_query("SELECT * FROM admins WHERE username='{$username}' AND password='{$password}'");
$ketemu = mysql_num_rows($login);
$r = mysql_fetch_array($login);
// Apabila username dan password ditemukan
if ($ketemu > 0) {
    session_start();
    "namauser";
    "namalengkap";
    "passuser";
    "leveluser";
    $_SESSION[namauser] = $r[username];
    $_SESSION[namalengkap] = $r[nama_lengkap];
    $_SESSION[passuser] = $r[password];
    $_SESSION[leveluser] = $r[level];
    header('location:media.php?module=home');
} else {
    echo "<link href=../config/adminstyle.css rel=stylesheet type=text/css>";
    echo "<center>LOGIN GAGAL! <br> \n        Username atau Password Anda tidak benar.<br>\n        Atau account Anda sedang diblokir.<br>";
    echo "<a href=index.php><b>ULANGI LAGI</b></a></center>";
}
开发者ID:muhammadmizwar,项目名称:UAS,代码行数:30,代码来源:cek_login.php

示例9: antiinjection

<?php

require "../config/config.php";
require '../function/antiinjection.php';
if (isset($_POST['input'])) {
    $nama = antiinjection($_POST['nama']);
    $jabatan = antiinjection($_POST['jabatan']);
    $pesan = antiinjection($_POST['pesan']);
    if (isset($_FILES['foto'])) {
        $foto = "";
        $sumber = $_FILES['foto']['tmp_name'];
        $tujuan = "../../images/testimonial/" . $_FILES['foto']['name'];
        $tujuan1 = "/images/testimonial/" . $_FILES['foto']['name'];
        //////////////////////
        $foto = $_FILES['foto']['name'];
        //////////////////////
        move_uploaded_file($sumber, $tujuan);
        /////////////////////
    }
    $insertquery = "insert into t_testimoni (id_testimoni, foto, nama, jabatan, pesan, tgl) values ('','{$foto}','{$nama}','{$jabatan}','{$pesan}',now())";
    $sql = mysql_query($insertquery);
    if ($sql) {
        echo "\n\t\t\t\t<div class='alert alert-success'>                \n\t\t\t\t\t<strong>Success!</strong> Successfully Saved\n\t\t\t\t\t<button type='button' class='close' data-dismiss='alert'>&times;</button>\n\t\t\t\t</div>\n\t\t\t\t";
    } else {
        echo "\n\t\t\t\t<div class='alert alert-error'>                \n\t\t\t\t<strong>Error !</strong> Failed to Save\n\t\t\t\t<button type='button' class='close' data-dismiss='alert'>&times;</button>\n\t\t\t\t</div>\n\t\t\t\t";
    }
}
?>

    
    <script type='text/javascript' src='../assets/js/validationengine/languages/jquery.validationEngine-en.js'></script>
开发者ID:BayuWijayaPermanaPutra,项目名称:BDF,代码行数:31,代码来源:testimoni_tambah.php

示例10: antiinjection

	external_link_list_url : "lists/link_list.js",
	external_image_list_url : "lists/image_list.js",
	media_external_list_url : "lists/media_list.js",
	
	template_replace_values : {
		username : "Some User",
		staffid : "991234"
	}
	});
</script>
<?php 
require "../config/config.php";
require '../function/antiinjection.php';
if (isset($_POST['input'])) {
    $judul = antiinjection($_POST['judul']);
    $deskripsi = antiinjection($_POST['deskripsi']);
    if (isset($_FILES['foto'])) {
        $foto = "";
        $sumber = $_FILES['foto']['tmp_name'];
        $tujuan = "../../images/slider/" . $_FILES['foto']['name'];
        $tujuan1 = "/images/slider/" . $_FILES['foto']['name'];
        //////////////////////
        $foto = $_FILES['foto']['name'];
        //////////////////////
        move_uploaded_file($sumber, $tujuan);
        /////////////////////
    }
    $insertquery = "insert into t_slider (id_slider, foto, judul, deskripsi, tgl) values ('','{$foto}','{$judul}','{$deskripsi}',now())";
    $sql = mysql_query($insertquery);
    if ($sql) {
        echo "\n\t\t\t\t<div class='alert alert-success'>                \n\t\t\t\t\t<strong>Success!</strong> Successfully saved\n\t\t\t\t\t<button type='button' class='close' data-dismiss='alert'>&times;</button>\n\t\t\t\t</div>\n\t\t\t\t";
开发者ID:BayuWijayaPermanaPutra,项目名称:BDF,代码行数:31,代码来源:slide_tambah.php

示例11: antiinjection

<?php

include "../config/koneksi.php";
function antiinjection($data)
{
    $filter_sql = mysql_real_escape_string(stripslashes(strip_tags(htmlspecialchars($data, ENT_QUOTES))));
    return $filter_sql;
}
$username = antiinjection($_POST[username]);
$pass = antiinjection(md5($_POST[password]));
$login = mysql_query("SELECT * FROM admins WHERE username='{$username}' AND password='{$pass}' AND blokir='N'");
$ketemu = mysql_num_rows($login);
$r = mysql_fetch_array($login);
// Apabila username dan password ditemukan
if ($ketemu > 0) {
    session_start();
    session_register("namauser");
    session_register("namalengkap");
    session_register("passuser");
    session_register("leveluser");
    $_SESSION[namauser] = $r[username];
    $_SESSION[namalengkap] = $r[nama_lengkap];
    $_SESSION[passuser] = $r[password];
    $_SESSION[leveluser] = $r[level];
    header('location:media.php?module=home');
} else {
    echo "<link href=../config/adminstyle.css rel=stylesheet type=text/css>";
    echo "<center>LOGIN GAGAL! <br> \n        Username atau Password Anda tidak benar.<br>\n        Atau account Anda sedang diblokir.<br>";
    echo "<a href=index.php><b>ULANGI LAGI</b></a></center>";
}
开发者ID:brianesa,项目名称:projek,代码行数:30,代码来源:cek_login.php

示例12: antiinjection

		username : "Some User",
		staffid : "991234"
	}
	});
</script>
<?php 
require "../config/config.php";
require '../function/antiinjection.php';
if (isset($_POST['input'])) {
    $nama = antiinjection($_POST['nama']);
    $jabatan = antiinjection($_POST['jabatan']);
    $deskripsi = antiinjection($_POST['deskripsi']);
    $fb = antiinjection($_POST['fb']);
    $twitter = antiinjection($_POST['twitter']);
    $google = antiinjection($_POST['google']);
    $link_in = antiinjection($_POST['link_in']);
    if (isset($_FILES['foto'])) {
        $foto = "";
        $sumber = $_FILES['foto']['tmp_name'];
        $tujuan = "../../images/team/" . $_FILES['foto']['name'];
        $tujuan1 = "/images/team/" . $_FILES['foto']['name'];
        //////////////////////
        $foto = $_FILES['foto']['name'];
        //////////////////////
        move_uploaded_file($sumber, $tujuan);
        /////////////////////
    }
    $insertquery = "insert into t_team (id_team, nama, jabatan, foto, deskripsi, fb, twitter, google, link_in, tgl) values ('','{$nama}','{$jabatan}','{$foto}','{$deskripsi}','{$fb}','{$twitter}','{$google}','{$link_in}',now())";
    $sql = mysql_query($insertquery);
    if ($sql) {
        echo "\n\t\t\t\t<div class='alert alert-success'>                \n\t\t\t\t\t<strong>Success!</strong>Successfully Saved\n\t\t\t\t\t<button type='button' class='close' data-dismiss='alert'>&times;</button>\n\t\t\t\t</div>\n\t\t\t\t";
开发者ID:BayuWijayaPermanaPutra,项目名称:BDF,代码行数:31,代码来源:team_tambah.php

示例13: antiinjection

<?php

include 'inc/koneksi.php';
function antiinjection($data)
{
    $filter_sql = mysql_real_escape_string(stripslashes(strip_tags(htmlspecialchars($data, ENT_QUOTES))));
    return $filter_sql;
}
session_start();
//tangkap data dari form login
$username = $_POST['username'];
$password = md5($_POST['password']);
//untuk mencegah sql injection
$username = antiinjection($username);
$password = antiinjection($password);
$loginadmin = mysql_query("select * from admin where username='{$username}' and password='{$password}'");
$q = mysql_fetch_array($loginadmin);
if (mysql_num_rows($loginadmin) == 1) {
    //kalau user dan password sudah terdaftar di database
    //buat session dengan username dengan isi nama user yang login
    $_SESSION['username'] = $q['username'];
    $_SESSION['password'] = $q['password'];
    $_SESSION['nama'] = $q['nama'];
    //redirect ke halaman index
    header('location:admin/index.php');
} else {
    //kalau username ataupun password tidak terdaftar di database
    header('location:index.php?error=4');
}
开发者ID:eR1an9,项目名称:SPK-SAW-Beasiswa,代码行数:29,代码来源:otentikasi.php

示例14: mysql_query

        $sql = mysql_query("SELECT * FROM orders_temp WHERE id_session='{$sid}'");
        while ($r = mysql_fetch_array($sql)) {
            $isikeranjang[] = $r;
        }
        return $isikeranjang;
    }
    $tgl_skrg = date("Ymd");
    $jam_skrg = date("H:i:s");
    if (!empty($_POST['kode'])) {
        if ($_POST['kode'] == $_SESSION['captcha_session']) {
            function antiinjection($data)
            {
                $filter_sql = mysql_real_escape_string(stripslashes(strip_tags(htmlspecialchars($data, ENT_QUOTES))));
                return $filter_sql;
            }
            $nama = antiinjection($_POST['nama']);
            $alamat = antiinjection($_POST['alamat']);
            $telpon = antiinjection($_POST['telpon']);
            $email = antiinjection($_POST['email']);
            $password = md5($_POST['password']);
            // simpan data kustomer
            mysql_query("INSERT INTO kustomer(nama_lengkap, password, alamat, telpon, email, id_kota) \n             VALUES('{$nama}','{$password}','{$alamat}','{$telpon}','{$email}','{$_POST['kota']}')");
            echo "<script>window.alert('Pendaftaran Berhasil, Klok OK untuk melanjtkan')</script>";
            echo "<meta http-equiv='refresh' content='0; url=index.php?hal=daftar'>";
        }
    }
}
?>

</body>
</html>
开发者ID:dvgjoshua,项目名称:scrapparel,代码行数:31,代码来源:simpanuser.php

示例15: protect

function protect($vA)
{
    $v = antiinjection($vA);
    $v = mysql_real_escape_string($v);
    $v = htmlentities($v, ENT_QUOTES);
    $v = trim($v);
    return $v;
}
开发者ID:dice9030,项目名称:GestionLogistico,代码行数:8,代码来源:funciones.php


注:本文中的antiinjection函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。