есть скрипт авторизации и регистрации! после регистрации попадаю на index.php, но при переходе на др страницу (например post.php) выкидывает из панели а после авторизации опять index.php. Помогите исправить. Код: <? /*!!!Чтобы не повредить работоспособности скрипта выше этого комментария не размещайте вообще ничего!!!*/ include('connectdb.php');// подключение к серверу MySql и выбор БД $userinfo=''; $state='0'; if($state != 1) {// если после проверки куков, оказалось, что пользователь не авторизован, то идем дальше if( (isset($_POST['login'])) & (isset($_POST['pass'])) ){ // если пользователь ввёл логин и пароль $login = $_POST['login']; // проверяем наличие пользователя в БД и достаём оттуда пароль $sql = "SELECT id, pass FROM users WHERE login='$login'"; $res = mysql_query($sql); if(mysql_num_rows($res)>0) {// если пользователь есть в БД $userinfo = mysql_fetch_array($res);// в этой переменной лежит пароль из БД и номер пользователя $pass = $_POST['pass']; if(strcmp($pass,$userinfo['pass'])==0){ // достаём все данные из БД $sql="SELECT * FROM users WHERE login='$login'"; $res=mysql_query($sql); $userinfo=mysql_fetch_array($res);// в этой переменной будет лежать вся информация о пользователе из БД $time=time(); // устанавливаем куки для запоминания статуса пользователя, пароль шифруем setcookie("login", $login, $time+1800); setcookie("pass", md5($pass), $time+1800); $state = 1;// статус, если 1, тогда пользователь авторизован } } } } if($state != 1) { ?>
Через этот скрипт тебя взломают рано или поздно - в нём есть уязвимости (SQL-Injection). Лучше поищи другой. Ну а по теме - неизвестно, что происходит на других страницах. Возможно, там вообще никаких проверок кук нет - тут этого не видно. Возможно, куки не устанавливаются в браузере, например, если есть какой-либо вывод в браузер до инструкций setcookie. Возможно, файл сохранён в кодировке utf8 + BOM.
остается телепатически догадываться, что на других страницах никак не проверяется состояние cookie и поэтому пользователь считается неаутентифицированным.
насчёт взома я не переживаю! я в пхп немного не шарю, но всётаки столкнулся с проблемой авторизации, панель та уже готова за исключением этого минуса. помогите пожалуйста с кодом.
Покажи как ты проверяешь авторизован пользователь или нет в post.php Добавлено спустя 46 секунд: Это ты зря...
фаил post.php эт образно(его нет такого). я делаю панель для студентов, тк являюсь информатиком. я сделал страничку index.php запихнул туда простой скрипт форума и поставил смену страниц на jqueru для того чтобы обойти данную проблему, но не тут то было создаю тему на форуме а когда в неё захожу то адрес меняется (например на /index.php?id=002) и "капут" выкидывает из панели. я могу повыкладывать тут с коментариями то что получилось так как слабо представляю где искать.
dark5572008, ну что тебе сказать. ты мудак. пока ты будешь обходить дыры в своем образовании с помощью jquery, проблемы будут вылазить и вылазить, как гной из запущеной болячки. хватит копипастить говнокод, учи матчасть.
давай только без оскорблений, я пришёл сюда за помощью. Добавлено спустя 10 минут 4 секунды: вот код index.php форума т.к сам форум это пару стилей и файлы конфига Код: <? // WR-Forum Lite v 2.0.3 // 28.03.11 г. // Miha-ingener@yandex.ru // Если у Вас возникли вопросы что куда записывается и где и что храниться, то: // Вся структура базы данных этого форума описана на странице: // http://www.wr-script.ru/info/wr-forum-2_strukture.php // надо делать поиск по: // - названию темы // - имени участника! // - вхождению ключевого слова в сообщение!!! // - если нет файла типа 001.dbf - автоматом его создавать! Данные брать из wrforum.dbf! error_reporting (E_ALL); function replacer ($text) { // ФУНКЦИЯ очистки кода $text=str_replace(" ",' ',$text); $text=str_replace(">",'>',$text); $text=str_replace("<",'<',$text); $text=str_replace("\"",'"',$text); $text=preg_replace("/\n\n/",'<p>',$text); $text=preg_replace("/\n/",'<br>',$text); $text=preg_replace("/\\\$/",'$',$text); $text=preg_replace("/\r/",'',$text); $text=preg_replace("/\\\/",'\',$text); if (get_magic_quotes_gpc()) { // если magic_quotes включена - чистим СЛЭШи: одиночные (') и двойные кавычки ("), обратный слеш (\) $text=str_replace("\"",'"',$text); $text=str_replace("\'",'\'',$text); $text=str_replace("\\",'\',$text);} $text=str_replace("\r\n","<br> ",$text); $text=str_replace("\n\n",'<p>',$text); $text=str_replace("\n",'<br> ',$text); $text=str_replace("\t",'',$text); $text=str_replace("\r",'',$text); $text=str_replace(' ',' ',$text); do {$text=str_replace("<br><br><br>","<br>",$text);} while (preg_match("/<br><br><br><br>/i",$text)); do {$text=str_replace(" "," ",$text);} while (preg_match("/ /i",$text)); $text=str_replace("\t",' ',$text); $text=str_replace("\r",' ',$text); $text=str_replace(' ',' ',$text); $text=rtrim($text); return $text; } // ФУНКЦИЯ сообщающая об ошибке (данные беруются из файла ERROR.DBF) function error($name,$info) { global $forum_skin; $name=replacer($name); $info=replacer($info); $back="<a href='javascript:history.back(1)'><B>вернуться назад</B></a>"; // Удобная строка $basa=dbase_open("data/error.dbf",0) or die("отсутсвует обязательный файл DATA/ERROR.DBF !!!"); $itogo=dbase_numrecords($basa); do {$record=dbase_get_record_with_names($basa,$itogo); if (replacer($record['ERROR'])==$name) $error_msg=$record; $itogo--;} while($itogo>0); dbase_close($basa); print"<html><head> <title>Ошибка</title> <meta http-equiv='Content-Type' content='text/html; charset=windows-1251'> <meta http-equiv='Content-Language' content='ru'> <meta name='Robots' content='noindex,nofollow'> <link rel='stylesheet' href='$forum_skin' type='text/css'> </head><body>"; $msg=replacer($error_msg['MSG']); if (eregi("@back@",$msg)) $again="$back и повторить ввод данных или<br>"; else $again=""; $msg=str_replace("@back@",'',$msg); $msg=str_replace("@info@","$info",$msg); print "<table border=0 width=100% height=80%><tr><td><table border=1 cellpadding=10 cellspacing=0 bordercolor=#FF0000 align=center valign=center width=60%><tr><td><center> <font color=red><B>Обнаружена ошибка!</B></FONT> <BR><BR><B>$msg</B><BR><BR> Вы можете $again перейти на <B><a href='index.php'>главную страницу форума</a></B>.</a></B></td></tr></table></td></tr></table></center></body></html>"; if($error_msg['STATUS']!="3") exit; // только если будет ошибка 3 скрипт продолжит работу. return $info;} function printtop($frtname,$frname) { global $f_name,$f_info_1,$f_info_2,$forum_skin; // Функция подключения верхнего блока $msg='<html> <head> <title>@frtname@ @frname@ @fname@</title> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> <meta http-equiv="Content-Language" content="ru"> <meta name="description" content="@f_info_1@@f_info_2@ - @fname@"> <meta http-equiv="keywords" content="@frtname@ @frname@ @fname@"> <meta name="Resource-type" content="document"> <meta name="document-state" content="dynamic"> <meta name="Robots" content="index,follow"> <link rel="stylesheet" href="@forum_skin@" type="text/css"> <SCRIPT language=JavaScript> <!-- function x () {return;} function FocusText() { document.REPLIER.msg.focus(); document.REPLIER.msg.select(); return true; } function DoSmilie(addSmilie) { var revisedMessage; var currentMessage = document.REPLIER.msg.value; revisedMessage = currentMessage+addSmilie; document.REPLIER.msg.value=revisedMessage; document.REPLIER.msg.focus(); return; } function DoPrompt(action) { var revisedMessage; var currentMessage = document.REPLIER.msg.value; } //--> </SCRIPT> </head> <table width="@forumwidth@" cellspacing=0 cellpadding=10 align=center><tr><td> <table width="100%"><tr><td valign="bottom" align="center"> <h4><a href="index.php">@fname@</a></h4> </td></TR><TR><td align="center" valign="top">@f_info_1@@f_info_2@ </td></tr></table> </td></tr></table>'; $msg=str_replace("@frtname@","$frtname",$msg); // меняем переменные на их значение $msg=str_replace("@frname@","$frname",$msg); $msg=str_replace("@fname@","$f_name",$msg); $msg=str_replace("@f_info_1@","$f_info_1",$msg); $msg=str_replace("@f_info_2@","$f_info_2",$msg); $msg=str_replace("@forum_skin@","$forum_skin",$msg); print $msg; return;} // ФУНКЦИЯ, определяющая еслть ли данные в DBF-файле! function data_dbf($dbfname) {$fdbf=fopen($dbfname,'r'); $buf=fread($fdbf,32); $header=unpack("VITOGO",substr($buf,4,8)); return $header['ITOGO'];} // считываем и обрабатываем конфигурационный файл if(!function_exists('dbase_open')) // ЕСЛИ НЕТ поддержки PHP_DBASE.DLL exit("<table align=center width=50% height=50%><TR valign=center><TD align=center> На Вашем хостинге возможность работы<br> <B>с DBF-файлами отключена или не поддерживается!</B><br><br> <B>Для корректной работы</B> скрипта необходимо<br> <B>включить библиотеку в php.ini</B> Вашего сервера: <font color=red><B>extension=php_dbase.dll</B></font><br> Если Ваш хостер включить эту библиотеку отказывается, то <br> качайте другой, на обычных txt-файлах!!!<br> В ближайшее время будет написана функция, которая позволить форуму <br> работать без этой библиотеки, следите за новостями на <a href=\"http://www.wr-script.ru\">нашем сайте</a>!</TD></TR></TABLE>"); $basa=dbase_open("data/config.dbf",0) or error("ERROR_BASE","data/config.dbf"); $itogo=dbase_numrecords($basa); if ($itogo<1) error("BAD_CONFIG",""); $cfg=dbase_get_record_with_names($basa,1); dbase_close($basa); $f_name=replacer($cfg['F_NAME']); $f_info_1=replacer($cfg['F_INFO_1']); $f_info_2=replacer($cfg['F_INFO_2']); $forum_skin=replacer($cfg['FORUM_SKIN']); $msg_onpage=replacer($cfg['MSG_ONPAGE']); if ($msg_onpage<1) $msg_onpage=1; $rand_key=replacer($cfg['RAND_KEY']); $max_key=replacer($cfg['MAX_KEY']); $s1=replacer($cfg['SMILE1']); $s2=replacer($cfg['SMILE2']); $s3=replacer($cfg['SMILE3']); $s4=replacer($cfg['SMILE4']); $s5=replacer($cfg['SMILE5']); $s6=replacer($cfg['SMILE6']); $s7=replacer($cfg['SMILE7']); $s8=replacer($cfg['SMILE8']); $s9=replacer($cfg['SMILE9']); $s10=replacer($cfg['SMILE10']); $s11=replacer($cfg['SMILE11']); $s12=replacer($cfg['SMILE12']); $s13=replacer($cfg['SMILE13']); $s14=replacer($cfg['SMILE14']); $s15=replacer($cfg['SMILE15']); $s16=replacer($cfg['SMILE16']); $s17=replacer($cfg['SMILE17']); $s18=replacer($cfg['SMILE18']); $s19=replacer($cfg['SMILE19']); $s20=replacer($cfg['SMILE20']); $s21=replacer($cfg['SMILE21']); $s22=replacer($cfg['SMILE22']); $s23=replacer($cfg['SMILE23']); $s24=replacer($cfg['SMILE24']); $smiles=array($s1,$s2,$s3,$s4,$s5,$s6,$s7,$s8,$s9,$s10,$s11,$s12,$s13,$s14,$s15,$s16,$s17,$s18,$s19,$s20,$s21,$s22,$s23,$s24); function nospam() { global $max_key,$rand_key; // Функция АНТИСПАМ 2011 ! if (array_key_exists("image", $_REQUEST)) { $num=replacer($_REQUEST["image"]); for ($i=0; $i<10; $i++) {if (md5("$i+$rand_key")==$num) {imgwr($st,$i); die();}} } $xkey=""; mt_srand(time()+(double)microtime()*1000000); $dopkod=mktime(0,0,0,date("m"),date("d"),date("Y")); // доп.код: меняется каждые 24 часа $stime=md5("$dopkod+$rand_key");// доп.код echo'<table border=0 cellspacing=0 cellpadding=0><tr height=30><TD>Защитный код:</TD>'; $nummax=0; for ($i=0; $i<=$max_key; $i++) { $snum[$i]=mt_rand(0,9); $psnum=md5($snum[$i]+$rand_key+$dopkod); $secret=mt_rand(0,1); $styles=''; if ($nummax<3) { if ($secret==1 or $i==0) {$styles='bgcolor=#FFFF00'; $xkey=$xkey.$snum[$i]; $nummax++;}} echo "<td width=20 $styles><img src=antispam.php?image=$psnum border=0 alt=''></td>\r\n";} $xkey=md5("$xkey+$rand_key+$dopkod"); //число + ключ из config.php + код меняющийся кажые 24 часа print"<td><input name='usernum' class=post type='text' maxlength=$nummax size=6> (введите цифры, которые на <font style='font-weight:bold'> жёлтом фоне</font>) <input name=xkey type=hidden value='$xkey'> <input name=stime type=hidden value='$stime'> </td></tr></table>"; return; } function crate_dbf($rn,$filename) { // Функция создания файла с темой (вызывается при потере данных в файле) $fid=substr($filename,0,3); $id=substr($filename,3,4); if (!file_exists("data/$filename.dbf")) { // необходимо считать данные из БД рубрики, выдернуть все параметры и на основании их построить // переменную $msg_record и далее записать её в созданную вновь тему $basa=dbase_open("data/$fid.dbf",0) or error("ERROR_BASE","data/$fid.dbf"); $itogo=dbase_numrecords($basa); for ($i=1;$i<$itogo;$i++) {$dt=dbase_get_record($basa,$i); if ($dt[0]==$rn) $i=$itogo;} dbase_close($basa); $msg_record=array("$dt[1]","F","$fid","$id","$dt[4]","Давайте обсудим: \"$dt[5]\"","$dt[6]","$dt[7]","$dt[8]","$dt[9]","$dt[10]","$dt[11]","$dt[12]","","","","","","","","","","","","","",""); $struktura=array( array("RN","N",5,0), array("GOLOS","L"), array("FID_RUBRIK","C",3), array("ID","N",4,0), array("TIME","N",10,0), array("TEMA","C",100), array("STATUS","L"), array("RN_USER","N",5,0), array("NAME","C",35), array("EMAIL","C",35), array("VIP","L"), array("OPEN","L"), array("IP","C",15), array("FILE_NAME","C",20), array("MSG1","C",250), array("MSG2","C",250), array("MSG3","C",250), array("MSG4","C",250), array("MSG5","C",250), array("MSG6","C",250), array("MSG7","C",250), array("MSG8","C",250), array("MSG9","C",250), array("MSG10","C",250), array("MSG11","C",250), array("MSG12","C",250), array("REZERVED","C",10)); if (!dbase_create("data/$filename.dbf",$struktura)) error("BAD_ADD_TEMA","с темой - data/$filename.dbf"); $basa=dbase_open("data/$filename.dbf",2) or error("ERROR_BASE","data/$filename.dbf"); dbase_add_record($basa,$msg_record); dbase_close($basa);} return; } if(isset($_GET['event'])) { // ДОБАВЛЕНИЕ темы или ответа $event=replacer($_GET['event']); if ($event!="addtopic" and $event!="addanswer") error("BAD_ADRESS",""); sleep(1); // мелкая защита от БОТОВ if ($cfg['ANTISPAM']==TRUE) { if (!isset($_POST['usernum']) or !isset($_POST['xkey']) or !isset($_POST['stime']) ) error("BAD_CODE",""); $usernum=replacer($_POST['usernum']); $xkey=replacer($_POST['xkey']); $stime=replacer($_POST['stime']); $dopkod=mktime(0,0,0,date("m"),date("d"),date("Y")); // доп.код. Меняется каждые 24 часа $usertime=md5("$dopkod+$rand_key");// доп.код $userkey=md5("$usernum+$rand_key+$dopkod"); if (($usertime!=$stime) or ($userkey!=$xkey)) error("BAD_CODE","");} // получаем данные из формы if (!isset($_POST['name']) or !isset($_POST['msg'])) error("NO_NAME_AND_MSG",""); $_POST['name']=replacer($_POST['name']); $name=replacer($_POST['name']); if (strlen($name)<1) error("NO_NAME",""); $msg=replacer($_POST['msg']); if ($event=="addtopic") { if (!isset($_POST['tema']) or !isset($_POST['fid'])) error("NO_RUBRIK_NAME",""); $fid=replacer($_POST['fid']); $tema=replacer($_POST['tema']); if (!ctype_digit($fid)) error("BAD_KEY",""); if ($tema=="" || strlen($tema) >35) error("BAD_TEMA_NAME",""); } else { if (isset($_POST['id'])) $id=replacer($_POST['id']); else error("BAD_ID",""); if (!ctype_digit($id)) error("BAD_TEMA_KEY",""); $tema=""; $fid=substr($id,0,3); $id=substr($id,3,4); } if (isset($_POST['email'])) $email=replacer($_POST['email']); else $email=null; if (isset($_POST['page'])) $page=replacer($_POST['page']); else $page="1"; if (!ctype_digit($page)) error("BAD_PAGE",""); if (!isset($name) || strlen($name)>35) error("NO_NAME",""); if ($msg == "" || strlen($msg)>3000) {$simvol=strlen($msg)-3000; if ($simvol<0) $simvol="несколько"; error("BAD_MSG","$simvol");} if (!eregi("^([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)$", $email) and strlen($email) > 30 and $email != "") error("BAD_EMAIL",""); // если длина сообщения больше 250 символов, то дробим его на части $m[0]=$msg;$m[1]=null;$m[2]=null;$m[3]=null;$m[4]=null;$m[5]=null;$m[6]=null;$m[7]=null;$m[8]=null;$m[9]=null;$m[10]=null;$m[11]=null; $msmax=strlen($msg); $i=0; do { if ($msmax>=$i*250) {$n=$i*250;} else {$n=$msmax; $i=12;} if ($msmax>=$n+250) {$k=250;} else {$k=$msmax;} $m[$i]=substr($msg,$n,$k); $i++; } while ($i<12); $tema==wordwrap($tema,40,' ',1); $name=wordwrap($name,40,' ',1); // разрываем слишком длинные строки $tektime=time(); // КОЛДУЕМ рандомные КОДы if ($event=="addtopic") {$z=null; do {$id=mt_rand(1000,9999); if (!file_exists("$fid$id.dbf")) $z++; } while ($z<1);} $z=null; do {$rn=mt_rand(10000,99999); if (strlen($rn)==5 and ctype_digit($rn)) $z++; } while ($z<1); $z=null; do {$rntema=mt_rand(10000,99999); if (strlen($rntema)==5 and ctype_digit($rntema)) $z++; } while ($z<1); $z=null; do {$id_tema=mt_rand(1000,9999); if (strlen($id_tema)==4 and ctype_digit($id_tema)) $z++; } while ($z<1); // собираем данные по шаблону: RN-ключ | RN-ключ темы | FID раздела | ID темы | МКТАЙМ:время_в_UNIX_формате | тема | | | имя | емайл | | 1 | | | if ($event=="addtopic") $tema_record=array("$rn","$rntema","$fid","$id","$tektime","$tema","F","","$name","$email","F","T","",""); // собираем данные по шаблону: RN-ключ | МКТАЙМ:время_в_UNIX_формате | тема |0| || имя | емайл | | 1 | | | собщение, раздробленное на 12 кусочков по 250 символов каждый || $msg_record=array("$rn","F","$fid","$id","$tektime","$tema","F","","$name","$email","F","T","","","$m[0]","$m[1]","$m[2]","$m[3]","$m[4]","$m[5]","$m[6]","$m[7]","$m[8]","$m[9]","$m[10]","$m[11]",""); if ($event=="addtopic") { // Добавление ТЕМЫ $basa=dbase_open("data/$fid.dbf",2) or error("ERROR_BASE","data/$fid.dbf"); $itogo=dbase_numrecords($basa); $i=$itogo; $error1=null; $error2=null; $record=null; do {$record[$i]=dbase_get_record_with_names($basa,$i); $filetema=replacer($record[$i]['TEMA']); if ($tema==$filetema) $error2=1; // Бежим по всему файлу тем и ЕСЛИ тема = любая тема в файле = ошибка $i--; } while ($i>0); if (($record[$itogo]['TIME']+30)>$tektime) {$error1=1; $eshe=$record[$itogo]['TIME']+30-$tektime;} if ($error1==null and $error2==null) dbase_add_record($basa,$tema_record); dbase_close($basa); if ($error1!=null) error("SPAM","$eshe"); if ($error2!=null) error("FLUD_TEMA",""); if(file_exists("$fid$id.dbf")) error("TEMA_EXIST",""); $struktura=array( array("RN","N",5,0), array("GOLOS","L"), array("FID_RUBRIK","C",3), array("ID","N",4,0), array("TIME","N",10,0), array("TEMA","C",100), array("STATUS","L"), array("RN_USER","N",5,0), array("NAME","C",35), array("EMAIL","C",35), array("VIP","L"), array("OPEN","L"), array("IP","C",15), array("FILE_NAME","C",20), array("MSG1","C",250), array("MSG2","C",250), array("MSG3","C",250), array("MSG4","C",250), array("MSG5","C",250), array("MSG6","C",250), array("MSG7","C",250), array("MSG8","C",250), array("MSG9","C",250), array("MSG10","C",250), array("MSG11","C",250), array("MSG12","C",250), array("REZERVED","C",10)); if (!dbase_create("data/$fid$id.dbf",$struktura)) error("BAD_ADD_TEMA","data/$fid$id.dbf"); // создание файла с темой $basa=dbase_open("data/$fid$id.dbf",2) or error("ERROR_BASE","data/$fid$id.dbf"); dbase_add_record($basa,$msg_record); dbase_close($basa); $itogo=1; $textpr="тема успешно добавлена";} if ($event=="addanswer") { //ОТВЕТ в теме // Открываем базу, считываем поля $basa=dbase_open("data/$fid$id.dbf",0) or error("ERROR_BASE","data/$fid$id.dbf"); $itogo=dbase_numrecords($basa); $dt=dbase_get_record_with_names($basa,$itogo); dbase_close($basa); if ($cfg['ANTIFLUD']==TRUE) { // функция АНТИФЛУД начало if ($itogo>0) { $last_msg=replacer($dt['MSG1']); $last_msg.=replacer($dt['MSG2']); $last_msg.=replacer($dt['MSG3']); $last_msg.=replacer($dt['MSG4']); $last_msg.=replacer($dt['MSG5']); $last_msg.=replacer($dt['MSG6']); $last_msg.=replacer($dt['MSG7']); $last_msg.=replacer($dt['MSG8']); $last_msg.=replacer($dt['MSG9']); $last_msg.=replacer($dt['MSG10']); $last_msg.=replacer($dt['MSG11']); $last_msg.=replacer($dt['MSG12']); $last_name=replacer($dt['NAME']); $last_time=replacer($dt['TIME']); $today=mktime(); if (($last_time+30)>$today) {$eshe=($last_time+30)-$today; error("SPAM","$eshe");} if ($last_msg==$msg and $last_name==$name) error("FLUD_MSG",""); } } // функция АНТИФЛУД конец // запись сообщения в файл $basa=dbase_open("data/$fid$id.dbf",2) or error("ERROR_BASE","data/$fid$id.dbf"); dbase_add_record($basa,$msg_record); dbase_close($basa); $itogo++; $textpr="Ваш ответ успешно добавлен";} $basa=dbase_open("data/$fid.dbf",2) or error("ERROR_BASE","data/$fid.dbf"); $fitogo=dbase_numrecords($basa); $i=0; $num=$fitogo; do {$record=dbase_get_record_with_names($basa,$i); if ($fid==$record['FID'] and $id==$record['ID_TEMA']) {$num=$i; $newrecord=$record;} $i++; } while ($i<$fitogo); // Цикл передвигает новую тему на самую верхнюю строчку файла базы данных if ($num!=$fitogo) { // только если тема не последняя unset($newrecord['deleted']); $newrecord=array_values($newrecord); do {$num++; $record=dbase_get_record($basa,$num); $num--; unset($record['deleted']); dbase_replace_record($basa,$record,$num); $num++;} while ($num<$fitogo); dbase_replace_record($basa,$newrecord,$fitogo); // Заменяем последнюю запись новой dbase_close($basa); } // if ($num!=$fitogo) // добавляем +1 в wrforum.dbf в КОЛИЧЕСТВО ТЕМ / СООБЩЕНИЙ $basa=dbase_open("data/wrforum.dbf",2) or error("ERROR_BASE","data/wrforum.dbf"); $i=dbase_numrecords($basa); $record=null; $num=-1; do {$record=dbase_get_record_with_names($basa,$i); // Бежим по всему файлу и ЕСЛИ ID рубрики = ID рубрики, куда добавляем тему, то нарашиваем кол-во тем на 1 if ($record['FID_RUBRIK']==$fid) { if ($event=="addtopic") $record['ITOGOTEM']++; $record['ITOGOMSG']++; $num=$i; $i=0;} $i--; } while ($i>0); if ($num!=-1) { unset($record['deleted']); $record=array_values($record); dbase_replace_record($basa,$record,$num);} dbase_close($basa); $page=ceil($itogo/$cfg['MSG_ONPAGE']); // расчитываем верную страницу и номер сообщения print "<html><head> <title>$textpr</title> <meta http-equiv='Content-Type' content='text/html; charset=windows-1251'> <meta http-equiv='Content-Language' content='ru'> <link rel='stylesheet' href='$forum_skin' type='text/css'> </head><body><script language='Javascript'>function reload() {location = \"index.php?id=$fid$id&page=$page#m$itogo\"}; setTimeout('reload()', 1500);</script> <table border=0 width=100% height=80%><tr><td><table border=1 cellpadding=10 cellspacing=0 bordercolor=#224488 align=center valign=center width=60%><tr><td><center> Спасибо <B>$name, $textpr.</B><BR><BR>Через несколько секунд Вы будете автоматически перемещены в тему <B>$tema</B>.<BR><BR> <B><a href='index.php?id=$fid$id&page=$page#m$itogo'>Нажмите здесь, если не хотите больше ждать</a></B></td></tr></table></td></tr></table></center></body></html>"; exit; } // if isset($event) // выводим ГЛАВНУЮ СТРАНИЦУ ФОРУМА if (!isset($_GET['fid']) and !isset($_GET['id']) and !isset($_GET['event'])) { if (!is_file("data/wrforum.dbf")) error("ERROR_BASE","data/wrforum.dbf"); if(data_dbf("data/wrforum.dbf")!=FALSE) { // если в файле есть данные $record=null; $basa=dbase_open("data/wrforum.dbf",0) or error("ERROR_BASE","data/wrforum.dbf"); $itogo=dbase_numrecords($basa); $i=$itogo; do {$record[$i]=dbase_get_record_with_names($basa,$i); $i--;} while ($i>0); dbase_close($basa);} else {$i="-1";} $frtname=""; $frname=""; printtop("",""); // Печатаем шапку print " <table class=maincolor cellSpacing=1 cellPadding=4 width=100%><tr class=row1><td><a href=index.php>$f_name</a> -> </td></tr></table><BR> <TABLE cellSpacing=0 cellPadding=0 width=\"100%\"><TR><TD class=maincolor> <TABLE cellSpacing=1 cellPadding=5 width=\"100%\"><tr align=center> <td class=rutoprow width=60% height=25>Группы</td> <td width=20 class=rutoprow>Предметов</td> <td width=55 class=rutoprow>Сообщений</td> <td width=225 class=rutoprow>Обновление</td></tr>"; $sumtem=0;$summsg=0; if ($i>=0) { do {$i++; $dt=$record[$i]; $fid=$dt['FID_RUBRIK']; $name=$dt['RNAME']; $coment=$dt['COMENT']; $itogotem=$dt['ITOGOTEM']; $sumtem=$sumtem+$itogotem; $itogomsg=$dt['ITOGOMSG']; $summsg=$summsg+$itogomsg; // считываем последнее сообщение из файла $FID.DBF $last_tema=""; unset($last); if (is_file("data/$fid.dbf")) { if(data_dbf("data/$fid.dbf")!=FALSE) { // если в файле есть данные $tbasa=dbase_open("data/$fid.dbf",0) or error("ERROR_BASE","data/$fid.dbf"); $fitogo=dbase_numrecords($tbasa); if ($fitogo>0) $last=dbase_get_record_with_names($tbasa,$fitogo); dbase_close($tbasa); $tema=replacer($last['TEMA']); $tema_full=$tema; if (strlen($tema)>25) {$tema=substr($tema,0,25); $tema.="...";} $id=$last['ID_TEMA']; $tbasa=dbase_open("data/$fid$id.dbf",0) or error("ERROR_BASE","data/$fid$id.dbf"); $titogo=dbase_numrecords($tbasa); if ($titogo>0) $tlast=dbase_get_record_with_names($tbasa,$titogo); dbase_close($tbasa); $today=date('d.m.y',mktime()); $lastdate=date('d.m.y',$tlast['TIME']); if ($today==$lastdate) $lastdate='<B>сегодня</B>'; $lasttime=date('H:i',$tlast['TIME']); $temaname=replacer($tlast['NAME']); $last_tema.="<span class=gensmall> тема: <a href=\"index.php?id=$fid$id\" title='$tema_full'>$tema</a> <BR>автор: <B>$temaname</B><BR> дата: <B>$lastdate</B> - $lasttime</span></td></tr>"; } //if data_dbf... } if ($dt['TYPE']==FALSE) { // в зависимости от ТИПА (топик или заголовок) меняем вывод print "<td width=60% class=row1 valign=middle><span class=forumlink> <a href=\"index.php?id=$fid\">$name</a><BR></span><small>$coment</small></td> <td width=7% class=row2 align=center><small>$itogotem</small></td> <td width=7% class=row2 align=center valign=middle><small>$itogomsg</small></td> <td width=28% class=row2 valign=middle>$last_tema</td></tr>"; } else {print "<tr height=28><td class=rutoprow colspan=2><center>$name</td><td class=rutoprow colspan=4 align=right> </td></tr>";} } while($i < $itogo); } // if ($i!=0) print "</table></table><br> </span></td></tr></table>"; } // конец главной страницы if (isset($_GET['id'])) { // страница С ТЕМАМИ выбранной РУБРИКИ $id=replacer($_GET['id']); if (!ctype_digit($id)) error("BAD_KEY",""); if (!is_file("data/$id.dbf")) error("NO_FILE","data/$id.dbf"); if(strlen($id)==3) { $fid=$id; // ЗНАЧИТ мы в разделе!!! // Считываем количество записей в рубрике с темами $record=null; $basa=dbase_open("data/$fid.dbf",0) or error("ERROR_BASE","data/$fid.dbf"); $itogo=dbase_numrecords($basa); $i=$itogo; do {$record[$i]=dbase_get_record_with_names($basa,$i); $i--;} while ($i>0); dbase_close($basa); if (isset($_POST['findme'])) { // ЕСЛИ есть фильтр по названию темы, то: // - Считываем файл с темами и отбираем в отдельный массив только те, которые содаржат в названии искомую фразу // - в $itogo записываем кол-во тем // - в $record[$i] записываем структуру+данные setlocale(LC_ALL,'ru_RU.CP1251'); // ! РАЗРЕШАЕМ РАБОТУ ФУНКЦИЙ, работающих с регистором и с РУССКИМИ БУКВАМИ $findme=replacer($_POST['findme']); $stroka=strlen($findme); if($stroka<4 or $stroka>30) error("PUSTOY_ZAPROS",$stroka); $temprecord=$record; $record=null; $i=0; foreach($temprecord as $v) {if (stristr($v['TEMA'],$findme)) {$i++; $record[$i]=$v;}} $itogo=$i;} else $findme=""; // Для отображения названия рубрики и навигации считываем файл WRFORUM.DBF $mainrecord=null; $basa=dbase_open("data/wrforum.dbf",0) or error("ERROR_BASE","data/wrforum.dbf"); $mainitogo=dbase_numrecords($basa); $mi=$mainitogo; do { $mainrecord[$mi]=dbase_get_record_with_names($basa,$mi); if ($mainrecord[$mi]['FID_RUBRIK']==$fid) {$frname=replacer($mainrecord[$mi]['RNAME']);} $mi--; } while ($mi>0); dbase_close($basa); // Исключаем ошибку вызова несуществующей страницы if (!isset($_GET['page'])) $page=1; else {$page=replacer($_GET['page']); if (!ctype_digit("$page")) $page=1; if ($page<1) $page=1;} $i=$itogo-$msg_onpage*($page-1); if ($i<1) {$i=$msg_onpage;} $last=$i-$msg_onpage; if ($last<1) $last=0; // формируем переменную $pageinfo - со СПИСКОМ СТРАНИЦ $maxpage=ceil(($itogo)/$msg_onpage); if ($page>$maxpage) {$page=$maxpage;} $pageinfo='<div style="margin: 5px;">Страницы: '; if ($page>=4 and $maxpage>5) $pageinfo.="<a href=index.php?id=$fid&page=1>1</a> ... "; $f1=$page+2; $f2=$page-2; if ($page<=2) {$f1=5; $f2=1;} if ($page>=$maxpage-1) {$f1=$maxpage; $f2=$page-3;} if ($maxpage<=5) {$f1=$maxpage; $f2=1;} for($k=$f2; $k<=$f1; $k++) {if ($page==$k) $pageinfo.="<B>$k</B> "; else $pageinfo.="<a href=index.php?id=$fid&page=$k>$k</a> ";} if ($page<=$maxpage-3 and $maxpage>5) $pageinfo.="... <a href=index.php?id=$fid&page=$maxpage>$maxpage</a>"; $pageinfo.='</div>'; printtop("$frname ->",""); // Печатаем шапку print "$navogator <table class=maincolor cellSpacing=1 cellPadding=0 width=100%><tr class=row1><td> <table cellSpacing=0 cellPadding=0 width=100%><TR><TD> <TABLE cellSpacing=0 cellPadding=0 width=\"100%\"><TR><TD class=maincolor> <TABLE cellSpacing=1 cellPadding=5 width=\"100%\"><tr align=center> <td width=60% class=rutoprow height=25>Предмет</td> <td width=10% class=rutoprow>Тем</td> <td width=12% class=rutoprow>Преподаватель</td> <td width=18% class=rutoprow>Обновления</td></tr>"; $addbutton="<BR> <table class=maincolor cellSpacing=1 cellPadding=0 width=100%> <td align=center width=200> <table cellSpacing=0 cellPadding=0 width=100%><TR><TD> <TD align=right>$pageinfo </TD></tr></table> </TD></tr></table> </TD></tr></table><BR>"; if ($itogo>0) { // если есть данные, то выводим do { $dt=$record[$i]; //В случае отсутствия файла с темой запускается // 1) проверка на валидность $dt[3] и $dt[2] (допустимы только цифры) // 2) функция автосоздания файла с темой $id=replacer($dt['ID_TEMA']); $fid=replacer($dt['FID']); $rn_tema=replacer($dt['RN_TEMA']); if (strlen($id)==4 and strlen($fid)==3) { if (ctype_digit("$id") and ctype_digit("$fid")) {if (!is_file("data/$fid$id.dbf")) crate_dbf("$rn_tema","$fid$id");}} $name=replacer($dt['NAME']); $email=replacer($dt['EMAIL']); $tema=replacer($dt['TEMA']); if (is_file("data/$fid$id.dbf")) { $tbasa=dbase_open("data/$fid$id.dbf",0) or error("ERROR_BASE","data/$fid$id.dbf"); $titogo=dbase_numrecords($tbasa); if($titogo>0) $lastrec=dbase_get_record_with_names($tbasa,$titogo); else $lastrec=null; dbase_close($tbasa); print "<tr height=50> <td width=57% class=row1 valign=middle><span class=forumlink><b><a href=\"index.php?id=$fid$id\">$tema</a>"; if ($titogo>$msg_onpage) { // Если тема содержит более 1 страницы, то формируем переменную $tpageinfo - со СПИСКОМ СТРАНИЦ $tmaxpage=ceil(($titogo)/$msg_onpage); $tpageinfo='<div style="font-size:10px; margin: 5px;">Страницы: '; if ($tmaxpage<=5) $f1=$tmaxpage; else $f1=5; for($j=1; $j<=$f1; $j++) $tpageinfo.="<a href=index.php?id=$fid$id&page=$j>$j</a> "; if ($tmaxpage>5) $tpageinfo.="... <a href=index.php?id=$fid$id&page=$tmaxpage>$tmaxpage</a>"; $tpageinfo.='</div>'; print $tpageinfo; } print"</span></td><td width=10% class=row2 align=center>$titogo</td> <td width=10% class=row2 align=center><span class=gensmall>"; if (strlen($email)>4) print"<a href=\"mailto:$email\">$name</a>"; else print"$name"; // Если есть записи в файле с темой - выводим последнюю if ($lastrec!=null) { $today=date('d.m.y',mktime()); $lastdate=date('d.m.y',$lastrec['TIME']); if ($today==$lastdate) $lastdate='<B>сегодня</B>'; $lasttime=date('H:i',$lastrec['TIME']); $lastname=replacer($lastrec['NAME']); } else {$lastname=null; $lastdate=null; $lasttime=null;} print "</span></td><td width=15% height=50 class=row2 align=left valign=middle><span class=gensmall> автор: $lastname<BR> дата: $lastdate<BR> время: $lasttime </td></tr>"; } //if is_file(data/$fid$id.dbf") $i--; } while($last < $i); print "</td></tr></table>"; print "</td></tr></table>"; print "$addbutton"; } else {print"$addbutton";} if (isset($_GET['newtema'])) { print "<TABLE class=maincolor cellSpacing=1 cellPadding=5 width=\"100%\"> <tr align=center><td class=rutoprow colspan=2 height=28><B>Добавление темы</B></td></tr> <tr><td class=row1 align=right valign=top rowspan=2><span class=gensmall> <B>Имя</B> и E-mail<BR> <B>Заголовок темы</B><BR><B>Сообщение</B></td><td class=row1 valign=middle rowspan=2> <form action=\"index.php?event=addtopic\" method=post name=REPLIER> <input type=text class=post name=name maxlength=35 size=23> <input type=text class=post name=email size=24><br> <input type=text class=post name=tema maxlength=35 size=50><br> <textarea class=post cols=100 rows=6 name=msg></textarea><br>"; if ($cfg['ANTISPAM']==TRUE) nospam(); // АНТИСПАМ ! print"<input type=hidden name=fid value='$fid'><br> <input type=submit class=mainoption value=' Добавить '><br><br></td></form> <SCRIPT language=JavaScript>document.REPLIER.msg.focus();</SCRIPT> </span> </tr></table><BR>"; } // уточнить что здесь заканчивается } // if strlen($id)==3 } // КОНЕЦ блока - страница С ТЕМАМИ выбранной РУБРИКИ if (isset($_GET['id'])) { // Показываем сообщения выбранной по $id ТЕМЫ $id=replacer($_GET['id']); if (ctype_digit($id) and strlen($id)==7) { // Проверка на ошибки, защиты от взлома $fid=substr($id,0,3);//Считываем FID - это первые три символа из $id $frtname=""; $frname=""; $record=null; // определяем есть ли информация в файле с данными if (!is_file("data/$id.dbf")) error("FILE_IS_DELETED","data/$id.dbf"); $basa=dbase_open("data/$id.dbf",0) or error("ERROR_BASE","data/$id.dbf"); $itogo=dbase_numrecords($basa); $i=0; if ($itogo>0) {do {$n=$itogo-$i; $i++; $record[$n]=dbase_get_record_with_names($basa,$i);} while ($i<$itogo);} dbase_close($basa); // Для отображения названия рубрики и навигации считываем файл WRFORUM.DBF // БЫСТРЫЙ ПЕРЕХОД к теме - считываем данные из файла $frecord=null; $basa=dbase_open("data/$fid.dbf",0) or error("ERROR_BASE","data/$fid.dbf"); $fitogo=dbase_numrecords($basa); $fi=$fitogo; if ($fitogo>0) {do {$frecord[$fi]=dbase_get_record_with_names($basa,$fi); $fi--;} while ($fi>0);} dbase_close($basa); if ($itogo>0) { // Исключаем ошибку вызова несуществующей страницы if (!isset($_GET['page'])) $page=1; else {$page=replacer($_GET['page']); if (!ctype_digit($page)) $page=1; if ($page<1) $page=1;} $i=$itogo-$msg_onpage*($page-1); if ($i<1) $i=$msg_onpage; $last=$i-$msg_onpage; if ($last<1) $last=0; // формируем переменную $pageinfo - со СПИСКОМ СТРАНИЦ $maxpage=ceil(($itogo)/$msg_onpage); if ($page>$maxpage) {$page=$maxpage;} $pageinfo='<div style="margin: 5px;">Страницы: '; if ($page>=4 and $maxpage>5) $pageinfo.="<a href=index.php?id=$id&page=1>1</a> ... "; $f1=$page+2; $f2=$page-2; if ($page<=2) {$f1=5; $f2=1;} if ($page>=$maxpage-1) {$f1=$maxpage; $f2=$page-3;} if ($maxpage<=5) {$f1=$maxpage; $f2=1;} for($p=$f2; $p<=$f1; $p++) {if ($page==$p) $pageinfo.="<B>$p</B> "; else $pageinfo.="<a href=index.php?id=$id&page=$p>$p</a> ";} if ($page<=$maxpage-3 and $maxpage>5) $pageinfo.="... <a href=index.php?id=$id&page=$maxpage>$maxpage</a>"; $pageinfo.='</div>'; $temaname=replacer($record[$itogo]['TEMA']); // Название темы есть только в последней строке таблицы $id=replacer($record[$itogo]['FID_RUBRIK']);$id.=replacer($record[$itogo]['ID']); $tblstyle="row1"; printtop("$temaname -> $frname ->",""); // Печатаем шапку print"$navogator <br><table class=maincolor cellSpacing=1 cellPadding=0 width=100%><tr class=row1><td> <table cellSpacing=0 cellPadding=0 width=100%><TR><TD> <div style='margin:5px;'><span class=nav> <a href=index.php class=nav>$f_name</a> -> <a href='index.php?id=$fid' class=nav>$frname</a> -> <a href='index.php?id=$id' class=nav><strong>$temaname</strong></a> </span></div> </td> <TD align=right>$pageinfo</TD></tr></table></TD></tr></table><BR> <TABLE class=maincolor cellSpacing=1 cellPadding=5 width=\"100%\"><tr align=center> <td class=rutoprow width=20% height=26>Автор</td> <td class=rutoprow width=80%>Cообщение</td></tr>"; do { $dt=$record[$i]; $number=1+$itogo-$i; $xdate=date('d.m.y',$dt['TIME']); $xtime=date('H:i',$dt['TIME']); $name=replacer($dt['NAME']); $email=replacer($dt['EMAIL']); // склеиваем всё сообщение в переменную MSG $msg=$dt['MSG1'].$dt['MSG2'].$dt['MSG3'].$dt['MSG4'].$dt['MSG5'].$dt['MSG6'].$dt['MSG7'] .$dt['MSG8'].$dt['MSG9'].$dt['MSG10'].$dt['MSG11'].$dt['MSG12']; $msg=replacer($msg); $msg=str_replace("<br>","<br>", $msg); $msg=str_replace("[b]","<b>", $msg); $msg=str_replace("[/b]","</b>", $msg); $msg=str_replace("[RB]","<B><font color=red>", $msg); $msg=str_replace("[/RB]","</font></B>", $msg); $msg=str_replace("[Quote]","<BR><fieldset align=center style='width:80%; color:#EE4422'><legend><B>Цитата:</B></legend>", $msg); $msg=str_replace("[/Quote]","</fieldset><BR>", $msg); $msg=str_replace("[Code]","<BR><fieldset align=center style='width:80%; color:#224488'><legend><B>Код:</B></legend>", $msg); $msg=str_replace(" ","</fieldset><BR>", $msg); if ($cfg['SHOWSMILES']==TRUE) {$j=count($smiles)-1; // заменяем текстовые смайлики на графические если разрешено for($k=0; $k<$j; $k=$k+2) { $t=$k+1; $msg=str_replace("$smiles[$t]","<img src='smile/$smiles[$k].gif' border=0>",$msg);}} // Заменяем ссылки на активные, если разрешено, подключаем блок $url_reg="((https?|ftp)://[[:alnum:]_=/-]+(\\.[[:alnum:]_=/-]+)*(/[[:alnum:]+&._=/~%]*(\\?[[:alnum:]?+&;_=/%]*)?)?)"; if ($cfg['LITEURL']==TRUE) { $msg=eregi_replace($url_reg, "<a href='\\1' target='_blank' >\\1</a>", $msg); $msg=eregi_replace("\\[img\\]<a href='$url_reg' target='_blank' >$url_reg</a>\\[/img\\]", "<img src='\\1' alt='\\1' border='0'>",$msg); } else { $msg=eregi_replace("\\[img\\]$url_reg\\[/img\\]", "<img src='\\1' alt='\\1' border='0'>",$msg); } if ($tblstyle=="row1") {$tblstyle="row2";} else {$tblstyle="row1";} print"</tr> <tr height=150><td class=$tblstyle valign=top> <small><I><B>$number.</B></I><center></small>"; if (strlen($email)>4) print"<a href=\"mailto:$email\">$name</a>"; else print"$name"; print" <a name='m$number' href='javascript:%20x()' onclick=\"DoSmilie('[b] $name [/b], ');\">".chr(149)."</a><BR><BR><small> <BR><BR><BR><BR><BR><BR><BR>Отправлено: <b>$xdate</b> - $xtime</span></small></td> <td class=$tblstyle height=28 valign=middle>$msg</td></tr> <tr><td class=rutoprow colspan=2 height=10></td>"; $i--; } while($last < $i); echo'</tr></table><br>'; if (isset($_GET['add'])) { // Если нажали кнопку добавить сообщение print " <br><form action=\"index.php?event=addanswer\" method=post name=REPLIER> <table cellpadding=3 cellspacing=1 width=100% class=maincolor> <tr><td class=rutoprow colspan=2 height=25 align=center><b>Добавление сообщения</b></td></tr> <tr><td class=row1 width=14% height=25><b>Имя</B> и E-mail<BR></td><td class=row2 width=76%> <input type=hidden name=id value=\"".$dt['FID_RUBRIK'].$dt['ID']."\"> <input type=hidden name=page value=$page> <input type=text maxlength=35 size=28 name=name> <input type=text maxlength=35 size=30 name=email> </td></tr><tr> <td class=row1 valign=top><span class=genmed><b>Сообщение</b><br>Для вставки имени, кликните на точку рядом с ним.<br> <table align=center width=120 height=70><tr><td valign=top>"; if ($cfg['SHOWSMILES']==TRUE) {$i=count($smiles)-1; echo'Смайлики:<br><br>'; for($k=0; $k<$i; $k=$k+2) { $j=$k+1; if (strlen($smiles[$k])>1) print"<A href='javascript:%20x()' onclick=\"DoSmilie(' $smiles[$j]');\"><img src='smile/$smiles[$k].gif' border=0></a>\r\n";} } print"</tr></td></table> </span></td> <td class=row2 valign=top><span class=genmed> <input type=button class=button value=' B ' style='font-weight:bold; width: 30px' onclick=\"DoSmilie(' [b] [/b] ');\"> <input type=button class=button value=' RB ' style='font-weight:bold; color:red' onclick=\"DoSmilie('[RB] [/RB]');\"> <input type=button class=button value='Цитировать выделенное' style='width: 170px' onclick='REPLIER.msg.value += \"[Quote]\"+(window.getSelection?window.getSelection():document.selection.createRange().text)+\"[/Quote]\"'> <input type=button class=button value=' Код ' onclick=\"DoSmilie(' [Code] [/Code] ');\"> <br><textarea name=msg cols=95 rows=10 class=post></textarea></span><br> <SCRIPT language=JavaScript>document.REPLIER.name.focus();</SCRIPT><br>"; if ($cfg['ANTISPAM']==TRUE) nospam(); // АНТИСПАМ ! print" <tr><td class=row1 colspan=2 align=center height=28><input type=submit tabindex=5 class=mainoption value=' Отправить '> <input type=reset tabindex=6 class=mainoption value=' Очистить '></td> </tr></table></form>"; } } else print "$addbutton<TD align=right width=40%>$pageinfo</TD></tr></table>"; // if $itogo > 0 } // if (ctype_digit($id) and strlen($id)==7) } // if isset($_GET['id']) ?>[/code]
зачем ты это вывалил? насколько я вижу, здесь нет попытки идентифицировать пользователя. в первом посте ты привел скрипт, который устанавливает куки про пользователя. здесь тебе надо их прочитать и проверить валидность — примерно также как при вводе пароля, только в куке у тебя md5(пароль), значит сравнивать надо с md5(пароль из базы). вот и все!
А кто тебя научил хранить пароль и логин в cookie, плюс sql injection????? Только что обратил внимание... Извини, но по моему ты плохой информатик. УЖАС !!!
ребята я не програмист а ток сис админ! если я не ошибаюсь то чтение куков echo $_COOKIE['???']; только вот что надо вместо ? ("pass" или "login") ?? Добавлено спустя 1 минуту 56 секунд: я хочу внести одну поправочку что я слегка знаю разметку html а в php почти 0 Добавлено спустя 27 минут 55 секунд: только громко не ругайте пожалуйста, а если не так поправте пожалуйста Код: if (isset($_COOKIE['login']) { $state='1' } else { выход с сайта } if($state = 1) { код страници } else { выход с сайта }