473,386 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

one submit button two diff. DB's and one value needs to be encrypted

cassbiz
202 100+
Here is what I want to do, if possible.

I have a reservation form, where one value (credit card number) needs to be run through an encryption script then get posted to the DB where all of the other fields do not need encryption. Everything is posting over just fine right now to the DB. I would like to encrypt the CC# with the script at the bottom of the page. I got the script from PHPCLASSES.ORG

Expand|Select|Wrap|Line Numbers
  1. <tr id="tr1">
  2.         <td class="t1" colspan="2">
  3.         Is your mailing address same as your billing address?
  4.         <input name="addr_copy" type="checkbox" onClick="
  5.         copyConditional(this,
  6.         this.form.strasse,
  7.         this.form.baddress);
  8.         copyConditional(this,
  9.         this.form.ort,
  10.         this.form.bcity);
  11.         copyConditional(this,
  12.         this.form.stadt,
  13.         this.form.bstate);
  14.         copyConditional(this,
  15.         this.form.plz,
  16.         this.form.bzip);
  17. ">
  18.         </td>
  19. </tr>
  20. <tr id="tr1">
  21.         <td class="t1">
  22.                 <? echo $t_forms['card_type'] ?> <br />
  23.                 <select name="card_type" size="1"><!--Maximal Zehn Zeichen-->
  24.                         <option<?php if ($card ==  "") echo " selected"?>></option>
  25.                         <option<?php if ($card == 1) echo " selected"?>><?echo $t_pay['amex']?></option>
  26.                         <option<?php if ($card == 2) echo " selected"?>><?echo $t_pay['carte']?></option>
  27.                         <option<?php if ($card == 3) echo " selected"?>><?echo $t_pay['diners']?></option>
  28.                         <option<?php if ($card == 4) echo " selected"?>><?echo $t_pay['jcb']?></option>
  29.                         <option<?php if ($card == 5) echo " selected"?>><?echo $t_pay['mc']?></option>
  30.                         <option<?php if ($card == 6) echo " selected"?>><?echo $t_pay['visa']?></option>
  31.                 </select>
  32.         </td>
  33.         <td class="t1">
  34.                 <? echo $t_pay['cc_num'] ?><br> <input <?php echo "value=\"$cc_num\""?> name="cc_num" size="30" maxlength="20" <?echo $schreiben?>>
  35.         </td>
  36. </tr>
  37. <tr id="tr1">
  38.         <td class="t1">
  39.                 <? echo $t_pay['cc_exp'] ?><br> <input <?php echo "value=\"$cc_exp\""?> name="cc_exp" size="30" maxlength="20" <?echo $schreiben?>>
  40.         </td>
  41.         <td class="t1">
  42.                 <? echo $t_pay['cc_ccv'] ?><br> <input <?php echo "value=\"$cc_ccv\""?> name="cc_ccv" size="30" maxlength="20" <?echo $schreiben?>>
  43.         </td>
  44.  
  45. </tr>
  46.  
  47. <tr id="tr1">
  48.         <td class="t1">
  49.                 <? echo $t_pay['b_name'] ?><br>  <input <?php echo "value=\"$bname\""?> name="bname" size="30" maxlength="30" <?echo $schreiben?>>
  50.         </td>
  51.         <td class="t1">
  52.                 <? echo $t_pay['c_name'] ?><br>  <input <?php echo "value=\"$cname\""?> name="cname" size="30" maxlength="30" <?echo $schreiben?>>
  53.         </td>
  54. </tr>
  55.  
  56. <tr id="tr1">
  57.         <td class="t1">
  58.                  <? echo $t_pay['b_address']?><br>   <input <?php echo "value=\"$baddress\""?> name="baddress" size="30" maxlength="40" <?echo $schreiben?>>
  59.         </td>
  60.         <td class="t1">
  61.                  <? echo $t_pay['b_city'] ?><br>  <input <?php echo "value=\"$bcity\""?> name="bcity" size="30" maxlength="40" <?echo $schreiben?>>
  62.         </td>
  63. </tr>
  64.  
  65. <tr id="tr1">
  66.         <td class="t1">
  67.                  <? echo $t_pay['b_state'] ?><br>  <input <?php echo "value=\"$bstate\""?> name="bstate" size="10" maxlength="10" <?echo $schreiben?>>
  68.         </td>
  69.         <td class="t1">
  70.                 <? echo $t_pay['b_zip'] ?><br>  <input <?php echo "value=\"$bzip\""?> name="bzip" size="30" maxlength="7" <?echo $schreiben?>>
  71. </td>
  72. </tr>
  73.  
The field cc_num I would like it to run through this script so that it enters the DB encrypted. This way we will be able to retrieve the information later.


Expand|Select|Wrap|Line Numbers
  1. <?
  2. include('clsencrypt.php');
  3. // Create a new Encryption Object
  4. $enc = new Encryption;
  5. $encstr = '';
  6. $decstr = '';
  7. if (isset($_POST['encrypt'])) {
  8.     $key = $_POST['keystr'];
  9.     // Encrypt the Source Text
  10.     $encstr = $enc->encrypt($key, $_POST['text']);
  11. } elseif (isset($_POST['decrypt'])) {
  12.     $encstr = $_POST['enctext'];
  13.     $key = $_POST['keystr'];
  14.     // Decrypt the Encrypted Text
  15.     $decstr = $enc->decrypt($key, $_POST['enctext']);
  16. }
  17. ?>
  18. <FORM action = '<?php echo $_SERVER['PHP_SELF'] ?>' method = 'post'>
  19. <BR>Original Text<BR>
  20. <TEXTAREA name = 'text' cols="40" rows="1" wrap="soft"></TEXTAREA>
  21. <BR>Enter Key String<BR>
  22. <INPUT name = 'keystr' type = 'text' value = ''>
  23. <BR><Input type='submit' value = 'Encrypt' name='encrypt'><Input type='submit' value = 'Decrypt' name='decrypt'>
  24. <input type='reset' name='reset' value='Clear Entries'>
  25. <BR>Encrypted Text<BR>
  26. <TEXTAREA name = 'enctext' cols="40" rows="1" wrap="soft"><?php
  27. if (isset($_POST['encrypt']) || isset($_POST['decrypt']))
  28.     echo $encstr;
  29. ?></TEXTAREA>
  30. <BR>Decrypted Text<BR>
  31. <TEXTAREA name = 'dectext' cols="40" rows="1" wrap="soft"><?php
  32. if (isset($_POST['encrypt']) || isset($_POST['decrypt']))
  33.     echo $decstr;
  34. ?></TEXTAREA>
  35. </FORM>
  36.  
  37.  
Dec 7 '06 #1
3 1463
cassbiz
202 100+
Here is some reading for you:

http://www.dreamincode.net/forums/showtopic6747.htm
http://discuss.fogcreek.com/joelonso...w&ixPost=23596
http://forums.dathorn.com/showthread.php?t=2546

Short answer: don't do it!

Sean
Hey Sean,

In regards to your short answer, why?
Dec 8 '06 #3
cassbiz
202 100+
OK, I did the reading and I will take your advice and not store the data.
Dec 8 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Eric | last post by:
Hey Everyone.. I have a form that has approximately 7 text fields and 1 checkbox. Generally when this form is submitted(to itself BTW) it works fine, however, when the checkbox is only field...
2
by: DB | last post by:
Hi All Having stared at this all morning and altered various things with no effect other then to exasperate the problem i'm wondering if anyone could take a look at the code below and see why on...
15
by: M Smith | last post by:
I have a form I want to submit to itself. I want to be able to type in a list of numbers and submit the form and have that list show up on the same form under the text box I typed them into and...
3
by: Arun K | last post by:
Hi, I am creating a simple .aspx page to add some fields with validation. I have used different .NET validations like REquiredFieldValidator, RegularExpressionValidator and showed the summary...
17
by: DaveG | last post by:
Hi all I am planning on writing a stock and accounts program for the family business, I understand this is likely to take close to 2 years to accomplish. The stock is likely to run into over a...
1
by: kkuniya | last post by:
Situation : - A form (method : POST, action : itself, onsubmit : alert 'Submit' ) - Got 2 submit button ( 'Save' , 'View') - Got navigation 1|2|3|4 What I want to do : - Once clicked on the...
2
by: fliss | last post by:
Hello I have four submit buttons on my page - each carrying a value which refreshes the page selects from my db and displays the results in the drop down. The prob is i would like another...
1
by: gbezas | last post by:
Hi All, I have added an event handler to redirect form.submit() to a newSubmit() method that I have defined (which does some additional processing before submitting the form). Additionally I...
2
by: sbettadpur | last post by:
Hi everybody, Hi iam strugling with more than one submit buttons with in one form here is my code <form method="post" action="Offer.php" name='issueFrm' onSubmit="return fullOfferfields();">...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.