sesion starten in een sesion (PHP)

Pagina: 1
Acties:
  • 40 views sinds 30-01-2008

  • Alpha_Mouse
  • Registratie: Januari 2002
  • Laatst online: 16-02-2022
session starten in een session hoe doe ik dit...? ik heb al meerdere keren geprobeerd maar hij geeft tekens fout meldingen

www.php.net maakt mij niet wijzer.

Kan iemand me helpen met dit probleem?

[ Voor 1% gewijzigd door Alpha_Mouse op 04-12-2002 12:09 . Reden: sss ]

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.


Verwijderd

Waarom zou je dat willen doen???

  • Rashann
  • Registratie: Maart 2000
  • Laatst online: 24-08 07:20

Rashann

Zoek de hond...

Kan je je probleem niet gewoon met verschillende waardes binnen 1 sessie oplossen?

offtopic:
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...


  • Alpha_Mouse
  • Registratie: Januari 2002
  • Laatst online: 16-02-2022
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 :S

[ 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.


  • thomaske
  • Registratie: Juni 2000
  • Laatst online: 14-07 14:28

thomaske

» » » » » »

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 :S
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!

Brusselmans: "Continuïteit bestaat niet, tenzij in zinloze vorm. Iets wat continu is, is obsessief, dus ziekelijk, dus oninteressant, dus zinloos."


  • Alpha_Mouse
  • Registratie: Januari 2002
  • Laatst online: 16-02-2022
dat snap ik... maar als ik die pagina wil includen dan staat er toch standaard al iets boven?

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.


  • Alpha_Mouse
  • Registratie: Januari 2002
  • Laatst online: 16-02-2022
wat gaat hier dan fout als ik signup.php aan roep?

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.


  • Rashann
  • Registratie: Maart 2000
  • Laatst online: 24-08 07:20

Rashann

Zoek de hond...

Zou je even de aparte bestanden in aparte [php] tags willen zetten, zo is het best lastig te lezen...

If nothing is written below, I was the last to reply...


  • thomaske
  • Registratie: Juni 2000
  • Laatst online: 14-07 14:28

thomaske

» » » » » »

• gebruik [php]-tags!

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."


  • drm
  • Registratie: Februari 2001
  • Laatst online: 09-06-2025

drm

f0pc0dert

manual werk.

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

Pagina: 1

Dit topic is gesloten.