hidden message [php]

technokid88

Part of a System
Joined
15 Feb 2006
Messages
741
OK here is what i need to do.

I have a form put in more then one location on a site. The info gets emailed to the admin of the site.

I am trying to put a hidden message in the php form that the person inputing the info cant see, but only the admin can see in this email. Any help would be much appreciated. I don't think this is too hard either but kind of rusty on my php.

Each form will have a different message the that can be added by editing the code.
 
Last edited:
can you zip it up in a password protected file?

you can of course use a white font which he'll highligt to see what you want him to see but anyone can access once they know
 
So you basically have some fields, which are e-mailed to an address, and you wish to add additional text to the submitted information?

Can you post the code you're using to send the e-mail, and also exactly what extra you need sending.
 
code.........
--------
Code:
<form action="register.php" method="post" onSubmit="return validate()">
  <p>Username: <span class="style1 style5">*</span><br />
    <input type="text" name="username" size="20">
    <br>
Password: <span class="style1 style5">*</span><br />
<input type="password" name="password" size="20">
<br>
First Name: <span class="style1 style5">*</span><br />
    <input type="text" name="name1" size="20">
    <br>
    Last Name:<span class="style1 style5"> *</span><br />
    <input type="text" name="name2" size="20">
    <br>
    E-mail <span class="style1 style5">*</span><br />
    <input type="text" name="email" size="20">
 
  <br>Phone <span class="style1 style5">*</span><br />
    <input type="number" name="phone" size="20">
    <br>
    Cell <br />
    <input type="number" name="cell" size="20">
    <br>
    Street Address<br>
    <input type="text" name="street" size="50">
    <br>City<br>
    <input type="text" name="city" size="20">
    <br>
    State<br>
    <input type="text" name="state" size="10">
    <br>
    Zip<br>
    <input type="number" name="zip" size="15">
    <br>
    <br />
    <input type="submit" value="Sign Up">
Code:
<?php 

include("config.php"); 

// connect to the mysql server
$link = mysql_connect($server, $db_user, $db_pass)
or die ("Could not connect to mysql because ".mysql_error());

// select the database
mysql_select_db($database)
or die ("Could not select database because ".mysql_error());

// check if the username is taken
$check = "select id from $table where username = '".$_POST['username']."';"; 
$qry = mysql_query($check)
or die ("Could not match data because ".mysql_error());
$num_rows = mysql_num_rows($qry); 
if ($num_rows != 0) { 
echo "Sorry, there the username $username is already taken.<br>";
echo "<a href=register1.php>Please try again</a>";
exit; 
} else {

// insert the data
$insert = mysql_query("insert into $table values ('NULL', '".$_POST['username']."', '".$_POST['password']."', '".$_POST['name1']."', '".$_POST['name2']."', '".$_POST['email']."', '".$_POST['phone']."', '".$_POST['cell']."', '".$_POST['street']."','".$_POST['city']."','".$_POST['state']."', '".$_POST['zip']."')")
or die("Could not insert data because ".mysql_error());

$to      = 'admin@whatever.com';
$subject = 'New Registration';
$message = $_POST['username'] . " " . $_POST['password'] . " " . $_POST['name1'] . " " . $_POST['name2'] . " " . $_POST['email'] . " " . $_POST['phone'] . " " . $_POST['cell'] . " " . $_POST['street'] . " " . $_POST['city'] . " " . $_POST['state'] . " " . $_POST['zip'];
$headers =  'From: admin@whatever.com' . "\r\n" .
                 'Reply-To: admin@whatever.com' . "\r\n" .
                 'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);

// print a success message
echo "Your user account has been created for bla blah.com!<br>"; 
echo "Now you can <a href=login1.php>log in</a>"; 
}

?>
well ill have this code in diffrent areas of the site

All i want is a message sent to admin of the site. But the message is hidden from the public.

What i want to check is .. what areas bring the person to register for the site.

So if they choice to go to a page and registers ill have a message "resisted through page 1".

i know you can just pass the image name as a variable in the url... but don't want to do it like that... i have some extra stuff in between the image they click and the forms.
 
Last edited:
On top of what LordofLA said you can also take that hidden value and make it an arbitrary value that is per page(if you have any type of ID# on each of your pages you could use that) and then within register.php use some code to look at a table of these id's and match it up with the value that you want returned for that page. This would make it so that each page needs it's own number as well as that number needs entered on each page. This may not work if your pages are dynamically created(i.e. forums where showthread.php is used to show every thread, you would be able to tell by file that called it, but not necessarily what page called it).

This would make it so that if a user looks at the source of the page the only thing they would see is a number that means nothing to them, but when you receive the email it says exactly what you want it to.
 
Thanks man.. works for me... i knew after you go sleep and you wake up you could figure it out... lol

ok worked perfect thanks for you help lorofla...
 
Last edited:

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. 🙁

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,016
Messages
673,499
Members
5,627
Latest member
Setups
Back