Connecting Tech Pros Worldwide Help | Site Map

Processor ID with php

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 04:20 AM
rob
Guest
 
Posts: n/a
Default Processor ID with php

How is it possible to find the processor id of the current web
connection that a user has made, so that it can be displayed onto the
page.

is the "PID" that is assigned to each process item, (from doing ps
-ax) would display them all, but not sure how to display the current
one using php.

I know there is a way of doing it with PERL but not sure if there is
with PHP.

Any replies would be appreciated.

  #2  
Old July 17th, 2005, 04:20 AM
Jeppe Uhd
Guest
 
Posts: n/a
Default Re: Processor ID with php

rob wrote:[color=blue]
> How is it possible to find the processor id of the current web
> connection that a user has made, so that it can be displayed onto the
> page.
>
> is the "PID" that is assigned to each process item, (from doing ps
> -ax) would display them all, but not sure how to display the current
> one using php.
>
> I know there is a way of doing it with PERL but not sure if there is
> with PHP.
>
> Any replies would be appreciated.[/color]

http://dk.php.net/manual/en/function.getmypid.php

--
MVH Jeppe Uhd - NX


  #3  
Old July 17th, 2005, 04:20 AM
Kevin Thorpe
Guest
 
Posts: n/a
Default Re: Processor ID with php

rob wrote:[color=blue]
> How is it possible to find the processor id of the current web
> connection that a user has made, so that it can be displayed onto the
> page.
>
> is the "PID" that is assigned to each process item, (from doing ps
> -ax) would display them all, but not sure how to display the current
> one using php.
>
> I know there is a way of doing it with PERL but not sure if there is
> with PHP.[/color]

It doesn't look like it. phpinfo() tells me nothing. What do you want it
for? You have to bear in mind that it may only be valid for a single
page load as the next request may be sent to a fresh apache child.
  #4  
Old July 17th, 2005, 04:20 AM
Kevin Thorpe
Guest
 
Posts: n/a
Default Re: Processor ID with php

>[color=blue]
> http://dk.php.net/manual/en/function.getmypid.php
>[/color]
oops. Didn't see that. I sort of assumed that it would be in the
environment somewhere.

My point about it possibly not being valid between pages still stands
though.
  #5  
Old July 17th, 2005, 04:21 AM
rob
Guest
 
Posts: n/a
Default Re: Processor ID with php

> It doesn't look like it. phpinfo() tells me nothing. What do you want it[color=blue]
> for? You have to bear in mind that it may only be valid for a single
> page load as the next request may be sent to a fresh apache child.[/color]


I want it for creating a "session id" unique to that user, based on
the time the pid was issues and the pid itself, so that the session id
can be as small a value as possible but still unique.
  #6  
Old July 17th, 2005, 04:21 AM
Kevin Thorpe
Guest
 
Posts: n/a
Default Re: Processor ID with php

rob wrote:[color=blue][color=green]
>>It doesn't look like it. phpinfo() tells me nothing. What do you want it
>>for? You have to bear in mind that it may only be valid for a single
>>page load as the next request may be sent to a fresh apache child.[/color]
>
>
>
> I want it for creating a "session id" unique to that user, based on
> the time the pid was issues and the pid itself, so that the session id
> can be as small a value as possible but still unique.[/color]

In that case why not use sessions? If you use session_start() at the top
of your pages then a unique session id will be gewnerated for you.
  #7  
Old July 17th, 2005, 04:22 AM
.:Ninja
Guest
 
Posts: n/a
Default Re: Processor ID with php

rob wrote:[color=blue]
> I want it for creating a "session id" unique to that user, based on
> the time the pid was issues and the pid itself, so that the session id
> can be as small a value as possible but still unique.[/color]

You can still create such an ID using a more static parameter - such as the
user's IP address. I've done this before, created a unique identifying
string for each visiting user by crypt()-ing the IP address using the
person's browser identifier as seed. Then chuck that into a database and as
soon as the user returns from the same IP using the same browser, you'll
know they've been there before because the same encrypted string will be
generated again and you can check for its existence in the database. Or
easier - use sessions =)

Albe

--
http://www.ninja.up.ac.za
  #8  
Old July 17th, 2005, 04:22 AM
rob
Guest
 
Posts: n/a
Default Re: Processor ID with php

> In that case why not use sessions? If you use session_start() at the top[color=blue]
> of your pages then a unique session id will be gewnerated for you.[/color]

I am trying another, shorter method. session id's are too long. And
want to be able to find out the pid for a new method.
  #9  
Old July 17th, 2005, 04:25 AM
rob
Guest
 
Posts: n/a
Default Re: Processor ID with php

> You can still create such an ID using a more static parameter - such as the[color=blue]
> user's IP address. I've done this before, created a unique identifying
> string for each visiting user by crypt()-ing the IP address using the
> person's browser identifier as seed. Then chuck that into a database and as
> soon as the user returns from the same IP using the same browser, you'll
> know they've been there before because the same encrypted string will be
> generated again and you can check for its existence in the database. Or
> easier - use sessions =)
>
> Albe[/color]

This still has possible problems, what if you are going through a
caching server, or you are sharing an IP with someone with the same
browser version.

Doing it the way with a pid is a guarenteed method, relying on an IP
or browser agent can have flaws. So really just want to know if it is
possible to get the pid, anyone know?
  #10  
Old July 17th, 2005, 04:25 AM
Andy Hassall
Guest
 
Posts: n/a
Default Re: Processor ID with php

On 24 Mar 2004 00:51:57 -0800, rob@cdli.co.uk (rob) wrote:
[color=blue][color=green]
>> In that case why not use sessions? If you use session_start() at the top
>> of your pages then a unique session id will be gewnerated for you.[/color]
>
>I am trying another, shorter method. session id's are too long. And
>want to be able to find out the pid for a new method.[/color]

Too long for what?

--
Andy Hassall <andy@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
  #11  
Old July 17th, 2005, 04:33 AM
rob
Guest
 
Posts: n/a
Default Re: Processor ID with php

getmypid();

as simple as that
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.