Jump to content

Archived

This topic is now archived and is closed to further replies.

bojak71730

form

Recommended Posts

im gonna make a order form and its going to connect to mysql the only problem i have is i dont know how to make it secure i dont yet have it coded this is just an idea that came about in my head and i didnt know how to fix that problem

Share this post


Link to post
Share on other sites
OK, I am fairly new to PHP, so may make an error here. But, if you follow these instructions, it should work.

I will assume that your form will be named form.php (or something like that - at least with a php extension).

In that file (your form file), near the top, place the following code:

# connect to database
include("log.php");

1. The "# connect to database" is just a comment to indicate what the code is for.

2. You can use any name for the file as long as the extension is .php (db.php, connect.php, etc).

3. Create a file called log.php and put the following code in it:

<?php
$db = mysql_connect("localhost", "user_name", "password");
mysql_select_db("db_name");
?>

Where "localhost" is the required server name (normally localhost - may not be in your case)

user_name is your server user user name (usually supplied by the server host)

password - same as above

db_name is the name of your database (not the table - that will be named in your file where you indicate sotrage address).

Hope this helps...

If any of you journeymen see problems here please correct me!!




Share this post


Link to post
Share on other sites
[!--quoteo(post=374181:date=May 15 2006, 10:36 PM:name=bojak_cates)--][div class=\'quotetop\']QUOTE(bojak_cates @ May 15 2006, 10:36 PM) [snapback]374181[/snapback][/div][div class=\'quotemain\'][!--quotec--]
im gonna make a order form and its going to connect to mysql the only problem i have is i dont know how to make it secure i dont yet have it coded this is just an idea that came about in my head and i didnt know how to fix that problem[/quote]
What is it that you want to make 'secure'? If we knew that, we could build on the answer already posted, or point you in the right direction. Form secure? Database secure? Something else secure? Help us help you.

Share this post


Link to post
Share on other sites
[!--quoteo(post=374187:date=May 15 2006, 10:11 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ May 15 2006, 10:11 PM) [snapback]374187[/snapback][/div][div class=\'quotemain\'][!--quotec--]
What is it that you want to make 'secure'? If we knew that, we could build on the answer already posted, or point you in the right direction. Form secure? Database secure? Something else secure? Help us help you.
[/quote] what i mean is it will prolly really easy to get information from a form im sure there is hackers out there that can crack forms or dbs to get info like this so i need to make the form secure as well as the db i guess u could say

Share this post


Link to post
Share on other sites
For the form to be useful, it has to be visible to your site's visitors. And they can view the html source code so 'cracking' a form is a trivial (and pointless) exercise. If you only want 'authorized' visitors to view your form, explain how and why.

php scripts cannot be read with a browser (only the html they generate). Assuming you don't broadcast your database username and password, your database is as secure as it is going to get.

So, if you have some specific questions ask them here or use Google to track down whatever it is you need.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.