File size: 2.6Kb
<?php
/**
* Wap Portal Server
*
* Copyright (C) 2002 - 2004 Emir Sakic
*
* Wap Portal Server
* Developer: Emir Sakic - [email protected]
* Homepage: http://www.sakic.net
* Date: 15/03/2004
* Version #: 1.2
**/
// Defined variables
$logopath = "../images/logo"; //path to where images are uploaded. No trailing slash
$cert1 = "image/vnd.wap.wbmp"; //Wbmp type
$cert2 = "application/octet-stream"; //Wbmp type (not valid actually)
$log = "";
// Update logo
if (isset($update)) {
//checks if file chosen
if ($img1_name == "") {
$log .= "Please select a file to upload.<br>";
} else {
//checks if file is an image
if (($img1_type == $cert1) or ($img1_type == $cert2)) {
move_uploaded_file($img1, "$logopath/logo.wbmp") or $log .= "Could not upload the logo.<br>";
chmod("$logopath/logo.wbmp", 0644);
if (file_exists("$logopath/logo.wbmp")) {
$log .= "Logo successfully updated.<br>";
}
} else {
$log .= "This file is not a valid WBMP logo.<br>This file type: $img1_type<br>";
}
}
$update = 0;
}
// Delete logo
if (isset($delete)) {
$log .= "Logo successfully deleted.<br>";
@unlink ("$logopath/logo.wbmp") or $log = "Could not delete the logo.<br>";
$delete = 0;
}
?>
<script language="JavaScript">
<!--
function validate(){
if (confirm("Are you sure you want to delete the logo?")){
document.form1.action = '';
document.form1.submit();
}
}
//-->
</script>
<table width="600">
<tr>
<td colspan="2"><a href='index.php' border=0>Home</a> > Site Details
Management</td>
</tr>
<tr>
<td align="center" width="75%"><b>Upload Wap Site Logo</b></td>
<td align="center" width="25%"><b>Resources</b></td>
</tr>
<tr>
<td>
<form name="form" method="post" action="index.php?option=logo" enctype="multipart/form-data">
<p><?echo $log;?>
<b>Logo:</b><br>
<input type="file" name="img1">
</p>
<p>
<input type="hidden" name="update" value="1">
<input type="submit" name="Submit" value="Submit">
</p>
</form>
<form name="form1" method="post" action="index.php?option=logo">
<p>
<input type="hidden" name="delete" value="1">
<input type="button" name="Delete" value="Delete" onClick='validate()'>
</p>
</form>
</td>
<td valign="top"> <b>Note:</b> Logo must be in WBMP format.<br>
<br>
<?php
$common->setup_default_emulator();
$common->display_emulator();
?>
</td>
</tr>
</table>