<?php
/*
 **************************************************************************************************
 *    Copyright (c) 2010-2012 Just Another Video script
 *
 * 	  This file is part of Just Another Video Script.
 *    Version 1.4.3
 *    info@justanothervideoscript.com
 **************************************************************************************************
 *    Come to website for support or buying additional plugins/modules.
 *    http://justanothervideoscript.com/
 **************************************************************************************************
 *    By using this software you agree that you have read and acknowledged our End-User License
 *    Agreement available at http://justanothervideoscript.com/license and can be bound by it.
 **********************************************************************************
 */
global $db ;
if (!$loggedIn) {
	$haltMessage = "<h2>You must log in</h2>" ;
} else {
	if (isset($_POST['submit'])) { 
		$db->query("SELECT * FROM member WHERE username = '".quote_smart($_SESSION['session_username'])."'") ;
		$res = $db->fetch() ;

			if (quote_smart($_POST['newpass']) == quote_smart($_POST['newpass2'])) {

				if (sha1(quote_smart($_POST['oldpass'])) == $res['password']) {
					$db->query("UPDATE `member` SET `password` = '".sha1(quote_smart($_POST['newpass']))."' WHERE `username` = '".quote_smart($_SESSION['session_username'])."'") ;
					$msg = "Password has been changed" ;
				} else {
				$msg = "Old password not valid" ;
				}

			} else {
				$msg = "New Passwords did not matched" ;
			}
	}
}
?>