Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!isset($_SESSION))
- {
- session_start();
- }
- ?>
- <?php require_once('../Connections/uploader.php'); ?>
- <?
- function loginFormErrorsCheck ($loginUsername, $loginPassword) {
- if (empty($loginUsername) || empty($loginPassword)) {
- return true;
- } else {
- return false;
- }
- }
- ?>
- <?php
- if (isset($_POST['login'])) {
- $loginUsername = $_POST['uname'];
- $loginPassword = $_POST['pword'];
- $errors = loginFormErrorsCheck ($loginUsername, $loginPassword);
- if (!$errors) {
- mysql_select_db($database_uploader, $uploader);
- $query = "SELECT * FROM members WHERE uname='"
- . mysql_real_escape_string($loginUsername) . "' AND pword='"
- . mysql_real_escape_string($loginPassword) . "'";
- $result = mysql_query($query) or die(mysql_error());
- // make sure the username and password were found
- if (mysql_num_rows($result) > 0) {
- $row = mysql_fetch_array($result) or die(mysql_error());
- if ($loginUsername == "admin") { // Admin Login
- mysql_close($result);
- $_SESSION['admin'] = "Admin.";
- header('Location: admin.php');
- exit;
- }
- if ($row['acntStatus'] == 0) { // If account is OK
- mysql_close($result);
- }
- else // If account is in bad standing
- {
- $errors[0]="Your account has been temporarily/permanently disabled, or terminated. Please contact us for more details.";
- }
- if ($row['activated'] == 1) {
- }
- else {$errors[1] = "Your account is not yet activated.";}
- if ($row['activated'] == 1 && $row['acntStatus'] == 0)
- {
- mysql_close($result);
- $_SESSION[$user] = $loginUsername;
- header('Location: users/' . $row['uname'] . '/index.php');
- exit;
- }
- }
- }
- }
- ?>
- <?
- if (isset($_POST['register'])) {
- if (empty($name)) {
- $name_error = 'Flagged';
- $errors=1;
- }
- if (empty($new_username)) {
- $newusername_error = 'Flagged';
- $errors=1;
- }
- if (empty($new_password)) {
- $newpassword_error = 'Flagged';
- $errors=1;
- }
- $pattern = '/^[^@]+@[^\s\r\n\'";,@%]+$/';
- if (!preg_match($pattern, trim($new_email)) || empty($new_email))
- {
- $newemail_error = 'Flagged';
- $errors =1;
- }
- if (($spamcheck != 7) || empty($spamcheck)) {
- $errors=1;
- $spamcheck_error = 'Flagged';
- }
- if (file_exists($new_username))
- {
- $errors = 1;
- echo "<span class='error'>We are sorry, but the username, $new_username, is already taken.</span>";
- }
- if (!file_exists($new_username) && !(empty($new_username)) && ($errors != 1)) // if the user is not registered....
- {
- echo "Please wait while we process your request and setup your user account...";
- $_SESSION['username'] = $new_username;
- mkdir('users/'.$new_username); // creates the user's profile
- /*if (isset($remember)) {
- $_COOKIE['username'] = $_POST['new_username'];
- $_COOKIE['password'] = $_POST['new_password']; }*/
- /* Accessing SQL-Server and querying table */
- mysql_query(sprintf("INSERT INTO members(name, uname, pword, email, activated) VALUES('%s','%s','%s','%s','%s')",mysql_real_escape_string($name),mysql_real_escape_string($new_username),mysql_real_escape_string($new_password),mysql_real_escape_string($new_email), mysql_real_escape_string($acntactivation)))
- // ERROR MESSAGE??
- or die(mysql_error());
- mysql_close($con);
- $file2 = 'myaccount.php';
- $newfile2 = 'users/'.$new_username.'/myaccount.php';
- if (!copy($file2, $newfile2)) // Optional
- {
- echo "<br>Failed to copy $file2 to the location, $newfile2.";
- }
- $file3 = 'upgrade.php';
- $newfile3 = 'users/'.$new_username.'/upgrade.php';
- if (!copy($file3, $newfile3)) // Optional
- {
- echo "<br>Failed to copy $file3 to the location, $newfile3.";
- }
- // copy all files to user's folder
- $file = 'index.php';
- $newfile = 'users/'.$new_username.'/index.php';
- if (!copy($file, $newfile)) // Optional
- {
- echo "<br>Failed to copy $file to the location, $newfile.";
- }
- else
- {
- echo '<br>Your account has been successfully created. It may take up to two weeks to activate your account. We will e-mail you at the e-mail address you specified when your account is fully activated.';
- // USE THIS WHEN SERVICE IS READY - echo '<br><a href="/VBS/' . $new_username . '/index.php">Your account has been successfully created. It may take up to two weeks to activate your account. We will e-mail you at the e-mail address you specified when you may start using your account.</a>';
- }
- }
- }
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Member's Area</title>
- <style type="text/css">
- .required { color:#F00;
- }
- body {
- background-color: #FC9;
- }
- .errors {
- color:#F00;
- font-weight:bold;
- }
- </style>
- </head>
- <body>
- <h1 align="center"><img src="../Images/user_logout.gif" width="40" height="40" /> Member's Area</h1>
- <p align="center">To access this restricted access area, please login if you are an existing member, or register.</p>
- <?php
- if (isset($errors) && !empty($errors)) {
- for ($i=0; $i<2; $i++) {
- echo "<p class='errors'>$errors[$i]<br></p>";
- }
- }
- ?>
- <table width="50%" border="1" align="center">
- <tr>
- <td><form action="" method="post" id="login" name="login" >
- <table border="1" align="center">
- <tr>
- <td colspan="2"><h3>Login</h3>
- <p>Please enter a username to continue being uploading your files:</p></td>
- </tr>
- <tr>
- <td>Username: </td>
- <td><input type="text" name="uname" id="uname" value="<? if (isset($errors)) {echo $_POST['uname'];} ?>" /></td>
- </tr>
- <tr>
- <td>Password: </td>
- <td><input name='pword' type='password' value="<? if (isset($errors)) {echo $_POST['pword'];} ?>" /></td>
- </tr>
- <tr>
- <td colspan="2">By clicking "Submit", you have read agreed to the <a href="#">Terms and Conditions</a>. </td>
- </tr>
- <tr>
- <td> </td>
- <td><input type="submit" name="login" id="login" value="Submit" /></td>
- </tr>
- </table>
- </form></td>
- <td><strong><span style="padding:15px;">OR</span></strong></td>
- <td><form id="register" name="register" method="post" action=""><table border="0" align="center">
- <tr>
- <td colspan="2"><h3>Register</h3>
- <p>If you are not yet a member of this site, you must register to be able to use our services. Please fill out the following fields:</p></td>
- </tr>
- <tr>
- <td align="right"><span class="required">*</span>Name:</td>
- <td><input type="text" name="name" id="name" value="<? if (isset($errors)) {echo $_POST['name']; } ?>" /></td>
- </tr>
- <tr>
- <td align="right"><label for="new_username"><span class="required">*</span>Username:</label></td>
- <td><input type="text" name="new_username" id="new_username" value="<? if (isset($errors)) {echo $_POST['new_username']; } ?>" /></td>
- </tr>
- <tr>
- <td align="right"><span class="required">*</span>Password:</td>
- <td><input type="password" name="new_password" id="new_password" value="<? if (isset($errors)) {echo $_POST['new_password']; } ?>" /></td>
- </tr>
- <tr>
- <td align="right"><span class="required">*</span>E-mail Address: </td>
- <td><input type="text" name="new_email" id="new_email" value="<? if (isset($errors)) {echo $_POST['new_email']; } ?>" /></td>
- </tr>
- <tr>
- <td> </td>
- <td><span style="color:#999; font-size:12px;">*Please not that a max of 500mb is supported at this time.</span></td>
- </tr>
- <tr>
- <td align="right">Remember me?:</td>
- <td><input name="remember" type="checkbox" value="remember" disabled="disabled" /></td>
- </tr>
- <tr>
- <td align="right"><span class="required">*</span>Human Verification - What is 5 + 2?: </td>
- <td><input type="text" name="spamcheck" id="spamcheck" value="<? if (isset($errors)) {echo $_POST['spamcheck']; } ?>" /></td>
- </tr>
- <tr>
- <td colspan="2">By clicking "Submit", you have read agreed to the <a href="#">Terms and Conditions</a>. </td>
- </tr>
- <tr>
- <td> </td>
- <td><input type="submit" name="register" id="register" value="Submit" /></td>
- </tr>
- </table>
- </form></td>
- </tr>
- <tr>
- <td colspan="3" align="right";> v. 1.0 </td>
- </tr>
- </table>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement