Anybody need a little bit of quick php done?

DeadBattery

Community Support Team
Community Support
Messages
4,018
Reaction score
120
Points
0
Dude, you are awesome. I'll test it out and try it soon.
btw, nobody will be able to determine my username and password by looking at the "formpost.php" file, right?
 

Sohail

Active Member
Messages
3,055
Reaction score
0
Points
36
Don't worry about my request anymore, i've put up an offer in the marketplace regarding my script as i need some other help too :).
 

DarkDragonLord

New Member
Messages
782
Reaction score
0
Points
0
Dude, you are awesome. I'll test it out and try it soon.
btw, nobody will be able to determine my username and password by looking at the "formpost.php" file, right?

hmm.. dont think so since php is interpretted first, THEN show something.

just to make sure, use this: (im not sure if works bcause i did not teste BUT might work very well)

Add in the FORM page, before the 'SEND button'

HTML:
<input type="hidden" name="validate" value="PASS" />

then, in PHP

PHP:
 <?php

if(!isset($_REQUEST['validate']))
{
die("You must not access this page directly!"); //Just to stop people from visiting .php normally
}


$name = $_REQUEST['fullname'] ;
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;

$name = $_REQUEST['fullname'] ;

//Here: Connection to DB.
$connmysql = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$connmysql) {
    die('Could not connect: ' . mysql_error());
}

//Here: add 2 DB string
$gomysql = "Insert Into table_name(table_row_name_for_name,table_row_name_for_subject,table_row_name_for_message,table_row_name_for_email) Values('" .$name."', '" .$subject."', '" .$message."', '" .$email."')";  



$msg = "from: $name
$message"

if(mail(name@host.com, $subject, $msg, $email))
{
echo "/*PLACE HTML IF SEND IS SUCCESSFUL*/";

//Here: Adding stuff to DB
mysql_query ($gomysql);
}
else
{
echo "/*PLACE HTML IF SEND IS UNSUCCESSFUL*/";
}

//Here: Closing Connection to DB
mysql_close($connmysql);
?>
</span>



I THINK might work

test and tell me
if you try go php directly, will appear
You must not access this page directly!
 

DeadBattery

Community Support Team
Community Support
Messages
4,018
Reaction score
120
Points
0
I had one last question.
Let's say I have an option to attach an attachment. Will the attachment be stored in they MySQL database where I can download from something like phpMyAdmin?
 

DeadBattery

Community Support Team
Community Support
Messages
4,018
Reaction score
120
Points
0
Another question, how does it know which database to put the stuff in? Do I change mysql_connect to my database name or add something to the $connmysql part?
 
Top