Jump to content

Game_Replays

New Members
  • Posts

    7
  • Joined

  • Last visited

Game_Replays's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Fixed it using: fwrite()
  2. What is wrong with line 19 of my register script? <?php require('../usertest/userlist.inc.php'); function registerNewUser($username,$password) { global $userarray; if(!ctype_alnum($username) or !ctype_alnum($password)) { die("sorry, only alphanumeric letters allowed. (a-z,A-Z,0-9)"); } if(isset($userarray[$username])) { die("sorry, name is taken."); return false; } $username=addslashes($username); $password=addslashes($password); $addstring='<?php $userarray[\''.$username.'\']=\''.$password.'\';?>'; file_put_contents('userlist.inc.php', $addstring); return true;//new user registered... } ?> thanks, Game_replays
  3. ;_; No replies really?
  4. Hi there, I am working on a website and I have this code to allow people to upload to the website: Form: <form action="../scripts/upload_file.php" method="post" enctype="multipart/form-data"> <label for="file">Email Address:</label> <input name="email" type="text" id="email"><br> <label for="file">Username:</label> <input name="name" type="text" id="name" maxlength="12"><br> <label for="file">Select File:</label> <input type="file" name="file" id="file"><br> <input type="submit" name="submit" value="Submit"> </form> PHP script: <?php $allowedExts = array("SC2Replay"); $extension = end(explode(".", $_FILES["file"]["name"])); if ((($_FILES["file"]["type"] == "file/.SC2Replay")) && isset($_get["emai"]["name"]) && in_array($extension, $allowedExts)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br>"; } else { echo "Email: " . $_GET["email"]["name"] . "<br>"; echo "Uploader: " . $_GET["name"]["name"] . "<br>"; echo "Upload: " . $_FILES["file"]["name"] . "<br>"; echo "Type: " . $_FILES["file"]["type"] . "<br>"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } ?> What I want to be able to do: The thing I want to do with the form and PHP Script is for the form to ask for: Email Name File Once it has those three things it will then allow you to upload to the website (I know the file format is only ".SC2Replay") Once it is uploaded how will it look on a FTP server? "NameOfFile.SC2Replay" or "Username_NameOfFile.SC2Replay" ? If it looks like the first one then i'd like to have a snippet of code to make it turn into "Username_NameOfFile.SC2Replay" if that is possible Hope you all help - Thanks Game_Replays
×
×
  • 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.