473,396 Members | 1,871 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Password Protected Admin

Hi,
I want to create a password protected page to administer my site from
(the news is read from a mySQL database and I have created a PHP form to
as a GUI to do this). I thought of password-protecting it by creating a
page with the login details (which are the same as those needed for the
mySQL database, passing these as variable to the admin page using POST
and then making changes to the database using these login variables. Is
this secure and/or practical? Will it alert the user to an incorrect
mySQL login straight away or wait until the submit button is pressed
(and changes are attempted to be made)?

The other option is using a password script such as this one
http://www.webdevtips.com/webdevtips...re/index.shtml

Any thoughts or other (relatively simple) ways of doing this?

Cheers,
Ben
Jul 25 '05 #1
9 2182

Ben Allen wrote:
Hi,
I want to create a password protected page to administer my site from
(the news is read from a mySQL database and I have created a PHP form to
as a GUI to do this). I thought of password-protecting it by creating a
page with the login details (which are the same as those needed for the
mySQL database, passing these as variable to the admin page using POST


dont do that. dont send your mysql passwords via post or over th web
in the clear.

check this:
http://groups-beta.google.com/group/...16ca332d1fbb48

please read to the bottom of the thread about using $_POST.

--
juglesh

Jul 26 '05 #2
SOR
<comp.lang.php , juglesh , ju*********@hotmail.com>
<11**********************@g49g2000cwa.googlegroups .com>
<25 Jul 2005 19:38:24 -0700>
dont send your mysql passwords via post or over th web
in the clear.

check this:
http://groups-beta.google.com/group/...16ca332d1fbb48

please read to the bottom of the thread about using $_POST.


Silly question time .

Even if the password is in the clear on a url - wont it only be the
admin or the webmaster who sees it *only* after they have logged in with
the correct password .
Jul 26 '05 #3
I noticed that Message-ID:
<MP************************@no-cancel.newsreader.com> from SOR contained
the following:
Even if the password is in the clear on a url - wont it only be the
admin or the webmaster who sees it *only* after they have logged in with
the correct password .

...and anyone stranding behind him, or anyone checking the history or...
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 26 '05 #4
Ben Allen wrote:

The other option is using a password script such as this one
http://www.webdevtips.com/webdevtips...re/index.shtml

Any thoughts or other (relatively simple) ways of doing this?


This script is far from secure.

The quickest route would be to use the webserver's built-in security
mechanism. Basic authentication still sends the password in the clear but
leaving aside the huge vulnerability of it being sniffable it is reasonably
robust. Digest based authentication addresses the sniffing problem and is
supported on most modern software.

HTH

C.
Jul 26 '05 #5
You might also try to google any md5 tutorial. It's "relatively simple"
to make a pretty secure authentication system with encrypted passwords.
http://es.php.net/md5

Jul 26 '05 #6
My recommendation would be for you to do it through a .htaccess file. Most
web hosts will give you the ability to do this through your admin, but you
can do it by hand easily - do a google on it.

The problem with .htaccess files though, is, you get a naff looking box pop
up asking for your username and password. If you want to be able to design
the form you fill out, then a POST form will do the trick. This is how I've
written (what I hope are) secure admins.

At the very top of every page put: session_start(); - look at php.net for
documentation on PHP sessions if you're unsure what they are.

Have PHP create a new session variable when the password and username are
correct. e.g.:

if ($_POST['pass'] == "s2132t163" && $_POST['user'] == "me") {
$_SESSION['adminlogin'] = "yes";
}

On each page that needs to be protected, put this line before any content is
printed:

if (!isset($_SESSION['adminlogin'])) { die "Unauthorised access"; }

Having this means if the session variable hasn't been created, the page
won't load past this point and an 'unauthorised' message will display.

Ka kite,
Luke


"Ben Allen" <"ben.allen"@\"your.tonsils\"btinternet.com> wrote in message
news:dc**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
Hi,
I want to create a password protected page to administer my site from
(the news is read from a mySQL database and I have created a PHP form to
as a GUI to do this). I thought of password-protecting it by creating a
page with the login details (which are the same as those needed for the
mySQL database, passing these as variable to the admin page using POST
and then making changes to the database using these login variables. Is
this secure and/or practical? Will it alert the user to an incorrect
mySQL login straight away or wait until the submit button is pressed
(and changes are attempted to be made)?

The other option is using a password script such as this one
http://www.webdevtips.com/webdevtips...re/index.shtml

Any thoughts or other (relatively simple) ways of doing this?

Cheers,
Ben

Jul 26 '05 #7
I noticed that Message-ID:
<11**********************@g44g2000cwa.googlegroups .com> from Samuel
contained the following:
You might also try to google any md5 tutorial. It's "relatively simple"
to make a pretty secure authentication system with encrypted passwords.


Don't you need to use a bit of Javascript to get round the browser
sniffing problem?

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 26 '05 #8
SOR
<comp.lang.php , Geoff Berrow , bl******@ckdog.co.uk>
<05********************************@4ax.com>
<Tue, 26 Jul 2005 08:05:42 +0100>
Even if the password is in the clear on a url - wont it only be the
admin or the webmaster who sees it *only* after they have logged in with
the correct password .

..and anyone stranding behind him, or anyone checking the history or...


Its what i've used on that guestbook script i'm writing .

See your point but can live it with as its only a guestbook that will
only be used by home users .
Jul 26 '05 #9

Iluke wrote:
My recommendation would be for you to do it through a .htaccess file. Most
web hosts will give you the ability to do this through your admin, but you
can do it by hand easily - do a google on it.

The problem with .htaccess files though, is, you get a naff looking box pop
up asking for your username and password. If you want to be able to design
the form you fill out, then a POST form will do the trick. This is how I've
written (what I hope are) secure admins.

At the very top of every page put: session_start(); - look at php.net for
documentation on PHP sessions if you're unsure what they are.

Have PHP create a new session variable when the password and username are
correct. e.g.:

if ($_POST['pass'] == "s2132t163" && $_POST['user'] == "me") {
$_SESSION['adminlogin'] = "yes";
}

On each page that needs to be protected, put this line before any content is
printed:

if (!isset($_SESSION['adminlogin'])) { die "Unauthorised access"; }

Having this means if the session variable hasn't been created, the page
won't load past this point and an 'unauthorised' message will display.

Ka kite,
Luke

Thanks for your replies everyone. My host can do .htaccess which I
completely forgot about, although I don't like the pop-up boxes either.
Anyone know of any security issues doing it Luke's way? I may do it this
way, or use .htaccess.

Thanks,
Ben
Jul 26 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: netsurfer | last post by:
hi..I'm working on a project that requires files to be password protected on a UNIX based site. The people that own the web site want to be able to change the password every so often. ...
4
by: Kelly Bowles | last post by:
I have made a purchase requistion which I have been asked to put password protected copy of requestors signature. I am thinking that each signature will have to be scanned as a picture and linked...
0
by: mikehernandez99 | last post by:
I have an Access 2003 application that consists of a front end MDE with linked tables to a password protected MDB. I try to use ADO code for this because my MDB is password protected. Dim jro As...
8
by: ablyplus | last post by:
Hi, I am trying to open MS Access DB with c# like follows... OleDbConnection thisConnection = new OleDbConnection( @"Provider=Microsoft.Jet.OLEDB.4.0;" + @"Data Source=" + @"..\..\hren.mdb;"...
2
by: - Steve - | last post by:
I'm trying to change a user's password using objUser.Invoke("setPassword", "newpassword") It works fine as a console application if I'm logged in with someone with the correct permissions. If...
1
by: Daniel | last post by:
Hello everyone, I am trying to connect to a password protected Access database using: Public connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & pathDB & ";User...
4
by: kthiagar | last post by:
Hi I am trying to connect to a password protected access file from VB.NET. I have no problem in connecting to Access, if I remove the password. This is what I am doing: In the server explorer,...
2
by: UJ | last post by:
How do you make a part of a website require a login ? I've done it with forms authentication where the entire site (with a few exceptions) require somebody to log in. But how do you do it when...
3
by: Charlotte | last post by:
Hello, info: I'me a rookie with IIS I have on a WinXP Pro the IIS installed, so I can test some pages before uploading to the hostserver online on the hostserver is a possibility (with the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.