View Full Version : PHP Tracking help
OptWizard
01-12-2003, 16:43/04:43PM
PHP Tracking help
I have a form mail script I am using in PHP
WHat I need to capture is the following
www.mysite.com/quote.php?ID=CODE
I need this CODE to be captured and to be sent within the email form
any help please
for now I am using this $content .= "ID: ". $HTTP_REFERER."\n"; to capture the refferer and it gives me the whole url
__________________
zargon
01-12-2003, 17:31/05:31PM
Originally posted by OptWizard
PHP Tracking help
I have a form mail script I am using in PHP
WHat I need to capture is the following
www.mysite.com/quote.php?ID=CODE
I need this CODE to be captured and to be sent within the email form
any help please
for now I am using this $content .= "ID: ". $HTTP_REFERER."\n"; to capture the refferer and it gives me the whole url
__________________
What version of PHP are you running? For PHP 4.3 try the following.
If this is a POST do:
$content .= "ID: ".$_POST["ID"]."\n";
If this is a GET do:
$content .= "ID: ".$_GET["ID"]."\n";
OptWizard
01-12-2003, 17:38/05:38PM
I used
<input name="ID" type="hidden" value="<? echo $_SERVER['QUERY_STRING'];?>">
and it works
How would you use what you said?
zargon
01-12-2003, 17:48/05:48PM
Originally posted by OptWizard
I used
<input name="ID" type="hidden" value="<? echo $_SERVER['QUERY_STRING'];?>">
and it works
How would you use what you said?
Try this:
For a GET:
<input name="ID" type="hidden" value="<? echo($_GET['ID']);?>">
For a POST:
<input name="ID" type="hidden" value="<? echo($_POST['ID']);?>">
AndrewB
01-12-2003, 22:21/10:21PM
Zargon is correct
don't use $_SERVER['QUERY_STRING']; as it returns everything after the ? eg
www.mysite.com/quote.php?ID=CODE&PID=NUM&A=B
it will return "ID=CODE&PID=NUM&A=B"
I'm not sure why you can say it worked for you as it would have return "ID=CODE" for you but you just want CODE
OptWizard
02-12-2003, 10:03/10:03AM
that worked great thanks...
Next question is this...How can I keep that code to follow with each page like in ASP user session...
So this code follower user per session
zargon
02-12-2003, 10:33/10:33AM
Originally posted by OptWizard
that worked great thanks...
Next question is this...How can I keep that code to follow with each page like in ASP user session...
So this code follower user per session
Try:
$_SESSION["ID"] = $_GET['ID'];
or
$_SESSION["ID"] = $_POST['ID'];
OptWizard
02-12-2003, 14:19/02:19PM
so do this
<input name="ID" type="hidden" value="$_SESSION["ID"] = $_GET['ID'];">
Where di I put
$_SESSION["ID"] = $_GET['ID'];
zargon
02-12-2003, 14:24/02:24PM
Originally posted by OptWizard
so do this
<input name="ID" type="hidden" value="$_SESSION["ID"] = $_GET['ID'];">
Where di I put
$_SESSION["ID"] = $_GET['ID'];
No, do this.
<?php
$_SESSION["ID"] = $_GET['ID'];
?>
<input name="ID" type="hidden" value="<? echo($_SESSION["ID"]);?>">
FYI: you might need to check to make sure that "ID" is set in the session on other pages.
if(isSet($_SESSION["ID"])) {
sorry, had to edit the code. it was wrong.
OptWizard
02-12-2003, 14:26/02:26PM
WHAT DO YOU MEAN SET
and where do I put
the code
thanks
zargon
02-12-2003, 14:36/02:36PM
Originally posted by OptWizard
WHAT DO YOU MEAN SET
If you plan to have the "session" information accessible from other pages and any of those pages can be access directly, then you need to make sure to check to see if the variable in the session exists. If not you will get a warning.
So, if I had a page that I need to have the session checked do this:
<?php
if (isSet($_SESSION["ID"]) {
?>
<input name="ID" type="hidden" value="<? echo($_SESSION["ID"]);?>">
<?php
}
?>
OptWizard
02-12-2003, 14:47/02:47PM
So I need to do is this put this on all the pages
<?php
if (isSet($_SESSION["ID"]) {
?>
<input name="ID" type="hidden" value="<? echo($_SESSION["ID"]);?>">
<?php
}
?>
so the ID follows throught the page
Do I put this code top bottom head of page?
OptWizard
02-12-2003, 15:03/03:03PM
Do I put this code in the php mail form or on the app?
zargon
02-12-2003, 15:12/03:12PM
Once you add the value to the session you don't need to add it again not unless you want to update it.
So doing this:
$_SESSION["ID"] = $_GET['ID'];
Adds the value to the session.
Now you don't need to add this code:
<?php
if (isSet($_SESSION["ID"]) {
?>
<input name="ID" type="hidden" value="<? echo($_SESSION["ID"]);?>">
<?php
}
?>
unless you want to put a hidden field in your form with the value that the session contains.
Sounds like to me what you want to do is add the value to the session once. Then allow the user to still browse around your site. Now at some point if the user wants to mail you, you want to capture the information that is stored in the session. Is this correct?
OptWizard
02-12-2003, 15:58/03:58PM
Yes you are correct I want to capture that session ID
So I put this on say the quote and main page
<?php
if (isSet($_SESSION["ID"]) {
?>
where do I place this on the page
The I would place this on the page with the form
<input name="ID" type="hidden" value="<? echo($_SESSION["ID"]);?>">
correct?
and no matter where they go that id will follow them even if they go to a page without PHP and then go to the form that ID will still be there right example
they go here
www.site.com/index.php?ID=Google
then they go to
www.site.com/about.htm
then they go to
www.site.com/quote.php
that ID will follow them right?
zargon
02-12-2003, 16:15/04:15PM
On the main page and quote page put this:
<?php
$_SESSION["ID"] = $_GET['ID'];
?>
That will add the value to the session. Now your user can go anywhere on your site. At some point if you want to add the session value to a form then you do this:
<?php
if (isSet($_SESSION["ID"]) {
?>
<input name="ID" type="hidden" value="<? echo($_SESSION["ID"]);?>">
<?php
}
?>
What that code does it checks to see if the value (ID) is in the session. If so, it prints an <input> tag with the value that is in the session.
Hope this helps! :)
OptWizard
02-12-2003, 16:31/04:31PM
Where do I put
<?php
$_SESSION["ID"] = $_GET['ID'];
?>
on the page and
where do I put
<?php
if (isSet($_SESSION["ID"]) {
?>
<input name="ID" type="hidden" value="<? echo($_SESSION["ID"]);?>">
<?php
}
?>
on the form page?
Thanks alot for all the help
zargon
02-12-2003, 16:45/04:45PM
Originally posted by OptWizard
Where do I put
<?php
$_SESSION["ID"] = $_GET['ID'];
?>
on the page
Put it by the top of the page.
Originally posted by OptWizard
where do I put
<?php
if (isSet($_SESSION["ID"]) {
?>
<input name="ID" type="hidden" value="<? echo($_SESSION["ID"]);?>">
<?php
}
?>
on the form page?
Yes
:cheers:
OptWizard
02-12-2003, 16:49/04:49PM
I did that and the form did not come up let me try again
I put it on and now the form wont come up dont work?
zargon
02-12-2003, 16:55/04:55PM
Sorry.
Add this to the top of the page:
<?php
session_start();
$_SESSION["ID"] = $_GET['ID'];
?>
:D
OptWizard
02-12-2003, 17:06/05:06PM
nope did not work :-(
zargon
02-12-2003, 17:13/05:13PM
Originally posted by OptWizard
nope did not work :-(
Sorry, make sure on the page that has this code:
<?php
if (isSet($_SESSION["ID"]) {
?>
<input name="ID" type="hidden" value="<? echo($_SESSION["ID"]);?>">
<?php
}
?>
you also have this code at the top of the page:
<?php
session_start();
?>
The session needs to be started if you want to access session information. :)
OptWizard
02-12-2003, 17:15/05:15PM
no i am officially confused...
what is the exact coding do i need on my site
zargon
02-12-2003, 17:31/05:31PM
Originally posted by OptWizard
no i am officially confused...
what is the exact coding do i need on my site
Page to capture the ID
at the top of the page
<?php
session_start();
$_SESSION["ID"] = $_GET['ID'];
?>
Quote page or the page to mail the information
at the top of the page
<?php
session_start();
?>
for the mail form
<?php
if (isSet($_SESSION["ID"]) {
?>
<input name="ID" type="hidden" value="<? echo($_SESSION["ID"]);?>">
<?php
}
?>
Sorry for the confusion :)
zargon
02-12-2003, 17:42/05:42PM
I just tested everything and it works (well I found one error).
Set id page example
<?php
session_start();
$_SESSION["ID"] = $_GET['ID'];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
<b>The id has been set to <? echo($_SESSION["ID"]);?></b>
</body>
</html>
Print ID page example
<?php
session_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
<?php
if (isSet($_SESSION["ID"])) {
?>
<input name="ID" type="hidden" value="<? echo($_SESSION["ID"]);?>">
<? echo($_SESSION["ID"]);?>
<?php
}
?>
</body>
</html>
NOTE... this example also prints the id '<? echo($_SESSION["ID"]);?>' you can take that out of your code.
Hope this helps! :)
OptWizard
03-12-2003, 11:25/11:25AM
That seems to work but one slight problem...
when you go back or if someone does not fill out form fully and you go back it wipes out everything that the person input..this can be very annoying to the client?
Anyway to fix that...
You have been nothing but a great help thanks for everything
I also tested app and the ID did not follow I tested with ID then without? Maybe I am doing something wrong
zargon
03-12-2003, 11:35/11:35AM
Originally posted by OptWizard
That seems to work but one slight problem...
when you go back or if someone does not fill out form fully and you go back it wipes out everything that the person input..this can be very annoying to the client?
Anyway to fix that...
You have been nothing but a great help thanks for everything
The form that is being submitted does a POST right?
OptWizard
03-12-2003, 11:40/11:40AM
Yes a post
If I go stright to the form this is what I get as a result
PHPSESSID: 85b2917427384574243f162ef6c65e22
if I go through anbouther page the ID is passed?
So doI need to put this atop every page
<?php
session_start();
$_SESSION["ID"] = $_GET['ID'];
?>
or will this change Session with each page
zargon
03-12-2003, 11:57/11:57AM
Originally posted by OptWizard
Yes a post
If you change it to a GET then when users click on the back button the information they submitted will not be cleared. You would have to change anywhere you used $_POST to $_GET
If you don't want to change it to a GET then you need to code that functionality manually. :(
Originally posted by OptWizard
I also tested app and the ID did not follow I tested with ID then without? Maybe I am doing something wrong
You might be... I uploaded the code I gave you to my site:
http://www.freelancelounge.com/test/setid.php?ID=testing
If you click on that link it will set the session ID to testing. Then go anywhere else on the site. Once you have done that go back to this page:
http://www.freelancelounge.com/test/getid.php
You should see the information.
OptWizard
03-12-2003, 12:01/12:01PM
if I change to get will app still be emailed?
also this is what i mean about the session id
it works fine if I do this
www.site.com/index.php?ID=TEST
the test will follow
but if I go straight to the app
www.site.com/app.php?ID=NEWTEST
that new test will not show?
Basically what I need is whatever page I start from I need that code to follow can this be done. Be it the index be it the app page...
zargon
03-12-2003, 12:18/12:18PM
Originally posted by OptWizard
if I change to get will app still be emailed?
also this is what i mean about the session id
it works fine if I do this
www.site.com/index.php?ID=TEST
the test will follow
but if I go straight to the app
www.site.com/app.php?ID=NEWTEST
that new test will not show?
Basically what I need is whatever page I start from I need that code to follow can this be done. Be it the index be it the app page...
No problem. Just add this code at the top of the app page (or any other page).
For GET:
<?php
session_start();
$_SESSION["ID"] = $_GET['ID'];
?>
For POST
<?php
session_start();
$_SESSION["ID"] = $_POST['ID'];
?>
OptWizard
03-12-2003, 12:35/12:35PM
Sorry about this but that did not work
if I come from
www.site.com/index.php?ID=TEST from there click to
www.site.com/quote.php
adding
this like you said to quote
it does not pick up the test
id gives me back a blank cause a new session is started I think
zargon
03-12-2003, 12:44/12:44PM
Originally posted by OptWizard
Sorry about this but that did not work
if I come from
www.site.com/index.php?ID=TEST from there click to
www.site.com/quote.php
adding
this like you said to quote
it does not pick up the test
I'm sorry. You're right... The code was overwriting the value.
Do this:
<?php
session_start();
if (!isSet($_SESSION["ID"])) {
$_SESSION["ID"] = $_GET['ID'];
}
?>
Now only if the session ID is not set it will try to add it. Remember to use $_POST or $_GET
OptWizard
03-12-2003, 12:48/12:48PM
BINGO
I think that is working I will do some more testing on it but thanks for everything you have been a great help...
I am now a PHP wiz....LOL if I have more questions I will post or do you have IM?
zargon
03-12-2003, 12:53/12:53PM
Originally posted by OptWizard
BINGO
I think that is working I will do some more testing on it but thanks for everything you have been a great help...
I am now a PHP wiz....LOL if I have more questions I will post or do you have IM?
Great!
I just sent you a PM. :)
OptWizard
03-12-2003, 13:22/01:22PM
thnaks
One more question what is the difference between
<?php
session_start();
if (!isSet($_SESSION["ID"])) {
$_SESSION["ID"] = $_GET['ID'];
}
?>
and
<?php
session_start();
if (!isSet($_SESSION["ID"])) {
$_SESSION["ID"] = $_POST['ID'];
}
?>
which do I need to use?
zargon
03-12-2003, 14:16/02:16PM
For GET:
Originally posted by OptWizard
<?php
session_start();
if (!isSet($_SESSION["ID"])) {
$_SESSION["ID"] = $_GET['ID'];
}
?>
For POST
Originally posted by OptWizard
<?php
session_start();
if (!isSet($_SESSION["ID"])) {
$_SESSION["ID"] = $_POST['ID'];
}
?>
OptWizard
03-12-2003, 14:18/02:18PM
I know that but what is the difference in a GET OR POST
what would I use....or what should I use
I get this what does this mean?
PHPSESSID: 86375812e3e82dbe4130e410fc843547
zargon
03-12-2003, 14:24/02:24PM
Originally posted by OptWizard
I know that but what is the difference in a GET OR POST
what would I use....or what should I use
I'm sorry. The way you can figure out which one to use is if you are using a form and the "method" attribute is set to "POST" then its a post.
Anything else, its a GET. So accessing the page directly would be a GET. Using a form with the method attribute set to "POST" that would be a POST.
Hope this helps.
OptWizard
03-12-2003, 14:26/02:26PM
SO my form is set to post so I should use post correct...
what does this mean
PHPSESSID: 86375812e3e82dbe4130e410fc843547 i got this from the form
also when would I use a get?
zargon
03-12-2003, 14:34/02:34PM
Yes
Originally posted by OptWizard
SO my form is set to post so I should use post correct...
I'm not sure. Is this being printed in the HTML or URL??
Originally posted by OptWizard
what does this mean
PHPSESSID: 86375812e3e82dbe4130e410fc843547 i got this from the form
Use GET when the value you want is in the URL (mypage.php?ID=CODE)
Originally posted by OptWizard
also when would I use a get?
OptWizard
03-12-2003, 14:54/02:54PM
It is being email to me via the form
ok so the top parts for tracking should be gets
zargon
03-12-2003, 14:58/02:58PM
Your mail script must be sending you the "real" user session ID that PHP uses.
Originally posted by OptWizard
It is being email to me via the form
In almost all cases yes.
Originally posted by OptWizard
ok so the top parts for tracking should be gets
OptWizard
03-12-2003, 15:00/03:00PM
I gues cause when I go through index page I just get
ID=CODE
when I go through quote page I get
PHPSESSID: fa5402e69161b9cdff2c4dbcdf149c7a
ID=CODE
I do not need this
PHPSESSID: fa5402e69161b9cdff2c4dbcdf149c7a
other wise it works great now
can this be fixed...
so gets on top and form I leave as post
PROBLEM
just had outside source test app and only the PHPSESSID was captured from the app page testing the index page now
Also when scripting errors are allowed I get one says object is expected...is this a problem?
zargon
03-12-2003, 15:46/03:46PM
Originally posted by OptWizard
Also when scripting errors are allowed I get one says object is expected...is this a problem?
Does it give you a line number?
OptWizard
03-12-2003, 15:54/03:54PM
yes line 8 but that is the line that says
<html>
also I noticed when i get the PHPSESSIONID
is when I put in
www.site.com/quote.php?ID=CODE
if I refresh the PHPSESSION goes away?
zargon
03-12-2003, 15:57/03:57PM
Originally posted by OptWizard
yes line 8 but that is the line that says
<html>
also I noticed when i get the PHPSESSIONID
is when I put in
www.site.com/quote.php?ID=CODE
if I refresh the PHPSESSION goes away?
Post the PHP code you have before line 8
OptWizard
03-12-2003, 16:02/04:02PM
OK i also noticed this in the sosurce this is were phpsession is coming from
<input type="hidden" name="PHPSESSID" value="ff9c629dd0d91fdeaa267d7649e0abf9" />
and it is not in the raw code
this is all the code before html in order
<?php
session_start();
if (!isSet($_SESSION["ID"])) {
$_SESSION["ID"] = $_GET['ID'];
}
?>
also if I have this on the app page
<?php
if (isSet($_SESSION["ID"])) {
?>
<input name="ID" type="hidden" value="<? echo($_SESSION["ID"]);?>">
<?php
}
?>
do I need this twice at the top and the middle of app?
<?php
if (isSet($_SESSION["ID"])) {
?>
zargon
03-12-2003, 16:17/04:17PM
Originally posted by OptWizard
do I need this twice at the top and the middle of app?
Yes, one sets the value if it doesn't exist. The other checks if the value exists and prints a <input>
Can you post or PM me a link to the page? I can't see anything wrong with the code you posted so I would like to try testing it myself.
OptWizard
03-12-2003, 16:51/04:51PM
Found out what it was fixed...
Now the only problem is the PHPSESSIONID=
zargon
03-12-2003, 17:28/05:28PM
Originally posted by OptWizard
Found out what it was fixed...
Now the only problem is the PHPSESSIONID=
COOL!
Sorry for the delay. I had to step away from the computer for a few :)
The PHPSESSIONID should be pretty easy to find. Just look in your mail script and you should see the code thats printing the <input> tag.
OptWizard
03-12-2003, 17:37/05:37PM
its this tag
<?php
if (isSet($_SESSION["ID"])) {
?>
<input name="ID" type="hidden" value="<? echo($_SESSION["ID"]);?>">
<?php
}
?>
but doesnt that print the seesion ID
<input type="hidden" name="PHPSESSID" value="ba1b9592fb2ea947d5caf1b83afb3b1c" />
only happens when you go straight to quote dissapears if you refresh odd
the odd thing is this tag is not even in my coding i have no tag names="PHPSESSIONID" only the one above names ID
WOW a 6 page thread with just me and you LOL
zargon
03-12-2003, 17:46/05:46PM
Originally posted by OptWizard
its this tag
<?php
if (isSet($_SESSION["ID"])) {
?>
<input name="ID" type="hidden" value="<? echo($_SESSION["ID"]);?>">
<?php
}
?>
but doesnt that print the seesion ID
<input type="hidden" name="PHPSESSID" value="ba1b9592fb2ea947d5caf1b83afb3b1c" />
only happens when you go straight to quote dissapears if you refresh odd
WOW a 6 page thread with just me and you LOL
I don't think it is. Look at the "name" attribute. The one I gave you has "ID". The one that is getting printed has "PHPSESSID"
I think that code is in your mail script or the script that posts to the mail script.
OptWizard
03-12-2003, 17:51/05:51PM
nothing in mail script that says that
if I refresh it goes away?
what am I looking for?
zargon
03-12-2003, 17:53/05:53PM
Originally posted by OptWizard
nothing in mail script that says that
if I refresh it goes away?
what am I looking for?
Search your code for this:
name="PHPSESSID"
or
name=\"PHPSESSID\"
OptWizard
03-12-2003, 18:05/06:05PM
I see nothing
Going home will continue tomorrow
OptWizard
04-12-2003, 09:56/09:56AM
I checked the mail form and I do not see where that is?
zargon
04-12-2003, 10:08/10:08AM
Originally posted by OptWizard
I checked the mail form and I do not see where that is?
I just checked your quotenew180.php page (because the page you sent me yesterday isn't working). But if you look right after the start form tag, the very next field you see is that PHPSESSID. Remove the code that is printing the PHPSESSID field.
OptWizard
04-12-2003, 10:22/10:22AM
what page is not working?
that is the funny thing that code is not in the code...it only shows up when I go to the page in the source...
If I go to raw code that line is not there?
zargon
04-12-2003, 10:28/10:28AM
Originally posted by OptWizard
what page is not working?
that is the funny thing that code is not in the code...it only shows up when I go to the page in the source...
If I go to raw code that line is not there?
This page quotenew180test.php.
That is very weird you can't find the code... You might want to email your web host and ask them. Or in your mail script... You could hack it so it doesn't sent that field to you. But that might be more trouble than its worth.
OptWizard
04-12-2003, 10:32/10:32AM
what exactly is that code? and where is it coming from caus eit aint on the raw code of the form and it aint in the mail form
the mail form does have this
<?php
$post_info = $HTTP_POST_VARS['CODE'];
print("Here are the post variables:<br><br>");
foreach($post_info as $key=>$val)
{
print("$key: $val<br>");
}
zargon
04-12-2003, 10:39/10:39AM
Originally posted by OptWizard
<?php
$post_info = $HTTP_POST_VARS['CODE'];
print("Here are the post variables:<br><br>");
foreach($post_info as $key=>$val)
{
print("$key: $val<br>");
}
Somewhere in this script you should find a place where it is building up a string to mail the form values. Start looking there.
OptWizard
04-12-2003, 10:42/10:42AM
that would be here
//This produces the html email and makes it possible to include an attachment
$real_email_message = $content;
//BEGIN //----------------------------------------------
$email_message=formathtml($real_email_message);
$chked=0;
if ($upfile == "") $chked=1;
if (checkfileatt($upfile_name,$upfile_size)!="No file attached") $chked=1;
if($chked==0) {
copy($upfile, $upfile_name);
$fileatt=$upfile_name;
$fileatt_type=$upfile_type;
$fileatt_name=$upfile_name;
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
}
$headers = "From: ".$email;
//$headers = "From: ".$email_from;
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";
$email_message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type:text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $email_message . "\n\n";
$data = chunk_split(base64_encode($data));
if($chked == 0)
{
$email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . "Content-Disposition: attachment;\n" . " filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" ."--{$mime_boundary}--\n";
}
else
{
/* leave this line out $email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . "Content-Disposition: attachment;\n" . " filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" ."--{$mime_boundary}--\n";
*/
}
$sending_ok = @mail($recipient, $subject, $email_message, $headers);
if($chked==0) unlink($upfile_name);
//end MIME email code
zargon
04-12-2003, 10:44/10:44AM
Post this function:
formathtml()
OptWizard
04-12-2003, 10:50/10:50AM
here you go
//This is to format the html email we're about to send to you
function formathtml($text){
$text=stripslashes($text);
$text=str_replace("\r\n","<BR>",$text);
$text=str_replace("\n","<BR>",$text);
return $text;
}
zargon
04-12-2003, 11:02/11:02AM
Hmmm... The only thing I can think of is to write a PHP regular expression to remove the PHPSESSID from the $email_message string right before the mail function is called. But... I'm not that good with regular expressions. Here is a link:
http://us4.php.net/pcre
Hope this helps :)
OptWizard
04-12-2003, 11:08/11:08AM
as you said before no biggie on this all it is is an extra line of code in the email....
one stupid question how can I make all the emails sent formated like this
the here's are lined up
name: Here
Address: Here
now they are coming in like this
name: Here
Address: Here
OptWizard
04-12-2003, 11:27/11:27AM
all I did is add it to here
$reserved_keys[] = "PHPSESSID";
and now it does not print
THANK YOU FOR EVERYTHING:cheers:
zargon
04-12-2003, 11:30/11:30AM
Originally posted by OptWizard
all I did is add it to here
$reserved_keys[] = "PHPSESSID";
and now it does not print
THANK YOU FOR EVERYTHING:cheers:
VERY COOL! :cheers:
OptWizard
08-12-2003, 11:23/11:23AM
New problem...
this should be easy
what need to happen is this...I need the Code tracking to default to ID=Website
if no code is implyed meaning
if someone comes from here
www.website.com
then ID = website
if the come from
www.website.com/index.php?ID=CODE
then ID=CODE
get it?
I guess I would add something here?
<?php
if (isSet($_SESSION["ID"])) {
?>
<input name="ID" type="hidden" value="<? echo($_SESSION["ID"]);?>">
<?php
}
?>
and if statement of some sort
zargon
08-12-2003, 11:46/11:46AM
Try this:
<?php
if (isSet($_SESSION["ID"])) {
?>
<input name="ID" type="hidden" value="<? echo($_SESSION["ID"]);?>">
<?php
}
else {
if (!isSet($_GET["ID"])) {
$_SESSION["ID"] = "website";
}
}
?>
This code checks the session. If ID doesn't exist it checks the query string to make sure it ID doesn't exist there, if not it sets the session ID to website.
Hope this helps.
AndrewB
08-12-2003, 11:49/11:49AM
You don't need a session variable if your using ID=CODE in your url.
you can say
if (isset($_GET['ID']))
$id = $_GET['ID'];
else
$id = "something else";
so that says if there is variable ID in the url then make it equal to the value of ID else if it's not set then it equals something else.
OptWizard
08-12-2003, 11:55/11:55AM
I do need the session cause I want the ID to follow the whole session
It worked fin I just need to add a line
<?php
if (isSet($_SESSION["ID"])) {
?>
<input name="ID" type="hidden" value="<? echo($_SESSION["ID"]);?>">
<?php
}
else {
if (!isSet($_GET["ID"])) {
$_SESSION["ID"] = "KCC.COM";
}
}
?>
<input name="ID" type="hidden" value="<? echo($_SESSION["ID"]);?>">
this last line printed the code if no variable was set without it does not come out seem right?
AndrewB
08-12-2003, 12:07/12:07PM
Ok you need sessions then why do u need
<input name="ID" type="hidden" value="<? echo($_SESSION["ID"]);?>">
i'm assuming you want to pass ID around other pages but it's already in $_SESSION["ID"]
unless your using some javascript with this line i don't see a need for it
OptWizard
08-12-2003, 12:17/12:17PM
cause I need it to be printed out on a form
AndrewB
08-12-2003, 12:21/12:21PM
Ah I c but i think you meant type="text" you have type="hidden" which means nothing will show on the screen
OptWizard
08-12-2003, 12:28/12:28PM
exactly hidden until I need it printed
OptWizard
17-12-2003, 10:46/10:46AM
Got another question about this hope you are there...
when someone fills out this form and say goes back they loose all the information? How can I fix this and also your thoughts on the following
PHP tracking or Cookies?
I have a web form i need to be filled out on the web then it is emailed to me. The question I have is this what is better tracking COOKIES or PHP for example
www.website.com/app.php?ID=CODE
or
www.website.com/app.htm?ID=CODE This in turn calls a javascript to retreave CODE
the main question is this if someone has there cookies shut off will I still be able to track this?
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.