Jump to content


Photo

form


  • Please log in to reply
4 replies to this topic

#1 bojak71730

bojak71730
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 16 May 2006 - 02:36 AM

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

#2 rscott7706

rscott7706
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts
  • LocationLakeside CA

Posted 16 May 2006 - 02:54 AM

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!!






#3 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 16 May 2006 - 03:11 AM

[!--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) View Post[/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.

Legend has it that reading the manual never killed anyone.
My site

#4 bojak71730

bojak71730
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 16 May 2006 - 03:32 AM

[!--quoteo(post=374187:date=May 15 2006, 10:11 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ May 15 2006, 10:11 PM) View Post[/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

#5 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 16 May 2006 - 05:01 AM

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.
Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users