<?php if (!login()) { echo "<div class='box warning'>로그인을 하십시오.</div>"; return; } $company = company()->load(hi('id')); if (!$company) { echo "<div class='box warning'>업소 정보가 존재하지 않습니다.</div>"; return; } if (empty($company->get('username')) || $company->username != login()->username) { echo "<div class='box warning'>삭제 실패 : 회원님의 업소가 아닙니다.</div>"; return; } $company->delete(); ?> <h1>업소록 삭제</h1> 업소록 정보가 삭제되었습니다.
/** * * This adds * * - 'code'=0 * - 'username' = "login username ONLY IF the user is logged in" * - 'route'='route path' * * * @param array $data - array of data to echo in JSON string. * @return array */ function response_success($data = array()) { if (login()) { $data['username'] = login()->username; } $data['route'] = hi('route'); $data['code'] = 0; return $data; }
echo HtmlInput::submit('mod', 'modifie'); echo $w->input($_REQUEST['ac'], 'ac'); //echo $w->input($sa,'sa'); echo "</form>"; echo "</TD>"; echo '</TR>'; } echo "</table>"; // modify input if (isset($_POST['mod'])) { extract($_POST); echo '<div style="float:left;padding:2%">'; echo _("Voulez-vous modifier ?"); echo "<br><font color=\"red\"> "; echo _("Attention, ne changer pas la signification de ce poste."); echo hi(_("par exemple ne pas changer Client par fournisseur")) . "<br>"; echo _("sinon le programme fonctionnera mal, " . "utiliser uniquement des chiffres pour la classe de base ou rien") . "</font>"; $mod = new Fiche_Def_Ref($cn); $mod->frd_id = $idx; $mod->Get(); echo '<form method="post">'; echo '<ul style="list-style-type:none"'; echo $mod->Input(); echo "</ul>"; $w = new IHidden(); echo $w->input('ac', $_REQUEST['ac']); // echo $w->input('sa',$sa); echo HtmlInput::submit('confirm_mod', 'Confirme'); echo HtmlInput::submit('no', 'Cancel'); echo '</form>'; echo '</div>';
public function categoryDelete() { $id = hi('id'); if (empty($id)) { return ERROR(-457, 'Input category id'); } $c = category()->load($id); if (empty($c)) { return ERROR(-458, "Category by that id - {$id} does not exists."); } category()->load($id)->delete(); return SUCCESS(); }
if ($action == "view") { $l_Db = sprintf("dossier%d", $gDossier); $return = HtmlInput::button_anchor('Retour à la liste', '?&ac=' . $_REQUEST['ac'] . '&' . dossier::get(), 'retour'); $repo = new Database(); $User = new User($repo, $_GET['user_id']); $admin = 0; $access = $User->get_folder_access($gDossier); $str = "Aucun accès"; if ($access == 'R') { $str = ' Utilisateur normal'; } if ($User->admin == 1) { $str = ' Administrateur'; $admin = 1; } echo '<h2>' . h($User->first_name) . ' ' . h($User->name) . ' ' . hi($User->login) . "({$str})</h2>"; if ($_GET['user_id'] == 1) { echo '<h2 class="notice"> Cet utilisateur est administrateur, il a tous les droits</h2>'; echo "<p> Impossible de modifier cet utilisateur dans cet écran, il faut passer par\n\t\t\tl'écran administration -> utilisateur.\n\t\t\t</p>"; echo $return; return; } // // Check if the user can access that folder if ($access == 'X') { echo "<H2 class=\"error\">L'utilisateur n'a pas accès à ce dossier</H2>"; echo "<p> Impossible de modifier cet utilisateur dans cet écran, il faut passer par\n\t\t\tl'écran administration -> utilisateur.\n\t\t\t</p>"; echo $return; $action = ""; return; }
<?php $id = hi('id'); $owner = $code = $date_from = $date_to = $active = $list_order = $subject = $url = $fid = $url_banner = ''; if ($id) { $banner = banner($id); $owner = $banner->get('owner'); $code = $banner->get('position'); $date_from = $banner->get('date_from'); $date_to = $banner->get('date_to'); $active = $banner->get('active'); $list_order = $banner->get('list_order'); $subject = $banner->get('subject'); $url = $banner->get('url'); if ($fid = $banner->get('fid')) { if ($data = data($banner->get('fid'))) { $url_banner = $data->get('url'); } } } ?> <style> [name="code"] { padding:.6em; box-sizing: border-box; width:100%; } .c-indicator { background-color: #c6bf93; left:auto; right:-20px;
echo '<table style="width:100%;margin-left:0%">'; foreach ($a_poste as $poste_id) { $Poste = new Acc_Account_Ledger($cn, $poste_id['pcm_val']); $Poste->load(); $Poste->get_row_date($_GET['from_periode'], $_GET['to_periode'], $_GET['ople']); if (empty($Poste->row)) { continue; } echo '<tr><td class="mtitle" style="width:auto" colspan="6"><h2 class="title">' . $poste_id['pcm_val'] . ' ' . h($Poste->label) . '</h2></td></tr>'; $detail = $Poste->row[0]; $old = array(); foreach ($Poste->row as $detail) { /* avoid duplicates */ if (in_array($detail['jr_id'], $old) == TRUE) { continue; } $old[] = $detail['jr_id']; echo tr(td("Journal :" . $detail['jrn_def_name'], ''), 'style="width:auto" colspan="6"'); echo '<tr><td class="mtitle" style="width:auto" colspan="6">' . $detail['j_date'] . ' ' . $detail['jr_internal'] . ' ' . hb($detail['description']) . ' ' . hi($detail['jr_pj_number']) . '</td></tr>'; $op = new Acc_Operation($cn); $op->poste = $poste_id['pcm_val']; $op->jr_id = $detail['jr_id']; echo $op->display_jrnx_detail(1); } } echo '</table>'; echo Acc_Account_Ledger::HtmlTableHeader(); } exit; } }
<html> <head> <title> include php file </title> </head> <body> <?php include "include_func.php"; ?> <?php hello(everyone); hi(shanu); add(10, 25); add(15); ?> </body> </html>
} foreach (sys()->getPathUserModel() as $path) { $init = "{$path}/init.php"; if (file_exists($init)) { include $init; } } /** ---------------------------- Run Test Codes If 'php index.php test' is run --------------------------- * * * * Run unit test. * * * */ if (isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'test') { sys()->runTest(); } /** * * @short Running 'Route'. This runs route. It can be accessed through HTTP or CLI. * * * * * */ if (hi('route')) { route()->run(hi('route'), hi()); }
/** * * * * It checks the username and signature of HTTP input. * * @note it does not check any thing if there is no username and signature. * * @Attention it does NOT stop the run time even though the user's signature does not match with his username. * * */ if (hi('username') && hi('signature')) { $user = user(hi('username')); if ($user) { if ($user->signature() == hi('signature')) { $user->setLogin(); } //else response( ERROR(-40112, "Signature does not match")); } //else response(ERROR(-40111, "User not found.")); } else { // response(ERROR(-40113, "username and signature not provided.")); } /** * * * Returns user object. * * *
private function ajaxUpload() { if (!hi('owner')) { json_error(-400009, "광고주를 입력하십시오."); } if (!hi('code')) { json_error(-400009, "광고 위치를 선택하십시오."); } //if ( ! hi('fid') ) json_error(-400009, "배너 사진을 올리십시오."); if (!hi('date_from')) { json_error(-400009, "광고 시작 날짜를 선택하십시오."); } if (!hi('date_to')) { json_error(-400009, "광고 끝 날짜를 선택하십시오."); } if (!hi('subject')) { json_error(-400009, "광고 제목을 입력하십시오."); } if (!hi('url')) { json_error(-400009, "광고 페이지 URL 을 입력하십시오."); } if (hi('id')) { $banner = new Philgo_banner(); $banner->load(hi('id')); } else { $banner = new Philgo_banner(); $banner->create(); } if (hi('fid')) { data(hi('fid'))->finish(); $banner->set('fid', hi('fid')); } $banner->set('position', hi('code'))->set('owner', hi('owner'))->set('active', hi('active'))->set('date_from', hi('date_from'))->set('date_to', hi('date_to'))->set('subject', hi('subject'))->set('list_order', hi('list_order'))->set('url', hi('url'))->save(); json_success(array('id' => $banner->get('id'))); }
public function edit($in) { if (!login()) { return ERROR(-400201, "Login first"); } $sets = array(); if (isset($in['password']) && !empty($in['password'])) { $sets['password'] = password_encrypt($in['password']); } $sets['email'] = $in['email']; $sets['first_name'] = hi('first_name', ''); $sets['middle_name'] = hi('middle_name', ''); $sets['last_name'] = hi('last_name'); $sets['mobile'] = hi('mobile', ''); $sets['landline'] = hi('landline', ''); $sets['address'] = hi('address'); $sets['updated'] = time(); $login = login()->puts($sets); if (empty($login)) { return ERROR(-400204, "Update failed."); } return SUCCESS(); }
<?php $category = category(hi('cid')); $category_name = $category->code; $category_comment = $category->value; $category_id = $category->id; $count_company = company()->count("category={$category_id}"); ?> <style> .companies { } .companies .company { margin:.4em 0; background-color:#efefef; } </style> <h2> <?php echo $category->code; ?> </h2> <h3> <?php echo $category->value; ?> </h3> <div class="desc"> 총 <?php echo $count_company; ?>
/** * * It nd removes the previously uploaded file with same 'gid' and 'code'. * * 이전에 업로드한 'gid' 와 'code' 의 파일을 지운다. * * 동일한 'gid', 'code' 의 파일을 하나만 유지하고자 하는 경우에 사용하면 된다. * * @usage Use this method when you want to upload a file and maintain only the newly uploaded file by deleting previously uploaded file with same 'gid' and 'code' * * * * * @return array * * */ public function fileDeleteUnique($gid = null, $code = null) { $gid = $gid ? $gid : hi('gid'); $code = $code ? $code : hi('code'); $files = data()->loadQuery("gid='{$gid}' AND code='{$code}'"); sys()->log($files); if ($files) { foreach ($files as $file) { sys()->log($file); $file->delete(); } } }
} $names = array('Jack', 'Steve', 'David'); Hello($names); /* Return functions: for storing a functions value and ending a function's exectution so that it can be called upon later. Function's default arguments: defining an arguments value within the confines of the parentheses, removing the need to define the variable later e.g. $trife. */ function hi($dude, $trife = 'trouble') { return "Sup {$dude}, I see you got into some {$trife}."; } $poo = hi('Eric'); echo $poo, "</br>"; function add_up($a, $b) { return $a + $b; } $value = add_up(2, 4); echo $value, "</br>"; /* Variable functions: Using a variable's value, in this case a string to call a function of the same name. */ $func = 'add_up'; echo $func(2, 5), "</br>"; /* Closure (anonymous functions): Closures are anonymous
<?php $key = hi('keyword'); $companies = company()->loadQuery("ceo_name LIKE '%{$key}%' OR company_name LIKE '%{$key}%' OR title LIKE '%{$key}%'"); $count = count($companies); ?> <style> .companies { } .companies .company { margin:.4em 0; background-color:#efefef; } </style> <?php if ($count == 0) { return; } display_companies($companies);
alert "密码不能为空" else frm.submit end if end sub </script> </head> <body> <?php function hi() { //函数 echo "Helloworld<br>"; } hi(); ?> <br> <?php $arr = array(1, 5, 8, 8, 7); foreach ($arr as $value) { echo $value . "<br>"; } function bj($a, $b) { if ($a > $b) { return $a - $b; } else { return $b - $a; } }
} } echo "Test1" . EOL; $test = Hello::getIns("xiaohong"); $say1 = new ProxyMethod($test); $say1->hi("Miss."); // Hi, Miss. xiaohong! $say1::hello("Miss."); // Hello, Miss. xiaohong! $say1->test(); // test inheritance $say1::staticTest(); // test inheritance, static $say1->export("hello"); $say1->export("hi"); hi($test, "Miss."); // Hi, Miss. xiaohong! hello("Miss."); // Hello, Miss. xiaohong! echo EOL2; echo "Test2" . EOL; $say2 = new ProxyMethod("Hello", "xiaoming"); $say2->hi("Mr."); // Hi, Mr. xiaoming! $say2::hello("Mr."); // Hello, Mr. xiaoming! $say2->test(); // test inheritance $say2::staticTest(); // test inheritance, static $say2->alias("hi", "nihao1");