PHP upload Script problem

  • (6 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »

79 Replies - 8403 Views - Last Post: 28 January 2014 - 02:00 PM Rate Topic: -----

#1 chris98   User is offline

  • D.I.C Lover

Reputation: 42
  • View blog
  • Posts: 1,129
  • Joined: 06-July 13

PHP upload Script problem

Posted 04 January 2014 - 07:47 AM

I have attempted to upload a file over 2 MB using this upload script and even though my MAX_FILE_SIZE is 128 MB, it just reloads the page. I have spoken to my hosting providers about it, they checked it and they said:

Quote

Hello Chris,

This would seem to be an issue with your upload script, as we attempted to upload a test file and the upload page simply reloaded without putting the file to the server, or at the very least it is not listing the uploaded file under 'My Files'. We did try to upload via cpanel -> File Manager (also a php type upload) and the upload was completed successfully. Thus, we recommend you check your upload script.

I will be pleased to answer any additional questions you may have.

Thank You,
Alex F.
Help Desk Staff

www.hosting24.com


So the question is now, what's wrong with my upload script that is making it not upload files over 2/3 MB?

<?php
require_once('/home/*directories*/include.php');
define('PUN_ROOT', dirname(__FILE__).'/../../forums/');
include PUN_ROOT.'include/common.php';
date_default_timezone_set('GMT'); 
date_default_timezone_set("Europe/London");
?>
<?php
$active = "SELECT active FROM `sites` WHERE `site` = 'http://downloads.*************.co.uk'";
$ps = $shn_conf->query($active);
while ($row = $ps->fetch(PDO::FETCH_ASSOC)) {
if (($row['active'] == 'not_active') && (!$pun_user['is_admmod']))
{
header('Location: http://maintenance.*************.co.uk/');
}
$site = isset($_GET['site']) ? $_GET['site'] : null;
}	

		 if (isset($_POST['submitBtn'])) {

		 if ($pun_user['is_guest'])
		 header("location: http://downloads.*************.co.uk/login.php");

		 $user_id = $pun_user['id'];
		 $username = $pun_user['username'];
		 $email    = $pun_user['email'];
		 $minimap_uploadLocation = "/home/*directories*";
		 $uploadLocation = "/home/*directories*";
		 $minimap  =   "".  basename( $_FILES['upfile']['name'])."";
          	 $file  =   "".  basename( $_FILES['ufile']['name']).""; 
		 $date  =  date("d/m/Y");
		 //Start | Get all other variables in order of fields
		 $category     = (isset($_POST['category'])) ? htmlentities($_POST['category']) : '' ;
		 $name     = (isset($_POST['name'])) ? htmlentities($_POST['name']) : '' ;
		 $estates     = (isset($_POST['estates'])) ? htmlentities($_POST['estates']) : '' ;
		 $message  = (isset($_POST['textarea'])) ? ($_POST['textarea']) : '' ;
		 $difficulty     = (isset($_POST['difficulty'])) ? htmlentities($_POST['difficulty']) : '' ;
		 $balance     = (isset($_POST['balanced'])) ? htmlentities($_POST['balanced']) : '' ;
		 $size     = "" . ($_FILES["ufile"]["size"] / 1024) . " KB";
		 $missions     = (isset($_POST['missions'])) ? htmlentities($_POST['missions']) : '' ;
		 $support     = (isset($_POST['support'])) ? htmlentities($_POST['support']) : '' ;
		 $tags     = (isset($_POST['tags'])) ? htmlentities($_POST['tags']) : '' ;
		 $game_for     = (isset($_POST['site'])) ? htmlentities($_POST['site']) : '' ;
		 //End | Get all other variables in order of fields
		 //End:: Get all relevant variables
		 //Start:: Stop empty required fields
		 if (empty($category)) {
		 exit ('You must select a category.');
		 }
		 if (empty($name)) {
		 exit ('You must enter a filename.');
		 }
		 if (empty($estates)) {
		 exit ('You must select the amount of Estates on your map.If you are uploading a Miscellaneous file, select the bottom option.');
		 }
		 if (empty($message)) {
		 exit ('You must enter a file description bigger than 5 charcters.');
		 }
		 if (empty($difficulty)) {
		 exit ('You must select the difficulty of your file.If you are uploading a Miscellaneous file, choose the difficulty of installing it instead.');
		 }
		 if (empty($balance)) {
		 exit ('You must select the balance of your map.If you are uploading a Miscellaneous file, select the bottom option.');
		 }
		 if (empty($missions)) {
		 exit ('You must select the number of missions of your map.If you are uploading a Miscellaneous file, select the bottom option.');
		 }
		 if (empty($file)) {
		 exit ('You must upload a Zip file.');
		 }
		 if (empty($email)) {
		 exit ('Error fetching your user email.Please re-submit your file.');
		 }
		 if (empty($username)) {
		 exit ('Error fetching username.Please re-submit your file.');
		 }
		 if (empty($user_id)) {
		 exit ('Error fetching your user id.Please re-submit your file.');
		 }
		 if (empty($date)) {
		 exit ('Error fetching current date & time.Please re-submit your file.');
		 }
		 if (empty($size)) {
		 exit ('Error fetching your file size.Please re-submit your file.');
		 }
		 $hide_smilies = '0';
		 //End:: Stop empty required fields
		 
if (($_FILES["upfile"]["size"] > 102400)) // Max File Size: 100KB
  {
  exit ('Your preview image is too big.Please try again.');
  }
$allowed[] = 'gif';
$allowed[] = 'bmp';
$allowed[] = 'jpg';
$allowed[] = 'jpeg';
$allowed[] = 'png';
$allowed[] = '';  
  $filename = basename( $_FILES['upfile']['name']);
  $ext = substr($filename, strrpos($filename, '.')+1 , 3);
  $ext = strtolower($ext);

  if (!in_array($ext, $allowed)) {
        exit('This type of file extension is not allowed.Please upload a valid preview image.');
  }
//End | Allowed Previews
//Start | Allow No Preview & Preview Exist?
if (!empty($minimap)) {
$filename_check2 = "files/minimaps/".$minimap."";
if (file_exists($filename_check2)) {
    exit ('The preview image you are uploading already exists.Please specify a different name, then try again.');
};  
}
//End | Allow No Preview & Preview Exist?  
//End:: Minimap Verification 

//Start:: Zip file Verification
//Start | File Size
if (($_FILES["ufile"]["size"] > 125829120)) // Max File Size: 120MB
  {
  exit ('Your file size is too big.Please try again.');
  }
//End | File Size
//Start | File allowed?
$allowed1[] = 'zip';
  $filename_2 = basename( $_FILES['ufile']['name']);
  $ext1 = substr($filename_2, strrpos($filename_2, '.')+1 , 3);
  $ext1 = strtolower($ext1);

  if (!in_array($ext1, $allowed1)) {
        exit('This type of file extension is not allowed.Please upload a zip file.');
  }
//End | File allowed?
//Start | File Already Exists?
$filename_check = "files/downloads/".$file."";
if (file_exists($filename_check)) {
    exit ('The zip file you are uploading already exists.Please specify a different name, and try again.');
};
//End | File Already Exists?
//End:: Zip file Verification

//Start:: Right, if everything is fine, upload it all
//Start | Upload Minimap
$target_path = $minimap_uploadLocation . basename( $_FILES['upfile']['name']);
if(move_uploaded_file($_FILES['upfile']['tmp_name'], $target_path)) {
};
//End | Upload Minimap
//Start | Upload Zip File
$target_path1 = $uploadLocation . basename( $_FILES['ufile']['name']);
if(!move_uploaded_file($_FILES['ufile']['tmp_name'], $target_path1)) {
    exit ('There was an unspecified error uploading the zip file.Please try again.');
}
//End | Upload Zip File
//Start | Add info to Database
$sql = "INSERT INTO downloads_unchecked (name,username,userid,size,text,minimap,date,file,category,email,difficulty,balanced,estates,support,missions,tags,site) VALUES (
			 :name,:username,:userid,:size,:text,:minimap,:date,:file,:category,:email,:difficulty,:balance,:estates,:support,:missions,:tags,:site)";
$ps = $shn_sites->prepare($sql);
$ps->execute(array(':name'=>$name,
':username'=>$username,
':userid'=>$user_id,
':size'=>$size,
':text'=>$message,
':minimap'=>$minimap,
':date'=>$date,
':file'=>$file,
':category'=>$category,
':email'=>$email,
':difficulty'=>$difficulty,
':balance'=>$balance,
':estates'=>$estates,
':support'=>$support,
':missions'=>$missions,
':tags'=>$tags,
':site'=>$game_for));			 
//End | Add info to Database

//Start | email user

//Start:: Get the id
$select = 'SELECT id FROM downloads_unchecked WHERE name = :name AND username = :username AND category = :category AND support = :support';
$ps = $shn_sites->prepare($select);
$ps->execute(array(':name'=>$name,
':username'=>$username,
':category'=>$category,
':support'=>$support));	
while ($row = $ps->fetch(PDO::FETCH_ASSOC)) {
$file_id_latest = $row['id'];
}
//End:: Get the id
if (!$pun_user['is_admmod'])
{
$to_respond = "".$email."";
 $subject_respond = "File Submission - ************* Download Central";
 
$message_respond = '
 <html>
 <head>
 <title>Thank you for submitting a file to ************* Download Central!</title>
 </head>
 <body>
 <img src="http://downloads.*************.co.uk/images/header_downloads.png"><br />
 <p><h1>Dear '.$username.',</h1><br />
Thank you for submitting your file to ************* Download Central! We have recieved your submited file with no problems, and your details are sent below.

If you are experiencing any problems with this file, please contact us with this submission number:&nbsp;&nbsp;&nbsp;'.$file_id_latest.'.
<br />
<br />

Once your file is activated, you can visit at the URL below:<br><br>
<a href="http://downloads.*************.co.uk/viewfile.php?fileid='.$file_id_latest.'">http://downloads.*************.co.uk/viewfile.php?fileid='.$file_id_latest.'</a>
<br /><br />
Your submitted details:<br /><br />
		
<table>
 <tr>
 <th>Filename:&nbsp;</th>
<td>'.$name.'</td>
 </tr><br><br>
 <tr>
<th>Category:&nbsp;</th>
<td>'.$category.'</td>
 </tr>
 <br><br>
 <tr>
<th>No of Estates
 &nbsp;</th>
<td>'.$estates.'</td>
 </tr>
   <br><br>
 <tr>
<th>Difficulty&nbsp;</th>
<td>'.$difficulty.'</td>
 </tr>
    <br><br>
 <tr>
<th>Balance&nbsp;</th>
<td>'.$balance.'</td>
 </tr>
    <br><br>
 <tr>
<th>Missions&nbsp;</th>
<td>'.$missions.'</td>
 </tr>
     <br><br>
 <tr>
<th>Support URL&nbsp;</th>
<td>'.$support.'</td>
 </tr>
   <br><br>
 <tr>
<th>Description&nbsp;</th>
<td>'.$text.'</td>
 </tr><br><br><br>
 Checking your file can be painfully slow depending on the size, and the category type.However we must do this for security reasons.You will recieve an email once again when your file has been activated.Please email a member of our support team if your wait is longer than one week without a reply of any kind, good or bad.
<tr>
<th><h3 align="left">Kind Regards,</h3></th></tr><tr><th align="left">&raquo; <b>fellowslothb,</b></th></tr><br>
Downloads Manager<br />
</table>
<table><br />Email: <a href="MAILTO:[email protected]*************.co.uk">[email protected]*************.co.uk</a><br />
		<br />
<font size="1">This communication is confidential, and may be legally privileged. If you are not the intended recipient, (i) please do not read or disclose to others, (ii) please notify the sender via email, and (iii) please delete this communication from your system. Failure to follow this process may be unlawful. Thank you for your cooperation.</font size>
<br /><br />
(Please do not reply to this message, as it has been automatically generated)</p>
 </table> 
 </body>
 </html>
 ';
 
// Always set content-type when sending HTML email
 $headers = "MIME-Version: 1.0" . "\r\n";
 $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
 
// More headers
 $headers .= 'From: ************* <[email protected]*************.co.uk>' . "\r\n";
 
mail($to_respond,$subject_respond,$message_respond,$headers);
}
header('location: index.php?action=submit');
         
    } 
?>		  
	<script type="text/javascript">
function validateForm() {

  var category=document.forms["fileform"]["category"].value;
  if (category==null || category=="")  {
    	alert('You must select which category best fits your file!');
        return false;
  }
   var name=document.forms["fileform"]["name"].value;
  if (name==null || name=="")  {
    	alert('You must enter your filename');
        return false;
  }
  var preview_size=document.forms["fileform"]["upfile"].size;
  if (preview_size > "102400")  {
    	alert('Your preview is too big. Please upload a preview image under 100 KB.');
        return false;
  }


  var site=document.forms["fileform"]["site"].value;
  if (site==null || site=="")  {
    	alert('You are not submitting for a game, therefore cannot submit at all. Please close this window.');
        return false;
  }
  if (site=='CivCity Rome')
   {
  var estates=document.forms["fileform"]["estates"].value;
  if (estates==null || estates=="")  {
    	alert('You must select the mission type of your map.');
        return false;
  }
  }
  else
  {
  var estates=document.forms["fileform"]["estates"].value;
  if (estates==null || estates=="")  {
    	alert('You must select the number of estates on your map.');
        return false;
  }
  }
  var textarea=document.forms["fileform"]["textarea"].value;
  if (textarea==null || textarea=="")  {
    	alert('You must enter a file description.');
        return false;
  }
  var difficulty=document.forms["fileform"]["difficulty"].value;
  if (difficulty==null || difficulty=="")  {
    	alert('You must select how difficult your file is.');
        return false;
  }
  var balance=document.forms["fileform"]["balanced"].value;
  if (balance==null || balance=="")  {
    	alert('You must select the balance/type of your map.');
        return false;
  }
  var max_size=document.forms["fileform"]["MAX_FILE_SIZE"].value;
  if (max_size!=="125829120")  {
    	alert('Stop trying to tamper with the MAX_FILE_SIZE, and just accept that the limit is 120 MB!');
        return false;
  }
  var ufile=document.forms["fileform"]["ufile"].value;
  if (ufile==null || ufile=="")  {
    	alert('You must upload a file!');
        return false;
  }
  var file_size=document.forms["fileform"]["ufile"].size;
  if (file_size > "125829120")  {
    	alert('Your file is too big. Please upload a file under 120 MB.');
        return false;
  }

  var missions=document.forms["fileform"]["missions"].value;
  if (missions==null || missions=="")  {
    	alert('You must select the number of missions of your map.');
        return false;
  }







 }
</script>
<?php

if ($_GET['action'] == 'submit')
		{
		?><h1 class="upload">Submission Recieved</h1><br><br>
		Your file has been recieved with no problems.You have also been sent an email (with your file details) confirming this.You will recieve another email once your file has been checked by our staff.<br /><br />
Have a good day,<br />
&raquo; fellowslothb<br />
Downloads Manager
<?php
		}
		if (!isset($_GET['action']))
{
?>
        <h1 class="upload">Submit File for: <?php echo $site; ?></h1>          			  
		<br /><br />
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="fileform" onsubmit="return validateForm()" id="fileform" enctype="multipart/form-data">
<input type="hidden" name="site" value="<?php echo $site; ?>">
			  <b>Category:*</b><br /><font size="1">Please select which category your file fits best.</font size>
<br />
&nbsp;<select name="category">
<option value="">--Please Select Your Category--</option>
<?php
$category_select = "SELECT category FROM download_categories WHERE site = :site";
$ps_select = $shn_conf->prepare($category_select);
$ps_select->execute(array(':site'=>$site));
foreach ($ps_select as $row)
{
echo '<option value="'.$row['category'].'">'.$row['category'].'</option>';
}
?>
</select><br><br>
<b>File Name:*</b><br />
<font size="1">Your submission title - you will not be able to change this, so make it good!</font size><br />
<input name="name" type="text" size="42" maxlength="25" /><br><br>
<b>Preview Image:</b><br /><font size="1">Your preview image must be no bigger than 100KB, and either in PNG, JPEG, BMP or GIF form.It will also automatically get sized to 200x200 pixels<br /></font size><br><input class="text" name="upfile" type="file" size="36">
<br />
<br />
<?php
if ($site == 'CivCity Rome')
{
echo '<b>Mission Type:*</b><br /><font size="1">The map type; Civilian, Military or Free Build.If this is a miscellaneous file, select the last option.</font size><br />
<select name="estates"><option value="">--Please Select Your Value--</option><option value="Civilian">Civilian</option>
   <option value="Free Build">Free Build</option>
   <option value="Military">Military</option>
   <option value="N/A">N/A (Miscellaneous)</option>
 </select><br><br>';
}
else
{
echo '
<b>No of Estates:*</b><br /><font size="1">The number of estates on your map.If this is a miscellaneous file, select the last option.</font size><br />
<select name="estates"><option value="">--Please Select Your Value--</option><option value="1">1</option>
   <option value="2">2</option>
   <option value="2">2</option>
   <option value="3">3</option>
   <option value="4">4</option>
   <option value="5">5</option>
   <option value="6">6</option>
   <option value="7">7</option>
   <option value="8">8</option>
   <option value="9">9</option>
   <option value="10">10</option>
   <option value="11">11</option>
   <option value="12">12</option>
   <option value="13">13</option>
   <option value="14">14</option>
   <option value="15">15</option>
   <option value="16">16</option>
   <option value="17">17</option>
   <option value="18">18</option>
   <option value="N/A">N/A (Miscellaneous)</option>
 </select><br><br>';
}
?>
              <b>Full Description of your File:*</b><br /><font size="1">Tell us a bit more about your file. You may use all forum <a href="http://forums.*************.co.uk/help.php" target="_blank">BBCode</a> here.</font size><br /><textarea name="textarea" rows="15" width="400"></textarea><br><br>
              <b>Difficulty: *</b><br /><font size="1">Please select the difficulty of your map - or if this is a miscellaneous file, the difficulty of installing it.</font size><br /><select name="difficulty"><option value="">--Please Select Your Value--</option><option value="Very Easy">Very Easy</option>
   <option value="Easy">Easy</option>
   <option value="Normal">Normal</option>
   <option value="Hard">Hard</option>
   <option value="Very Hard">Very Hard</option>
   <option value="Insane">Insane</option>
 </select>
<br />
<br />
<?php
if ($site == 'CivCity Rome')
{
echo '<b>Map Type:*</b><br /><font size="1">The map type; small or large.If this is a miscellaneous file, select the last option.</font size><br />
<select name="balanced"><option value="">--Please Select Your Value--</option><option value="Large">Large</option>
   <option value="Small">Small</option>
   <option value="N/A">N/A (Miscellaneous)</option>
 </select><br><br>';
}
else
{
echo '				<b>Balanced?*</b><br /><font size="1">Is this map balanced or unbalanced? If this is a miscellaneous file, select the last option.</font size><br /><select name="balanced"><option value="">--Please Select Your Value--</option><option value="Balanced">Balanced</option>
   <option value="Unbalanced">Unbalanced</option>
   <option value="N/A">N/A (Miscellaneous)</option>
 </select><br><br>';
}
?>
<input type="hidden" name="MAX_FILE_SIZE" value="125829120">
			  <b>File:*</b><br /><font size="1">Your file must be archived in "zip" form, and its size under 120 MB</font size><br /><input class="text" name="ufile" type="file" id="ufile" size="36"><br><br>
			  <b>Missions:*</b><br /><font size="1">The amount of missions on your map.If this is a miscellaneous file, select the last option.</font size><br /><select name="missions"><option value="">--Please Select Your Value--</option><option value="1">1</option>
   <option value="2">2</option>
   <option value="2">2</option>
   <option value="3">3</option>
   <option value="4">4</option>
   <option value="5">5</option>
   <option value="6">6</option>
   <option value="7">7</option>
   <option value="8">8</option>
   <option value="9">9</option>
   <option value="10">10</option>
   <option value="11">11</option>
   <option value="12">12</option>
   <option value=">12">Greater than 12</option>
   <option value="N/A">N/A (Miscellaneous)</option>
 </select><br><br>
			  <b>Website URL:</b><br><input name="support" type="text" size="50" /><br />
			  <font size="1">Here you can enter the URL to a website with additional information/support for this file.I.E. A topic in our <a href="http://forums.*************.co.uk/viewforum.php?id=13" target="_blank">download forum</a>. If this page is not related at all (I.E. your personal homepage), the link will be removed.If you link to a <a href="http://www.microsoft.com/en-gb/security/online-privacy/phishing-faq.aspx" title="Exernal link to Microsoft.com" target="_blank">phishing</a> or dangerous site, your account will get terminated.</font size>
              <br><br />You may include tags to enhance your page's position in Google.These may be no longer than 100 characters.Please seperate these with a comma ",", and they <b>must</b> also be relevant to the file you are currently uploading.<br><br>I.E. tag, tag2, tag3, <br><br><input class="formbox" type="text" name="tags" maxlength="100" size="20" onblur="textCounter(this,this.form.counter,100);" onkeyup="textCounter(this,this.form.counter,100);">
<input onblur="textCounter(this.form.recipients,this,100);" disabled  onfocus="this.blur();" tabindex="999" maxlength="3" size="3" value="100" name="counter">
<script type="text/javascript">
function textCounter( field, countfield, maxlimit ) {
 if ( field.value.length > maxlimit ) {
  field.value = field.value.substring( 0, maxlimit );
  field.blur();
  field.focus();
  return false;
 } else {
  countfield.value = maxlimit - field.value.length;
 }
}

</script><br /><br />
   <input class="button" type="submit" name="submitBtn" value="Upload My File" class="text"/>
            </table>  
          </form>
          <?php
}
		 
?>		  



Could someone help?

This post has been edited by Curtis Rutland: 07 March 2016 - 10:04 AM
Reason for edit:: removed domain


Is This A Good Question/Topic? 0
  • +

Replies To: PHP upload Script problem

#2 andrewsw   User is offline

  • palpable absurdity
  • member icon

Reputation: 6905
  • View blog
  • Posts: 28,565
  • Joined: 12-December 12

Re: PHP upload Script problem

Posted 04 January 2014 - 08:03 AM

You could add the following to the top of your script so that you could see all errors during development:

error_reporting(E_ALL);
ini_set('display_errors', '1');

If it loads the page then compare the output of the page (which we can't see) to your code, which may indicate at which point it failed. Are you sure you mean that it reloads the page, and not just that it loads the page but doesn't perform the upload?

Otherwise, use lots of echo statements which will help you discover which parts of your code were completed successfully, or were even executed/entered.

Use:
print_r($_POST);

so that you can examine the full post-array. View the source of your page to read this information more easily.

Note that the font-tag is obsolete, and this </font size> is not correct.
Was This Post Helpful? 1
  • +
  • -

#3 chris98   User is offline

  • D.I.C Lover

Reputation: 42
  • View blog
  • Posts: 1,129
  • Joined: 06-July 13

Re: PHP upload Script problem

Posted 04 January 2014 - 08:04 AM

Quote

Are you sure you mean that it reloads the page, and not just that it loads the page but doesn't perform the upload?


The second one - except, I have noticed that when it does load it, it goes white, which means that the stylesheet link isn't there.
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw   User is offline

  • palpable absurdity
  • member icon

Reputation: 6905
  • View blog
  • Posts: 28,565
  • Joined: 12-December 12

Re: PHP upload Script problem

Posted 04 January 2014 - 08:10 AM

What stylesheet?

BTW It is a bit late now, but it would have been better to get a simple upload page working, and tested, first, before adding all the other content. It is a lot harder to debug now that you have 500+ lines.
Was This Post Helpful? 0
  • +
  • -

#5 chris98   User is offline

  • D.I.C Lover

Reputation: 42
  • View blog
  • Posts: 1,129
  • Joined: 06-July 13

Re: PHP upload Script problem

Posted 04 January 2014 - 08:16 AM

Sorry, I only posted the relevant bits here.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=iso-8859-1" />
<title>Submit File - Download Central :: *************</title>
<link href="http://downloads.*************.co.uk/stylesheet.css" rel="stylesheet" type="text/css" />
<link href="http://downloads.*************.co.uk/gb_styles.css" rel="stylesheet" type="text/css" />
<?php if ($month_number == '12')
{
?>
<script type="text/javascript">
nks = new Object;
nks.snowflakes = 20;
nks.timeout = 80;
nks.maxstepx = 1;
nks.maxstepy = 10;
nks.flakesize = 40;
nks.maxtime = 21600000;
nks.invert = 1;
</script>
<script src="http://www.*************.co.uk/cookies/christmas/snow.js" type="text/javascript"></script>
<?php } 
$base = "SELECT value FROM `config` WHERE `option` = 'snd_base'";
$db_ps = $shn_conf->query($base);

?> 
	<base href="<?php echo $db_ps->fetchColumn(); ?>" />
	<link rel="shortcut icon" href="<?php echo $site; ?>.ico" >
	
	

</head>
<body>

<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<div id="wrapper">

  <a href="http://downloads.*************.co.uk"><div id="header">
   <div id="topmenu">
    <ul>

    </ul>
   </div>
  </div>
  </a>
	<div id="content">

		<div id="posts">
			<div class="post">
				<p>
				</p>
				<br /><br />
<div class="upload">
 <table width="0%" cellspacing="0" cellpadding="0">
        </table>
        
        <div id="outer_box"><br />



The stylesheet in there. And here is the full document this time.

<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
require_once('/home/*directories*include.php');
define('PUN_ROOT', dirname(__FILE__).'/../../forums/');
include PUN_ROOT.'include/common.php';
date_default_timezone_set('GMT'); 
date_default_timezone_set("Europe/London");
?>
<?php
$active = "SELECT active FROM `sites` WHERE `site` = 'http://downloads.*************.co.uk'";
$ps = $shn_conf->query($active);
while ($row = $ps->fetch(PDO::FETCH_ASSOC)) {
if (($row['active'] == 'not_active') && (!$pun_user['is_admmod']))
{
header('Location: http://maintenance.*************.co.uk/');
}
$site = isset($_GET['site']) ? $_GET['site'] : null;
}	
?>
<?php		 //End:: Other Files Required?
		 
		 
		 //Start:: Guests shouldn't be here
		 if ($pun_user['is_guest'])
		 header("location: ../login.php");
		 //End:: Guests shouldn't be here		 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=iso-8859-1" />
<title>Submit File - Download Central :: *************</title>
<link href="http://downloads.*************.co.uk/stylesheet.css" rel="stylesheet" type="text/css" />
<link href="http://downloads.*************.co.uk/gb_styles.css" rel="stylesheet" type="text/css" />
<?php if ($month_number == '12')
{
?>
<script type="text/javascript">
nks = new Object;
nks.snowflakes = 20;
nks.timeout = 80;
nks.maxstepx = 1;
nks.maxstepy = 10;
nks.flakesize = 40;
nks.maxtime = 21600000;
nks.invert = 1;
</script>
<script src="http://www.*************.co.uk/cookies/christmas/snow.js" type="text/javascript"></script>
<?php } 
$base = "SELECT value FROM `config` WHERE `option` = 'snd_base'";
$db_ps = $shn_conf->query($base);

?> 
	<base href="<?php echo $db_ps->fetchColumn(); ?>" />
	<link rel="shortcut icon" href="<?php echo $site; ?>.ico" >
	
	

</head>
<body>

<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<div id="wrapper">

  <a href="http://downloads.*************.co.uk"><div id="header">
   <div id="topmenu">
    <ul>

    </ul>
   </div>
  </div>
  </a>
	<div id="content">

		<div id="posts">
			<div class="post">
				<p>
				</p>
				<br /><br />
<div class="upload">
 <table width="0%" cellspacing="0" cellpadding="0">
        </table>
        
        <div id="outer_box"><br />
		<?php 
		 if (isset($_POST['submitBtn'])) {

		 if ($pun_user['is_guest'])
		 header("location: http://downloads.*************.co.uk/login.php");

		 $user_id = $pun_user['id'];
		 $username = $pun_user['username'];
		 $email    = $pun_user['email'];
		 $minimap_uploadLocation = "/home/*directories*/";
		 $uploadLocation = "/home/*directories*/";
		 $minimap  =   "".  basename( $_FILES['upfile']['name'])."";
          	 $file  =   "".  basename( $_FILES['ufile']['name']).""; 
		 $date  =  date("d/m/Y");
		 //Start | Get all other variables in order of fields
		 $category     = (isset($_POST['category'])) ? htmlentities($_POST['category']) : '' ;
		 $name     = (isset($_POST['name'])) ? htmlentities($_POST['name']) : '' ;
		 $estates     = (isset($_POST['estates'])) ? htmlentities($_POST['estates']) : '' ;
		 $message  = (isset($_POST['textarea'])) ? ($_POST['textarea']) : '' ;
		 $difficulty     = (isset($_POST['difficulty'])) ? htmlentities($_POST['difficulty']) : '' ;
		 $balance     = (isset($_POST['balanced'])) ? htmlentities($_POST['balanced']) : '' ;
		 $size     = "" . ($_FILES["ufile"]["size"] / 1024) . " KB";
		 $missions     = (isset($_POST['missions'])) ? htmlentities($_POST['missions']) : '' ;
		 $support     = (isset($_POST['support'])) ? htmlentities($_POST['support']) : '' ;
		 $tags     = (isset($_POST['tags'])) ? htmlentities($_POST['tags']) : '' ;
		 $game_for     = (isset($_POST['site'])) ? htmlentities($_POST['site']) : '' ;
		 //End | Get all other variables in order of fields
		 //End:: Get all relevant variables
		 //Start:: Stop empty required fields
		 if (empty($category)) {
		 exit ('You must select a category.');
		 }
		 if (empty($name)) {
		 exit ('You must enter a filename.');
		 }
		 if (empty($estates)) {
		 exit ('You must select the amount of Estates on your map.If you are uploading a Miscellaneous file, select the bottom option.');
		 }
		 if (empty($message)) {
		 exit ('You must enter a file description bigger than 5 charcters.');
		 }
		 if (empty($difficulty)) {
		 exit ('You must select the difficulty of your file.If you are uploading a Miscellaneous file, choose the difficulty of installing it instead.');
		 }
		 if (empty($balance)) {
		 exit ('You must select the balance of your map.If you are uploading a Miscellaneous file, select the bottom option.');
		 }
		 if (empty($missions)) {
		 exit ('You must select the number of missions of your map.If you are uploading a Miscellaneous file, select the bottom option.');
		 }
		 if (empty($file)) {
		 exit ('You must upload a Zip file.');
		 }
		 if (empty($email)) {
		 exit ('Error fetching your user email.Please re-submit your file.');
		 }
		 if (empty($username)) {
		 exit ('Error fetching username.Please re-submit your file.');
		 }
		 if (empty($user_id)) {
		 exit ('Error fetching your user id.Please re-submit your file.');
		 }
		 if (empty($date)) {
		 exit ('Error fetching current date & time.Please re-submit your file.');
		 }
		 if (empty($size)) {
		 exit ('Error fetching your file size.Please re-submit your file.');
		 }
		 $hide_smilies = '0';
		 //End:: Stop empty required fields
		 
if (($_FILES["upfile"]["size"] > 102400)) // Max File Size: 100KB
  {
  exit ('Your preview image is too big.Please try again.');
  }
$allowed[] = 'gif';
$allowed[] = 'bmp';
$allowed[] = 'jpg';
$allowed[] = 'jpeg';
$allowed[] = 'png';
$allowed[] = '';  
  $filename = basename( $_FILES['upfile']['name']);
  $ext = substr($filename, strrpos($filename, '.')+1 , 3);
  $ext = strtolower($ext);

  if (!in_array($ext, $allowed)) {
        exit('This type of file extension is not allowed.Please upload a valid preview image.');
  }
//End | Allowed Previews
//Start | Allow No Preview & Preview Exist?
if (!empty($minimap)) {
$filename_check2 = "files/minimaps/".$minimap."";
if (file_exists($filename_check2)) {
    exit ('The preview image you are uploading already exists.Please specify a different name, then try again.');
};  
}
//End | Allow No Preview & Preview Exist?  
//End:: Minimap Verification 

//Start:: Zip file Verification
//Start | File Size
if (($_FILES["ufile"]["size"] > 125829120)) // Max File Size: 120MB
  {
  exit ('Your file size is too big.Please try again.');
  }
//End | File Size
//Start | File allowed?
$allowed1[] = 'zip';
  $filename_2 = basename( $_FILES['ufile']['name']);
  $ext1 = substr($filename_2, strrpos($filename_2, '.')+1 , 3);
  $ext1 = strtolower($ext1);

  if (!in_array($ext1, $allowed1)) {
        exit('This type of file extension is not allowed.Please upload a zip file.');
  }
//End | File allowed?
//Start | File Already Exists?
$filename_check = "files/downloads/".$file."";
if (file_exists($filename_check)) {
    exit ('The zip file you are uploading already exists.Please specify a different name, and try again.');
};
//End | File Already Exists?
//End:: Zip file Verification

//Start:: Right, if everything is fine, upload it all
//Start | Upload Minimap
$target_path = $minimap_uploadLocation . basename( $_FILES['upfile']['name']);
if(move_uploaded_file($_FILES['upfile']['tmp_name'], $target_path)) {
};
//End | Upload Minimap
//Start | Upload Zip File
$target_path1 = $uploadLocation . basename( $_FILES['ufile']['name']);
if(!move_uploaded_file($_FILES['ufile']['tmp_name'], $target_path1)) {
    exit ('There was an unspecified error uploading the zip file.Please try again.');
}
//End | Upload Zip File
//Start | Add info to Database
$sql = "INSERT INTO downloads_unchecked (name,username,userid,size,text,minimap,date,file,category,email,difficulty,balanced,estates,support,missions,tags,site) VALUES (
			 :name,:username,:userid,:size,:text,:minimap,:date,:file,:category,:email,:difficulty,:balance,:estates,:support,:missions,:tags,:site)";
$ps = $shn_sites->prepare($sql);
$ps->execute(array(':name'=>$name,
':username'=>$username,
':userid'=>$user_id,
':size'=>$size,
':text'=>$message,
':minimap'=>$minimap,
':date'=>$date,
':file'=>$file,
':category'=>$category,
':email'=>$email,
':difficulty'=>$difficulty,
':balance'=>$balance,
':estates'=>$estates,
':support'=>$support,
':missions'=>$missions,
':tags'=>$tags,
':site'=>$game_for));			 
//End | Add info to Database

//Start | email user

//Start:: Get the id
$select = 'SELECT id FROM downloads_unchecked WHERE name = :name AND username = :username AND category = :category AND support = :support';
$ps = $shn_sites->prepare($select);
$ps->execute(array(':name'=>$name,
':username'=>$username,
':category'=>$category,
':support'=>$support));	
while ($row = $ps->fetch(PDO::FETCH_ASSOC)) {
$file_id_latest = $row['id'];
}
//End:: Get the id
if (!$pun_user['is_admmod'])
{
$to_respond = "".$email."";
 $subject_respond = "File Submission - ************* Download Central";
 
$message_respond = '
 <html>
 <head>
 <title>Thank you for submitting a file to ************* Download Central!</title>
 </head>
 <body>
 <img src="http://downloads.*************.co.uk/images/header_downloads.png"><br />
 <p><h1>Dear '.$username.',</h1><br />
Thank you for submitting your file to ************* Download Central! We have recieved your submited file with no problems, and your details are sent below.

If you are experiencing any problems with this file, please contact us with this submission number:&nbsp;&nbsp;&nbsp;'.$file_id_latest.'.
<br />
<br />

Once your file is activated, you can visit at the URL below:<br><br>
<a href="http://downloads.*************.co.uk/viewfile.php?fileid='.$file_id_latest.'">http://downloads.*************.co.uk/viewfile.php?fileid='.$file_id_latest.'</a>
<br /><br />
Your submitted details:<br /><br />
		
<table>
 <tr>
 <th>Filename:&nbsp;</th>
<td>'.$name.'</td>
 </tr><br><br>
 <tr>
<th>Category:&nbsp;</th>
<td>'.$category.'</td>
 </tr>
 <br><br>
 <tr>
<th>No of Estates
 &nbsp;</th>
<td>'.$estates.'</td>
 </tr>
   <br><br>
 <tr>
<th>Difficulty&nbsp;</th>
<td>'.$difficulty.'</td>
 </tr>
    <br><br>
 <tr>
<th>Balance&nbsp;</th>
<td>'.$balance.'</td>
 </tr>
    <br><br>
 <tr>
<th>Missions&nbsp;</th>
<td>'.$missions.'</td>
 </tr>
     <br><br>
 <tr>
<th>Support URL&nbsp;</th>
<td>'.$support.'</td>
 </tr>
   <br><br>
 <tr>
<th>Description&nbsp;</th>
<td>'.$text.'</td>
 </tr><br><br><br>
 Checking your file can be painfully slow depending on the size, and the category type.However we must do this for security reasons.You will recieve an email once again when your file has been activated.Please email a member of our support team if your wait is longer than one week without a reply of any kind, good or bad.
<tr>
<th><h3 align="left">Kind Regards,</h3></th></tr><tr><th align="left">&raquo; <b>fellowslothb,</b></th></tr><br>
Downloads Manager<br />
</table>
<table><br />Email: <a href="MAILTO:[email protected]*************.co.uk">[email protected]*************.co.uk</a><br />
		<br />
<font size="1">This communication is confidential, and may be legally privileged. If you are not the intended recipient, (i) please do not read or disclose to others, (ii) please notify the sender via email, and (iii) please delete this communication from your system. Failure to follow this process may be unlawful. Thank you for your cooperation.</font size>
<br /><br />
(Please do not reply to this message, as it has been automatically generated)</p>
 </table> 
 </body>
 </html>
 ';
 
// Always set content-type when sending HTML email
 $headers = "MIME-Version: 1.0" . "\r\n";
 $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
 
// More headers
 $headers .= 'From: ************* <[email protected]*************.co.uk>' . "\r\n";
 
mail($to_respond,$subject_respond,$message_respond,$headers);
}
header('location: index.php?action=submit');
         
    } 
?>		  
	<script type="text/javascript">
function validateForm() {

  var category=document.forms["fileform"]["category"].value;
  if (category==null || category=="")  {
    	alert('You must select which category best fits your file!');
        return false;
  }
   var name=document.forms["fileform"]["name"].value;
  if (name==null || name=="")  {
    	alert('You must enter your filename');
        return false;
  }
  var preview_size=document.forms["fileform"]["upfile"].size;
  if (preview_size > "102400")  {
    	alert('Your preview is too big. Please upload a preview image under 100 KB.');
        return false;
  }


  var site=document.forms["fileform"]["site"].value;
  if (site==null || site=="")  {
    	alert('You are not submitting for a game, therefore cannot submit at all. Please close this window.');
        return false;
  }
  if (site=='CivCity Rome')
   {
  var estates=document.forms["fileform"]["estates"].value;
  if (estates==null || estates=="")  {
    	alert('You must select the mission type of your map.');
        return false;
  }
  }
  else
  {
  var estates=document.forms["fileform"]["estates"].value;
  if (estates==null || estates=="")  {
    	alert('You must select the number of estates on your map.');
        return false;
  }
  }
  var textarea=document.forms["fileform"]["textarea"].value;
  if (textarea==null || textarea=="")  {
    	alert('You must enter a file description.');
        return false;
  }
  var difficulty=document.forms["fileform"]["difficulty"].value;
  if (difficulty==null || difficulty=="")  {
    	alert('You must select how difficult your file is.');
        return false;
  }
  var balance=document.forms["fileform"]["balanced"].value;
  if (balance==null || balance=="")  {
    	alert('You must select the balance/type of your map.');
        return false;
  }
  var max_size=document.forms["fileform"]["MAX_FILE_SIZE"].value;
  if (max_size!=="125829120")  {
    	alert('Stop trying to tamper with the MAX_FILE_SIZE, and just accept that the limit is 120 MB!');
        return false;
  }
  var ufile=document.forms["fileform"]["ufile"].value;
  if (ufile==null || ufile=="")  {
    	alert('You must upload a file!');
        return false;
  }
  var file_size=document.forms["fileform"]["ufile"].size;
  if (file_size > "125829120")  {
    	alert('Your file is too big. Please upload a file under 120 MB.');
        return false;
  }

  var missions=document.forms["fileform"]["missions"].value;
  if (missions==null || missions=="")  {
    	alert('You must select the number of missions of your map.');
        return false;
  }







 }
</script>
<?php

if ($_GET['action'] == 'submit')
		{
		?><h1 class="upload">Submission Recieved</h1><br><br>
		Your file has been recieved with no problems.You have also been sent an email (with your file details) confirming this.You will recieve another email once your file has been checked by our staff.<br /><br />
Have a good day,<br />
&raquo; fellowslothb<br />
Downloads Manager
<?php
		}
		if (!isset($_GET['action']))
{
?>
        <h1 class="upload">Submit File for: <?php echo $site; ?></h1>          			  
		<br /><br />
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="fileform" onsubmit="return validateForm()" id="fileform" enctype="multipart/form-data">
<input type="hidden" name="site" value="<?php echo $site; ?>">
			  <b>Category:*</b><br /><font size="1">Please select which category your file fits best.</font size>
<br />
&nbsp;<select name="category">
<option value="">--Please Select Your Category--</option>
<?php
$category_select = "SELECT category FROM download_categories WHERE site = :site";
$ps_select = $shn_conf->prepare($category_select);
$ps_select->execute(array(':site'=>$site));
foreach ($ps_select as $row)
{
echo '<option value="'.$row['category'].'">'.$row['category'].'</option>';
}
?>
</select><br><br>
<b>File Name:*</b><br />
<font size="1">Your submission title - you will not be able to change this, so make it good!</font size><br />
<input name="name" type="text" size="42" maxlength="25" /><br><br>
<b>Preview Image:</b><br /><font size="1">Your preview image must be no bigger than 100KB, and either in PNG, JPEG, BMP or GIF form.It will also automatically get sized to 200x200 pixels<br /></font size><br><input class="text" name="upfile" type="file" size="36">
<br />
<br />
<?php
if ($site == 'CivCity Rome')
{
echo '<b>Mission Type:*</b><br /><font size="1">The map type; Civilian, Military or Free Build.If this is a miscellaneous file, select the last option.</font size><br />
<select name="estates"><option value="">--Please Select Your Value--</option><option value="Civilian">Civilian</option>
   <option value="Free Build">Free Build</option>
   <option value="Military">Military</option>
   <option value="N/A">N/A (Miscellaneous)</option>
 </select><br><br>';
}
else
{
echo '
<b>No of Estates:*</b><br /><font size="1">The number of estates on your map.If this is a miscellaneous file, select the last option.</font size><br />
<select name="estates"><option value="">--Please Select Your Value--</option><option value="1">1</option>
   <option value="2">2</option>
   <option value="2">2</option>
   <option value="3">3</option>
   <option value="4">4</option>
   <option value="5">5</option>
   <option value="6">6</option>
   <option value="7">7</option>
   <option value="8">8</option>
   <option value="9">9</option>
   <option value="10">10</option>
   <option value="11">11</option>
   <option value="12">12</option>
   <option value="13">13</option>
   <option value="14">14</option>
   <option value="15">15</option>
   <option value="16">16</option>
   <option value="17">17</option>
   <option value="18">18</option>
   <option value="N/A">N/A (Miscellaneous)</option>
 </select><br><br>';
}
?>
              <b>Full Description of your File:*</b><br /><font size="1">Tell us a bit more about your file. You may use all forum <a href="http://forums.*************.co.uk/help.php" target="_blank">BBCode</a> here.</font size><br /><textarea name="textarea" rows="15" width="400"></textarea><br><br>
              <b>Difficulty: *</b><br /><font size="1">Please select the difficulty of your map - or if this is a miscellaneous file, the difficulty of installing it.</font size><br /><select name="difficulty"><option value="">--Please Select Your Value--</option><option value="Very Easy">Very Easy</option>
   <option value="Easy">Easy</option>
   <option value="Normal">Normal</option>
   <option value="Hard">Hard</option>
   <option value="Very Hard">Very Hard</option>
   <option value="Insane">Insane</option>
 </select>
<br />
<br />
<?php
if ($site == 'CivCity Rome')
{
echo '<b>Map Type:*</b><br /><font size="1">The map type; small or large.If this is a miscellaneous file, select the last option.</font size><br />
<select name="balanced"><option value="">--Please Select Your Value--</option><option value="Large">Large</option>
   <option value="Small">Small</option>
   <option value="N/A">N/A (Miscellaneous)</option>
 </select><br><br>';
}
else
{
echo '				<b>Balanced?*</b><br /><font size="1">Is this map balanced or unbalanced? If this is a miscellaneous file, select the last option.</font size><br /><select name="balanced"><option value="">--Please Select Your Value--</option><option value="Balanced">Balanced</option>
   <option value="Unbalanced">Unbalanced</option>
   <option value="N/A">N/A (Miscellaneous)</option>
 </select><br><br>';
}
?>
<input type="hidden" name="MAX_FILE_SIZE" value="125829120">
			  <b>File:*</b><br /><font size="1">Your file must be archived in "zip" form, and its size under 120 MB</font size><br /><input class="text" name="ufile" type="file" id="ufile" size="36"><br><br>
			  <b>Missions:*</b><br /><font size="1">The amount of missions on your map.If this is a miscellaneous file, select the last option.</font size><br /><select name="missions"><option value="">--Please Select Your Value--</option><option value="1">1</option>
   <option value="2">2</option>
   <option value="2">2</option>
   <option value="3">3</option>
   <option value="4">4</option>
   <option value="5">5</option>
   <option value="6">6</option>
   <option value="7">7</option>
   <option value="8">8</option>
   <option value="9">9</option>
   <option value="10">10</option>
   <option value="11">11</option>
   <option value="12">12</option>
   <option value=">12">Greater than 12</option>
   <option value="N/A">N/A (Miscellaneous)</option>
 </select><br><br>
			  <b>Website URL:</b><br><input name="support" type="text" size="50" /><br />
			  <font size="1">Here you can enter the URL to a website with additional information/support for this file.I.E. A topic in our <a href="http://forums.*************.co.uk/viewforum.php?id=13" target="_blank">download forum</a>. If this page is not related at all (I.E. your personal homepage), the link will be removed.If you link to a <a href="http://www.microsoft.com/en-gb/security/online-privacy/phishing-faq.aspx" title="Exernal link to Microsoft.com" target="_blank">phishing</a> or dangerous site, your account will get terminated.</font size>
              <br><br />You may include tags to enhance your page's position in Google.These may be no longer than 100 characters.Please seperate these with a comma ",", and they <b>must</b> also be relevant to the file you are currently uploading.<br><br>I.E. tag, tag2, tag3, <br><br><input class="formbox" type="text" name="tags" maxlength="100" size="20" onblur="textCounter(this,this.form.counter,100);" onkeyup="textCounter(this,this.form.counter,100);">
<input onblur="textCounter(this.form.recipients,this,100);" disabled  onfocus="this.blur();" tabindex="999" maxlength="3" size="3" value="100" name="counter">
<script type="text/javascript">
function textCounter( field, countfield, maxlimit ) {
 if ( field.value.length > maxlimit ) {
  field.value = field.value.substring( 0, maxlimit );
  field.blur();
  field.focus();
  return false;
 } else {
  countfield.value = maxlimit - field.value.length;
 }
}

</script><br /><br />
   <input class="button" type="submit" name="submitBtn" value="Upload My File" class="text"/>
            </table>  
          </form>
          <?php
}
		 
?>		  

                </div>
             	


</div>					  
                    
					
       
				<p>&nbsp;</p>
			</div>
		</div>
<div id="form_area" class="boxed">
			<h2 class="heading">Quick Search</h2>
			<div class="content">
				<form method="post" action="http://downloads.*************.co.uk/search.php">
					<div>
			<label>Filename:<br /></label>
            <input type="text" class="textfield" name="search" value="" size="18" /><br /><br />
						<input class="button" type="submit" value="Search" title="Search" name="searchBtn"/><br /><br />
						
					</div>
				</form>
			</div>
		</div>
<?php 
 if ($pun_user['is_admmod'])
 {

$admmod = $shn_sites->prepare("SELECT COUNT(*) AS id FROM downloads_unchecked");
$admmod->execute();
foreach ($admmod as $row)
{	
	?>		
<div class="boxed">
<h2 class="heading">Admin</h2>
			<div class="content">
				<ul>
				<?php if ($row['id'] > 0)
{
?>
<li class="first"><a href='http://admin.downloads.*************.co.uk/'><?php echo $row['id']; ?> New Files</a></li>
<?php 
}
else
{
?>
<li class="first"><a href='http://admin.downloads.*************.co.uk/'>No New Files</a></li>
<?php
}


} 

$admmod2 = $shn_sites->prepare("SELECT COUNT(*) AS id FROM downloads WHERE approval = '1'");
$admmod2->execute();
foreach ($admmod2 as $row)
{	
	
if ($row['id'] > 0)
{
?>					
<li><a href="http://admin.downloads.*************.co.uk/updated_files.php"><?php echo $row['id']; ?> Updated Files</a></li>
<?php 
}
else
{
?>
<li><a href="http://admin.downloads.*************.co.uk/updated_files.php">No Updated Files</a></li>
<?php
}

}
?>
				</ul>
			</div>
		</div>
		<?php } ?>
			<div class="boxed">
			<h2 class="heading">Download Sections</h2>
			<div class="content">
				<ul>
					
  <li class="first"><?php
$ps = $shn_conf->query("SELECT site_title FROM download_sites");
// since you only want one value, tell PDO that
$ps->setFetchMode(PDO::FETCH_COLUMN, 0);
foreach ($ps as $title)
{
echo '<a href="index.php?action=display&site='.$title.'">'.$title.'</a></li>
<li>';
}
?>
				</ul>
			</div>
		</div>
  		<div class="boxed">
			<h2 class="heading">Site Navigation</h2>
			<div class="content">
				<ul>
  <li class="first"><?php
				$sites = "SELECT site,name FROM `sites`";
$ps = $shn_conf->query($sites);
while ($row = $ps->fetch(PDO::FETCH_ASSOC)) {
?>
               <a href="<?php echo $row['site']; ?>"><?php echo $row['name']; ?></a></li>
                	<li>
<?php } ?>
  
				</ul>
			</div>
		</div>	
		<?php if ($pun_user['is_guest']) {
?>
		    <div id="form_area" class="boxed">
			<h2 class="heading">My Account</h2>
			<div class="content">
				<form id="login" method="post" action="login.php?action=in" onsubmit="return process_form(this)">
				<input type="hidden" name="form_sent" value="1" />
					<div>
            <label>Username:<br /></label>
            <input type="text" class="textfield" name="req_username" size="18" maxlength="25"/>
            <label>Password:<br /></label>
            <input type="password" class="textfield" name="req_password" size="18" /><br /><br />
			<a href="register/">Not registered?</a><br /><br />
						<input class="button" type="submit" value="Login" title="Login" />
					</div>
				</form>
			</div>
		</div>
		<?php }
		else
		{ ?> 
	<div class='boxed'>
			<h2 class='heading'><?php echo $pun_user['username']; ?></h2>
			<div class='content'>
				<ul>
  <li class='first'><b><a href='submit.php'>Submit File</a></b></li>			
  <li><b><a href='files.php?id=<?php echo $pun_user['id']; ?>&u=<?php echo $pun_user['username']; ?>'>My Files</a></b></li>
  <li><b><a href="http://forums.*************.co.uk/profile.php?id=<?php echo $pun_user['id']; ?>">My Profile</a></li></b></li>
  <li><b><a href="http://members.*************.co.uk/">Members Area</a></li></b></li>
  <li><b><a href='index.php?action=upload_agreement'>Upload Agreement</a></b></li>
  <li><b><?php echo '<a href="login.php?action=out&amp;id='.$pun_user['id'].'&amp;csrf_token='.pun_hash($pun_user['id'].pun_hash(get_remote_address())).'">Logout</a></b></li>'; ?>	
		</div>
		    
		
		<?php } ?>
	
<div class="boxed">
			
			<div class="content"><br>
				<ul>
  <?php showRandomAD(1); ?>
  
				</ul>
			</div>
		</div>
	</div>
	
	<div id="footer">
	  <p><?php
$footerselect = "SELECT value FROM `config` WHERE `option` = 'footer'";
$ps = $shn_conf->query($footerselect);
echo $ps->fetchColumn();
?></p>
  </div>
</div>
<?php if ($month_number == '12')
{
?>
<img id="nksnow0" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow-d.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<img id="nksnow1" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow5-b.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<img id="nksnow2" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow-d.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<img id="nksnow3" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow5-b.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<img id="nksnow4" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow-d.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<img id="nksnow5" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow-d.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<img id="nksnow6" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow5-b.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<img id="nksnow7" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow5-b.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<img id="nksnow8" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow5-b.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<img id="nksnow9" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow5-b.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<img id="nksnow10" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow5-b.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<img id="nksnow11" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow5-b.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<img id="nksnow12" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow5-b.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<img id="nksnow13" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow-d.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<img id="nksnow14" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow5-b.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<img id="nksnow15" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow5-b.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<img id="nksnow16" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow-d.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<img id="nksnow17" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow-d.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<img id="nksnow18" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow5-b.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<img id="nksnow19" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow-d.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<img id="nksnow20" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow5-b.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<img id="nksnow21" src="http://www.*************.co.uk/cookies/christmas/img/flake-snow-d.png" style="position: fixed; top: -100px; border: 0; z-index:1000;" class="nksnow" alt="snowflake" />
<?php } ?>
</body>
</html>

This post has been edited by Curtis Rutland: 07 March 2016 - 10:04 AM
Reason for edit:: removed domain

Was This Post Helpful? 0
  • +
  • -

#6 andrewsw   User is offline

  • palpable absurdity
  • member icon

Reputation: 6905
  • View blog
  • Posts: 28,565
  • Joined: 12-December 12

Re: PHP upload Script problem

Posted 04 January 2014 - 08:25 AM

You have 700+ lines there. You need to use lots of echo and/or print_r statements, and other debugging techniques, to help narrow down the problem.
Was This Post Helpful? 0
  • +
  • -

#7 CTphpnwb   User is online

  • D.I.C Lover
  • member icon

Reputation: 3837
  • View blog
  • Posts: 13,997
  • Joined: 08-August 08

Re: PHP upload Script problem

Posted 04 January 2014 - 08:29 AM

You need to better organize your code.

When I see code with no/poor indenting and things like this:
?>
<?php		 //End:: Other Files Required?
// What's the point of breaking out of and the immediately back into PHP???

and then I see you've mixed three languages (PHP, HTML, and Javascript) in one file I'm not at all surprised that you have trouble. I find it difficult to read/debug, so why shouldn't you?

Oops! Make that four languages! I just noticed that you're including CSS in your code. Yikes!
Was This Post Helpful? 0
  • +
  • -

#8 chris98   User is offline

  • D.I.C Lover

Reputation: 42
  • View blog
  • Posts: 1,129
  • Joined: 06-July 13

Re: PHP upload Script problem

Posted 04 January 2014 - 08:30 AM

Sorry, I wrote all this before yesterday when you told me about it. To be honest, I don't even know why I did break out of PHP ta the time. I'll clean it up then re-post it.
Was This Post Helpful? 0
  • +
  • -

#9 CTphpnwb   User is online

  • D.I.C Lover
  • member icon

Reputation: 3837
  • View blog
  • Posts: 13,997
  • Joined: 08-August 08

Re: PHP upload Script problem

Posted 04 January 2014 - 08:31 AM

I'd start over and test as I wrote the code, making sure each part worked before moving on to the next. I'd also put HTML in .html files, PHP in .php files, Javascript in .js files, and CSS in .css files as they're intended to be.
Was This Post Helpful? 0
  • +
  • -

#10 andrewsw   User is offline

  • palpable absurdity
  • member icon

Reputation: 6905
  • View blog
  • Posts: 28,565
  • Joined: 12-December 12

Re: PHP upload Script problem

Posted 04 January 2014 - 08:32 AM

Mind you, if you are saying that the code works for files less than 2MB, then this should help you narrow down the problem. For example:

if (($_FILES["upfile"]["size"] > 102400)) // Max File Size: 100KB

Was This Post Helpful? 0
  • +
  • -

#11 CTphpnwb   User is online

  • D.I.C Lover
  • member icon

Reputation: 3837
  • View blog
  • Posts: 13,997
  • Joined: 08-August 08

Re: PHP upload Script problem

Posted 04 January 2014 - 08:38 AM

Andrew may be right about the specific problem you have at the moment, but I'd use that information when rewriting the code. Your main objective should be to get it right, not just working. "Working" is the least important goal you should have right now.
Was This Post Helpful? 0
  • +
  • -

#12 chris98   User is offline

  • D.I.C Lover

Reputation: 42
  • View blog
  • Posts: 1,129
  • Joined: 06-July 13

Re: PHP upload Script problem

Posted 04 January 2014 - 08:39 AM

That's for the preview image - it's the other one that should do it for the file as I named them upfile and ufile is the one I'm having trouble with.
Was This Post Helpful? 0
  • +
  • -

#13 CTphpnwb   User is online

  • D.I.C Lover
  • member icon

Reputation: 3837
  • View blog
  • Posts: 13,997
  • Joined: 08-August 08

Re: PHP upload Script problem

Posted 04 January 2014 - 08:40 AM

Your most important goal should be to write code that you can easily explain to another coder, or even better, a non coder. If you can read and explain your own code it's probably well written. If your code confuses you then it's a problem.
Was This Post Helpful? 0
  • +
  • -

#14 chris98   User is offline

  • D.I.C Lover

Reputation: 42
  • View blog
  • Posts: 1,129
  • Joined: 06-July 13

Re: PHP upload Script problem

Posted 04 January 2014 - 08:42 AM

When I incude the javascript file, I should name it something like "verification.js" and basically just paste all the javascript in that I have in that file and include it using a <link rel> and nothing else will change?
Was This Post Helpful? 0
  • +
  • -

#15 CTphpnwb   User is online

  • D.I.C Lover
  • member icon

Reputation: 3837
  • View blog
  • Posts: 13,997
  • Joined: 08-August 08

Re: PHP upload Script problem

Posted 04 January 2014 - 08:48 AM

Pretty much. There will be calls to the js in the html, but all the functions should be in the .js file.

By the way, you don't "include" Javascript, you reference it.

Example, in your HTML:
<script type='text/javascript' src='./your_javascript_file.js'></script>

Was This Post Helpful? 0
  • +
  • -

  • (6 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »