简体   繁体   中英

PHP file display blank page

I'm writing 'log in' script with this code:

blah blah
<?php
require_once("polaczenie.php");

$login=$_POST["email_post"];
$haslo=$_POST["haslo"];


$link=mysql_query("SELECT * FROM uzytkownicy WHERE email='$login'") or die(mysql_error());
$wiersz=mysql_fetch_array($link);

$login_baza=$wiersz["email"];
$haslo_baza=$wiersz["haslo"];

$imie=$wiersz["imie"];
$nazwisko=$wiersz["nazwisko"];
$adres=$wiersz["adres"];
$telefon=$wiersz["telefon"];
$nazwa_firmy=$wiersz["nazwa_firmy"];
$strona_www=$wiersz["strona_www"];
$typ_konta=$wiersz["typ_konta"];

if(($login_baza==$login)&($haslo_baza==$haslo)){
$_SESSION["zalogowany"] = 'ok';
$_SESSION["email"] = $login;
$_SESSION["imie"] = $imie;
$_SESSION["nazwisko"] = $nazwisko;
$_SESSION["adres"] = $adres;
$_SESSION["telefon"] = $telefon;
$_SESSION["nazwa_firmy"] = $nazwa_firmy;
$_SESSION["strona_www"] = $strona_www;
$_SESSION["typ_konta"] = $typ_konta;
echo 'ok';
} else {
echo 'no ok';
}
};

?>

Everything that I receive it blank page, even without 'blah blah' at the top. What is wrong with it? Anyway, thank you for your help ;)

if(($login_baza==$login)&($haslo_baza==$haslo)){

should be

if(($login_baza==$login) && ($haslo_baza==$haslo)){

Also make sure you have

session_start() on the top of the page !!

Also you have an extra } ; at the end

Maybe because your page doesn't display errors.

add this to your script :

<?php

error_reporting(E_ERROR | E_WARNING | E_PARSE);
ini_set('display_errors', 1);
//your script

you have some errors like :

if(($login_baza==$login)&($haslo_baza==$haslo))

should be :

if(($login_baza==$login) && ($haslo_baza==$haslo))

and there is no }; at the bottom.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM