thedigicraft / Atom.CMS

Atom.CMS
56 stars 52 forks source link

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

Open alhadidy opened 8 years ago

alhadidy commented 8 years ago

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...

creptor commented 8 years ago

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/

alhadidy commented 8 years ago

`<?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 :)

creptor commented 8 years ago

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 commented 8 years ago

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

alhadidy commented 8 years ago

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