Ejemplo n.º 1
0
 /**
 * Go to specific step
 *
 * @access public
 * @param integer $step Step instance or step number
 * @return boolean
 */
 function goToStep($step) {
   if(!($step instanceof ScriptInstallerStep)) $step = $this->getStep($step);
   if(!($step instanceof ScriptInstallerStep)) {
     die("Step '$step_number' does not exist in the installation process");
   } // if
   redirect_to($step->getStepUrl());
 } // goToStep
Ejemplo n.º 2
0
 public function clear_log()
 {
     file_put_contents($this->file_name, "");
     $this->new = true;
     $this->add_entry($_SESSION['user_id'], 'Log Cleared', 'log cleared');
     redirect_to('logs.php?type=' . $this->type);
 }
Ejemplo n.º 3
0
function confirm_login()
{
    if (isset($_SESSION['staff_id']) || isset($_SESSION['user_id'])) {
    } else {
        redirect_to("index.php");
    }
}
Ejemplo n.º 4
0
 public function index($mid = 1)
 {
     $ticketlist = "";
     if (empty($mid)) {
         redirect_to($this->uri->link("error/index"));
         exit;
     }
     $this->loadModel("Support");
     $datum = $this->model->getList("", "Support");
     $this->view->mytickets = $datum['Supportticket'];
     $uri = new Url("");
     $ticketlist .= "<table class='pure-table'  width='100%'>\n\t\t\t<thead><tr>\n\t\t\t\t<th width='10%'>Date</th><th width='5%'>ticketID</th><th width='50%'>Subject</th><th width='10%'>Status </th><th width='10%'>Department </th><th width='12%'>Date Modified </th><th width='5%'></th>\n\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>";
     if ($this->view->mytickets) {
         $x = 1;
         foreach ($this->view->mytickets as $ticket) {
             $ticketlist .= "<tr>\n\t\t\t\t\t<td>" . date_format(new DateTime($ticket->datecreated), "M d Y H:i:s") . "</td><td>{$ticket->id}</td><td>{$ticket->subject} </td><td>{$ticket->status}</td><td>{$ticket->department}</td><td>{$ticket->datemodified}</td><td><a href='" . $uri->link("support/detail/" . $ticket->id . "") . "'>View Ticket</a></td>\n\t\t\t\t</tr>";
             $x++;
         }
     } else {
         $ticketlist .= "<tr><td colspan='7'>No record to display</td></tr>";
     }
     $ticketlist .= "</tbody>\n\t\t\t</table>";
     $this->view->myvends = $ticketlist;
     $this->view->render("support/index");
 }
 public function validateUser($username, $password)
 {
     global $db;
     if ($this->validateUsername($username) && $this->validatePassword($password)) {
         // success
         if ($db->has_rows($result = $db->user_name_exists($this->username))) {
             $result = $db->fetch_array($result);
             //print_r($result);
             if (password_verify($this->password, $result['user_password'])) {
                 $_SESSION['user_id'] = $result['user_id'];
                 $_SESSION['username'] = $result['user_name'];
                 $_SESSION['permission'] = $result['permission'];
                 // the following checks to see if the response is an Ajax response.
                 if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
                     // ajax message
                     echo false;
                 } else {
                     redirect_to('../public/workshop.php');
                 }
             } else {
                 echo $this->errors[] = "Incorrect password";
             }
         } else {
             $this->password = "";
             echo $this->errors[] = "No such username exists";
         }
     }
 }
Ejemplo n.º 6
0
 function welcome()
 {
   $name = params('name');
   
   if(empty($name))      halt(NOT_FOUND, "Undefined name.");
   switch($name)
   {
     case "bill":
     trigger_error('No bill please', E_USER_WARNING);
     break;
     
     case "leland":
     halt('Fire walk with me', E_USER_ERROR);
     break;
     
     case "bob":
     halt(HTTP_UNAUTHORIZED, "no, go away!", array(1,2,3));
     break;
     
     case "david":
     redirect_to('/');
     break;
     
     default:
     trigger_error("Not sure $name lives in Twin Peaks", E_USER_NOTICE);
     # E_USER_NOTICE doesn't stop app execution
     break;
   } 
   return html("Welcome $name");
 }
Ejemplo n.º 7
0
 public function create_user($first_name, $last_name, $username, $password, $confirm_password)
 {
     global $database;
     $errors = array();
     // $dfirst_name = "";
     // $dlast_name = "";
     // $dusername = "";
     // $dpassword = "";
     // $dconfirm_password = "";
     // $demail = "";
     if (empty($first_name)) {
         $errors[] = "You forgot to enter your first name.";
     } else {
         $first_name = $database->escape_value($first_name);
     }
     if (empty($last_name)) {
         $errors[] = "You forgot to enter your last name.";
     } else {
         $last_name = $database->escape_value($last_name);
     }
     if (empty($username)) {
         $errors[] = "You forgot to enter your username.";
     } else {
         $username = $database->escape_value($username);
     }
     if (empty($password)) {
         $errors[] = "You forget to enter your password.";
     } else {
         $password = $database->escape_value($password);
     }
     if (empty($confirm_password)) {
         $errors[] = "You forgot to enter your confirm password.";
     } else {
         $confirm_password = $database->escape_value($confirm_password);
     }
     if ($password !== $confirm_password) {
         $errors[] = "You password and confirm password do not match.";
     } else {
         $confirm_password = $database->escape_value($confirm_password);
     }
     if (empty($errors)) {
         $sql = " INSERT INTO users ( username , password, first_name, last_name )  VALUES ( '{$username}', '{$password}', '{$first_name}', '{$last_name}' ) ";
         if ($database->query($sql)) {
             //will return a true or false as this is an insert query...
             // get the last id inserted into the DB
             $this->id = $database->insert_id();
             $_SESSION['registered'] = "You have been successfully registered.";
             redirect_to('registration.php');
             return true;
         } else {
             return false;
         }
     } else {
         echo "<br><br><br><br><br><h4 class='text-center'>There were some errors!</h4>\n\n\t\t\t\t<p class='text-center'>The following error(s) occurred: ><br>";
         foreach ($errors as $error) {
             echo " - {$error}<br>\n";
         }
         echo "</p>";
     }
 }
Ejemplo n.º 8
0
 public function index($mid = 1)
 {
     $productlist = "";
     if (empty($mid)) {
         redirect_to($this->uri->link("error/index"));
         exit;
     }
     $this->loadModel("Clientproduct");
     $datum = $this->model->getList("", "Clientproduct");
     $this->view->myclientsproducts = $datum['clientproduct'];
     $uri = new Url("");
     $productlist .= "<table  width='100%'>\n            <thead><tr>\n            \t<th>S/N</th><th>Product </th><th>Client</th><th>Location</th><th>City </th><th></th><th></th>\n            </tr>\n            </thead>\n            <tbody>";
     if ($this->view->myclientsproducts) {
         $x = 1;
         foreach ($this->view->myclientsproducts as $products) {
             $productlist .= "<tr>\n                \t<td>{$x}</td><td><a href='" . $uri->link("clientproduct/detail/" . $products->id) . "'>{$products->prod_name}</a> </td><td>{$products->client_name}</td><td>{$products->install_address}</td><td>{$products->install_city}</td><td><a href='" . $uri->link("clientproduct/edit/" . $products->id . "") . "'>Edit</a></td><td><a href='" . $uri->link("clientproduct/doDelete/" . $products->id . "") . "'>Delete</a></td>\n                </tr>";
             $x++;
         }
     } else {
         $productlist .= "<tr><td colspan='7'>No record to display</td></tr>";
     }
     $productlist .= "</tbody>\n            </table>";
     $this->view->myprods = $productlist;
     $this->view->render("clientproduct/index");
 }
/**
 * Execution of the form submission
 */
function do_form_submission()
{
    // make sure some data was send via appropriate request method
    if (!empty($_POST)) {
        // ensure that our data array has expected keys
        $data = normalize_submission_data($_POST);
        // clean up data by removing potential malicious code
        $data = array_map('sanitize_text', $data);
        // determine if our remaining data meets our minimum standards
        $valid = validate_submission_data($data);
        // step 1: test to see if the submitted data is valid
        if ($valid) {
            // step 2: attempt to send the email.
            // $success will be true if the email sent, and false if it did not
            $success = send_submission_email($data);
            // handle the result of our attempt
            if ($success) {
                // result was true, go to thankyou page
                redirect_to('thankyou.html');
            } else {
                // result was false, go to error page
                redirect_to('error.html');
            }
        } else {
            // to submitted data is not valid, go to error page
            redirect_to('error.html');
        }
    } else {
        // no request information, go to home
        redirect_to('index.html');
    }
}
Ejemplo n.º 10
0
function delete(&$vars)
{
    extract($vars);
    $resource->delete_from_post($request);
    header_status('200 OK');
    redirect_to($request->resource);
}
Ejemplo n.º 11
0
 public function index()
 {
     if (isset($_SESSION['user_id']) && !empty($_SESSION['user_id'])) {
         $data['title'] = 'Elixir Industrial Equipment Inc. Cebu-Branch';
         $data['companyName'] = 'Elixir Industrial Equipment Inc.';
         $data['clients'] = $this->model->show_client();
         $user = $this->load_model('user');
         $data['current_user'] = $user->show_current_users_info($_SESSION['user_id']);
         $product = $this->load_model('product');
         $data['category'] = $product->show_category();
         $data['itemUnit'] = $product->show_item_unit();
         $notification = $this->load_model('product');
         $data['notification'] = $notification->product_lowItems();
         if ($data['current_user']['user_type'] == 2) {
             $this->load_template('home', $data, 'client');
         } else {
             if ($data['current_user']['user_type'] != 0) {
                 redirect_to(home_url());
             } else {
                 $this->load_template('home', $data, 'client');
             }
         }
     } else {
         redirect_to(home_url());
     }
 }
Ejemplo n.º 12
0
 public function postIndex()
 {
     #set post ke  params variable, agar bisa dikirim ke tampilan login
     $this->params = $_POST;
     if (!in_array($_POST['type'], $this->user_types)) {
         #error tipe login salah
         $this->params['error_message'] = 'Tipe login salah';
         #buka lagi halaman login
         $this->getIndex();
     } else {
         // $this->pdo->enable_debug();
         $row = $this->pdo->select("SELECT * FROM {$_POST['type']} WHERE username = ? AND password = ?", [$_POST['username'], hashpassword($_POST['password'])], false);
         #error ID atau password salah
         if (!$row || count($row) == 0) {
             $this->params['error_message'] = 'ID atau password Anda salah';
             $this->getIndex();
         } else {
             #berhasil login
             #set session login
             switch ($_POST['type']) {
                 case 'siswa':
                     $this->user_logged->set_user_logged(['level' => 'siswa', 'hak' => 'siswa', 'admin' => $_POST['username'], 'user' => $row['id_siswa'], 'id' => $row['id_siswa'], 'agent' => $_SERVER['HTTP_USER_AGENT'], 'username' => $_POST['username'], 'status' => $row['status']]);
                     break;
                 case 'guru':
                     $this->user_logged->set_user_logged(['level' => 'guru', 'hak' => 'guru', 'admin' => $_POST['username'], 'user' => $row['id_guru'], 'id' => $row['id_guru'], 'agent' => $_SERVER['HTTP_USER_AGENT'], 'username' => $_POST['username'], 'status' => 'active']);
                     break;
                 case 'admin':
                     $this->user_logged->set_user_logged(['level' => 'admin', 'hak' => 'admin', 'admin' => $_POST['username'], 'user' => $row['id_admin'], 'id' => $row['id_admin'], 'agent' => $_SERVER['HTTP_USER_AGENT'], 'username' => $_POST['username'], 'status' => 'active']);
                     break;
             }
             #redirect ke halaman index
             redirect_to("{$_POST['type']}/profile");
         }
     }
 }
Ejemplo n.º 13
0
 public function logout()
 {
     unset($_SESSION['uid']);
     unset($this->uid);
     $this->isLoggedIn = false;
     redirect_to('login.php');
 }
Ejemplo n.º 14
0
function delete(&$vars)
{
    extract($vars);
    $resource->delete_from_post($request);
    header_status('200 OK');
    redirect_to($request->url_for(array('resource' => 'identities', 'id' => $profile->id, 'action' => 'edit')));
}
Ejemplo n.º 15
0
 public function view_modify()
 {
     $this->smarty->assign('title', '修改运输方式名预警');
     $id = isset($_GET['id']) ? intval(trim($_GET['id'])) : 0;
     if (empty($id) || !is_numeric($id)) {
         redirect_to("index.php?mod=trackWarnCarrier&act=index");
         exit;
     }
     $trackWarnCarrier = new TrackWarnCarrierAct();
     $res = $trackWarnCarrier->actModify($id);
     $erpCarrierList = TransOpenApiAct::act_getErpCarrierList();
     $this->smarty->assign('shipErp', $erpCarrierList);
     //ERP运输方式列表
     $carrierList = TransOpenApiModel::getCarrier(2);
     $this->smarty->assign('lists', $carrierList);
     //运输方式列表
     $trackCarrierList = TransOpenApiModel::getTrackCarrierList();
     $this->smarty->assign('shipTrack', $trackCarrierList);
     //跟踪号系统运输方式列表
     $this->smarty->assign('carrier_name', $res['trackName']);
     $this->smarty->assign('ship_erp', $res['erpName']);
     $this->smarty->assign('ship_id', $res['carrierId']);
     $this->smarty->assign('id', $res['id']);
     $this->smarty->display('trackWarnCarrierModify.htm');
 }
Ejemplo n.º 16
0
 function logout()
 {
     setcookie(DEFAULT_COOKIE, 'blah', time() - 86400);
     unset($_SESSION['user']);
     redirect_to('/');
     return;
 }
Ejemplo n.º 17
0
 public function doDelete($id)
 {
     @$this->loadModel("Prod_Cats");
     if ($this->model->delete($id)) {
         redirect_to($this->uri->link("prod_cats/index"));
     }
 }
Ejemplo n.º 18
0
function delete(&$vars)
{
    extract($vars);
    $resource->delete_from_post($request);
    header_status('200 OK');
    redirect_to($request->url_for(array('action' => 'entry', 'resource' => 'auctions', 'id' => $request->params['auctionbullet']['auction_id'])));
}
Ejemplo n.º 19
0
function confirm_user_is_admin()
{
    confirm_logged_in();
    if ($_SESSION['admin'] != 1) {
        redirect_to("index.php");
    }
}
Ejemplo n.º 20
0
 public function doDelete($id)
 {
     @$this->loadModel("Clients");
     if ($this->model->delete($id)) {
         redirect_to($this->uri->link("clients/index"));
     }
 }
 public function index()
 {
     if (!isset($_SESSION['id'])) {
         redirect_to('index.php?rt=login');
     }
     $this->registry->template->title = "This is title of my website";
     $this->registry->template->show('index');
 }
Ejemplo n.º 22
0
function authenticate_by_role($user_role)
{
    if ($user_role = "organizer") {
        redirect_to("organizer_dashboard.php");
    } elseif ($user_role = "normaluser") {
        redirect_to("home.php");
    }
}
Ejemplo n.º 23
0
    function __CONSTRUCT()
    {
        $this->load_outer_template('admin');

    // Require login
        if(!isset($_SESSION['active_user']))
            redirect_to('/');
    }
function log_in_user($user, $user_id)
{
    $_SESSION['active_user'] = array(
        'name' => $user,
        'id'   => $user_id);

    redirect_to(make_url("messages"));
}
Ejemplo n.º 25
0
 public function doLogout()
 {
     //@$session = new Session();
     global $session;
     $session->logout();
     redirect_to($this->uri->link("login/index"));
     //$this->view->render("dashboard/index");
 }
Ejemplo n.º 26
0
 public function __construct(Routing $routing, MyPDO $pdo = null, View $view = null, Layout $layout = null, UserLogged $user_logged = null)
 {
     parent::__construct($routing, $pdo, $view, $layout, $user_logged);
     #user harus sudah login
     if (!$this->user_logged->check_is_logged()) {
         redirect_to('login');
     }
 }
Ejemplo n.º 27
0
 public static function callback()
 {
     //Get the username
     $username = $_GET['username'];
     //Save it inside as an access_token
     Token::add(self::name, $_SESSION['userid'], $username);
     redirect_to('/');
 }
Ejemplo n.º 28
0
 /**
  * TrackEmailStatAct::actIndex()
  * 列出符合条件的数据并分页显示
  * @param string $condition 查询条件
  * @param integer $curpage 页码
  * @param integer $pagenum 每页个数
  * @return array 
  */
 public function actIndex()
 {
     $data = array();
     $condition = '';
     $trackEmailStat = new TrackEmailStatModel();
     //接收参数生成条件
     $curpage = isset($_GET['page']) ? abs(intval($_GET['page'])) : 1;
     $type = isset($_GET['type']) ? trim($_GET['type']) : '';
     $key = isset($_GET['key']) ? post_check(trim($_GET['key'])) : '';
     $timeNode = isset($_GET['timeNode']) ? post_check(trim($_GET['timeNode'])) : '';
     $condition .= "1";
     if ($type && $key) {
         if (!in_array($type, array('trackNumber', 'platAccount'))) {
             redirect_to("index.php?mod=trackEmailStat&act=index");
         }
         $condition .= ' AND ' . $type . " = '" . $key . "'";
     }
     if (!empty($timeNode)) {
         if (!in_array($timeNode, array('addTime', 'lastTime'))) {
             redirect_to("index.php?mod=trackEmailStat&act=index");
         }
         $startTime = isset($_GET['startTime']) ? strtotime(trim($_GET['startTime']) . " 00:00:00") : strtotime(date("Y-m-d", time()) . " 00:00:00");
         $endTime = isset($_GET['endTime']) ? strtotime(trim($_GET['endTime']) . " 23:59:59") : strtotime(date("Y-m-d", time()) . " 23:59:59");
         if ($startTime && $endTime) {
             $condition .= ' AND ' . $timeNode . " BETWEEN '" . $startTime . "' AND " . "'" . $endTime . "'";
         }
     }
     //获取符合条件的数据并分页
     $pagenum = 20;
     $total = $trackEmailStat->modListCount($condition);
     $res = $trackEmailStat->modList($condition, $curpage, $pagenum);
     $page = new Page($total, $pagenum, '', 'CN');
     $pageStr = "";
     if ($res) {
         if ($total > $pagenum) {
             $pageStr = $page->fpage(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9));
         } else {
             $pageStr = $page->fpage(array(0, 1, 2, 3));
         }
     } else {
         $pageStr = '暂无数据';
     }
     //封装数据返回
     $data['key'] = $key;
     $data['type'] = $type;
     $data['lists'] = $res;
     $data['pages'] = $pageStr;
     $data['timeNode'] = $timeNode;
     $data['startTime'] = $startTime ? date('Y-m-d', $startTime) : '';
     $data['endTime'] = $endTime ? date('Y-m-d', $endTime) : '';
     self::$errCode = trackEmailStatModel::$errCode;
     self::$errMsg = trackEmailStatModel::$errMsg;
     if (self::$errCode != 0) {
         show_message($this->smarty, self::$errMsg, "");
         return false;
     }
     return $data;
 }
Ejemplo n.º 29
0
 public function unlike()
 {
     if (!isset($_SESSION['user_id'])) {
         redirect_to('pages', 'error');
     }
     Image::unlike(Request::get_id());
     header('Location: ' . $_SESSION['url']);
     die;
 }
Ejemplo n.º 30
0
function delete(&$vars)
{
    extract($vars);
    //$Category->delete_from_post( $request );
    $rec = $Category->find($request->id);
    $result = $db->delete_record($rec);
    header('Status: 200 OK');
    redirect_to($request->url_for('admin') . '#ui-tabs-9');
}