Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
|
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 10th, 2004, 08:35 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Default PHP & security

I'm reading PHP&MYsql for dummies atm.. and (if I can get some help I take the idiot hat!) there's something which seam very 'weird' to me.

It seams that some data like passwords and usernames are 'hidden' in PHP files.

Now, I know if you use internet explorer and you load the file for example:
http://www.servername.com/test.php

test.php
<?php
session_start();
@$_SESSION['password']="Enter$$2541";
?>

and go in View/ Source, the PHP code doesn't show.. but I am wondering if this system is sufficient to stop hackers from reading that information?

(please say yes!! well.. only if it's sufficient)
 
Old December 10th, 2004, 09:03 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Yes, it is sufficient.

When the page is requested from the server, it MUST go through the PHP processor (assuming the server is configured correctly) and the processor replaces the PHP code with the output. Therefore it is impossible for anyone to look at the original source, unless they can hack directly into your server's filesystem (and then you're in trouble anyway ;) ).

Good luck,

-Snib - http://www.snibworks.com
Where will you be in 100 years?
 
Old December 10th, 2004, 09:31 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks :)) makes life so much easier!
 
Old December 13th, 2004, 05:29 AM
Authorized User
 
Join Date: Oct 2004
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to SiliconFuRy
Default

If you're storing passwords, for even more security, look at the md5() function.

The idea being, store your password in the database as an md5 hash, then to authenticate, retrieve the password from the database, hash the password that the user entered, and match them.

Simple, yet very effective.

Many shoes,

Jamez/SiliconFuRy
 
Old December 13th, 2004, 07:06 AM
Authorized User
 
Join Date: Dec 2004
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to colin.horne
Default

Yes... and No

When you get further into Unix, you'll find that it's probably possible for anybody who is hosted on the same server as you (eg: someone else hosted by the same company) to read the php file and get the passwords.

Don't worry about it now, but do bear it in mind (and try not to use the same password for mySQL).

Cheers

--
Please contact me at:
Colin (dot) Horne (at) gmail (dot) com
 
Old December 13th, 2004, 03:15 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Only got 2 accounts on the database: Select in a 'hidden PHP' and one account with more access rights (but not to delete database or modify tables) that one isn't store anywhere... except in my mind!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Code Access Security & Role Based Security robzyc C# 6 April 11th, 2008 02:31 AM
begin php & mysql - chapter 12, user_form.php jon_stubber Beginning PHP 1 March 9th, 2006 10:57 AM
c++ & php vlad77 C++ Programming 1 May 20th, 2005 09:01 AM
Linux & KDE & C++ & QT & MYSQL & Kdevelop Munnnki Linux 0 January 2nd, 2005 05:41 PM
Error: movie.php & commit.php on p182-186, ch6 willburke BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 October 12th, 2004 02:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.