function core_showCatId($catid) { $sql = "SELECT * from categ where id={$catid}"; $res = SelectFirstFromDB($sql); $name = $res['name']; return $name; }
function pass($pass, $oldpass, $id) { if (!empty($pass)) { $pass = mysql_escape_string($pass); $pass = sha1($pass); } if (!empty($oldpass)) { $oldpass = mysql_escape_string($oldpass); $oldpass = sha1($oldpass); } $sql = "select * from users where id='{$id}' and password='******'"; $res = SelectFirstFromDB($sql); if ($res) { $sql = "UPDATE users SET password='******' where id={$id}"; if (ExecFromDB($sql)) { ?> <script>alert("Пароль успешно изменен");</script><?php echo "<script>document.location.replace('/main');</script>"; } else { ?> <script>alert("Ошибка изменения пароля");</script><?php echo "<script>document.location.replace('/main');</script>"; } } else { ?> <script>alert("Ошибка! Неправильный пароль!");</script><?php echo "<script>document.location.replace('/main');</script>"; } }
function auth_getStatus($userid) { $sql = "select status from users where id={$userid}"; $row = SelectFirstFromDB($sql); if ($row != false) { return $row["status"]; } else { return FALSE; } }
function activation($id) { $row = SelectFirstFromDB("SELECT * FROM users WHERE actid = '{$id}'"); if ($row) { if ($row['actid'] == $id) { if ($row['status'] == 0) { $status = $row['status']; $result = ExecFromDB("UPDATE users SET status= 100 WHERE actid='{$id}'"); echo "<h1>Ваша учетная запись успешно активирована!</h1>"; } else { echo "<h1>Ваша учетная запись уже активирована!</h1>"; } } else { echo "<h1>Неверная ссылка!</h1>"; } } }
<?php require_once LIBPATH . "db.php"; $sql = "SELECT * FROM users where id='{$userid}'"; $res = SelectFirstFromDB($sql); $name = $res['name']; echo $name;
<?php //выбор шапки для авторизованных пользователей require_once "/config.php"; require_once LIBPATH . "db.php"; if (isset($_SESSION['userid'])) { $id = $_SESSION['userid']; if (!isset($_SESSION['type'])) { $arr = SelectFirstFromDB("SELECT type from users where id={$id}"); $_SESSION['type'] = $arr['type']; } if ($_SESSION['type'] != FALSE) { if ($_SESSION['type'] == "cust") { include TMPALATEPATH . "header-cl.php"; } if ($_SESSION['type'] == "perf") { include TMPALATEPATH . "header-perf.php"; } if ($_SESSION['type'] == "admin") { include TMPALATEPATH . "header-adm.php"; } } else { ?> <script>alert('Не указан тип пользователя, либо пользователя не существует!');</script><?php } } else { //Header неавторизованого пользователя ?> <header>
<!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body> <div id="wrapper"> <!-- Header ================================================== --> <?php include "blocks/header-out.php"; if (isset($_REQUEST['id'])) { $id = $_REQUEST['id']; $myrow = SelectFirstFromDB("SELECT * FROM (users CROSS JOIN categories ON users.firstid = categories.id)\n CROSS JOIN regions ON regions.id=users.regionid\n WHERE users.id ={$id}"); if (!isset($_SESSION['userid'])) { $access = FALSE; ?> <span> Чтобы видеть контакты исполнителей, пожалуйста, авторизуйтесь!</span> <?php } else { $access = TRUE; } ?> <div class="clearfix"></div> <div id="titlebar" class="resume"> <div class="container"> <div class="ten columns">
<header> <?php require_once LIBPATH . "db.php"; if (isset($_SESSION['userid'])) { $id = $_SESSION['userid']; } $res = SelectFirstFromDB("SELECT * from users where id={$id}"); if ($res != false) { $arr = $res; } ?> <div class="container" > <div class="sixteen columns" > <!-- Logo --> <div id="logo"> <h1><a href="main"><img src="images/logo.png" alt="" /></a></h1> </div> <!-- Menu --> <nav id="navigation" class="menu"> <ul id="responsive"> <li><a href="main">Главная</a> </li> <li><a href="orders">Заказы</a> </li> <li><a href="performers">Исполнители</a>
</head> <body> <div id="wrapper"> <!-- Header ================================================== --> <?php include "blocks/header-out.php"; include LIBPATH . "catfun.php"; if (isset($_REQUEST['orderid'])) { $orderid = $_REQUEST['orderid']; $orderid = mysql_escape_string($orderid); $userid = $_SESSION['userid']; $userid = mysql_escape_string($userid); $arr = SelectFirstFromDB("SELECT * FROM ads WHERE userid={$userid} and id={$orderid}"); if ($arr == FALSE) { echo "<script>document.location.replace('/main');</script>"; } } ?> <div class="clearfix"></div> <div id="titlebar" class="single submit-page"> <div class="container"> <div class="sixteen columns"> <h2><i class="fa fa-plus"></i> Добавление заказа</h2> </div> </div> </div>
<![endif]--> </head> <body> <div id="wrapper"> <!-- Header ================================================== --> <?php include "blocks/header-cl.php"; //require("lib/db.php"); if (isset($_REQUEST['adid'])) { $adid = $_REQUEST['adid']; //$arr=SelectFromDBArray("SELECT * from applications where adid=$adid"); $usarr = SelectFromDBArray("SELECT * from users INNER JOIN applications ON users.id=applications.clid"); $one = SelectFirstFromDB("SELECT title from ads where id={$adid}"); //$arr=array_merge($arr, $usarr); //print_r($arr); } ?> <div class="clearfix"></div> <div id="titlebar" class="single"> <div class="container"> <div class="sixteen columns"> <h2> <i class="fa fa-user-plus"> </i> Заявки к заказу "<?php if (isset($one['title'])) { echo $one['title']; } ?> "</h2>
<?php include LIBPATH . "pageoutput.php"; include LIBPATH . "db.php"; $table = "ads"; $start_pos = 0; $res = SelectFirstFromDB("Select Count(*) as col from ads"); if ($res) { $count = $res['col']; } $perpage = 10; dbout($table, $start_pos, $_REQUEST['pagesname']);