示例#1
0
 public static function updateUserForm($values = ["ime" => "", "priimek" => "", "mail" => "", "uporabnisko_ime" => "", "geslo" => "", "aktiven" => "", "telefon" => "", "ulica" => "", "stevilka" => "", "posta" => "", "kraj" => ""])
 {
     $rules = ["id" => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 1]]];
     $data = filter_input_array(INPUT_POST, $rules);
     if (self::checkValues($data)) {
         $result = UsersDB::getCustomer($data);
         $_SESSION["uid"] = $data["id"];
         $_SESSION["uname"] = $result["uporabnisko_ime"];
     } else {
         $result = UsersDB::getCustomer(["id" => $_SESSION["uid"]]);
     }
     $result["geslo2"] = $result["geslo"];
     $result["stranka"] = true;
     $form = new OsebaForm('registracija', $result, "spreminjanje");
     echo ViewHelper::render("view/salesman-user-edit.php", ["form" => $form]);
 }
示例#2
0
 public static function profileForm()
 {
     $result = UsersDB::getCustomer(["id" => $_SESSION["id"]]);
     $result["geslo2"] = $result["geslo"];
     $_SESSION["uid"] = $_SESSION["id"];
     $_SESSION["uname"] = $result["uporabnisko_ime"];
     $result["stranka"] = true;
     $form = new OsebaForm('registracija', $result, "profil");
     echo ViewHelper::render("view/customer-profil.php", ["form" => $form]);
 }
示例#3
0
文件: index.php 项目: benjaminovak/ep
     if ($http_method == "GET" && $param == null) {
         session_start();
         session_destroy();
         $returnJson = array('status' => 'ok');
         http_response_code(200);
         echo json_encode($returnJson);
     } else {
         // error
         echo returnError(404, "Unknown request: [{$http_method} {$resource}]");
     }
     break;
 case "profile":
     //TODO: sanitize
     session_start();
     if ($http_method == "GET" && $param == null) {
         $user_data = UsersDB::getCustomer(["id" => $_SESSION["id"]]);
         unset($user_data["aktiven"]);
         http_response_code(200);
         echo json_encode($user_data);
     } else {
         if ($http_method == "POST" && $param == null) {
             $filtered_input = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
             //            echo $filtered_input["ime"];
             UsersDB::updateCustomer($filtered_input);
             $status = array('status' => 'OK');
             http_response_code(204);
             echo json_encode($status);
         } else {
             // error
             echo returnError(404, "Unknown request: [{$http_method} {$resource}]");
         }