I want to get the name of the person and the emailadress, to be stored in $_SESSION('name') or something.
I'm quite new to php, so please try to explain carefully... I've read through the whole $_SESSION() explanation
Code: Select all
<?php
session_start();
$_SESSION["email"] = $email;
$_SESSION["wachtwoord"] = $wachtwoord;
$_SESSION["name"] = $row['name'];
if (isset($_POST['actie'])) {
$emailadres = $_POST['e'];
$paswoord = $_POST['w'];
$emailadres = strip_tags($emailadres);
$paswoord = strip_tags($paswoord);
$paswoord = trim($paswoord);
$emailadres = trim($emailadres);
$melding = "give in a good emailadress";
if (strlen($emailadres) > 50) {
$melding = "wrong adress ";}
else {
require_once('is_email.inc.php');
if (is_email($emailadres)) {
$actie = $_POST['actie'];
if ($actie === "Login" ) {
if ($actie == "Login") {
$sql = "SELECT * FROM users WHERE email='" . $_POST["e"] ."' AND password='". $_POST["w"]. "'";
}
require_once('mysql_connect.inc.php');
$verbinding = mysql_connect(MYSQL_SERVER, MYSQL_GEBRUIKERSNAAM, MYSQL_WACHTWOORD) or die("Verbinding mislukt: " . mysql_error());
mysql_select_db("users") or die("couldn't open: " . mysql_error());
// Query zonder resultaatset uitvoeren:
$result = mysql_query($sql) or die("Query failed: " . mysql_error());
$row=mysql_fetch_array($result);
if(!empty($row)){
$email = $_POST["e"];
$password = $_POST["w"];
header("Location: upload.php");
exit(); } }
if(empty($row)){
$melding = "blablabla, you have to register and stuff";}
mysql_close($verbinding);}
else {
$emailadres = htmlentities($emailadres, ENT_QUOTES);
if (strlen($emailadres) < 1) {
$melding = "input an email ";}
else {
$melding = "this email isn't legit ";
$melding .= "type another emailadress";}}}}
else {
$emailadres = "";
$melding = "input legit pass and email";}
?>