
3raser
Members-
Posts
815 -
Joined
-
Last visited
Everything posted by 3raser
-
$_FILES['file']['name'] = $output.".zip"; $target_path = $target_path . basename($_FILES['file']['name']); and echo "There was an error uploading ". $_FILES['file']['name'] ." the file, please try again!";
-
} else{ echo "There was an error uploading ". $_FILES['file']['name'] ." the file, please try again!"; } I get this with errorreporting(E_ALL); Notice: Undefined index: SESSION in /home/a8079066/public_html/upload.php on line 26 As you see, no errors. (Just a small session one, which does no help)
-
Newest code, still doesn't work: <?php session_start(); include("includes/mysql.php"); include("includes/config.php"); ?> <title><?php echo $title; ?></title> <?php if(!$_SESSION['user']) { echo "Your not allowed to upload plugins! <a href='index.php'>Go Home</a> or <a href='register.php'>Make an account</a>."; } else { echo "<a href='start_upload.php'>Upload</a> | <a href='search.php'>Search & Browse</a> | <a href='/news'>News & Announcements</a> | <a href='logout.php'>Logout</a><hr>"; $description = $_POST['description']; $description = mysql_real_escape_string($description); $ip = $_SERVER['REMOTE_ADDR']; $date = date('m-d-y'); $title = $_POST['title']; $title = mysql_real_escape_string($title); $user = $_SESSION['SESSION']; if(pathinfo(basename($_FILES['file']['name']), PATHINFO_EXTENSION)=="zip") { $query = mysql_query("SELECT COUNT(id) FROM mods"); $finish_query = mysql_fetch_assoc($query); $output = $finish_query['COUNT(id)'] + 1; $target_path = "mods/"; $_FILES['file']['name'] = $output.".zip"; $target_path = $target_path . basename($_FILES['file']['name']); if(move_uploaded_file(basename($_FILES['file']['name']), $target_path)) { echo "The mod ". $title . " has been uploaded. Check it out <a href='mods/". $output ."'>HERE.</a>"; mysql_query("INSERT INTO mods VALUES('', '$ip', '$date', '$title', '$description', '$user')"); } else{ echo "There was an error uploading ". $_FILES['file']['name'] ." the file, please try again!"; } } else { echo "You cannot use a .". pathinfo(basename($_FILES['file']['name']), PATHINFO_EXTENSION) ." extension! .zip is currently the only file extension allowed."; } } include("includes/footer.php"); ?>
-
It's correct. There was an error uploading the file, please try again!9 BREAK /mods/9.zip
-
Why does it give me the "There was an error uploading the file, please try again!" error message? I've checked through the code, and I've looked to see what is wrong. I'm thinking it MIGHT be because of: $target_path = $target_path . $output; if(pathinfo(basename($_FILES['file']['name']), PATHINFO_EXTENSION)=="zip") { if(move_uploaded_file($output, $target_path)) { But, heres the full code: <?php session_start(); include("includes/mysql.php"); include("includes/config.php"); ?> <title><?php echo $title; ?></title> <?php if(!$_SESSION['user']) { echo "Your not allowed to upload plugins! <a href='index.php'>Go Home</a> or <a href='register.php'>Make an account</a>."; } else { echo "<a href='start_upload.php'>Upload</a> | <a href='search.php'>Search & Browse</a> | <a href='/news'>News & Announcements</a> | <a href='logout.php'>Logout</a><hr>"; $description = $_POST['description']; $description = mysql_real_escape_string($description); $ip = $_SERVER['REMOTE_ADDR']; $date = date('m-d-y'); $title = $_POST['title']; $title = mysql_real_escape_string($title); $user = $_SESSION['SESSION']; $target_path = "mods/"; $query = mysql_query("SELECT COUNT(id) FROM mods"); $finish_query = mysql_fetch_assoc($query); $output = $finish_query['COUNT(id)'] + 1; $target_path = $target_path . $output; if(pathinfo(basename($_FILES['file']['name']), PATHINFO_EXTENSION)=="zip") { if(move_uploaded_file($output, $target_path)) { echo "The mod ". basename($_FILES['file']['name']) . " has been uploaded. Check it out <a href='mods/". $output ."'>HERE.</a>"; mysql_query("INSERT INTO mods VALUES('', '$ip', '$date', '$title', '$description', '$user')"); } else{ echo "There was an error uploading the file, please try again!"; } } else { echo "You cannot use a .". pathinfo(basename($_FILES['file']['name']), PATHINFO_EXTENSION) ." extension! .zip is currently the only file extension allowed."; } } include("includes/footer.php"); ?>
-
<?php session_start(); include("includes/mysql.php"); include("includes/config.php"); ?> <title><?php echo $title; ?></title> <?php echo "<a href='start_upload.php'>Upload</a> | <a href='search.php'>Search & Browse</a> | <a href='/news'>News & Announcements</a> | <a href='logout.php'>Logout</a><hr>"; if(!$_SESSION['user']) { echo "Your not allowed to upload plugins! <a href='index.php'>Go Home</a> or <a href='register.php'>Make an account</a>."; } else { echo "<a href='start_upload.php'>Upload</a> | <a href='search.php'>Search & Browse</a> | <a href='/news'>News & Announcements</a> | <a href='logout.php'>Logout</a><hr>"; $description = $_POST['description']; $description = mysql_real_escape_string($description); $ip = $_SERVER['REMOTE_ADDR']; $date = date('m-d-y'); $title = $_POST['title']; $title = mysql_real_escape_string($title); $user = $_SESSION['SESSION']; $target_path = "mods/"; $query = mysql_query("SELECT COUNT(id) FROM mods"); $finish_query = mysql_fetch_assoc($query); $output = $finish_query['COUNT(id)'] + 1; $_FILES['file']['name'] = $output; $target_path = $target_path . basename( $_FILES['file']['name']); if(pathinfo(basename($_FILES['file']['name']), PATHINFO_EXTENSION)=="zip") { if(move_uploaded_file($output, $target_path)) { echo "The mod ". basename($_FILES['file']['name']) . " has been uploaded. Check it out <a href='mods/". $output ."'>HERE.</a>"; mysql_query("INSERT INTO mods VALUES('', '$ip', '$date', '$title', '$description', '$user')"); } else{ echo "There was an error uploading the file, please try again!"; } } else { echo "You cannot use a .". pathinfo(basename($_FILES['file']['name']), PATHINFO_EXTENSION) ." extension! .zip is currently the only filed extension allowed."; } } include("includes/footer.php"); ?> How do I get it so it will upload the file name as $output, instead of basename($_FILES['file]['name'])
-
But if you DO use a zip, is gives you the error message. But it says: You cannot use a . extension! .zip is currently the only filed extension allowed. And also, thats just the way I code. I don't know what to do to improve it...
-
Yes, it's an integer. But where it checks and displays the extensions are out of reach. (Checks = above $output, display is in another { } (dunno whats it's called) - And this is the latest code) <?php session_start(); include("includes/mysql.php"); include("includes/config.php"); ?> <title><?php echo $title; ?></title> <?php echo "<a href='start_upload.php'>Upload</a> | <a href='search.php'>Search & Browse</a> | <a href='/news'>News & Announcements</a> | <a href='logout.php'>Logout</a><hr>"; if(!$_SESSION['user']) { echo "Your not allowed to upload plugins! <a href='index.php'>Go Home</a> or <a href='register.php'>Make an account</a>."; } else { echo "<a href='start_upload.php'>Upload</a> | <a href='search.php'>Search & Browse</a> | <a href='/news'>News & Announcements</a> | <a href='logout.php'>Logout</a><hr>"; $description = $_POST['description']; $description = mysql_real_escape_string($description); $ip = $_SERVER['REMOTE_ADDR']; $date = date('m-d-y'); $title = $_POST['title']; $title = mysql_real_escape_string($title); $user = $_SESSION['SESSION']; $target_path = "mods/"; $target_path = $target_path . basename( $_FILES['file']['name']); if(pathinfo(basename($_FILES['file']['name']), PATHINFO_EXTENSION)=="zip") { if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) { $query = mysql_query("SELECT COUNT(id) FROM mods"); $finish_query = mysql_fetch_assoc($query); echo "The mod ". basename($_FILES['file']['name']) . " has been uploaded. Check it out <a href='mods/". $output ."'>HERE.</a>"; $output = $finish_query['COUNT(id)'] + 1; $_FILES['file']['name'] = $output; mysql_query("INSERT INTO mods VALUES('', '$ip', '$date', '$title', '$description', '$user')"); } else{ echo "There was an error uploading the file, please try again!"; } } else { echo "You cannot use a .". pathinfo(basename($_FILES['file']['name']), PATHINFO_EXTENSION) ." extension! .zip is currently the only filed extension allowed."; } } include("includes/footer.php"); ?>
-
Nope, it's not changing anything important. :/ It worked before, now it isn't.
-
This solved it: echo "You cannot use a .". pathinfo(basename($_FILES['file']['name']), PATHINFO_EXTENSION) ." extension!";
-
start_upload.php <?php session_start(); include("includes/mysql.php"); include("includes/config.php"); ?> <title><?php echo $title; ?></title> <?php echo "<a href='start_upload.php'>Upload</a> | <a href='search.php'>Search & Browse</a> | <a href='/news'>News & Announcements</a> | <a href='logout.php'>Logout</a><hr>"; if(!$_SESSION['user']) { echo "Your not allowed to upload plugins! <a href='index.php'>Go Home</a> or <a href='register.php'>Make an account</a>."; } else { echo '<form enctype="multipart/form-data" action="upload.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="10000000 byte" /> Choose a Plugin to Upload: <input name="file" type="file" /><br /> <b>Title:</b> <input type="text" name="title" maxlength="40"><br/> <b>Description</b><br/><textarea name="description" cols="45" rows="25" maxlength="2300"></textarea> <br/> <input type="submit" value="Upload Plugin" /> </form>'; echo "<br/><br/>"; echo "NOTE: Uploading any harmful programs and/or files that can invade another users privacy, harm their computer, or uploading any files like malware, viruses, or trojans will result in an INSTANT, PERMANENT, IP Ban."; } ?> <? include("includes/footer.php"); ?> upload.php <?php session_start(); include("includes/mysql.php"); include("includes/config.php"); ?> <title><?php echo $title; ?></title> <?php if(!$_SESSION['user']) { echo "Your not allowed to upload plugins! <a href='index.php'>Go Home</a> or <a href='register.php'>Make an account</a>."; } else { $description = $_POST['description']; $description = mysql_real_escape_string($description); $ip = $_SERVER['REMOTE_ADDR']; $date = date('m-d-y'); $title = $_POST['title']; $title = mysql_real_escape_string($title); $user = $_SESSION['SESSION']; $target_path = "mods/"; $target_path = $target_path . basename( $_FILES['file']['name']); if(pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION)==".zip") { if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) { $query = mysql_query("SELECT COUNT(id) FROM mods"); $finish_query = mysql_fetch_assoc($query); $output = $finish_query['COUNT(id)'] + 1; $_FILES['file']['name'] = $output; echo "The mod ". basename( $_FILES['file']['name']). " has been uploaded. Check it out <a href='mods/". $output ."'>HERE.</a>"; echo pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION); mysql_query("INSERT INTO mods VALUES('', '$ip', '$date', '$title', '$description', '$user')"); } else{ echo "There was an error uploading the file, please try again!"; } } else { echo "You cannot use a ". pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION) ." extension!"; echo $_FILES['file']['name']; } } include("includes/footer.php"); ?>
-
Nothing shows up. Doesn't it need to be basename($_FILES['file']['name']) instead? The rest of my code uses that as the file name.
-
After further research, I learned a bit more. But where do I put the ['extension'] part? echo "You cannot use a ". PATHINFO(basename($_FILES['file']['name']['extension'])) ." extension!";
-
After further research, I learned a bit more. But where do I put the ['extension'] part? echo "You cannot use a ". PATHINFO(basename($_FILES['file']['name']['extension'])) ." extension!";
-
All I said was this is what I think the cleansing functions will do. Read more carefully and don't assume things. Denno How about don't be an ass?
-
I've looked it, and I guess it's right in front of me but I don't see it. Parse error: syntax error, unexpected T_STRING, expecting ']' in /home/a8079066/public_html/view.php on line 24 echo "<b>Name:</b> ". $query['name'] ."<br/><b>Description:</b> ". $query['description'] ."<hr><a href='/mods/". $query['id'] .".zip'><h2>[DOWNLOAD]</h2></a><hr>";
-
Still does the same glitch, and I updated my code accordingly. <?php session_start(); include("includes/mysql.php"); include("includes/config.php"); ?> <title><?php echo $title; ?></title> <?php echo "<a href='../index.php'>Home</a> | <a href='start_upload.php'>Upload</a> | Search & Browse | <a href='/news'>News & Announcements</a> | <a href='logout.php'>Logout</a><hr>"; $search = (isset($_POST['search']))?$_POST['search']:false; if(!$search) { echo "<form action='search.php' method='POST'>Search: <input type='text' name='search'><input type='submit' value='Search'></form>"; } else { if (get_magic_quotes_gpc()) { $search = stripslashes($search); } $search = mysql_real_escape_string($search); $sql = "SELECT * FROM mods WHERE name LIKE '%$search%' OR description LIKE '%$search%'"; $query = mysql_query($sql) or die(mysql_error()); while ($row = mysql_fetch_assoc($query)) { $x++; echo "#". $x .": ". $row['name'] .".[VIEW]<br/>"; } if(!$x) { echo "No results found."; } else { echo "<br/>".$x." results."; } } include("includes/footer.php"); ?>
-
Doesn't that nbsp function add a space? If so, how do this help? The code already has a space when someone types in a space manually.