php-general Digest 6 Aug 2005 19:40:10 -0000 Issue 3610
Topics (messages 220137 through 220150):
Re: Sending post data from a script
220137 by: glumtail
Re: Return Path
220138 by: Sebastian
Re: Can I retrieve a stored php session variable from within a javascript
function?
220139 by: Burhan Khalid
220142 by: Rick Emery
Re: Average time spent on a page
220140 by: Burhan Khalid
220147 by: virtualsoftware.gmail.com
220148 by: Frank de Bot
220150 by: virtualsoftware.gmail.com
Re: Return Path [SOLVED]
220141 by: sub.pudlz.com
Bug or programmer-error?
220143 by: Rob Ziere
220144 by: Frank de Bot
Re: how to check http:// or https:// ?
220145 by: Jochem Maas
Re: [NEWBIE GUIDE] For the benefit of new members
220146 by: Jochem Maas
sorry for asking here,a small apache query
220149 by: babu
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
you can try this:
$sock = fsockopen($parse_url['host'], $parse_url['port'], $errno, $errstr, 30);
if (!$sock) {
die("$errstr ($errno)\r\n");
}
$tmp = explode('&',$parse_url['query']);
$data = NULL;
foreach($tmp as $val) {
$p = explode('=',$val);
if(empty($data)) {
$data = $p[0] . "=" . urlencode($p[1]);
} else {
$data .= "&" . $p[0] . "=" . urlencode($p[1]);
}
}
fwrite($sock, "POST " . $parse_url['path'] . " HTTP/1.0\r\n");
fwrite($sock, "Host: " . $parse_url['host'] . "\r\n");
fwrite($sock, "Content-type: application/x-www-form-urlencoded\r\n");
fwrite($sock, "Content-length: " . strlen($data) . "\r\n");
fwrite($sock, "Accept: */*\r\n");
fwrite($sock, "\r\n");
fwrite($sock, "$data\r\n");
fwrite($sock, "\r\n");
$body = "";
while (!feof($sock)) {
$body .= fgets($sock, 4096);
}
fclose($sock);
--- End Message ---
--- Begin Message ---
try using -f
mail($toemail, $subject, $message, $from, '-f [EMAIL PROTECTED]');
[EMAIL PROTECTED] wrote:
I don't seem to be able to set the "return path" using the mail() function. I can't figure out why "from" will let me set it, but not the return path.
$headers = 'From: [EMAIL PROTECTED]' . "\r\n" .
'Return-path: [EMAIL PROTECTED]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($email, $subject, $message, $headers);
Any thoughts?
Andrew Darrow
Kronos1 Productions
www.pudlz.com
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.1/64 - Release Date: 8/4/2005
--- End Message ---
--- Begin Message ---
Mauricio Pellegrini wrote:
Hi ,
I wonder if it's possible to retrieve the value from a php session
variable from within a javascript function.
Does anyone have any ideas about this?
No. You cannot retrieve it, restore it, read it, send it, anything else.
You can write it from PHP :
echo '<script type="text/javascript">var sess =
'.$_SESSION['somevar'].'</script>';
But that's it.
--- End Message ---
--- Begin Message ---
Quoting Mauricio Pellegrini <[EMAIL PROTECTED]>:
Hi ,
I wonder if it's possible to retrieve the value from a php session
variable from within a javascript function.
I'm no PHP expert, but I'll give it a try (there are plenty of smart
people on this list who will correct me if Im wrong :-)
Does anyone have any ideas about this?
Yes, two of the top of my head.
1. You can send the session variable to the client along with the script.
ex.
function doSomething()
{
sessVar = <?php print($_SESSION['variable']); ?>;
// Do some stuff.
}
Of course, sessVar won't be updated if the session variable changes
unless the script is reloaded.
2. My favorite, but probably overkill. Write a php page that outputs
the session variables (as XML would be cool). Then use xmlhttprequest
to retrieve them from javascript (Google AJAX for more information).
Hope this helps,
Rick
--
Rick Emery
"When once you have tasted flight, you will forever walk the Earth
with your eyes turned skyward, for there you have been, and there
you will always long to return"
-- Leonardo Da Vinci
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
Hi,
How can i found out the average time users spent on a page. Anyone know a
tutorial?
Thanks in advance for your help !!!
PLEASE ONLY SEND YOUR MESSAGE ONCE!!!
Also, remember that google is your friend.
--- End Message ---
--- Begin Message ---
Guess what? I've googled for it and.... nothing
----- Original Message -----
From: "Burhan Khalid" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Saturday, August 06, 2005 5:07 PM
Subject: Re: [PHP] Average time spent on a page
[EMAIL PROTECTED] wrote:
Hi,
How can i found out the average time users spent on a page. Anyone know a
tutorial?
Thanks in advance for your help !!!
PLEASE ONLY SEND YOUR MESSAGE ONCE!!!
Also, remember that google is your friend.
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
Hi,
How can i found out the average time users spent on a page. Anyone know a
tutorial?
Thanks in advance for your help !!!
A hello world page will take me around 15 secs I guess...
A full blown website with everything you can imagine a few months orso.
--- End Message ---
--- Begin Message ---
LOL. This got nothing to do with my question . LOL again
----- Original Message -----
From: "Frank de Bot" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Saturday, August 06, 2005 10:20 PM
Subject: Re: [PHP] Average time spent on a page
[EMAIL PROTECTED] wrote:
Hi,
How can i found out the average time users spent on a page. Anyone know a
tutorial?
Thanks in advance for your help !!!
A hello world page will take me around 15 secs I guess...
A full blown website with everything you can imagine a few months orso.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Works great. Thank you.
Although I swear I tried that last night. Eh I probably messed something up.
Andrew Darrow
Kronos1 Productions
www.pudlz.com
----- Original Message -----
From: "Sebastian" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Saturday, August 06, 2005 6:12 AM
Subject: Re: [PHP] Return Path
> try using -f
>
> mail($toemail, $subject, $message, $from, '-f [EMAIL PROTECTED]');
>
> [EMAIL PROTECTED] wrote:
>
> >I don't seem to be able to set the "return path" using the mail()
function. I can't figure out why "from" will let me set it, but not the
return path.
> >
> >$headers = 'From: [EMAIL PROTECTED]' . "\r\n" .
> > 'Return-path: [EMAIL PROTECTED]' . "\r\n" .
> > 'X-Mailer: PHP/' . phpversion();
> >
> >mail($email, $subject, $message, $headers);
> >
> >
> >Any thoughts?
> >
> >Andrew Darrow
> >Kronos1 Productions
> >www.pudlz.com
> >
> >
> >
> >
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.338 / Virus Database: 267.10.1/64 - Release Date: 8/4/2005
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.338 / Virus Database: 267.10.1/64 - Release Date: 8/4/2005
>
>
--- End Message ---
--- Begin Message ---
Dear PHP_friends,
I have found a strange behaviour of the "include" function.
Here it is .
// 1. this works fine
include ("../../gps_info/fetch_fields.php");
// 2. this works fine
$doc_root=$_SERVER[DOCUMENT_ROOT];
include
("$doc_root"."/pages/gps_info/fetch_fields.php");
// 3. this open the doc fetch_fields.php allright, but variables
that have been set outside fetchfields.php are not available within
fetch_fields.php
$root= 'webserver-2';
include
("$root"."/pages/gps_info/fetch_fields.php");
Does anybody have a clou as to what's wrong here?
Best regards/ Met vriendelijke groet,
Rob Ziere
Webmaster/beheerder GO-GPS.nl, alles over GPS en wandelen
http://www.go-gps.nl
--- End Message ---
--- Begin Message ---
Rob Ziere wrote:
Dear PHP_friends,
I have found a strange behaviour of the "include" function.
Here it is .
// 1. this works fine
include ("../../gps_info/fetch_fields.php");
// 2. this works fine
$doc_root=$_SERVER[DOCUMENT_ROOT];
include
("$doc_root"."/pages/gps_info/fetch_fields.php");
// 3. this open the doc fetch_fields.php allright, but variables
that have been set outside fetchfields.php are not available within
fetch_fields.php
You could try calling a var with global first
global $variable
(reference: http://nl2.php.net/global )
$root= 'webserver-2';
include
("$root"."/pages/gps_info/fetch_fields.php");
Does anybody have a clou as to what's wrong here?
Best regards/ Met vriendelijke groet,
Rob Ziere
Webmaster/beheerder GO-GPS.nl, alles over GPS en wandelen
http://www.go-gps.nl
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
Right. Tested and found $_SERVER['HTTPS'] has to be 'on' :)
But, there is something in the code Jochem wrote that bothers me for a
while:
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') {
echo 'you are secure(-ish?)'; }
Doesn't
$_SERVER['HTTPS']=='on'
automatically means
isset($_SERVER['HTTPS'])
?
indeed - I'm a bit of correctness freak like that - without the isset
an E_NOTICE is generated - which you could supress:
if('on' == @$_SERVER['HTTPS']) {
// yes!
}
(others are speed freaks - and will
probably go for the E_NOTICE :-) - although I have no idea whether thats even
any faster
than calling isset() as the E_NOTICE generation must all have _some_ overhead,
and how error supression affects performance. regardless the difference if
probably
almost immeasurable.)
I mean, if $_SERVER['HTTPS'] exists doesn't mean it's equal to 'on'
but if $_SERVER['HTTPS'] == 'on' IT MEANS $_SERVER['HTTPS'] exists
why then
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on')
-afan
Jochem Maas wrote:
Marco Tabini wrote:
On 8/5/05 2:43 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
Thanks Marco!
:)
I was looking for something like this on phpinfo() but didn't found?
That's because it shows up only if you are under HTTPS! :-)
AFAICT tell you should check whether the value is actually set to 'on'
(IIRC a post by Rasmus):
e.g.
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') {
echo 'you are secure(-ish?)'; }
SIDENOTE REGARDING BEEBLEX.COM:
I just added a bookmark in firefox to beeblex.com as follows
http://beeblex.com/search.php?d=ALLDB&s=%s
and I gave it a keyword of 'beeb'
now I can go to firefox and type 'beeb HTTPS' to get an direct hit -
so now there is no excuse not to be using Marco's cool new resource :-)
Marco
-afan
Marco Tabini wrote:
IIRC, if you're using Apache you can check
If (isset ($_SERVER['HTTPS']))
You can also check this thread:
http://beeblex.com/lists/index.php/php.general/190410?h=%24_SERVER%5B%27HTTP
S%27%5D
--
BeebleX - The PHP Search Engine
http://beeblex.com
On 8/5/05 2:05 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
Hi,
I need to check does URL use http or https?
Right now I use this code:
if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false)
{
header('location: [URL]https://www.test.com/test.php[/URL]');
exit;
}
but I am sure there is much better solution.
:)
--- End Message ---
--- Begin Message ---
Rick Emery wrote:
Quoting "Chris W. Parker" <[EMAIL PROTECTED]>:
Rick Emery <mailto:[EMAIL PROTECTED]>
on Friday, August 05, 2005 4:54 PM said:
Well, as I found out when I Google'd before I posted, it *lists*
plenty of JavaScript mailing lists. But it can hardly "recommend a
good" one, which is what I asked for, can it? I was soliciting
opinions.
Yes I know, but I was hoping you wouldn't notice (because that's what
makes the joke so great)! :)
lol.
Oh, I get it now :-)
There has been a lot mentioned lately about checking Google before
posting, and I didn't want anyone to think that I hadn't Google'd before
we have a whole army doing this constantly ;-)
I posted (I've actually joined a mailing list I found that way, but was
looking for good recommendations). I apologize if I came off a little
defensive.
Thanks,
Rick
--- End Message ---
--- Begin Message ---
Hi all,
I am sorry for asking in php forum.i am subscribed to php and not to apache.but
i hope many people in this group also the solution to this query.
how can i configure apache so that users are forbidden to see my docroot file
structure.
for example i have a file at http://localhost/dir1/xyz.html , if the user try
to access http://localhost, or http://localhost/dir1 he shud get a message
forbidden.
Thanks
babu.
---------------------------------
To help you stay safe and secure online, we've developed the all new Yahoo!
Security Centre.
--- End Message ---