עבור לתוכן

הוספת אופצית זכור אותי בדף LOGIN בPHP

Featured Replies

פורסם

שלום

בניתי דף LOGIN בPHP שמעביר לסוג של דף צאט

הוא עובד אבל יש לי בעיה עם הזכור אותי הגדרתי את יצירת העוגיה אבל אני לא מצליח להגדיר את הדף הראשי לשימוש בעוגיה


<?php session_start();require_once 'function.php';$users = get_all_users();
if (isset($_REQUEST['remmember_me'])){setcookie("username",$_REQUEST['username'],time()+60*60*24*14);}}?> <html><head><title>login</title><link rel="stylesheet" type="text/css" href="css/style.css"></head><body> <?php $errors = array();if (isset($_SESSION['login'])){header('Location: index.php');break;}else{if (isset($_REQUEST['login'])){if ($_REQUEST['username'] == ""){$errors['username'] = "you did not enter username";}if ($_REQUEST['password'] == ""){$errors['password'] = "you did not enter password";}if((empty($errors['username']))||(empty($errors['password']))){if ((key_exists($_REQUEST['username'], $users)&&$users[$_REQUEST['username']] == $_REQUEST['password'])){$_SESSION['username'] = $_REQUEST['username']; header('Location: index.php');break;}else{$errors['key'] = "wrong username and/or password, please try again";}}}} ?><div class="welcom"><h2>welcom to My Chet please login:</h2><div class="login"><form method="post"><div class="username_box"><input type="text" name="username" placeholder="userName"></div><div class="password_box"><input type="password" name="password" placeholder="password"></div><input type="checkbox" name="remmember_me" >Remember me on this computer<div class="login_butten"><input type="submit" name="login" value="login"></div><div class="nut_a_member">Not singed-up yet <a href="singup.php">sing-up now</a></div><?php if(isset($errors['username'])){echo $errors['username'];} if(isset($errors['password'])){echo "" . $errors['password'];} if(isset($errors['key'])){echo "" . $errors['key'];} ?></form></div></div>
זה הLOGIN
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364<?php session_start();require_once 'function.php';$users = get_all_users();?> <html><head><title>My Chet</title><link rel="stylesheet" type="text/css" href="css/style.css"></head><body><div class="outside_box"> <?phpif (isset($_SESSION['username'])){require_once 'heder.php';require_once 'message.php';$_SESSION['message'] = $message; ?><div class="chet_erea"><div class="chet_erea_inside"><div class="My_Friends">My Friends <?php require_once 'my_friends.php'; ?><ul><?php foreach ($my_freinds as $friends => $value){?><li><?php echo $friends; ?> <a href="chat-page.php?friend=<?php echo $friends; ?>">send message</a></li><?php } ?></ul></div><div class="new_messege_outside"><div class="new_messages">you've got (X) new messages<div class="new_messages_inside"><a class="button" href="index.php">Check for new messages</a></div></div><div class="message_to_everyone">message to everyone <?php require_once 'send_to_all.php'; ?></div></div></div><div class="Last_conversation"><?php require_once 'last_conversation.php'; ?> </div></div><div class="Active_conversations">Active conversations:<?php require_once 'Active_conversations.php'; ?></div></div><?php }else{// send back to login header("Location:login.php");break;}?></body></html>זה האינדקסנערך לאחרונה ע"יBa4kEnd; אתמול ב-15:17

ניסיתי להוסיף את זה באינדקס


if(isset($_COOKIE['username']))
{
$_SESSION['username']= $_COOKIE['username'];
}

אבל זה לא עבד

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים