OSDN Git Service

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