File Thingie help
Ik gebruik op het moment File Thingie, en werkt goed.
Alleen mijn vraag is,
Hiermee bepaald hij het wachtwoord, is er een mogelijkhijd om meer gebruikers toe te voegen met een bepaalde dir ?
Alleen mijn vraag is,
Code (php)
1
2
3
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!
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 ?
Gesponsorde koppelingen:
Dat hangt van de inlogprocedure van File Thingie af.
Zover ik hier in het script zie gebruikt hij dit om in te loggen:
Code (php)
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
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;
}
}
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
Pas je script even aan en gebruik en tags om je code heen. Gebruik je
knop om dit te doen.
SanThe.
knop om dit te doen.SanThe.



