The real definition of windows 9x: A number of 32-bit extensions of a 16-bit shell for an 8-bit OS, made for a 4-bit computer by a 2-bit company who can't stand 1-bit of competition.
En daarbij, session is met 3 s'en
[ Voor 46% gewijzigd door Rashann op 04-12-2002 12:08 ]
If nothing is written below, I was the last to reply...
als ik die pagina's wil inculden in index.php dan vreet die dat niet.
session header already send, cant set cash limieter ofzow
[ Voor 14% gewijzigd door Alpha_Mouse op 04-12-2002 12:11 ]
The real definition of windows 9x: A number of 32-bit extensions of a 16-bit shell for an 8-bit OS, made for a 4-bit computer by a 2-bit company who can't stand 1-bit of competition.
Dat wil zeggen dat er al data verstuurd is naar de client. Je moet dus zorgen voordat je voor je session_start aanroept, geen echo's, print's of gewone HTML-code heb staan!Alpha_Mouse schreef op 04 december 2002 @ 12:10:
nou... heb een include scriptje in index.php waarin ik dus mijn pagina's laad. hier is een pagina die inloggen heet en die ook weer pagina include plus een session start.
als ik die pagina's wil inculden in index.php dan vreet die dat niet.
session header already send, cant set cash limieter ofzow
Brusselmans: "Continuïteit bestaat niet, tenzij in zinloze vorm. Iets wat continu is, is obsessief, dus ziekelijk, dus oninteressant, dus zinloos."
index.php
...
<?
if (!$page) $page = "home";
if (file_exists("includes/$page.php")) {
include("includes/$page.php");
} else {
print "404";
}
?>
...
signup.php
<h2 align=center>User Signup</h2>
<?php
include("config.php");
$connect = mysql_connect("$user_hostname", "$user_username", "$user_password");
mysql_select_db("$user_database", $connect);
$sql = "SELECT * FROM users WHERE username = \"$username\"";
$result = @mysql_query($sql) or die("No.");
$num = mysql_num_rows($result);
if(!$submit) {
echo "<form method=\"POST\" action=$PHP_SELF>
<center>
<table>
<tr>
<td>First Name:</td>
<td><input type=\"text\" name=\"fname\" size=\"20\"></td>
</tr>
<tr>
<td>Last Name:</td>
<td><input type=\"text\" name=\"lname\" size=\"20\"></td>
</tr>
<tr>
<td>Username:</td>
<td><input type=\"text\" name=\"username\" size=\"20\"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type=\"password\" name=\"password\" size=\"20\"></td>
</tr>
</table>
<p><input type=\"submit\" value=\"Submit\" name=\"submit\"></p>
</center>
</form>";
} else if($submit && empty($fname) && empty($lname) && empty($username) && empty($username)) {
echo "<center>You need to enter all the fields</center>";
} else if($num == "1") {
echo "<center>The username is already registered, please try another.</center>";
} else if($submit && !empty($fname) && !empty($lname) && !empty($username) && !empty($username) && $num == "0") {
$insert = "INSERT INTO users VALUES ('', '$fname', '$lname', '$username', '$password')";
$insert_res = @mysql_query($insert) or die("No.");
echo "<h2 align=center>You successfully added the username $username.</h2>";
}
mysql_close($connect);
?>
config.php
database login
include.php (deze is nodig voor de inlog page)
<?php
include("config.php");
$connect = mysql_connect("$user_hostname", "$user_username", "$user_password");
mysql_select_db("$user_database", $connect);
session_start();
if(!isset($username)) {
echo "<form method=\"POST\" action=$PHP_SELF>
<center>
<table>
<tr>
<td>Username:</td>
<td><input type=\"text\" name=\"username\" size=\"20\"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type=\"password\" name=\"password\" size=\"20\"></td>
</tr>
<tr>
<td colspan=\"2\">
<p align=\"center\"><input type=\"submit\" value=\"Submit\" name=\"submit\"></td>
</tr>
</table>
</center>
</form>";
exit;
}
session_register("username");
session_register("password");
$sql = "SELECT * FROM users WHERE username = \"$username\" AND password = \"$password\"";
$result = @mysql_query($sql) or die("No.");
if(mysql_num_rows($result) == "0") {
session_unregister("username");
session_unregister("password");
echo "<h2 align=center>Wrong username and password, try again</h2>";
exit;
}
$username = mysql_result($result,0,"username");
mysql_close($connect);
?>
The real definition of windows 9x: A number of 32-bit extensions of a 16-bit shell for an 8-bit OS, made for a 4-bit computer by a 2-bit company who can't stand 1-bit of competition.
If nothing is written below, I was the last to reply...
in signup.php schrijf je al je <h3> tag weg, en daarna include je de pagina waarin je je sessie start, dat werkt dus niet!
Brusselmans: "Continuïteit bestaat niet, tenzij in zinloze vorm. Iets wat continu is, is obsessief, dus ziekelijk, dus oninteressant, dus zinloos."
Output bufferen of session_start naar boven trekken.
Music is the pleasure the human mind experiences from counting without being aware that it is counting
~ Gottfried Leibniz
Dit topic is gesloten.
![]()