本文整理汇总了PHP中clear函数的典型用法代码示例。如果您正苦于以下问题:PHP clear函数的具体用法?PHP clear怎么用?PHP clear使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了clear函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteProject
function deleteProject($path, $pathToFile)
{
unlink($pathToFile);
clear($path);
rmdir($path . 'RENDER_DATA/');
rmdir($path);
return json_encode(array('code' => 0));
}
示例2: enable
function enable($profiletext)
{
$fileProfileDir = "Output/Profiles/" . $profiletext . "/profile.txt";
if (file_exists($fileProfileDir)) {
clear($profiletext);
copy($fileProfileDir, 'Output/CurrentProfile/profile.txt');
$message = shell_exec("Scripts/snortreboot.sh 2>&1");
print_r($message);
} else {
// code when file not found
}
}
示例3: add_top_name
function add_top_name($thelist = "")
{
$filllist = array();
if (is_array($thelist)) {
foreach ($thelist as $kk => $vv) {
//clear();
$filllist['names'] .= $filllist['names'] ? "@||@|@" . clear($vv) : clear($vv);
$filllist['ids'] .= $filllist['ids'] ? ",{$kk}" : $kk;
}
}
return $filllist;
}
示例4: edit
function edit()
{
// neu co nhap pass thi lay gia tri moi, kho se lay gia tri ban dau
if ($_POST['confirm_password'] != '') {
$password = md5(trim($_POST['username']) . trim($_POST['confirm_password']));
} else {
$password = clear($_POST['resetpass']);
}
$input = array('full_name' => clear($_POST['full_name']), 'email' => clear($_POST['email']), 'status' => intval($_POST['status']), 'password' => $password, 'permission' => clear($_POST['permission']));
$this->db->update_record($this->table, $input, $this->key . '=' . intval($_GET['id']));
security::redirect($this->module, 'list');
}
示例5: log_in
function log_in($log = '', $log_name = '', $log_pass = '')
{
//normalni prihlaseni bez parametru, s parametry je autoprihlaseni pri registraci
if (!$log) {
$log = clear("log");
$log_name = clear("log_name");
$log_pass = clear("log_pass");
$permanent = clear("permanent");
}
$msg = $_SESSION["msg"];
if ($log) {
$sql = sql_query("select id, pass\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfrom users\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twhere (nick = '{$log_name}')");
$data = sql_fetch_object($sql);
$db_pass = $data->pass;
$id = $data->id;
if (!$data->id) {
$msg->set_text($l->t("bad_login"), "error");
redirect($l->l("prihlaseni"));
}
$log_pass = md5(md5(md5(md5(md5($log_pass)))));
if ($log_pass == $db_pass) {
$me = new me($data->id);
$uid = $data->id;
$_SESSION['me'] = $me;
$_SESSION['uid'] = $uid;
//ulozeni trvaleho prihlaseni
if ($permanent) {
$hash = time();
$a = rand();
$hash = $id . "" . $time . "" . $a;
$hash = md5(md5(md5(md5(md5(md5($hash))))));
$sql = sql_query("insert into permanent_login\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(user, hash_id)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalues\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t('{$id}', '{$hash}')");
if ($sql) {
$time = time();
$time = $time + 3600 * 24 * 60;
setcookie("permanent_login", "{$id}:{$hash}", $time);
}
}
//nastaveni ze jsem se prihlasil
$sql = sql_query("update users set logged = 'yes'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twhere (id = '" . $_SESSION['me']->uid . "')");
if ($self == "/objednavka.php") {
redirect("objednavka");
}
//defaultni presun zpet na stejnou stranku (aby nebyly back post data)
$this_url = $_SERVER["REQUEST_URI"];
redirect($this_url);
} else {
$msg->set_text($l->t("bad_login"), "error");
redirect($l->l("prihlaseni"));
}
}
}
示例6: edit
function edit()
{
$image = clear($_POST['image']);
if ($_FILES['file']['name']) {
if ($_POST['image']) {
unlink($this->pathadm . $_POST['image']);
unlink($this->pathadm . 'resize/' . $_POST['image']);
}
$upload = new upload();
$upload->process($_FILES['file'], $this->pathadm, $this->max_width);
$image = clear($upload->name);
}
$input = array('name' => clear($_POST['name']), 'alias' => clear($_POST['alias']), 'cha_id' => intval($_POST['cha']), 'cat_id' => intval($_POST['cat']), 'special' => intval($_POST['special']), 'description' => clear($_POST['description']), 'detail' => clear($_POST['detail']), 'image' => $image, 'cards_list' => @implode(',', $_POST['cards']), 'ordering' => (int) $ordering, 'card_slogan' => clear($_POST['card_slogan']));
$this->db->update_record($this->table, $input, $this->key . '=' . $_GET['id']);
security::redirect($this->module, 'list');
}
示例7: login
function login()
{
$this->check_pin();
$db = new database();
global $sitelink;
$select = "user_id,username, password, permission";
$table = "8x_user";
$where = 'status = 1 && username = \'' . clear($_POST['log_username']) . '\' && password = \'' . md5(clear($_POST['log_username'] . $_POST['log_password'])) . '\'';
$row = $db->detail($table, $select, $where);
if (intval($row['user_id']) > 0 && $row['username'] !== '') {
$_SESSION['username'] = $row['username'];
$_SESSION['user_id'] = $row['user_id'];
$_SESSION['permission' . $sitelink] = $row['permission'];
}
header_redirect('');
}
示例8: try_login
function try_login()
{
//defaultni vypis problemu s prihlasenim
$l = new lang("layout");
$msg = new msg();
//pokud nam google vrati code, muzeme se autentifikovat a ziksat token
$code = clear("code");
if ($code) {
$this->client->authenticate();
$this->token = $this->client->getAccessToken();
}
/*
//kdybychom chteli na nejake jine strance zase s uctem u googlu pracovat
// musimve vytvorit to spojeni a pomoci se token ze session se autorizovat u googlu
//ale mi tady session token nulujeme, takze uz se dal pouzit neda
if ($_SESSION['token']) {
$this->client->setAccessToken($_SESSION['token']);
}
//kdyz ho chceme ziskat
$_SESSION['token'] = $this->client->getAccessToken();
*/
if ($this->token) {
$my_data = $this->plus->people->get('me');
$gp_id = $my_data['id'];
//nyni mame udaje o uzivateli
//pokusime se zjistit, zda-li jiz v databazi nekdo takovy je (gp_id)
$sql = sql_query("select id, nick from users\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twhere (gp_id = '" . $gp_id . "')");
$data = sql_fetch_object($sql);
//jiz v databazi existuje
if ($data->id) {
$_SESSION['uid'] = $data->id;
$_SESSION['me'] = new me($data->id);
$_SESSION['me']->homepage_redirect();
} else {
$new_login = $this->create_login($my_data);
if ($new_login) {
$_SESSION['uid'] = $new_login[0];
$_SESSION['me'] = new me($new_login[0]);
//prvotni presun po registraci na nastaveni a doplneni udaju
header("location: " . $l->l("osobni-udaje") . "?first=true");
return true;
}
}
}
$msg->set_text($l->t("bad_gplus_login"), "error");
redirect($l->l("prihlaseni"));
}
示例9: set
function set($products)
{
$user = \cf\User::getLoggedIn();
if ($user) {
clear();
$cartId = create();
$q = \cf\createQuery('INSERT INTO cf_products_in_cart (cart_id,product_id,amount) VALUES(:cid,:pid,:amt)');
foreach ($products as $id => $qty) {
$q->setParam('cid', $cartId);
$q->setParam('pid', $id);
$q->setParam('amt', $qty);
$q->execute();
}
} else {
$c = create();
$c->setParam('ready', $products);
$c->set();
}
return getList();
}
示例10: save
function save()
{
if ($_SESSION['member_id'] != '') {
$ma_nhanvien = $_SESSION['member_id'];
} else {
$ma_nhanvien = 1;
}
$input_order = array('customer' => clear($_POST['name']), 'ma_nhanvien' => $ma_nhanvien, 'ma_website' => $_POST['maweb'], 'company' => clear($_POST['company']), 'address' => clear($_POST['address']), 'mobile' => clear($_POST['tel']), 'email' => clear($_POST['email']), 'yahoo' => clear($_POST['nick_yahoo']), 'skype' => clear($_POST['nick_skype']), 'tenmien' => clear($_POST['tenmien']), 'tenmien_sudung' => clear($_POST['tenmien_sudung']), 'hotro' => clear($_POST['hotro']), 'hosting' => clear($_POST['hosting']), 'giaodien' => clear($_POST['giaodien']), 'logo' => clear($_POST['logo']), 'banner' => clear($_POST['banner']), 'ten_cty_banner' => clear($_POST['ten_cty_banner']), 'slogan' => clear($_POST['slogan']), 'note' => clear($_POST['thongtinkhac']), 'banquyen' => $_POST['banquyen'], 'date_up' => date('Y-m-d h:m:s'));
if (!$this->db->insert_record($this->table, $input_order)) {
// get order_id of order
$row = $this->db->detail($this->table, $this->key, '', $this->key . " DESC");
$order_id = $row[$this->key];
$input_order_detail = array('order_id' => $order_id, 'pro_price' => $_POST['gia'], 'pro_id' => $_POST['maweb'], 'chiphitamtinh' => $_POST['chiphitamtinh'], 'quantity' => '1');
if (!$this->db->insert_record($this->table_detail, $input_order_detail, 0)) {
echo "success";
} else {
echo "Cannot insert order detail.";
}
//Staff mail
if ($_SESSION['member_email'] != '') {
$to = $_SESSION['member_email'];
$subject = 'Web Mail - New order.';
$message = '
<p>Hello <b>' . $_SESSION['member_name'] . '</b>!</p>
<p>Order code<b>' . $order_id . '</b> has been sent. please visit <a href="http://url/admin" target="_blank">http://url/admin</a>
for details.
</p>
<p>
(c)2010 - @@sitename@@ - http://url
</p>
';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'From: @@emailaddress@@' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
@mail($to, $subject, $message, $headers);
}
} else {
echo "Cannot insert order.";
}
}
示例11: makeContent
function makeContent($currentPage)
{
$PAGES_DIR = './pages/';
$PORTIONS_DIR = './htmlPortions/';
$key = makePageKey($currentPage);
echo "<!DOCTYPE html>\n";
echo "<html>";
include_once $PORTIONS_DIR . 'head.html';
echo "<body>";
include_once $PORTIONS_DIR . 'banner.html';
clear();
makeNav($key, $PAGES_DIR);
clear();
echo "<div id=\"page\"><div id=\"pageContent\">";
include_once $PAGES_DIR . $key . '.html';
echo "</div>";
include_once $PORTIONS_DIR . 'sidebar.html';
echo "</div>";
clear();
echo "<div id=\"footer\">Software and website by <a href=\"http://quentelery.users.sourceforge.net\">Quentin Geissmann</a><br>Website hosted by <a href='http://sourceforge.net'>sourceforge</a></div></body></html>";
}
示例12: edit
function edit()
{
$image = clear($_POST['image']);
$assign_banner = clear($_POST['assign_banner']);
if ($_FILES['file1']['name']) {
if ($_POST['image']) {
unlink($this->pathadm . $_POST['image']);
unlink($this->pathadm . 'resize/' . $_POST['image']);
}
$upload1 = new upload();
$upload1->process($_FILES['file1'], $this->pathadm, $this->max_width);
$image = clear($upload1->name);
}
$my_top = isset($_POST['top_name']) ? $this->add_top_name($_POST['top_name']) : clear($_POST['top_type_name']);
$topname = isset($my_top['names']) ? $my_top['names'] : $my_top;
$toplist = isset($my_top['ids']) ? $my_top['ids'] : "";
$topname2 = isset($_POST['top_type_name2']) ? $_POST['top_type_name2'] : "";
$input = array('name' => clear($_POST['name']), 'alias' => clear($_POST['alias']), 'head_name' => clear($_POST['head_name']), 'status' => intval($_POST['status']), 'top_list' => $toplist, 'top_type_name' => $topname, 'top_type_name2' => $topname2, 'icon_on' => intval($_POST['iconchk']), 'header_text' => clear($_POST['header_text']), 'footer_text' => clear($_POST['footer_text']), 'ordering' => intval($_POST['ordering']), 'cards_list' => implode(',', $_POST['cards']), 'sapxep' => implode(',', $_POST['sapxep']), 'title' => clear($_POST['title']), 'keyword' => clear($_POST['keyword']), 'destination' => clear($_POST['destination']), 'assign_banner' => clear($_POST['assign_banner']), 'banner' => intval($_POST['banner']), 'featured' => intval($_POST['featured']), 'image' => $image, 'card_slogan' => clear($_POST['card_slogan']));
$this->db->update_record($this->table, $input, $this->key . '=' . intval($_GET['id']));
security::redirect($this->module, 'list_types');
}
示例13: edit
function edit()
{
$image = clear($_POST['image']);
if ($_FILES['file1']['name']) {
if ($_POST['image']) {
unlink($this->pathadm . $_POST['image']);
unlink($this->pathadm . 'resize/' . $_POST['image']);
}
$upload1 = new upload();
$upload1->process($_FILES['file1'], $this->pathadm, $this->max_width);
$image = clear($upload1->name);
}
$result = $this->db->query("SELECT tbl_id,alias FROM 8x_cards_bank WHERE tbl_id='" . (int) $_POST['assign_bank'] . "' LIMIT 1 ");
$rowdata = $this->db->fetch_assoc($result);
//var_dump($image); exit;
if (isset($rowdata['tbl_id']) && $rowdata['tbl_id']) {
$alias = isset($rowdata['alias']) ? $rowdata['alias'] : "";
$input = array('tbl_id' => $rowdata['tbl_id'], 'name' => clear($_POST['name']), 'alias' => clear($alias), 'destination' => clear($_POST['destination']), 'ordering' => intval($_POST['ordering']), 'status' => intval($_POST['status']), 'image' => $image);
$this->db->update_record($this->table, $input, $this->key . '=' . intval($_GET['id']));
}
security::redirect($this->module, 'list_issuers');
}
示例14: init
/**
* Initialise l'application
*/
public static function init()
{
clear();
while (self::$continue === true) {
$input = null;
self::showHelp();
// L'utilisateur doit rentrer un numéro de commande
while ($input === null || $input < 0 || $input >= count(self::$choices)) {
$input = ask('Numéro de commande : ');
}
$command = self::$choices[$input];
// Le numéro est valide, on execute la commande
clear();
echo 'Vous avez choisi la commande : "' . $command['text'] . '"' . PHP_EOL;
self::exec($command);
// Est-ce que l'utilisateur veut continuer ?
$input = ask('Voulez-vous continuer ? (O/n) ');
if ($input === 'n') {
self::$continue = false;
}
clear();
}
}
示例15: clear
function clear()
{
global $user, $mysql, $log, $msg;
if (!isset($_POST['confirm_pass'])) {
$data = '<p>Bitte geben Sie zur Bestätigung ihr Passwort ein:</p>
<form action=' . $_SERVER['REQUEST_URI'] . ' method=post>
<input type=password name=confirm_pass />
<input type=submit value=Löschen />
</form>';
} else {
if (!($user->password == sha1($_POST['confirm_pass']))) {
$msg->error("Ihr Passwort ist Falsch");
//Confirmpass unset damit formular angezeigt wird.
unset($_POST['confirm_pass']);
$data = clear();
} else {
$mysql->query("DELETE FROM " . _PREFIX_ . "log");
$log->add("Aktionschronik vollständig gelöscht");
$msg->success("Aktionschronik vollständig gelöscht.");
$data = showlog();
}
}
return $data;
}