Click to See Complete Forum and Search --> : delete URL
saifi4u
12-16-2006, 05:32 AM
hi
I have a php page that opens some html pages from a folder on my webserver. These Html pages are generated by software and can not be altered.
I have the security on my PHP page. If user is not login then the page will not be opened. But the problem is this: when user directly type the address of my html pages (from history) it opens.
I want to clear history/URLs on logout. I found something from MSDN but not from php yet:-
Deletes all instances of the specified URL from the history.
Syntax
HRESULT DeleteUrl(
LPCOLESTR pocsUrl,
DWORD dwFlags
);
Parameters
pocsUrl
[in] URL to delete.
dwFlags
[in] Not implemented.
Return Value
Returns S_OK if successful, or an error value otherwise.
FROM : http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/urlhist/iurlhistorystg/deleteurl.asp
can any body convert this to php..........or any idea to solve the problem
....
balloonbuffoon
12-16-2006, 08:08 AM
I would think if anything would allow you to change the user's browsing history (doubtful), it would have to be a client side script, and not PHP. A better idea for this set-up is to have a PHP page that enforces your security measures, but instead of simply redirecting to the HTML pages, it retrieves the page and displays it. That way, your users wouldn't know the exact address to the URLs. I can't help you much right know as I will be gone all weekend, so hopefully someone else can give you some more insight.
Here's a simple example of what I'm talking about:
<?php
// all of your HTML pages would be in this folder:
$dir = "C:\html_pages\\"; //note that the extra slash is to cancel the next slash, which would escape the end double quote, leaving the string unclosed
//an example page would be "C:\html_pages\index.html"
//the script finds what page you want from the query string: ?page=index.html
$page = $_GET["page"];
echo file_get_contents($dir.$page);
//displays "index.html" as if you went directly there in the browser
?>
--Steve
NightShift58
12-16-2006, 06:06 PM
The ideas suggested by BalloonBuffoon are in the right direction. I don't think we need to use the file_get_contents() function (which is disabled by some hosting providers) to solve your problem.
I think it would be more efficient to just include() the .HTML file. The result should be the same - unless you have some SSI instructions in those files.
<?php
// all of your HTML pages would be in this folder:
$dir = "C:\html_pages\";
// an example page would be "C:html_pagesindex.html"
// the script finds what page you want from the query string:
// ?page=index.html
$page = $dir . $_GET["page"];
if (file_exists($page)) {
//displays "index.html" as if you went directly there in the browser
include($page);
} else {
include($my404page);
}
?>
I realize that $my404page is not defined anywhere, but I wanted to include it so it won't be forgotten.
netbuddy
12-17-2006, 08:41 AM
It is not always a case of the host limiting PHP but rather an older build of PHP is running.
Something I just have stumbled across with a web host in the US who in live chat was telling me that they had no plans to upgrage from 4.4.1 even though I pointed out that most people are talking php5 which I think did a 747 on the guy and overshot the runway a bit... He didnt get what I was trying to say which was to upgrade in a polite way.
So I left it at that. I would imagine that this is not unusual and a typical example of hosting companys dragging their feet.
What is the point in pushing php5 is hosting companys wont use it?
saifi4u
12-18-2006, 10:52 PM
Thank u NightShift58 & balloonbuffoon for u'r reply.
Due to some restrictions I am unable to open the html pages within php page. (however I will try this as my last option).
Is it possible to write a code that automatically rename the html pages from a folder to php and add some lines of php code to top of the page?
In this way I will be able to put my session-check code to every html page.
saifi4u
12-19-2006, 12:36 AM
I found a PHP Class and Sample Code that automatically convert the html pages to php pages (change extension from html to php) the site link is
http://www.reducedcomplexity.com/php/index.php?rc=2&c=overview&lang=en
Now I am in seach of code that automatically add some lines of code (for authentication check) on these newly converted (html-to-php) pages.
I hope someone will help me.
thanks