Jump to content

Uploader.


marklarah

Recommended Posts

My uploader doesn't work - its not entering into the database or uploading the file  ???

<?
include 'top.php';

if(isset($_SESSION['user'])){
if($_SESSION['lvl'] < "49"){
$error = "You are not high enough.";
}
}else{
$error2 = "You are not logged in.";

}
$title = 'Games Upload';
include 'main.inc.php';
if(isset($error)){
echo $error;
}
if(isset($error2)){
echo '<div class="error"><h2>Error!</h2>'.$error2.'</div>';
}
if(isset($error2) || isset($error)){
include 'bottom.inc.php';
exit;
}
echo '<h2>Insert new game</h2><hr><br>';

if(isset($_POST['name']) && isset($_POST['emb']) && isset($_POST['blurb']) && isset($_POST['rating']) && isset($_POST['x']) && isset($_POST['y']) && isset($_POST['uploaded'])){


$name = $_POST['name']; 
   $blurb = $_POST['blurb']; 
  $y = $_POST['y']; 
  $emb = $_POST['emb']; 
  $x = $_POST['x']; 
  $rating = $_POST['rating']; 

$sqll = "SELECT * FROM `site`";
$resultt = mysql_query($sqll) or die(mysql_error());  
$roww = mysql_fetch_array($resultt);
$gid = $roww['lastgid'];
$img1 = $gid + 1;

$url = 'gimages/'.$img1.'.gif';

$sql = "INSERT INTO `3` (ID, emb, blurb, played, date, name, x, y, rating, img) VALUES (NULL, '$emb', '$blurb', 20, NOW(), '$name', '$x', '$y', '$rating', '$url')";
mysql_query($sql) or die(mysql_error()); 

if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $url)) 
{

echo 'Succesful! - <a href="g_upload.php">Upload More</a>';
}else{
echo 'Soz';
}

}else{
?>

<form enctype="multipart/form-data" action="g_upload.php" method="POST">
Name:<br>
<input type="text" name="name"><br>


SWF URL: <br>
<textarea cols="40" rows="7" name="emb">
</textarea><br>

Blurb: <br>
<textarea cols="40" rows="7" name="blurb">
</textarea><br>

Rating: <br>
<input type="text" name="rating" maxlength="3"><br>
Width: <br>
<input type="text" name="x" maxlength="3"><br>
Height: <br>
<input type="text" name="y" maxlength="3"><br>
Image: <br>
<input name="uploaded" type="file"><br >

<br>    <input type="submit" value="Go">

</form>
<?
}
?>
<br>
<?
$result="SELECT * FROM `3`";
$dn = mysql_query($result) or die(mysql_error());
$num = mysql_num_rows($dn);

echo '<h3>Number of games in database: '.$num.'</h3>';

?>
<?
include 'bottom.inc.php';
?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/97182-uploader/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.