Помощь по скриптам | где тут дыры
Donbass17.95 , После header('location: /home'); не было exit();
Потом не ясно что в auth() и text()
Потом не ясно что в auth() и text()
TuT (28.01.2019 в 23:49)
Donbass17.95 , После header('location: /home'); не было exit();
Потом не ясно что в auth() и text()
выход не обязательно там же локация установлена оно просто переадресует , а вот noauth и text это интересно
Donbass17.95 , После header('location: /home'); не было exit();
Потом не ясно что в auth() и text()
Wap_Master , <?php
session_start();
ob_start();
require_once 'db.php';
$db = mysql_connect(DB_HOST, DB_USER, DB_PASS);
mysql_select_db(DB_NAME, $db);
$pdo = new PDO("mysql:host=".DB_HOST.";dbname=".DB_NAME.";charset=UTF8", DB_USER, DB_PASS);
function text($m){
$m = mysql_real_escape_string(htmlspecialchars(stripslashes(trim($m))));
return $m;
}
function num($m){
$m = intval($m);
$m = abs($m);
return $m;
}
$user = null;
if (isset($_COOKIE['login']) and isset($_COOKIE['pass'])) {
$pass = text($_COOKIE['pass']);
$dbs = mysql_query("SELECT * FROM `user` WHERE `login` = '".text($_COOKIE['login'])."' and `pass` = '".text($_COOKIE['pass'])."' LIMIT 1");
$user = mysql_fetch_assoc($dbs);
if (!isset($user['id'])) {
setcookie('login', '', time() - 86400*365);
setcookie('pass', '', time() - 86400*365);
}
}
$myID = $user['id'];
function err($msg){
echo '<div class="nav-bar"> '.$msg.' </div>';
}
function error_msg($sms){
echo '<div class="nav-bar"> '.$sms.' </div>';
}
function vremja($time=NULL){
if ($time == NULL)$time = time();
$timep="".date("j M Y в H:i", $time)."";
$time_p[0]=date("j n Y", $time);
$time_p[1]=date("H:i", $time);
if ($time_p[0] == date("j n Y"))$timep = date("H:i:s", $time);
if ($time_p[0] == date("j n Y", time()-60*60*24))$timep = "Вчера в $time_p[1]";$timep=str_replace("Jan","Января",$timep);$timep=str_replace("Feb","Февраля",$timep);$timep=str_replace("Mar","Марта",$timep);$timep=str_replace("May","Мая",$timep);$timep=str_replace("Apr","Апреля",$timep);$timep=str_replace("Jun","Июня",$timep);$timep=str_replace("Jul","Июля",$timep);$timep=str_replace("Aug","Августа",$timep);$timep=str_replace("Sep","Сентября",$timep);$timep=str_replace("Oct","Октября",$timep);$timep=str_replace("Nov","Ноября",$timep);$timep=str_replace("Dec","Декабря",$timep);
return $timep;
}
function text_msg($msg){
$bbcode=array();
$bbcode['/\n/isU']='<br>';
$bbcode['/\[br\]/isU']='<br>';
global $ank;
$bbcode['/\[center\](.+)\[\/center\]/isU'] = '<center>$1</center>';
$bbcode['/\[b\](.+)\[\/b\]/isU'] = '<b>$1</b>';
$bbcode['/\[i\](.+)\[\/i\]/isU'] = '<i>$1</i>';
$bbcode['/\[u\](.+)\[\/u\]/isU'] = '<u>$1</u>';
$bbcode['/\[s\](.+)\[\/s\]/isU'] = '<s>$1</s>';
$bbcode['/\[small\](.+)\[\/small\]/isU'] = '<small>$1</small>';
//$bbcode['/\[img\](.*)\[\/img\]/isU'] = "<img src='$1'/>$2</img>";
$bbcode['/\[url=(.+)\](.+)\[\/url\]/isU'] = "<a href='$1'>$2</a>";
$bbcode['/\[a\](.+)\[\/a\]/isU'] = "<a>$1</a>";
$bbcode['/\[color=(.+)\](.+)\[\/color\]/isU'] = "<font color='$1'>$2</font>";
if (count($bbcode))$msg = preg_replace(array_keys($bbcode), array_values($bbcode), $msg);
$msg = str_replace(array(':ded'), '<img src="http://mlust.ru/images/smile/1.gif" alt="*"/>', $msg);
$msg = str_replace(array(':sneg'), '<img src="http://mlust.ru/images/smile/2.gif" alt="*"/>', $msg);
$msg = str_replace(array(':elka'), '<img src="http://mlust.ru/images/smile/3.gif" alt="*"/>', $msg);
$msg = str_replace(array(':0)'), '<img src="http://mlust.ru/images/smile/4.gif" alt="*"/>', $msg);
$msg = str_replace(array(':])'), '<img src="http://mlust.ru/images/smile/5.gif" alt="*"/>', $msg);
$msg = str_replace(array(':$'), '<img src="http://mlust.ru/images/smile/6.gif" alt="*"/>', $msg);
$msg = str_replace(array('
'), '<img src="http://mlust.ru/images/smile/7.gif" alt="*"/>', $msg);
$msg = str_replace(array(':)'), '<img src="http://mlust.ru/images/smile/8.gif" alt="*"/>', $msg);
$msg = str_replace(array(';)'), '<img src="http://mlust.ru/images/smile/9.gif" alt="*"/>', $msg);
$msg = str_replace(array(':D'), '<img src="http://mlust.ru/images/smile/10.gif" alt="*"/>', $msg);
$msg = str_replace(array(':p'), '<img src="http://mlust.ru/images/smile/11.gif" alt="*"/>', $msg);
$msg = str_replace(array(':('), '<img src="http://mlust.ru/images/smile/12.gif" alt="*"/>', $msg);
$msg = str_replace(array(':sl'), '<img src="http://mlust.ru/images/smile/13.gif" alt="*"/>', $msg);
$msg = str_replace(array(':]'), '<img src="http://mlust.ru/images/smile/14.gif" alt="*"/>', $msg);
$msg = str_re
session_start();
ob_start();
require_once 'db.php';
$db = mysql_connect(DB_HOST, DB_USER, DB_PASS);
mysql_select_db(DB_NAME, $db);
$pdo = new PDO("mysql:host=".DB_HOST.";dbname=".DB_NAME.";charset=UTF8", DB_USER, DB_PASS);
function text($m){
$m = mysql_real_escape_string(htmlspecialchars(stripslashes(trim($m))));
return $m;
}
function num($m){
$m = intval($m);
$m = abs($m);
return $m;
}
$user = null;
if (isset($_COOKIE['login']) and isset($_COOKIE['pass'])) {
$pass = text($_COOKIE['pass']);
$dbs = mysql_query("SELECT * FROM `user` WHERE `login` = '".text($_COOKIE['login'])."' and `pass` = '".text($_COOKIE['pass'])."' LIMIT 1");
$user = mysql_fetch_assoc($dbs);
if (!isset($user['id'])) {
setcookie('login', '', time() - 86400*365);
setcookie('pass', '', time() - 86400*365);
}
}
$myID = $user['id'];
function err($msg){
echo '<div class="nav-bar"> '.$msg.' </div>';
}
function error_msg($sms){
echo '<div class="nav-bar"> '.$sms.' </div>';
}
function vremja($time=NULL){
if ($time == NULL)$time = time();
$timep="".date("j M Y в H:i", $time)."";
$time_p[0]=date("j n Y", $time);
$time_p[1]=date("H:i", $time);
if ($time_p[0] == date("j n Y"))$timep = date("H:i:s", $time);
if ($time_p[0] == date("j n Y", time()-60*60*24))$timep = "Вчера в $time_p[1]";$timep=str_replace("Jan","Января",$timep);$timep=str_replace("Feb","Февраля",$timep);$timep=str_replace("Mar","Марта",$timep);$timep=str_replace("May","Мая",$timep);$timep=str_replace("Apr","Апреля",$timep);$timep=str_replace("Jun","Июня",$timep);$timep=str_replace("Jul","Июля",$timep);$timep=str_replace("Aug","Августа",$timep);$timep=str_replace("Sep","Сентября",$timep);$timep=str_replace("Oct","Октября",$timep);$timep=str_replace("Nov","Ноября",$timep);$timep=str_replace("Dec","Декабря",$timep);
return $timep;
}
function text_msg($msg){
$bbcode=array();
$bbcode['/\n/isU']='<br>';
$bbcode['/\[br\]/isU']='<br>';
global $ank;
$bbcode['/\[center\](.+)\[\/center\]/isU'] = '<center>$1</center>';
$bbcode['/\[b\](.+)\[\/b\]/isU'] = '<b>$1</b>';
$bbcode['/\[i\](.+)\[\/i\]/isU'] = '<i>$1</i>';
$bbcode['/\[u\](.+)\[\/u\]/isU'] = '<u>$1</u>';
$bbcode['/\[s\](.+)\[\/s\]/isU'] = '<s>$1</s>';
$bbcode['/\[small\](.+)\[\/small\]/isU'] = '<small>$1</small>';
//$bbcode['/\[img\](.*)\[\/img\]/isU'] = "<img src='$1'/>$2</img>";
$bbcode['/\[url=(.+)\](.+)\[\/url\]/isU'] = "<a href='$1'>$2</a>";
$bbcode['/\[a\](.+)\[\/a\]/isU'] = "<a>$1</a>";
$bbcode['/\[color=(.+)\](.+)\[\/color\]/isU'] = "<font color='$1'>$2</font>";
if (count($bbcode))$msg = preg_replace(array_keys($bbcode), array_values($bbcode), $msg);
$msg = str_replace(array(':ded'), '<img src="http://mlust.ru/images/smile/1.gif" alt="*"/>', $msg);
$msg = str_replace(array(':sneg'), '<img src="http://mlust.ru/images/smile/2.gif" alt="*"/>', $msg);
$msg = str_replace(array(':elka'), '<img src="http://mlust.ru/images/smile/3.gif" alt="*"/>', $msg);
$msg = str_replace(array(':0)'), '<img src="http://mlust.ru/images/smile/4.gif" alt="*"/>', $msg);
$msg = str_replace(array(':])'), '<img src="http://mlust.ru/images/smile/5.gif" alt="*"/>', $msg);
$msg = str_replace(array(':$'), '<img src="http://mlust.ru/images/smile/6.gif" alt="*"/>', $msg);
$msg = str_replace(array('
'), '<img src="http://mlust.ru/images/smile/7.gif" alt="*"/>', $msg); $msg = str_replace(array(':)'), '<img src="http://mlust.ru/images/smile/8.gif" alt="*"/>', $msg);
$msg = str_replace(array(';)'), '<img src="http://mlust.ru/images/smile/9.gif" alt="*"/>', $msg);
$msg = str_replace(array(':D'), '<img src="http://mlust.ru/images/smile/10.gif" alt="*"/>', $msg);
$msg = str_replace(array(':p'), '<img src="http://mlust.ru/images/smile/11.gif" alt="*"/>', $msg);
$msg = str_replace(array(':('), '<img src="http://mlust.ru/images/smile/12.gif" alt="*"/>', $msg);
$msg = str_replace(array(':sl'), '<img src="http://mlust.ru/images/smile/13.gif" alt="*"/>', $msg);
$msg = str_replace(array(':]'), '<img src="http://mlust.ru/images/smile/14.gif" alt="*"/>', $msg);
$msg = str_re
Всё в норме!
Wap_Master (28.01.2019 в 23:52)
TuT (28.01.2019 в 23:49)
Donbass17.95 , После header('location: /home'); не было exit();
Потом не ясно что в auth() и text()
выход не обязательно там же локация установлена оно просто переадресует , а вот noauth и text это интересно
TuT (28.01.2019 в 23:49)
Donbass17.95 , После header('location: /home'); не было exit();
Потом не ясно что в auth() и text()
выход не обязательно там же локация установлена оно просто переадресует , а вот noauth и text это интересно
Ага, и зациклить скрипт. Представляешь что будет?
function text($m){
$m = mysql_real_escape_string(htmlspecialchars(stripslashes(trim($m))));
return $m;
} function noauth(){
global $user;
if(isset($user['id'])) header('Location: /home');
}
function auth(){
global $user;
$_SESSION['notif2'] = 'Вам необходимо авторизироваться';
if(!isset($user['id'])) header('Location: /loading');
}
Graph Aizen (28.01.2019 в 23:58)
function text($m){
$m = mysql_real_escape_string(htmlspecialchars(stripslashes(trim($m))));
return $m;
} function noauth(){
global $user;
if(isset($user['id'])) header('Location: /home');
}
function auth(){
global $user;
$_SESSION['notif2'] = 'Вам необходимо авторизироваться';
if(!isset($user['id'])) header('Location: /loading');
} А выход где???
Wap_Master , так можно использовать, в куске где pdo нет SQL injection. ИБО там используется подготовленные запросы.
________
посл. ред. 28.02.2019 в 14:58; всего 1 раз(а); by Night_devil
________
посл. ред. 28.02.2019 в 14:58; всего 1 раз(а); by Night_devil