<?
session_start();
include 'all. php';
if(isset($_REQUEST ['login'])) $login=$_REQUEST ['login'] ;
if(isset($_REQUEST ['password'])) $password=md5($_REQUEST ['password']);
$student=loginpass($login, $password);
if(! $student)
{
echo "<script> alert('Неправильное имя или пароль пользователя! ') </script>";
include 'InternetTechnology. php';
}
else
{
$_SESSION ['student'] ['name'] =$student ['name'] ; $_SESSION ['student'] ['family'] =$student ['secondname'] ;
$_SESSION ['student'] ['group'] =$student ['idstud'] ; $_SESSION ['student'] ['faculty'] =$student ['faculty'] ;
$_SESSION ['student'] ['email'] =$student ['email'] ; $_SESSION ['student'] ['login'] =$student ['login'] ;
echo "<script> alert('Вы в системе! ') </script>";
include 'InternetTechnology. php';
}
? >
А.6 Листинг модуля "start_stop_session. php"
<?
session_start();
//echo '<meta http-equiv=Content-Type content=text/html; charset=windows-1251>';
include("all. php");
$family=$_REQUEST ['secondname'] ; $name=$_REQUEST ['name'] ; $group=$_REQUEST ['group'] ; $faculty=$_REQUEST ['faculty'] ;
$login=$_REQUEST ['login'] ; $pass=$_REQUEST ['password'] ; $email=$_REQUEST ['email'] ;
if($family! =''&$name! =''&$group! =''&$faculty! =''&$pass! =''&$email! =''&$login! ='')
{
if (! ereg ("^. +@. +\. +$",$email))
{
$_SESSION ['error_fill'] ['bool'] =true;
$_SESSION ['error_fill'] ['message'] ='<b>Проверьте правильность написания электронного адреса! </b>';
include 'InternetTechnology. php';
}
elseif(store_student($group, $name, $family, $faculty, $login, md5($pass), $email))
{
$_SESSION ['student'] ['name'] =$name; $_SESSION ['student'] ['family'] =$family;
$_SESSION ['student'] ['group'] =$group; $_SESSION ['student'] ['faculty'] =$faculty;
$_SESSION ['student'] ['email'] =$email; $_SESSION ['student'] ['login'] =$login;
echo"<script> alert('Вы зарегистрированы в системе') </script>";
include 'InternetTechnology. php';
} else
{
$_SESSION ['error_fill'] ['bool'] =true;
$_SESSION ['error_fill'] ['message'] ='<b>Не записано. Возможно такой шифр или Ник уже существует. Шифр и Ник должны быть уникальными. </b>';
include 'InternetTechnology. php';
}
}
else
{
$_SESSION ['error_fill'] ['bool'] =true;
$_SESSION ['error_fill'] ['message'] ='<b>Заполнены не все поля! Пожалуйста будьте внимательнее! </b>';
include 'InternetTechnology. php';
}
? >
А.7 Листинг модуля "all. php"
<?
include_once("funcexam. php");
include_once("BaseFunctions. php");
include_once("funcquest. php");
include_once("funcchat. php");
include_once("funcshop. php");
include_once("styles. css");
? >
Б.1 Листинг модуля "gb. php"
<?
echo '<meta http-equiv=Content-Type content=text/html; charset=windows-1251>';
if(isset($_REQUEST ['message'])) $message=$_REQUEST ['message'] ;
else $message='';
$group='';
if(! isset($_SESSION ['student']))
{
if($message)
{
echo "<script> alert ('Чтобы оставить ссобщение в гостевой книге нужно зарегистрироваться! ') </script>";
}
} else $group=$_SESSION ['student'] ['group'] ;
include('all. php');
$color_replace = array ('#\ [color=(\# [0-9A-F] {6}| [a-z\-] +) \] (. *?) \ [/color\] #si' => '<font color="\1">\2</font>');
$link_replace=array('#([\w] +?: // [^ \"\n\r\t<] *) #si' => '<a href="\1" target=_blank><u>\1</a></u>');
$color1='#e5e5e5';
$color2='#cbdff7';
$color3='#84ade1';
$pageid=$_SESSION ['page'] ;
if($message! =''&$group! ='')
{
$ip=$_SERVER ['REMOTE_ADDR'] ;
if(! badip($ip, 'gb'))
{
$message=wordwrap($message,50," ",1);
filter($message);
if(! storeguest($group, $message, $ip, $pageid)) echo "<b><script> alert('Не удалось записать сообщение! ')";
}else echo "<b><script> alert('Запись сообщений с этого IP - адреса запрещена администратором! ') </b>";
}
$ids=idsg($pageid);
echo "<center>
<table width=95% border=1 cellspacing=0 cellpadding=3 bgcolor=$color3>
<tr bgcolor=$color2>
<td><font color=darkblue size=+1><b> Вы можете оставить свои пожелание в гостевой книге: $pageid</b></font></td>
</tr>
<tr bgcolor=$color3><td>
<table width=100% border=0> <tr> <td width=15%><b><center>
<font color=darkblue> Автор</font></center></b></td> <td width=75%><center><b>
<font color=darkblue>Сообщение</font></b></center></td><td width=10%>
<b><center><font color=darkblue>Записано</font></b></center></td></tr></table>
</td></tr><tr><td>";
echo "<table width=100% border=0>";
if(sizeof($ids) >0)
{
$i=0; $row=0;
while(++$i<=sizeof($ids))
{
$mes=mes($ids [$i-1], 'idguest','guests');
$student=studguest($ids [$i-1], $pageid);
if($mes)
{
foreach($color_replace as $k=>$v)
{
$mes ['message'] =preg_replace($k,$v,$mes ['message']);
}
foreach($link_replace as $key=>$value)
{
$mes ['message'] =preg_replace($key, $value, $mes ['message']);
}
$mes ['message'] =smiles($mes ['message']);
$date=reformat_date($mes ['time']);
if ($row%2) $col=$color1; else $col=$color2;
echo
"<tr bgcolor=". $col. "> <td width=15% valign=top align=center>
<a href=mailto: ". $student ['email']. " title=\" Нажмите для отправки по e-mail\"><b>". $student ['name']. "</b>
<a><font size=1><br>". $mes ['ip']. "</font> </td> <td width=75% valign=center align=left>". $mes ['message']. "</td>
<td width=10% align=center><font size=2>". $date. "</font></td></tr> ";
$row++;
}}
echo "</table> </center>";
}
echo "
</td></tr>
<tr>
<td bgcolor=$color3><font color=darkblue><b>Отображается 10 последних сообщений</b></font></td>
</tr>
<tr>
<td>";
include('postmodule. php');
echo "</td></tr></table></td></tr></table>";
? >
Б.2 Листинг модуля "postmodule. php"
<SCRIPT language=javascript>
var Bold = 0;
var Italic = 0;
var Underline = 0;
var Color = 0;
function PostWrite(NewCode) {
document. gb. message. value+=NewCode;
document. gb. message. focus();
return;
}
function WObold() {
if (Bold == 0) {
ToAdd = " [b] ";
document. gb. bold. value = " B*";
Bold = 1;
} else {
ToAdd = " [/b] ";
document. gb. bold. value = " B ";
Bold = 0;
}
PostWrite(ToAdd);
}
function WOitalic() {
if (Italic == 0) {
ToAdd = " [i] ";
document. gb. italic. value = " I*";
Italic = 1;
} else {
ToAdd = " [/i] ";
document. gb. italic. value = " I ";
Italic = 0;
}
PostWrite(ToAdd);
}
function WOunder() {
if (Underline == 0) {
ToAdd = " [u] ";
document. gb. under. value = " U*";
Underline = 1;
} else {
ToAdd = " [/u] ";
document. gb. under. value = " U ";
Underline = 0;
}
PostWrite(ToAdd);
}
function WOColor() {
if (Color == 0) {
ToAdd = " [color=] ";
document. gb. color. value = " Font Color*";
Color = 1;
} else {
ToAdd = " [/color] ";
document. gb. color. value = " Font Color ";
Color = 0;
}
PostWrite(ToAdd);
}
function WOLi() {
ToAdd = " [*] ";
PostWrite(ToAdd);
}
function emoticon(theSmilie) {
document. gb. message. value += ' ' + theSmilie + ' ';
document. gb. message. focus();
}
</SCRIPT>
<?
echo "<table width=100% border=1 cellpadding=0 cellspacing=0 bgcolor='#e5e5e5'>
<tr>
<td><table width=100% border=0 cellspacing=0 cellpadding=6>
<tr>
<td width=60% align=left>";
echo"
<INPUT class=form_but title='Bold: [Alt + b] - При повторном нажатии тег закроется' style='FONT-WEIGHT: bold' accessKey=b onclick=WObold() type=button value=' B ' name=bold>
<INPUT class=form_but title='Italic: [Alt + i] - При повторном нажатии тег закроется' style='FONT-STYLE: italic' accessKey=i onclick=WOitalic() type=button value=' I ' name=italic>
<INPUT class=form_but title='Underline: [Alt + u] - При повторном нажатии тег закроется' style='TEXT-DECORATION: underline' accessKey=u onclick=WOunder() type=button value=' U ' name=under>
<INPUT class=form_but title='Элемент списка: [Alt + l] - Закрывающий тег не требуется' style='FONT-WEIGHT: bold' accessKey=l onclick=WOLi() type=button value=' * ' name=li>
<INPUT class=form_but title='Цвет шрифта: [Alt + c] - При повторном нажатии тег закроется' accessKey=c onclick=WOColor() type=button value='Font Color' name=color>
<br><textarea class=message name=message cols=60 rows=3></textarea><br>
 
<a href=javascript: emoticon(':: wink:: ') >
<img alt='Ухмылочка' src=smiles/icon_wink. gif border=0></a>  
<a href=javascript: emoticon(':: sad:: ') >
<img alt='Не рад' src=smiles/icon_sad. gif border=0></a>  
<a href=javascript: emoticon(':: lol:: ') >
<img alt='Очень рад' src=smiles/icon_lol. gif border=0></a>  
<a href=javascript: emoticon(':: cry:: ') >
<img alt='Плач' src=smiles/icon_cry. gif border=0></a>  
<a href=javascript: emoticon(':: shock:: ') >
<img alt='Шок' src=smiles/icon_eek. gif border=0></a>  
<a href=javascript: emoticon(':: smile:: ') >
<img alt='Улыбка' src=smiles/icon_smile. gif border=0></a>  
<a href=javascript: emoticon(':: exclaim:: ') >
<img alt='Восклицательный знак' src=smiles/icon_exclaim. gif border=0></a>  
<a href=javascript: emoticon(':: question:: ') >
<img alt='Вопрос' src=smiles/icon_question. gif border=0></a>  
<a href=javascript: emoticon(':: dont:: ') >
<img alt='Не надо' src=smiles/dont. gif border=0></a>
<a href=javascript: emoticon(':: dedmoroz:: ') >
<img alt='Дед мороз' src=smiles/dedmoroz. gif border=0></a>
<A href=javascript: emoticon(':: kiss:: ') >
<IMG alt='Поцелуй' src=smiles/kiss. gif border=0></A>
<A href=javascript: emoticon(':: frag:: ') >
<IMG alt='Лягушка' src=smiles/frag. gif border=0></A>
<A href=javascript: emoticon(':: flag:: ') >
<IMG alt='Флаг' src=smiles/flag. gif border=0></A>
<input type='submit' name='Submit' title='Нажмите для отправки сообщения' value=Отправить></td>
<td width=45% align=left>
[b] <b>Полужирный текст</b> [/b] <br>
[u] <u>Подчеркнутый</u> [/u] <br>
[i] <i>Курсив</i> [/i]  
[*] Элемент списка<br>
[color=blue] </span><b><font color='#0000FF'>Цветной текст</font></b> [/color]
<br>Ссылки, начинающиеся с http:, <b> подчеркиваются автоматически. </b></td>
</tr></table></td></tr></table>";
? >
Б.3 Листинг модуля "funcguest. php"
<?
function studguest($idguest, $page) // Eiee? anoai ioieoia id
{
$conn = db_connect();
if($page=='all')
{
$query = "select idstudg from guests where idguest='$idguest'"; //
$result = mysql_query($query);
if(! $result) return false;
}else
{
$query = "select idstudg from guests where page='$page' and idguest='$idguest'"; //
$result = mysql_query($query);
if(! $result) return false;
}
$id=mysql_result($result,0,0);
$query = "select* from students where idstud='$id'";
$result = mysql_query($query);
if(! $result) return false;
return mysql_fetch_array($result);
}
function idssort($page) // Eiee? anoai ioieoia id
{
$conn = db_connect();
$query = "select idguest from guests order by $page";
$result = mysql_query($query);
if(! $result) return false;
$num=mysql_numrows($result);
if($num>0)
{
for($i=0; $i<$num; $i++)
$idsg [$i] =mysql_result($result,$i,0);
return $idsg;
}
}
function delguest($id) // Eiee? anoai ioieoia id
{
$conn = db_connect();
$query = "delete from guests where idguest=$id";
$result = mysql_query($query);
if(! $result) return false;
return true;
}
function idsg($page) // Eiee? anoai ioieoia id
{
$conn = db_connect();
$query = "select idguest from guests where page='$page' order by time";
$result = mysql_query($query);
if(! $result) return false;
$num=mysql_numrows($result);
if($num>0)
{
for($i=0; $i<$num; $i++)
$idsg [$i] =mysql_result($result,$i,0);
return $idsg;
}
}
function filter(&$func_var1)
{
$func_var1=htmlspecialchars(stripslashes(trim($func_var1)));
}
function storeguest($idstud, $message, $ip, $page)