Exemplo n.º 1
0
Arquivo: card.php Projeto: nikuha/rs
}
function check_client($client_id)
{
    $sql = mysql_query("SELECT count(*) FROM " . TABLE_ORDER . " WHERE FIND_IN_SET({$client_id}, clients)") or Error(1, __FILE__, __LINE__);
    $arr = @mysql_fetch_array($sql);
    return (int) @$arr[0];
}
if (@$del_client) {
    $del_client = (int) $del_client;
    if (check_client($del_client)) {
        $_SESSION['message'] = "Клиент  не может быть удален!";
        Header("Location: ?p={$part}&client");
        exit;
    }
    mysql_query("DELETE FROM " . TABLE_CLIENT . " WHERE client_id='{$del_client}'") or Error(1, __FILE__, __LINE__);
    renew_clients($root_dir);
    Header("Location: ?p={$part}&client");
    exit;
}
if (@$_FILES["pricefile"]) {
    $url = "?p={$part}&card_id={$card_id}";
    load_file($file_owner, $card_id, $url);
    Header("Location: " . $url);
    exit;
}
if (@$delfile) {
    $file_id = (int) @$delfile;
    del_file($file_id);
    Header("Location: " . ADMIN_URL . "?p={$part}&card_id={$card_id}");
    exit;
}
Exemplo n.º 2
0
Arquivo: func.php Projeto: nikuha/rs
function add_to_clients($name, $email, $phone)
{
	$sql = mysql_query("SELECT * FROM ".TABLE_CLIENT." WHERE name='$name'") or Error(1, __FILE__, __LINE__);
	if($client = @mysql_fetch_array($sql)) 
	{
		$client_id = $client['client_id'];
	}
	else
	{
		mysql_query("INSERT INTO ".TABLE_CLIENT." SET name='$name', phone='$phone', email='$email'") or Error(1, __FILE__, __LINE__);
		$client_id = mysql_insert_id();
		renew_clients($root_dir);
	}
		
	$arr = @unserialize($_SESSION['form_data']);
		
	$client_arr = @$arr['clients'] ? explode(",", $arr['clients']) : array();
	if(!in_array($client_id, $client_arr))	$client_arr[] = (int)$client_id;
	$arr['clients'] = implode(",",$client_arr);
	$arr['clients'] = preg_replace("/^,/", '', $arr['clients']);
	
	$_SESSION['form_data'] = serialize($arr);
	
	return $arr['clients'];
}