<?php require_once "inc/config.php"; check_role($ROLE_ADMIN); $tem = template_open("add_address.tpl"); $tem = template_add_head_foot($tem, head, foot); $username = ereg_replace("[^[A-z]]", "", $_REQUEST['username']); $password = ereg_replace("[^[A-z]]", "", $_REQUEST['password']); $first = ereg_replace("[^[:alnum:] ]", "", $_REQUEST['first']); $last = ereg_replace("[^[:alnum:] ]", "", $_REQUEST['last']); echo "do sem"; $sql = "SELECT * FROM roles"; //TitleGroup"; $result = $db->fetchAll($sql); foreach ($result as $res) { $names[] .= $res["name"]; $values[] .= $res["id_role"]; } $role_dropdown = html_drop_down_arrays("role_drop", $names, $values, ""); if ($_REQUEST['add'] == "Dodaj") { //echo $username."-".$password."-".$first."-".$last."-".$role_drop; if ($username and $password and $first and $last) { //pogledamo kaj imamo in ce je ze tak notr slucajn... $sql = "SELECT first FROM persons where first='{$first}' and last='{$last}'"; $result = $db->fetchOne($sql); if ($result) { $message .= "Uporabnik ze obstaja"; } else { // dejansko vnesemo $data = array('username' => $username, 'passwd' => $password, 'first' => $first, 'last' => $last, 'id_role' => $role_drop); $db->insert('persons', $data);
<? require_once("inc/config.php"); $tem = template_open("user_add.tpl"); $tem = template_add_head_foot($tem); $username = ereg_replace("[^[A-z]]","",$_REQUEST['username']); $password = ereg_replace("[^[A-z]]","",$_REQUEST['password']); $first = ereg_replace("[^[:alnum:] ]","",$_REQUEST['first']); $last = ereg_replace("[^[:alnum:] ]","",$_REQUEST['last']); $sql = "SELECT * FROM roles"; $result = $db->fetchAll($sql); foreach ($result as $res) { $names[] .= $res["name"]; $values[] .= $res["id_role"]; } $role_dropdown = html_drop_down_arrays("role_drop",$names,$values,""); if ($_REQUEST['add'] == "Dodaj") { //echo $username."-".$password."-".$first."-".$last."-".$role_drop; if ($username and $password and $first and $last) { //pogledamo kaj imamo in ce je ze tak notr slucajn... $sql = "SELECT first FROM persons where first='$first' and last='$last'"; $result = $db->fetchOne($sql);
<?php require_once "inc/config.php"; check_role($ROLE_USER); $TITLE = "Cilji"; $tem = template_open("aim_add.tpl") . ($tem = template_open("aim_stop.tpl")); $tem = template_add_head_foot($tem, "head", "foot"); include 'name_dropdown.php'; //dropdown ocene $duration = range(1, 5); $duration_dropdown = html_drop_down_arrays("duration_drop", $duration, $duration, "3"); //date("H",time())); $day = range(1, 31); $day_dropdown = html_drop_down_arrays("day_drop", $day, $day, date("j", time())); $month = range(1, 12); $month_dropdown = html_drop_down_arrays("month_drop", $month, $month, date("n", time())); $year = range(2010, date("Y", time()) + 1); $year_dropdown = html_drop_down_arrays("year_drop", $year, $year, date("Y", time())); //nosilec drop down $sql = "SELECT * FROM `persons` WHERE 20<`id_role` order by unit, letter ASC"; $result = $db->fetchAll($sql); foreach ($result as $res) { if (!is_array($ResponsibleName)) { $ResponsibleName[] = "izberi.."; $ResponsibleValue[] = ""; } $ResponsibleName[] .= $res["last"] . " " . $res["first"]; $ResponsibleValue[] .= $res["id_person"]; } /////////// $responisble_dropdown = html_drop_down_arrays("responsible_drop", $ResponsibleName, $ResponsibleValue, $ResponsibleName);
<?php //*$DO_NOT_REDIRECT="true";*/ require_once "inc/config.php"; check_role($ROLE_EMPLOYED); $TITLE = "Aktivnosti"; $tem = template_open("aktiv_main.tpl"); $tem = template_add_head_foot($tem, head, blank); $tem = str_replace('##USER##', $identity, $tem); $tem = str_replace('##TITLE##', $TITLE, $tem); $tem = str_replace("##MESSAGE##", $message, $tem); $tem = template_clean_up_tags($tem, "##"); echo $tem;
<?php $DO_NOT_REDIRECT = "true"; require_once "inc/config.php"; $user = $_REQUEST["user"]; $pass = $_REQUEST["pass"]; $tem = template_open("login.tpl"); $tem = template_add_head_foot($tem, headLog); if ($user and $pass) { // Set up the authentication adapter $authAdapter = new Zend_Auth_Adapter_DbTable($db); $authAdapter->setTableName('persons')->setIdentityColumn('username')->setCredentialColumn('passwd'); $authAdapter->setIdentity($user)->setCredential($pass); // Attempt authentication, saving the result $result = $auth->authenticate($authAdapter); if (!$result->isValid()) { // Authentication failed; print the reasons why foreach ($result->getMessages() as $message) { $m .= $message; } $m = "Vzdevek ali geslo nista pravilna!"; $messagetype = "error"; $tem = str_replace('##MESSAGETYPE##', $messagetype, $tem); $tem = str_replace("##MESSAGE##", $m, $tem); $tem = template_clean_up_tags($tem, "##"); echo $tem; } else { header("location:index.php"); } } else { $tem = template_clean_up_tags($tem, "##");