Jump to content
php.lv forumi

kartejais login.php


ziedinjsh

Recommended Posts

skatījos jau postus par login.php, bet vienalga nesaprotu kur ir problēma manējā!

if(isset($_POST['login'])){


$user_email = $_POST['user_email'];
$user_pass = md5($_POST['user_pass']);


$user_email = stripslashes($user_email);
$user_pass = stripslashes($user_pass);
$user_email = mysql_real_escape_string($user_email);
$user_pass = mysql_real_escape_string($user_pass);

$sql = "SELECT * FROM users WHERE user_email='$user_email' and user_pass='$user_pass'";
$result = mysql_query($sql);


$count = mysql_num_rows($result);


if($count==1){

$_SESSION['user_email'] = $user_email;




echo "<meta http-equiv='refresh' content='0;url=index.php'><img src='img/loader.gif'><br>";
}
else {
echo "<spna style='color:#ff0000;font-weight:bold;margin-bottom:10px;'>Nepareizs e-pasts un/vai parole!";
}
}

Link to comment
Share on other sites

nez, bet tu šiem

$user_email = $_POST['user_email'];
$user_pass = md5($_POST['user_pass']);


$user_email = stripslashes($user_email);
$user_pass = stripslashes($user_pass);
$user_email = mysql_real_escape_string($user_email);
$user_pass = mysql_real_escape_string($user_pass);

liec vienadus mainiigo nosaukumus. Tev tur manuprāt pietiktu tikai ar mysql_real_escape_string

un

tam ir jaiskatās tā

$user_email = mysql_real_escape_string($_POST['user_email']);
$user_pass = mysql_real_escape_string($_POST['user_pass']);
$pass_hash = md5($user_pass);
$sql = "SELECT * FROM users WHERE user_email='$user_email' and user_pass='$pass_hash'";

Edited by Vecteevs
Link to comment
Share on other sites

headera vietā es uzliku šo

<meta http-equiv='refresh' content='0;url=index.php'>

ja ielieku

header("Location:index.php");

 

tad ir Warning: Cannot modify header information - headers already sent by (output started at D:\WEB\xampp\htdocs\forums\header.php:138) in D:\WEB\xampp\htdocs\forums\login.php on line 27

Link to comment
Share on other sites

Ziedinjsh, tu vispār forumā uzturies?

Kā jau trilijons reižu pieminēti iemesli, kapēc met šo Brīdinājumu, kā arī, ja nemaldos pat bija pieknaģota viena saraksta par to.

Un to ielogošanos manuprāt vari iemest kādam kaķim bļodiņā, lai apēd viņu.

AGAIN AGAIN AND AGAIN - Power of future is ID !!!!!!!!

Izlasi, ko forSilance ( atvaino ja kļūdos par segvārdu ) ir teicis / prasījis / jautājis utml. par autorizācijas lietām.

 

Kungs dievs, manuprāt to ko briedis teica vienā sarakstē ( topikā ) par šo cilvēku, ir tomēr 100% taisnība.

Link to comment
Share on other sites

  • 1 year later...

Tu sesiju sāc tikai tad, kad tev ir errors. No kurienes tev scripts redzēs $_SESSION['user_email'] mainīgo, ja sesija nav atvērta?

 

session_start();
if(!isset($_SESSION['user_email'])){
include("login.php");
} else {
include("menu.php");
}

 

Un par headeriem paskaties šo pašu forumu, ir liels raksts par header already sent kā tats pirmais izceltais!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...