Exemple #1
0
 $target = GW_UPLOADPATH . $photo;
 move_uploaded_file($_FILES['photo']['tmp_name'], $target);
 $query = "SELECT * FROM allusers WHERE email = '{$email}'";
 $data = mysqli_query($dbc, $query);
 if (mysqli_num_rows($data) == 0) {
     // The username is unique, so insert the data into the database
     $query = "INSERT INTO allusers (firstname, lastname, email, password, phone, photo, category) VALUES ('{$firstname}', '{$lastname}', '{$email}', SHA('{$password1}'), '{$phone}', '{$photo}', '{$category}')";
     mysqli_query($dbc, $query);
     //echo "Query: ".$query;
     $query2 = "Select photo from allusers where email = '{$email}'";
     $photoResult = mysqli_query($dbc, $query2);
     $photoRow = mysqli_fetch_array($photoResult);
     //Registration confirmation email
     $subject = "Registration confirmation-ClickArt";
     $message = "Dear " . $firstname . ",<br/><br/>Welcome to the world of art.<br/><br/><u><b>Below are \n        your registration information:</b></u><br/><br/>Email: " . $email . "<br/>Password: "******"<br/>Phone: " . $phone . "<br/>\n        Category: " . $category . "<br/><br/><h4>Enjoy our services.</h4><br/><br/>\n        <p>Copyright &copy;2015 IT354 Project.";
     $emailStatus = $ooClass->sendEmail($email, $subject, $message, $firstname);
     mysqli_close($dbc);
     //Confirm success with the user
     // $home_url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/registrationSuccess2.php';
     // header('Location: ' . $home_url);
     // require_once('registrationSuccess.php');
     $_SESSION['email'] = $email;
     ?>
 <script>
   window.location.assign("./registrationSuccess.php");
 </script>
 <?php 
     exit;
 } else {
     // An account already exists for this username, so display an error message
     echo '<p class="error">An account already exists for this username. Please use a different address.</p>';
Exemple #2
0
     // if (mysqli_num_rows($data) == 0) {
     // The username is unique, so insert the data into the database
     $query = "INSERT INTO paintings (paintingname, paintingtype, painter, publisher, category, price, availability, photo) VALUES ('{$paintingname}', '{$paintingtype}', '{$painter}', '{$publisher}', '{$category}', '{$price}', '{$availability}', '{$photo}')";
     mysqli_query($dbc, $query);
     //echo "Query: ".$query;
     $tempEmail = $_SESSION['email'];
     $query2 = "Select * from allusers where email = '{$tempEmail}'";
     $query2Result = mysqli_query($dbc, $query2);
     $row2 = mysqli_fetch_array($query2Result);
     //Registration confirmation email
     $subject = "Publication confirmation-ClickArt";
     $message = "Dear " . $row2['firstname'] . ",<br/><br/>Welcome to the world of art.<br/><br/><u><b>Your painting has been published for sale on ClickArt.</b></u><br/>\n        <br/>Thanks for your using our services.<br/>\n        <p>Copyright &copy;2015 IT354 Project.";
     // echo '<script language="javascript">';
     // echo 'alert("s1")';
     // echo '</script>';
     $emailStatus = $ooClass->sendEmail($tempEmail, $subject, $message, $row2['firstname']);
     mysqli_close($dbc);
     // Confirm success with the user
     $home_url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/artistSuccess.php';
     header('Location: ' . $home_url);
     //echo "tempEmail ".$tempEmail;
     exit;
     // }
     //else {
     // An account already exists for this username, so display an error message
     echo '<p class="error">Some error found.</p>';
     //$username = "";
     //}
 } else {
     echo '<p class="error">You must enter all of the data</p>';
 }