View Full Version : if I am trying to mail a url
of the last page accessed, what type of scripting would be involved? I was not sure where to post this, could be perl, could be JS, I dunno.
I am creating custom error pages for a site. I know how to work the .htaccess file, that is not the issue. I am setting up the error page to Email me when it is accessed, that way I can head it off before it happens again. What I am trying to figure out is if there is a way that I can send the url entered that yeilded the error page to begin with.
it would all be hidden and automated (I think this would be more accurate) so I am trying to find something like a history script that would do it.
I need to take the value of -1 and enter it as a hidden field, the question is, how do I get that negative one value?
Any help or a redirect to the proper forum would be appreciated.
edit >
This example was added to the Uer Help Documentation here:
http://help.powweb.com/info/404.php
I gave it a test run locally, looks great, thank you.
One question, in the page that results, under the last line of text I see "; ?> like this
you can click here to go back to your previous page.
"; ?>
does that little piece need to be moved higher up in the document? (I cut and pasted your post) or does it get deleted?
I know virtually nothing of PHP, so I don't want to just go deleting stuff.
I would assume it safe to change the text parts of the code you wrote out right?
I greatly appreciate the help
Trip
You must have something messed up in the copy to your page. You want it exactly as it is and there should be no
"; ?>
displayed at the end.
Those are the ending php statements which should not be send to the browser. The "; is the end of the print statement and the ?> is the end of php.
Are you sure you have this running through php and not just displaying the html page? Upload it to powweb as a 404.php and give it a try. Note .php NOT .htm
When you say you tried this locally - you can't do that unless you have php and all on your local machine.
see, I knew I knew nothing about PHP. lol
I tested it as an htm file
my testing server here at home is not up right now. I will have to upload it and try it out. just a stupid question, but do you know a good way to force an error? if I delete a file that was linked to I just see a page cennot be displayed page, the same one you see if you don't have an internet connection up.
Thank you, thank you, I really appreciate the help. I am so loaded down between courses and work, I don't heve the brain bandwidth left to learn PHP right now. lol
To test it just type in a bad url
http://www.yourdomain.com/badname.htm
Don't forget to change the email address to your address.
If'n it you don't mind, might I ask if it is safe to modify content inside the <body></body> tags as I would do up a normal page?
and also, how do I add comments, just comments for my reference, in the code? is it easy and won't interfere, or should I just use <!-- inside the html section for my comments?
do you have any idea why I would get an error message 26 times, indicating each of the files on a page that was requested yet didn't exist? they appear to all be parts of a navigation bar.
As for modifying the code - the html is inside a php print statement. The print statement used " as the delimiter. If you want to use more " then you must use \" or use a single '
Go ahead and modify, you will be errors if you mess it up. But that is how you learn. As with most things - you could code this many different ways.
Your next post doesn't make sense to me. Ask the question again with more details. Get an error message where?
I get mail to the address I specified, but I get it 26 E-mails, different each time
here is the first one
Time of the error: June 23 01:25pm
browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)
Page Requested: www.my-domain.com/nullfile.htm
Referer: (I left out my IP and such, but it worked, I also left out my domain, is not publicly released yet)
the second Email was
Time of the error: June 23 01:25pm
browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)
Page Requested: www.my-domain/page_elements/nav_elements/1submissionsg.gif
Referer:
and so on, 26 Emails total, each with a gif from a nav bar, but not all of the images in the nav bar. the gifs being requested do exist and work fine on the other pages, and the page I tried, 'nullfile.htm' never existed.
I successfully modified the appearance, I stayed within the <body> tags and only changed text.
First off, I want to thank you B&T for the script. It works great and has already helped me a lot :)
Trip59,
You might want to do some checking of your page coding, as I've not had any problems running this script. Sounds to me like you may have an image that is being called for that either does not exist or is in a different path than what the code calls for.
If you are using some form of a DHTML or Javascript menu, the referring code may be buried within a .js file.
This script will do 2 things:
1) It will notify you of bad links to your site.
2) It is a great debugging tool for your own site, notifying you of your own invalid references.
As (jj) pointed out, I think you are finding the bad references in your own site coding.
That makes a lot of sense. I'll go check out the files it named and see what the deal with them is. Other than that problem, it worked great, thank you much.
thank you thank you.
I went hunting and found a template that had a bunch of files set to preload that were not even used anymore, hazard of using an editor AND hand coding. I deleted the extra files a while ago from the folder and never new there were still links to them. Without the help of both You and (jj) I would not have known about these, fortunately, since the files didn't exist they weren't getting loaded with each page as preload images (what a waste of bandwidth and time)
Anyhow, it is set up and works wonderfully now, many thanks.
Glad it works for you :)
And you now have your first php script.
vBulletin v3.6.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.