1,105,229 Community Members

Hiding my SQL Details from users

Member Avatar
Clanstrom
Junior Poster in Training
72 posts since Mar 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 5 [?]
Skill Endorsements: 0 [?]
 
0
 

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.

Member Avatar
TechySafi
Junior Poster in Training
97 posts since Oct 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 14 [?]
Skill Endorsements: 0 [?]
 
1
 

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>
Member Avatar
Clanstrom
Junior Poster in Training
72 posts since Mar 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 5 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Question Answered as of 2 Years Ago by TechySafi
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: