🔒 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: 29
Status
Not open for further replies.

About this Thread

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

Trending Topics

Online now

Members online
381
Guests online
976
Total visitors
1,357

Forum statistics

Threads
2,286,940
Posts
29,041,315
Members
1,217,274
Latest member
scrapersam
Back
Top