Finding Referer In PHP
I'm trying to determine the location a user has come from when they access a script of mine (a custom web logging script). I've searched the manual for 'referer' but can't find any relevant references and looking at output from phpinfo doesn't shed any light on which, if any, variables might hold info about where the user has come from.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Referer
I'm looking for a way to change the refferer of the client clicking on a link to an external site. In other words, the external site should not see where the visitor is coming from, or even better, if i could manipulate the referer so that in their web-server's logs it will show as if they are coming from their own site. I've tried different ideas none of which worked.
404 Get Referer ?
Is it possible to catch the referer when using a 404 document ? for example, someone surfs to www.test.com/mkqjdfkjdfk mkdjfmqkd doesn't excist, so I want to catch this string to analyze it further on ..
Referer
Is it possible to get the page anchor name when using $_SERVER['HTTP_REFERER'];? So instead of mysite.com/one.html it'll show mysite.com/one.html#two
Referer?
I want to make something so that you can only see a page if you have been referred there by a certain page. For example www.bla.com/test.php can only be accessed if the page it was linked from was www.bla.com/test123.php. How would i go about doing this? You don't have to litrally write the code out if you don't want to, just an idea of what i have to learn/read in order to do this (i know basic php, been doing it for a while but ive had a big break so i don't remember much).
Referer Header
I wasn't too clear about how the referer header works if sent on a php page on domain Z. Does it mean that it will send to the destination server a referer specified in the header, even if it is not the actual referer of the site? e.g. header("Referer: http://www.wanttosendthis.com"); header("Location: http://www.anothersite.com"); With anothersite.com show in it's logs the referer as wanttosendthis.com?
Getting Referer Of Script In PHP
I need to obtain the URL of the site that called one of my scripts. My code on client side looks like this: <SCRIPT type="text/javascript" src="http://example.com/scripts/apiscript.php?key=[hash of site]"> on server side, what do I have to do to get the referer (calling url), so that I can use it to calcuate the required hash?
Cache And Referer
if we click on back on this browser, this forum somehow refreshes itself. So I assume it uses something like cache. But what about sometimes, like we're filling up a form and click on submit than later realize we miss out something and this time when we click back, we get a "Warning, page had expired". So is this also using cache? If this two is the same case, how come this forum won't get affected by the expired page? For the HTTP_Referer, I'm sorry but can anyone show some example like how do we stick this function to remember every part of the click on our site link like this forum? I'm really desperate to know this answer and hope someone could just briefly go through these two functions to me (rather than send me to php.net or any site) I don't mean to repeat this and hope no one will get offended by this post. I just need a little explaination.
Http Referer?
I'm bulding this web site and I do not want other to link to my pages. I can use on every sinle page the http_referer to detect who's the referer and decide if I have to give access or not... but isn't there a better way of doing this instead of putting a piece of code on very single page ?
Page Referer Not Getting Set
I do web design for some small organizations, and one of the sites I have set up takes online conference registrations. Now, most of the time it works. In fact, every time I try it, it works fine. However, after having many complaints about it not working right, I finally discovered that some of my users do not have the page referer set when they request my page, and I was checking on the form submission page to make sure that the referer was the correct page. What could cause people to not have their referer set? What is the solution for this sort of problem? Just don't check the referer?
IP Lookup Or HTTP Referer
I want to know if there is a function that I can know the IP of a user. For HTTP_REFERER, I can get the URL from the user such as www.sony.com. BUT is there any way I can also know the IP of that?
How To Keep A REFERER After Redirecting With .htaccess
When users click on a link such as /stuff/page5.html for example, when page5.html does not exist, i need to redirect to MyScript.php using the .htaccess (this works fine) but I need to hold on to the page5.html so I can make a better 404 page (and so i can be nitified of any 404 in order to fix them). Using $HTTP_REFERER returns the original page that the user clicked on, and $REQUEST_URI returns "/stuff/My404.php". I think what I need to do is somehow redirect to My404.php?BrokenLink=page5.html in the .htaccess but i'm not sure how to do this.
Referer Based Allow/disallow
If referrer is internal (www.mysite.com), then show the page, else show an error message. Basically do not want outside link, and would prefer not to have direct link through the browser either.
Dynamic Http Referer
I have people coming to my site from the page http://www.domain.com/attn.php. If i put into the script that i should let anyone into my page coming from attn.php then if the URL is changed by the variable $check it doesnt let them in. What do i do to make sure that anyone coming from 'http://www.domain.com/attn.php?check=$anything' gets in? PHP Code:
Referer And Keyword Info Sent Via Form?
I've learned that HTTP_REFERRER, at least in my tests, returns the page visted on the current domain before the form page, not the domain visited before the current domain, so that hasn't been useful. I don't know how I would get keywords in this case. I've searched around for scripts or tutorials and have been surprised to find nothing helpful The site in question has a separate stats package, but it doesn't track converting keywords and that's really what I'm after. There isn't high volume traffic, so getting them individually via a form (rather than input into a database) isn't a problem. My question is really whether what I'm trying to do is possible with a few lines of code, or have I underestimated the complexity of the task?
Zone Alarm (pro) - Block Referer
i'm having troble with a script where i check referer, on a PC with Zone Alarm Pro the referer isn't send... i did a couple of page of testing and no referer is sand, closing ZAP the referer will work How can i solve this, do you know wich option is in zone alarm that dosen't
404 Error Referer Script Problems
I am having trouble extracting the original referer in my 404 error script. This is what I have so far: 1) I set the .htaccess file to the following and it works fine: ErrorDocument 404 /404.php 2) I've tried the following variables and they all produce the same results: $REQUEST_URI $HTTP_REFERER $REDIRECT_URL 3) The above mentioned variables all return "/404.php" and not the originally requested page.
Getting Page Referer Without Depending On User
I NEED the page referer for a script i've built to work, basicly i'm redirecting to my frames page with a line like this.. if ($m == "find") { $mainframe = $_SERVER['HTTP_REFERER']; } but i've been told that this data is sent from the user, so i need some way of telling my script which page to use as the main frame.
Check Referer - Call To Unsupported Or Undefined Function Error()
I have a Fatal error: Call to unsupported or undefined function error() in line 24 Line 24 is: error("Unauthorized access to: $HTTP_REFERER"); What I'm doing wrong? $referers = array('mydomain.com','www.mydomain.com'); function check_referer () { global $REFERERS, $HTTP_REFERER; if ($HTTP_REFERER != "") while (list($val, $ref) = each($REFERERS)) if (preg_match("/^http://$ref/", $HTTP_REFERER)) return; error("Unauthorized access to: $HTTP_REFERER"); exit; } check_referer();
Finding How Many There Are In A Var
how can I find out how many newlines there are in a variable? It's not hard to find out if there is a newline in the var, but I wanna know how many!
Finding Id Value
i am using php and mysql for this. i only want to keep the last 5 entries in the database. so i will add an entry in, which will have an ID value, then i want to delete the id with the lowest value, which in turn will be 6 from the last entry added. so the code will look like this: $oldid = $newid - 6; $deletethis = mysql_query("delete from table where id = $oldid"); is there a simple way to find the value of $newid ?
Finding Out An IP
I've been wondering for some time now, how to get every visitor's IP address and log them. Any ideas?
Finding The Sum In Mysql
What would be the easiet way to add the values of a certain field in every record that it occurs in. For example, If a person is placing multiple orders on a website and each order is to be shipped to a different location. Each seperate order is being stored in the mysql db and I need to add the shipping costs of all orders together when the user is ready to check out.
Finding The Last Occurance
I'm working on a update at my site. Every file on a part of the site means something. I want to accomplish some kind of a directory browseing and at each file displays the realtive info in it. Anyway... The following part of the code is made for finding the last occurance of '/' and after i did it, it looked kind of 'primitive' to me :). Is there any other optimised way of finding the last occurance of a substring in a string ?
Finding MySQL With 5.0.3
I have loaded PHP MySQL and Apache on windows in the past but recently had to reload my Win XP which is SP2 fully updated. Have reloaded Apache - fine - and MySQL and MySQLAdministrator - working fine Loaded PHP 5.0.3 and worked through configuring the ini to show a path to the ext file and so forth - copied some of the dll in the apache file. Copied many of the addtional modules in pecl into the php/ext directory and uncommented lots of them in the php ini (as suggested in a web tutorial - actually I don't NEED all of them yet) Installed PHPMyAdmin and configured that and then tried to connect but only get the error message that "cant find mysql" I tried this twice first with MySQLi and then MySQL set in the PHPMyAdmin configuration. Same result - some advice on a forum to a similar question suggested copying the dll files to the main php directory (just meant moving them up one in fact) and I did but that does not work either phpinfo shows lots of the modules but not MySQL or MySQLi I am rather puzzled - can anyone help this (long winded) problem?
Finding The Php.ini File
Is there another way I can find where the php.ini file is located besides using phpinfo(); The one that shows up in that file is not a valid directory--is not reading from the php.ini where I have it stored because the changes I'm making to the ini file are not reflected when I run code. I can't do anything with session or includes because the I can't get php to read from the ini, or it is reading from another ini file and I don't know how to access it.
DOM Child Finding
Is there any faster/easier way of finding a child node of a certain DOMNode object than doing something like function getChildByTagname($curnode, $name) { foreach($curnode->childNodes as $node) { if($node->nodeName==$name) { return $node; } } } ? it seems fairly slow and cumbersome. i was thinking xpath, but i can hardly imagine that to be a lot faster, with all the DOMXpath object creation and all, though I didn't benchmark.
Finding Directory
would like to know if there is a way to locate a specific directory on your site. I have a script which scans a directory, but it is not always running in the same directory, so the relative path to the scanned directory will be changed. Is there a way to find the location of the directory to be scanned, and build a relative url to it?
Finding H-tags
I am trying to build a script whic will convert html pages, to php, and formatting them to fit the php file's setup... i am trying to also improve navigation - which is where i am stuck. I need to find all information located between any number of <h2> </h2> tags, and place the contents into an array, which i can then print of, and link to that section i just need to find a method to find the information, and then put it into an array.
Finding Out IP Addresses
is it possible to get the persons IP address so that depending on what IP he has come from, I send him to a different page? any ideas?
Finding Pagination
First, let me say this is NOT a "How do I paginate my results?" question. I know how that works. Problem: I have items that are listed by date and medium. Both have paginated listings for searching for items. What I need to do is go back to either list to the page where the current item is listed. Say item #10 is listed on page 1 of dates, and page 5 of mediums [simplified for illustration]. I want the user to be able to come from dates - then move to the mediums listings, while finding the item just viewed on the resulting page. To determine the mediums listing I tried a function where I looped through a pagination function looking for the $id of the item in the result set with in_array(). It would only return the highest page number, if it returned anything. I have really trashed the function, and have to start from scratch. It seems my logic is wrong. Code:
Finding Out About Html_doc()
I'm trying to get some PHP4 code working on PHP5 - and am having an issue with a part of the code that uses html_doc() to turn html text scraped from a website into something that can be processed by DomXml functions like xpath_eval() I've found a nice looking wrapper at http://alexandre.alapetite.net/doc-...mxml-php4-php5/ which seems like it should do PHP4<->PHP5 work, except that it doesnt support html_doc(). I've tried replacing html_doc() with: domxml_open_mem($doc,DOMXML_LOAD_RECOVERING) but I can't get that to work even with the PHP4 - is that down to validation errors in the HTML? My problem is that I can't find any documentation to explain what html_doc() is meant to do and I'm new to the details of domxml coding (though I know what an XPath is...) In summary, two questions: - can I use domxml_open_mem() as a replacement for html_doc() in PHP4/domxml. If so, how? - where can I find documentation on html_doc()? I've googled, searched php.net and looked through group archives and can't find anything
Error Finding
My current web site appears correct. However, I know some browsers are smart enough to get around misplaced tags, and other syntax errors. Does anyone know of a good browser(s) that isn't so forgiving but still supports server-side html (shtml) and php scripting? Also, are there any tools out there that identify syntax errors within html, javascript, php, and or pearl code?
Finding The Mode?
Does anyone know how to write a program to find the mode of a series of numbers? I need to find the mean, median and mode. I was able to find the formula's for the mean and the median. But I have not been able to find a formula to find the mode. I know that the mode will be the numbers that are listed multiple times. I just can not figure out how to write this in the program to echo the mode.
Finding Out IP Address Behind NAT
I am writing a PHP app for a small business (family member owes me after this...) but they need to get their box back before I am finished. They have a DSL with dynamic ip and I need to be able to SSH in to their box, so I need to write a script that i have run as a cron job that will email me the current public IP of their DSL modem...
PHP Finding Text
i want to create a PHP Script that would go through a list inside a text file and ignore all of one kind of value and print all of another? e.g. lets say i had a text file that had in it: koum test test test test koum i would want it to go through that text file, ignore all of the test's and only print or echo the koum's.
Finding The Mode
Can't figure out how to find the mode of a file (string occurring most often). Has anyone else managed to do it?
Finding A Value Within A String
Say I have a string, for example: "Name: bob, Age: 22". I know that there is a name stored in there and that it is in that format. How can I trim that string down until it's left with just the name?
Finding Php.ini On My Website?
I'm having trouble finding the php.ini file on my website (It's running a Unix server). I know it's located at /usr/bin/php, but how can I access the /usr/bin/ folder? Do I need shell access? And can that be done through cPanel?
Finding The Date
I need help in finding the date of the 1st day for a specified Week. Lets suppose if I specify the week of the year as 22, I should get the date as 5-28-2007 which is Monday. Is there any function or can I get a script which gives the above requirement?
Finding Sub Strings
I think i might need to use preg_replace. However I have never used it before and can't workout how to find the following. This is my string.. Call Out Fee for 10:00 on 20/8/2007 What I need is for this string to be reduced to 10:00 and 20/8/2007. These values would preferably be in an array. Could someone give me a hand with this please.
Finding Out Localhost
is their any way to find out "localhost" of mysql to get the actual address? If not, is their any way to pull the content of a table off of localhost and connect to mysql on another server and insert the data into a table there?
Finding Out A Future Date
I've creating a script that displays an advert on my site for 90 days. I've got the current date in the following format: $todaysDate = date(mdy); I need to know how to find out the date in 90 days time, keeping it in the same format.
|