Changing you Sessions saved;

Status
Not open for further replies.

nwmappcr

New Member
Messages
2
Reaction score
0
Points
1
EDIT: I fixed my issues, please ignore.


I had to ;

  1. Make the .html document page into a .php
  2. I missing a ?> my .html (now .php doc)
  3. I changed my sessions to be just /tmp (even tho i dont see the session being created there, they are working)
Thanks!@




===============================


Hello,

I'm trying to get _SESSIONS working with my website in order to stop people from by-passing my login page but have had no luck.

This page is accessible without logging in:
http://nwmap.pcriot.com/BlackPad_NewMap_sessions.html

This is my login page:
http://nwmap.pcriot.com/htdocs/login5_sessions/login.php


You can log into the login.php with to test;
tester1
tester1

I've setup the proper mysql DB +calls, its limiting login successfully at the front end, so if you make a new account you cannot login until I manually change a boolean in the DB,



Inside my process_login.php I set a session;
Code:
// At the top of the page
<?php
    if (isset($_POST['login-submit']))
    {
        // Include config file
        require_once 'config.php';
          // include("config.php");
          session_start();


//Inside my If/Else statement checking user login with DB

else if ($row['username'] == $username && $pwdCheck == true && $row['loginboolean'] == $loginboolean) {
            echo "Login successful!";
        
            $_SESSION['userName'] = $username;
            //Go to map here
            header("Location: ../../../BlackPad_NewMap_sessions.html");
            exit();

        
        }



Now on the top of BlackPad_NewMap_sessions.html I have;
Code:
<?php
session_start();
if (!isset($_SESSION['userName']))
{
    header("Location: /htdocs/login5_sessions/login.php");
    die();  //Tried both neither work
    //exit();  //Tried both neither work
}
else
{
//Show page contents

All of my .php pages (excluding the process_ ones) have session_Start(); on the top.


Some notes from researching on this community and on google;
  1. Does my login page need to be in the root and the hidden pages need to be nested into deeper sub folders?
  2. I tried changing the php.ini via the cPanel, specifically the session.save_path from what it was, to tmp folder inside my website, but no luck. I also have no way to revert it back to default (dumb me, I forgot to write down what the default was).

EDIT:------------
I Turned on display_errors in the cPanel and now because I've changed my session directory to a new locaiton, its unable to save the session at all.

What is the default directory?

Code:
Warning: session_start(): open(/dir/tmp/sess_54f9cd56e9518cbec3759baf5283b31a, O_RDWR) failed: No such file or directory (2) in /home/nwmappcr/public_html/htdocs/login5_sessions/login.php on line 2

Warning: session_start(): Failed to read session data: files (path: /dir/tmp) in /home/nwmappcr/public_html/htdocs/login5_sessions/login.php on line 2


I also think it may be because I'm trying to check the session on an HTML page? Should I leave it .HTML or change the entire page to .PHP and just add my 'isset_check' along the top?


end-edit:------------




Any tips or help would be greatly appreciated.



Thank you
 
Last edited:
Status
Not open for further replies.
Top