OSDN Git Service

Update index.php
[idb/iDB-Extras.git.git] / vercheck / index.php
1 <?php
2 /*
3     This program is free software; you can redistribute it and/or modify
4     it under the terms of the Revised BSD License.
5
6     This program is distributed in the hope that it will be useful,
7     but WITHOUT ANY WARRANTY; without even the implied warranty of
8     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9     Revised BSD License for more details.
10
11     Copyright 2009-2014 iDB Support - https://idb.osdn.jp/support/category.php?act=view&id=1
12     Copyright 2009-2014 Game Maker 2k - https://idb.osdn.jp/support/category.php?act=view&id=2
13
14     $FileInfo: index.php - Last Update: 07/18/2014 Ver 3.1.2 - Author: cooldude2k $
15 */
16 /* Change to your url. */
17 @ini_set("html_errors", false);
18 @ini_set("track_errors", false);
19 @ini_set("display_errors", false);
20 @ini_set("report_memleaks", false);
21 @ini_set("display_startup_errors", false);
22 //@ini_set("error_log","logs/error.log"); 
23 //@ini_set("log_errors","On"); 
24 @ini_set("docref_ext", "");
25 @ini_set("docref_root", "http://php.net/");
26 @ini_set("date.timezone","UTC"); 
27 @ini_set("default_mimetype","text/html");
28 @error_reporting(E_ALL ^ E_NOTICE);
29 @set_time_limit(30); @ignore_user_abort(true);
30 if(function_exists("date_default_timezone_set")) { 
31         @date_default_timezone_set("UTC"); }
32 function idb_output_handler($buffer) { return $buffer; }
33 @ob_start("idb_output_handler");
34 header("Cache-Control: private, no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0");
35 header("Pragma: private, no-cache, no-store, must-revalidate, pre-check=0, post-check=0, max-age=0");
36 header("P3P: CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"");
37 header("Date: ".gmdate("D, d M Y H:i:s")." GMT");
38 header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
39 header("Expires: ".gmdate("D, d M Y H:i:s")." GMT");
40 output_reset_rewrite_vars();
41 require_once('inc/killglobals.php');
42 $get_content_by = "file_get_contents"; // Can be file_get_contents or curl
43 $site_url = "http://localhost/vercheck/";
44 $agent_site_url = $site_url."?act=vercheck";
45 $site_name = "iDB Version checker";
46 $appname = "iDB VerCheck";
47 $download_url = "https://github.com/GameMaker2k/iDB/releases/latest";
48 $site_version = "3.1.2";
49 $ver_exp = explode(".",$site_version);
50 if(!isset($ver_exp[3])) { $ver_exp[3] = null; }
51 $appver = array($ver_exp[0],$ver_exp[1],$ver_exp[2],$ver_exp[3]);//Version of program
52 $csryear = "2004"; $cryear = date("Y"); if($cryear<=2004) { $cryear = "2005"; }
53 $site_useragent = "Mozilla/5.0 (compatible; iDB-VerCheck/".$site_version."; +".$agent_site_url.")";
54 $URLsTest = parse_url($Settings['idburl']); 
55 // Programs to check for add to array.
56 // $iDBArray = array("IntDB", "iDB");//IntDB
57 $iDBArray = array("iDB");
58 @ini_set("user_agent", $site_useragent);
59 if(!isset($get_content_by) || ($get_content_by!="file_get_contents" && $get_content_by!="curl")) { 
60    $get_content_by = "file_get_contents"; }
61 @ini_set("user_agent", $site_useragent);
62 if (function_exists("stream_context_create")) {
63 if($get_content_by=="file_get_contents") {
64 $opts = array(
65   'http' => array(
66     'method' => "GET",
67     'header' => "Accept-Language: *\r\n".
68                 "User-Agent: ".$site_useragent."\r\n".
69                 "Accept: */*\r\n".
70                 "Connection: keep-alive\r\n".
71                 "Referer: ".$agent_site_url."\r\n".
72                 "From: ".$agent_site_url."\r\n".
73                 "Via: ".$_SERVER['REMOTE_ADDR']."\r\n".
74                 "Forwarded: ".$_SERVER['REMOTE_ADDR']."\r\n".
75                 "X-Real-IP: ".$_SERVER['REMOTE_ADDR']."\r\n".
76                 "X-Forwarded-For: ".$_SERVER['REMOTE_ADDR']."\r\n".
77                 "X-Forwarded-Host: ".$URLsTest['host']."\r\n".
78                 "X-Forwarded-Proto: ".$URLsTest['scheme']."\r\n".
79                 "Client-IP: ".$_SERVER['REMOTE_ADDR']."\r\n"
80   )
81 );
82 $context = stream_context_create($opts); } }
83 function version_info($proname,$subver,$ver,$supver,$reltype,$svnver,$showsvn) {
84         $return_var = $proname." ".$reltype." ".$subver.".".$ver.".".$supver;
85         if($showsvn==false) { $showsvn = null; }
86         if($showsvn==true) { $return_var .= " SVN ".$svnver; }
87         if($showsvn!=true&&$showsvn!=null) { $return_var .= " ".$showsvn." ".$svnver; }
88         return $return_var; }
89 $appversion = version_info($appname,$appver[0],$appver[1],$appver[2],$appver[3]." Ver.",null,false);
90 if(!isset($_GET['redirect'])) { $_GET['redirect'] = "off"; }
91     /**
92      * Returns true if $string is valid UTF-8 and false otherwise.
93      *
94      * @since        1.14
95      * @param [mixed] $string     string to be tested
96      * @subpackage
97      */
98     function is_utf8($string) {
99       
100         // From http://w3.org/International/questions/qa-forms-utf-8.html
101         return preg_match('%^(?:
102               [\x09\x0A\x0D\x20-\x7E]            # ASCII
103             | [\xC2-\xDF][\x80-\xBF]             # non-overlong 2-byte
104             |  \xE0[\xA0-\xBF][\x80-\xBF]        # excluding overlongs
105             | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}  # straight 3-byte
106             |  \xED[\x80-\x9F][\x80-\xBF]        # excluding surrogates
107             |  \xF0[\x90-\xBF][\x80-\xBF]{2}     # planes 1-3
108             | [\xF1-\xF3][\x80-\xBF]{3}          # planes 4-15
109             |  \xF4[\x80-\x8F][\x80-\xBF]{2}     # plane 16
110         )*$%xs', $string);
111       
112     } 
113   # Original PHP code by Chirp Internet: www.chirp.com.au
114   # Please acknowledge use of this code by including this header.
115
116   function robots_allowed($url, $useragent=false)
117   {
118         global $context;
119     # parse url to retrieve host and path
120     $parsed = parse_url($url);
121
122     $agents = array(preg_quote('*'));
123     if($useragent) $agents[] = preg_quote($useragent);
124     $agents = implode('|', $agents);
125
126     # location of robots.txt file
127     if (function_exists("stream_context_create")) {
128         if($get_content_by=="file_get_contents") {
129            $robotstxt = file_get_contents("http://{$parsed['host']}/robots.txt",false,$context); }
130     } else {
131         if($get_content_by=="file_get_contents") {
132            $robotstxt = file_get_contents("http://{$parsed['host']}/robots.txt"); }
133     }
134     if($get_content_by=="curl") {
135        $ch = curl_init(); 
136        curl_setopt($ch, CURLOPT_URL, "http://{$parsed['host']}/robots.txt");
137        curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept-Language: *",
138                                                   "User-Agent: ".$site_useragent,
139                                                   "Accept: */*",
140                                                   "Connection: keep-alive",
141                                                   "Referer: ".$agent_site_url,
142                                                   "From: ".$agent_site_url,
143                                                   "Via: ".$_SERVER['REMOTE_ADDR'],
144                                                   "Forwarded: ".$_SERVER['REMOTE_ADDR'],
145                                                   "X-Forwarded-For: ".$_SERVER['REMOTE_ADDR'],
146                                                   "Client-IP: ".$_SERVER['REMOTE_ADDR']));
147        curl_setopt($ch, CURLOPT_HEADER, 0);
148        curl_setopt($ch, CURLOPT_VERBOSE, 0);
149        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
150        curl_setopt($ch, CURLOPT_USERAGENT, $site_useragent);
151        $robotstxt = curl_exec($ch);
152        curl_close($ch); }
153     if(!$robotstxt) { return true; }
154
155     $rules = array();
156     $ruleapplies = false;
157     foreach($robotstxt as $line) {
158       # skip blank lines
159       if(!$line = trim($line)) continue;
160
161       # following rules only apply if User-agent matches $useragent or '*'
162       if(preg_match('/User-agent: (.*)/i', $line, $match)) {
163         $ruleapplies = preg_match("/($agents)/i", $match[1]);
164       }
165       if($ruleapplies && preg_match('/Disallow:(.*)/i', $line, $regs)) {
166         # an empty rule implies full access - no further tests required
167         if(!$regs[1]) return true;
168         # add rules that apply to array for testing
169         $rules[] = preg_quote(trim($regs[1]), '/');
170       }
171     }
172
173     foreach($rules as $rule) {
174       # check if page is disallowed to us
175       if(preg_match("/^$rule/", $parsed['path'])) return false;
176     }
177
178     # page is not disallowed
179     return true;
180   }
181 if(!isset($_SERVER['HTTP_USER_AGENT'])) {
182         $_SERVER['HTTP_USER_AGENT'] = null; }
183 if (stristr($_SERVER["HTTP_USER_AGENT"],"W3C_Validator")) {
184         $_SERVER["HTTP_ACCEPT"] = "application/xml"; }
185 if(!isset($_SERVER['HTTP_ACCEPT'])) {
186         $_SERVER['HTTP_ACCEPT'] = null; }
187 if(!isset($_SERVER['PATH_INFO'])) {
188         $_SERVER['PATH_INFO'] = null; }
189 if(!isset($_GET['vercheck'])) { $_GET['vercheck'] = null; }
190 if($_GET['redirect']=="js") {
191 header("Content-Type: application/javascript; charset=UTF-8"); }
192 if($_GET['redirect']=="xml") {
193 if (stristr($_SERVER["HTTP_USER_AGENT"],"W3C_Validator")) {
194         $_SERVER["HTTP_ACCEPT"] = "application/xml"; }
195 if(stristr($_SERVER["HTTP_ACCEPT"],"application/xml") ) {
196 header("Content-Type: application/xml; charset=UTF-8"); }
197 else { header("Content-Type: text/xml; charset=UTF-8"); } }
198 if(!isset($_GET['act'])) { $_GET['act'] = "vercheck"; }
199 if(isset($_GET['act'])&&$_GET['act']!="update") {
200 if(!isset($_GET['name'])&&!isset($_GET['bid'])) {
201 ?>
202 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
203    "http://www.w3.org/TR/html4/strict.dtd">
204 <html>
205 <head>
206 <title> <?php echo $site_name; ?> </title>
207 <meta http-equiv="content-language" content="en-US">
208 <meta http-equiv="content-type" content="text/html; charset=iso-8859-15">
209 <meta name="Generator" content="EditPlus">
210 <meta name="Author" content="Cool Dude 2k">
211 <meta name="Keywords" content="<?php echo $site_name; ?>">
212 <meta name="Description" content="<?php echo $site_name; ?>">
213 <meta name="ROBOTS" content="Index, FOLLOW">
214 <meta name="revisit-after" content="1 days">
215 <meta name="GOOGLEBOT" content="Index, FOLLOW">
216 <meta name="resource-type" content="document">
217 <meta name="distribution" content="global">
218 <link rel="icon" href="favicon.ico" type="image/icon">
219 <link rel="shortcut icon" href="favicon.ico" type="image/icon">
220 </head>
221
222 <body>
223 <form method="get" action="?act=vercheck&amp;vercheck=newtype&amp;encoded=false">
224 <div>
225 <input type="hidden" id="act" name="act" value="vercheck" />
226 <label for="bid">Insert board url:</label><br />
227 <input type="text" id="bid" name="bid" /><br />
228 <input type="hidden" id="vercheck" name="vercheck" value="newtype" />
229 <input type="hidden" id="encoded" name="encoded" value="false" />
230 <input type="submit" />
231 </div>
232 </form>
233
234 <div class="copyright"><br />Powered by <a href="http://ja.gamemaker2k.org/" title="iDB-VerCheck <?php echo $site_version; ?>" onclick="window.open(this.href);return false;">iDB VerCheck</a> &copy; <a href="http://ja.gamemaker2k.org/support/category.php?act=view&amp;id=2" title="Game Maker 2k" onclick="window.open(this.href);return false;">Game Maker 2k</a> @ <?php echo $csryear." - ".$cryear; ?></div>
235 </body>
236 </html>
237 <?php exit(); } }
238 if(isset($_GET['bid'])) {
239         if(!isset($_GET['encoded'])) { 
240                 $_GET['encoded'] = "true"; }
241         if($_GET['encoded']=="true") { 
242         $_GET['bid'] = @base64_decode($_GET['bid']); }
243         $_GET['bid'] = @urldecode($_GET['bid']);
244         $_GET['bid'] = @strip_tags($_GET['bid']);
245         if(robots_allowed($_GET['bid'],"iDB-VerCheck")===false) {
246                 echo "Error cannot prase this site. :P ";
247                 /* Then we cant prase this site now*/ exit(); die(); }
248         $ChkURL = parse_url($_GET['bid']);
249         $HostIP = gethostbyname($ChkURL['host']);
250         if($_GET['vercheck']=="newtype") {
251         $actchange = preg_quote("act=view", '/');
252         $_GET['bid'] = preg_replace("/".$actchange."/i", "act=versioninfo", $_GET['bid']);
253     if (function_exists("stream_context_create")) {
254         if($get_content_by=="file_get_contents") {
255            $GetTitle = file_get_contents($_GET['bid'],false,$context); }
256     } else {
257         if($get_content_by=="file_get_contents") {
258            $GetTitle = file_get_contents($_GET['bid']); }
259     } 
260     if($get_content_by=="curl") {
261        $ch = curl_init(); 
262        curl_setopt($ch, CURLOPT_URL, $_GET['bid']);
263        curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept-Language: *",
264                                                   "User-Agent: ".$site_useragent,
265                                                   "Accept: */*",
266                                                   "Connection: keep-alive",
267                                                   "Referer: ".$agent_site_url,
268                                                   "From: ".$agent_site_url,
269                                                   "Via: ".$_SERVER['REMOTE_ADDR'],
270                                                   "Forwarded: ".$_SERVER['REMOTE_ADDR'],
271                                                   "X-Forwarded-For: ".$_SERVER['REMOTE_ADDR'],
272                                                   "Client-IP: ".$_SERVER['REMOTE_ADDR']));
273        curl_setopt($ch, CURLOPT_HEADER, 0);
274        curl_setopt($ch, CURLOPT_VERBOSE, 0);
275        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
276        curl_setopt($ch, CURLOPT_USERAGENT, $site_useragent);
277        $GetTitle = curl_exec($ch);
278        curl_close($ch); } }
279         if($_GET['vercheck']!="newtype") {
280     if (function_exists("stream_context_create")) {
281         if($get_content_by=="file_get_contents") {
282            $GetTitle = file_get_contents($_GET['bid'],false,$context); }
283     } else {
284         if($get_content_by=="file_get_contents") {
285            $GetTitle = file_get_contents($_GET['bid']); }
286     } 
287     if($get_content_by=="curl") {
288        $ch = curl_init(); 
289        curl_setopt($ch, CURLOPT_URL, $_GET['bid']);
290        curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept-Language: *",
291                                                   "User-Agent: ".$site_useragent,
292                                                   "Accept: */*",
293                                                   "Connection: keep-alive",
294                                                   "Referer: ".$agent_site_url,
295                                                   "From: ".$agent_site_url,
296                                                   "Via: ".$_SERVER['REMOTE_ADDR'],
297                                                   "Forwarded: ".$_SERVER['REMOTE_ADDR'],
298                                                   "X-Forwarded-For: ".$_SERVER['REMOTE_ADDR'],
299                                                   "Client-IP: ".$_SERVER['REMOTE_ADDR']));
300        curl_setopt($ch, CURLOPT_HEADER, 0);
301        curl_setopt($ch, CURLOPT_VERBOSE, 0);
302        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
303        curl_setopt($ch, CURLOPT_USERAGENT, $site_useragent);
304        $GetTitle = curl_exec($ch);
305        curl_close($ch); } }
306         $_GET['bid'] = htmlspecialchars($_GET['bid']);
307         preg_match_all("/<title>(.*?)<\/title>/i", $GetTitle, $GetFullTitle);
308         $GetConType = $GetTitle;
309         $GetTitle = htmlspecialchars(strip_tags(trim($GetFullTitle[1][0]))); 
310         if($_GET['vercheck']=="newtype") {
311         $prequote1 = preg_quote("<charset>", '/');
312         $prequote2 = preg_quote("</charset>", '/'); }
313         if($_GET['vercheck']!="newtype") {
314         $prequote1 = preg_quote("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=", '/');
315         $prequote2 = preg_quote("\" />", '/'); }
316         preg_match_all("/".$prequote1."(.*?)".$prequote2."/i", $GetConType, $GetCType);
317         $prequote1 = preg_quote("<name>", '/');
318         $prequote2 = preg_quote("</name>", '/');
319         preg_match_all("/".$prequote1."(.*?)".$prequote2."/i", $GetConType, $GetVerNum);
320         if(!isset($GetVerNum[1][0])) { 
321         $prequote1 = preg_quote("<!-- generator=\"", '/');
322         $prequote2 = preg_quote("\" -->", '/');
323         preg_match_all("/".$prequote1."(.*?)".$prequote2."/i", $GetConType, $GetVerNum); }
324         if(!isset($GetVerNum[1][0])) { 
325         $prequote1 = preg_quote("<meta name=\"Generator\" content=\"", '/');
326         $prequote2 = preg_quote("\" />", '/');
327         preg_match_all("/".$prequote1."(.*?)".$prequote2."/i", $GetConType, $GetVerNum); }
328         if(!isset($GetVerNum[1][0])) { 
329         $prequote1 = preg_quote("<a href=\"http://ja.gamemaker2k.org/\" title=\"", '/');
330         $prequote2 = preg_quote("\" onclick=\"window.open(this.href);return false;\">", '/');
331         preg_match_all("/".$prequote1."(.*?)".$prequote2."/i", $GetConType, $GetVerNum); }
332         if(!isset($GetVerNum[1][0])) { $GetVerNum[1][0] = null; }
333         $GetVerNum = $GetVerNum[1][0];
334         $GetVerNum = preg_replace("/\s/i", "|", $GetVerNum);
335         if(!isset($_GET['name'])) { $_GET['name'] = $GetVerNum; }
336         if(!isset($GetCType[1][0])) {
337         if(is_utf8($GetTitle)==true) { $GetCType[1][0] = "UTF-8"; }
338         if(is_utf8($GetTitle)==false) { $GetCType[1][0] = "UTF-8"; 
339         $GetTitle = utf8_encode($GetTitle); }
340         $preq1 = preg_quote("&amp;#", '/');
341         $GetTitle = preg_replace("/".$preq1."(.*?);/isU","&#\\1;",$GetTitle);
342         $preq2 = preg_quote("&amp;#x", '/');
343         $GetTitle = preg_replace("/".$preq2."(.*?);/isU","&#x\\1;",$GetTitle);
344         if(!isset($GetCType[1][0])) { $GetCType[1][0] = null; }
345         $BoardLang = $GetCType[1][0];
346         if(isset($BoardLang)) {
347         if($BoardLang!="ISO-8859-15"&&$BoardLang!="ISO-8859-1"&&
348         $BoardLang!="UTF-8"&&$BoardLang!="CP866"&&
349         $BoardLang!="Windows-1251"&&$BoardLang!="Windows-1252"&&
350         $BoardLang!="KOI8-R"&&$BoardLang!="BIG5"&&
351         $BoardLang!="GB2312"&&$BoardLang!="BIG5-HKSCS"&&
352         $BoardLang!="Shift_JIS"&&$BoardLang!="EUC-JP") {
353         $BoardLang = "ISO-8859-15"; } }
354         $GetFullTitle = $GetTitle; } }
355 if(!isset($_GET['bid'])) { $_GET['bid'] = null; }
356 // Make the Query String if we are not useing &=
357 function qstring($qstr=";",$qsep="=")
358 { $_GET = null; $_GET = array();
359 if (!isset($_SERVER['QUERY_STRING'])) {
360 $_SERVER['QUERY_STRING'] = getenv('QUERY_STRING'); }
361 @ini_get("arg_separator.input", $qstr);
362 $_SERVER['QUERY_STRING'] = urldecode($_SERVER['QUERY_STRING']);
363 $preqs = explode($qstr,$_SERVER["QUERY_STRING"]);
364 $qsnum = count($preqs); $qsi = 0;
365 while ($qsi < $qsnum) {
366 $preqst = explode($qsep,$preqs[$qsi],2);
367 $fix1 = array(" ",'$'); $fix2  = array("_","_");
368 $preqst[0] = str_replace($fix1, $fix2, $preqst[0]);
369 $preqst[0] = killbadvars($preqst[0]);
370 if($preqst[0]!=null) {
371 $_GET[$preqst[0]] = $preqst[1]; }
372 ++$qsi; } return true; }
373 if($_SERVER['PATH_INFO']==null) {
374         if(@getenv('PATH_INFO')!=null&&@getenv('PATH_INFO')!="1") {
375 $_SERVER['PATH_INFO'] = @getenv('PATH_INFO'); }
376 if(@getenv('PATH_INFO')==null) {
377 $myscript = $_SERVER["SCRIPT_NAME"];
378 $myphpath = $_SERVER["PHP_SELF"];
379 $mypathinfo = str_replace($myscript, "", $myphpath);
380 @putenv("PATH_INFO=".$mypathinfo); } }
381 // Change Path info to Get Vars :
382 function mrstring() {
383 $urlvar = explode('/',$_SERVER['PATH_INFO']);
384 $num=count($urlvar); $i=1;
385 while ($i < $num) {
386 //$urlvar[$i] = urldecode($urlvar[$i]);
387 if(!isset($_GET[$urlvar[$i]])) { $_GET[$urlvar[$i]] = null; }
388 if(!isset($urlvar[$i])) { $urlvar[$i] = null; }
389 if($_GET[$urlvar[$i]]==null&&$urlvar[$i]!=null) {
390 $fix1 = array(" ",'$'); $fix2  = array("_","_");
391 $urlvar[$i] = str_replace($fix1, $fix2, $urlvar[$i]);
392 $urlvar[$i] = killbadvars($urlvar[$i]);
393         $_GET[$urlvar[$i]] = $urlvar[$i+1]; }
394 ++$i; ++$i; } return true; }
395 // Redirect to another file with ether timed or nontimed redirect
396 function redirect($type,$file,$time=0,$url=null,$dbsr=true) {
397 if($type!="location"&&$type!="refresh") { $type=="location"; }
398 if($url!=null) { $file = $url.$file; }
399 if($dbsr===true) { $file = str_replace("//", "/", $file); }
400 if($type=="refresh") { header("Refresh: ".$time."; URL=".$file); }
401 if($type=="location") { @session_write_close(); 
402 header("Location: ".$file); } return true; }
403 function redirects($type,$url,$time=0) {
404 if($type!="location"&&$type!="refresh") { $type=="location"; }
405 if($type=="refresh") { header("Refresh: ".$time."; URL=".$url); }
406 if($type=="location") { header("Location: ".$url); } return true; }
407 // Make xhtml tags
408 function html_tag_make($name="br",$emptytag=true,$attbvar=null,$attbval=null,$extratest=null) {
409         $var_num = count($attbvar); $value_num = count($attbval);
410         if($var_num!=$value_num) { 
411                 echo "Erorr Number of Var and Values dont match!";
412         return false; } $i = 0;
413         while ($i < $var_num) {
414         if($i==0) { $mytag = "<".$name." ".$attbvar[$i]."=\"".$attbval[$i]."\""; }
415         if($i>=1) { $mytag = $mytag." ".$attbvar[$i]."=\"".$attbval[$i]."\""; }
416         if($i==$var_num-1) { 
417         if($emptytag===false) { $mytag = $mytag.">"; }
418         if($emptytag===true) { $mytag = $mytag." />"; } }       ++$i; }
419         if($attbvar==null&&$attbval==null) { $mytag = "<".$name;
420         if($emptytag===true) { $mytag = $mytag." />"; }
421         if($emptytag===false) { $mytag = $mytag.">"; } }
422         if($emptytag===false&&$extratest!=null) { 
423         $mytag = $mytag.$extratest; $mytag = $mytag."</".$name.">"; } 
424         return $mytag; }
425 // Start a xml document
426 function xml_tag_make($type,$attbs,$retval=false) {
427         $melanie1 = explode("&",$attbs);
428         $melanienum=count($melanie1);
429         $melaniei=0; $attblist = null;
430         while ($melaniei < $melanienum) {
431         $melanie2 = explode("=",$melanie1[$melaniei]);
432         if($melanie2[0]!=null||$melanie2[1]!=null) {
433         $attblist = $attblist.' '.$melanie2[0].'="'.$melanie2[1].'"'; }
434         ++$melaniei; }
435         if($retval!==false&&$retval!==true) { $retval=false; }
436         if($retval===false) {
437         echo '<?'.$type.$attblist.'?>'."\n"; }
438         if($retval===true) {
439         return '<?'.$type.$attblist.'?>'."\n"; } }
440 // Start a xml document (old version)
441 function xml_doc_start($ver,$encode,$retval=false) {
442         if($retval===false) {
443         echo xml_tag_make('xml','version='.$ver.'&encoding='.$encode,true); }
444         if($retval===true) {
445         return xml_tag_make('xml','version='.$ver.'&encoding='.$encode,true); } }
446 if($_GET['redirect']!="on"&&$_GET['redirect']!="xml"&&$_GET['redirect']!="js") {
447 ?>
448 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
449    "http://www.w3.org/TR/html4/strict.dtd">
450 <html>
451 <head>
452 <?php if(isset($GetFullTitle)) { ?>
453 <title> <?php echo $site_name; ?> - Checking <?php echo $GetFullTitle; ?> </title>
454 <?php } if(!isset($GetFullTitle)) { ?>
455 <title> <?php echo $site_name; ?> </title>
456 <?php } ?>
457 <meta http-equiv="content-language" content="en-US">
458 <?php if(isset($BoardLang)) { ?>
459 <meta http-equiv="content-type" content="text/html; charset=<?php echo $BoardLang; ?>">
460 <?php } if(!isset($BoardLang)) { ?>
461 <meta http-equiv="content-type" content="text/html; charset=iso-8859-15">
462 <?php } ?>
463 <meta name="Generator" content="EditPlus">
464 <meta name="Author" content="Cool Dude 2k">
465 <meta name="Keywords" content="<?php echo $site_name; ?>">
466 <meta name="Description" content="<?php echo $site_name; ?>">
467 <meta name="ROBOTS" content="Index, FOLLOW">
468 <meta name="revisit-after" content="1 days">
469 <meta name="GOOGLEBOT" content="Index, FOLLOW">
470 <meta name="resource-type" content="document">
471 <meta name="distribution" content="global">
472 <link rel="icon" href="favicon.ico" type="image/icon">
473 <link rel="shortcut icon" href="favicon.ico" type="image/icon">
474 </head>
475
476 <body>
477 <?php }
478 if(!isset($_GET['act'])) { $_GET['act'] = null; }
479 if(!isset($_GET['redirect'])) { $_GET['redirect'] = null; }
480 if(isset($_GET['act'])&&$_GET['act']=="update") {
481 if (function_exists("stream_context_create")) {
482     if($get_content_by=="file_get_contents") {
483        $GetNewVersion = file_get_contents("https://github.com/GameMaker2k/iDB/releases/latest",false,$context); }
484 } else {
485     if($get_content_by=="file_get_contents") {
486        $GetNewVersion = file_get_contents("https://github.com/GameMaker2k/iDB/releases/latest"); }
487 }
488 if($get_content_by=="curl") {
489    $ch = curl_init(); 
490    curl_setopt($ch, CURLOPT_URL, "https://github.com/GameMaker2k/iDB/releases/latest");
491    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept-Language: *",
492                                               "User-Agent: ".$site_useragent,
493                                               "Accept: */*",
494                                               "Connection: keep-alive",
495                                               "Referer: ".$agent_site_url,
496                                               "From: ".$agent_site_url,
497                                               "Via: ".$_SERVER['REMOTE_ADDR'],
498                                               "Forwarded: ".$_SERVER['REMOTE_ADDR'],
499                                               "X-Forwarded-For: ".$_SERVER['REMOTE_ADDR'],
500                                               "Client-IP: ".$_SERVER['REMOTE_ADDR']));
501    curl_setopt($ch, CURLOPT_HEADER, 0);
502    curl_setopt($ch, CURLOPT_VERBOSE, 0);
503    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
504    curl_setopt($ch, CURLOPT_USERAGENT, $site_useragent);
505    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
506    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
507    $GetNewVersion = curl_exec($ch);
508    curl_close($ch); }
509 $verstart = preg_quote("<a href=\"/GameMaker2k/iDB/commit/", "/");
510 $verend = preg_quote("\" class=\"muted-link\">", "/");
511 preg_match_all("/".$verstart."([0-9a-zA-Z]+)".$verend."/is", $GetNewVersion, $NewVersionPart);
512 $verstartnex = preg_quote("<a href=\"/GameMaker2k/iDB/releases/tag/", "/");
513 $vermidnex = preg_quote("\">iDB ", "/");
514 $verendnex = preg_quote("</a>", "/");
515 preg_match_all("/".$verstartnex."([0-9]+)\.([0-9]+)\.([0-9]+)".$vermidnex."([0-9]+)\.([0-9]+)\.([0-9]+)".$verendnex."/is", $GetNewVersion, $NewFullVersionPart);
516 $NewSVNPart = "https://raw.githubusercontent.com/GameMaker2k/iDB/".$NewVersionPart[1][0]."/inc/versioninfo.php";
517 if (function_exists("stream_context_create")) {
518     if($get_content_by=="file_get_contents") {
519        $GetSVNVersion = file_get_contents($NewSVNPart,false,$context); }
520 } else {
521     if($get_content_by=="file_get_contents") {
522        $GetSVNVersion = file_get_contents($NewSVNPart); }
523
524 if($get_content_by=="curl") {
525    $ch = curl_init(); 
526    curl_setopt($ch, CURLOPT_URL, $NewSVNPart);
527    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept-Language: *",
528                                               "User-Agent: ".$site_useragent,
529                                               "Accept: */*",
530                                               "Connection: keep-alive",
531                                               "Referer: ".$agent_site_url,
532                                               "From: ".$agent_site_url,
533                                               "Via: ".$_SERVER['REMOTE_ADDR'],
534                                               "Forwarded: ".$_SERVER['REMOTE_ADDR'],
535                                               "X-Forwarded-For: ".$_SERVER['REMOTE_ADDR'],
536                                               "Client-IP: ".$_SERVER['REMOTE_ADDR']));
537    curl_setopt($ch, CURLOPT_HEADER, 0);
538    curl_setopt($ch, CURLOPT_VERBOSE, 0);
539    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
540    curl_setopt($ch, CURLOPT_USERAGENT, $site_useragent);
541    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
542    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
543    $GetSVNVersion = curl_exec($ch);
544    curl_close($ch); }
545 $prepreg1 = preg_quote("\$SubVerN = ","/"); 
546 $prepreg2 = preg_quote(";","/");
547 preg_match_all("/".$prepreg1."(.*)".$prepreg2."{1}/isU", $GetSVNVersion, $GetVerSubType);
548 $newver['subver'] = $GetVerSubType[1][0];
549 //$newver['subver'] = $NewFullVersionPart[1][0].".".$NewFullVersionPart[2][0].".".$NewFullVersionPart[3][0];
550 $prepreg1 = preg_quote("\$VER1[0] = ","/"); 
551 $prepreg2 = preg_quote(";","/");
552 preg_match_all("/".$prepreg1."(.*)".$prepreg2."{1}/isU", $GetSVNVersion, $GetVer0);
553 $GetVer0 = $GetVer0[1][0];
554 $prepreg1 = preg_quote("\$VER1[1] = ","/"); 
555 $prepreg2 = preg_quote(";","/");
556 preg_match_all("/".$prepreg1."(.*)".$prepreg2."{1}/isU", $GetSVNVersion, $GetVer1);
557 $GetVer1 = $GetVer1[1][0];
558 $prepreg1 = preg_quote("\$VER1[2] = ","/"); 
559 $prepreg2 = preg_quote(";","/");
560 preg_match_all("/".$prepreg1."(.*)".$prepreg2."{1}/isU", $GetSVNVersion, $GetVer2);
561 $GetVer2 = $GetVer2[1][0];
562 $newver['ver'] = $GetVer0.".".$GetVer1.".".$GetVer2;
563 $prepreg1 = preg_quote("\$VER2[0] = \"","/"); 
564 $prepreg2 = preg_quote("\";","/");
565 preg_match_all("/".$prepreg1."(.*)".$prepreg2."{1}/isU", $GetSVNVersion, $GetFullVerType);
566 $newver['fullreltype'] = $GetFullVerType[1][0];
567 $prepreg1 = preg_quote("\$VER2[1] = \"","/"); 
568 $prepreg2 = preg_quote("\";","/");
569 preg_match_all("/".$prepreg1."(.*)".$prepreg2."{1}/isU", $GetSVNVersion, $GetVerType);
570 $newver['reltype'] = $GetVerType[1][0];
571 $prepreg1 = preg_quote("\$VER2[2] = \"","/"); 
572 $prepreg2 = preg_quote("\";","/");
573 preg_match_all("/".$prepreg1."(.*)".$prepreg2."{1}/isU", $GetSVNVersion, $GetVerSubType);
574 $newver['subtype'] = $GetVerSubType[1][0];
575 echo "Sorry need more info to check version.";
576 $VersionXML = xml_doc_start("1.0","UTF-8",true);
577 $VersionXML .= xml_tag_make("xml-stylesheet","type=text/xsl&href=version.xsl",true)."\n";
578 $VersionXML .= "<!DOCTYPE versioninfo [\n";
579 $VersionXML .= "<!ELEMENT versioninfo (version*)>\n";
580 $VersionXML .= "<!ELEMENT version (relname,reltype,reltypename,relnum,subtype,relsvnum,fullrel,fullname)>\n";
581 $VersionXML .= "<!ELEMENT relname (#PCDATA)>\n";
582 $VersionXML .= "<!ELEMENT reltype (#PCDATA)>\n";
583 $VersionXML .= "<!ELEMENT reltypename (#PCDATA)>\n";
584 $VersionXML .= "<!ELEMENT relnum (#PCDATA)>\n";
585 $VersionXML .= "<!ELEMENT subtype (#PCDATA)>\n";
586 $VersionXML .= "<!ELEMENT relsvnum (#PCDATA)>\n";
587 $VersionXML .= "<!ELEMENT fullrel (#PCDATA)>\n";
588 $VersionXML .= "<!ELEMENT fullname (#PCDATA)>\n";
589 $VersionXML .= "]>\n\n";
590 $VersionXML .= "<versioninfo>\n\n";
591 $VersionXML .= "<version>\n";
592 $VersionXML .= "<relname>iDB</relname>\n";
593 $VersionXML .= "<reltype>".$newver['reltype']."</reltype>\n";
594 $VersionXML .= "<reltypename>".$newver['fullreltype']."</reltypename>\n";
595 $VersionXML .= "<relnum>".$newver['ver']."</relnum>\n";
596 $VersionXML .= "<subtype>".$newver['subtype']."</subtype>\n";
597 $VersionXML .= "<relsvnum>".$newver['subver']."</relsvnum>\n";
598 $VersionXML .= "<fullrel>iDB ".$newver['reltype']." ".$newver['ver']."</fullrel>\n";
599 $VersionXML .= "<fullname>iDB ".$newver['reltype']." ".$newver['ver']." ".$newver['subtype']." ".$newver['subver']."</fullname>\n";
600 $VersionXML .= "</version>\n\n";
601 $VersionXML .= "</versioninfo>\n";
602 $fp = fopen("./inc/version.xml","w+");
603 fwrite($fp, $VersionXML);
604 fclose($fp); }
605
606 if($_GET['act']!="update") {
607 $VersionFile = file_get_contents("inc/version.xml");
608 if(!isset($iDBArray)) {
609 $iDBArray = array("iDB"); }
610 $NamePart = explode("|", $_GET['name']);
611 if(count($NamePart)>=5) { 
612 $_GET['name'] = $NamePart[0];
613 if(!isset($_GET['reltype'])&&isset($NamePart[1])) {
614         $_GET['reltype'] = $NamePart[1]; }
615 if(!isset($_GET['ver'])&&isset($NamePart[2])) {
616         $_GET['ver'] = $NamePart[2]; }
617 if(!isset($_GET['subtype'])&&isset($NamePart[3])) {
618         $_GET['subtype'] = $NamePart[3]; }
619 if(!isset($_GET['subver'])&&isset($NamePart[4])) {
620         $_GET['subver'] = $NamePart[4]; } }
621 if(count($NamePart)<5&&count($NamePart)!=1) { 
622 if(!isset($_GET['name'])||!isset($_GET['reltype'])||!isset($_GET['ver'])||
623         !isset($_GET['subtype'])||!isset($_GET['subver'])) {
624         echo "Sorry need more info to check version."; ?>
625
626 <div class="copyright"><br />Powered by <a href="http://ja.gamemaker2k.org/" title="iDB-VerCheck <?php echo $site_version; ?>" onclick="window.open(this.href);return false;">iDB VerCheck</a> &copy; <a href="http://ja.gamemaker2k.org/support/category.php?act=view&amp;id=2" title="Game Maker 2k" onclick="window.open(this.href);return false;">Game Maker 2k</a> @ <?php echo $csryear." - ".$cryear; ?></div>
627 </body>
628 </html>
629 <?php exit(); } }
630 if(!isset($_GET['name'])||!isset($_GET['reltype'])||!isset($_GET['ver'])||
631         !isset($_GET['subtype'])||!isset($_GET['subver'])) {
632         echo "Sorry need more info to check version."; ?>
633 <?php exit(); }
634 if(count($NamePart)==1) { $_GET['name'] = $NamePart[0]; }
635 if(!in_array($_GET['name'],$iDBArray)) { echo "Sorry cound not find ".$_GET['name']."."; ?>
636
637 <div class="copyright"><br />Powered by <a href="http://ja.gamemaker2k.org/" title="iDB-VerCheck <?php echo $site_version; ?>" onclick="window.open(this.href);return false;">iDB VerCheck</a> &copy; <a href="http://ja.gamemaker2k.org/support/category.php?act=view&amp;id=2" title="Game Maker 2k" onclick="window.open(this.href);return false;">Game Maker 2k</a> @ <?php echo $csryear." - ".$cryear; ?></div>
638 </body>
639 </html>
640 <?php exit(); }
641 $VerSplit = explode(".", $_GET['ver']);
642 if(count($VerSplit)>3||count($VerSplit)<3) { 
643 echo "Sorry version number is not formated right"; exit(); }
644 preg_match_all("/([a-zA-Z]+)([0-9]+)/i", $_GET['reltype'], $reltypeChCk);
645 if(isset($reltypeChCk[0][0])) {
646 $_GET['reltype'] = $reltypeChCk[1][0];
647 $uvercheck['reltypex'] = $reltypeChCk[2][0]; }
648 if(!isset($reltypeChCk[0][0])) {
649 preg_match_all("/([a-zA-Z]+)/i", $_GET['reltype'], $reltypeChCk); 
650 $_GET['reltype'] = $reltypeChCk[1][0];
651 $uvercheck['reltypex'] = "0"; }
652 /*
653 PA (Pre-Alpha) = 100
654 A - Al (Alpha) = 200
655 PB (Pre-Beta) = 300
656 B - Be (Beta) = 400
657 G - Ga (Gamma) = 500
658 D - De (Delta) = 600
659 O - Om (Omega) = 700
660 Z - Ze (Zenith) = 800
661 R - RC (Release Candidate) = 900
662 F - FR (Final Release) = 950
663 */
664 // Pre-Alpha
665 if($_GET['reltype']=="PA") {
666         $uvercheck['reltypenum'] = 100 + $uvercheck['reltypex']; }
667 // Alpha
668 if($_GET['reltype']=="A"||
669         $_GET['reltype']=="Al") {
670         $uvercheck['reltypenum'] = 200 + $uvercheck['reltypex']; }
671 // Pre-Beta
672 if($_GET['reltype']=="PB") {
673         $uvercheck['reltypenum'] = 300 + $uvercheck['reltypex']; }
674 // Beta
675 if($_GET['reltype']=="B"||
676         $_GET['reltype']=="Be") {
677         $uvercheck['reltypenum'] = 400 + $uvercheck['reltypex']; }
678 // Gamma
679 if($_GET['reltype']=="G"||
680         $_GET['reltype']=="Ga") {
681         $uvercheck['reltypenum'] = 500 + $uvercheck['reltypex']; }
682 // Delta
683 if($_GET['reltype']=="D"||
684         $_GET['reltype']=="De") {
685         $uvercheck['reltypenum'] = 600 + $uvercheck['reltypex']; }
686 // Omega
687 if($_GET['reltype']=="O"||
688         $_GET['reltype']=="Om") {
689         $uvercheck['reltypenum'] = 700 + $uvercheck['reltypex']; }
690 // Zenith
691 if($_GET['reltype']=="Z"||
692         $_GET['reltype']=="Ze") {
693         $uvercheck['reltypenum'] = 800 + $uvercheck['reltypex']; }
694 // Release Candidate
695 if($_GET['reltype']=="R"||
696         $_GET['reltype']=="RC") {
697         $uvercheck['reltypenum'] = 900 + $uvercheck['reltypex']; }
698 // Final Release
699 if($_GET['reltype']=="F"||
700         $_GET['reltype']=="FR") {
701         $uvercheck['reltypenum'] = 950 + $uvercheck['reltypex']; }
702 if($uvercheck['reltypex']!=0) {
703         $_GET['reltype'] = $_GET['reltype'].$uvercheck['reltypex']; }
704 $FullRelNum = $VerSplit[0].$VerSplit[1].$VerSplit[2].".".$uvercheck['reltypenum'].$_GET['subver'];
705 $prepreg1 = preg_quote("<version>\n<relname>".$_GET['name']."</relname>","/"); 
706 $prepreg2 = preg_quote("</version>","/");
707 preg_match_all("/".$prepreg1."(.*)".$prepreg2."{1}/isU", $VersionFile, $VersionPart);
708 $VersionPart = $VersionPart[0][0];
709 $prepreg1 = preg_quote("<relname>","/"); 
710 $prepreg2 = preg_quote("</relname>","/");
711 preg_match_all("/".$prepreg1."(.*)".$prepreg2."{1}/isU", $VersionPart, $NamePart);
712 $vercheck['name'] = $NamePart[1][0];
713 $prepreg1 = preg_quote("<reltype>","/"); 
714 $prepreg2 = preg_quote("</reltype>","/");
715 preg_match_all("/".$prepreg1."(.*)".$prepreg2."{1}/isU", $VersionPart, $RelTypePart);
716 $vercheck['reltype'] = $RelTypePart[1][0];
717 preg_match_all("/([a-zA-Z]+)([0-9]+)/i", $vercheck['reltype'], $reltypeChCk);
718 if(isset($reltypeChCk[0][0])) {
719 $vercheck['reltype'] = $reltypeChCk[1][0];
720 $vercheck['reltypex'] = $reltypeChCk[2][0]; }
721 if(!isset($reltypeChCk[0][0])) {
722 preg_match_all("/([a-zA-Z]+)/i", $vercheck['reltype'], $reltypeChCk); 
723 $vercheck['reltype'] = $reltypeChCk[1][0];
724 $vercheck['reltypex'] = "0"; }
725 /*
726 PA (Pre-Alpha) = 100
727 A - Al (Alpha) = 200
728 PB (Pre-Beta) = 300
729 B - Be (Beta) = 400
730 G - Ga (Gamma) = 500
731 D - De (Delta) = 600
732 O - Om (Omega) = 700
733 Z - Ze (Zenith) = 800
734 R - RC (Release Candidate) = 900
735 F - FR (Final Release) = 950
736 */
737 // Pre-Alpha
738 if($vercheck['reltype']=="PA") {
739         $vercheck['reltypenum'] = 100 + $vercheck['reltypex']; }
740 // Alpha
741 if($vercheck['reltype']=="A"||
742         $vercheck['reltype']=="Al") {
743         $vercheck['reltypenum'] = 200 + $vercheck['reltypex']; }
744 // Pre-Beta
745 if($vercheck['reltype']=="PB") {
746         $vercheck['reltypenum'] = 300 + $vercheck['reltypex']; }
747 // Beta
748 if($vercheck['reltype']=="B"||
749         $vercheck['reltype']=="Be") {
750         $vercheck['reltypenum'] = 400 + $vercheck['reltypex']; }
751 // Gamma
752 if($vercheck['reltype']=="G"||
753         $vercheck['reltype']=="Ga") {
754         $vercheck['reltypenum'] = 500 + $vercheck['reltypex']; }
755 // Delta
756 if($vercheck['reltype']=="D"||
757         $vercheck['reltype']=="De") {
758         $vercheck['reltypenum'] = 600 + $vercheck['reltypex']; }
759 // Omega
760 if($vercheck['reltype']=="O"||
761         $vercheck['reltype']=="Om") {
762         $vercheck['reltypenum'] = 700 + $vercheck['reltypex']; }
763 // Zenith
764 if($vercheck['reltype']=="Z"||
765         $vercheck['reltype']=="Ze") {
766         $vercheck['reltypenum'] = 800 + $vercheck['reltypex']; }
767 // Release Candidate
768 if($vercheck['reltype']=="R"||
769         $vercheck['reltype']=="RC") {
770         $vercheck['reltypenum'] = 900 + $vercheck['reltypex']; }
771 // Final Release
772 if($vercheck['reltype']=="F"||
773         $vercheck['reltype']=="FR") {
774         $vercheck['reltypenum'] = 950 + $vercheck['reltypex']; }
775 if($vercheck['reltypex']!=0) {
776         $vercheck['reltype'] = $vercheck['reltype'].$vercheck['reltypex']; }
777 $prepreg1 = preg_quote("<relnum>","/"); 
778 $prepreg2 = preg_quote("</relnum>","/");
779 preg_match_all("/".$prepreg1."(.*)".$prepreg2."{1}/isU", $VersionPart, $RelNumPart);
780 $vercheck['ver'] = $RelNumPart[1][0];
781 $MyVerSplit = explode(".", $vercheck['ver']);
782 $prepreg1 = preg_quote("<subtype>","/"); 
783 $prepreg2 = preg_quote("</subtype>","/");
784 preg_match_all("/".$prepreg1."(.*)".$prepreg2."{1}/isU", $VersionPart, $SubTypePart);
785 $vercheck['subtype'] = $SubTypePart[1][0];
786 $prepreg1 = preg_quote("<relsvnum>","/"); 
787 $prepreg2 = preg_quote("</relsvnum>","/");
788 preg_match_all("/".$prepreg1."(.*)".$prepreg2."{1}/isU", $VersionPart, $RelSVNumPart);
789 $vercheck['subver'] = $RelSVNumPart[1][0];
790 $MyFullRelNum = $MyVerSplit[0].$MyVerSplit[1].$MyVerSplit[2].".".$vercheck['reltypenum'].$vercheck['subver'];
791 $DownloadLink = "<a href=\"".$download_url."\">".$download_url."</a>";
792 if($_GET['redirect']!="on"&&$_GET['redirect']!="xml"&&$_GET['redirect']!="js") {
793 echo "<div>"; }
794 $actchange = preg_quote("act=versioninfo", '/');
795 $_GET['bid'] = preg_replace("/".$actchange."/i", "act=view", $_GET['bid']);
796 if($_GET['redirect']=="xml") {
797 $VersionXML = xml_doc_start("1.0","UTF-8",true);
798 $VersionXML .= "<!DOCTYPE versioninfo [\n";
799 $VersionXML .= "<!ELEMENT versioninfo (version*)>\n";
800 $VersionXML .= "<!ELEMENT version (reltype,relnum,subtype,relsvnum,results)>\n";
801 $VersionXML .= "<!ELEMENT reltype (#PCDATA)>\n";
802 $VersionXML .= "<!ELEMENT relnum (#PCDATA)>\n";
803 $VersionXML .= "<!ELEMENT subtype (#PCDATA)>\n";
804 $VersionXML .= "<!ELEMENT relsvnum (#PCDATA)>\n";
805 $VersionXML .= "<!ELEMENT results (#PCDATA)>\n";
806 $VersionXML .= "<!ENTITY nbsp \" \">\n";
807 $VersionXML .= "]>\n\n";
808 $VersionXML .= "<versioninfo>\n\n";
809 $VersionXML .= "<version>\n";
810 $VersionXML .= "<reltype>".$vercheck['reltype']."</reltype>\n";
811 $VersionXML .= "<relnum>".$vercheck['ver']."</relnum>\n";
812 $VersionXML .= "<subtype>".$vercheck['subtype']."</subtype>\n";
813 $VersionXML .= "<relsvnum>".$vercheck['subver']."</relsvnum>\n";
814 if($FullRelNum<$MyFullRelNum) {
815 $VersionXML .= "<results><![CDATA[\n<img src=\"".$site_url."inc/pics/old.png\" alt=\"You seem to be using a old version.\" title=\"You seem to be using a old version.\" />&nbsp;Warning: A new version is available. <a href=\"".$download_url."\">Click Here</a>\n]]></results>\n"; }
816 if($FullRelNum==$MyFullRelNum) {
817 $VersionXML .= "<results><![CDATA[\n<img src=\"".$site_url."inc/pics/new.png\" alt=\"Congratulations you have the newest version. ^_^ \" title=\"Congratulations you have the newest version. ^_^ \" />&nbsp;Congratulates: You have the latest version.\n]]></results>\n"; }
818 if($FullRelNum>$MyFullRelNum) {
819 $VersionXML .= "<results><![CDATA[\n<img src=\"".$site_url."inc/pics/beta.png\" alt=\"You seem to be using a nightly version.\" title=\"You seem to be using a nightly version.\" />&nbsp;Warning: You seem to be using a nightly version. <a href=\"".$download_url."\">Click Here</a> for latest version.\n]]></results>\n"; }
820 $VersionXML .= "</version>\n\n";
821 $VersionXML .= "</versioninfo>"; 
822 echo $VersionXML; }
823 if($_GET['redirect']=="js") {
824 $VersionJS = "function idbvercheck() \n{ \n";
825 $VersionJS .= "document.getElementById('iverinfo').style.display = '';\n";
826 $VersionJS .= "var vercheckinfo = 'Version Check info below: <br />';\n";
827 $VersionJS .= "var yourverinfo = 'Your Version: ".$_GET['name']." ".$_GET['reltype']." ".$_GET['ver']." ".$_GET['subtype']." ".$_GET['subver']."';\n";
828 $VersionJS .= "var myverinfo = 'Current Version: ".$vercheck['name']." ".$vercheck['reltype']." ".$vercheck['ver']." ".$vercheck['subtype']." ".$vercheck['subver']."<br />';\n";
829 $VersionJS .= "var ourverinfo = yourverinfo+'<br />'+myverinfo;\n";
830 if($_GET['bid']!==null) {
831 $VersionJS .= "var checkingsite = 'Checking board: <a href=\"".$_GET['bid']."\" title=\"".$GetTitle."\">".$GetTitle."<\/a><br />';\n"; }
832 if($_GET['bid']===null) {
833 $VersionJS .= "var checkingsite = '';\n"; }
834 $VersionJS .= "var copyright = '<br \/>Powered by <a href=\"http://ja.gamemaker2k.org/\" title=\"iDB-VerCheck ".$site_version."\" onclick=\"window.open(this.href);return false;\">iDB VerCheck</a> &#169; <a href=\"http://ja.gamemaker2k.org/support/category.php?act=view&amp;id=2\" title=\"Game Maker 2k\" onclick=\"window.open(this.href);return false;\">Game Maker 2k<\/a> @ ".$csryear." - ".$cryear."';\n";
835 if($FullRelNum<$MyFullRelNum) {
836 $VersionJS .= "document.getElementById('iverinfo').innerHTML = vercheckinfo+'<img src=\"".$site_url."inc/pics/old.png\" alt=\"You seem to be using a old version.\" title=\"You seem to be using a old version.\" />&#160;Warning: A new version is available. <a href=\"".$download_url."\">Click Here<\/a><br />'+ourverinfo+checkingsite+'<br />';"; }
837 if($FullRelNum==$MyFullRelNum) {
838 $VersionJS .= "document.getElementById('iverinfo').innerHTML = vercheckinfo+'<img src=\"".$site_url."inc/pics/new.png\" alt=\"Congratulations you have the newest version. ^_^ \" title=\"Congratulations you have the newest version. ^_^ \" />&#160;Congratulates: You have the latest version.<br />'+ourverinfo+checkingsite+copyright+'<br />';"; }
839 if($FullRelNum>$MyFullRelNum) {
840 $VersionJS .= "document.getElementById('iverinfo').innerHTML = vercheckinfo+'<img src=\"".$site_url."inc/pics/beta.png\" alt=\"You seem to be using a nightly version.\" title=\"You seem to be using a nightly version.\" \/>&#160;Warning: You seem to be using a nightly version. <br /><a href=\"".$download_url."\">Click Here</a> for latest version.<br \/>'+ourverinfo+checkingsite+copyright+'<br />';"; }
841 $VersionJS .= "\n} ";
842 echo $VersionJS; }
843 if($_GET['redirect']=="on") { 
844 if($FullRelNum<$MyFullRelNum) {
845 redirect("location","old.png",FALSE,$site_url."inc/pics/",FALSE); }
846 if($FullRelNum==$MyFullRelNum) {
847 redirect("location","new.png",FALSE,$site_url."inc/pics/",FALSE); }
848 if($FullRelNum>$MyFullRelNum) {
849 redirect("location","beta.png",FALSE,$site_url."inc/pics/",FALSE); } }
850 if($_GET['redirect']!="on"&&$_GET['redirect']!="xml"&&$_GET['redirect']!="js") {
851 if($FullRelNum<$MyFullRelNum) { echo "You seem to be using a old version.\n<br />Goto link below to download new version.\n<br />".$DownloadLink; }
852 if($FullRelNum==$MyFullRelNum) { echo "Congratulations you have the newest version. ^_^ \n<br />You dont need to do anything for now."; }
853 if($FullRelNum>$MyFullRelNum) { echo "You seem to be using a nightly version.\n<br />Rember these version are not as stable as the Current Version.\n<br />"; 
854 echo "Goto link below to download latest version.\n<br />".$DownloadLink; }
855 echo "\n<br />\n<br />";
856 echo "Your Version: ".$_GET['name']." ".$_GET['reltype']." ".$_GET['ver']." ".$_GET['subtype']." ".$_GET['subver'];
857 echo "\n<br />";
858 echo "Current Version: ".$vercheck['name']." ".$vercheck['reltype']." ".$vercheck['ver']." ".$vercheck['subtype']." ".$vercheck['subver'];
859 if($_GET['bid']!=null) {
860 echo "\n<br />Checking board: <a href=\"".$_GET['bid']."\" title=\"".$GetTitle."\">".$GetTitle."</a>"; }
861 echo "</div>"; } }
862 if($_GET['redirect']!="on"&&$_GET['redirect']!="xml"&&$_GET['redirect']!="js") {
863 ?>
864
865 <div class="copyright"><br />Powered by <a href="http://ja.gamemaker2k.org/" title="iDB-VerCheck <?php echo $site_version; ?>" onclick="window.open(this.href);return false;">iDB VerCheck</a> &copy; <a href="http://ja.gamemaker2k.org/support/category.php?act=view&amp;id=2" title="Game Maker 2k" onclick="window.open(this.href);return false;">Game Maker 2k</a> @ <?php echo $csryear." - ".$cryear; ?></div>
866 </body>
867 </html>
868 <?php } ?>