forked from DMeloni/shaarlo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
connect.php
46 lines (41 loc) · 2 KB
/
connect.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
<?php
ini_set('session.save_path', $_SERVER['DOCUMENT_ROOT'].'/sessions');
ini_set('session.use_cookies', 1); // Use cookies to store session.
ini_set('session.use_only_cookies', 1); // Force cookies for session (phpsessionID forbidden in URL)
ini_set('session.use_trans_sid', false); // Prevent php to use sessionID in URL if cookies are disabled.
ini_set('session.cookie_domain', '.shaarli.fr');
session_name('shaarli');
session_start();?><html>
<?php
if(!isset($_GET['password'])) {
$password = '';
}else{
$password = $_GET['password'];
}
// Returns a token.
function getToken()
{
$rnd = sha1(uniqid('',true).'_'.mt_rand().$GLOBALS['salt']); // We generate a random string.
$_SESSION['tokens'][$rnd]=1; // Store it on the server side.
return $rnd;
}
if(isset($_GET['pseudo']) ) {
?><form action="<?php echo sprintf("http://my.shaarli.fr/%s/", htmlentities($_GET['pseudo']));?>" method="post" name="loginform">
Login: <input name="login" tabindex="1" type="text" value="<?php echo htmlentities($_GET['pseudo']);?>">
Password : <input name="password" tabindex="2" type="password" value="<?php echo htmlentities($password);?>">
<a style="display: inline; background-color: red; color: white;" href="Show">Show</a>
<input value="Login" class="bigbutton" tabindex="4" type="submit">
<br>
<input name="longlastingsession" id="longlastingsession" tabindex="3" type="checkbox">
<label for="longlastingsession"> Stay signed in (Do not check on public computers)</label>
<input name="token" value="<?php echo getToken();?>" type="hidden">
<input name="returnurl" value="http://shaarli.fr/index2.php" type="hidden">
</form>
</form>
<script language="JavaScript">
//document.loginform.submit();
</script>
<?php
}
?>
</html>