File size: 6.98Kb
<?php
$fod=getcwd();
$fold=$fod."/inc/members";
chdir($fold);
$fo=opendir($fold);
while ($read=readdir($fo))
{
if(($read != ".") && ($read != ".."))
{
$note[]=$read;
$fnt = file("$read");
$notes[] = $fnt[0];
rsort($note);
}
}
chdir("../../");
closedir($fo);
$count_notes = count($notes);
if (isset($_POST['name'])) {
$name = htmlspecialchars(substr(trim($_POST['name']), 0, 45));
$sid = htmlspecialchars(substr(trim($_POST['sid']), 0, 4));
$email = htmlspecialchars(substr(trim($_POST['email']), 0, 80));
$site_url = htmlspecialchars(substr(trim($_POST['site_url']), 0, 80));
$pwd = htmlspecialchars(substr(trim($_POST['pwd']), 0, 20));
if (isset($_POST['banner'])) $banner = htmlspecialchars(substr(trim($_POST['banner']), 0, 100)); else $banner = "";
if (isset($_POST['descr'])) $descr = htmlspecialchars(substr(trim($_POST['descr']), 0, 255)); else $descr = "";
$note = $site_url."¤".$banner."¤".$name."¤".$email."¤".$sid."¤".$descr."¤".$pwd;
$fopt = fopen ("./inc/members/sid".$sid.".db", "w");
if ($fopt) $result = fwrite($fopt, $note);
fclose($fopt);
?>
<p> </p><p> </p><center><span style="FONT-SIZE: 32px; FONT-FAMILY: 'Courier new',Verdana;"><b>Спасибо!</b></span><br><span style="FONT-SIZE: 18px; FONT-FAMILY: 'Courier new',Verdana;"><b>Ваша информация успешно сохранена!</font></span><p align=center><a href="index.php"><b>Вернуться в рейтинг</a><br><br><br><br>
<?php
}
elseif (isset($_POST['pwd'])) {
$sid = htmlspecialchars(substr(trim($_POST['sid']), 0, 4));
$pwd = htmlspecialchars(substr(trim($_POST['pwd']), 0, 20));
for ($j=0;$j<$count_notes;$j++) {
$record = explode("¤", trim($notes[$j]));
if ($sid==$record[4]) $uid=$j;
}
$record = explode("¤", trim($notes[$uid]));
if (($pwd != $record[6]) || ($uid<0)) {
?>
<P> </P><P> </P><center><span style="FONT-SIZE: 18px;COLOR: #F00000; FONT-FAMILY: Verdana;"><b>НЕВЕРНЫЙ пароль !</font></span><br><br>
<a href="javascript:history.back();"><span style="FONT-SIZE: 18px; FONT-FAMILY: 'Courier new',Verdana;"><b><<Назад</font></span></a><br><br>
<?php
}
else { ?>
<script language="javascript">
function checkform (f1) {
if (f1.email.value=="") {alert("Введите ваш email !");return false;}
else if (f1.email.value.search('@')<0) {alert("Введите корректный email !");return false;}
else if (f1.site_url.value=="") {alert("URL сайта не задано !");return false;}
else if (f1.pwd.value=="") {alert("Введите пароль для редактирования информации");return false;}
else if (f1.name.value=="") {alert("Название сайта не задано !");return false;}
else return true;
}
</script>
<FORM METHOD="POST" name="f1" onsubmit="return checkform(this);"><input type="hidden" name="sid" value="<?php echo $sid; ?>">
<table cellspacing=0 border=0 align=center>
<tr>
<td>
<DIV class=blue>
<DIV class=headblue>
<table cellspacing =0 border=0 background="images/fbg1.gif">
<tr height=10><td>
<TR>
<TD background="images/fbg3.gif" class=d4><b> Ваш Email </TD>
<TD background="images/fbg3.gif" class=d4> <font color=red>*<INPUT class=sb TYPE="text" style="width:260px;" NAME="email" maxlength=80 value="<?php echo $record[3]; ?>"> </TD>
</TR>
<TR>
<TD background="images/fbg3.gif" class=d4><b> URL сайта</TD><TD background="images/fbg3.gif" class=d4> <font color=red>*<INPUT class=sb TYPE="text" style="width:260px;" NAME="site_url" maxlength=80 value="<?php echo $record[0]; ?>"> </TD>
</TR>
<TR>
<TD background="images/fbg3.gif" class=d4><b> URL баннера</TD><TD background="images/fbg3.gif" class=d4> <INPUT class=sb TYPE="text" style="width:260px;" NAME="banner" maxlength=100 value="<?php echo $record[1]; ?>"> </TD>
</TR>
<TR>
<TD background="images/fbg3.gif" class=d4><b> Пароль</TD>
<TD background="images/fbg3.gif" class=d4> <font color=red>*<INPUT class=sb TYPE="password" style="width:260px;" NAME="pwd" maxlength=20 value="<?php echo $record[6]; ?>"> </TD>
</TR>
<TR>
<TD background="images/fbg3.gif" class=d4><b> Название сайта</TD>
<TD background="images/fbg3.gif" class=d4> <font color=red>*<INPUT class=sb TYPE="text" style="width:260px;" NAME="name" maxlength=100 value="<?php echo $record[2]; ?>"> </TD>
</TR>
<TR>
<TD background="images/fbg3.gif" class=d4><b> Описание сайта</TD><TD background="images/fbg3.gif" class=d4> <input class=sb style="width:260px;" NAME="descr" maxlength=256 value="<?php echo $record[5]; ?>"></input> </TD>
</TR>
<tr height=10>
<TD background="images/fbg3.gif" class=d4>
<TD background="images/fbg3.gif" class=d4>
<TR>
<TD colspan=2 align=center background="images/fbg3.gif"><input class=sb2 style="cursor:hand" type=submit value=" Редактировать "></TD>
<tr height=10><td>
</td>
</tr></TABLE></form>
</div>
</div>
</td>
</tr>
</table>
<?php }
}
else print_form();
function print_form() {
global $notes, $count_notes;
?>
<p> </p><p> </p>
<center>
<span class=d3><b>Пожалуйста выберите ваш сайт:</b></span>
<FORM METHOD="POST" name="f1">
<table cellspacing=0 border=0>
<tr>
<td>
<DIV class=blue>
<DIV class=headblue>
<table cellspacing=0 border=0>
<TR>
<TD background="<?php echo top_bg2; ?>" class=d4><b> Ваш Сайт: </TD>
<TD background="<?php echo top_bg2; ?>" class=d4> <select name="sid" style="width:420px">
<?php
for ($j=0;$j<$count_notes;$j++) {
$record = explode("¤", trim($notes[$j]));
$st=substr($notes[$j],0,1);
echo "<option value=\"".trim($record[4])."\"";
if ($j == 0) echo " selected";
echo ">\n";
if ($st[0] == "*") echo "#"; else echo "";
echo substr(trim(substr($record[0], 7)),0,80)."</option>";
}
?></select> </TD>
</TR>
<tr height=10><td>
<tr>
<td background="<?php echo top_bg3; ?>" class=d4><b> Пароль:</TD>
<TD background="<?php echo top_bg3; ?>" class=d4 nowrap> <INPUT class=sb TYPE="password" style="width:100px;" NAME="pwd" maxlength=20> <B>ID Сайта: <INPUT class=sb TYPE="button" style="width:35px;" NAME="site"> <input class=sb2 type="button" value="GetID" onclick="document.f1.site.value=document.f1.sid.value" style="height:18px"></TD>
</TR>
</TABLE>
</div>
</div>
</td>
</tr>
</table>
<table cellspacing=0 border=0>
<tr>
<td align=center><input class=sb2 class=enter style="cursor:hand;" type=submit value=" Редактировать "></td>
</tr>
</table>
</form>
<script>
document.f1.site.value=document.f1.sid.value;
</script>
<?php } ?>
</HTML>