note 84586 added to function.dirname
| From: | Tom at osu1 dot php dot net | Date: | Sun, 20 Jul 2008 18:13:18 +0000 |
| Subject: | note 84586 added to function.dirname | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-142210@lists.php.net to get a copy of this message | ||
Expanding on Anonymous' comment, this is not necessarily correct. If the user is using a secure
protocol, this URL is inaccurate. This will work properly:
<?php
// Is the user using HTTPS?
$url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ==
'on')) ? 'https://' : 'http://';
// Complete the URL
$url .= $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
// echo the URL
echo $url;
?>
----
Server IP: 92.48.100.16
Probable Submitter: 84.70.26.97
----
Manual Page -- http://www.php.net/manual/en/function.dirname.php
Edit -- https://master.php.net/note/edit/84586
Del: integrated -- https://master.php.net/note/delete/84586/integrated
Del: useless -- https://master.php.net/note/delete/84586/useless
Del: bad code -- https://master.php.net/note/delete/84586/bad+code
Del: spam -- https://master.php.net/note/delete/84586/spam
Del: non-english -- https://master.php.net/note/delete/84586/non-english
Del: in docs -- https://master.php.net/note/delete/84586/in+docs
Del: other reasons-- https://master.php.net/note/delete/84586
Reject -- https://master.php.net/note/reject/84586
Search -- https://master.php.net/manage/user-notes.php