Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ob_start();
- include_once('modules/session.php');
- Session::start();
- include_once('modules/user.php');
- include_once('modules/account.php');
- include_once('modules/data_validation.php');
- include_once('modules/database.php');
- include_once('modules/error_codes.php');
- include_once('modules/msg_codes.php');
- include_once('config.php');
- //error_reporting(1);
- include_once('modules/template.php');
- include_once('modules/most_interesting_topics.php');
- try {
- $db = new Database($db_host, $db_user, $db_password, $db_name);
- }
- catch (Exception $e) {
- echo $e->getMessage();
- die();
- }
- $user = new User(Session::get_user_id(), $db);
- Template::showHead($config_site_name);
- Template::showBody();
- Template::showUserMenuBlock($user);
- Template::showMostInterestingBlockTop();
- $more_interesting_topics = new MostInterestingTopics(5, $db);
- $more_interesting_topics->getMostInterestingTopics();
- $more_interesting_topics->showMostInterestingTopics();
- Template::showMostInterestingBlockBottom();
- Template::showPollsBlock();
- if(isset($_POST['fl']) && !empty($_POST['fl'])) {
- Validator::removeSlashes();
- if($_POST['old_pass']!=="" && $_POST['new_pass']!=="" && $_POST['new_pass2']!=="") {
- $old_pass=$_POST['old_pass'];
- $new_pass=$_POST['new_pass'];
- $new_pass2=$_POST['new_pass2'];
- try {
- $query = 'SELECT password FROM users WHERE id='.$user->get_id().' LIMIT 1';
- $db->query($query);
- }
- catch(Exception $e) {
- $e->getMessage();
- die();
- }
- if ($db->num_rows()>0){
- $row=$db->next_row();
- $pass=$row['password'];
- }
- if(strcmp($new_pass,$new_pass2)==0 && strcmp(md5(md5($old_pass)),$pass)==0){
- $name=$_POST['name'];
- $email=$_POST['email'];
- $country=$_POST['country'];
- $city=$_POST['city'];
- $about=$_POST['about'];
- $err_Arr=Validator::getErrorsArray($email,$name,$country,$city,'a','1');
- if(!Validator::full_info_validation($err_Arr)) {
- echo '<div id="mid">'.Validator::getErrorMessage($err_Arr).'</div>';
- Template::showChangeProfileForm($name,$email,$country,$city,$about);
- }
- else {
- $var=Account::change_password($db,$user->get_login(),$old_pass,$new_pass)*Account::change_profile_info($db,$user->get_id(),$name,$email,$country,$city,$about);
- if($var){
- echo '<div id="mid">'.MSG0002.'</div>';
- }
- else
- echo ERR0021;
- }
- }
- else {
- echo ERR0020;
- }
- }
- else {
- $name=$_POST['name'];
- $email=$_POST['email'];
- $country=$_POST['country'];
- $city=$_POST['city'];
- $about=$_POST['about'];
- $err_Arr=Validator::getErrorsArray($email,$name,$country,$city,'a','1');
- if(!Validator::full_info_validation($err_Arr)) {
- echo '<div id="mid">'.Validator::getErrorMessage($err_Arr).'</div>';
- Template::showChangeProfileForm($name,$email,$country,$city,$about);
- }
- else {
- if(Account::change_profile_info($db,$user->get_id(),$name,$email,$country,$city,$about))
- echo '<div id="mid">'.MSG0002.'</div>';
- else echo ERR0003;
- }
- }
- }
- else {
- Template::showChangeProfileForm($user->get_name(),$user->get_email(),$user->get_country(),$user->get_city(),$user->get_about());
- }
- Template::showFooter();
- $db->close();
- ?>
Add Comment
Please, Sign In to add comment