Jump to content

Ziph

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Ziph's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have made a little upload place for me and my friends. I made it so you can only upload application/replay files if($_FILES['userfile']['type'] != "application/replay") { echo "$filetype Sorry, we only allow uploading REP files"; exit; when i try to upload a file a JPG it indeed works and when i upload a .rep a replay file it gets allowed. THE problem is. if a friend tries to upload this same rep file from his computer it gets rejected because its not a application/replay anymore for some reason but a octet-stream how do i fix this problem ?
  2. I have this filetype .rep its a application/replay i added it to my mime list on my webhost. but when i try echo mime_content_type('Ziph/LastReplay.rep'); it gives me this error Fatal error: Call to undefined function mime_content_type() is there anyway to read the file i upload and check if its a application/replay (.rep) and print this i have been trying all day and failed. code $fileinfo = mime_content_type($_FILES['userfile']['tmp_name']); if($fileinfo['mime'] != 'application/replay') { echo "File type: $fileinfo"; echo mime_content_type('Ziph/LastReplay.rep'); exit; }
  3. haha tnx allot Btw because im a noob at php only started using php and sql this week ^^. can you explain what is the diffrence between str_replace and preg_replace ?
  4. For some reason it wont add _ for where the spaces are this is the outcome of this code (Ziph) () test test test = fixedlink http://www.gosuhosting.com/upload/Ziph/0028 shakaalxZ ZiphP.rep = mustfixlink <?php // Start a session session_start(); // Sends the user to the login-page if not logged in if(!session_is_registered('member_ID')) : header('Location: ../login/login.html?msg=requires_login'); endif; // DB connect ifno include '../mysql/db.php'; // functions include '../mysql/functions.php'; $username = user_info('username'); echo "($username) "; echo "($filename) "; $filename = $_GET["msg"]; $filelinkconstruct = mysql_query("SELECT filelink FROM uploads WHERE username='$username' AND filename='$filename' "); while($fix = mysql_fetch_assoc($filelinkconstruct)) { $mustfixlink = $fix['filelink']; }; $fixedlink = preg_replace('[%[\s]+%]', '_', 'test test test'); echo "$fixedlink = fixedlink"; echo "$mustfixlink = mustfixlink"; ?> test test test is ofcourse in the final version to be replaced with $mustfixlink but the test test test is to test it hehe i also tried to rename the file also didnt work. this preg_replace code does work with other people so i dont know what im doing wrong.
  5. hehe im pretty sure im running php5 If I make a new php file with just <?php $str = 'foo o'; $str = preg_replace('/\s\s+/', ' ', $str); // This will be 'foo o' now echo $str; ?> this one works but when i use '/\s\s+/' this code in my php script it does not =\ like it did iin this script really weird.
  6. test test test this is what i get returned shouldnt it be test_test_test or something ?
  7. hmz does not work still getting the name returned with spaces
  8. Hello I put a filelink + filename in my database that contains spaces i want to remove those with this php script. I send the filelink from the the previous page to this one with a header sending the filename with it in a $msg= $filename = $_GET["msg"]; $filelinkconstruct = mysql_query("SELECT filelink FROM uploads WHERE username='$username' AND filename='$filename' "); while($fix = mysql_fetch_assoc($filelinkconstruct)) { $mustfixlink = $fix['filelink']; }; $fixedlink = preg_replace('[([\r\n])[\s]+]', '_', $mustfixlink); /// it wont replace the whitespaces with _ i tried a lot of diffrent space codes but for some reason it wont work echo "$fixedlink = fixedlink"; echo "$mustfixlink = mustfixlink"; EXAMPLE: http://www.gosuhosting.com/upload/fixfilename.php?msg=x%20s%20a.png IN DATABASE = filelink "http://www.gosuhosting.com/upload/Ziph/x s a.png" and filename "x s a.png" RESPONSE: http://www.gosuhosting.com/upload/Ziph/x s a.png = fixedlink http://www.gosuhosting.com/upload/Ziph/x s a.png = mustfixlink im pretty sure there must be something wrong with the pregreplace code but i cant find what i should use for a mysql space.
  9. oh sorry error should be Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/gosuh0/public_html/upload/uploadform.php on line 63 so i guess that means something is still wrogn with the ' or "
  10. Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/gosuh0/public_html/upload/uploadform.php on line 63 keep getting this error. echo "<tr><td>" . $row1['name'] . "</td><td>" . $row1['lastname'] . "</td><td>" '<a href="' . $row1['link'] . '">Click Here</a>' "</td><td>" . $row1['poll'] . "</td></tr>";
  11. echo '<tr><td>' . $row1['link'] . "</td></tr>"; output = "http://www.google.nl" now I want the output to be this "Click Here" $row1[<a href='filelink'>Click Here </a>] didnt really work out =p any hints ?
  12. K tnx allot btw i also found why it didnt print anyhing =) also can i ask what is the reason between '<tr><td>' and "</td></tr>" and not both ' ' or " "
  13. great! Atleast im not getting the error anymore tho it still doesnt show up will take a look at that myself =)) tnx allot again.
  14. Dear phpFreaks, I am trying to echo something from my database into a table now when i try this i get this error. Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/gosu/public_html/hahaha/lollolo.php on line 63 <?php echo "<table> <tr height='100px'></tr> <tr><td><img src='documents.jpg' /></td></tr> <tr height='20px'></tr>"; $checkdocuments = mysql_query("SELECT * FROM uploads WHERE username='$username' AND sortlist='Documents' "); while($row1 = mysql_fetch_array($checkdocuments)) { echo "<tr><td>$row1['username']</td></tr>"; // LINE 63 } echo "</table>"; ?>
  15. ye i do not understand that line. Maybe change it into there may be NOTHING before the <?php instead of whitespace or w/e. =) Anyway tnx allot its fixed now.
×
×
  • 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.