Do yourself a favor and post using the PHP tag and not the CODE tag in the future... that way, it'll color code for you, and for us... Then people will be more willing to delve into your code a bit deeper and help you out more...
Ok i will, sorry i didnt realise their was an extra one for PHP, i just usually do code posts on other forums, i guess i got into the habit
Well i got it working and tried to add a bold filter for search terms, that gave me an odd error, and i'm not eniterly sure how to figure it out
this page shows up: http://www.p2phub.jumbahost.com/script/searchbt.php?searchstring=linux&Search=normal
With this code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/x* html1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">*
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>alpha script</title>
<style type="text/css">
<!--
a{
}
a:visited{
}
a:hover{
}
a:active{
}
a.link_class {
display:block;
width:100%;
height:30px;
margin:0px;
padding:10px 0px 0px 0px;
color:#000;
background-color:inherit;
}
a.link_class:visited{
color:#006600;
background-color:inherit;
}
a.link_class:hover{
color:#ffffff;
background-color:inherit;
font-weight:bold;
}
a.link_class:active{
color:#ff0000;
background-color:inherit;
font-weight:bold;
}
.bold_text{
font-weight: bold;
}
.bg{
background-color:#edf3fe;
}
.style1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
}
-->
</style>
</head>
<body>
<center>
<center>
<center>
<h2><img src="P2PLibrary.png" alt="p2plibrary" width="234" height="43" /></h2>
</center>
<form action="http://www.p2phub.jumbahost.com/script/searchbt.php"
method="get">
<div align="center">
<p><span class="style3"><img src="search.png" alt="search" width="110" height="19" />
<input name="searchstring" type="text" id="searchstring" size="35" />
</span>
<input name="Search" type="submit" id="Search" value="normal">
</p>
</div>
</form>
<hr />
</center>
</center>
<div align="center" class="style1">
<p class="style4 style6">
<?
$searchstring = $_GET['searchstring'];
$newsearchstring = str_replace(" ","%20",$searchstring);
$bgcolor = "#edf3fe";
?>
<?
if ($searchstring != NULL)
$boldtest = explode(" ", $searchstring);
foreach( $boldtest as $key => $value ) // Arrays have indexes.. which start at 0
?>
<?
if ($searchstring != NULL){
print "You Searched For: $searchstring";
}
else{
print "Please Make A Search";
}
?>
</p>
<table summary="Torrent Data">
<tbody>
<tr >
<td class="style6">
<div align="left">
<? if ( $searchstring != NULL )
print "Torrent Name" ?>
</div>
</td>
<td class="style6">
<div align="left">
<? if ( $searchstring != NULL )
print "Torrent Size" ?>
</div>
</td>
<td class="style6">
<div align="left">
<? if ( $searchstring != NULL )
print "Torrent Seeds" ?>
</div>
</td>
</tr>
</tbody>
<?
// Scrape URL
if ( $searchstring != NULL ){
$tpbURL = "http://thepiratebay.org/search.php?q=".$newsearchstring."";
// Open and get contents
$tpbfile = fopen($tpbURL, "r");
$tpbr = "";
do{
$tpbdata = fread($tpbfile, 8192);
$tpbr .= $tpbdata;
}
while(strlen($tpbdata) != 0);
// Find Tables
$tpbTABLEArray = preg_split ("/<table.*?>/", $tpbr);
// Find Correct Table with keyword in it (Leechers)
for($tpbx=0; $tpbx<count($tpbTABLEArray); $tpbx++){
if(strstr($tpbTABLEArray[$tpbx],"Leechers")){
$tpbresultTable = $tpbx; // Record Index of correct table (This was x+1 which is incorrect)
}
}
// Split up Rows from Table
$tpbTRArray = preg_split("/<tr.*?>/",$tpbTABLEArray[$tpbresultTable]);
}
?>
<?php
for($tpbi=0; $tpbi<count($tpbTRArray); $tpbi++){
$tpbTDArray = preg_split ("/<td.*?>/",$tpbTRArray[$tpbi]);
// 0 = Blank
// 1 = Date
// 2 = Category
// 3 = Download Link, Name and Link to Details
// 4 = Size
// 5 = Seeders
// 6 = Leechers
$tpbtorrent_Name = strip_tags($tpbTDArray[2],"<a>");
if ( empty($tpbtorrent_Name) ) continue; // Don't show it when no name
$tpbtorrent_Name = preg_replace('/<a\s+.*?href="([^"]+)"[^>]*>([^<]+)<\/a>/is', '<a href="http://thepiratebay.org/\1">\2</a>', $tpbTDArray[2]);
$tpbtorrent_Name = preg_replace('$boldtest[$value]','<b>$boldtest[$value]</b>', $tpbTDArray[2]);
$tpbtorrent_Size = strip_tags($tpbTDArray[5]);
$tpbtorrent_Seeds = strip_tags($tpbTDArray[7]);
if ($bgcolor == "#edf3fe")
{
$bgcolor = "#ffffff";
}
else
{
$bgcolor = "#edf3fe";
}
?>
<tbody>
<tr style="color:inherit;backgroundColor:<?php echo $bgcolor ?>;"
onmouseover="this.style.backgroundColor='#3d80df'"
onmouseout="this.style.backgroundColor='<?php echo $bgcolor ?>'">
<td class="style6"
onmouseover="this.style.color='#FFFFFF'"
onmouseout="this.style.color='#000000'">
<div align="left">
<?
echo $tpbtorrent_Name;
?>
</div>
</td>
<td class="style6"
onmouseover="this.style.color='#FFFFFF'"
onmouseout="this.style.color='#000000'">
<div align="left">
<?
echo $tpbtorrent_Size;
?>
</div>
</td>
<td class="style6"
onmouseover="this.style.color='#FFFFFF'"
onmouseout="this.style.color='#000000'">
<div align="left">
<?
echo $tpbtorrent_Seeds;
?>
</div>
</td>
</tr>
</tbody>
<?php
}
?>
</table>
</div>
</body>
</html>