User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,549 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,536 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1032 | Replies: 6
Reply
Join Date: Sep 2006
Posts: 9
Reputation: went1180 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
went1180 went1180 is offline Offline
Newbie Poster

$password= '*****' is this safe?

  #1  
Sep 6th, 2006
may i ask if it is ok to create a $password variable with my real password as the string? it seems like mysql_real_escape_string() won't work because this function only works after the connection is made, but i've also read that php code is not actually viewable by a user...
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2006
Posts: 53
Reputation: Barnz is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Barnz Barnz is offline Offline
Junior Poster in Training

Re: $password= '*****' is this safe?

  #2  
Sep 6th, 2006
Originally Posted by went1180 View Post
may i ask if it is ok to create a $password variable with my real password as the string? it seems like mysql_real_escape_string() won't work because this function only works after the connection is made, but i've also read that php code is not actually viewable by a user...


I always wondered this myself,

But im not sure so you could just encrypt it anyway, there are functions in PHP that do this.
Last edited by Barnz : Sep 6th, 2006 at 7:17 pm.
Reply With Quote  
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 10,879
Reputation: cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice 
Rep Power: 32
Solved Threads: 106
Admin
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: $password= '*****' is this safe?

  #3  
Sep 6th, 2006
Find the encrypted value of your password string and do $encrypted_password = '**********';

Then, do a check against md5($entered_password) == $encrypted_password. This way, if someone gains FTP access, or another user on your server, won't know what your password is.
Reply With Quote  
Join Date: Sep 2006
Posts: 9
Reputation: went1180 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
went1180 went1180 is offline Offline
Newbie Poster

Re: $password= '*****' is this safe?

  #4  
Sep 6th, 2006
I'm not sure if we're talking about the same thing. I THINK you might be referring to a form where a user logs in with a password, whereas I am trying to write a script which takes $_POST data and enters it into an INSERT query using the username and password in mysql_connect().

[php]
$hostname="blah.blah.net";
$username="blahblahjunior";
$password="blahblahblah";
$dbname="blahbase";
$usertable="blahusers";

$con = mysql_connect($hostname,$username, $password);
[/php]

i.e. is the $password string in the php file used to connect to the database ever visible/hackable by an outside user.

p.s. yer cute
Reply With Quote  
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 10,879
Reputation: cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice 
Rep Power: 32
Solved Threads: 106
Admin
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: $password= '*****' is this safe?

  #5  
Sep 6th, 2006
Ah, you're right. I was referring to a password being entered in a form. In such a case, entering the password in plain text is the only alternative I know of, since md5() and sha1() are both one-way encryption algorithms.
Last edited by cscgal : Sep 6th, 2006 at 9:19 pm.
Reply With Quote  
Join Date: Sep 2006
Posts: 9
Reputation: went1180 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
went1180 went1180 is offline Offline
Newbie Poster

Re: $password= '*****' is this safe?

  #6  
Sep 6th, 2006
my bad ambiguous post to start with. thx...
Reply With Quote  
Join Date: Jul 2004
Location: North East Indiana
Posts: 491
Reputation: Puckdropper is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 20
Puckdropper Puckdropper is offline Offline
Posting Pro in Training

Re: $password= '*****' is this safe?

  #7  
Sep 7th, 2006
I asked the same question several months ago.

Here's the thread:
http://www.daniweb.com/techtalkforums/thread48057.html

Users of Mozilla and Firefox may want to right click and select "Open in new Tab" especially if they're browsing with tabs now.
www.uncreativelabs.net

Old computers are getting to be a lost art. Here at Uncreative Labs, we still enjoy using the old computers. Sometimes we want to see how far a particular system can go, other times we use a stock system to remind ourselves of what we once had.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 9:10 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC