• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

hidden message [php]

technokid88

Part of a System
#1
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:

Perris Calderon

Moderator
Staff member
Political User
#2
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
 

SPeedY_B

I may actually be insane.
#3
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.
 

technokid88

Part of a System
#4
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:

Ferretlovers

Giver of 2 Cents
#6
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.
 

technokid88

Part of a System
#7
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

Latest posts

Latest profile posts

Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,961
Messages
673,239
Members
89,013
Latest member
Pdawgintown