Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #9740 > unrolled thread
| Started by | Jason Demitri <jasonjdemitri@gmail.com> |
|---|---|
| First post | 2013-06-03 04:12 -0700 |
| Last post | 2013-06-03 12:23 -0400 |
| Articles | 9 — 4 participants |
Back to article view | Back to comp.lang.php
php contact form with AES encrypt and sessions for a multipage contact form - Driving me mad what ma i doing wrong Jason Demitri <jasonjdemitri@gmail.com> - 2013-06-03 04:12 -0700
Re: php contact form with AES encrypt and sessions for a multipage contact form - Driving me mad what ma i doing wrong Jerry Stuckle <jstucklex@attglobal.net> - 2013-06-03 07:31 -0400
Re: php contact form with AES encrypt and sessions for a multipage contact form - Driving me mad what ma i doing wrong Jeff North <jnorthau@yahoo.com.au> - 2013-06-03 22:00 +1000
Re: php contact form with AES encrypt and sessions for a multipage contact form - Driving me mad what ma i doing wrong Jason Demitri <jasonjdemitri@gmail.com> - 2013-06-03 06:38 -0700
Re: php contact form with AES encrypt and sessions for a multipage contact form - Driving me mad what ma i doing wrong Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-06-03 15:46 +0200
Re: php contact form with AES encrypt and sessions for a multipage contact form - Driving me mad what ma i doing wrong Jason Demitri <jasonjdemitri@gmail.com> - 2013-06-03 07:14 -0700
Re: php contact form with AES encrypt and sessions for a multipage contact form - Driving me mad what ma i doing wrong Jason Demitri <jasonjdemitri@gmail.com> - 2013-06-03 07:14 -0700
Re: php contact form with AES encrypt and sessions for a multipage contact form - Driving me mad what ma i doing wrong Jason Demitri <jasonjdemitri@gmail.com> - 2013-06-03 06:41 -0700
Re: php contact form with AES encrypt and sessions for a multipage contact form - Driving me mad what ma i doing wrong Jerry Stuckle <jstucklex@attglobal.net> - 2013-06-03 12:23 -0400
| From | Jason Demitri <jasonjdemitri@gmail.com> |
|---|---|
| Date | 2013-06-03 04:12 -0700 |
| Subject | php contact form with AES encrypt and sessions for a multipage contact form - Driving me mad what ma i doing wrong |
| Message-ID | <0e022c39-a8da-4b79-96ad-cbbb67e8e760@googlegroups.com> |
Hi im sort of a part time developer that is learning how to do php and what not . .. . now im trying to create a signup form for my site www.relution.co.uk
im using foundation 4 as a framework which has modal windows built in
now im trying to create a form that appears in one of these popup modals which has 4 pages and ajax image upoad i think it is . . .now from what ive figured out from each page of the form subbmission i need to store the collected data in a session to be recalled with the final php script so this is what ive used on page 2 and 3
page 2 to collect the data from page one on submission or next being hit
<?php
session_start();
// other php code here
$_SESSION['title'] = $_POST['title'];
$_SESSION['fname'] = $_POST['fname'];
$_SESSION['lname'] = $_POST['lname'];
$_SESSION['bday'] = $_POST['bday'];
?>Form goes here
<?php
session_start();
// other php code here
$_SESSION['email'] = $_POST['email'];
$_SESSION['mobphone'] = $_POST['mobphone'];
$_SESSION['hmephone'] = $_POST['hmephone'];
$_SESSION['rdname'] = $_POST['rdname'];
$_SESSION['postcode'] = $_POST['postcode'];
?>image upload on this page
and this is the final php to upload to the temp db for confirm email
<?php ob_start(); ?>
<?php
session_start();
$_SESSION['usrname'] = $_POST['usrname'];
$_SESSION['pswd'] = $_POST['pswd'];
require('config.php');
//table name
$tbl_name=temp_members_db;
//Random Confirm Code
$confirm_code=md5(uniqid(rand()));
//AES Encrypt Salt
if(!define('SALT'))
define('SALT','897sdn9j98u98jk');
//details collected from form
$title=$_SESSION['title'];
$fname=$_SESSION['fname'];
$lname=$_SESSION['lname'];
$bday=$_SESSION['bday'];
$email=$_SESSION['email'];
$emailr=$_SESSION['emailr'];
$mobphone=$_SESSION['mobphone'];
$hmephone=$_SESSION['hmephone'];
$usrname=$_SESSION['usrname'];
$pswd=$_SESSION['pswd'];
$pswd2=$_SESSION['pswd2'];
$rdname=$_SESSION['rdname'];
$postcode=$_SESSION['postcode'];
$pic=$_SESSION['pic'];
//Insert data into database
$sql="INSERT INTO $tbl_name(confirm_code, title, fname, lname, bday, email, mobphone, hmephone, usrname, pswd, rdname, postcode, pic)
VALUES('$confirm_code', '$title', '$fname', '$lname','$bday', AES_ENCRYPT('$email','".SALT."'), '$mobphone', '$hmephone', '$usrname', AES_ENCRYPT('$pswd','".SALT."'), '$rdname', '$pic' AES_ENCRYPT('$postcode','".SALT."'))
";
// if suceesfully inserted data into database, send confirmation link to email
if($result){
echo "Put Successfull";
}
else {
echo "there has been an error";
}
?>
?>
now before i tried this on a multipage form i had all of the last page working replacing the $_SESSION WITH POST including the AES encrypt but now on multipage i cant get it working keeps running to the error notice . . . please please help im no coder im still learning and personally think i've done well to get this far
[toc] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-06-03 07:31 -0400 |
| Message-ID | <kohuha$klt$1@dont-email.me> |
| In reply to | #9740 |
On 6/3/2013 7:12 AM, Jason Demitri wrote:
> Hi im sort of a part time developer that is learning how to do php and what not . .. . now im trying to create a signup form for my site www.relution.co.uk
>
> im using foundation 4 as a framework which has modal windows built in
>
> now im trying to create a form that appears in one of these popup modals which has 4 pages and ajax image upoad i think it is . . .now from what ive figured out from each page of the form subbmission i need to store the collected data in a session to be recalled with the final php script so this is what ive used on page 2 and 3
>
> page 2 to collect the data from page one on submission or next being hit
> <?php
> session_start();
> // other php code here
>
> $_SESSION['title'] = $_POST['title'];
> $_SESSION['fname'] = $_POST['fname'];
> $_SESSION['lname'] = $_POST['lname'];
> $_SESSION['bday'] = $_POST['bday'];
> ?>Form goes here
>
>
> <?php
> session_start();
> // other php code here
>
> $_SESSION['email'] = $_POST['email'];
> $_SESSION['mobphone'] = $_POST['mobphone'];
> $_SESSION['hmephone'] = $_POST['hmephone'];
> $_SESSION['rdname'] = $_POST['rdname'];
> $_SESSION['postcode'] = $_POST['postcode'];
> ?>image upload on this page
>
> and this is the final php to upload to the temp db for confirm email
>
> <?php ob_start(); ?>
> <?php
> session_start();
>
> $_SESSION['usrname'] = $_POST['usrname'];
> $_SESSION['pswd'] = $_POST['pswd'];
>
>
> require('config.php');
>
> //table name
>
> $tbl_name=temp_members_db;
>
> //Random Confirm Code
>
> $confirm_code=md5(uniqid(rand()));
>
> //AES Encrypt Salt
> if(!define('SALT'))
> define('SALT','897sdn9j98u98jk');
>
> //details collected from form
> $title=$_SESSION['title'];
> $fname=$_SESSION['fname'];
> $lname=$_SESSION['lname'];
> $bday=$_SESSION['bday'];
> $email=$_SESSION['email'];
> $emailr=$_SESSION['emailr'];
> $mobphone=$_SESSION['mobphone'];
> $hmephone=$_SESSION['hmephone'];
> $usrname=$_SESSION['usrname'];
> $pswd=$_SESSION['pswd'];
> $pswd2=$_SESSION['pswd2'];
> $rdname=$_SESSION['rdname'];
> $postcode=$_SESSION['postcode'];
> $pic=$_SESSION['pic'];
>
> //Insert data into database
>
> $sql="INSERT INTO $tbl_name(confirm_code, title, fname, lname, bday, email, mobphone, hmephone, usrname, pswd, rdname, postcode, pic)
> VALUES('$confirm_code', '$title', '$fname', '$lname','$bday', AES_ENCRYPT('$email','".SALT."'), '$mobphone', '$hmephone', '$usrname', AES_ENCRYPT('$pswd','".SALT."'), '$rdname', '$pic' AES_ENCRYPT('$postcode','".SALT."'))
> ";
>
> // if suceesfully inserted data into database, send confirmation link to email
> if($result){
> echo "Put Successfull";
> }
>
> else {
> echo "there has been an error";
> }
> ?>
> ?>
>
> now before i tried this on a multipage form i had all of the last page working replacing the $_SESSION WITH POST including the AES encrypt but now on multipage i cant get it working keeps running to the error notice . . . please please help im no coder im still learning and personally think i've done well to get this far
>
Where did you actually insert the data into the database? The $sql=...
statement just creates a string.
A couple of other things - when using strings with a database, you MUST
escape each one or used prepared statements. See the doc for the
interface (mysql - which has been deprecated, or mysqli) for more
information.
And finally - why are you using obstart() on your last page? Proper
design of your code makes it unnecessary.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[toc] | [prev] | [next] | [standalone]
| From | Jeff North <jnorthau@yahoo.com.au> |
|---|---|
| Date | 2013-06-03 22:00 +1000 |
| Message-ID | <051pq8hbg7ls2ldgaivvdd1m1ljp1b1bjr@4ax.com> |
| In reply to | #9740 |
On Mon, 3 Jun 2013 04:12:43 -0700 (PDT), in comp.lang.php Jason
Demitri <jasonjdemitri@gmail.com>
<0e022c39-a8da-4b79-96ad-cbbb67e8e760@googlegroups.com> wrote:
>| Hi im sort of a part time developer that is learning how to do php and what not . .. . now im trying to create a signup form for my site www.relution.co.uk
>|
>| im using foundation 4 as a framework which has modal windows built in
>|
>| now im trying to create a form that appears in one of these popup modals which has 4 pages and ajax image upoad i think it is . . .now from what ive figured out from each page of the form subbmission i need to store the collected data in a session to be recalled with the final php script so this is what ive used on page 2 and 3
>|
>| page 2 to collect the data from page one on submission or next being hit
>| <?php
>| session_start();
>| // other php code here
>|
>| $_SESSION['title'] = $_POST['title'];
>| $_SESSION['fname'] = $_POST['fname'];
>| $_SESSION['lname'] = $_POST['lname'];
>| $_SESSION['bday'] = $_POST['bday'];
>| ?>Form goes here
>|
>|
>| <?php
>| session_start();
>| // other php code here
>|
>| $_SESSION['email'] = $_POST['email'];
>| $_SESSION['mobphone'] = $_POST['mobphone'];
>| $_SESSION['hmephone'] = $_POST['hmephone'];
>| $_SESSION['rdname'] = $_POST['rdname'];
>| $_SESSION['postcode'] = $_POST['postcode'];
>| ?>image upload on this page
>|
>| and this is the final php to upload to the temp db for confirm email
>|
>| <?php ob_start(); ?>
>| <?php
>| session_start();
>|
>| $_SESSION['usrname'] = $_POST['usrname'];
>| $_SESSION['pswd'] = $_POST['pswd'];
>|
>|
>| require('config.php');
>|
>| //table name
>|
>| $tbl_name=temp_members_db;
>|
>| //Random Confirm Code
>|
>| $confirm_code=md5(uniqid(rand()));
>|
>| //AES Encrypt Salt
>| if(!define('SALT'))
>| define('SALT','897sdn9j98u98jk');
>|
>| //details collected from form
>| $title=$_SESSION['title'];
>| $fname=$_SESSION['fname'];
>| $lname=$_SESSION['lname'];
>| $bday=$_SESSION['bday'];
>| $email=$_SESSION['email'];
>| $emailr=$_SESSION['emailr'];
>| $mobphone=$_SESSION['mobphone'];
>| $hmephone=$_SESSION['hmephone'];
>| $usrname=$_SESSION['usrname'];
>| $pswd=$_SESSION['pswd'];
>| $pswd2=$_SESSION['pswd2'];
>| $rdname=$_SESSION['rdname'];
>| $postcode=$_SESSION['postcode'];
>| $pic=$_SESSION['pic'];
>|
>| //Insert data into database
>|
>| $sql="INSERT INTO $tbl_name(confirm_code, title, fname, lname, bday, email, mobphone, hmephone, usrname, pswd, rdname, postcode, pic)
>| VALUES('$confirm_code', '$title', '$fname', '$lname','$bday', AES_ENCRYPT('$email','".SALT."'), '$mobphone', '$hmephone', '$usrname', AES_ENCRYPT('$pswd','".SALT."'), '$rdname', '$pic' AES_ENCRYPT('$postcode','".SALT."'))
>| ";
You've only created the sql statement but have not told the database
to write it to the table.
You will need to check which database you are using and write the
necessary code.
>| // if suceesfully inserted data into database, send confirmation link to email
>| if($result){
>| echo "Put Successfull";
>| }
>|
>| else {
>| echo "there has been an error";
>| }
>| ?>
>| ?>
>|
>| now before i tried this on a multipage form i had all of the last page working replacing the $_SESSION WITH POST including the AES encrypt but now on multipage i cant get it working keeps running to the error notice . . . please please help im no coder im still learning and personally think i've done well to get this far
[toc] | [prev] | [next] | [standalone]
| From | Jason Demitri <jasonjdemitri@gmail.com> |
|---|---|
| Date | 2013-06-03 06:38 -0700 |
| Message-ID | <4aa01588-1659-4026-a600-72da52ea652a@googlegroups.com> |
| In reply to | #9740 |
on the original script above the sql statement i originally had these as $lname=$_Post['lname']; and with the sql it inserted it into my database without a problem as the last part of the script was on its own. I read up on some tutorials on how to split a form over different modals and it said that i had to declare the collected information from the form in the $_Session the in the last script pull all of these sessions to then insert into the sql. As i said im only a beginner and am starting to think im punching way above my weight but could someone please point out what part of the script im doing wrong . .why its not working and how to correct it . . . i thought that the sql statment on the last part of the script with INSERT INTO and then the values listed was all it took to insert it into the table
On Monday, June 3, 2013 12:12:43 PM UTC+1, Jason Demitri wrote:
> Hi im sort of a part time developer that is learning how to do php and what not . .. . now im trying to create a signup form for my site www.relution.co.uk
>
>
>
> im using foundation 4 as a framework which has modal windows built in
>
>
>
> now im trying to create a form that appears in one of these popup modals which has 4 pages and ajax image upoad i think it is . . .now from what ive figured out from each page of the form subbmission i need to store the collected data in a session to be recalled with the final php script so this is what ive used on page 2 and 3
>
>
>
> page 2 to collect the data from page one on submission or next being hit
>
> <?php
>
> session_start();
>
> // other php code here
>
>
>
> $_SESSION['title'] = $_POST['title'];
>
> $_SESSION['fname'] = $_POST['fname'];
>
> $_SESSION['lname'] = $_POST['lname'];
>
> $_SESSION['bday'] = $_POST['bday'];
>
> ?>Form goes here
>
>
>
>
>
> <?php
>
> session_start();
>
> // other php code here
>
>
>
> $_SESSION['email'] = $_POST['email'];
>
> $_SESSION['mobphone'] = $_POST['mobphone'];
>
> $_SESSION['hmephone'] = $_POST['hmephone'];
>
> $_SESSION['rdname'] = $_POST['rdname'];
>
> $_SESSION['postcode'] = $_POST['postcode'];
>
> ?>image upload on this page
>
>
>
> and this is the final php to upload to the temp db for confirm email
>
>
>
> <?php ob_start(); ?>
>
> <?php
>
> session_start();
>
>
>
> $_SESSION['usrname'] = $_POST['usrname'];
>
> $_SESSION['pswd'] = $_POST['pswd'];
>
>
>
>
>
> require('config.php');
>
>
>
> //table name
>
>
>
> $tbl_name=temp_members_db;
>
>
>
> //Random Confirm Code
>
>
>
> $confirm_code=md5(uniqid(rand()));
>
>
>
> //AES Encrypt Salt
>
> if(!define('SALT'))
>
> define('SALT','897sdn9j98u98jk');
>
>
>
> //details collected from form
>
> $title=$_SESSION['title'];
>
> $fname=$_SESSION['fname'];
>
> $lname=$_SESSION['lname'];
>
> $bday=$_SESSION['bday'];
>
> $email=$_SESSION['email'];
>
> $emailr=$_SESSION['emailr'];
>
> $mobphone=$_SESSION['mobphone'];
>
> $hmephone=$_SESSION['hmephone'];
>
> $usrname=$_SESSION['usrname'];
>
> $pswd=$_SESSION['pswd'];
>
> $pswd2=$_SESSION['pswd2'];
>
> $rdname=$_SESSION['rdname'];
>
> $postcode=$_SESSION['postcode'];
>
> $pic=$_SESSION['pic'];
>
>
>
> //Insert data into database
>
>
>
> $sql="INSERT INTO $tbl_name(confirm_code, title, fname, lname, bday, email, mobphone, hmephone, usrname, pswd, rdname, postcode, pic)
>
> VALUES('$confirm_code', '$title', '$fname', '$lname','$bday', AES_ENCRYPT('$email','".SALT."'), '$mobphone', '$hmephone', '$usrname', AES_ENCRYPT('$pswd','".SALT."'), '$rdname', '$pic' AES_ENCRYPT('$postcode','".SALT."'))
>
> ";
>
>
>
> // if suceesfully inserted data into database, send confirmation link to email
>
> if($result){
>
> echo "Put Successfull";
>
> }
>
>
>
> else {
>
> echo "there has been an error";
>
> }
>
> ?>
>
> ?>
>
>
>
> now before i tried this on a multipage form i had all of the last page working replacing the $_SESSION WITH POST including the AES encrypt but now on multipage i cant get it working keeps running to the error notice . . . please please help im no coder im still learning and personally think i've done well to get this far
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2013-06-03 15:46 +0200 |
| Message-ID | <9094520.Wl3ISODeDI@PointedEars.de> |
| In reply to | #9743 |
Jason Demitri posted: > [something posing an increased risk for getting eye cancer] Please put yourself into the position of a complete stranger who is generally willing to help you, and think about what they might think when they are _not_ helping you after reading your postings. <http://www.catb.org/~esr/faqs/smart-questions.html> -- PointedEars
[toc] | [prev] | [next] | [standalone]
| From | Jason Demitri <jasonjdemitri@gmail.com> |
|---|---|
| Date | 2013-06-03 07:14 -0700 |
| Message-ID | <e034c439-c9f3-4d81-85b8-7f03351a386f@googlegroups.com> |
| In reply to | #9745 |
On Monday, June 3, 2013 2:46:34 PM UTC+1, Thomas 'PointedEars' Lahn wrote: > Jason Demitri posted: > > > > > [something posing an increased risk for getting eye cancer] > > > > Please put yourself into the position of a complete stranger who is > > generally willing to help you, and think about what they might think > > when they are _not_ helping you after reading your postings. > > > > <http://www.catb.org/~esr/faqs/smart-questions.html> > > > > -- > > PointedEars
[toc] | [prev] | [next] | [standalone]
| From | Jason Demitri <jasonjdemitri@gmail.com> |
|---|---|
| Date | 2013-06-03 07:14 -0700 |
| Message-ID | <1b3b8f82-8c71-4551-be8a-fcb4592ed13d@googlegroups.com> |
| In reply to | #9745 |
cant see the link and dont understand On Monday, June 3, 2013 2:46:34 PM UTC+1, Thomas 'PointedEars' Lahn wrote: > Jason Demitri posted: > > > > > [something posing an increased risk for getting eye cancer] > > > > Please put yourself into the position of a complete stranger who is > > generally willing to help you, and think about what they might think > > when they are _not_ helping you after reading your postings. > > > > <http://www.catb.org/~esr/faqs/smart-questions.html> > > > > -- > > PointedEars
[toc] | [prev] | [next] | [standalone]
| From | Jason Demitri <jasonjdemitri@gmail.com> |
|---|---|
| Date | 2013-06-03 06:41 -0700 |
| Message-ID | <529025b3-7cd5-469e-863a-598b823ba278@googlegroups.com> |
| In reply to | #9740 |
I believe this is more or less how i had it before i split the form up the . . it would action this script on submit
<?php
require('config.php');
//table name
$tbl_name=temp_members_db;
//Random Confirm Code
$confirm_code=md5(uniqid(rand()));
//AES Encrypt Salt
if(!define('SALT'))
define('SALT','897sdn9j98u98jk');
//details collected from form
$title=$_POST['title'];
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$bday=$_POST['bday'];
$email=$_POST['email'];
$emailr=$_POST['emailr'];
$mobphone=$_POST['mobphone'];
$hmephone=$_POST['hmephone'];
$usrname=$__POST['usrname'];
$pswd=$_POST['pswd'];
$pswd2=$_POST['pswd2'];
$rdname=$_POST['rdname'];
$postcode=$_POST['postcode'];
//Insert data into database
$sql="INSERT INTO $tbl_name(confirm_code, title, fname, lname, bday, email, mobphone, hmephone, usrname, pswd, rdname, postcode,)
VALUES('$confirm_code', '$title', '$fname', '$lname','$bday', AES_ENCRYPT('$email','".SALT."'), '$mobphone', '$hmephone', '$usrname', AES_ENCRYPT('$pswd','".SALT."'), '$rdname', AES_ENCRYPT('$postcode','".SALT."'))
";
// if suceesfully inserted data into database, send confirmation link to email
if($result){
echo "Put Successfull";
}
else {
echo "there has been an error";
}
?>
?>
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2013-06-03 12:23 -0400 |
| Message-ID | <koifle$8e4$1@dont-email.me> |
| In reply to | #9744 |
On 6/3/2013 9:41 AM, Jason Demitri wrote:
> I believe this is more or less how i had it before i split the form up the . . it would action this script on submit
>
>
> <?php
>
>
> require('config.php');
>
> //table name
>
> $tbl_name=temp_members_db;
>
> //Random Confirm Code
>
> $confirm_code=md5(uniqid(rand()));
>
> //AES Encrypt Salt
> if(!define('SALT'))
> define('SALT','897sdn9j98u98jk');
>
> //details collected from form
> $title=$_POST['title'];
> $fname=$_POST['fname'];
> $lname=$_POST['lname'];
> $bday=$_POST['bday'];
> $email=$_POST['email'];
> $emailr=$_POST['emailr'];
> $mobphone=$_POST['mobphone'];
> $hmephone=$_POST['hmephone'];
> $usrname=$__POST['usrname'];
> $pswd=$_POST['pswd'];
> $pswd2=$_POST['pswd2'];
> $rdname=$_POST['rdname'];
> $postcode=$_POST['postcode'];
>
>
> //Insert data into database
>
> $sql="INSERT INTO $tbl_name(confirm_code, title, fname, lname, bday, email, mobphone, hmephone, usrname, pswd, rdname, postcode,)
>
> VALUES('$confirm_code', '$title', '$fname', '$lname','$bday', AES_ENCRYPT('$email','".SALT."'), '$mobphone', '$hmephone', '$usrname', AES_ENCRYPT('$pswd','".SALT."'), '$rdname', AES_ENCRYPT('$postcode','".SALT."'))
> ";
>
> // if suceesfully inserted data into database, send confirmation link to email
> if($result){
> echo "Put Successfull";
> }
>
> else {
> echo "there has been an error";
> }
> ?>
> ?>
>
Did you even READ the responses?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web