Blog/Sign in/Email Activation/ = Problems

Post here is you are having problems with any of the tutorials.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Blog/Sign in/Email Activation/ = Problems

Post by jacek »

jaysus7 wrote:Nevermind i fixed it ..... thank you ....
No problem :D

You may want to be careful posting your database login details by the way ;)
Image
User avatar
jaysus7
Posts: 95
Joined: Wed Feb 22, 2012 9:06 pm
Location: Canada

Re: Blog/Sign in/Email Activation/ = Problems

Post by jaysus7 »

oops right i started off blocking that haha keep that n mind !!!
Just a helpless cause!!!!
User avatar
jaysus7
Posts: 95
Joined: Wed Feb 22, 2012 9:06 pm
Location: Canada

Re: Blog/Sign in/Email Activation/ = Problems

Post by jaysus7 »

I had to change all my mysql...the spelling I'm 99% sure its spelled correctly and its all in order so why won't it work now????? can you see anything wrong???? it was working!!!!

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM `users` WHERE `user_id` = '76'' at line 25
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/content/50/8811650/html/core/init/user.inc.php on line 133




user.inc

<?php
error_reporting(E_ALL);
//fetches the current logged in users id
function fetch_current_user_id($username){
        $username = mysql_real_escape_string($username);
       
        $sql = "SELECT `user_id` FROM `users` WHERE `user_username` = '{$username}'";
        $result = mysql_query($sql);
       
        return mysql_result($result, 0);
}
 


//check if given username exsists in the database
function user_exists($user){
	$user = mysql_real_escape_string($user);
	
	$total = mysql_query("SELECT COUNT(`user_id`) FROM `users` WHERE `user_username` = '{$user}'");
	echo mysql_error();
	return (mysql_result($total, 0) == '1') ? true : false;

}
//check if the given username and password combinations are valid
function valid_credentials($user, $pass){
	$user = mysql_real_escape_string($user);
	$pass = mysql_real_escape_string($pass);
	
	$total = mysql_query("SELECT COUNT(`user_id`) FROM `users` WHERE `user_username` = '{$user}' AND `user_password` = '{$pass}'");
	
	return (mysql_result($total, 0) == '1') ? true : false;
	
}
//checks to see is user account is active
	function is_active($user){
		$user = mysql_real_escape_string($user);
		echo mysql_error();
		$sql = "SELECT
					COUNT(`activations`.`user_id`)
				FROM `users`
				INNER JOIN `activations`
				ON `users`.`user_id` = `activations`.`user_id`
				WHERE `users`.`user_username` = '{$user}'";
				
	$result = mysql_query($sql);
	echo mysql_error();
	return (mysql_result($result, 0) == '0') ? true : false;
		
}
//acctivates the account related to the given activation code
function activate_account($aid){
	$aid = mysql_real_escape_string($aid);
	
	mysql_query("DELETE FROM `activations` WHERE `activation_code` = '{$aid}'");
echo mysql_error();
}

//adds a user to the database
function add_user($user, $email, $pass, $first, $last){
	$user		= mysql_real_escape_string(htmlentities($user));
	$email		= mysql_real_escape_string($email);
	$pass		= sha1($pass);
	$first		= mysql_real_escape_string(htmlentities($first));
	$last		= mysql_real_escape_string(htmlentities($last));
	
	$charset = array_flip(array_merge(range('a', 'z'), range('A', 'Z'), range('0', '9')));
	$aid =implode('', array_rand($charset, 10)); 
	
	$body =	<<<EMAIL
	
	Thank you for signing up with knowquest. To activate your account, please click the link below:
	
	http://www.jasonmassieportfolio.com/act ... ?aid={$aid}
	
EMAIL;
	
	mail($email, 'Your new account at Knowquest.com', $body, 'From: admin@knowquest.com');
	
	mysql_query("INSERT INTO `users` (`user_username`, `user_email`, `user_password`,`user_firstname`,`user_lastname`) VALUES ('{$user}', '{$email}', '{$pass}','{$first}','{$last}')");
	echo mysql_error();
	$user_id = mysql_insert_id();
	
	mysql_query("INSERT INTO `activations` (`user_id`, `activation_code`) VALUES ({$user_id}, '{$aid}')");
echo mysql_error();
}

//fetches all of the users from the table
function fetch_users(){
        $result = mysql_query("SELECT `user_id` AS `id`, `user_username` AS `username` FROM `users`"); 
        
        $users = array();
       
        while (($row = mysql_fetch_assoc($result)) !== false){
                $users[] = $row;
        }
       
        return $users;
}
 
//fetches profile info for given user
function fetch_user_info($uid){
        $uid = (int)$uid;
       
        $sql = "SELECT
                   `user_id` AS `id`,
                   `user_username` AS `username`,
                   `user_email` AS `email`,
                   `user_firstname` AS `firstname`,
                   `user_lastname` AS `lastname`,
                   `user_institution` AS `institution`,
                   `user_department` AS `department`,
                   `user_location` AS `location`,
                   `user_speciality` AS `speciality`,
                   `user_key words` AS `keywords`,
                   `user_research centre` AS `researchcentre`,
                   `user_website` AS `website`,
				   `user_articles published pre` AS `articlespublishedpre`,
                   `user_articles published non pre` AS `articlespublishednonpre`,
                   `user_published books` AS `publishedbooks`,
                   `user_social media` AS `socialmedia`,
				   `user_published chapters` AS `publishedchapters`,
				   `user_confidence poceedings` AS `confidencepoceedings`,
                   `user_non acidemic influences` AS `nonacidemicinfluences`,
                   `user_data sets` AS `datasets`,
                   `user_research methodology perferred` AS `researchmethodologyperferred`,
                   `user_researchers cited in your research` AS `researcherscitedinyourresearch`,
                   `user_memberships` AS `user_memberships`,
                   `user_acidemic influences` AS `acidemicinfluences`,
                 FROM `users`
                 WHERE `user_id` = '{$uid}'";
                       
          $result = mysql_query($sql);
            	echo mysql_error();
          $info = mysql_fetch_assoc($result);
                      
          $info['avatar'] = (file_exists("{$GLOBALS['path']}/user_avatars/{$info['id']}.jpg")) ? "core/user_avatars/{$info['id']}.jpg" : "core/user_avatars/default.jpg";
                      
          return $info;
}

//updates current user portfolio info
function set_profile_info($institution, $department, $location, $speciality, $keywords, $researchcentre, $website, $articlespublishedpre, $publishedbooks, $socialmedia, $publishedchapters, $confidencepoceedings, $nonacidemicinfluences, $datasets, $researchmethodologyperferred, $researcherscitedinyourresearch, $memberships, $acidemicinfluences, $avatar){
        $institution                   			= mysql_real_escape_string(htmlentities($institution));
        $department               				= mysql_real_escape_string(htmlentities($department));
        $location              					= mysql_real_escape_string(htmlentities($location));
        $speciality   							= mysql_real_escape_string(htmlentities($speciality));
        $keywords    							= mysql_real_escape_string(htmlentities($keywords));
        $researchcentre                			= mysql_real_escape_string(htmlentities($researchcentre));
        $website                 				= mysql_real_escape_string(htmlentities($website));
        $articlespublishedpre         		    = mysql_real_escape_string(htmlentities($articlespublishedpre));
        $publishedbooks              			= mysql_real_escape_string(htmlentities($publishedbooks));
		$socialmedia             				= mysql_real_escape_string(htmlentities($socialmedia));
        $publishedchapters                  	= mysql_real_escape_string(htmlentities($publishedchapters));
        $confidencepoceedings                   = mysql_real_escape_string(htmlentities($confidencepoceedings));
		$nonacidemicinfluences        	        = mysql_real_escape_string(htmlentities($nonacidemicinfluences));
        $datasets   							= mysql_real_escape_string(htmlentities($datasets));
        $researchmethodologyperferred    		= mysql_real_escape_string(htmlentities($researchmethodologyperferred));
        $researcherscitedinyourresearch         = mysql_real_escape_string(htmlentities($researcherscitedinyourresearch));
        $memberships                  			= mysql_real_escape_string(htmlentities($memberships));
        $acidemicinfluences              		= mysql_real_escape_string(htmlentities($acidemicinfluences));
     
 		 if (file_exists($avatar)){
                $src_size = getimagesize($avatar);
               			
                if ($src_size['mime'] === 'image/jpeg'){
                    $src_img = imagecreatefromjpeg($avatar);
                }else if ($src_size['mime'] === 'image/png'){
                    $src_img = imagecreatefrompng($avatar);
                }else if ($src_size['mime'] === 'image/gif'){
                    $src_img = imagecreatefromgif($avatar);
                }else{
                 $src_img = false;
                }
                       
                if ($src_img !== false){
                    $thumb_width = 300;
                               
               	    if ($src_size[0] <= $thumb_width){
                        $thumb = $src_img;
					}else{
                         $new_size[0] = $thumb_width;
                         $new_size[1] = ($src_size[1] / $src_size[0]) * $thumb_width;
                                       
                         $thumb = imagecreatetruecolor($new_size[0], $new_size[1]);
                         imagecopyresampled($thumb, $src_img, 0, 0, 0, 0, $new_size[0], $new_size[1], $src_size[0], $src_size[1]);
                    }
					
                    imagejpeg($thumb, "{$GLOBALS['path']}/user_avatars/{$_SESSION['uid']}.jpg");
                
				}
        
		}
       
        $sql = "UPDATE `users` SET
                    `user_institution` = '{$institution}',
                    `user_department` = '{$department}',
                    `user_location` = '{$location}',
                    `user_speciality` = '{$speciality}',
                    `user_key words` = '{$keywords}',
                    `user_research centre` = '{$researchcentre}',
                    `user_website` = '{$website}',
                    `user_articles published pre` = '{$articlespublishedpre}',
                    `user_published books` = '{$publishedbooks}',
                    `user_socia lmedia` = '{$socialmedia}',
                    `user_published chapters` = '{$publishedchapters}'
					`user_confidence poceedings` = '{$confidencepoceedings}',
                    `user_non acidemic influences` = '{$nonacidemicinfluences}',
                    `user_datasets` = '{$datasets}',
                    `user_research methodology perferred` = '{$researchmethodologyperferred}',
                    `user_researchers cited in your research` = '{$researcherscitedinyourresearch}',
                    `user_memberships` = '{$memberships}'
					`user_acidemic influences` = '{$acidemicinfluences}'
                WHERE `user_id` = {$_SESSION['uid']}";
              
        mysql_query($sql);
        echo mysql_error();
}
 
?>
Just a helpless cause!!!!
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Blog/Sign in/Email Activation/ = Problems

Post by Temor »

Try removing the quoutes around {$uid}. Putting qoutes around it makes SQL think it's a string, but it's not, it's an integer. Not sure if that would cause it all to act up like this though.
 FROM `users` WHERE `user_id` = '{$uid}'";
And are you sure that spaces is the way to go here? Seeing as you started using underscores and then started using spaces.
`user_research methodology perferred`
`user_researchers cited in your research`
 
User avatar
jaysus7
Posts: 95
Joined: Wed Feb 22, 2012 9:06 pm
Location: Canada

Re: Blog/Sign in/Email Activation/ = Problems

Post by jaysus7 »

i have tried with and without the ' ' and the spaces worked before!!!
Just a helpless cause!!!!
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Blog/Sign in/Email Activation/ = Problems

Post by Temor »

   `user_acidemic influences` AS `acidemicinfluences`,
                FROM `users`
                WHERE `user_id` = '{$uid}'";
there should not be a comma after your last line.
User avatar
jaysus7
Posts: 95
Joined: Wed Feb 22, 2012 9:06 pm
Location: Canada

Re: Blog/Sign in/Email Activation/ = Problems

Post by jaysus7 »

oh ya I'm an idiot!!! thanks lol jesse the easiest thing eh!! thanks solved it
Just a helpless cause!!!!
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Blog/Sign in/Email Activation/ = Problems

Post by Temor »

it took me over half an hour of constant staring to find that so don't be too hard on yourself :)
User avatar
jaysus7
Posts: 95
Joined: Wed Feb 22, 2012 9:06 pm
Location: Canada

Re: Blog/Sign in/Email Activation/ = Problems

Post by jaysus7 »

wow thank you for taking that much time to look at my code and help me out i appreciate it a lot!!!!!
Just a helpless cause!!!!
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Blog/Sign in/Email Activation/ = Problems

Post by Temor »

Don't worry about it. That's what I'm here for :)
User avatar
jaysus7
Posts: 95
Joined: Wed Feb 22, 2012 9:06 pm
Location: Canada

Re: Blog/Sign in/Email Activation/ = Problems

Post by jaysus7 »

it stopped editing my profile???

user inc
<?php
error_reporting(E_ALL);
//fetches the current logged in users id
function fetch_current_user_id($username){
        $username = mysql_real_escape_string($username);
       
        $sql = "SELECT `user_id` FROM `users` WHERE `user_username` = '{$username}'";
        $result = mysql_query($sql);
       
        return mysql_result($result, 0);
}
 


//check if given username exsists in the database
function user_exists($user){
	$user = mysql_real_escape_string($user);
	
	$total = mysql_query("SELECT COUNT(`user_id`) FROM `users` WHERE `user_username` = '{$user}'");
	echo mysql_error();
	return (mysql_result($total, 0) == '1') ? true : false;

}
//check if the given username and password combinations are valid
function valid_credentials($user, $pass){
	$user = mysql_real_escape_string($user);
	$pass = mysql_real_escape_string($pass);
	
	$total = mysql_query("SELECT COUNT(`user_id`) FROM `users` WHERE `user_username` = '{$user}' AND `user_password` = '{$pass}'");
	
	return (mysql_result($total, 0) == '1') ? true : false;
	
}
//checks to see is user account is active
	function is_active($user){
		$user = mysql_real_escape_string($user);
		echo mysql_error();
		$sql = "SELECT
					COUNT(`activations`.`user_id`)
				FROM `users`
				INNER JOIN `activations`
				ON `users`.`user_id` = `activations`.`user_id`
				WHERE `users`.`user_username` = '{$user}'";
				
	$result = mysql_query($sql);
	echo mysql_error();
	return (mysql_result($result, 0) == '0') ? true : false;
		
}
//acctivates the account related to the given activation code
function activate_account($aid){
	$aid = mysql_real_escape_string($aid);
	
	mysql_query("DELETE FROM `activations` WHERE `activation_code` = '{$aid}'");
echo mysql_error();
}

//adds a user to the database
function add_user($user, $email, $pass, $first, $last){
	$user		= mysql_real_escape_string(htmlentities($user));
	$email		= mysql_real_escape_string($email);
	$pass		= sha1($pass);
	$first		= mysql_real_escape_string(htmlentities($first));
	$last		= mysql_real_escape_string(htmlentities($last));
	
	$charset = array_flip(array_merge(range('a', 'z'), range('A', 'Z'), range('0', '9')));
	$aid =implode('', array_rand($charset, 10)); 
	
	$body =	<<<EMAIL
	
	Thank you for signing up with knowquest. To activate your account, please click the link below:
	
	http://www.jasonmassieportfolio.com/act ... ?aid={$aid}
	
EMAIL;
	
	mail($email, 'Your new account at Knowquest.com', $body, 'From: admin@knowquest.com');
	
	mysql_query("INSERT INTO `users` (`user_username`, `user_email`, `user_password`,`user_firstname`,`user_lastname`) VALUES ('{$user}', '{$email}', '{$pass}','{$first}','{$last}')");
	echo mysql_error();
	$user_id = mysql_insert_id();
	
	mysql_query("INSERT INTO `activations` (`user_id`, `activation_code`) VALUES ({$user_id}, '{$aid}')");
echo mysql_error();
}

//fetches all of the users from the table
function fetch_users(){
        $result = mysql_query("SELECT `user_id` AS `id`, `user_username` AS `username` FROM `users`"); 
        
        $users = array();
       
        while (($row = mysql_fetch_assoc($result)) !== false){
                $users[] = $row;
        }
       
        return $users;
}
 
//fetches profile info for given user
function fetch_user_info($uid){
        $uid = (int)$uid;
       
        $sql = "SELECT
                   `user_id` AS `id`,
                   `user_username` AS `username`,
                   `user_email` AS `email`,
                   `user_firstname` AS `firstname`,
                   `user_lastname` AS `lastname`,
                   `user_institution` AS `institution`,
                   `user_department` AS `department`,
                   `user_location` AS `location`,
                   `user_speciality` AS `speciality`,
                   `user_key words` AS `keywords`,
                   `user_research centre` AS `researchcentre`,
                   `user_website` AS `website`,
				   `user_articles published pre` AS `articlespublishedpre`,
                   `user_articles published non pre` AS `articlespublishednonpre`,
                   `user_published books` AS `publishedbooks`,
                   `user_social media` AS `socialmedia`,
				   `user_published chapters` AS `publishedchapters`,
				   `user_confidence proceedings` AS `confidenceproceedings`,
                   `user_non acidemic influences` AS `nonacidemicinfluences`,
                   `user_data sets` AS `datasets`,
                   `user_research methodology perferred` AS `researchmethodologyperferred`,
                   `user_researchers cited in your research` AS `researcherscitedinyourresearch`,
                   `user_memberships` AS `memberships`,
                   `user_acidemic influences` AS `acidemicinfluences`
                 FROM `users`
                 WHERE `user_id` = {$uid}";
                       
          $result = mysql_query($sql);
            	echo mysql_error();
          $info = mysql_fetch_assoc($result);
                      
          $info['avatar'] = (file_exists("{$GLOBALS['path']}/user_avatars/{$info['id']}.jpg")) ? "core/user_avatars/{$info['id']}.jpg" : "core/user_avatars/default.jpg";
                      
          return $info;
}

//updates current user portfolio info
function set_profile_info($institution, $department, $location, $speciality, $keywords, $researchcentre, $website, $articlespublishedpre, $publishedbooks, $socialmedia, $publishedchapters, $confidencepoceedings, $nonacidemicinfluences, $datasets, $researchmethodologyperferred, $researcherscitedinyourresearch, $memberships, $acidemicinfluences, $avatar){
        $institution                   			= mysql_real_escape_string(htmlentities($institution));
        $department               				= mysql_real_escape_string(htmlentities($department));
        $location              					= mysql_real_escape_string(htmlentities($location));
        $speciality   							= mysql_real_escape_string(htmlentities($speciality));
        $keywords    							= mysql_real_escape_string(htmlentities($keywords));
        $researchcentre                			= mysql_real_escape_string(htmlentities($researchcentre));
        $website                 				= mysql_real_escape_string(htmlentities($website));
        $articlespublishedpre         		    = mysql_real_escape_string(htmlentities($articlespublishedpre));
        $publishedbooks              			= mysql_real_escape_string(htmlentities($publishedbooks));
		$socialmedia             				= mysql_real_escape_string(htmlentities($socialmedia));
        $publishedchapters                  	= mysql_real_escape_string(htmlentities($publishedchapters));
        $confidencepoceedings                   = mysql_real_escape_string(htmlentities($confidencepoceedings));
		$nonacidemicinfluences        	        = mysql_real_escape_string(htmlentities($nonacidemicinfluences));
        $datasets   							= mysql_real_escape_string(htmlentities($datasets));
        $researchmethodologyperferred    		= mysql_real_escape_string(htmlentities($researchmethodologyperferred));
        $researcherscitedinyourresearch         = mysql_real_escape_string(htmlentities($researcherscitedinyourresearch));
        $memberships                  			= mysql_real_escape_string(htmlentities($memberships));
        $acidemicinfluences              		= mysql_real_escape_string(htmlentities($acidemicinfluences));
     
 		 if (file_exists($avatar)){
                $src_size = getimagesize($avatar);
               			
                if ($src_size['mime'] === 'image/jpeg'){
                    $src_img = imagecreatefromjpeg($avatar);
                }else if ($src_size['mime'] === 'image/png'){
                    $src_img = imagecreatefrompng($avatar);
                }else if ($src_size['mime'] === 'image/gif'){
                    $src_img = imagecreatefromgif($avatar);
                }else{
                 $src_img = false;
                }
                       
                if ($src_img !== false){
                    $thumb_width = 200;
                               
               	    if ($src_size[0] <= $thumb_width){
                        $thumb = $src_img;
					}else{
                         $new_size[0] = $thumb_width;
                         $new_size[1] = ($src_size[1] / $src_size[0]) * $thumb_width;
                                       
                         $thumb = imagecreatetruecolor($new_size[0], $new_size[1]);
                         imagecopyresampled($thumb, $src_img, 0, 0, 0, 0, $new_size[0], $new_size[1], $src_size[0], $src_size[1]);
                    }
					
                    imagejpeg($thumb, "{$GLOBALS['path']}/user_avatars/{$_SESSION['uid']}.jpg");
                
				}
        
		}
       
        $sql = "UPDATE `users` SET
                    `user_institution` = '{$institution}',
                    `user_department` = '{$department}',
                    `user_location` = '{$location}',
                    `user_speciality` = '{$speciality}',
                    `user_key words` = '{$keywords}',
                    `user_research centre` = '{$researchcentre}',
                    `user_website` = '{$website}',
                    `user_articles published pre` = '{$articlespublishedpre}',
                    `user_published books` = '{$publishedbooks}',
                    `user_socia lmedia` = '{$socialmedia}',
                    `user_published chapters` = '{$publishedchapters}'
					`user_confidence proceedings` = '{$confidenceproceedings}',
                    `user_non acidemic influences` = '{$nonacidemicinfluences}',
                    `user_data sets` = '{$datasets}',
                    `user_research methodology perferred` = '{$researchmethodologyperferred}',
                    `user_researchers cited in your research` = '{$researcherscitedinyourresearch}',
                    `user_memberships` = '{$memberships}',
					`user_acidemic influences` = '{$acidemicinfluences}'
                WHERE `user_id` = {$_SESSION['uid']}";
              
        mysql_query($sql);
        echo mysql_error();
}
 
?>

Edit

<?php
error_reporting(E_ALL);
include ("core/init.inc.php");

if (isset($_POST['institution'], $_POST['department'], $_POST['location'], $_POST['speciality'], $_POST['keywords'], $_POST['researchcentre'], $_POST['website'], $_POST['articlespublishedpre'], $_POST['publishedbooks'], $_POST['socialmedia'], $_POST['publishedchapters'], $_POST['confidenceproceedings'], $_POST['nonacidemicinfluences'], $_POST['datasets'], $_POST['researchmethodologyperferred'], $_POST['researcherscitedinyourresearch'], $_POST['memberships'], $_POST['acidemicinfluences'])){
	$errors = array();

	if (filter_var($_POST['email'],  FILTER_VALIDATE_EMAIL) === false){
		$errors[] = 'The email address you entered is not valid.';

	}
	
	if (preg_match('#^[a-z0-9]+$#i', $_POST['location']) === 0){
		$errors[] = 'your location may only contain letters and numberswith now spaces.';	
	}
	
	if (empty($_FILES['avatar']['tmp_name']) === false){
		$file_ext =	end(explode('.', $_FILES['avatar']['name']));
		
		if (in_array(strtolower($file_ext), array('jpg', 'jpeg', 'png', 'gif')) === false){
			$errors[] = 'your Picture id must be an image';
	}
	
}

if (empty($errors)){
	set_profile_info($_POST['institution'], $_POST['department'], $_POST['location'], $_POST['speciality'], $_POST['keywords'], $_POST['researchcentre'], $_POST['website'], $_POST['articlespublishedpre'], $_POST['publishedbooks'], $_POST['socialmedia'], $_POST['publishedchapters'], $_POST['confidenceproceedings'], $_POST['nonacidemicinfluences'], $_POST['datasets'], $_POST['researchmethodologyperferred'], $_POST['researcherscitedinyourresearch'], $_POST['memberships'], $_POST['acidemicinfluences'], (empty($_FILES['avatar']['tmp_name'])) ? false : $_FILES['avatar']['tmp_name']);
	
	}

	$user_info = array(
		'institution' 						=> htmlentities($_POST['institution']),
		'department' 						=> htmlentities($_POST['department']),
		'location' 							=> htmlentities($_POST['location']),
		'keywords'							=> htmlentities($_POST['keywords']),
		'researchcentre'					=> htmlentities($_POST['researchcentre']),
		'website' 							=> htmlentities($_POST['website']),
		'articlespublishedpre'				=> htmlentities($_POST['articlespublishedpre']),
		'publishedbooks'					=> htmlentities($_POST['publishedbooks']),
		'socialmedia'						=> htmlentities($_POST['socialmedia']),
		'publishedchapters'					=> htmlentities($_POST['publishedchapters']),
		'confidenceproceedings'				=> htmlentities($_POST['confidenceproceedings']),
		'nonacidemicinfluences'				=> htmlentities($_POST['nonacidemicinfluences']),
		'datasets'							=> htmlentities($_POST['datasets']),
		'researchmethodologyperferred'		=> htmlentities($_POST['researchmethodologyperferred']),
		'researcherscitedinyourresearch'	=> htmlentities($_POST['researcherscitedinyourresearch']),
		'memberships'						=> htmlentities($_POST['memberships']),
		'acidemicinfluences'				=> htmlentities($_POST['acidemicinfluences'])
	);
}else{	
	$user_info = fetch_user_info($_SESSION['uid']);
}	
?>
 <?php
	
	if (isset($errors) === false){
		echo 'Click update to edit your portfolio.';
	}else if (empty($errors)){
		echo 'Your portfolio has been updated';
	}else{
		echo '<ul><li>', implode('</li><li>', $errors), '</li></ul>';
	}
	
	?>
    </h4>
    <h2>Professional Information</h2>
    <hr />
    <h5>
  <form action="" method="post" enctype="multipart/form-data">
  
  <table width="343" height="346" border="0" align="left">
       <tr>
         <td width="38%" height="84"><p><strong>Institution</strong>           </p>
           <h3><br>
         </h3></td>
         <td width="62%"><h3> 
           </h3>
           <h3>
             <input type="text" name="institution" id="institution" value="<?php echo $user_info['institution']; ?>">
           </h3>
           <h3>(Name of School, ThinkTank, Government)</h3></td>
         </tr>
    <tr>
        <td height="63"><p><strong>Department</strong></p>
          <p>
            <label for='aboutinstituition'><strong><br>
            </strong></label>
      </p></td>
        <td><h3> 
          </h3>
          <h3>
            <input type="text" name="department" id="department" value="<?php echo $user_info['department']; ?>">
          </h3>
          <h3><strong>(Area of Study i.e. Economics, Business, Biology, History, Education etc.)</strong></h3></td>
        </tr>
      <tr>
        <td height="87"><p><strong>Speciality</strong></p></td>
        <td><h3> 
          </h3>
          <h3>
            <input type="text" name="speciality" id="speciality" value="<?php echo $user_info['speciality']; ?>">
          </h3>
          <h3><strong>(Area of Interest i.e. Micro Economics, Gentics, Civil Engineering, etc.)</strong></h3></td>
        </tr>
      <tr>
        <td height="87"><p><strong>
          <label for='professionalresearch'> </label>
          Key Words        </strong></p>
          <p><strong>
            <label for='professionalresearch'><br>
            </label>
      </strong></p></td>
        <td><h3> 
          </h3>
          <h3>
            <input type="text" name="keywords"id="keywords"  value="<?php echo $user_info['keywords']; ?>">
          </h3>
          <h3>(i.e. Interest rates, head injuries, solor flares, family business, etc.)</h3></td>
        </tr>
  </table>
  <table width="341" height="299" border="0" align="center">
    <tr>
      <td width="14%" height="50"><p><strong>Country</strong></p></td>
      <td width="22%"><h3>
        <input type="text" name="location" id="location" value="<?php echo $user_info['location']; ?>">
      </h3></td>
      </tr>
    <tr>
      <td height="69"><p><strong>
        <label for='professionalresearch5'>Research Center</label>
      </strong></p></td>
      <td><h3>
        <input type="text" name="researchcentre" id="researchcentre" value="<?php echo $user_info['researchcentre']; ?>">
        </h3>
        <h3><strong>(If applicable)</strong></h3></td>
      </tr>
    <tr>
      <td height="50"><p><strong>Website</strong></p></td>
      <td><h3>
        <input type="text" name="website" id="website" value="<?php echo $user_info['website']; ?>">
      </h3></td>
      </tr>
    <tr>
      <td height="50"><p><strong>Social Networking</strong></p></td>
      <td><h3> 
        </h3>
        <h3>
          <input type="text" name="socialmedia" id="socialmedia" value="<?php echo $user_info['socialmedia']; ?>">
        </h3>
        <h3><strong>(twitter, facebook, linked in, etc.)</strong></h3></td>
    </tr>
    <tr>
      <td height="50"><p>Email</p></td>
      <td><h3>
        <input type="text" name="email" id="email" value="<?php echo $user_info['email']; ?>">
      </h3></td>
    </tr>
  </table>
  <p> </p>
  <p> </p>
  <p> </p>
  <h2> </h2>
  <h6> </h6>
  <h6><br>
    <br>
  </h6>
  <h2>Research Information</h2>
  <hr />
  <h2> </h2>
  <table width="355" height="503" border="0" align="left">
    <tr>
      <td height="69"><p><strong>Articles Published</strong></p></td>
      <td><h3> 
        </h3>
        <h3>
          <input type="text" name="nonacidemicinfluences" id="nonacidemicinfluences" value="<?php echo $user_info['nonacidemicinfluences']; ?>">
        </h3>
        <h3><strong>(Non-refferred)</strong></h3></td>
    </tr>
    <tr>
      <td width="43%" height="95"><p><strong>Published Books</strong></p></td>
      <td width="57%"><h3>
        <input type="text" name="publishedbooks" id="publishedbooks" value="<?php echo $user_info['publishedbooks']; ?>">
      </h3></td>
    </tr>
    <tr>
      <td height="82"><p><strong>Acidemic Influences</strong></p></td>
      <td><h3> 
        </h3>
        <h3>
          <input type="text" name="acidemicinfluences" id="acidemicinfluences" value="<?php echo $user_info['acidemicinfluences']; ?>">
        </h3>
        <h3><strong>(That describe your research: i.e. Interest rates, head injuries, solor flares, family business, etc.)</strong></h3></td>
    </tr>
    <tr>
      <td height="122"><p><strong>Research Methodology Perferred</strong></p>
        <label for='professionalemail3'><strong><br>
      </strong></label></td>
      <td><h3>
        <input type="text" name="researchmethodologyperferred" id="researchmethodologyperferred" value="<?php echo $user_info['researchmethodologyperferred']; ?>">
      </h3></td>
    </tr>
    <tr>
      <td height="88"><p><strong>Researchers Cited in Your Research</strong></p></td>
      <td><h3>
        <input type="text" name="researcherscitedinyourresearch" id="researcherscitedinyourresearch" value="<?php echo $user_info['researcherscitedinyourresearch']; ?>">
      </h3>
        <h3><strong>(Names of researchers)</strong></h3></td>
    </tr>
</table>
  <table width="353" height="428" border="0" align="center">
    <tr>
      <td height="69"><p><strong>Articles Published</strong></p></td>
      <td><h3> 
        </h3>
        <h3>
          <input type="text" name="articlespublishedpre" id="articlespublishedpre" value="<?php echo $user_info['articlespublishedpre']; ?>">
        </h3>
        <h3><strong>(Refferred)</strong></h3></td>
    </tr>
    <tr>
      <td height="65"><p><strong>Confidence Proceedings</strong>
        </p></td>
      <td><h3>
        <input type="text" name="confidencepoceedings" id="confidencepoceedings" value="<?php echo $user_info['confidencepoceedings']; ?>">
      </h3></td>
    </tr>
    <tr>
      <td width="14%" height="65"><p><strong>Published Chapters</strong>
      </p></td>
      <td width="22%"><h3>
        <input type="text" name="publishedchapters" id="publishedchapters" value="<?php echo $user_info['publishedchapters']; ?>">
      </h3></td>
    </tr>
    <tr>
      <td height="88"><p><strong>Non-acidemic Influences</strong></p></td>
      <td><h3> 
        </h3>
        <h3>
          <input type="text" name="nonacidemicinfluences" id="nonacidemicinfluences" value="<?php echo $user_info['nonacidemicinfluences']; ?>">
        </h3>
        <h3> <strong>(That describe your research: i.e. Interest rates, head injuries, solor flares, family business, etc.)</strong></h3></td>
    </tr>
    <tr>
      <td height="60"><p><strong>Data Sets</strong></p></td>
      <td><h3> 
        </h3>
        <h3>
          <input type="text" name="datasets" id="datasets" value="<?php echo $user_info['datasets']; ?>">
        </h3>
        <h3><strong>(Posted)</strong></h3></td>
    </tr>
    <tr>
      <td height="46"><p><strong>Memberships</strong>
        </p></td>
      <td><h3>
        <input type="text" name="memberships" id="memberships" value="<?php echo $user_info['memberships']; ?>">
      </h3></td>
    </tr>
  </table>
  <p> </p>
  <p> </p>
 <h6><br>
    <br>
 </h6>
  <h2>Photo Identification</h2>
  <hr />
  <p> </p>
  <table width="902">
    <tr>
      <td width="19%"><p><strong>Photo Id</strong></p>
        <hr />
        <p></p></td>
      <td width="36%"><input type="file" name="avatar" id="avatar" value=""/></td>
      <td width="45%"> </td>
    </tr>
</table>
  <h6><br>
    <br>
    <input type="submit" value="Update">
  </h6>
  
    </form>
Just a helpless cause!!!!
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Blog/Sign in/Email Activation/ = Problems

Post by Temor »

What do you mean it stopped? Did it just break all of a sudden or did you change anything in the code beforehand?
Are you getting any error messages?

Is the page refreshing but not doing anything?
User avatar
jaysus7
Posts: 95
Joined: Wed Feb 22, 2012 9:06 pm
Location: Canada

Re: Blog/Sign in/Email Activation/ = Problems

Post by jaysus7 »

oh right lol ya i changed the database and the code to match it...it right because it shows the user info just fine....it just doesn't change it no more...it was but since the change it stopped but it should be fine cuz i just changed the words around.
Just a helpless cause!!!!
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Blog/Sign in/Email Activation/ = Problems

Post by Temor »

well, there has to be a typo somewhere. Are you not getting any errors?


I did find one typo.

you spelled confidenceproceedings " confidencepoceedings " in at least two different places.
User avatar
jaysus7
Posts: 95
Joined: Wed Feb 22, 2012 9:06 pm
Location: Canada

Re: Blog/Sign in/Email Activation/ = Problems

Post by jaysus7 »

ya i noticed that as well so i went through a copied and pasted the mysql to every single code in my two pages.... it just doesn't work :S i think there is something wrong here...


	$user_info = array(
		'institution' 						=> htmlentities($_POST['institution']),
		'department' 						=> htmlentities($_POST['department']),
		'location' 							=> htmlentities($_POST['location']),
		'speciality' 						=> htmlentities($_POST['speciality']),
		'keywords'							=> htmlentities($_POST['speciality']),
		'researchcentre'					=> htmlentities($_POST['researchcentre']),
		'website' 							=> htmlentities($_POST['website']),
		'articlespublishedpre'				=> htmlentities($_POST['articlespublishedpre']),
		'articlespublishednonpre'			=> htmlentities($_POST['articlespublishednonpre']),
		'publishedbooks'					=> htmlentities($_POST['publishedbooks']),
		'socialmedia'						=> htmlentities($_POST['socialmedia']),
		'publishedchapters'					=> htmlentities($_POST['publishedchapters']),
		'confidenceproceedings'				=> htmlentities($_POST['confidenceproceedings']),
		'nonacidemicinfluences'				=> htmlentities($_POST['nonacidemicinfluences']),
		'datasets'							=> htmlentities($_POST['datasets']),
		'researchmethodologyperferred'		=> htmlentities($_POST['researchmethodologyperferred']),
		'researcherscitedinyourresearch'	=> htmlentities($_POST['researcherscitedinyourresearch']),
		'memberships'						=> htmlentities($_POST['memberships']),
		'acidemicinfluences'				=> htmlentities($_POST['acidemicinfluences'])
	);
}else{	
	


i just don't know what?
Just a helpless cause!!!!
User avatar
jaysus7
Posts: 95
Joined: Wed Feb 22, 2012 9:06 pm
Location: Canada

Re: Blog/Sign in/Email Activation/ = Problems

Post by jaysus7 »

Click update to edit your portfolio.
is the only error i get when i update it the other error doesn't show stating that my portfolio has been updated
Just a helpless cause!!!!
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Blog/Sign in/Email Activation/ = Problems

Post by Temor »

well, the only thing I can think of right now has to be that you have a typo in your database. What does your table structure look like?
User avatar
jaysus7
Posts: 95
Joined: Wed Feb 22, 2012 9:06 pm
Location: Canada

Re: Blog/Sign in/Email Activation/ = Problems

Post by jaysus7 »

mysql
Attachments
Screen Shot 2012-04-17 at 8.06.01 PM.png
Screen Shot 2012-04-17 at 8.06.01 PM.png (147.76 KiB) Viewed 3889 times
Just a helpless cause!!!!
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Blog/Sign in/Email Activation/ = Problems

Post by jacek »

Follow it back from the error message
        if (isset($errors) === false){
                echo 'Click update to edit your portfolio.';
        }
this displays if the $errors variable is not set. So where is it set ?
if (isset($_POST['institution'], $_POST['department'], $_POST['location'], $_POST['speciality'], $_POST['keywords'], $_POST['researchcentre'], $_POST['website'], $_POST['articlespublishedpre'], $_POST['publishedbooks'], $_POST['socialmedia'], $_POST['publishedchapters'], $_POST['confidenceproceedings'], $_POST['nonacidemicinfluences'], $_POST['datasets'], $_POST['researchmethodologyperferred'], $_POST['researcherscitedinyourresearch'], $_POST['memberships'], $_POST['acidemicinfluences'])){
        $errors = array();
If this massive list of variables exist. So my guess is that you miss-typed one of them ? check them all with the html and see if that is it.
Image
User avatar
jaysus7
Posts: 95
Joined: Wed Feb 22, 2012 9:06 pm
Location: Canada

Re: Blog/Sign in/Email Activation/ = Problems

Post by jaysus7 »

No that was not the case!! i checked the back end file the edit file and everything it did not work



im so stumped!!!!
Just a helpless cause!!!!
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Blog/Sign in/Email Activation/ = Problems

Post by jacek »

jaysus7 wrote:No that was not the case!! i checked the back end file the edit file and everything it did not work
Can you add a
echo 'TEST';
under the if (isset()){ check, just so we can confirm that the correct data is being sent.
Image
Post Reply