Advertisement
Guest User

Untitled

a guest
Jul 12th, 2016
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. <?php
  2.  
  3. if ($_SESSION['userid'] == '') {
  4. redirect('404.php', '0');
  5. }
  6.  
  7. $user = $_SESSION['userid'];
  8. $select_user = mysql_query("SELECT * FROM cover_user WHERE user_id = '$user' ");
  9. $update_user = mysql_fetch_assoc($select_user);
  10.  
  11. $user_email = $update_user['user_email'];
  12. $user_firma = $update_user['user_firma'];
  13. $user_link = $update_user['user_link'];
  14. $user_about = $update_user['user_about'];
  15.  
  16. $smarty->assign('UserEmail', $user_email);
  17. $smarty->assign('UserFirma', $user_firma);
  18. $smarty->assign('UserLink', $user_link);
  19. $smarty->assign('UserAbout', $user_about);
  20.  
  21. if ( isset($_POST['update']) ) {
  22. $email = $_POST['email'];
  23. $firma = $_POST['firma'];
  24. $link = $_POST['link'];
  25. $about = $_POST['about'];
  26. $password = $_POST['password'];
  27. $user = $_SESSION['userid'];
  28.  
  29.  
  30. $select_user = mysql_query("SELECT * FROM cover_user WHERE user_id = '$user' ");
  31. $update_user = mysql_fetch_assoc($select_user);
  32.  
  33. $user_email = $update_user['user_email'];
  34. $user_firma = $update_user['user_firma'];
  35. $user_link = $update_user['user_link'];
  36. $user_about = $update_user['user_about'];
  37. $user_picture = $update_user['user_picture'];
  38. $user_password= $update_user['user_password'];
  39.  
  40. if($email == ''){
  41. $post_error = '<div class="alert alert-danger"><h3>Please Enter Email Address</h3></div>';
  42. }else{
  43. $user_email = $email;
  44. }
  45. if ($password == '') {
  46. $user_password = $user_password;
  47. }else{
  48. $user_password = $password;
  49. }
  50. if ($firma == '') {
  51. $user_firma = $user_firma;
  52. }else{
  53. $user_firma = $firma;
  54. }
  55. if ($link == '') {
  56. $user_link = $user_link;
  57. }else{
  58. $user_link = $link;
  59. }
  60. if ($about == '') {
  61. $user_about = $user_about;
  62. }else{
  63. $user_about = $about;
  64. }
  65. if ($_FILES['photo']['size'] == '0') {
  66. $user_picture = $user_picture;
  67. }else{
  68. list($file,$error) = upload('photo','images/users/','jpg,jpeg,gif,png');
  69. $user_picture = $file;
  70. $post_error = $error;
  71. $user_picture = 'images/users/'.$file;
  72. }
  73.  
  74.  
  75.  
  76. if ($post_error == '') {
  77.  
  78.  
  79. $insert = mysql_query("UPDATE cover_user SET
  80. user_id = '$user',
  81.  
  82. user_email='$user_email',
  83. user_password='$user_password',
  84. user_firma='$user_firma',
  85. user_link='$user_link',
  86. user_about='$user_about',
  87. user_picture = '$user_picture' ");
  88.  
  89. //redirect('edit.php', '2');
  90.  
  91. $post_error = '<div class="alert alert-success"><h3>Your Profile Updates Success</h3></div>';
  92. }else{
  93. $post_error = '<div class="alert alert-danger"><h3>'.$error.'</h3></div>';
  94. }
  95.  
  96. $smarty->assign('EditResult', $post_error);
  97.  
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement