Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Aug 2005
    Location
    London
    Posts
    9,773
    Tokens
    146

    Latest Awards:

    Default Need help with forms :(

    Well i suck at coding and I want a form for a basic name+pass script but I can't find one
    I also want the code for the uploader bar thingy for upload sites , Someone help me
    Here's an image of basically what i want for people who didn't get what I typed above.

    +37 rep to people who help.

  2. #2
    Join Date
    Oct 2007
    Posts
    824
    Tokens
    71

    Latest Awards:

    Default

    Dynamicdrive.com for the bar. I know I saw it somewhere before? Use the search tool.

    Ill do a form for you but the handler is up to you.

    Is that ok?

  3. #3
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    Name your username and password filed to user and pass and then set up a mysql table to include it.

    then use this =]

    PHP Code:
    <?
    session_start
    ();
    function 
    clean($st)
    {
    $var strip_tags(addslashes(stripslashes(htmlspecialchars($st))));
    return 
    $var;
    }
    $login clean($_GET[login]);
    if(!
    $login) {
    ?>
    <form action="?login=login" method="post">
    <label for="user">Username:</label>
    <input type="text" name="user" />
    <label for="pass">Password:</label>
    <input type="password" name="pass" />
    <input type="submit" value="Login" />
    </form>
    <? }
    else
    {
    $user clean($_POST[user]);
    $pass clean($_POST[pass]);
    $pass md5($pass);
    $ck mysql_num_rows(mysql_query("select * from users where username = '$user' AND password = '$pass'"));
    if(
    $ck==1)
    {
    $_SESSION[username] = $user;
    echo(
    'You have now logged in... Bla Bla Bla, you can put whatever content you want here');
    }
    else
    die(
    "Sorry, Your username or password were not correct");
    }
    ?>
    Coming and going...
    Highers are getting the better of me

  4. #4
    Join Date
    Aug 2007
    Location
    Scotland
    Posts
    1,708
    Tokens
    0

    Latest Awards:

    Default

    Code:
    <?
    $serverpath = "ServerPathHere";
    $urltoimages = "URLHere";
    $maxsize = "500000";
    $uniq = uniqid("");
    
    $mode = $_GET['mode'];
    if ($mode == "") { $mode = "form"; }
    
    if ($mode == "form") {
    echo "<form enctype='multipart/form-data' method='post' action='?mode=upload'>\n";
    echo "Upload file: <input type='file' name='file'>\n";
    echo "<br><input type='submit' name='Submit' value='Upload'>\n";
    echo "<br>Maximum File Size: $maxsizeb Bytes";
    echo "<br>$file";
    }
    
    if ($mode == "upload") {
    $file = $_FILES['file']['name'];
    $name = time() . substr($file, -4);
     $allowedfiles[] = "gif";
     $allowedfiles[] = "jpg";
     $allowedfiles[] = "jpeg";
     $allowedfiles[] = "jfef";
     $allowedfiles[] = "jpe";
     $allowedfiles[] = "png";
     $allowedfiles[] = "GIF";
     $allowedfiles[] = "JPG";
     $allowedfiles[] = "JPEG";
     $allowedfiles[] = "JFEF";
     $allowedfiles[] = "JPE";
     $allowedfiles[] = "PNG";
     $allowedfiles[] = "PDF";
     $allowedfiles[] = "pdf";
     $allowedfiles[] = "PSD";
     $allowedfiles[] = "psd";
     $allowedfiles[] = "bmp";
     $allowedfiles[] = "BMP";
     $allowedfiles[] = "tif";
     $allowedfiles[] = "tiff";
     $allowedfiles[] = "TIF";
     $allowedfiles[] = "TIFF";
     $allowedfiles[] = "dib";
     $allowedfiles[] = "DIB";
    
    
     if($_FILES['file']['size'] > $maxsize)
     {
      print "What to say if files too big";
      }
      else {
      $path = "$serverpath/" . $name;
      foreach($allowedfiles as $allowedfile) {
     
      if ($done <> "yes") {
      if (file_exists($path)) {
       echo "What To Say If File Already Exists";
       exit;
      }
      }
     
      if (substr($file, -3) == $allowedfile) {
        move_uploaded_file($_FILES['file']['tmp_name'], "$path");
        $done = "yes";
        echo "<p>What to say once its been uploaded</p>";
        echo "<p><img src='$urltoimages/$name' border='0'>"; 
        echo "<p>Direct Link: <input name='direct' type='text' size='75' value='$urltoimages/$name'></a></p>";
               
        }
    
      }
    
    if ($done <> "yes") { print "<p><b>Error:</b>What to say if the file isnt one of your allowed ones.</p>"; }
    }
    }
    
    ?>
    Thats a basic code for uploading the images but no usersystem.

    (reason i used [code] instead of [php] was to show where he needs to imput stuff by embolden and larger font which cant be done in php tags.)

  5. #5
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    For above, you script does not support file types with a extension longer that 3 characters.
    Last edited by Tomm; 18-10-2007 at 03:13 PM.

  6. #6
    Join Date
    Aug 2007
    Location
    Scotland
    Posts
    1,708
    Tokens
    0

    Latest Awards:

    Default

    That was just for uploading images, so not many things have more than 4 characters in extension? :S

  7. #7
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    Sorry, I meant three.

    Quote Originally Posted by Galaxay View Post
    That was just for uploading images, so not many things have more than 4 characters in extension? :S

  8. #8
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    Change
    PHP Code:
    $name time() . substr($file, -4); 
    to
    PHP Code:
    $name time() . substr($file, -5); 
    Coming and going...
    Highers are getting the better of me

  9. #9
    Join Date
    Aug 2007
    Location
    Scotland
    Posts
    1,708
    Tokens
    0

    Latest Awards:

    Default

    and


    if (substr($file, -3) == $allowedfile) {

  10. #10
    Join Date
    Aug 2005
    Location
    London
    Posts
    9,773
    Tokens
    146

    Latest Awards:

    Default

    I've actually got a fully working upload script but i don't actually want an upload script , I just want the bar to type in where the file is if you get what i mean , anyway + rep who have posted.

    grrr need to spread for scott
    Last edited by --ss--; 19-10-2007 at 03:17 PM.

Page 1 of 2 12 LastLast

Posting Permissions

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