![]() |
2008-01-07
, 04:37
|
Posts: 32 |
Thanked: 5 times |
Joined on Nov 2007
|
#2
|
![]() |
2008-01-07
, 05:54
|
|
Posts: 66 |
Thanked: 7 times |
Joined on Oct 2005
@ Europe
|
#3
|
Run a private php based blog on my n810, restrict access to the blog from any other machine on the network but when needed, have the ability to login and access the blog via a desktop web browser.
<?php
$list = array("tablet browser");
// $list = array("tablet browser", "other", "value");
function searchValues($string, $matchesArray) {
foreach($matchesArray as $currentTest) {
if (strpos(strtolower($string), strtolower($currentTest)) !== false) {
return true;
}
}
return false;
}
$user_agent = $HTTP_SERVER_VARS["HTTP_USER_AGENT"];
if (searchValues($user_agent, $list)) {
// ------------------------------------------
// on the tablet
// ------------------------------------------
header( 'Location: /dir/name/file.php' );
} else {
// ------------------------------------------
// not on the tablet
// ------------------------------------------
// Change guest & password to you chosen username & password
if ( $PHP_AUTH_USER != "guest" || $PHP_AUTH_PW != "password" ) {
header('WWW-Authenticate: Basic realm="Protected Area"');
header("HTTP/1.1 401 Unauthorized");
echo "Failed to authenticate.";
exit();
} else {
// ------------------------------------------
// refresh / redirect to an internal web page
// ------------------------------------------
header( 'refresh: 3; url=/dir/name/file.php' );
echo "You are logged in successfully as: ".$PHP_AUTH_USER;
echo "</br>";
echo '<h1>You will be re-directed in 3 seconds...</h1>';
}
}
?>
<?php include 'detect.php'; ?>
![]() |
2008-01-07
, 12:08
|
|
Posts: 1,012 |
Thanked: 817 times |
Joined on Jul 2007
@ France
|
#4
|
The Following User Says Thank You to Khertan For This Useful Post: | ||
![]() |
2008-01-07
, 13:09
|
|
Posts: 794 |
Thanked: 784 times |
Joined on Sep 2007
@ /Canada/Ontario/GTA
|
#5
|
I am looking for some help. I have installed nginx and PHP to my n810 and configured a blog system which uses flatfiles as its db. This works perfectly and is being used as my diary for personal thoughts etc.
The issue I am facing is that if I am connected to a WLAN network it is possible for anyone on that network to access this blog by hitting the URL.
I can obviously create a PHP script which looks for the useragent and only displays the blog if its being hit from the device, this doenst allow me to access the blog form a pc if I wanted to...
Does the nginx httpd allow me to do anything special with regards to adding security to folders on the webserver?
I want to be able to password protect a folder if its not being accessed via the device itself...
I guess I will need to do this with php but wanted to know if there are any other options...
Thanks in advanced for your help.
badger
Some are wise, others are foolish