get paid to paste

code

<?php


//get data
$button = $_GET['submit'];
$search = $_GET['search'];


$s = $_GET['s'];
if (!$s)
$s = 0;


$e = 15; // Just change to how many results you want per page


$next = $s + $e;
$prev = $s - $e;




 if (strlen($search)<=2)
  echo "<html><head><center><meta http-equiv='refresh' content='1; url='></head><body>Your search character must be more then 3 characters!<center></body></html>";
 else
 {
  echo "<br /><table><tr><td><img src='' /></td><td><form action='searchmusic.php' method='GET'><input type='text' onclick=value='' size='50' name='search' value='$search' autofocus> <input type='submit' name='submit' value='Search'></form></td></tr></table>";

  //connect to database
  mysql_connect("","","");
  mysql_select_db("");

   //explode out search term
   $search_exploded = explode(" ",$search);

   foreach($search_exploded as $search_each)
   {
                                                                                    
        //construct query
    $x++;
    if ($x==1)
     $construct .= "keywords= '$search'";
    else
     $construct .= " or keywords= '$search'";

   }

  //echo outconstruct
  $constructx = "SELECT * FROM Music WHERE $construct";

  $construct = "SELECT * FROM Music WHERE $construct LIMIT $s,$e";
  $run = mysql_query($constructx);

  $foundnum = mysql_num_rows($run);


  $run_two = mysql_query("$construct");

  if ($foundnum==0)
   echo "<hr>No results found for <b>$search</b></hr>";
  else
  {
   echo "<table bgcolor='#0000FF' width='100%' height='1px'><br /></table><table bgcolor='#F0F0F0' width='100%' height='10px'><tr><td><div align='right'>Showing 1-10 of <b>$foundnum</b> results found for <b>$search.</b></div></td></tr></table><p>";

   while ($runrows = mysql_fetch_assoc($run_two))
   {
    //get data
   $title = $runrows['title'];
   $desc = $runrows['description'];
   $url = $runrows['url'];

   echo "<table width='300px'>
   <h4><a href='http://$url'><b>$title</b></a><br />
   $desc<br>
   <font color='00CC00'>$url</font></table></h4>
   ";
   }
?>

<table width='100%'>
<tr>
<td>
<div align="center">

<?php
if (!$s<=0)
 echo "<a href='searchmusic.php?search=$search&s=$prev'>Prev</a>";

$i =1; 
for ($x=0;$x<$foundnum;$x=$x+$e)
{


 echo " <a href='searchmusic.php?search=$search&s=$x'>$i</a> ";


$i++;


}

if ($s<$foundnum-$e)
  echo "<a href='searchmusic.php?search=$search&s=$next'>Next</a>";

	}
}  


?>
</div>
</td>
</tr>
</table>

Pasted: Jun 7, 2011, 11:14:55 pm
Views: 48