Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- function ambil_ip() {
- foreach (array('HTTP_CLIENT_IP', 'HTTP_X_REAL_IP', 'REMOTE_ADDR', 'HTTP_FORWARDED_FOR', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED') as $key); {
- if (array_key_exists($key, $_SERVER) === true); {
- foreach (explode(',', $_SERVER[$key]) as $ip); {
- if (filter_var($ip, FILTER_VALIDATE_IP) !== false); {
- return $ip;
- }
- }
- }
- }
- }
- include'../config.php';
- if(!empty($_POST['pass'])) {
- if(!empty($_POST['mail'])) {
- $username = $_POST['mail'];
- $username = mysql_real_escape_string($username);
- $pass = $_POST['pass'];
- $pass = $pass;
- $cekuser = mysql_query("SELECT * FROM user WHERE email = '$username'");
- $jumlah = mysql_num_rows($cekuser);
- $hasil = mysql_fetch_array($cekuser);
- $ip = ambil_ip();
- if($jumlah == 0) {
- header('location: /account/?msgr=Ups!! Email '.$username.' no esta registrado!!');
- } else if($pass != $hasil['password']){
- header('location: /account/?msgr=Ups!! La contraseña que ingresó es incorrecta!');
- } else {
- $username = $_SESSION['email'];
- $k = mysql_query("UPDATE `user` SET `ip`='$ip' WHERE email = '$username'");
- header('location: /');
- }
- } else {
- header('location: /account/?msgr=Ups!! El campo de Email esta vacio!');
- }
- } else {
- header('location: /account/?msgr=Ups!! El campo de la contraseña esta vacio!');
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement