Jump to content
Sign in to follow this  
C)zy

Cs Dc Script Problem

Recommended Posts

Buna ziua am si eu o problema , am incercat sa realizez un site pe baza scriptului CS-DC.ro si merge destul de bine , problema este ca nu merge optiunea "cautare server" cand dau sa cauta un server dupa nume / mod sau orice altceva ...si dau trimite ...pur si simplu pagina isi da refresh ( desii sunt 7 servare in baza de date ) si apare formularul necompletat .

Scriptul pe care ruelaza optiunea de cautare este :

<?PHP 

include("include/rating_functions.php"); 

?> 

<h2>Cauta Server in baza de date</h2> 

<form name="search" method="post" action="<?=$PHP_SELF?>"> 

Cauta : <input type="text" name="find" /> dupa  

<Select NAME="field"> 

<Option VALUE="ip">Adresa</option> 

<Option VALUE="modul">Mod</option> 

<Option VALUE="cod">Anticheat</option> 

</Select> 

<input type="hidden" name="searching" value="yes" /> 

<input type="submit" name="search" class="box" value="Search" /> 

</form> 


<? 

//This is only displayed if they have submitted the form 

if ($searching =="yes") 

{ 

echo "<h2>Rezultatele cautarii</h2><p>"; 


//If they did not enter a search term we give them an error 

if ($find == "") 

{ 

echo "<p>You forgot to enter a search term"; 

exit; 

} 



// We preform a bit of filtering 

$find = strtoupper($find); 

$find = strip_tags($find); 

$find = trim ($find); 


//Now we search for our search term, in the field the user specified 

$data = mysql_query("SELECT * FROM server WHERE upper($field) LIKE'%$find%'"); 


?> 


<center><table border=0 class=margins cellspacing=1 width=99%> 

<tr><td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Status ]</b></td> 

<td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Live ]</b></td> 

<td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Adress ]</b></td> 

<td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Port ]</b></td> 

<td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Slots ]</b></td> 

<td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Anticheat ]</b></td> 

<td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ ISP ]</b></td> 

<td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Mod ]</b></td> 

<td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Country ]</b></td> 

<td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Rate ]</b></td> 

</tr> 



<?PHP 

//And we display the results 

while($result = mysql_fetch_array( $data )) 

{ 

?> 


<tr><td class=margins><center> 


<?php 

if ($fp=@fsockopen(htmlentities($ip, ENT_QUOTES),$port,$ERROR_NO,$ERROR_STR,(float)0.5)) 

   { 

   fclose($fp); 

   echo '<img src="imagini/up.png" alt="Online"/>'; 

   } 

else 

   { 

   echo '<img src="imagini/down.png" alt="Offline"/>'; 

   } 

?> 


</center></td> 

<td class=margins><center><a target='_blank' title='http://servers.cs-dc.ro/info.php?server=<?=$result['ip']?>:<?=$result['port']?>.html' onClick=window.open('stats/stats.php?ip=<?=$result['ip']?>&port=<?=$result['port']?>','mywindow','width=520,height=680')>Verifica</a></center></td> 

<td class=margins><center> <?=$result['ip']?> </center></td> 

<td class=margins><center> <?=$result['port']?> </center></td> 

<td class=margins><center> <?=$result['player']?> </center></td> 

<td class=margins><center> <?=$result['cod']?> </center></td> 

<td class=margins><center> <?=$result['net']?> </center></td> 

<td class=margins><center> <?=$result['modul']?> </center></td> 

<td class=margins><center> <?=$result['tara']?> </center></td> 

<td class=margins><center> 

Unavailable 

</center></td> 

</tr> 



<?PHP 


} 

print "</table></center>"; 


//This counts the number or results - and if there wasn't any it gives them a little message explaining that 

$anymatches=mysql_num_rows($data); 

if ($anymatches == 0) 

{ 

echo "Cuvantul introdus nu se potriveste cu nimic din baza de date.<br><br>"; 

} 


} 

?>

Cand dau trimite , nu imi apare nici macar "Rezultatele cautarii" ci doar formularul . Din cate vad eu in script in codu :

echo "<h2>Rezultatele cautarii</h2><p>"; ar trebui sa imi arate imediat dupa ce dau cauta / trimite . Asta ma duce cu gandul ca este de la formularul de contact , dar care este problema , ma puteti ajuta ?

multumesc anticipat

Share this post


Link to post
Share on other sites

L-ai declarat undeva si nu vad eu ($_POST['find'])? :)) Ia verifica scriptul si dupa posteaza aici, te rog.


"Timpul exista pentru ca lucrurile sa nu se intample in acelasi timp." - Albert Einstein

"I'm gonna make him an offer he can't refuse." - Don Corleone Vito

Share this post


Link to post
Share on other sites

$find = $_POST['find'];

Am adaugat linia...acum e aceiasi problema ..isi da refresh si atat...totusi cred ca e problema la formural...si linia "if ($searching =="yes") "... cred ca ar trebui alta optiune de trimitere a acestuia

edit : bun am observat ca nu am declarat "$searching = $_POST['searching'];" ...si acum nu isi da refresh ...apare doar

Rezultatele cautarii

[ Status ] [ Live ] [ Adress ] [ Port ] [ Slots ] [ Anticheat ] [ ISP ] [ Mod ] [ Country ] [ Rate ]

Cuvantul introdus nu se potriveste cu nimic din baza de date.

Orice as scrie aia apare ..

daca las spatiu gol zice "You forgot to enter a search term" cum ar trebui

Deci problema e ca nu le afiseaza..

Share this post


Link to post
Share on other sites

$data = mysql_query("SELECT * FROM server WHERE CELULA = '".$find."'");

Inlocuieste celula cu ce ai tu!


"Timpul exista pentru ca lucrurile sa nu se intample in acelasi timp." - Albert Einstein

"I'm gonna make him an offer he can't refuse." - Don Corleone Vito

Share this post


Link to post
Share on other sites

Nu are legatura cu scriptul. Ai pus ceva in htacces sau chestii gen?

Oricum, pune un ss sa vad.


"Timpul exista pentru ca lucrurile sa nu se intample in acelasi timp." - Albert Einstein

"I'm gonna make him an offer he can't refuse." - Don Corleone Vito

Share this post


Link to post
Share on other sites

Server error

The website encountered an error while retrieving http://www.csmaniack.com/cautare_svr.php. It may be down for maintenance or configured incorrectly.

Here are some suggestions:

Reload this webpage later.

HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

nu am modificat nimica in htaccess..

Share this post


Link to post
Share on other sites

Bun am facut modificari

<?PHP 

include("include/rating_functions.php"); 

?> 

<h2>Cauta Server in baza de date</h2> 

<form name="search" method="post" action="<?=$PHP_SELF?>"> 

Cauta : <input type="text" name="find" /> dupa  

<Select NAME="field"> 

<Option VALUE="ip">Adresa</option> 

<Option VALUE="modul">Mod</option> 

<Option VALUE="cod">Anticheat</option> 

</Select> 

<input type="hidden" name="searching" value="yes" /> 

<input type="submit" name="search" class="box" value="Search" /> 

</form> 


<? 

$modul = $_POST['modul']; 

$cod = $_POST['cod']; 

$ip = $_POST['ip']; 

$searching = $_POST['searching']; 

$find = $_POST['find']; 

//This is only displayed if they have submitted the form 

if ($searching =="yes") 

{ 

echo "<h2>Rezultatele cautarii</h2><p>"; 


//If they did not enter a search term we give them an error 

if ($find == "") 

{ 

echo "<p>You forgot to enter a search term"; 

exit; 

} 



// We preform a bit of filtering 

$find = strtoupper($find); 

$find = strip_tags($find); 

$find = trim ($find); 


//Now we search for our search term, in the field the user specified 

$data = mysql_query("SELECT * FROM server WHERE upper($field) LIKE'($find)'"); 


?> 


<center><table border=0 class=margins cellspacing=1 width=99%> 

<tr><td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Status ]</b></td> 

<td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Live ]</b></td> 

<td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Adress ]</b></td> 

<td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Port ]</b></td> 

<td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Slots ]</b></td> 

<td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Anticheat ]</b></td> 

<td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ ISP ]</b></td> 

<td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Mod ]</b></td> 

<td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Country ]</b></td> 

<td height=28 style=background-image:url(imagini/categoriix.png) align=center><b>[ Rate ]</b></td> 

</tr> 



<?PHP 

//And we display the results 

while($result = mysql_fetch_array( $data )) 

{ 

?> 


<tr><td class=margins><center> 


<?php 

if ($fp=@fsockopen(htmlentities($ip, ENT_QUOTES),$port,$ERROR_NO,$ERROR_STR,(float)0.5)) 

   { 

   fclose($fp); 

   echo '<img src="imagini/up.png" alt="Online"/>'; 

   } 

else 

   { 

   echo '<img src="imagini/down.png" alt="Offline"/>'; 

   } 

?> 


</center></td> 

<td class=margins><center><a target='_blank' 


title='http://servers.cs-dc.ro/info.php?server=<?=$result['ip']?>:<?=$result['port']?>.html' 


onClick=window.open('stats/stats.php?ip=<?=$result['ip']?>&port=<?=$result['port']?>','mywindow','width=


520,height=680')>Verifica</a></center></td> 

<td class=margins><center> <?=$result['ip']?> </center></td> 

<td class=margins><center> <?=$result['port']?> </center></td> 

<td class=margins><center> <?=$result['player']?> </center></td> 

<td class=margins><center> <?=$result['cod']?> </center></td> 

<td class=margins><center> <?=$result['net']?> </center></td> 

<td class=margins><center> <?=$result['modul']?> </center></td> 

<td class=margins><center> <?=$result['tara']?> </center></td> 

<td class=margins><center> 

Unavailable 

</center></td> 

</tr> 



<?PHP 


} 

print "</table></center>"; 


//This counts the number or results - and if there wasn't any it gives them a little message explaining 


that 

$anymatches=mysql_num_rows($data); 

if ($anymatches == 0) 

{ 

echo "Cuvantul introdus nu se potriveste cu nimic din baza de date.<br><br>"; 

} 


} 

?>
Totul e bine . problema e la
$data = mysql_query("SELECT * FROM server WHERE upper($field) LIKE'($find)'"); 

cred

Edit : mai mult ca sigur problema e la

while($result = mysql_fetch_array( $data ))

Share this post


Link to post
Share on other sites

upper() nu prea exista, nu ai vrut sa folosesti defapt litere mari? Daca da, functia este strtouper()


"Timpul exista pentru ca lucrurile sa nu se intample in acelasi timp." - Albert Einstein

"I'm gonna make him an offer he can't refuse." - Don Corleone Vito

Share this post


Link to post
Share on other sites

mysql_fetch_array returns row as an associative array.

an ex:

$query="select .... from......";

$result=mysql_query($query);

while($row=mysql_fetch_array($result);

..........

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...