Versio

File Thingie help

Overzicht Reageren

Frankyy

Frankyy

21/04/2008 20:27:00
Quote Anchor link
Ik gebruik op het moment File Thingie, en werkt goed.
Alleen mijn vraag is,
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
define("USERNAME", "my_username"); // Your default username.
define("PASSWORD", "my_password"); // Your default password.
define("_DIR", "."); // Your default directory. Do NOT include a trailing slash!

Hiermee bepaald hij het wachtwoord, is er een mogelijkhijd om meer gebruikers toe te voegen met een bepaalde dir ?
 
PHP hulp

PHP hulp

24/05/2012 15:35:51
Gesponsorde koppelingen:
BHosted Hosting al vanaf € 1,- per maand

Controleer nu gratis jouw domeinnaam:

  
 
Jan Koehoorn

Jan Koehoorn

21/04/2008 20:29:00
Quote Anchor link
Dat hangt van de inlogprocedure van File Thingie af.
 
Frankyy

Frankyy

21/04/2008 20:34:00
Quote Anchor link
Zover ik hier in het script zie gebruikt hij dit om in te loggen:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
function checkLogin() { // Checks whether a login is valid or not.
    global $users;
  $valid_login = 0;
    if (DISABLELOGIN == FALSE) {
        if (empty($_SESSION['ft_user_'.MUTEX])) {
          $cookie_mutex = str_replace('.', '_', MUTEX);
            // Session variable has not been set. Check if there is a valid cookie or login form has been submitted or return false.
      if (REMEMBERME == TRUE && !empty($_COOKIE['ft_user_'.$cookie_mutex])) {
        // Verify cookie.
        $cookie = checkCookie($_COOKIE['ft_user_'.$cookie_mutex]);
        if (!empty($cookie)) {
                // Cookie valid. Login.
                  $_SESSION['ft_user_'.MUTEX] = $cookie;
                  redirect();          
        }
            }
            if (!empty($_POST['act']) && $_POST['act'] == "dologin") {
                // Check username and password from login form.
                if ($_POST['ft_user'] == USERNAME && $_POST['ft_pass'] == PASSWORD) {
                    // Valid login.
                    $_SESSION['ft_user_'.MUTEX] = USERNAME;
                    $valid_login = 1;
                }
                // Default user was not valid, we check additional users (if any).
                if (is_array($users) && sizeof($users) > 0) {
                    // Check username and password.
                    if (array_key_exists($_POST['ft_user'], $users) && $users[$_POST['ft_user']]['password'] == $_POST['ft_pass']) {
                        // Valid login.
                        $_SESSION['ft_user_'.MUTEX] = $_POST['ft_user'];
                        $valid_login = 1;
                    }
                }
                if ($valid_login == 1) {
                  // Set cookie.
                    if (!empty($_POST['ft_cookie']) && REMEMBERME) {
                      setcookie('ft_user_'.MUTEX, md5($_POST['ft_user'].$_POST['ft_pass']), time()+60*60*24*3);
                    } else {
                      // Delete cookie
                      setcookie('ft_user_'.MUTEX, md5($_POST['ft_user'].$_POST['ft_pass']), time()-3600);
                    }
                    redirect();
                } else {
                  redirect("act=error");                  
                }
            }
            return FALSE;
        } else {
            return TRUE;
        }
    } else {
        return TRUE;
    }
}
Gewijzigd op 01/01/1970 01:00:00 door Frankyy
 
- SanThe -

- SanThe -

21/04/2008 20:36:00
Quote Anchor link
Pas je script even aan en gebruik en tags om je code heen. Gebruik je http://www.phphulp.nl/imgs/forum/edit.gif knop om dit te doen.

SanThe.
 



Overzicht Reageren