Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(!empty($_POST)){
- if(isset($_POST["username"]) && isset($_POST["password"])) {
- if($_POST["username"] != "" && $_POST["password"] != "") {
- include "conexion.php";
- $user_id = null;
- $sql1= "select * from user where (username=\"$_POST[username]\" or email=\"$_POST[username]\") and password=\"$_POST[password]\" ";
- $query = $con->query($sql1);
- while ($r=$query->fetch_array()) {
- $user_id=$r["id"];
- break;
- }
- if($user_id==null){
- print "<script>alert(\"Acceso invalido.\");window.location='../login.php';</script>";
- }
- else {
- session_start();
- $_SESSION["user_id"] = $user_id;
- $_SESSION["user_name"] = $_POST["username"]
- $_SESSION["user_pass"] = $_POST["password"]
- $_SESSION["user_join"] = $_POST["created_at"]
- print "<script>window.location='../home.php';</script>";
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement