Jump to content

Please help!!! Admin pages


soupy127

Recommended Posts

Hi trying to create an admin script that uses sessions, so that i can call this script so that the pages can only be viewed by admins.

Here is my script so far and i keep getting error on line 13 :( please help im not very good at php.

 

<?php

 

//session start and get variable

session_start();

$username = $_SESSION['username'];

 

//connect to database

$connect = mysql_connect("localhost","root","") or die ("sorry couldn't connect");

 

mysql_select_db("duffers") or die("couldnt connect");

 

$get = mysql_query("SELECT * FROM users WHERE username='$username'")

while ($row = mysql_fetch_assoc($get))

{

$admin = $row['admin'];

}

if ($admin==0)

die("Your Not an Admin!");

?>

 

Any help would be greatly appreciated

thanks

Link to comment
https://forums.phpfreaks.com/topic/199306-please-help-admin-pages/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.