๐Ÿ”’ Closed Simple authentication for php

Status
Not open for further replies.
eto po yung auth.php
Code:
<?php
session_start();
if(!isset($_SESSION["usern"])){
header("Location: login.php");
exit(); }
?>
nilgay ko sa ` Index.php ko hind na ako maka pasok sa index
Baka di ka naman nag set ng session variable sa previous page?
 
lahat puba nang page need nang authentication?
Lahat ng page that needs proper auth before access must check if the user is logged in or not. That's when you need to access session variables. Session variable must be set after successful login so that you can check on every page if authentication is made before page access.
 
galito sir

12.webp 13.webp
 
You need to set a proper session variable to make it work. based on your code to process the login request, there's no code there that assigns a value to a session.
Try this one
1649059514592.webp

Put this code after switch(){...} structure.
Code:
$_SESSION["usern"] = $usern;
 
thru session, tapos conditions.

pag yung session ay di existing, use header or die(header("Location: asdasdsad.com")); do not use javascript.
 
Napagana mo na ba yung login ? Itry mo i echo yung $_SESSION["usern"] kung gumagana na yung session mo.

Naka-gawa kana ng database ?
eto po data base ko

lmaoqwe.webp database.webp

kapag yung folder lang po nilagay ko matik index po pasok
 

Attachments

  • qweqweqwe.webp
    qweqweqwe.webp
    124 KB · Views: 28
Status
Not open for further replies.

About this Thread

  • 13
    Replies
  • 572
    Views
  • 4
    Participants
Last reply from:
ribbit

Online now

Members online
946
Guests online
900
Total visitors
1,846

Forum statistics

Threads
2,276,301
Posts
28,969,047
Members
1,231,208
Latest member
phcFREDOMA
Back
Top