Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2008
    Posts
    50
    Tokens
    10

    Default Need Help Real Quick.

    Hello, I have this PHP File upload script I modified and stuff, I just need help adding something in it. Basically you can view a LIVE version at maniaupload.net.

    The guy sold it to me, and he hasn't been on to help me. I just need this one favor.

    What I want is, once a user uploads an image, it can also be deleted by that user with the code given. For example: go to maniaupload.net and upload a test image. I have made the html, bbcode & direct link. I want an option for a box where it shows Delete link....

    here's my FULL php upload script.

    <?php
    define ("MAX_SIZE","100000");
    function getExtension($str) {
    $i = strrpos($str,".");
    if (!$i) { return ""; }
    $l = strlen($str) - $i;
    $ext = substr($str,$i+1,$l);
    return $ext;
    }
    $errors=0;
    if(isset($_POST['Submit']))
    {
    $image=stripslashes($_FILES['image']['name']);
    if ($image)
    {
    $filename = stripslashes($_FILES['image']['name']);
    $extension = getExtension($filename);
    $extension = strtolower($extension);
    if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "mov") && ($extension !="PNG") && ($extension !="bmp") && ($extension != "png") && ($extension != "gif"))
    {

    echo '<font color="red"><b>Extension not allowed</b></font><br>';
    $errors=1;
    }
    else
    {
    $size=filesize($_FILES['image']['tmp_name']);


    if ($size > MAX_SIZE*100000)
    {
    echo 'You have exceeded the size limit!';
    $errors=1;
    }

    $image_name=time().'.'.$extension;

    $newname="images/".$image_name;

    $fullname="http://www.maniaupload.net/".$newname;



    $copied = copy($_FILES['image']['tmp_name'], $newname);
    if (!$copied)
    {
    echo '<font color=\"red\"><b>Upload Unsuccessful! Try Again?</b></font>';
    $errors=1;
    }}}}

    if(isset($_POST['Submit']) && !$errors)
    {
    echo "File Uploaded Successfully! <br /><br /> <img src=\"$newname\" /> <br /><br />

    <b>Direct Image Link:</b><br/><table width=\"338\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" id=\"Table1\">
    <tr>
    <td align=\"center\" valign=\"middle\"><textarea readonly name=\"message\" rows=\"1\" cols=\"50\">$fullname</textarea></td>
    </tr>
    </table></center><br>

    <b>HTML Code:</b><br/><table width=\"338\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" id=\"Table1\">
    <tr>
    <td align=\"center\" valign=\"middle\"><textarea readonly name=\"message\" rows=\"1\" cols=\"50\">
    <a href=\"$fullname\" target=\"_blank\"><img border=\"0\" src=\"$fullname\"></a>
    </textarea></td>
    </tr>
    </table><br>

    <b>BBCode <font color=\"red\">*NEW*</font></b><br>
    <table width=\"338\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" id=\"Table1\">
    <tr>
    <td align=\"center\" valign=\"middle\">
    <textarea readonly name=\"message\" rows=\"1\" cols=\"50\">
    [IMG] $fullname [/IMG]
    </textarea></td>
    </tr>
    </table><br>
    ";
    }

    ?>
    I have more code but its not needed, its outside of the php tags. But can anyone help please. It's just adding a delete link so users can delete it if they choose.

    Thanks.

  2. #2
    Join Date
    Jul 2006
    Location
    Cambridge, UK
    Posts
    447
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by lSFresh View Post
    The guy sold it to me...

    ...here's my FULL php upload script.
    :S Would recommend removing it and asking for people to PM you who are generally interested in helping.

  3. #3
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Well you really have two options... you can use a database or flat file system... decide which one you want and I'll be more then glad to help you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •