We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Hiding my SQL Details from users

Hi there all.
This is my first time ever in Dani web. I just began teaching myself PhP by googling. My first question ( Not sure if i am even allowed to ask in here ) is that.
* When you create a php registration form in PHP enabled page, you have to write how the php will insert the registered user into your SQL Database (Right?) Then in-order to do that you have to write ( i Guess ) Your local host password and database name ... In the page itself so it can gain access to write your SQL.
So what is bothering me is that, how can i write MySQL password and username in the page where the user is trying to access?

I mean wont the user just view your source code? If he does, won't the script speak for it self?

In Short - how can you prevent from any one viewing you SQL pass & username by viewing your source code?


Thanks and sorry for mess.

2
Contributors
2
Replies
48 Minutes
Discussion Span
2 Years Ago
Last Updated
3
Views
Question
Answered
Vribium
Junior Poster in Training
56 posts since Mar 2011
Reputation Points: 10
Solved Threads: 3
Skill Endorsements: 0

NO!!
Like you wrote $pass="this_is_my_pass";
php won't let you see this. Even with source view.

Just try, write a simple php page named index.php and run it

<?php
$my="just wondering"; //you can't see this, neither the code nor the value of $my
echo "Or"; //you can see this because it echoed it
$pass=$_POST['pass'];
if($pass)
{
echo "hi, im index.php. I got your password, try to view it if you cant :D";
}
?>
<form action="index.php" method="post">
Password: <input type="text" name"pass" />
</form>
TechySafi
Junior Poster in Training
99 posts since Oct 2010
Reputation Points: 10
Solved Threads: 14
Skill Endorsements: 0

Thanks, never though of it like that. Such an easy thing! A Million Thanks

Vribium
Junior Poster in Training
56 posts since Mar 2011
Reputation Points: 10
Solved Threads: 3
Skill Endorsements: 0
Question Answered as of 1 Year Ago by TechySafi

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0660 seconds using 2.7MB