se7enet purgatorio

Page 1 of 1 1
Topic Options
Rate This Topic
#17951 - 08/20/08 01:11 PM admin panel (help)
Anu
Malt-o-Meal


Registered: 08/17/08
Posts: 13

Offline
I have been working on an admin panel to create towns and such, and the only problem that I've run into is making it admin only. I tried
 Code:
if ($userrow["id"] = 1) {
trying to limit it to only a specified id, to no effect.

I am sorry for what seems to me like a small hurdle to cross, but after looking through the code, that is all I could find. I'm still trying to figure it out though, but I wouldn't mind someone throwing info my way.

Please, do not tell me how to do it, but suggest the proper syntax. I suppose I would learn either way, but the idea is that I figure it out :X


Edited by Anu (08/20/08 04:58 PM)
_________________________
I've got a lovely bunch of $error's. There just-a standin' in my code. Big one's, small ones, some as big as that error threaaaaad. Doodley doodley doot.

Top
#17952 - 08/20/08 05:23 PM Re: admin panel (help) [Re: Anu]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
You just assigned the id variable to 1. To block access only to administrators you'd use not equal to.

if ($userrow["authlevel"] != "1") {
display("<p>Only Administrators can access the control panel.<br><br>You may now return to <a href=\"index.php\">town</a>.", "Error");
}


Or to limit it for the owners account only, meaning you. ID 1 it would be.....

if ($userrow["id"] != "1") {
display("<p>Only Administrators can access the control panel.<br><br>You may now return to <a href=\"index.php\">town</a>.", "Error");
}
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
#17957 - 08/20/08 07:46 PM Re: admin panel (help) [Re: Fayt]
Anu
Malt-o-Meal


Registered: 08/17/08
Posts: 13

Offline
Worked like a charm. Now to get the rest sorted out, hopefully I'm not the only one wanting something like this.
_________________________
I've got a lovely bunch of $error's. There just-a standin' in my code. Big one's, small ones, some as big as that error threaaaaad. Doodley doodley doot.

Top
#17958 - 08/20/08 08:12 PM Re: admin panel (help) [Re: Anu]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
Yep, post if you need more help.
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
#17963 - 08/21/08 08:28 AM Re: admin panel (help) [Re: Fayt]
Anu
Malt-o-Meal


Registered: 08/17/08
Posts: 13

Offline
About 33.3% done. Man I code slow, heheh.
_________________________
I've got a lovely bunch of $error's. There just-a standin' in my code. Big one's, small ones, some as big as that error threaaaaad. Doodley doodley doot.

Top
#17964 - 08/21/08 09:06 AM Re: admin panel (help) [Re: Anu]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
Fully test it before releasing.
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
#17965 - 08/21/08 07:10 PM Re: admin panel (help) [Re: Fayt]
Anu
Malt-o-Meal


Registered: 08/17/08
Posts: 13

Offline
Oh I am, that's why it's taking me longer. Debugging every part as I go. But it's a pretty simple script, just need to stay concise with which db the info is going in, and what's being inserted. No worries, I wouldn't release something with bugs or errors. That's just ignorant.
_________________________
I've got a lovely bunch of $error's. There just-a standin' in my code. Big one's, small ones, some as big as that error threaaaaad. Doodley doodley doot.

Top
#17967 - 08/21/08 09:12 PM Re: admin panel (help) [Re: Anu]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
Ok cool
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
#17975 - 08/22/08 10:07 AM Re: admin panel (help) [Re: Fayt]
Anu
Malt-o-Meal


Registered: 08/17/08
Posts: 13

Offline
I'm having some issues getting a query to select and echo current table data. I'm not so good with those. Here's what i've been trying at so far-

 Code:
$sql = doquery('SELECT `id`, `name`, `unique`, `willdrop` FROM <<itemsuffixes>>');

mysql_select_db('ds');
$retval = mysql_query( $sql );
if(! $retval )
{
  die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_array($retval))
{
    echo "ID :{$row['id']}  <br> ".
         "Name: {$row['name']} <br> ".
         "Unique: {$row['unique']} <br> ".
         "Willdrop: {$row['willdrop']} <br> ".
         "<br>";
} 
echo "Fetched data successfully\n";


This is an attempt to show the admin what's already in the tables, to improve accuracy and prevent repeats. Also as a guide for people who don't know what a value should be.
_________________________
I've got a lovely bunch of $error's. There just-a standin' in my code. Big one's, small ones, some as big as that error threaaaaad. Doodley doodley doot.

Top
#17976 - 08/22/08 05:45 PM Re: admin panel (help) [Re: Anu]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
I refuse to help you now, because you call me an Asshole and show me disrespect even tho I was quite nice to you.
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
#17978 - 08/23/08 10:00 AM Re: admin panel (help) [Re: Fayt]
Anu
Malt-o-Meal


Registered: 08/17/08
Posts: 13

Offline
Wow dude, it was a joke. Im sorry. Really.

Edited by Anu (08/23/08 10:11 AM)
_________________________
I've got a lovely bunch of $error's. There just-a standin' in my code. Big one's, small ones, some as big as that error threaaaaad. Doodley doodley doot.

Top
#18004 - 08/25/08 06:29 PM Re: admin panel (help) [Re: Fayt]
AnmanIndustries
Cookie Crisp
*****

Registered: 03/21/05
Posts: 2876
Loc: Planet Stupid, AKA Earth

Offline
 Originally Posted By: Fayt
I refuse to help you now, because you call me an Asshole and show me disrespect even tho I was quite nice to you.


You are an asshole though. Proof RIGHT there.

But just in case youre not convinced:
http://www.thebestpageintheuniverse.net/c.cgi?u=ahtest
_________________________
If you want me to punch you in the nuts go to:
http://www.AnmanIndustries.com

I'll do it for free too. Enjoy.

Top
#18005 - 08/25/08 08:28 PM Re: admin panel (help) [Re: AnmanIndustries]
Fayt
Crunchberries
***

Registered: 11/08/05
Posts: 1131
Loc: My Computer, USA

Offline
Your a dickwad so thats proof right there.
_________________________
MasterFayt - Amara 5 - Manas - Banar

Top
#18006 - 08/26/08 12:17 AM Re: admin panel (help) [Re: Fayt]
AnmanIndustries
Cookie Crisp
*****

Registered: 03/21/05
Posts: 2876
Loc: Planet Stupid, AKA Earth

Offline
... Yes.
_________________________
If you want me to punch you in the nuts go to:
http://www.AnmanIndustries.com

I'll do it for free too. Enjoy.

Top
Page 1 of 1 1


Hop to:

se7enet

Barack Obama Logo