File size: 4.15Kb
<?php
include("config.php");
include("core.php");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
//header('Content-type: application/vnd.wap.xhtml+xml');
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
$bcon = connectdb();
if (!$bcon)
{
echo "<head>";
echo "<title>Error!!!</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
echo "<img src=\"../images/notok.gif\" alt=\"!\"/><br/>";
echo "<b><strong>Error! Cannot Connect To Database...</strong></b><br/><br/>";
echo "This error happens usually when backing up the database, please be patient...";
echo "</p>";
echo "</body>";
echo "</html>";
exit();
}
$brws = explode("/",$HTTP_USER_AGENT);
$ubr = $brws[0];
$uip = getip();
$action = $_GET["action"];
$sid = $_GET["sid"];
$page = $_GET["page"];
$who = $_GET["who"];
$sitename = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sitename'"));
$sitename = $sitename[0];
$uid = getuid_sid($sid);
$theme = mysql_fetch_array(mysql_query("SELECT theme FROM ibwf_users WHERE id='".$uid."'"));
cleardata();
if(($action != "") && ($action!="terms"))
{
$uid = getuid_sid($sid);
if((islogged($sid)==false)||($uid==0))
{
echo "<head>";
echo "<title>Error</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
echo "</head>";
echo "<body>";
echo "<p align=\"center\">";
echo "You are not logged in<br/>";
echo "Or Your session has been expired<br/><br/>";
echo "<a href=\"index.php\">Login</a>";
echo "</p>";
echo "</body>";
echo "</html>";
exit();
}
}
echo "<head>";
echo "<title>Uploading smilies</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "Code<br/>";
echo "<form action=\"main.php?action=stpc&sid=$sid\" method=\"post\">";
echo "<input name=\"smtext\" maxlength=\"30\"/><br/>";
$upload_directory = '../smilies';
$reserved = array('.', '..');
$errors = array();
//
// Upload
//
if (isset($_POST['upload']))
{
$upload_directory .= (!ereg('/$', $upload_directory)) ? '/' : '';
$filename = $_FILES['upload_file']['name'];
$target_file = $upload_directory . $filename;
if (!isset($_POST['upload_overwrite']))
{
if (!in_array($filename, $reserved))
{
if (!file_exists($target_file))
{
if (!move_uploaded_file($_FILES['upload_file']['tmp_name'], $target_file))
{
$errors[] = sprintf('Please try uploading %s again.', $filename);
}
}
else
{
$errors[] = sprintf('%s already exists!', $filename);
}
}
else
{
$errors[] = 'That filename is reserved.';
}
}
else
{
if (!in_array($filename, $reserved))
{
if (!move_uploaded_file($_FILES['upload_file']['tmp_name'], $target_file))
{
$errors[] = 'Please try again.';
}
}
else
{
$errors[] = 'That filename is reserved.';
}
}
if (empty($errors))
{
echo 'File Uploaded Successfully!<br />';
mysql_query("INSERT INTO ibwf_smilies SET scode='$(smtext)', imgsrc='../smilies/$fileName', hidden='0'");
}
else
{
foreach ($errors as $error)
{
echo "<b>$error</b><br />\n";
}
}
}
?>
<br /><form enctype="multipart/form-data" method="post">
<input type="file" name="upload_file" size="20">
<input type="submit" name="upload" value="Upload">
<br /><span style="font-size:12px">Overwrite? <input type="checkbox" name="upload_overwrite"></span>
</form>
<?
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
echo "</p>";
echo "</body>";
?>
</html>