Guest User

Untitled

a guest
Sep 8th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. <?php
  2. $host="localhost";
  3. $username="mrephex_song";
  4. $password="test010203";
  5. $db_name="mrephex_songsheet";
  6. $tbl_name="members";
  7. mysql_connect("localhost", "mrephex_song", "test010203")or die("cannot connect");
  8. mysql_select_db("mrephex_songsheet")or die("cannot select DB");
  9.  
  10. define('DB_HOST', 'localhost');
  11. define('DB_USER', 'mrephex_song');
  12. define('DB_PASSWORD', 'test010203');
  13. define('DB_DATABASE', 'mrephex_songsheet');
  14.  
  15.  
  16. $id=$_GET['id'];
  17. $errmsg_arr = array();
  18.  
  19. $errflag = false;
  20.  
  21.  
  22. $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
  23. if(!$link) {
  24. die('Failed to connect to server: ' . mysql_error());
  25. }
  26.  
  27.  
  28. $db = mysql_select_db(DB_DATABASE);
  29. if(!$db) {
  30. die("Unable to select database");
  31. }
  32.  
  33.  
  34. function clean($str) {
  35. $str = @trim($str);
  36. if(get_magic_quotes_gpc()) {
  37. $str = stripslashes($str);
  38. }
  39. return mysql_real_escape_string($str);
  40. }
  41.  
  42.  
  43. $password = clean($_POST['password']);
  44. $cpassword = clean($_POST['cpassword']);
  45.  
  46. if( strcmp($password, $cpassword) != 0 ) {
  47. $errmsg_arr[] = 'Passwords do not match';
  48. $errflag = true;
  49. }
  50.  
  51. if($errflag) {
  52. $_SESSION['ERRMSG_ARR'] = $errmsg_arr;
  53. session_write_close();
  54. header("location: myprofile-password.php");
  55. exit();
  56. }
  57.  
  58.  
  59. $passwd = md5( $_POST['passwd'] );
  60.  
  61. $sql="UPDATE members SET firstname='$firstname', lastname='$lastname', email='$email', passwd = ".(!empty($passwd) ? "'$passwd'" : 'passwd')." WHERE member_id='$member_id'";
  62.  
  63.  
  64.  
  65. $result=mysql_query($sql);
  66.  
  67.  
  68. if($result){
  69. require_once('../connection/auth.php');
  70. include('../includes/head.php');
  71. include('../includes/head2.php');
  72. include('includes/sidebar.php');
  73. echo "<div id='dash_right'>";
  74. echo "<div class='p_top'></div>";
  75. echo "<div class='p_content'>";
  76. echo "<h2>Successful</h2><div class='clear'></div>";
  77. echo "<p>You have successfully updated your profile.</p>";
  78. echo "</div>";
  79. echo "<div class='p_bottom'></div>";
  80. echo "</div>";
  81. include('../includes/foot.php');
  82. }
  83.  
  84. ?>
Add Comment
Please, Sign In to add comment