Малък проблем със система

C++ JAVA
Post Reply
User avatar
rutera24
Турист
Турист
Posts: 281
Joined: Sun Dec 06, 2009 6:35 pm
Answers: 14
Location: Sofia

Малък проблем със система

Post by rutera24 » Sun Dec 13, 2009 9:36 pm

Ами значи това е система за лични съобщения, логин,регистер,аватар и т.н. без MySQL.Та проблема е следният:Регистрира се един потребител 1-вия всичко е ок но когато да кажем се опитаме да регистрираме втори потребител всичко минава добре докато не се опитаме да се логнем това просто не може да стане дава Грешен потребител или парола.Докато проблем със първия потребител няма.Ето фаиловете
index.php

Code: Select all

<html>
<head>
<meta charset="windows-1251">
<title>Намери си нов приятел</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
		<link type="text/css" rel="stylesheet" href="style.css" media="screen" />
<META content="MSHTML 5.00.2614.3500" name=GENERATOR>
</head>
<body bgcolor="#f5f5f5" link="#0033ff" text="#000000" marginwidth="5">
<br>
<table align="center" border="0" cellPadding="1" cellSpacing="0" class="bordercolor" width="92%">
<tbody>
<tr>
<td class="bordercolor" width="100%">
<table bgcolor="#ffffff" cellPadding="0" cellSpacing="0" width="100%">
<tbody>
<tr>
<td>
<table bgcolor="#ffffff" border="0" cellPadding="0" cellSpacing="8" width="100%">
<tbody>
<tr>
<td>
<font size="3" color="#AFC6DB" class="copyright">
<b>Намери си нов приятел &#58;&#41;</b>
</font>
<hr color="#AFC6DB">
</td>
</tr>
<td align="left">
<?php
include "gmain.php";
if &#40;$action==""&#41;&#123;
&#125;
?><html>
<body topmargin="50" leftmargin="50">
<td><img src="clear.gif" width="1" height="330"> 
</td><font class="titlebg">
 </font></td></tr></tbody></table></td></tr></tbody></table></tr></tr>
  <tr>
    <td align="middle" class="bordercolor">
      <table align="center" bgcolor="#afc6db" cellpadding="0" cellspacing="0" width="100%">
        <tbody>
        <tr>
          <td align="middle" width="100%">
            <table align="center" bgcolor="#afc6db" border="0" cellpadding="3" cellspacing="0" width="100%">
              <tbody>
              <tr></tr></tbody></table></td></tr></tbody></table></td></tr>
  <tr>
    <td align="middle" class="bordercolor">
      <table align="center" bgcolor="#ffffff" cellpadding="0" cellspacing="0" width="100%">
        <tbody>
        <tr>
          <td align="middle" width="100%">
            <table align="center" bgColor="#ffffff" border="0" cellPadding="5" cellSpacing="0" width="100%">
              <tbody>
              <tr>
                <td align="middle" bgColor="#ffffff" vAlign="center"><font color="#00000" size="2" class="code"><a href="index.php">«Начало»</a> <a href="?action=signup">«Регистрация»</a> <a href="?action=login">«Вход»</a></td>
              </tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table><br>
<center><tr></tr>
</center></body></html>
gmain.php

Code: Select all

<html>
<head>
<meta charset="windows-1251">
<script language="JavaScript">
<!--
function emo&#40;emo&#41;&#123;
document.all.message.value += emo;
document.all.message.focus&#40;&#41;;
return;
&#125;
//-->
</script>
</head>
<?php
$prl=$name;
extract&#40;$HTTP_GET_VARS&#41;;
extract&#40;$HTTP_POST_VARS&#41;;
$auser="admin"; //усернайма на администратора на сайта
$apassword="password"; //паролата на администратора на сайта
$date=time&#40;&#41;;
$message = str_replace &#40;"n","<br>", $message&#41;;
$message = str_replace &#40;"|~~|","", $message&#41;;
$message = str_replace &#40;"&#58;&#41;","<img src=images/smile.gif>", $message&#41;;
$message = str_replace &#40;"&#58;&#40;","<img src=images/sad.gif>", $message&#41;;
$message = str_replace &#40;"&#58;P","<img src=images/tongue.gif>", $message&#41;;
$message = str_replace &#40;"&#58;o","<img src=images/scared.gif>", $message&#41;;
$message = str_replace &#40;"&#58;C","<img src=images/mad.gif>", $message&#41;;
$message = str_replace &#40;";&#41;","<img src=images/rolleyes.gif>", $message&#41;;
$message = str_replace &#40;";Y","<img src=images/thumbsup.gif>", $message&#41;;
$message = str_replace &#40;"&#58;D","<img src=images/laugh.gif>", $message&#41;;
$message = str_replace &#40;"&#58;s","<img src=images/shocking.gif>", $message&#41;;
$message = str_replace &#40;"&#58;r","<img src=images/naughty.gif>", $message&#41;;
$message = str_replace &#40;"&#58;/","<img src=images/sweatdrop.gif>", $message&#41;;
$message = str_replace &#40;"&#58;O&#41;","<img src=images/clown.gif>", $message&#41;;
$message = str_replace &#40;"&#58;H&#41;","<img src=images/heart.gif>", $message&#41;;
$message = str_replace &#40;"&#58;i&#41;","<img src=images/info.gif>", $message&#41;;
$message = str_replace &#40;"&#58;Q&#41;","<img src=images/question.gif>", $message&#41;;
$message = stripslashes &#40;$message&#41;;
$lday =date&#40;"D d"&#41;;
$lmonth =date&#40;"M"&#41;;
$lyear =date&#40;"Y"&#41;;
$dated="$lday-$lmonth-$lyear";
if&#40;$action == "signup"&#41; &#123;
signup&#40;&#41;;
&#125;
if&#40;$action == "join"&#41; &#123;
$user = file&#40;"g_file.mpr"&#41;;
$lis = 0;
if&#40;strlen&#40;$name&#41; <= 2&#41;&#123;
 print "<p><BR><BR><BR><b>Вашето потребителско име трябва да е повече от 2  символа</b><br><p> </p><p> </p><p> </p><p> </p><p> </p><BR><BR><BR>";
&#125;
elseif&#40;strlen&#40;$password&#41; <= 2&#41;&#123;
 print "<p><BR><BR><BR><b>Вашата парола трябва да е по дълга от 2 символа</b><br><p> </p><p> </p><p> </p><p> </p><p> </p><BR><BR><BR>";
&#125;
elseif&#40;strlen&#40;$email&#41; <= 2&#41;&#123;
 print "<p><BR><BR><BR><b>Е-Майла ви трябва да е валиден</b><br><p> </p><p> </p><p> </p><p> </p><p> </p><BR><BR><BR>";
&#125;
elseif&#40;strlen&#40;$year&#41; <= 2&#41;&#123;
 print "<p><BR><BR><BR><b>Интернет сайта ви трябва да бъде валиден</b><br><p> </p><p> </p><p> </p><p> </p><p> </p><BR><BR><BR>";
&#125;
else&#123;
 for&#40;$x=0;$x<sizeof&#40;$user&#41;;$x++&#41; &#123;
  $temp = explode&#40;";",$user&#91;$x&#93;&#41;;
  $opp&#91;$x&#93; = "$temp&#91;0&#93;;$temp&#91;1&#93;;$temp&#91;2&#93;;$temp&#91;3&#93;;$temp&#91;4&#93;;$temp&#91;5&#93;;$temp&#91;6&#93;;$temp&#91;7&#93;;$temp&#91;8&#93;;$temp&#91;9&#93;;$temp&#91;10&#93;;$temp&#91;11&#93;;";
  $meta = $name;
  $meta2 = $temp&#91;0&#93;;
  if&#40;$meta==$meta2&#41; &#123;
  $list&#91;0&#93; = $opp&#91;$x&#93;;
 &#125;
&#125;
if&#40;sizeof&#40;$list&#41; != "0"&#41; &#123;
echo "<font face=arial color=red><b>Потребителското име е заето, моля изберете друго.</font><BR><BR>";
signup&#40;&#41;;
&#125;
else&#123;
$dpo=file&#40;"g_file.mpr"&#41;;
$op=sizeof&#40;$dpo&#41;;
$fp = fopen &#40;"g_file.mpr", "a+"&#41;;
fwrite &#40;$fp, $name&#41;;
fwrite &#40;$fp, ";"&#41;;
fwrite &#40;$fp, $password&#41;;
fwrite &#40;$fp, ";"&#41;;
fwrite &#40;$fp, $email&#41;;
fwrite &#40;$fp, ";"&#41;;
fwrite &#40;$fp, $rname&#41;;
fwrite &#40;$fp, ";"&#41;;
fwrite &#40;$fp, $month."||".$day."||".$year&#41;;
fwrite &#40;$fp, ";"&#41;;
fwrite &#40;$fp, $gender&#41;;
fwrite &#40;$fp, ";"&#41;;
fwrite &#40;$fp, $country&#41;;
fwrite &#40;$fp, ";"&#41;;
fwrite &#40;$fp, $date&#41;;
fwrite &#40;$fp, ";"&#41;;
fwrite &#40;$fp, $hide&#41;;
fwrite &#40;$fp, ";"&#41;;
fwrite &#40;$fp, $op&#41;;
fwrite &#40;$fp, ";"&#41;;
fwrite &#40;$fp, ";"&#41;;
fwrite &#40;$fp, ";"&#41;;
fwrite &#40;$fp, ";"&#41;;
fwrite &#40;$fp, "n"&#41;;
fclose &#40;$fp&#41;;
$to=$email;
$message="Здравейте..n n Потребителското ви име &#58; $name n Паролата ви &#58; $password n Ве ще може да качите вашите снимки след като се логнете.";
$subject="Добре дошли !";
$mess = "$message n"; 
$mailheaders="Return-path&#58; Find_A_Friend@Donot_Replyn"; 
$mailheaders.="From&#58; Find_A_Friend@Donot_Reply"; 
$sent=mail&#40;trim&#40;$to&#41;, $subject, $mess, $mailheaders&#41;; 
$f = fopen &#40;"files/".$name.".txt", "w"&#41;;
fwrite &#40;$f,"250"&#41;;
fclose &#40;$f&#41;;
$g = fopen &#40;"files/".$name."_profile.mpr", "w"&#41;;
fclose &#40;$g&#41;;
$w = fopen &#40;"files/".$name."_det.mpr", "w"&#41;;
fwrite &#40;$w, $name&#41;;
fwrite &#40;$w, ";"&#41;;
fwrite &#40;$w, $email&#41;;
fwrite &#40;$w, ";"&#41;;
fwrite &#40;$w, $rname&#41;;
fwrite &#40;$w, ";"&#41;;
fwrite &#40;$w, $month."||".$day."||".$year&#41;;
fwrite &#40;$w, ";"&#41;;
fwrite &#40;$w, $gender&#41;;
fwrite &#40;$w, ";"&#41;;
fwrite &#40;$w, $country&#41;;
fwrite &#40;$w, ";"&#41;;
fwrite &#40;$w, $date&#41;;
fwrite &#40;$w, ";"&#41;;
fwrite &#40;$w, $hide&#41;;
fwrite &#40;$w, ";"&#41;;
fwrite &#40;$w, $op&#41;;
fwrite &#40;$w, ";"&#41;;
fwrite &#40;$w, ";"&#41;;
fwrite &#40;$w, ";"&#41;;
fwrite &#40;$w, ";"&#41;;
fwrite &#40;$w, "n"&#41;;
fclose &#40;$w&#41;;
$h = fopen &#40;"files/".$name."_message.mpr", "w"&#41;;
fwrite &#40;$h, "new1|~~|admin|~~|Добре дошли|~~| Добре дошли в нашия сайт за запознанства. <BR>Тук вие може да си намерите нови приятели.<br>Не забравяйте и да качите ваши снимки като натиснете на Промяна на профила.<br>Успех !!! <img src=images/thumbsup.gif> |~~|0|~~|$dated|~~|" &#41;;
fwrite &#40;$h,"n"&#41;;
fclose &#40;$h&#41;;
echo "<p><b>Регистрацията премина успешно !<BR><BR><A href='?action=login'>Влез с потребителското си име</A>";
&#125;
&#125;
&#125;
if&#40;$action == "login"&#41;&#123;
echo"<FONT SIZE=2 COLOR=#330000 class=copyright>Потребителско вход&#58;</FONT>";
login&#40;&#41;;
&#125;
 if&#40;$action == "dologin"&#41;&#123;
if&#40;strlen&#40;$s&#41; >= 1&#41;&#123;
$name = base64_decode&#40;$s&#41;;
$password = base64_decode&#40;$t&#41;;
&#125;
$user = file&#40;"g_file.mpr"&#41;;
if&#40;strlen&#40;$name&#41; <= 2&#41;&#123;
 print "<p><BR><BR><BR><b>Потребителското ви име трябва да е по дълго от 2 символа</b><br><p> </p><p> </p><p> </p><p> </p><p> </p><BR><BR><BR>";
&#125;else&#123;
for&#40;$x=0;$x<sizeof&#40;$user&#41;;$x++&#41; &#123;
  $temp = explode&#40;";",$user&#91;$x&#93;&#41;;
  $opp&#91;$x&#93; = "$temp&#91;0&#93;;$temp&#91;1&#93;;$temp&#91;2&#93;;$temp&#91;3&#93;;$temp&#91;4&#93;;$temp&#91;5&#93;;$temp&#91;6&#93;;$temp&#91;7&#93;;$temp&#91;8&#93;;$temp&#91;9&#93;;$temp&#91;10&#93;;$temp&#91;11&#93;;$temp&#91;12&#93;;";
  $meta = $name;
  $meta2 =$temp&#91;0&#93;;
  $aq= $password;
  $ap =$temp&#91;1&#93;;
  if&#40;$aq==$ap && $meta==$meta2&#41; &#123;
  $list&#91;0&#93; = $opp&#91;$x&#93;;
  $list1&#91;0&#93; = $opp&#91;$x&#93;;
 &#125;
&#125;
if&#40;sizeof&#40;$list&#41; != "0" && sizeof&#40;$list1&#41; != "0"&#41; &#123;
for&#40;$y=0;$y<sizeof&#40;$list&#41;;$y++&#41; &#123;
$temp = explode&#40;";",$list&#91;$y&#93;&#41;;
$b=base64_encode &#40;"$temp&#91;0&#93;"&#41;;
$c=base64_encode &#40;"$temp&#91;1&#93;"&#41;;
if &#40;$temp&#91;6&#93;!=0&#41;&#123;
$p="Твоя леб сайт е активиран <a href=?action=change&id=$temp&#91;5&#93;>Деактивирай го</a>";
   &#125;elseif&#40;$temp&#91;6&#93;==0 && $temp&#91;7&#93;==1&#41;&#123;
   $p="Твоя леб сайт е деактивиран <a href=?action=change&id=$temp&#91;5&#93;>Активирай го</a>";
    &#125;
    elseif&#40;$temp&#91;6&#93;==0 && $temp&#91;7&#93;<=0&#41;&#123;
    $p="Твоя леб сайт е деактивиран <a href=?action=change&id=$temp&#91;5&#93;>Активирай го</a>";
    &#125;
$bb = file&#40;"files/$temp&#91;0&#93;_message.mpr"&#41;;
$mm=0;
for&#40;$d=0;$d<sizeof&#40;$bb&#41;;$d++&#41; &#123;
$tep = explode&#40;"|~~|",$bb&#91;$d&#93;&#41;;
if&#40;$tep&#91;0&#93; == "new1"&#41; &#123;
$mlist&#91;$mm&#93; = $d;
$mm++;
&#125;
&#125;
$h=sizeof&#40;$mlist&#41;;
$cc = file&#40;"files/$temp&#91;0&#93;_profile.mpr"&#41;;
for&#40;$vt=0;$vt<sizeof&#40;$cc&#41;;$vt++&#41; &#123;
$remp=explode&#40;"|~~|",$cc&#91;$vt&#93;&#41;;
&#125;
$d="$temp&#91;9&#93;";
if&#40;strlen&#40;$remp&#91;0&#93;&#41;<=0&#41;&#123;
 $pic="<img src=images/info.gif> Вие нямате качени снимки, натисни <A href=?action=uploadpic&wp=$b&wq=$c>ТУК</A>, за да качиш.";
&#125;
echo "<table><tr><td>Добре дошъл &#58; $temp&#91;0&#93;<br>Имаш <b>$h</b> нови съобщения</td></tr><tr>
<td><li><A href=?action=messagebox&s=$b&t=$c&n=1>Кутия с съобщения</A></td><tr><td><li><A href=?action=change&wp=$b&no=$d&wq=$c>Промяна на профила</A></td></tr><tr><td><li><a href=?action=profile&user=$temp&#91;0&#93; target=_blank>Виш профила</td></tr><tr><td><li><a href=?action=compose&t=$c&s=$b>Изпрати съобщение</td></tr><tr><td><li><a href=?action=logout>Излез</a></td></tr></table><table><tr><td>$pic</td></tr></table>";
&#125;
&#125;
else&#123;
echo "<FONT SIZE=2 COLOR=red face=arial>Грешно потребителско име или парола !</FONT>";
login&#40;&#41;;
&#125;
&#125;
&#125;
if &#40;$action=="profile"&#41;&#123;
if &#40;file_exists &#40;"files/".$user."_det.mpr"&#41;&#41;&#123;
$io=  "files/".$user."_det.mpr";
$ip=  "files/".$user."_profile.mpr";
$fd = fopen &#40;$io, "r"&#41;; 
$mtuff = fread &#40;$fd, filesize &#40;$io&#41;&#41;; 
fclose &#40;$fd&#41;;
$ff = fopen &#40;$ip, "r"&#41;; 
$stuff = fread &#40;$ff, filesize &#40;$ip&#41;&#41;; 
fclose &#40;$ff&#41;;
$vemp = explode &#40;";",$mtuff&#41;;
$temp = explode &#40;";",$stuff&#41;;
if&#40;strlen&#40;$stuff&#41;>=4&#41;&#123;
$pic="files/$temp&#91;0&#93;";
&#125;else&#123;
$pic="images/no_pic.jpg";
&#125;
$bdat=explode&#40;"||",$vemp&#91;3&#93;&#41;;
if&#40;$vemp&#91;8&#93;=="0"&#41;&#123;
$bn=base64_encode&#40;$vemp&#91;0&#93;&#41;;
$mess="<form method=post action=?action=sendemail><input type=hidden name=bn value=$bn><input type=submit value='Изпрати е-майл'></form>";
&#125;else&#123;
$mess="";
&#125;
echo "<table width=100% align=middle><tr><td></td><td></td></tr>";
echo "<td><table width=65%><div align=left><tr><td align=left>Потребителско име &#58; $vemp&#91;0&#93;</td></tr><tr><td>Изтинско име &#58; $vemp&#91;2&#93;</td></tr><tr><td>Положение &#58; $vemp&#91;4&#93;</td></tr><tr><td>Държава &#58; $vemp&#91;5&#93;</td></tr><tr><td>Рожден ден &#58; $bdat&#91;0&#93;-$bdat&#91;1&#93;-$bdat&#91;2&#93;</td></tr><tr><td>$mess</td></tr></table></td><td><table border=1 cellspacing=0 bordercolor=#000000 width=50%><div align=right><td align=right border=1><img src=$pic></td></div></table></td></table>";
&#125;else&#123;
 echo "Няма тъкъв потребител";
&#125;
&#125;
if &#40;$action==""&#41;&#123;
echo "<table width=100%><td width=75%><BR><BR><BR><table width=100%><td><FONT SIZE=4 >Търси си приятел</FONT></td></table><table width=100%><tr><td width=22%><form action=?action=search method=post name=searchform><FONT SIZE=2>Име &#58;</FONT></td><td><input type=text name=keyword size=25 maxlength=100><BR>&#40;остави го празно за да немери всички&#41;</td></tr><tr><td>Държава&#58;</td><td>";
include "country.php";
echo"</td></tr><tr><td width=5><font size=-1>Положение &#58;</font></td>";

?>
<td><select name=gender value="Select" style="BACKGROUND&#58; #f5f5f5; COLOR&#58; #303030; FONT-FAMILY&#58; arial; FONT-SIZE&#58; 12px; FONT-WEIGHT&#58; 200"><option value="Any">Без значение</option><option value="Male">Самот&#40;на/ен&#41;</option><option value="Female">Оженен/Омъжена</option>
      </td></tr><td></td><td><input type=submit value=Търси><BR><font size=2><BR></form></td></table><BR><B><A href=?action=signup>Регистрирай</A> се сега, за да си намериш нови приятели.</B><BR></td><td><table border=1 bordercolor=#f5f5f5 cellspacing=0 width=100%><td><U>Последно регистрирали се потребители &#58;</U>
   <?php
$db_file = "g_file.mpr";
$latest_max = 5;
$lines = file&#40;$db_file&#41;;
$a = count&#40;$lines&#41;;
$u = $a - $latest_max;
for&#40;$i = $a; $i >= $u ;$i--&#41;&#123;
if&#40;substr&#40;$lines&#91;$i&#93;, 0, 5 &#41;!= ""&#41;&#123;
$temp = explode&#40;";",$lines&#91;$i&#93;&#41;;
echo "<li><a href='?action=profile&user=$temp&#91;0&#93;'><b>$temp&#91;0&#93;</b></a><BR>   От $temp&#91;6&#93;<BR>";
&#125;
&#125;
 ?></td></table></td></table>
<?php
&#125;
if &#40;$action=="search"&#41;&#123;
$results_per_page=15;
$user = file&#40;"g_file.mpr"&#41;;
$lis = 0;
if&#40;strlen&#40;$keyword&#41; <= 0 && strlen&#40;$country&#41;<=0 && $gender=="Any"&#41;&#123;
 for&#40;$x=0;$x<sizeof&#40;$user&#41;;$x++&#41; &#123;
  $temp = explode&#40;";",$user&#91;$x&#93;&#41;;
  $opp&#91;$x&#93; = "$temp&#91;0&#93;;$temp&#91;1&#93;;$temp&#91;2&#93;;$temp&#91;3&#93;;$temp&#91;4&#93;;$temp&#91;5&#93;;$temp&#91;6&#93;;$temp&#91;7&#93;;$temp&#91;8&#93;;$temp&#91;9&#93;;$temp&#91;10&#93;;";
  $list&#91;$lis&#93; = $opp&#91;$x&#93;;
  $lis++;
&#125;
&#125;
elseif&#40;strlen&#40;$keyword&#41; <= 0 && strlen&#40;$country&#41;<=0 && $gender!="Any"&#41;&#123;
for&#40;$x=0;$x<sizeof&#40;$user&#41;;$x++&#41; &#123;
$temp = explode&#40;";",$user&#91;$x&#93;&#41;;
$opp&#91;$x&#93; = "$temp&#91;0&#93;;$temp&#91;1&#93;;$temp&#91;2&#93;;$temp&#91;3&#93;;$temp&#91;4&#93;;$temp&#91;5&#93;;$temp&#91;6&#93;;$temp&#91;7&#93;;$temp&#91;8&#93;;$temp&#91;9&#93;;$temp&#91;10&#93;;";
$meta = metaphone&#40;$gender&#41;;
$meta2 =metaphone&#40;$temp&#91;5&#93;&#41;;
$such = stristr&#40;$meta2,$meta&#41;;
if&#40;$such&#41; &#123;
$list&#91;$lis&#93; = $opp&#91;$x&#93;;
$lis++;
&#125;
&#125;
&#125;elseif&#40;strlen&#40;$keyword&#41; <= 0 && strlen&#40;$country&#41;>0 && $gender=="Any"&#41;&#123;
for&#40;$x=0;$x<sizeof&#40;$user&#41;;$x++&#41; &#123;
$temp = explode&#40;";",$user&#91;$x&#93;&#41;;
  $opp&#91;$x&#93; = "$temp&#91;0&#93;;$temp&#91;1&#93;;$temp&#91;2&#93;;$temp&#91;3&#93;;$temp&#91;4&#93;;$temp&#91;5&#93;;$temp&#91;6&#93;;$temp&#91;7&#93;;$temp&#91;8&#93;;$temp&#91;9&#93;;$temp&#91;10&#93;;";
$r=$temp&#91;6&#93;;
$p=$country;
include "search.php";
&#125;
&#125;
elseif&#40;strlen&#40;$keyword&#41; > 0 && strlen&#40;$country&#41;<=0 && $gender=="Any"&#41;&#123;
for&#40;$x=0;$x<sizeof&#40;$user&#41;;$x++&#41; &#123;
$temp = explode&#40;";",$user&#91;$x&#93;&#41;;
  $opp&#91;$x&#93; = "$temp&#91;0&#93;;$temp&#91;1&#93;;$temp&#91;2&#93;;$temp&#91;3&#93;;$temp&#91;4&#93;;$temp&#91;5&#93;;$temp&#91;6&#93;;$temp&#91;7&#93;;$temp&#91;8&#93;;$temp&#91;9&#93;;$temp&#91;10&#93;;";
  $r=$temp&#91;0&#93;;
  $p=$keyword;
include "search.php";
&#125;
&#125;
elseif&#40;strlen&#40;$keyword&#41; >0 && strlen&#40;$country&#41;>0 && $gender!="Any"&#41;&#123;
for&#40;$x=0;$x<sizeof&#40;$user&#41;;$x++&#41; &#123;
$temp = explode&#40;";",$user&#91;$x&#93;&#41;;
$opp&#91;$x&#93; = "$temp&#91;0&#93;;$temp&#91;1&#93;;$temp&#91;2&#93;;$temp&#91;3&#93;;$temp&#91;4&#93;;$temp&#91;5&#93;;$temp&#91;6&#93;;$temp&#91;7&#93;;$temp&#91;8&#93;;$temp&#91;9&#93;;$temp&#91;10&#93;;$temp&#91;11&#93;;$temp&#91;12&#93;;";
$meta = metaphone&#40;$keyword&#41;;
$meta2 =metaphone&#40;$temp&#91;0&#93;&#41;;
$such = stristr&#40;$meta2,$meta&#41;;
$aq= $country;
$ap =$temp&#91;6&#93;;
if&#40;$ap==$aq && $such && $gender==$temp&#91;5&#93;&#41; &#123;
$list&#91;$lis&#93; = $opp&#91;$x&#93;;
$lis++;
&#125;
&#125;
&#125;
elseif&#40;strlen&#40;$keyword&#41;<=0 && strlen&#40;$country&#41;>0 && $gender!="Any"&#41;&#123;
for&#40;$x=0;$x<sizeof&#40;$user&#41;;$x++&#41; &#123;
$temp = explode&#40;";",$user&#91;$x&#93;&#41;;
$opp&#91;$x&#93; = "$temp&#91;0&#93;;$temp&#91;1&#93;;$temp&#91;2&#93;;$temp&#91;3&#93;;$temp&#91;4&#93;;$temp&#91;5&#93;;$temp&#91;6&#93;;$temp&#91;7&#93;;$temp&#91;8&#93;;$temp&#91;9&#93;;$temp&#91;10&#93;;$temp&#91;11&#93;;$temp&#91;12&#93;;";
//$meta = metaphone&#40;$keyword&#41;;
//$meta2 =metaphone&#40;$temp&#91;0&#93;&#41;;
//$such = stristr&#40;$meta2,$meta&#41;;
$aq= $country;
$ap =$temp&#91;6&#93;;
if&#40;$ap==$aq &&  $gender==$temp&#91;5&#93;&#41; &#123;
$list&#91;$lis&#93; = $opp&#91;$x&#93;;
$lis++;
&#125;
&#125;
&#125;
elseif&#40;strlen&#40;$keyword&#41;>0 && strlen&#40;$country&#41;>0 && $gender=="Any"&#41;&#123;
for&#40;$x=0;$x<sizeof&#40;$user&#41;;$x++&#41; &#123;
$temp = explode&#40;";",$user&#91;$x&#93;&#41;;
$opp&#91;$x&#93; = "$temp&#91;0&#93;;$temp&#91;1&#93;;$temp&#91;2&#93;;$temp&#91;3&#93;;$temp&#91;4&#93;;$temp&#91;5&#93;;$temp&#91;6&#93;;$temp&#91;7&#93;;$temp&#91;8&#93;;$temp&#91;9&#93;;$temp&#91;10&#93;;$temp&#91;11&#93;;$temp&#91;12&#93;;";
$meta = metaphone&#40;$keyword&#41;;
$meta2 =metaphone&#40;$temp&#91;0&#93;&#41;;
$such = stristr&#40;$meta2,$meta&#41;;
$aq= $country;
$ap =$temp&#91;6&#93;;
if&#40;$ap==$aq && $such&#41; &#123;
$list&#91;$lis&#93; = $opp&#91;$x&#93;;
$lis++;
&#125;
&#125;
&#125;
if&#40;sizeof&#40;$list&#41; != "0"&#41; &#123;
  echo " <font face=arial><p><b>",sizeof&#40;$list&#41;,"</b> резултат&#40;и&#41; от търсенето. натисни на потребителското име за да видиш профила.<BR><table width=80% border=1 cellspacing=0 align=center><tr><td>Потребителско име<td>Положение</td><td>Държава</td></tr>";
  &#125;else&#123;
  echo "Няма намерени резултати.";
 &#125;
$latest_max = sizeof&#40;$list&#41;;
$u = $a - $latest_max;
if &#40;is_file&#40;"g_file.mpr"&#41;&#41;
 &#123;
 $s=sizeof&#40;$list&#41;;
if &#40;$page=='' or !$page&#41; &#123; $page=1; &#125;
$end=$results_per_page*$page;
$start=$end-$results_per_page;

if &#40;$start<>'0'&#41; &#123;
 $new_page=$page-1;
 $prev="<a href='?action=search&keyword=$keyword&country=$country&gender=$gender&page=$new_page'><---Предишна страница</a>";
&#125;
else &#123;
 $prev="";
&#125;

if &#40;$end<$s&#41; &#123;
 $new_page1=$page+1;
 $next="<a href='?action=search&keyword=$keyword&country=$country&gender=$gender&page=$new_page1'>Следваща страница---></a>";
&#125;
else &#123;
 $next="";
&#125;
$today = time&#40;&#41;;
for &#40;$i=$start; $i<$end; $i++&#41;&#123;
 if&#40;substr&#40;$list&#91;$i&#93;, 0, 5 &#41;!= ""&#41;
 &#123;
    $p=explode&#40;';', $list&#91;$i&#93;&#41;;
 echo "<tr><td><a href='?action=profile&user=$p&#91;0&#93;'><b>$p&#91;0&#93;</a></td><td>$p&#91;5&#93;</td><td>$p&#91;6&#93;</td></tr>";
&#125;
&#125;
$pages=$s/$results_per_page;
$pages1=round&#40;$pages, 2&#41;;
$p= explode&#40;".", $pages1&#41;;
$pcount=count&#40;$p&#41;;
$ext=$p&#91;$pcount-2&#93;;
if &#40;$ext!=0&#41; &#123;
 $num=$p&#91;0&#93;+1;
&#125;

else &#123;
 $num=$p&#91;0&#93;;
&#125;
echo "<table width='100%'><tr><td align='left'>$prev</td><td align='center'>";
for &#40;$i=1; $i<=$num; $i++&#41; &#123;
 if &#40;$i==$page&#41; &#123;
echo "<B> $i </B> ";

 &#125;
 else &#123;
echo "<a href='?action=search&keyword=$keyword&country=$country&gender=$gender&page=$i'>&#91;$i&#93;</a>";
&#125;
&#125;
echo "</td><td align='right'>$next</td></tr></table>";
&#125;
&#125;
//&#125;
if&#40;$action=="sendemail"&#41;&#123;
?>
<table width=90% align=middle>
<form method=post action='?action=send_mail'>
<tr><td>Вашия е-майл &#58;</td><td><input type=text name=subject value='' maxlength="35"></td></tr>
<tr><td>Тема &#58;</td><td><input type=text name=subject value='' maxlength="35">
</td><tr><td width=59>Съобщение &#58;</td> 
<td width=187> 
<textarea name=mesd wrap=VIRTUAL cols=50 rows=8></textarea> 
</td><input type=hidden name=bn value='<?php echo $bn; ?>'></td> 
<tr><td></td><td align=center><input type=submit value=Изпрати></td></tr></form></table>
<?php
&#125;
if &#40;$action=="send_mail"&#41;&#123;
$rn=base64_decode&#40;$bn&#41;;
$io=  "files/".$rn."_det.mpr";
$fd = fopen &#40;$io, "r"&#41;; 
$mtuff = fread &#40;$fd, filesize &#40;$io&#41;&#41;; 
fclose &#40;$fd&#41;;
$vemp = explode &#40;";",$mtuff&#41;;
$to=$vemp&#91;1&#93;;
$message="$mesd";
$subject="$subject";
$mess = "$message n"; 
$mailheaders="От&#58; $fromn"; 
$mailheaders.="От &#58; $from"; 
$sent=mail&#40;trim&#40;$to&#41;, $subject, $mess, $mailheaders&#41;; 
echo "Е-майла е изпратен успешно на този потребител.";
&#125;
if &#40;$action=="change"&#41;&#123;
$r=base64_decode &#40;"$wp"&#41;;
$d=base64_decode &#40;"$wq"&#41;;
$user = file&#40;"g_file.mpr"&#41;;
if&#40;strlen&#40;$r&#41; <= 0&#41;&#123;
print "Please Login Again";
&#125;else&#123;
 for&#40;$x=0;$x<sizeof&#40;$user&#41;;$x++&#41; &#123;
  $temp = explode&#40;";",$user&#91;$x&#93;&#41;;
  $opp&#91;$x&#93; = "$temp&#91;0&#93;;$temp&#91;1&#93;;$temp&#91;2&#93;;$temp&#91;3&#93;;$temp&#91;4&#93;;$temp&#91;5&#93;;$temp&#91;6&#93;;$temp&#91;7&#93;;$temp&#91;8&#93;;$temp&#91;9&#93;;$temp&#91;10&#93;;$temp&#91;11&#93;;$temp&#91;12&#93;;";
  $meta = $r;
  $meta2 =$temp&#91;0&#93;;
  $aq= $d;
  $ap =$temp&#91;1&#93;;
  if&#40;$aq==$ap && $meta==$meta2&#41; &#123;
  $list&#91;0&#93; = $opp&#91;$x&#93;;
  $list1&#91;0&#93; = $opp&#91;$x&#93;;
 &#125;
&#125;
$num="0";
if&#40;sizeof&#40;$list&#41; != "0" && sizeof&#40;$list1&#41; != "0"&#41; &#123;
$filename="g_file.mpr";
$id=$no;
if&#40;$_GET&#91;'no'&#93; >= 0&#41;&#123;
global $filename;
$no = $_GET&#91;'no'&#93;;
$fp = @fopen&#40;$filename, 'r'&#41;;
$array = explode&#40;"n", fread&#40;$fp, filesize&#40;$filename&#41;&#41;&#41;; 
for&#40;$x=0;$x<sizeof&#40;$array&#41;;$x++&#41; &#123;
$temp = explode&#40;";",$array&#91;$x&#93;&#41;;
$line&#91;$x&#93; = "$temp&#91;0&#93;;$temp&#91;1&#93;;$temp&#91;2&#93;;$temp&#91;3&#93;;$temp&#91;4&#93;;$temp&#91;5&#93;;$temp&#91;6&#93;;$temp&#91;7&#93;;$temp&#91;8&#93;;$temp&#91;9&#93;;";
&#125;
$mod = explode&#40;";", $line&#91;$no&#93;&#41;;
echo "Промяна на профила";
echo "<form method='POST' action=?'action=change_2' method='post'>";
echo "<table><tr><td>Име &#58;</td><td><input type=text value=$mod&#91;3&#93; name=rname size=50></td></tr>";
echo " <tr><td><font size=-1>Е-майл &#58;</font></td><td><input type=text name=email size=30 value=$mod&#91;2&#93;> Скрий е-майла &#58;<select name=hide style='BACKGROUND&#58; #f5f5f5; COLOR&#58; #303030; FONT-FAMILY&#58; arial; FONT-SIZE&#58; 12px; FONT-WEIGHT&#58; 200'><option value=0>Не<option value=1>Да</select></td>";
echo "<tr><font face=arial size=2><td>Държава &#58;</td><td>";
include "country.php";
echo "</td></tr>";
$gui=base64_encode&#40;"$mod&#91;4&#93;"&#41;;
$agg=base64_encode&#40;"$mod&#91;5&#93;"&#41;;
echo '<input type="hidden" name="dna" value="$wp">';
echo '<input type="hidden" name="dpa" value="$wq">';
echo '<input type="hidden" name="bda" value="$gui">';
echo '<input type="hidden" name="gen" value="$agg">';
echo '<input type="hidden" name="no" value="$no">';
echo '<tr><td></td><td><input type="submit" value="Обнови">';
echo '<input type="reset" value="Изчисти"></td></tr>';
echo '</form></table>';
echo '<hr>';
echo "<table valign=top><tr><td>Качи твоя снимка.<BR><li>Максималните размери са 250 на 250<br><li>Снимката трябва да е до 50Kb.<BR><li>Снимката трябва да е в формат <B>jpg</B>.<BR></td></tr><tr><td align=center><form  ENCTYPE=multipart/form-data method=post action=?action=doupload><input type=file name=fileup$num><input type=hidden name=filename value=$r><input type=hidden name=pn value='$wq'><input type=submit value=Качи></td></tr></table>";
&#125;
else&#123;
print "Няма избрано потребителско име";
&#125;
&#125;
&#125;
&#125;
if&#40;$_GET&#91;'action'&#93; == "change_2"&#41; &#123;
$filename="g_file.mpr";
global $filename;
$name=base64_decode&#40;$dna&#41;;
$password=base64_decode&#40;$dpa&#41;;
$bdate=base64_decode&#40;$bda&#41;;
$gender=base64_decode&#40;$gen&#41;;
$data_submitted=time&#40;&#41;;
$no = $_POST&#91;'no'&#93;;
$fp = @fopen&#40;$filename, 'r'&#41;;
$array = explode&#40;"n", fread&#40;$fp, filesize&#40;$filename&#41;&#41;&#41;; 
for&#40;$x=0;$x<sizeof&#40;$array&#41;-1;$x++&#41; &#123; 
$temp = explode&#40;";",$array&#91;$x&#93;&#41;;
$line&#91;$x&#93; = "$temp&#91;0&#93;;$temp&#91;1&#93;;$temp&#91;2&#93;;$temp&#91;3&#93;;$temp&#91;4&#93;;$temp&#91;5&#93;;$temp&#91;6&#93;;$temp&#91;7&#93;;$temp&#91;8&#93;;$temp&#91;9&#93;;$temp&#91;10&#93;;$temp&#91;11&#93;;";
&#125;
$line&#91;$no&#93;= "$name;$password;$email;$rname;$bdate;$gender;$country;$data_submitted;$hide;$no;";
$sline="$name;$email;$rname;$bdate;$gender;$country;$data_submitted;$no;$hide;";
    $fp = fopen &#40;"$filename", "w"&#41;;
    for&#40;$i=0; $i<sizeof&#40;$line&#41;;$i++&#41;&#123;   
    fwrite &#40;$fp, $line&#91;$i&#93;&#41;;
    fwrite &#40;$fp, "n"&#41;;
    &#125;
    fclose &#40;$fp&#41;;
    $fp = fopen &#40;"files/".$name."_det.mpr", "w"&#41;;
    fwrite &#40;$fp, $sline&#41;;
    fwrite &#40;$fp, "n"&#41;;
    print "<p><p>Вашия прогил е обновен успешно.<br><br><BR>";
    echo "<BR><form method=post action=?action=dologin><input type=hidden name=t value=$dpa><input type=hidden name=s value=$dna><input type=submit value='Назад към началната страница' border=1></A></form>";
    &#125;
if&#40;$action=="uploadpic"&#41;&#123;
$r=base64_decode &#40;"$wp"&#41;;
$d=base64_decode &#40;"$wq"&#41;;
$user = file&#40;"g_file.mpr"&#41;;
if&#40;strlen&#40;$r&#41; <= 0&#41;&#123;
print "Please Login Again";
&#125;else&#123;
 for&#40;$x=0;$x<sizeof&#40;$user&#41;;$x++&#41; &#123;
  $temp = explode&#40;";",$user&#91;$x&#93;&#41;;
  $opp&#91;$x&#93; = "$temp&#91;0&#93;;$temp&#91;1&#93;;$temp&#91;2&#93;;$temp&#91;3&#93;;$temp&#91;4&#93;;$temp&#91;5&#93;;$temp&#91;6&#93;;$temp&#91;7&#93;;$temp&#91;8&#93;;$temp&#91;9&#93;;$temp&#91;10&#93;;$temp&#91;11&#93;;$temp&#91;12&#93;;";
  $meta = $r;
  $meta2 =$temp&#91;0&#93;;
  $aq= $d;
  $ap =$temp&#91;1&#93;;
  if&#40;$aq==$ap && $meta==$meta2&#41; &#123;
  $list&#91;0&#93; = $opp&#91;$x&#93;;
  $list1&#91;0&#93; = $opp&#91;$x&#93;;
 &#125;
&#125;
$num="0";
if&#40;sizeof&#40;$list&#41; != "0" && sizeof&#40;$list1&#41; != "0"&#41; &#123;
echo "<table valign=top><tr><td>Качи твоя снимка.<BR><li>Максималните размери са 250 на 250<br><li>Снимката трябва да е до 50Kb.<BR><li>Снимката трябва да е в формат <B>jpg</B>.<BR></td></tr><tr><td align=center><form  ENCTYPE=multipart/form-data method=post action=?action=doupload><input type=file name=fileup$num><input type=hidden name=filename value=$r><input type=hidden name=pn value='$wq'><input type=submit value=Качи></td></tr></table>";
&#125;
&#125;
&#125;
if&#40;$action=="doupload"&#41; &#123;
$num = 0;
$picture = "fileup$num"."_name";
$picture1 = $$picture;
$picture2 = "fileup$num";
$picture3 = $$picture2;
$cpic=explode &#40;".",$picture1&#41;;
$cvb= base64_decode&#40;"$pn"&#41;;
if&#40;$picture3 != "none"&#41; &#123;
$filesizebtyes = filesize&#40;$picture3&#41;;
if&#40;file_exists&#40;"files/$picture3"&#41;&& $filesizebtyes <= "50000" && $cpic&#91;1&#93;== "jpg"&#41; &#123;
copy &#40;$picture3, "files/$filename.$cpic&#91;1&#93;"&#41;;
echo "Файла $picture1 е качен успешно<BR>";
$g = fopen &#40;"files/".$filename."_profile.mpr", "w"&#41;;
fwrite &#40;$g,"$filename.$cpic&#91;1&#93;"&#41;;
fclose &#40;$g&#41;;
&#125; elseif&#40;$filesizebtyes <= "50000" && $cpic&#91;1&#93;== "jpg"&#41; &#123;
copy &#40;$picture3, "files/$filename.$cpic&#91;1&#93;"&#41;;
echo "Снимката $picture1 е качена успешно<BR><a href=?action=profile&user=$filename>Виште профила си.</a><BR>";
$g = fopen &#40;"files/".$filename."_profile.mpr", "w"&#41;;
fwrite &#40;$g,"$filename.$cpic&#91;1&#93;"&#41;;
fclose &#40;$g&#41;;
&#125;else&#123;
echo "Снимката е над 50 Kb или не е jpg формат.";
&#125;
echo"<BR><form method=post action=?action=dologin><input type=hidden name=name value=$filename><input type=hidden name=password value=$cvb><input type=submit value='Назад към началната страница' border=1></A></form>";
&#125;
&#125;
if&#40;$action=="reply"&#41; &#123;
$r=base64_decode &#40;"$s"&#41;;
$d=base64_decode &#40;"$t"&#41;;
$user = file&#40;"g_file.mpr"&#41;;
if&#40;strlen&#40;$r&#41; <= 0&#41;&#123;
print "Please Login Again";
&#125;else&#123;
 for&#40;$x=0;$x<sizeof&#40;$user&#41;;$x++&#41; &#123;
  $temp = explode&#40;";",$user&#91;$x&#93;&#41;;
  $opp&#91;$x&#93; = "$temp&#91;0&#93;;$temp&#91;1&#93;;$temp&#91;2&#93;;$temp&#91;3&#93;;$temp&#91;4&#93;;$temp&#91;5&#93;;$temp&#91;6&#93;;$temp&#91;7&#93;;$temp&#91;8&#93;;$temp&#91;9&#93;;$temp&#91;10&#93;;$temp&#91;11&#93;;$temp&#91;12&#93;;";
  $meta = $r;
  $meta2 =$temp&#91;0&#93;;
  $aq= $d;
  $ap =$temp&#91;1&#93;;
  if&#40;$aq==$ap && $meta==$meta2&#41; &#123;
  $list&#91;0&#93; = $opp&#91;$x&#93;;
  $list1&#91;0&#93; = $opp&#91;$x&#93;;
 &#125;
&#125;
if&#40;sizeof&#40;$list&#41; != "0" && sizeof&#40;$list1&#41; != "0"&#41; &#123;
?>
<form method=post action="?action=messagebox&do=sendmessage">
<table>
<td>До &#58;</td> 
<td>
<input type=text name=to value="<?php echo "$api"; ?>"> Относно &#58;<input type=text name=subject value='<?php echo "Re&#58; $sup"; ?>' maxlength="35">
<input type=hidden name=from value='<?php echo $r; ?>'> 
      </td><tr><td></td><td><?php smiles&#40;&#41;; ?></td><tr> 
<td width=59>Съобщение &#58;</td> 
<td width=187> 
<textarea name=message wrap=VIRTUAL cols=55 rows=10></textarea> 
      </td> 
<tr><td></td><td>
<input type=hidden name=s value=<?php echo $s; ?>>
<input type=hidden name=t value=<?php echo $t; ?>>
<input type=submit name=submit value=Изпрати> 
</td> 
</form>
</table>
<?php
&#125;
&#125;
&#125;
if&#40;$action=="compose"&#41;&#123;
 ?>
<form method=post action="?action=messagebox&do=sendmessage">
<table>
<td>До потребител &#58;</td> 
<td>
<input type=text name=to value=""> Относно &#58;<input type=text name=subject value='' maxlength="35">
<input type=hidden name=from value='<?php echo $r; ?>'> 
      </td><tr><td></td><td><?php smiles&#40;&#41;; ?></td><tr> 
<td width=59>Съобщение &#58;</td> 
<td width=187> 
<textarea name=message wrap=VIRTUAL cols=55 rows=10></textarea> 
      </td> 
<tr><td></td><td>
<input type=hidden name=s value=<?php echo $s; ?>>
<input type=hidden name=t value=<?php echo $t; ?>>
<input type=submit name=submit value=Изпрати> 
</td> 
</form>
</table>
<?php
&#125;
function smiles&#40;&#41;&#123;
?>
<a href="javascript&#58;emo&#40;' &#58;&#41; '&#41;"><img src="images/smile.gif" border=0 alt="&#58;&#41;"></a>
    <a href="javascript&#58;emo&#40;' &#58;&#40;' &#41; "><img src="images/sad.gif" border=0 alt="&#58;&#40;"></a>
    <a href="javascript&#58;emo&#40;' &#58;P '&#41;"><img src="images/tongue.gif" border=0 alt="&#58;P"></a>
    <a href="javascript&#58;emo&#40;' &#58;o '&#41;"><img src="images/scared.gif"  border=0 alt="&#58;o"></a>
    <a href="javascript&#58;emo&#40;' &#58;C '&#41;"><img src="images/mad.gif" border=0 alt="&#58;C"></a>
    <a href="javascript&#58;emo&#40;' ;Y '&#41;"><img src="images/thumbsup.gif" border=0 alt=";Y"></a>
 <a href="javascript&#58;emo&#40;' &#58;O&#41; '&#41;"><img src="images/clown.gif"border=0 alt="&#58;0"></a>
    <a href="javascript&#58;emo&#40;' &#58;D '&#41;"><img src="images/laugh.gif" border=0 alt="&#58;D"></a>
    <a href="javascript&#58;emo&#40;' &#58;/ '&#41;"><img src="images/sweatdrop.gif" border=0 alt="&#58;/"></a>
    <a href="javascript&#58;emo&#40;' &#58;s '&#41;"><img src="images/shocking.gif" border=0 alt="&#58;s"></a>
    <a href="javascript&#58;emo&#40;' &#58;r '&#41;"><img src="images/naughty.gif" border=0 alt="&#58;r"></a>
    <a href="javascript&#58;emo&#40;' ;&#41; '&#41;"><img src="images/rolleyes.gif"border=0 alt=";&#41;"></a>
    <a href="javascript&#58;emo&#40;' &#58;H&#41; '&#41;"><img src="images/heart.gif"border=0 alt="&#58;H&#41;"></a>
    <a href="javascript&#58;emo&#40;' &#58;i&#41; '&#41;"><img src="images/info.gif"border=0 alt="&#58;i&#41;"></a>
    <a href="javascript&#58;emo&#40;' &#58;Q&#41; '&#41;"><img src="images/question.gif"border=0 alt="&#58;Q&#41;"></a>
 <?php
&#125;
if&#40;$action=="read"&#41;&#123;
$r=base64_decode &#40;"$s"&#41;;
$d=base64_decode &#40;"$t"&#41;;
$user = file&#40;"g_file.mpr"&#41;;
if&#40;strlen&#40;$r&#41; <= 0&#41;&#123;
print "Please Login Again";
&#125;else&#123;
 for&#40;$x=0;$x<sizeof&#40;$user&#41;;$x++&#41; &#123;
  $temp = explode&#40;";",$user&#91;$x&#93;&#41;;
  $opp&#91;$x&#93; = "$temp&#91;0&#93;;$temp&#91;1&#93;;$temp&#91;2&#93;;$temp&#91;3&#93;;$temp&#91;4&#93;;$temp&#91;5&#93;;$temp&#91;6&#93;;$temp&#91;7&#93;;$temp&#91;8&#93;;$temp&#91;9&#93;;$temp&#91;10&#93;;$temp&#91;11&#93;;$temp&#91;12&#93;;";
  $meta = $r;
  $meta2 =$temp&#91;0&#93;;
  $aq= $d;
  $ap =$temp&#91;1&#93;;
  if&#40;$aq==$ap && $meta==$meta2&#41; &#123;
  $list&#91;0&#93; = $opp&#91;$x&#93;;
  $list1&#91;0&#93; = $opp&#91;$x&#93;;
 &#125;
&#125;
if&#40;sizeof&#40;$list&#41; != "0" && sizeof&#40;$list1&#41; != "0"&#41; &#123;
$lines = "files/".$r."_message.mpr";
$fp = @fopen&#40;"$lines", 'r'&#41;;
$array = explode&#40;"n", fread&#40;$fp, filesize&#40;"$lines"&#41;&#41;&#41;; 
for&#40;$x=0;$x<sizeof&#40;$array&#41;-1;$x++&#41; &#123; 
$mod = explode&#40;"|~~|", $array&#91;$n&#93;&#41;;
$line&#91;$x&#93; = "$mod&#91;0&#93;|~~|$mod&#91;1&#93;|~~|$mod&#91;2&#93;|~~|$mod&#91;3&#93;|~~|$mod&#91;4&#93;|~~|$mod&#91;5&#93;|~~|";
&#125;
$fpo = @fopen&#40;$lines, 'r'&#41;;
$array = explode&#40;"n", fread&#40;$fpo, filesize&#40;$lines&#41;&#41;&#41;; 
for&#40;$x=0;$x<sizeof&#40;$array&#41;-1;$x++&#41; &#123; 
$temp = explode&#40;"|~~|",$array&#91;$x&#93;&#41;;
$line&#91;$x&#93; = "$temp&#91;0&#93;|~~|$temp&#91;1&#93;|~~|$temp&#91;2&#93;|~~|$temp&#91;3&#93;|~~|$temp&#91;4&#93;|~~|$temp&#91;5&#93;|~~|";
&#125;
$line&#91;$n&#93;= "new2|~~|$mod&#91;1&#93;|~~|$mod&#91;2&#93;|~~|$mod&#91;3&#93;|~~|$mod&#91;4&#93;|~~|$mod&#91;5&#93;|~~|";
$fpm = fopen &#40;$lines, "w"&#41;;
fwrite &#40;$fpm, $line&#91;0&#93;&#41;;
for&#40;$i=0; $i<sizeof&#40;$line&#41;;$i++&#41;&#123;   
fwrite &#40;$fpm, $line&#91;$i&#93;&#41;;
fwrite &#40;$fpm, "n"&#41;;
&#125;
fclose &#40;$fpm&#41;;
fclose &#40;$fpo&#41;;
echo "<table width=90%><tr><td>От &#58; $mod&#91;1&#93;<BR> На &#58; $mod&#91;5&#93;<hr></td></tr><tr><td>Съобщение &#58;</td></tr><tr><td border=1 bgcolor=#fffff0>$mod&#91;3&#93;</td></tr></table><table width=30%><tr><td><form method=post action=?action=messagebox><input type=hidden name=s value='$s'><input type=hidden name=t value='$t'><input type=submit value='Кутия с съобщения'></form></td><td><form method=post action=?action=reply><input type=hidden name=api value='$mod&#91;1&#93;'><input type=hidden name=s value='$s'><input type=hidden name=t value='$t'><input type=hidden name=sup value='$mod&#91;2&#93;'><input type=submit value='Отговори'></form></td><td><form method=post action=?action=messagebox&do=delete><input type=hidden name=s value='$s'><input type=hidden name=t value='$t'><input type=hidden name=to value='$r'><input type=hidden name=n value='$n'><input type=submit value='Изтрий'></form></td></table>";
&#125;
&#125;
&#125;
if&#40;$action=="messagebox"&#41;&#123;
$r=base64_decode &#40;"$s"&#41;;
$d=base64_decode &#40;"$t"&#41;;
if&#40;$do=="sendmessage"&#41;&#123;
if &#40;file_exists&#40;"files/".$to."_message.mpr"&#41;&#41;&#123;
$rpo=file&#40;"files/".$to."_message.mpr"&#41;;
$l= sizeof&#40;$rpo&#41;;
$po = fopen &#40;"files/".$to."_message.mpr", "a+"&#41;;
fwrite &#40;$po, "new1"&#41;;
fwrite &#40;$po, "|~~|"&#41;;
fwrite &#40;$po, $r&#41;;
fwrite &#40;$po, "|~~|"&#41;;
fwrite &#40;$po, $subject&#41;;
fwrite &#40;$po, "|~~|"&#41;;
fwrite &#40;$po, $message&#41;;
fwrite &#40;$po, "|~~|"&#41;;
fwrite &#40;$po, $l&#41;;
fwrite &#40;$po, "|~~|"&#41;;
fwrite &#40;$po, $dated&#41;;
fwrite &#40;$po, "|~~|"&#41;;
fwrite &#40;$po, "n"&#41;;
fclose &#40;$po&#41;;
echo "Съобщението ви е изпратено успешно.<hr>";
&#125;else&#123;
echo "<FONT SIZE=2 COLOR=#FF0000>ГРЕШКА !!! Този потребител не съществува.<BR></FONT>";
&#125;
&#125;
if&#40;$_GET&#91;'do'&#93; == "delete"&#41; &#123;
$lines = "files/".$r."_message.mpr";
$fp = @fopen&#40;"$lines", 'r'&#41;;
$array = explode&#40;"n", fread&#40;$fp, filesize&#40;"$lines"&#41;&#41;&#41;; 
for&#40;$x=0;$x<sizeof&#40;$array&#41;-1;$x++&#41; &#123; 
$mod = explode&#40;"|~~|", $array&#91;$n&#93;&#41;;
$line&#91;$x&#93; = "$mod&#91;0&#93;|~~|$mod&#91;1&#93;|~~|$mod&#91;2&#93;|~~|$mod&#91;3&#93;|~~|$mod&#91;4&#93;|~~|$mod&#91;5&#93;|~~|";
&#125;
if&#40;$_GET&#91;'n'&#93; >= 0&#41;&#123;
$fpo = @fopen&#40;"files/".$r."_message.mpr", 'r'&#41;;
$nrray = explode&#40;"n", fread&#40;$fpo, filesize&#40;"files/".$r."_message.mpr"&#41;&#41;&#41;; 
for&#40;$fg=0;$fg<sizeof&#40;$nrray&#41;;$fg++&#41; &#123; 
$yemp = explode&#40;"|~~|",$nrray&#91;$fg&#93;&#41;;
$bline&#91;$fg&#93; = "$yemp&#91;0&#93;|~~|$yemp&#91;1&#93;|~~|$yemp&#91;2&#93;|~~|$yemp&#91;3&#93;|~~|$yemp&#91;4&#93;|~~|$yemp&#91;5&#93;|~~|";
&#125;
$bline&#91;$n&#93;= "$new2|~~|$mod&#91;1&#93;|~~|$mod&#91;2&#93;|~~|$mod&#91;3&#93;|~~|$mod&#91;4&#93;|~~|$mod&#91;5&#93;|~~|";
$fpm = fopen &#40;"$lines", "w"&#41;;
for&#40;$ti=0; $ti<sizeof&#40;$bline&#41;;$ti++&#41;&#123;
if&#40;$ti==$n&#41;&#123;
fwrite &#40;$fpm, $bline&#91;$n&#93;&#41;;
&#125;
fwrite &#40;$fpm, $bline&#91;$ti&#93;&#41;;
fwrite &#40;$fpm, "n"&#41;;
&#125;
fclose &#40;$fpm&#41;;
&#125;
&#125;
$user = file&#40;"g_file.mpr"&#41;;
for&#40;$x=0;$x<sizeof&#40;$user&#41;;$x++&#41; &#123;
  $temp = explode&#40;";",$user&#91;$x&#93;&#41;;
  $opp&#91;$x&#93; = "$temp&#91;0&#93;;$temp&#91;1&#93;;$temp&#91;2&#93;;$temp&#91;3&#93;;$temp&#91;4&#93;;$temp&#91;5&#93;;$temp&#91;6&#93;;$temp&#91;7&#93;;$temp&#91;8&#93;;$temp&#91;9&#93;;$temp&#91;10&#93;;$temp&#91;11&#93;;$temp&#91;12&#93;;";
  $meta = $r;
  $meta2 =$temp&#91;0&#93;;
  $aq= $d;
  $ap =$temp&#91;1&#93;;
  if&#40;$aq==$ap && $meta==$meta2&#41; &#123;
  $list&#91;0&#93; = $opp&#91;$x&#93;;
  $list1&#91;0&#93; = $opp&#91;$x&#93;;
 &#125;
&#125;
if&#40;sizeof&#40;$list&#41; != "0" && sizeof&#40;$list1&#41; != "0"&#41; &#123;
echo "Кутия със съобщения<hR>";
$results_per_page= "10" ;
$user1 = file&#40;"files/".$r."_message.mpr"&#41;;
echo "Виш всичките съобщения";
$tlis = 0;
 for&#40;$mp=sizeof&#40;$user1&#41;;$mp>=0;$mp--&#41;&#123;
  $mop = explode&#40;"|~~|",$user1&#91;$mp&#93;&#41;;
  $opp&#91;$mp&#93; = "$mop&#91;0&#93;|~~|$mop&#91;1&#93;|~~|$mop&#91;2&#93;|~~|$mop&#91;3&#93;|~~|$mop&#91;4&#93;|~~|$mop&#91;5&#93;|~~|$mop&#91;6&#93;|~~|";
  $such1 = $mop&#91;0&#93;;
   if&#40;$such1&#41; &#123;
    $list2&#91;$tlis&#93; = $opp&#91;$mp&#93;;
    $tlis++; 
   &#125;
 &#125;
if&#40;sizeof&#40;$list2&#41; != "0"&#41; &#123;
echo "<table width=100% border=1 bordercolor=black bgcolor=#ffffff><td width=20%>Дата</td><td width=15%>От</td><td width=57%>Относно</td><td width=8%><B><FONT COLOR=red>Изтрий</FONT></B></td>";
&#125;
else&#123;
echo "<p><b> Нямате писна в кутията.</b><BR><BR><BR><BR>";
&#125;
$latest_max = sizeof&#40;$list2&#41;;
$u = $a - $latest_max;
if &#40;is_file&#40;"files/".$r."_message.mpr"&#41;&#41;
&#123;
$sop=sizeof&#40;$list2&#41;;
if &#40;$page=='' or !$page&#41; &#123; $page=1; &#125;
$end=$results_per_page*$page;
$start=$end-$results_per_page;

if &#40;$start<>'0'&#41; &#123;
 $new_page=$page-1;
 $prev="<a href='?action=messagebox&s=$s&t=$t&n=1&page=$new_page'><---Предишна страница</a>";
&#125;
else &#123;
 $prev="";
&#125;

if &#40;$end<sizeof&#40;$list2&#41;&#41; &#123;
 $new_page1=$page+1;
 $next="<a href='?action=messagebox&s=$s&t=$t&n=1&page=$new_page1'>Следваща страница---></a>";
&#125;
else &#123;
 $next="";
&#125;
$today = time&#40;&#41;;
for &#40;$in=$start; $in<$end; $in++&#41;&#123;
 if&#40;substr&#40;$list2&#91;$in&#93;, 0, 3 &#41;=="new"&#41;
 &#123;
    $kp=explode&#40;'|~~|', $list2&#91;$in&#93;&#41;;
 if&#40;substr&#40;$list2&#91;$in&#93;, 0, 4 &#41;=="new1"&#41;
  &#123;
 $color="#CCCCCC";
 &#125;else &#123;
 $color="#ffffff";
 &#125;
 echo "<tr><td bgcolor=$color>$kp&#91;5&#93;</td><td bgcolor=$color>$kp&#91;1&#93;</td><td bgcolor=$color><a href=?action=read&n=$kp&#91;4&#93;&s=$s&t=$t>$kp&#91;2&#93;</td><td bgcolor=$color><a href=?action=messagebox&do=delete&s=$s&t=$t&to=$r&n=$kp&#91;4&#93;>Изтрий</a></td></tr>";
&#125;
&#125;
$pages=$sop/$results_per_page;
$pages1=round&#40;$pages, 2&#41;;
$pi= explode&#40;".", $pages1&#41;;
$pcount=count&#40;$pi&#41;;
$ext=$pi&#91;$pcount-2&#93;;
if &#40;$ext!=0&#41; &#123;
 $num=$pi&#91;0&#93;+1;
&#125;

else &#123;
 $num=$pi&#91;0&#93;;
&#125;
echo "<table width='100%'><tr><td align='left'>$prev</td><td align='center'>";
for &#40;$im=1; $im<=$num; $im++&#41; &#123;
 if &#40;$im==$page&#41; &#123;
echo "<B> $im </B> ";

 &#125;
 else &#123;
echo "<a href='?action=messagebox&s=$s&t=$t&n=1&page=$im'>&#91;$im&#93;</a>";
&#125;
&#125;
echo "</td><td align='right'>$next</td></tr></table>";
echo "<table align=middle width=100%><td align=center><form method=post action=?action=dologin><input type=hidden name=s value=$s><input type=hidden name=t value=$t><input type=submit value='Назад към менюто'></td></table>";
&#125;
&#125;
&#125;
if&#40;$action=="logout"&#41;&#123;
echo "Излязохте успешно.<br>";
login&#40;&#41;;
&#125;
function login&#40;&#41;&#123;
?>
<br><form method=post action=?action=dologin>
<table width=80% border=0 cellspacing=0 cellpadding=0>
<tr> 
<td width=14% ><font size=-1>Потребителско име &#58;</font></td>
<td width=187> 
<input type=text name=name size=20>
</td>
</tr><tr><td width=14%>
Парола &#58;</td><td><input type=password name=password ></td></tr>
<tr>
<td width=59></td>
<td>
<input type=submit name=submit value=Влез>
</td>
</tr>
<td><A href="?action=signup">Регистрация !</A></td>
</table>
</form>
<?php
&#125; 
function signup&#40;&#41;&#123;
?>
<form method=post action=?action=join>
 <table width=80% border=0 cellspacing=0 cellpadding=0>
   <tr><td></td><td><FONT SIZE="2" class="copyright" color=#330000>Регистрация</FONT><BR><BR></td></tr><tr> 
      <td width=10 ><font size=-1>Потребителско име &#58;</font></td>
      <td width=187> 
        <input type=text name=name size=20>
      </td>
    </tr><tr><td width=10%>
     Парола &#58;</td><td><input type=password name=password ></td></tr>
     <td width=5><font size=-1>Е-майл &#58;</font></td>
      <td width=14%>
        <input type=text name=email size=20> Скрий е-майла &#58;<select name=hide style="BACKGROUND&#58; #f5f5f5; COLOR&#58; #303030; FONT-FAMILY&#58; arial; FONT-SIZE&#58; 12px; FONT-WEIGHT&#58; 200"><option value="0">Не<option value="1">Да</select>
      </td>
    </tr>
       <td width=5><font size=-1>Име &#58;</font></td>
      <td width=14%>
        <input type=text name=rname size=20 maxlength=25>
      </td>
    </tr>
    <tr>
      <td width=5><font size=-1>Дата на раждане &#58;</font></td>
   <td>
         <select name=month style="BACKGROUND&#58; #f5f5f5; COLOR&#58; #303030; FONT-FAMILY&#58; arial; FONT-SIZE&#58; 12px; FONT-WEIGHT&#58; 200"><option value="">&#91;Избери едно&#93;<option value="January">Януари<option value="February">Февруари<option value="March">Март<option value="April">Април<option value="May">Май<option value="June">Юни<option value="July">Юли<option value="August">Август<option value="September">Септември<option value="October">Октомври<option value="November">Ноември<option value="December">Декември</select></span> Ден &#58;<input type=text name="day" value="" size=2 maxlength=2 > Година &#58;<input type=text name="year" value="" size=4 maxlength=4 > &#40;Месец, Ден, Година&#41;

      </td>
    </tr>
 <tr>
      <td width=5><font size=-1>Положение &#58;</font></td>
      <td width=50%>
        <select name=gender value="Select" style="BACKGROUND&#58; #f5f5f5; COLOR&#58; #303030; FONT-FAMILY&#58; arial; FONT-SIZE&#58; 12px; FONT-WEIGHT&#58; 200"><option value="Male">Свобод&#40;ен/на&#41;</option><option value="Female">Оженен/Омъжена</option>
      </td>
    </tr>
     <tr><td>Държава &#58;
  </td><td><?php include "country.php" ;?><br><br></td></tr>
   <tr><td></td><td>
        <input type=submit name=submit value=Регистрация>
      </td>
    </tr>
  </table>
</form>
<?php
&#125;
?>
country.php

Code: Select all

<?php ?>
<select name="country"  style="background&#58; #f5f5f5; color&#58; #303030; font-family&#58; arial; font-size&#58; 12px; font-weight&#58; 200"></center>
<option selected="selected" value="">Избери държава</OPTION>
<option value="България">България </option>
</select>
<?php
?>
search.php

Code: Select all

<?php
$meta = metaphone&#40;$r&#41;;
$meta2 = metaphone&#40;$p&#41;;
$such = stristr&#40;$meta2,$meta&#41;;
if&#40;$such&#41; &#123; 
$list&#91;$lis&#93; = $opp&#91;$x&#93;;
$lis++;
&#125;
?>
един празен файл g_file.mpr и една празна директория files
Благодаря за вниманието.

User avatar
Dizasterr
Много Редовен
Много Редовен
Posts: 1919
Joined: Thu Nov 05, 2009 9:49 pm
Answers: 52
Contact:

Post by Dizasterr » Mon Dec 14, 2009 12:58 pm

Провери ли записва ли правилно в базата данни ?

User avatar
rutera24
Турист
Турист
Posts: 281
Joined: Sun Dec 06, 2009 6:35 pm
Answers: 14
Location: Sofia

Post by rutera24 » Tue Dec 15, 2009 10:10 am

Ами чесно казано ще провера довечера благодаря за насоката.

User avatar
rutera24
Турист
Турист
Posts: 281
Joined: Sun Dec 06, 2009 6:35 pm
Answers: 14
Location: Sofia

Post by rutera24 » Tue Dec 15, 2009 6:33 pm

Бацее че какви ги пиша и аз ми то е без база данни с простифайлове е.
А като да редактира единствения профил ми дава тази грешка.:

Code: Select all

Warning&#58; fread&#40;&#41; &#91;function.fread&#93;&#58; Length parameter must be greater than 0 in /var/www/159/13/gmain.php on line 222
Така в папката "files" се създават фаилове с имена "user.txt","user_det.mpr","user_message.mpr","user_profile.mpr".
Съдържание от пурви файл.
user.txt

Code: Select all

250
user_det.mpr

Code: Select all

user;rutera@kkkkkc.org;kik;June||15||1978;Male;България;1260653289;0;1;;;;n
user_message.mpr

Code: Select all

new1|~~|user|~~|Добре дошли|~~| Добре дошли в нашия сайт за запознанства. <BR>Тук вие може да си намерите нови приятели.<br>Не забравяйте и да качите ваши снимки като натиснете на Промяна на профила.<br>Успех !!! <img src=images/thumbsup.gif> |~~|0|~~|Sat 12-Dec-2009|~~|n

user_profile.mpr

Code: Select all

празно е

Надявам се да съм помогнал че не разбирам каде е проблема.

Post Reply