Doorsturen bij form
maar nu stuurt ie niet door maar krijgt ie echo's.
Ik wil hem laten doorsturen maar ik heb nog niet zo veel verstand van php.
DIT IS DE CODE:
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
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
<?
############################################
# Filename : INDEX.PHP #
#------------------------------------------#
# Written By : Dennis van den Hout #
# Email : [email protected] #
# Website : www.scripters.nl #
# Questions? : www.scripters.nl/forum #
#------------------------------------------#
# Editing source is allowed, unless you #
# give it to other users #
#------------------------------------------#
############################################
error_reporting(E_ALL);
session_start();
include("config.php");
include("functions.php");
if(!isset($_COOKIE['last_active']))
{
if(isset($_SESSION['user_id']))
{
mysql_query("UPDATE tbl_users SET user_lastactive = NOW() WHERE user_id = '" . $_SESSION['user_id'] . "'") or die(mysql_error());
setcookie("last_active",true,time()+5);
}
}
if(!isset($_SESSION['user_id']))
{
if(isset($_POST['login']))
{
$query = mysql_query("SELECT * FROM tbl_users WHERE user_name = '" . $_POST['user'] . "' AND user_pass = '" . md5($_POST['pass']) . "'");
$result = mysql_num_rows($query);
if(empty($result))
{
echo "<script>alert('Login Incorrect.'); document.location.href=('index.php')</script>";
}
else
{
while($row = mysql_fetch_assoc($query))
{
$user_id = $row['user_id'];
}
header("Location: index.php");
$_SESSION['user_id'] = $user_id;
}
}
else
{
?>
############################################
# Filename : INDEX.PHP #
#------------------------------------------#
# Written By : Dennis van den Hout #
# Email : [email protected] #
# Website : www.scripters.nl #
# Questions? : www.scripters.nl/forum #
#------------------------------------------#
# Editing source is allowed, unless you #
# give it to other users #
#------------------------------------------#
############################################
error_reporting(E_ALL);
session_start();
include("config.php");
include("functions.php");
if(!isset($_COOKIE['last_active']))
{
if(isset($_SESSION['user_id']))
{
mysql_query("UPDATE tbl_users SET user_lastactive = NOW() WHERE user_id = '" . $_SESSION['user_id'] . "'") or die(mysql_error());
setcookie("last_active",true,time()+5);
}
}
if(!isset($_SESSION['user_id']))
{
if(isset($_POST['login']))
{
$query = mysql_query("SELECT * FROM tbl_users WHERE user_name = '" . $_POST['user'] . "' AND user_pass = '" . md5($_POST['pass']) . "'");
$result = mysql_num_rows($query);
if(empty($result))
{
echo "<script>alert('Login Incorrect.'); document.location.href=('index.php')</script>";
}
else
{
while($row = mysql_fetch_assoc($query))
{
$user_id = $row['user_id'];
}
header("Location: index.php");
$_SESSION['user_id'] = $user_id;
}
}
else
{
?>
<h1></h1>
<form method="POST">
<img src="../images/login.bmp" width="803" height="70">
<p><font size="6" face="Arial, Helvetica, sans-serif">Login </font></p>
<p> <font face="Arial, Helvetica, sans-serif">
<input type="hidden" value="1" name="login">
</font></p>
<p><font face="Arial, Helvetica, sans-serif">Gebruikersnaam</font><font face="Arial, Helvetica, sans-serif">
:
<input type="text" name="user" maxlength="15">
<br>
Wachtwoord :
<input type="password" name="pass" maxlength="15">
<br>
<br>
<input type="Submit" value="Login">
<br>
<br>
<img src="icons/register.gif"> <a href="Voorwaarden.php">Registreer</a><br>
<img src="icons/memberlist.gif"> <a href="memberlist.php">Ledenlijst</a></font></p>
<font face="Arial, Helvetica, sans-serif">
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
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
<?
}
}
else
{
$query = mysql_query("SELECT * FROM tbl_users WHERE user_id = '" . $_SESSION['user_id'] . "'");
while($row = mysql_fetch_assoc($query))
{
echo "Username : <b>" . $row['user_name']. "</b>";
if($row['user_pm'])
{
$msg = mysql_result(mysql_query("SELECT COUNT(1) FROM tbl_msg WHERE msg_to = '" . $_SESSION['user_id'] . "'"),0);
if(empty($msg))
{
$msg = "<font color=\"#008000\">Empty</font>";
}
elseif($msg >= $cfg['max_msg'])
{
$msg = "<font color=\"#FF0000\">FULL</font>";
}
else
{
$msg = $msg . " / " . $cfg['max_msg'];
}
echo "<br>\n";
echo "Inbox : <b>". $msg ."</b> ( <a href=\"msg.php?act=inbox\">Open</a> )";
}
}
echo "<br>\n<br>\n";
if(isset($_SESSION['admin_login']))
{
echo "<img src=\"icons/admin.gif\"> <a href=\"admin.php\">Admin Page</a>";
echo "<br>\n";
}
echo "<img src=\"icons/memberlist.gif\"> <a href=\"memberlist.php\">Memberlist</a>";
echo "<br>\n";
echo "<img src=\"icons/profile.gif\"> <a href=\"profile.php?act=edit_profile\">Change Profile</a>";
echo "<br>\n";
echo "<img src=\"icons/profile.gif\"> <a href=\"profile.php?act=view&user_id=" . $_SESSION['user_id'] . "\">My Profile</a>";
echo "<br>\n";
echo "<img src=\"icons/logoff.gif\"> <a href=\"logoff.php\">Log Off</a>";
}
?>
}
}
else
{
$query = mysql_query("SELECT * FROM tbl_users WHERE user_id = '" . $_SESSION['user_id'] . "'");
while($row = mysql_fetch_assoc($query))
{
echo "Username : <b>" . $row['user_name']. "</b>";
if($row['user_pm'])
{
$msg = mysql_result(mysql_query("SELECT COUNT(1) FROM tbl_msg WHERE msg_to = '" . $_SESSION['user_id'] . "'"),0);
if(empty($msg))
{
$msg = "<font color=\"#008000\">Empty</font>";
}
elseif($msg >= $cfg['max_msg'])
{
$msg = "<font color=\"#FF0000\">FULL</font>";
}
else
{
$msg = $msg . " / " . $cfg['max_msg'];
}
echo "<br>\n";
echo "Inbox : <b>". $msg ."</b> ( <a href=\"msg.php?act=inbox\">Open</a> )";
}
}
echo "<br>\n<br>\n";
if(isset($_SESSION['admin_login']))
{
echo "<img src=\"icons/admin.gif\"> <a href=\"admin.php\">Admin Page</a>";
echo "<br>\n";
}
echo "<img src=\"icons/memberlist.gif\"> <a href=\"memberlist.php\">Memberlist</a>";
echo "<br>\n";
echo "<img src=\"icons/profile.gif\"> <a href=\"profile.php?act=edit_profile\">Change Profile</a>";
echo "<br>\n";
echo "<img src=\"icons/profile.gif\"> <a href=\"profile.php?act=view&user_id=" . $_SESSION['user_id'] . "\">My Profile</a>";
echo "<br>\n";
echo "<img src=\"icons/logoff.gif\"> <a href=\"logoff.php\">Log Off</a>";
}
?>
</font>
Doorsturen kan met een header [1], met HTML [2] of met JavaScript [3].
[1] http://www.phphulp.nl/php/tutorials/4/138
[2] http://www.w3schools.com/html/tryit.asp?filename=tryhtml_redirect
[3] http://www.javascript-2.com/redirect.html
Elwin
[Edit: Typo's]
Gewijzigd op 31/05/2004 15:11:00 door Elwin - Fratsloos