# MySQL & PHP Login Script



## support.clpafs (Apr 7, 2008)

Hi,

I am trying to build a login script that would be hosted on secure.clpafsk12.net.

The thing is I would like to have pages on our other domains and sub-domains to restrict access according to the users account in the MySQL Database restrict user access based on their username, password, and access level.

I am using Adobe Dreamweaver CS3 to automate script setup and I have the login and sign out page setup.

I then go and edit a welcome page that can be found at www.clpafsk12.org/welcome/index.php

That is one of the pages that I would like to restrict access to.

So when I go into Dreamweaver to edit the welcome page and add the restriction to only allow users with the access levels listed below.

Administrator
Classified
Guest
Parent
Staff
Student
Teacher

The script is created and everything goes fine. I figure it will work because both sites have access to the database.

So when I go to login with my account that is setup for administrator access, It shoots me back to the login page for an access check , so I login again and it shoots me back to the login page again .

Any ideas on why this is happening?

I would like to thank all of those who assist in the solution to this problem in advance.
-Thank you.


----------



## support.clpafs (Apr 7, 2008)

Here is the code for the login page


> <?php require_once('CONNECTION URL GOES HERE'); ?>
> <?php
> if (!function_exists("GetSQLValueString")) {
> function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
> ...


and here is the code that dreamweaver created for the restricted page "welcome/index.php"



> <?php require_once('CONNECTION URL GOES HERE'); ?>
> <?php
> if (!isset($_SESSION)) {
> session_start();
> ...


----------



## support.clpafs (Apr 7, 2008)

Any suggestions?


----------



## colinsp (Sep 5, 2007)

Have a look at the login script here this is the one I use and it works well. Looking at the logic may help you with yours or you could use this one.


----------



## support.clpafs (Apr 7, 2008)

thanks,

I will take a look at it.


----------

