Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(!isset($_POST['uname']) || !isset($_POST['pass'])){}
- if($_POST["uname"] == "" || $_POST["pass"] == ""){
- echo "<h1>You must require a username or password!</h1>";
- echo "<h2><a href='/Access'>Go Back</a></h2>";
- }
- $ourFileName = "Users/" . $_POST['uname'] ."_pass.txt";
- $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
- fclose($ourFileHandle); $fopen = fopen($ourFileName, 'a');
- fwrite($fopen, $_POST['pass']);
- fclose($fopen);
- if(!isset($_POST['uname']) || !isset($_POST['pass'])){
- echo "You must fill all required areas.<a href='/Access'>Go Back</a>";
- }
- $myfile = "Users/" . $_POST['uname'] ."_pass.txt";
- $username = $_POST['uname'];
- $postpass = $_POST['pass']; //Above just helps tidy up
- $exists = file_exists($myfile);
- if($exists){ $file = $myfile;
- $fh = fopen($file, 'r');
- $pass = fread($fh, filesize($file));
- fclose($fh); //Above checks if exists and sets pass as the real password
- }
- if(($exists) and ($pass == $postpass)){
- //Above checks if the real pass is equal to the entered pass
- setcookie("Username",$username,time()+86400, "/");
- //Username
- setcookie("Password",$pass,time()+86400, "/");
- //Password
- //Cookies That Expire Within A Day For Profile Reasons
- ?>
- <script>
- window.location.assign("done.php");
- </script>
- <?php
- }else{
- print "Username or password was incorrect.<a href='/Access'>Go Back</a>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement