This repository has been archived by the owner on Mar 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathps3t_game_list.php
149 lines (109 loc) · 4.62 KB
/
ps3t_game_list.php
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<HTML>
<HEAD>
<TITLE>PS3Trophies.org Guide Template</TITLE>
<META name=VI60_defaultClientScript content=JavaScript>
<META http-equiv="Content-Type" Content="text/html; charset=UTF-16">
<META name="description" content="ps3trophies.org">
<META name="keywords" content="ps3trophies.org">
<link rel="stylesheet" type="text/css" href="ps3trophies.css">
</HEAD>
<BODY BGCOLOR=white>
<?php
// Include the library
include('simple_html_dom.php');
// Get the variables from the selection
$gamealpha = $_GET['alpha'];
$gamesite = $_GET['site'];
$forumnamecheck = 0;
// Create gametype based on site
if ($gamesite == 'ps3t') {
$siteurl = 'playstationtrophies.org';
$linkreplace = '/trophies/';
$numtypes = 4;
$gametype[0] = 'ps4';
$gametype[1] = 'retail';
$gametype[2] = 'psn';
$gametype[3] = 'vita';
$gametype[4] = 'japanese';
}
else {
$siteurl = 'xboxachievements.com';
$linkreplace = '/achievements/';
$numtypes = 7;
$gametype[0] = 'xbox-one';
$gametype[1] = 'arcade';
$gametype[2] = 'retail';
$gametype[3] = 'app';
$gametype[4] = 'japanese';
$gametype[5] = 'pc';
$gametype[6] = 'win8';
$gametype[7] = 'wp7';
}
echo '<BR>';
if ($gamesite == 'ps3t') {
echo '<FONT COLOR=darkblue SIZE=3><B>PLAYSTATION TROPHIES</B>'; }
else {
echo '<FONT COLOR=darkgreen SIZE=3><B>XBOX ACHIEVEMENTS</B>'; }
echo ' - ';
if ($gamealpha == '-') {
echo '0-9'; }
else {
echo strtoupper($gamealpha); }
echo ' games</FONT><BR><BR>';
// Retrieve the DOM from a given URL
for ($i = 0; $i <= $numtypes; $i++) {
if (($gametype[$i] == 'retail') && ($gamesite == 'ps3t')) {
echo '<B>PS3 RETAIL</B><BR>'; }
else if ($gametype[$i] == 'psn') {
echo '<B>PS3 DIGITAL</B><BR>'; }
else if ($gametype[$i] == 'xbox-one') {
echo '<B>XBOX ONE</B><BR>'; }
else if ($gametype[$i] == 'app') {
echo '<B>APPLICATIONS</B><BR>'; }
else {
echo '<B>' . str_replace('%20',' ',strtoupper($gametype[$i])) . '</B><BR>'; }
// Set number of pages dynamically
$init_html = file_get_html('http://www.' . $siteurl . '/browsegames/' . $gametype[$i] . '/' . $gamealpha . '/');
$pagination_obj = $init_html->find('div.pagination a');
if (count($pagination_obj) == 0) { $page_num = 1; }
else { $page_num = $pagination_obj[count($pagination_obj)-2]->plaintext; }
$init_html->clear();
unset($init_html);
for ($j = 1; $j <= $page_num; $j++) {
$html = file_get_html('http://www.' . $siteurl . '/browsegames/' . $gametype[$i] .
'/' . $gamealpha . '/' . $j);
foreach($html->find('a') as $x) {
if (strncmp($x->href, '/game/', 6) == 0) {
if ($x->class == 'linkT') {
$y = $x->href;
// get the game name
$game = str_replace($linkreplace,'',str_replace('/game/','',$y));
echo '<A HREF="ps3t_guide_template.php?site=' . $gamesite .
'&game=' . $game . '">';
// remove any blank unnecessary spaces
$gamename = str_replace(' ','',$x->plaintext);
if ($forumnamecheck) {
echo $gamename . '</A>'; }
else {
echo $gamename . '</A><BR>'; }
}
}
// FORUM LINK CHECK
if ((strncmp($x->href, '/forum/', 7) == 0) && ($forumnamecheck)) {
if ($x->class == 'linkT') {
$y = $x->href;
// get the game name
$forum = str_replace('/forum/','',$y);
echo '|<A HREF="http://www.' . $siteurl . $y . '" target="_blank">' . $forum . '</A><BR>';
}
}
}
}
echo '<BR>';
$html->clear();
unset($html);
}
?>
<BR><BR>
</BODY>
</HTML>