Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include("connectbd.php");
- $_SESSION["login"];
- $_SESSION["password"];
- $login=$_POST["login"];
- $password=$_POST["password"];
- $email=$_POST["email"];
- $aselect="SELECT * FROM User WHERE ('login'='$login' AND 'password'='$password')";
- $aresult=mysqli_query($connect, $aselect)or die(mysqli_error($connect));
- function ver(){
- if(empty($_SESSION["login"]&&$_SESSION["password"])){
- authoriz();
- reg();
- echo"<form name=\"aitorization\" action=\"#\" method=\"POST\">".
- "<input type=\"text\" name=\"login\">".
- "<input type=\"password\" name=\"password\">".
- "<input type=\"submit\" name=\"in\" value=\"Вход\">".
- "<input type=\"submit\" name=\"reg\" value=\"Регистрация\">".
- "</form>";
- }else{
- echo $_SESSION["login"];
- out();
- echo"<form name=\"out\" action=\"#\" method=\"POST\">"."<input type=\"submit\" name=\"out\" value=\"выход\">"."</form>";
- }
- }
- function authoriz(){
- if(isset($_POST["in"])){
- if(!empty($_POST['login']&&$_POST['password'])){
- var_dump($_POST);
- if(mysqli_num_rows($aresult)==1){
- $_SESSION["login"]=$_POST["login"] ;
- $_SESSION["password"]=$_POST["password"];
- echo"hh";
- }
- }
- }
- }
- function reg(){
- if($_POST["reg"]){
- header("Location:../reg.php");
- }
- }
- function out(){
- if($_POST["out"]){
- session_unset();
- }
- }
- ver();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement