Jump to content
php.lv forumi

nesanāk ielogoties


ziedinjsh

Recommended Posts

jā tikoes arī par to aizdomājos.. pieliku session_start(); un aizgāja

 

Paldies! :)

 

uztaisīju logout.php bet bet kad meoģinu izlogoties parāda šādu Warning: session_destroy() [function.session-destroy]: Trying to destroy uninitialized session in /home/produc/public_html/mp3/1/logout.php on line 2

 

Warning: Cannot modify header information - headers already sent by (output started at /home/produc/public_html/mp3/1/logout.php:2) in /home/produc/public_html/mp3/1/logout.php on line 3

 

logout.php:

<?php
session_destroy();
header("Location:index.php");
?>

betman liekas, ka kkas trūkst :D

 

un kāds varētu izskatīties kods kurš atpazīst vai ir ielogojies vai nē.. piem man ir šādi:

<div id='left'>
include "login.php";

include "profile.php";

</div>

protams, ka rādīsies abi divi, bet kā varētu panāk sādu efektu:

<div id='left'>

if(member){
include "profile.php";
}else{
include "login.php";
}

Edited by ziedinjsh
Link to comment
Share on other sites

es jau štukoju.. mošk kodā nav kaut kas vai arī ar seozām :?

<?php

$status = (isset($_GET['status'])) ? $_GET['status'] : '';

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

$email = strip_tags($_POST['email']);
$password = strip_tags($_POST['password']);

$query = sprintf("SELECT ID FROM users WHERE email = '%s' AND password =  '%s' LIMIT 1;", mysql_real_escape_string($email), md5($password));
$result = mysql_query($query) or die(mysql_error);
if(mysql_num_rows($result) != 1){ 

echo "<span style='color:#ff0000'>bad login</span>";

}else{
$row = mysql_fetch_assoc($result);

$_SESSION['user_ID'] = $row['ID'];

}
}

echo "<form method='post' action='".$_SERVER['PHP_SELF']."'>";
echo "<table><tr>";
echo "<td>email</td><td><input type='text' name='email'></td>";
echo "</tr><tr>";
echo "<td>password</td><td><input type='password' name='password'></td>";
echo "</tr><tr>";
echo "<td></td><td><input type='submit' name='login' value='Login'></td>";
echo "</tr><tr>";
echo "<td><a href='register.php'>Register?</a></td><td><a href='lost.php'>Lost password?</a></td>";
echo "</tr></table>";


?>

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