logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 01-28-2012, 05:09 PM   #1
gigiloumill
gigiloumill's Avatar
 
Join Date: Apr 2009
Location: Miami, FL
Posts: 493
Default Hiding webform keys in PHP

Good morning guys: I have a rather technical question. The contact form if I have in a website has the following html

HTML Code:
<form method="POST" name="myform" action="http://www.test.com/crm/test/test/test.php">
  <input type="hidden" value="Contacts" name="moduleName" />
  <input type="hidden" value="****************12345" name="appKey" />
code:

When the reader hits submit, the form pushes the info to the action above and then it goes into a CRM. My question is: Is there a php script I can include in a page that I can send action to and have the keys in there? right now the keys are open to the public and obviously I have them to hide for security reasons..as always thanks in advance.
__________________
Keeping your business connected.
www.starionmedia.com
gigiloumill is offline   Reply With Quote
Old 01-29-2012, 12:02 AM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,176
Default

its basically a variable so it can be converted . quick example below

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<form action="" method="POST" name="form"><br />

<input name="first" type="text" /><br />

<input name="appkey" type="hidden" value="appkey" />
<br />
<input name="" type="submit" value="Submit" />



</form>
hidden value =<?php echo $_POST['appkey']; ?>

<?php if($_POST['appkey']=="appkey"){
	
$_POST['appkey']="111xxxxxxxx34" ;}

?><br />

new value =<?php echo $_POST['appkey']; ?>

</body>
</html>
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 01-29-2012, 01:38 AM   #3
gigiloumill
gigiloumill's Avatar
 
Join Date: Apr 2009
Location: Miami, FL
Posts: 493
Default

Thanks E...I'll look into and post..
__________________
Keeping your business connected.
www.starionmedia.com
gigiloumill is offline   Reply With Quote
Old 01-29-2012, 01:51 AM   #4
gigiloumill
gigiloumill's Avatar
 
Join Date: Apr 2009
Location: Miami, FL
Posts: 493
Default

O.K. I tried it but I can't figure out where to include the action page:
Code:
<form method="POST" name="myform" action="http://www.test.com/crm/test/test/test.php">
__________________
Keeping your business connected.
www.starionmedia.com
gigiloumill is offline   Reply With Quote
Old 01-29-2012, 01:57 AM   #5
gigiloumill
gigiloumill's Avatar
 
Join Date: Apr 2009
Location: Miami, FL
Posts: 493
Default

Here's the entire code i'm using..
Code:
<form method="POST" name="myform" action="http://www.test.com/crm/test/test/test.php">
        <input type="hidden" value="Contacts" name="moduleName" />
  		<input name="appkey" type="hidden" value="appkey" />
       		<label>
	           <span>Name:
	           </span>
	           <input type="text" name="firstname" id="firstname"/>
	           
	        </label>
           <label>
	           <span>lAST Name:
	           </span>
	           <input type="text" name="lastname" id="lastname"/>
	           
	        </label>
	        <label>
	           <span>E-mail:
	           </span>
	           <input type="text" name="email" id="email"/>
	           
	        </label>
	         <label>
	            <span>Subject:
	            </span>
	            <input type="text" name="subject" id="subject"/>
	            
	        </label>
	        <label>
	            <span>Message:
	            </span>
	            <textarea name="message" id="message">
	            </textarea>
              <input type="submit" class="button" value="Send" />
	            
	        </label> 
	          
		  </form>
         hidden value =<?php echo $_POST['appkey']; ?>

<?php if($_POST['appkey']=="appkey"){
	
$_POST['appkey']="*****************1234" ;}

?><br />

new value =<?php echo $_POST['appkey']; ?> 
</div>
	<div class="clear">
	</div>
Thanks
__________________
Keeping your business connected.
www.starionmedia.com
gigiloumill is offline   Reply With Quote
Old 01-29-2012, 02:38 AM   #6
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,176
Default

put the if condition at the begining of the http://www.test.com/crm/test/test/test.php as it wont be a POST value until submitted
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 01-29-2012, 04:14 PM   #7
gigiloumill
gigiloumill's Avatar
 
Join Date: Apr 2009
Location: Miami, FL
Posts: 493
Default

O.K. E, this is what I got so far, after trying all different ways.
PHP Code:
<form method="POST" name="myform" <?php if($_POST['appkey']=="appkey"){
    
$_POST['appkey']="*****************12345" ;}

?> action="http://www.test.com/test/test/test/test.php" > 

        <input type="hidden" value="Contacts" name="moduleName" />
          <input name="appkey" type="hidden" value="appkey" />
               <label>
               <span>Name:
               </span>
               <input type="text" name="firstname" id="firstname"/>
               
            </label>
           <label>
               <span>lAST Name:
               </span>
               <input type="text" name="lastname" id="lastname"/>
               
            </label>
            <label>
               <span>E-mail:
               </span>
               <input type="text" name="email" id="email"/>
               
            </label>
             <label>
                <span>Subject:
                </span>
                <input type="text" name="subject" id="subject"/>
                
            </label>
            <label>
                <span>Message:
                </span>
                <textarea name="message" id="message">
                </textarea>
              <input type="submit" class="button" value="Send" />
                
            </label> 
              
          </form>
When I submit form, it obviously doesn't go in the crm. I can't find a spot to place these:
PHP Code:
hidden value =<?php echo $_POST['appkey']; ?>
new value =<?php echo $_POST['appkey']; ?>
It seems that no matter where I'd placed them, I get an error..Any other suggestions? Thanks
__________________
Keeping your business connected.
www.starionmedia.com
gigiloumill is offline   Reply With Quote
Old 01-30-2012, 03:46 AM   #8
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,176
Default

you need to add <?php if($_POST['appkey']=="appkey"){

$_POST['appkey']="111xxxxxxxx34" ;}

?>

edit for actual key and form field name
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 01-30-2012, 11:10 AM   #9
gigiloumill
gigiloumill's Avatar
 
Join Date: Apr 2009
Location: Miami, FL
Posts: 493
Default

E, I have added it everywhere, and it still doesn't work. I have followed your directions with no luck. Exactly where does this thing get placed? Thanks
__________________
Keeping your business connected.
www.starionmedia.com
gigiloumill is offline   Reply With Quote
Old 01-31-2012, 01:16 AM   #10
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,176
Default

ok let me try step by step
the form will send a $_POST array
the hidden field will be sent to the script (http://www.test.com/test/test/test/test.php) as $_POST['appkey'] with the value appkey.

if you add
Code:
<?php if($_POST['appkey']=="appkey"){
$_POST['appkey']="111xxxxxxxx34" ;}
?>
before the script process ie at the top of the http://www.test.com/test/test/test/test.php page

then $_POST['appkey'] will be seen by the script as the new value.
I dont know how the script is coded but that should work
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:06 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com