Webmaster Key - Discussion Forums


Welcome, Guest. Please login or register.
Did you miss your activation email?
February 08, 2012, 06:49:44 PM

Login with username, password and session length
Welceome to Forums!

Important information for guests and new members:

In order to understand the full benefits of becoming an active member of this forum, please review the following information on guest and new member restrictions. These forum changes have been prompted by an overwhelming and unreasonable amount of bot postings and incoherent guest spam messages. We wish to prevent these events from happening in the future and make our community a more comfortable place for all of our members.

For guests:

Guests are not allowed to open new topics, polls, or posts attachments.
If you wish to open up new discussions on this forum, we encourage you to register.

For new members:

New members with less than five posts are not allowed to modify additional profile information such as avatars, contact information, biographies, and signatures. However, new members are encouraged to post their own topics or reply to topics initiated by other members. Become active on the forums and 5 posts should be an easy task!

We are a diverse community with members from all over the world. We encourage new ideas and interesting conversation. Do not be afraid to post webmaster/computer-related questions or problems, as our active members are always willing to help when they are able. Interested? Join us.

+ Webmaster Key Forums
|-+ General Discussion
| |-+ Tech Corner
| | |-+ php login script
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Stumble Upon! Digg It! del.icio.us! Add to Technorati! ReddIt!  Send this topic Print
Author Topic: php login script  (Read 2130 times)
stu
Key Keeper
Member
**
Posts: 83



WWW
« on: November 06, 2008, 10:30:45 AM »

Hi all

Not been in for a while now. Been busy with work, kids and uni. I am after a little help with a php login script. i have download a login script, this one

http://www.modulatemedia.com/login.php

it seems to work very well so far and takes a few mins to implement. However i am very stuck on one part. The restricted page is the admin.php I want to add more pages to the restricted list but i just can not find were to add these. I woundered if someone would be so kind as to have a look for me. I know you are all busy and i wouldn't ask if i wasnt really stuck. I have implemented this on a website

http://www.web-application-development.info

which i am composing as a purely information website.

I really would be very greatfull if someone could look at this and explain in simple terms how i can restrict more than the admin page please. Also is there a point were i can state which users can access which pages.

Many thanks

stuart
Report to moderator   Logged

SensoVision
Administrator
Veteran
*****
Posts: 5 857


I'm proud user of Debian GNU/Linux OS


WWW
« Reply #1 on: November 06, 2008, 08:39:11 PM »

Hi Stu, don't worry about asking questions in worse case you may not get answer but it surely doesn't harm to anyone of us Smiley

I took quick glance to the admin page and it's look like that call to function for checking authorization is taking place here:
Code:
<?php
$MM_restrictGoTo 
"login.php";
if (!((isset(
$_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers$_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  
$MM_qsChar "?";
  
$MM_referrer $_SERVER['PHP_SELF'];
  if (
strpos($MM_restrictGoTo"?")) $MM_qsChar "&";
  if (isset(
$QUERY_STRING) && strlen($QUERY_STRING) > 0
  
$MM_referrer .= "?" $QUERY_STRING;
  
$MM_restrictGoTo $MM_restrictGoTo$MM_qsChar "accesscheck=" urlencode($MM_referrer);
  
header("Location: "$MM_restrictGoTo); 
  exit;
}
?>
but unless you move function isAuthorized and all variables required for it to separate file which include each time, it's would be safe IMHO to include all PHP code which goes from beginning until doctype part:
"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">"

Try this by just pasting it before your HTML code on other page and let us know if it's work
Report to moderator   Logged

Denis
stu
Key Keeper
Member
**
Posts: 83



WWW
« Reply #2 on: November 06, 2008, 09:18:56 PM »

Hi

I had tried copying the contents of the php script from the top of the admin page (This is the page that is protected with the script). Then created all other pages from this templet. put they didnt work. Dont know why. i have just dont this again and it works fine.

Thank you.

Did you look at the website i created? is that were you got the code or the other link i posted?

http://www.web-application-development.info

I originaly built this website a few weeks ago as a refrence for my uni work. Then realised it was pretty usefull and that others learng such scripts may benifit from it. The google adds at the side are there to cover the cost of the website, but i am happy to maintain it. It is very helpfull to me.

The password protection script is thier to protect the admin page which is for me. In there i have created working examples of these scripts that i will implement for users to try but i have the admin pages to create and drop database tables. I have created php forms that can create database tables at a click of a button, fill the tables, populate them and drop them. considering i couldnt do php two weeks ago.

What would the php syntax be to

display all colloms in a table. (say i dont know what colloms are there)

add new colloms to a table

The type of coding i some what understand so far is below. A quick example


<?php
$conn = mysql_connect("localhost", "username", "password");
mysql_select_db("your database",$conn);

$sql = "INSERT INTO testtable values ('','data to add to table')";

if (mysql_query($sql, $conn)) {

echo "record added!";
} else {
echo "somthing went wrong";
}

?>


Thank you

Stuart
Report to moderator   Logged

Pages: [1] Go Up Stumble Upon! Digg It! del.icio.us! Add to Technorati! ReddIt!  Send this topic Print 
+ Webmaster Key Forums
|-+ General Discussion
| |-+ Tech Corner
| | |-+ php login script

Jump to:  
« previous next »


Our Partners
RelmaxTOP Ranking System Web Hosting RelmaxTOP Ranking System
Staff Sites
12Noon[12Noon Gallery] Andy[Urgentclick]
Tamuril[Tamuril's Digital Art Exhibit] Sensovision
Powered by MySQL Powered by PHP We are hosted by Relmax Inc. |Our Privacy Policy | Sitemap
Powered by SMF 1.1.9 | SMF © 2006-2009, Simple Machines LLC
Forum design by Tamuril © 2005.
Valid XHTML 1.0! Valid CSS!