[PHP] login script werkt niet na include
deze instructies. Dat werkt feilloos.
Echter wil ik niet gebruik maken van een aparte login pagina, zoals deze die volgens de instructies is aangemaakt. Maar wil ik dat inlog formulier embedden op de home pagina en de redirect daarvan vervolgens nergens naartoe laten gaan, maar gewoon op dezelfde pagina te blijven. een refresh dus. Maar op een of andere manier werkt dat inlog formulier niet als ik hem enbed / include op de home pagina. Sowieso kan ik de invulvelden al niet aanklikken. Ik kan er alleen in komen door TAB te drukken. Waarom dat is, snap ik al niet. Vervolgens krijg ik een login error, terwijl e-mail en wachtwoord juist zijn. Ik gebruik gewoon de test user voorlopig van de instructies. Weten jullie wel wat het probleem is? Zo ja, hoe los ik het op. Vast bedankt.
N.B. Alle php pagina's zijn rechtstreeks gekopieerd van de instructies, behalve de login.php. Die heb ik iets aangepast en vervolgens home.php genoemd. Die code staat hieronder. Ook post ik de index.php pagina waarin ik de home.php oproep.
index.php
home.php
process_login.php
Voor een loginscript op mijn website, heb ik gebruik gemaakt van Echter wil ik niet gebruik maken van een aparte login pagina, zoals deze die volgens de instructies is aangemaakt. Maar wil ik dat inlog formulier embedden op de home pagina en de redirect daarvan vervolgens nergens naartoe laten gaan, maar gewoon op dezelfde pagina te blijven. een refresh dus. Maar op een of andere manier werkt dat inlog formulier niet als ik hem enbed / include op de home pagina. Sowieso kan ik de invulvelden al niet aanklikken. Ik kan er alleen in komen door TAB te drukken. Waarom dat is, snap ik al niet. Vervolgens krijg ik een login error, terwijl e-mail en wachtwoord juist zijn. Ik gebruik gewoon de test user voorlopig van de instructies. Weten jullie wel wat het probleem is? Zo ja, hoe los ik het op. Vast bedankt.
N.B. Alle php pagina's zijn rechtstreeks gekopieerd van de instructies, behalve de login.php. Die heb ik iets aangepast en vervolgens home.php genoemd. Die code staat hieronder. Ook post ik de index.php pagina waarin ik de home.php oproep.
index.php
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
include_once 'includes/db_connect.php';
include_once 'includes/functions.php';
sec_session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="nl" lang="nl">
<head>
<title>
Bart Crum Advies & Dienstverlening
</title>
<meta http-equiv="content-type" content="application/xml; charset=utf-8" />
<meta http-equiv="Author" content="bartcrum.com - Bart Crum" />
<meta name="Language" content="NL" />
<meta name="expires" content="never" />
<meta name="security" content="PUBLIC" />
<meta name="charset" content="ISO-8859-1" />
<meta name="REVISIT-AFTER" content="1 DAY" />
<meta name="distribution" content="Global" />
<meta name="robots" content="ALL,INDEX,FOLLOW" />
<meta name="publisher" content="http://www.bartcrum.com" />
<meta name="copyright" content="Copyright ©2010 - www.bartcrum.com" />
<script type="text/javascript">
<!--
window.status="Copyright ©right2014 - www.bartcrum.com"
//-->
</script>
<script type="text/JavaScript" src="js/sha512.js"></script>
<script type="text/JavaScript" src="js/forms.js"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-17969574-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<link href="includes/incl_styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="container">
<a href="http://bartcrum.com/" class="header">
<div id="header">
<div class="headerindex">Bart Crum</div>
<div class="header2index">Advies & Dienstverlening</div><br /><hr />
<div class="header3index">van Woustraat 195-2, 1074 AN Amsterdam | T: +31 (0)6 205 403 33,
E: info[at]bartcrum[.]com | BTW: NL.1854.91.339.B01, KvK Amsterdam: 34354565</div>
</div>
</a>
<div id="buttonbalk">
<a href="/roundcube/" class="button">
<div id="button1">
Mail
</div>
</a>
<a href="index.php?p=bart" class="button">
<div id="button2">
Advies & Dienstverlening
</div>
</a>
<a href="index.php?p=CV" class="button">
<div id="button3">
Curriculum vitae
</div>
</a>
<?php if (login_check($mysqli) == true) : ?>
<a href="/dropbox/" class="button">
<?php else : ?>
<div id="button4">
Dropbox
</div>
</a>
<?php endif; ?>
<a href="#" class="button">
<div id="button5">
Cloud
</div>
</a>
</div>
<div id="bodytext">
<?php
$p = $_GET['p'];
if(isset($p)){
if($p == "home"){
include("home.php");
}
if($p == "bart"){
include("bart.php");
}
if($p == "CV"){
include("CV.php");
}
} else {
include("home.php");
}
?>
</div>
</div>
<div id="footer">
© Copyright Bart Crum Advies & Dienstverlening - <a href="werk/Algemene_voorwaarden-Bart_Crum_Advies&Dienstverlening-2014.pdf" class="footer" target="_blank">Algemene voorwaarden 2014</a>
</div>
</body>
</html>
include_once 'includes/db_connect.php';
include_once 'includes/functions.php';
sec_session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="nl" lang="nl">
<head>
<title>
Bart Crum Advies & Dienstverlening
</title>
<meta http-equiv="content-type" content="application/xml; charset=utf-8" />
<meta http-equiv="Author" content="bartcrum.com - Bart Crum" />
<meta name="Language" content="NL" />
<meta name="expires" content="never" />
<meta name="security" content="PUBLIC" />
<meta name="charset" content="ISO-8859-1" />
<meta name="REVISIT-AFTER" content="1 DAY" />
<meta name="distribution" content="Global" />
<meta name="robots" content="ALL,INDEX,FOLLOW" />
<meta name="publisher" content="http://www.bartcrum.com" />
<meta name="copyright" content="Copyright ©2010 - www.bartcrum.com" />
<script type="text/javascript">
<!--
window.status="Copyright ©right2014 - www.bartcrum.com"
//-->
</script>
<script type="text/JavaScript" src="js/sha512.js"></script>
<script type="text/JavaScript" src="js/forms.js"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-17969574-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<link href="includes/incl_styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="container">
<a href="http://bartcrum.com/" class="header">
<div id="header">
<div class="headerindex">Bart Crum</div>
<div class="header2index">Advies & Dienstverlening</div><br /><hr />
<div class="header3index">van Woustraat 195-2, 1074 AN Amsterdam | T: +31 (0)6 205 403 33,
E: info[at]bartcrum[.]com | BTW: NL.1854.91.339.B01, KvK Amsterdam: 34354565</div>
</div>
</a>
<div id="buttonbalk">
<a href="/roundcube/" class="button">
<div id="button1">
</div>
</a>
<a href="index.php?p=bart" class="button">
<div id="button2">
Advies & Dienstverlening
</div>
</a>
<a href="index.php?p=CV" class="button">
<div id="button3">
Curriculum vitae
</div>
</a>
<?php if (login_check($mysqli) == true) : ?>
<a href="/dropbox/" class="button">
<?php else : ?>
<div id="button4">
Dropbox
</div>
</a>
<?php endif; ?>
<a href="#" class="button">
<div id="button5">
Cloud
</div>
</a>
</div>
<div id="bodytext">
<?php
$p = $_GET['p'];
if(isset($p)){
if($p == "home"){
include("home.php");
}
if($p == "bart"){
include("bart.php");
}
if($p == "CV"){
include("CV.php");
}
} else {
include("home.php");
}
?>
</div>
</div>
<div id="footer">
© Copyright Bart Crum Advies & Dienstverlening - <a href="werk/Algemene_voorwaarden-Bart_Crum_Advies&Dienstverlening-2014.pdf" class="footer" target="_blank">Algemene voorwaarden 2014</a>
</div>
</body>
</html>
home.php
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
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
<?php
if (isset($_GET['error'])) {
echo '<p class="error">Error Logging In!</p>';
}
?>
<script type="text/JavaScript" src="js/sha512.js"></script>
<script type="text/JavaScript" src="js/forms.js"></script>
<form action="includes/process_login.php" method="post" name="login_form" class="loginform">
<table border="0" cellspacing="5px">
<tr>
<td>
Email:
</td>
<td>
<input type="text" name="email" />
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<input type="password" name="password" id="password" />
</td>
</tr>
<tr>
<td colspan="2">
<input type="button"
value="Login"
onclick="formhash(this.form, this.form.password);" />
</td>
</tr>
</table>
</form>
<!--
<p>If you don't have a login, please <a href="register.php">register</a></p>
<p>If you are done, please <a href="includes/logout.php">log out</a>.</p>
<p>You are currently logged <?php echo $logged ?>.</p>
-->
if (isset($_GET['error'])) {
echo '<p class="error">Error Logging In!</p>';
}
?>
<script type="text/JavaScript" src="js/sha512.js"></script>
<script type="text/JavaScript" src="js/forms.js"></script>
<form action="includes/process_login.php" method="post" name="login_form" class="loginform">
<table border="0" cellspacing="5px">
<tr>
<td>
Email:
</td>
<td>
<input type="text" name="email" />
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<input type="password" name="password" id="password" />
</td>
</tr>
<tr>
<td colspan="2">
<input type="button"
value="Login"
onclick="formhash(this.form, this.form.password);" />
</td>
</tr>
</table>
</form>
<!--
<p>If you don't have a login, please <a href="register.php">register</a></p>
<p>If you are done, please <a href="includes/logout.php">log out</a>.</p>
<p>You are currently logged <?php echo $logged ?>.</p>
-->
process_login.php
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
include_once 'db_connect.php';
include_once 'functions.php';
sec_session_start(); // Our custom secure way of starting a PHP session.
if (isset($_POST['email'], $_POST['p'])) {
$email = $_POST['email'];
$password = $_POST['p']; // The hashed password.
if (login($email, $password, $mysqli) == true) {
// Login success
echo 'Je bent nu ingelogd';
} else {
// Login failed
header('Location: ../index.php?error=1');
}
} else {
// The correct POST variables were not sent to this page.
echo 'Invalid Request';
}
?>
include_once 'db_connect.php';
include_once 'functions.php';
sec_session_start(); // Our custom secure way of starting a PHP session.
if (isset($_POST['email'], $_POST['p'])) {
$email = $_POST['email'];
$password = $_POST['p']; // The hashed password.
if (login($email, $password, $mysqli) == true) {
// Login success
echo 'Je bent nu ingelogd';
} else {
// Login failed
header('Location: ../index.php?error=1');
}
} else {
// The correct POST variables were not sent to this page.
echo 'Invalid Request';
}
?>
Gewijzigd op 03/02/2014 21:28:19 door johan de wit
Johan de wit op 03/02/2014 21:26:34:
Bij email heb je geen waarde staan en check je javascript.
Zou je het iets meer kunnen toelichten. Ik begrijp het niet goed. Dank