Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host="localhost";
- $username="mrephex_song";
- $password="test010203";
- $db_name="mrephex_songsheet";
- $tbl_name="members";
- mysql_connect("localhost", "mrephex_song", "test010203")or die("cannot connect");
- mysql_select_db("mrephex_songsheet")or die("cannot select DB");
- define('DB_HOST', 'localhost');
- define('DB_USER', 'mrephex_song');
- define('DB_PASSWORD', 'test010203');
- define('DB_DATABASE', 'mrephex_songsheet');
- $id=$_GET['id'];
- $errmsg_arr = array();
- $errflag = false;
- $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
- if(!$link) {
- die('Failed to connect to server: ' . mysql_error());
- }
- $db = mysql_select_db(DB_DATABASE);
- if(!$db) {
- die("Unable to select database");
- }
- function clean($str) {
- $str = @trim($str);
- if(get_magic_quotes_gpc()) {
- $str = stripslashes($str);
- }
- return mysql_real_escape_string($str);
- }
- $password = clean($_POST['password']);
- $cpassword = clean($_POST['cpassword']);
- if( strcmp($password, $cpassword) != 0 ) {
- $errmsg_arr[] = 'Passwords do not match';
- $errflag = true;
- }
- if($errflag) {
- $_SESSION['ERRMSG_ARR'] = $errmsg_arr;
- session_write_close();
- header("location: myprofile-password.php");
- exit();
- }
- $passwd = md5( $_POST['passwd'] );
- $sql="UPDATE members SET firstname='$firstname', lastname='$lastname', email='$email', passwd = ".(!empty($passwd) ? "'$passwd'" : 'passwd')." WHERE member_id='$member_id'";
- $result=mysql_query($sql);
- if($result){
- require_once('../connection/auth.php');
- include('../includes/head.php');
- include('../includes/head2.php');
- include('includes/sidebar.php');
- echo "<div id='dash_right'>";
- echo "<div class='p_top'></div>";
- echo "<div class='p_content'>";
- echo "<h2>Successful</h2><div class='clear'></div>";
- echo "<p>You have successfully updated your profile.</p>";
- echo "</div>";
- echo "<div class='p_bottom'></div>";
- echo "</div>";
- include('../includes/foot.php');
- }
- ?>
Add Comment
Please, Sign In to add comment