add auto update system

This commit is contained in:
unknown
2012-09-07 09:29:24 +03:00
parent 800627b813
commit 8a9fb7b141
4 changed files with 68 additions and 80 deletions
+62 -75
View File
@@ -1,75 +1,62 @@
<?php <?php
if($_SESSION['access'] < ADMIN) die("Access Denied: You are not Admin!"); if($_SESSION['access'] < ADMIN) die("Access Denied: You are not Admin!");
include('ver.tpl'); include_once('ver.tpl');
if(isset($_GET['c'])) if(isset($_GET['c']))
{ {
copy("http://travian.gamingcrazy.net/Update/update_latest.tpl", "Templates/update_latest.tpl"); copy("http://travian.gamingcrazy.net/Update/update_latest.tpl", "Templates/update_latest.tpl");
} }
include('update_latest.tpl'); if(isset($_GET['u']))
if(isset($_GET['u'])) {
{ $dl=$ver+1;
for ($dl=$ver+1; $dl<=$latest; $dl++) $file = "http://travian.gamingcrazy.net/Update/$dl.zip";
{ $newfile = "update.zip";
$file = "http://travian.gamingcrazy.net/Update/$dl.zip"; if (!copy($file, $newfile))
$newfile = "update.zip"; {
if (!copy($file, $newfile)) echo "Failed Update";
{ }
echo "Update Files of Version $dl were not found."; $zip = new ZipArchive;
} if ($zip->open('update.zip') === TRUE)
else {
{ $zip->extractTo('../');
$zip = new ZipArchive; $zip->close();
if ($zip->open('update.zip') === TRUE) unlink('update.zip');
{ header("Location: admin.php?p=update&s");
$zip->extractTo('../'); } else {echo 'Update Failed';}
$zip->close(); }
unlink('update.zip'); ?>
echo "Successfully Updated to Version $dl ";; <table id="member" cellpadding="1" cellspacing="1" >
} <thead>
else <tr>
{ <th colspan="3">System Updates</th>
echo 'Failed to update to Version $dl'; </tr>
} </thead>
} <tbody>
} <tr>
} <td class="hab" colspan="2">Current Version :</td>
?> <td class="hab" colspan="1"><font color="red"><?php echo "$ver"; ?></font></td>
<table id="member" cellpadding="1" cellspacing="1" > </tr>
<thead> <tr>
<tr> <td class="hab" colspan="2">Latest Version :</td>
<th colspan="3">System Updates</th> <td class="hab" colspan="1"><font color="red"><?php include('update_latest.tpl'); echo "$latest" ?></font></td>
</tr> </tr>
</thead> <tr>
<tbody> <td class="hab" colspan="2">Check for Update</td>
<tr> <td class="hab" colspan="1"><center><a href="?p=update&c"><img src="../img/admin/b/ok1.gif"></a></center></td>
<td class="hab" colspan="2">Current Version :</td> </tr>
<td class="hab" colspan="1"><font color="red"><?php include('ver.tpl'); echo "$ver"; ?></font></td> <tr>
</tr> <td class="hab" colspan="2">Update</td>
<tr> <td class="hab" colspan="1"><?php
<td class="hab" colspan="2">Latest Version :</td> if(isset($_GET['s']))
<td class="hab" colspan="1"><font color="red"><?php echo "$latest"; ?></font></td> {echo '<font color="red">Update Success</font>';}
</tr> elseif($latest > $ver)
<tr> {echo'<center><a href="?p=update&u"><img src="../img/admin/b/update.png"></a></center>'; }
<td class="hab" colspan="2">Check for Update</td> else { echo "No updates Avaiable";}?></td>
<td class="hab" colspan="1"><center><a href="?p=update&c"><img src="../img/admin/b/ok1.gif"></a></center></td> </tr>
</tr> <tr>
<tr> <td class="hab" colspan="2">Visit Forum</td>
<td class="hab" colspan="2">Update</td> <td class="hab" colspan="1"><center><a href="http://travian.gamingcrazy.net/forum/"><img src="../img/admin/b/ok1.gif"></a></center></td>
<td class="hab" colspan="1"><?php </tr>
if($latest > $ver) </tbody>
{ </table>
echo'<center><a href="?p=update&u"><img src="../img/admin/b/update.png"></a></center>'; <br /><br />
} <p><font color="red">Guys don`t forget to register at the forum to receive information of the updates"</font></p>
else
{
echo "No updates Avaiable";
}
?></td>
</tr>
<tr>
<td class="hab" colspan="2">Visit Forum</td>
<td class="hab" colspan="1"><center><a href="http://travian.gamingcrazy.net/forum/"><img src="../img/admin/b/ok1.gif"></a></center></td>
</tr>
</tbody>
</table><br /><br />
<p><font color="red">Guys don`t forget to register at the forum to receive information of the updates"</font></p>
+1 -1
View File
@@ -1,3 +1,3 @@
<?php <?php
$latest="8"; $latest="4";
?> ?>
+1 -1
View File
@@ -1,3 +1,3 @@
<?php <?php
$ver="4"; $ver="1";
?> ?>
+4 -3
View File
@@ -93,6 +93,7 @@ $timeformat = new timeFormatGenerator;
<a href="<?php echo HOMEPAGE; ?>">Server Homepage</a> <a href="<?php echo HOMEPAGE; ?>">Server Homepage</a>
<a href="admin.php">Control Panel Home</a> <a href="admin.php">Control Panel Home</a>
<a href="<?php echo SERVER; ?>dorf1.php">Return to the server</a> <a href="<?php echo SERVER; ?>dorf1.php">Return to the server</a>
<a href="?p=update"><font color="Red"><b>Server Update</font></b></a>
<br /> <br />
<a href="?action=logout">Logout</a> <a href="?action=logout">Logout</a>
<br /> <br />
@@ -102,8 +103,8 @@ $timeformat = new timeFormatGenerator;
<a href="?p=notregistered">Players Not Activated</a> <a href="?p=notregistered">Players Not Activated</a>
<br /> <br />
<a href="#"><b>Search</b></a> <a href="#"><b>Search</b></a>
<a href="?p=search">Search Players/Alliances/Villages/E-mails/IPs/Deleted Players</a> <a href="?p=search">General Search</a>
<a href="?p=message">Search Messages/Battle Reports</a> <a href="?p=message">Search IGMs/Reports</a>
<br /> <br />
<a href="#"><b>Ban</b></a> <a href="#"><b>Ban</b></a>
<a href="?p=ban">Ban/Unban Players</a> <a href="?p=ban">Ban/Unban Players</a>
@@ -129,7 +130,7 @@ $timeformat = new timeFormatGenerator;
<br /> <br />
<a href="#"><b>Natars</b></a> <a href="#"><b>Natars</b></a>
<a href="?p=natarend">Add WW Villages</a> <a href="?p=natarend">Add WW Villages</a>
<a href="?p=natarbuildingplan">Add WW Buildingplan Villages</a> <a href="?p=natarbuildingplan">Add WW Building Plan Villages</a>
<br /> <br />
<a href="#"><b>Admin:</b></a> <a href="#"><b>Admin:</b></a>
<a href="?p=admin_log"><font color="Red"><b>Admin Log</font></b></a> <a href="?p=admin_log"><font color="Red"><b>Admin Log</font></b></a>