Esempio n. 1
0
function checkLogin($username, $password)
{
    $username = replaceMQ($username);
    $password = replaceMQ($password);
    $db_check = new db_query("SELECT adm_id\n                                FROM admin_users\n                                WHERE adm_loginname = '" . $username . "' AND adm_password = '******'");
    if (mysqli_num_rows($db_check->result) > 0) {
        $check = mysqli_fetch_array($db_check->result);
        $adm_id = $check["adm_id"];
        $db_check->close();
        unset($db_check);
        return $adm_id;
    } else {
        $db_check->close();
        unset($db_check);
        return 0;
    }
}
Esempio n. 2
0
function checkLogin($b, $c)
{
    $b = replaceMQ($b);
    $c = replaceMQ($c);
    $f = new db_query("SELECT adm_id \n\t\t\t\t\t\t\t FROM admin_users\n\t\t\t\t\t\t\t WHERE adm_loginname = '" . $b . "' AND adm_password = '******'");
    if (mysqli_num_rows($f->result) > 0) {
        $g = mysqli_fetch_array($f->result);
        $h = $g["adm_id"];
        $f->close();
        unset($f);
        return $h;
    } else {
        $f->close();
        unset($f);
        return 0;
    }
}
Esempio n. 3
0
function checkAccessCategory(){
	
	$userlogin	= getValue("userlogin", "str", "SESSION", "", 1);
	$password	= getValue("password", "str", "SESSION", "", 1);
	$lang_id		= getValue("lang_id", "int", "SESSION", 1);
	
	// Danh sách category đc phép truy cập
	$list_id		= "";
	$db_category= new db_query("SELECT adm_id, adm_isadmin, adm_access_category
										 FROM admin_user
										 WHERE adm_loginname = '" . $userlogin . "' AND adm_password='******' AND adm_active = 1");
	
	//Check xem user co ton tai hay khong
	if($row = mysql_fetch_array($db_category->result)){
		
		//Neu column adm_isadmin = 1 thi get all category
		if($row["adm_isadmin"] == 1) {
			$db_getall = new db_query("SELECT cat_id FROM categories_multi");
			while($getall = mysql_fetch_array($db_getall->result)){
				$list_id .= $getall["cat_id"] . ",";
			}
			unset($db_getall);
		}
		else{
			preg_match_all('/\[(.*?)\]/is', $row["adm_access_category"], $matches);
			for($i=0; $i<count($matches[1]); $i++){
				$list_id	.= intval($matches[1][$i]) . ",";
			}
		}
		
	}
	
	$db_category->close();
	unset($db_category);
		
	$list_id .= 0;
		
	return $list_id;
	
}
Esempio n. 4
0
function forgetPass($email){
	$email	= replaceMQ($email);
	$user_id		= 0;
	$db_check	= new db_query("SELECT use_id 
										 FROM user_test
										 WHERE use_email = '" . $email . "' AND use_active = 1");
	if(mysql_num_rows($db_check->result) > 0){
		$check	= mysql_fetch_array($db_check->result);
		$user_id	= $check["use_id"];
		$db_check->close();
		unset($db_check);
		return $user_id;
	}
	else{
        ?>
        <script>
            alert('Bạn đã khai báo tên truy cập hoặc email không đúng.');
        </script>
        <?
		$db_check->close();
		unset($db_check);
		return false;
	}
}
Esempio n. 5
0
		$db_ex = new db_execute($myform->generate_update_SQL("con_lang_id",$_SESSION["lang_id"]));
		//echo $myform->generate_update_SQL("con_lang_id",$_SESSION["lang_id"]);
		//Redirect to:
		redirect($_SERVER['REQUEST_URI']);
		exit();
	}
}
//add form for javacheck
$myform->addFormname("setting");
$myform->checkjavascript();
//Select data
$db_data = new db_query("SELECT * FROM configuration WHERE con_lang_id = " . $_SESSION["lang_id"]);
if (mysql_num_rows($db_data->result) > 0)
{
	$row = mysql_fetch_array($db_data->result);
	$db_data->close();
	unset($db_data);
}
else{
	echo "Cannot find data";
	exit();
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<?php 
echo $load_header;
?>
Esempio n. 6
0
	<? if($total_record > $page_size){?>
	<table width="98%" cellpadding="2" cellspacing="2">
		<tr>
			<td class="textBold"><?php 
echo generatePageBar($page_prefix, $current_page, $page_size, $total_record, $url, $normal_class, $selected_class, $previous, $next, $first, $last, $break_type);
?>
</td>
			<td class="textBold" align="right"><a title="Go to top" accesskey="T" class="top" href="#">Lên trên<img align="absmiddle" border="0" hspace="5" src="<?php 
echo $fs_imagepath;
?>
top.gif"></a></td>
		</tr>
	</table>
	<? }?>
	<?
	$db_listing->close();
	unset($db_listing);
	?>
<?
}// End if(isset($arrayData))
?>

</body>
</html>
<script language="javascript">
function change_category(){
	frm = document.create_link;
	frm.submit();
}
function change_file(filename){
	document.getElementById("link_category").value = '<?php 
Esempio n. 7
0
function checkaccessmodule($module_id){
	checkloged();
	$userlogin	= getValue("userlogin", "str", "SESSION", "", 1);
	$password	= getValue("password", "str", "SESSION", "", 1);
	$lang_id		= getValue("lang_id", "int", "SESSION", 1);
	$db_getright = new db_query("SELECT * 
								 FROM admin_user
								 WHERE adm_loginname='" . $userlogin . "' AND adm_password='******' AND adm_active=1 AND adm_delete = 0");
	//Check xem user co ton tai hay khong
	if ($row = mysql_fetch_array($db_getright->result)){
		//Neu column adm_isadmin = 1 thi cho access
		if ($row['adm_isadmin'] == 1) {
			$db_getright->close();
			unset($db_getright);
			return 1;
		}
	}
	//Ko co thi` fail luon
	else{
		$db_getright->close();
		unset($db_getright);
		return 0;
	}
	$db_getright->close();
	unset($db_getright);
	
	//check user
	$db_getright = new db_query("SELECT * 
								 FROM admin_user, admin_user_right, modules
								 WHERE adm_id = adu_admin_id AND mod_id = adu_admin_module_id AND
								 adm_loginname='" . $userlogin . "' AND adm_password='******' AND adm_active=1 AND adm_delete = 0
								 AND mod_id = " . $module_id);
	
	if ($row=mysql_fetch_array($db_getright->result)){	
		$db_getright->close();
		unset($db_getright);
		return 1;
	}
	else{
		$db_getright->close();
		unset($db_getright);
		return 0;
	}
}
Esempio n. 8
0
    /**
	 * db_count::db_count()
	 * 
	 * @param string $sql : Cau lenh sql
	 * @return int so ket qua
	 */
	function db_count($sql){
		$db_ex    = new db_query($sql);
        
		if( $row = mysql_fetch_assoc($db_ex->result)){
			$this->total = intval($row["count"]);
		}else{
			$this->total = 0;
		}
		$db_ex->close();
		unset($db_ex);
		return $this->total;
	}
Esempio n. 9
0
$load_header 			.= '<script language="javascript" src="../../resource/js/tooltip.jquery.js"></script>';
$load_header 			.= '<script language="javascript" src="../../resource/js/jquery.jeditable.mini.js"></script>';
$load_header 			.= '<script language="javascript" src="../../resource/js/swfObject.js"></script>';
$load_header 			.= '<script language="javascript" src="../../resource/js/jwysiwyg/jquery.wysiwyg.js"></script>';

$fs_change_bg			= 'onMouseOver="this.style.background=\'#DDF8CC\'" onMouseOut="this.style.background=\'#FEFEFE\'"';
//phan ngon ngu admin
$db_language			= new db_query("SELECT tra_text,tra_keyword FROM admin_translate");
$langAdmin 				= array();
while($row=mysql_fetch_assoc($db_language->result)){
	$langAdmin[$row["tra_keyword"]] = $row["tra_text"];
}

$db_con = new db_query("SELECT 	con_currency,con_exchange from configuration WHERE con_lang_id=" . $lang_id);
if ($row=mysql_fetch_array($db_con->result)){
	while (list($data_field, $data_value) = each($row)) {
		if (!is_int($data_field)){
			//tao ra cac bien config
			$$data_field = $data_value;
			//echo $data_field . "= $data_value <br>";
		}
	}
}
$db_con->close();
unset($db_con);
$array_value =	array(
                     "nguoimua"=>translate_text("Dành cho người mua")
                  	,"nguoiban"=>translate_text("Dành cho người bán")
                  	,"quydinh"=>translate_text("Quy định")	
                  	);
?>
Esempio n. 10
0
	</tr>
</table>
<script language="javascript">
function formchangepass(){
	if(document.getElementById("adm_password").value==''){
		document.getElementById("adm_password").focus();
		alert("<?php 
echo translate_text("Please enter new password");
?>
");
		return false;
	}
	if(document.getElementById("adm_password").value!=document.getElementById("adm_password_con").value){
		document.getElementById("adm_password_con").focus();
		alert("<?php 
echo translate_text("New password and confirm password is not correct");
?>
");
		return false;
	}
	document.edit_password.submit();
}
</script>
<?php 
echo template_bottom();
?>
</body>
<?
$db_admin_sel->close();
unset($db_admin_sel);
?>
		$con_site_title 		  .= $page != '' ? ' - Trang ' . $page : '';
		$con_meta_description	= $con_site_title;
		$con_meta_keywords		= $con_site_title;	
	}
}

/**
 * Detail News
 */
if(($type == 'news' || $type == 'thongbao') && ($iData != 0 || $sData != '') ){
	
	if($type == 'thongbao'){
		if($iData <= 334){
			$db_thongbao_fix = new db_query("SELECT ntb_new_id FROM news_thongbao WHERE ntb_id = " . $iData . " LIMIT 1");
			if($rowTb = mysql_fetch_assoc($db_thongbao_fix->result)) $iData = $rowTb['ntb_new_id'];
			$db_thongbao_fix->close();
			unset($db_thongbao_fix);
		}
	}
	
	$sql = $iData != 0 ? " AND new_id = " . $iData : " AND new_title_rewrite = '" . $sData . "'";
	$db_news   = new db_query("SELECT new_id, new_category_id, new_title, new_title_rewrite,
											cat_id, cat_name, cat_type
										FROM news
											INNER JOIN categories_multi ON(cat_id = new_category_id AND cat_active = 1)
										WHERE new_active = 1 " . $sql . "
										");
	if($row = mysql_fetch_assoc($db_news->result)){
		$module		= $module == '' ? $row["cat_type"] : $module;
		$iCat			= $iCat == 0 ? $row['new_category_id'] : $iCat;
		$iData		= $iData == 0 ? $row['new_id'] : $iData;
Esempio n. 12
0
	$i++;
	?>
	<tr <? if($i % 2 == 0){ echo "bgcolor='#EEE'"; }else{ echo "bgcolor='#FFF'"; } ?>>
		<td width="30%" nowrap="nowrap">&nbsp;-&nbsp;<b><?php 
echo $value;
?>
</b></td>
		<td>
			<?php 
echo get_config_combo($db_static->result, $key, ${$key});
?>
		</td>
	</tr>
	<?
	}
	$db_static->close();
	unset($db_static);
	?>
	<tr>
		<td>&nbsp;</td>
		<td height="30">
			<input type="button" class="bottom" value="<?php 
echo translate_text("Cập nhật");
?>
" style="cursor:hand; width:100px" onClick="validateForm();">&nbsp;
			<input type="reset" class="bottom" value="<?php 
echo translate_text("Làm lại");
?>
" style="cursor:hand; width:100px">
			<input type="hidden" name="action" value="update">
		</td>
Esempio n. 13
0
	function getOpenNode($table_name,$id_field,$parent_id_field,$parent_id,$where_clause="1",$field_list,$order_clause,$has_child_field,$array_parent_node,$level=0,$callback=0)
	{
		//select menu from database
		$db_menu = new db_query("SELECT " . $field_list . ", " . $has_child_field . " " .
										"FROM " . $table_name . " " .
										"WHERE " . $parent_id_field . "=" . $parent_id . " AND " . $where_clause . " " .
										"ORDER BY " . $order_clause);
		//lap de lay menu					
		while ($row=mysql_fetch_assoc($db_menu->result)){
			//tang so thu tu
			$this->stt++;
			
			//break field_list in to array
			$field_list_arr = explode(",",$field_list);
			//gan gia tri menu vao array
			for ($i=0;$i<count($field_list_arr);$i++){
				$this->menu[$this->stt][$field_list_arr[$i]] = $row[$field_list_arr[$i]];	
			}
			//gan level cho menu
			$this->menu[$this->stt]["level"] = $level;
			$this->menu[$this->stt]["parent"] = 0;
			
			//de quy de lap lai, neu menu_id man trong array cac menu cha
			if (array_search($row[$id_field],$array_parent_node)!==false){
				//thiet lap de biet day la` 1 nut cha
				$this->menu[$this->stt]["parent"] = 1;
				$this->getOpenNode($table_name,$id_field,$parent_id_field,$row[$id_field],$where_clause,$field_list,$order_clause,$has_child_field,$array_parent_node,$level+1,1);
			}
		}
		
		if ($callback==0){
			$db_menu->close();
		}
		unset($db_menu);
		//tra ve gia tri menu
		if ($callback==0) return $this->menu;
	}
Esempio n. 14
0
echo $cat["cat_name"];
?>
</li>
						<?
						}
						?>
					</ul>
				</td>
			</tr>
			</tbody>
			<tr valign="baseline"> 
			<td nowrap align="right"> </td>
			<td> <input type="button" class="bottom" onClick="document.add_user.submit();" value="<?php 
echo translate_text("Cập nhật");
?>
"> 
			</td>
			</tr>
			</table>
			<input type="hidden" name="Action" value="insert">
			</form>
		<? /*---------Body------------*/ ?>
<?php 
echo template_bottom();
?>
<? /*------------------------------------------------------------------------------------------------*/ ?>
</body>
<?
$db_getallmodule->close();
unset($db_getallmodule);
?>