PHP - Levels
ok im trying to create a admin panel but i want to be able to set what level of power they have how would i start i know that i have to use a enum
Similar TutorialsI just added a user log on for a site I am building using PHP. I used a simple session based system for this. I can log on just fine. What I am looking for is a way to pass on in ht session what rank a user is so some links/pages will only show for the admin or the super user but not the normal user. I rank the users as Admin 1, superuser 2, and user 3. This is what I have for the session in my header that allows you to be logged in. Code: [Select] <? session_start(); if(!session_is_registered(myusername)){ header("location:login.php"); } ?> Here is what I have that starts the session Code: [Select] //Connection stuff $query="SELECT * FROM user WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($query); $count=mysql_num_rows($result); if($count==1){ session_register("myusername"); session_register("mypassword"); header("location:index.php"); } else { echo "Wrong Username or Password"; } ob_end_flush(); ?> Happy Monday All! I am writing some code to try to pull in some XML from the TVA on lake levels. This file is updated about every 3 to 4 hours. I have the startings to pull the data in, but running into some problems. Here is a break down of the problems. I am fairly new to PHP, but trying to learn as I go. Any help would be greatly appreciated. The code I have will not pull in the data and display One I am able to display the code, I need to review the upsteam elevation and compare to the previous levels and show the lake rising, falling, or stable. Here is my code: Code: [Select] <?php $html = file_get_contents('http://www.tva.gov/lakes/xml/OHH_R.xml'); $xml = simplexml_load_file('$html'); echo $html->getName() . "<br />"; foreach($xml->children() as $child) { echo $child->getName() . ": " . $child . "<br />"; } ?> I am fairly new to PHP, but trying to learn as I go. Any help would be greatly appreciated. i know how to get my current directory, and the root path, but what i'm needing to do is find the levels of the current dir, for instance, if i'm in: domain.com/folder1 or if i'm in domain.com/folder1/folder2 or if i'm in domain.com/folder1/folder2/folder3 can someone help? thanks much GN Hi everyone ! I am stuck on a task which I'm sure has been achieved by several others in the past. I need to create a category table with unlimited / infinite levels (depths) of categories, sub-categories, sub-sub-categories, sub-sub-sub-categories and so on. I need to know how to show the category tree through PHP. An example would be great or even a link to another page where someone has laid out a step-by-step tutorial. Please help! Thank you very much! Kind Regards, Xeirus. I am working on this page concept of pedigree. How can I foreach or create a loop that can get 6 levels of parents, for example name= 1 ; nfather=2; nmohter = 3 and the loop continue to get or consider nfather as a name = 2 and get his parents. this is my table any help plees
CREATE TABLE horsetest01 (
CREATE INDEX horsetest01_index02
good evening folks, i have a question regarding the foreach syntax when needing to access something say 3 levels deep into the json architecture here's the example I'm trying to accomplish but when echoing it's not returning the value i need from 3 levels deep. I believe i just don't understand the correct syntax so here's the example any help would he sincerely appreciated.
https://pastebin.com/mEBiMUW5 When having different levels of directories, using relative paths will not work anymore, for example: controller - authentication File 1: include('../../model/header.php') model File 2: header.php view File 3. style.css The header.php file includes the css file with a relative path, but the problem is it includes it as follows: ../view/style.css When now the header.php file gets included into File 1 in the folder "authentication", then the css file will not be accessible anymore, for it to be accessible you would have to go two directories up. In this sense my question is, what would be the proper path structure for a folder structure with multiple levels? Should I rather use absolute paths, I am not so prone of absolute path. What if the folders changes a bit, or the domain changes, or the location changes? |