Atom.CMS icon indicating copy to clipboard operation
Atom.CMS copied to clipboard

Notice: Undefined index: username in D:\programing\xampp\htdocs\brackets\admin\config\setup.php

Open alhadidy opened this issue 9 years ago • 5 comments

when logout the value of $_SESSION become Undefined in setup file where the function of $data_user is and that is obvious cuz i just unset it be logging out but the error is there hope i find help here...

alhadidy avatar Jun 14 '16 01:06 alhadidy

Ok, just post your code here (setup.php is the only one necessary) and I'll find the error and give you a solution :P If the code looks messy use http://pastebin.com/

creptor avatar Jun 14 '16 04:06 creptor

`<?php

#database connection include('../config/connection.php');

#functions include('functions/data.php'); include('functions/template.php');

#constants DEFINE('D_TEMPLATE', 'template');

#site setup $debug = data_settengs_value($dbCon, 'debug-status');

#default id for the url if(isset($_GET['page'])) { $pageid = $_GET['page']; } else { $pageid = 1; }

#page setup $page = data_page($dbCon, $pageid);

#user info setup $user = data_user($dbCon, $_SESSION['username']); ?>`

this is my code, thank you for your help :)

alhadidy avatar Jun 14 '16 13:06 alhadidy

Well it's actually very simple.

Just place this on the part where you call the user function (#user info setup):

if(isset($_SESSION['username'])&&!empty($_SESSION['username'])){
    $user = data_user($dbCon, $_SESSION['username']);
}

I can't check the code because I'm on my phone, but it should work (and be correctly written). You should add something similar to the outputs too.

creptor avatar Jun 14 '16 22:06 creptor

That basically checks if the username exists, and that is valid 😉

creptor avatar Jun 14 '16 22:06 creptor

thank you very much :), actually it's my first course of coding, i have just started learning php from youtube.. @creptor

alhadidy avatar Jun 14 '16 23:06 alhadidy