Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('appvars.php');
- require_once('connectvarsT.php');
- if(isset($_POST['submit'])) {
- // Grab the score data from the POST
- $image= $_FILES['image']['name'];
- $image_type= $_FILES['image']['type'];
- $image_size= $_FILES['image']['size'];
- $prefix= $_POST['prefix'];
- $lname= $_POST['lname'];
- $info= $_POST['info'];
- $fname= $_POST['fname'];
- $suffix=$_POST['suffix'];
- $mname=$_POST['mname'];
- $email=$_POST['email'];
- $iid=$_POST['iid'];
- $eid=$_POST['eid'];
- if(!empty($fname) && !empty($lname) && !empty($email)) {
- if((($image_type == 'image/jpeg') || ($image_type =='image/pjpeg') || ($image_type == 'image/png'))
- && ($image_size > 0) && ($image_size <= GW_MAXFILESIZE)){
- if ($_FILES['image']['error'] == 0) {
- //Move the file to the target upload folder
- $target = GW_UPLOADPATH . $image;
- if(move_uploaded_file($_FILES['image']['tmp_name'], $target)) {
- // Connect to the database
- $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
- //Write the data to the database
- $query = "INSERT INTO login VALUES ('$image', '$prefix', '$lname', '$info', '$fname', '$suffix', '$mname', '$email', '$iid', '$eid')";
- mysqli_query($dbc, $query);
- // Clear the score data to clear the form
- $image="";
- $prefix="";
- $lname="";
- $info="";
- $fname="";
- $suffix="";
- $mname="";
- $email="";
- $iid="";
- $eid="";
- mysqli_close($dbc);
- }
- else {
- echo '<p class="error">Sorry, there was a problem uploading your image.</p>';
- }
- }
- }
- else {
- echo '<p class="error">The screen shot must be a JPEG, or PNG image file.</p>';
- }
- }
- else {
- echo '<p class="error">Please enter all of the information.</p>';
- }
- }
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>Bootstrap Example</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
- <link rel="stylesheet" type="text/css" href="Tripnologies.css">
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
- <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
- </head>
- <body>
- <form enctype="multipart/form-data" method="post" action="<?PHP echo $_SERVER['PHP_SELF']; ?>" >
- <input type="hidden" name="MAX_FILE_SIZE" value="32768" />
- <div class="container">
- <table class="table">
- <tr>
- <td>
- <p class="text-primary">Remove</p>
- </td>
- <td>
- <label class="btn btn-default btn-file">
- Choose File <input type="file" name="image" style="display: none;">
- </label><br />
- <small>image size(130x130)... jpg or png only.</small></h4>
- </td>
- <td>
- <button type="submit" class="btn btn-primary btn-lg" name="submit">Save Changes</button>
- </td>
- </tr>
- <tr>
- <td>
- <div class="form-group">
- <label class="col-xs-3 control label">Prefix:</label><br />
- <div class="col-xs-5 selectContainer">
- <select name="prefix" class="form-control">
- <option value="Mr">Mr</option>
- <option value="Miss">Miss</option>
- <option value="Ms">Ms</option>
- </select>
- </div>
- </div>
- </div>
- </td>
- <td>
- <div class="form-group">
- <label for="lname">Last Name:</label>
- <input type="text" class="form-control" id="lname" name="lname">
- </div>
- </td>
- <td>
- <div class="form-group">
- <label for="info">Information:</label>
- <textarea class="form-control" rows="4" id="info" name="info"></textarea>
- </div>
- </td>
- </tr>
- <tr>
- <td>
- <label for="fname">First Name:</label>
- <input type="text" class="form-control" id="fname" name="fname">
- </td>
- <td>
- <label for="suffix">Suffix:</label>
- <input type="text" class="form-control" id="suffix" name="suffix">
- </td>
- </tr>
- <tr>
- <td>
- <label for="mname">Middle Name:</label>
- <input type="text" class="form-control" id="mname" name="mname">
- </td>
- <td>
- <label for="lg">Login Email:</label>
- <input type="text" class="form-control" id="email" name="email">
- </td>
- </tr>
- <tr>
- <td>
- <label for="id">ID:</label>
- <input type="text" class="form-control" id="id" name="id" disabled>
- </td>
- <td>
- <label for="ii">Internal ID:</label>
- <input type="text" class="form-control" id="ii" name="iid">
- </td>
- <td>
- <label for="ei">External ID:</label>
- <input type="text" class="form-control" id="ei" name="eid">
- </td>
- </tr>
- </table>
- </div>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement