1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
<?
/*
* HotScripts Script
* Easily Display HotScripts Statistics, and a Voting Box for Your Entry
*
* Author : JMan
* HomePage : www.bedpan.ca
* Email : jman@bedpan.ca
*/
include("cache.php");
function hotscripts($id){
$cached = cache("hotscripts$id");
if ($cached){
$pageid = $cached[0];
$rating = $cached[1];
$votes = $cached[2];
$hits = $cached[3];
}else{
$fp = @fsockopen("www.hotscripts.com", 80, $errno, $errstr, "1");
if ($fp){
fclose($fp);
$page = file_get_contents("http://www.hotscripts.com/Detailed/$id.html");
if (strlen($page) > 0){
preg_match_all('/id="ReviewsRatings.*?<td>(.*?)<\/td>.*?<td>(.*?)<\/td>.*?<td>(.*?)<\/td>/s', $page, $regs, PREG_PATTERN_ORDER);
if ($regs[2][0]) $rating = $regs[2][0];
else $rating = "Not Yet Rated";
if ($regs[3][0]) $votes = $regs[3][0];
else $votes = 0;
if ($regs[1][0]) $hits = $regs[1][0];
else $hits = 0;
$cache = array($id, $rating, $votes, $hits);
cache("hotscripts$id", 3600 * 24, $cache);
}
}
}
$html = "\n
<table border=\"0\" cellpadding=\"1\" cellspacing=\"0\" bgcolor=\"#A8DDA0\">
<tr>
<td>
<a href=\"http://www.hotscripts.com/Detailed/$id.html\" target=\"_blank\"><b>HotScripts.com</b></a>
</td>
</tr>
<tr>
<td>
<table border=\"0\" width=\"100%\" bgcolor=\"#EBFFED\">
<form action=\"http://www.hotscripts.com/cgi-bin/rate.cgi\" method=\"POST\" target=\"_blank\">
<tr>
<td><b>Rating:</b></td>
<td>$rating / 5</td></tr>
<tr>
<td><b>Votes:</b></td>
<td>$votes</td></tr>
<tr>
<td><b>Hits:</b></td>
<td>$hits</td>
</tr>
<tr>
<td>
<input type=\"hidden\" name=\"ID\" value=\"$id\">
<select name=\"ex_rate\">
<option value=\"5\" selected=\"selected\">Excellent!</option>
<option value=\"4\">Very Good</option>
<option value=\"3\">Good</option>
<option value=\"2\">Fair</option>
<option value=\"1\">Poor</option>
</select>
</td>
<td><input name=\"submit\" type=\"submit\" value=\"Rate It!\"></td>
</tr>
</form></table>
</td>
</tr>
</table>\n";
return $html;
}
?>
|