Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'home.php';
- // session_start();
- require_once 'class.user.php';
- $user_home = new USER();
- if(!$user_home->is_logged_in())
- {
- header("Location: index.php");
- die();
- }
- ?>
- <?php
- if (isset($_POST['submit'])) {
- // new data
- $uname = $_POST['txtuname'];
- $email = $_POST['txtemail'];
- $phone = $_POST['phone'];
- $street_address = $_POST['street_address'];
- $street_address_2 = trim($_POST['street_address_2']);
- $city = trim($_POST['city']);
- $state = trim($_POST['state']);
- $zip_code = trim($_POST['zip_code']);
- $country = trim($_POST['country']);
- $sold_by = trim($_POST['sold_by']);
- $portfolio = trim($_POST['portfolio']);
- $paypal_email_id = trim($_POST['paypal_email_id']);
- $account_holder_name = trim($_POST['account_holder_name']);
- $account_number = trim($_POST['account_number']);
- $branch_name = trim($_POST['branch_name']);
- $bank_name = trim($_POST['bank_name']);
- $ifsc_code = trim($_POST['ifsc_code']);
- $tax = trim($_POST['tax']);
- $photo = trim($_POST['photo']);
- // $uid = (isset($_GET['userID']) ? intval($_GET['userID']) : -1);
- $uid = (isset($_SESSION['userSession']) ? intval($_SESSION['userSession']) : 0);
- // query
- if ($uid > 0 && $user_home->update($uname,$email, $phone, $street_address, $street_address_2 , $city , $state , $zip_code , $country, $sold_by,
- $portfolio , $paypal_email_id, $account_holder_name, $account_number , $branch_name , $bank_name , $ifsc_code, $tax , $uid))
- {
- //uploadUserPhoto($uid);
- $user_home->uploadUserPhoto($uid);
- header("Location: profile1.php");
- die();
- }
- }
- $stmt = $user_home->runQuery("SELECT * FROM tbl_users WHERE userID=:uid");
- $stmt->execute(array(":uid"=>$_SESSION['userSession']));
- $row = $stmt->fetch(PDO::FETCH_ASSOC);
- /* php codde end*/
- ?>
- <!DOCTYPE html>
- <html class="no-js">
- <h4> Welcome to profile page</h4>
- <head>
- <title><?php echo $row['userEmail']; ?></title>
- <a href="user.php?<?php print($userRow['user_name']); ?>"></a> <title><?php echo $row['userEmail']; ?></title>
- <!-- Bootstrap -->
- <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
- <link href="bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
- <link href="assets/styles.css" rel="stylesheet" media="screen">
- <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
- <!--[if lt IE 9]>
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
- <![endif]-->
- <form action="profile1.php" method="POST">
- <h3>Personal details</h3>
- Name :
- <?php echo $row['userName'] ?> <br/>
- Email :
- <?php echo $row['userEmail'] ?> <br>
- Sold by :
- <?php echo $row['sold_by'] ?> <br/>
- Portfolio :
- <?php echo $row['portfolio'] ?> <br/>
- photo :
- <img src="upload/<?php echo $row['userID'] ?>/<?php echo $row['photo'] ?>"/><br>
- </form>
- <a href="profile1.php"><button class = "pedit" name="submit">Edit</button></a>
- <form action="profile1.php" method="POST">
- <h3>ADDRESS</h3>
- Phone :
- <?php echo $row['phone'] ?> <br>
- street address :
- <?php echo $row['street_address'] ?> <br>
- street address 2 :
- <?php echo $row['street_address_2'] ?> <br>
- city :
- <?php echo $row['city'] ?> <br>
- state :
- <?php echo $row['state'] ?> <br>
- country :
- <?php echo $row['country'] ?> <br>
- zip :
- <?php echo $row['zip_code'] ?> <br>
- </form>
- <a href="profile1.php"><button class = "pedit" name="submit">Edit</button></a>
- <form action="profile1.php" method="POST">
- <h3>Payment details</h3>
- Paypal email id :
- <?php echo $row['paypal_email_id'] ?> <br/>
- <h4>Wiretransfer </h4>
- account holder name :
- <?php echo $row['account_holder_name'] ?> <br/>
- account number :
- <?php echo $row['account_number'] ?> <br/>
- branch name :
- <?php echo $row['branch_name'] ?> <br/>
- bank name :
- <?php echo $row['bank_name'] ?> <br/>
- ifsc code :
- <?php echo $row['ifsc_code'] ?> <br/>
- </form>
- <a href="profile1.php"><button class = "pedit" name="submit">Edit</button></a>
- <form action="profile1.php" method="POST">
- <h3>Other information</h3>
- Tax id scan copy :
- <?php echo $row['tax'] ?> <br/>
- photo :
- <?php echo $row['photo'] ?> <br/>
- <input id="sub" type="submit" name="submit" value="Save" style="display:none" />
- </form>
- <a href="profile1.php"><button class = "pedit" name="submit">Edit</button></a>
- </html>
- <?php
- if(isset($_FILES["photo"]["error"])){
- if($_FILES["photo"]["error"] > 0){
- echo "Error: " . $_FILES["photo"]["error"] . "<br>";
- } else{
- $allowed = array("jpg" => "image/jpg", "jpeg" => "image/jpeg", "gif" => "image/gif", "png" => "image/png");
- $filename = $_FILES["photo"]["name"];
- $filetype = $_FILES["photo"]["type"];
- $filesize = $_FILES["photo"]["size"];
- // Verify file extension
- $ext = pathinfo($filename, PATHINFO_EXTENSION);
- if(!array_key_exists($ext, $allowed)) die("Error: Please select a valid file format.");
- // Verify file size - 5MB maximum
- $maxsize = 5 * 1024 * 1024;
- if($filesize > $maxsize) die("Error: File size is larger than the allowed limit.");
- // Verify MYME type of the file
- if(in_array($filetype, $allowed)){
- // Check whether file exists before uploading it
- if(file_exists("upload/" . $_FILES["photo"]["name"])){
- echo $_FILES["photo"]["name"] . " is already exists.";
- } else{
- move_uploaded_file($_FILES["photo"]["tmp_name"], "upload/" . $_FILES["photo"]["name"]);
- echo "Your file was uploaded successfully.";
- }
- } else{
- echo "Error: There was a problem uploading your file - please try again.";
- }
- }
- } else{
- echo "";
- }
- ?>
- <style>
- .pedit
- {
- color: blue;
- }
- </style>
Add Comment
Please, Sign In to add comment