php-general Digest 15 Jun 2003 06:46:21 -0000 Issue 2118

Topics (messages 151500 through 151540):

How to write a DLL that can play with w32api?
        151500 by: DvDmanDT
        151517 by: DvDmanDT

Re: Minimalistic BBcode script
        151501 by: Jason Wong

Re: php editor?
        151502 by: electroteque
        151503 by: electroteque
        151504 by: Aliaksei Kurets
        151508 by: Gerard Samuel
        151509 by: Lars Torben Wilson
        151514 by: Kevin Ison
        151518 by: Tom Ray [Lists]
        151519 by: Kevin Ison
        151523 by: Ryan A
        151524 by: Leif K-Brooks
        151525 by: Ryan A
        151527 by: John Nichel
        151528 by: Ryan A
        151531 by: electroteque
        151533 by: Mike
        151534 by: electroteque

SELECT MULTIPLE form variable?
        151505 by: Noel Wade
        151506 by: Leif K-Brooks
        151507 by: Noel Wade

Re: Very Wierd Problem
        151510 by: John W. Holmes

manually unserializing  session data
        151511 by: Andrew Warner
        151526 by: Leif K-Brooks

Formatting issue.
        151512 by: Tom Ray [Lists]
        151513 by: Tom Ray [Lists]

reverse DNS lookup with PHP
        151515 by: Tim Thorburn
        151516 by: Tom Ray [Lists]
        151521 by: Lars Torben Wilson

isset()
        151520 by: Daniel J. Rychlik
        151529 by: Daniel J. Rychlik
        151532 by: Justin French

Re: sessions security (no problems just question)
        151522 by: vh

Problem to start apache after installed PHP.
        151530 by: Niklas Janzon

Re: Securing Source Code
        151535 by: Manuel Lemos

Re: shopping cart and login system
        151536 by: Jeff Harris
        151538 by: electroteque

Sort locale problem
        151537 by: Johan GrЖnvall

is my server working
        151539 by: Khoo Merry
        151540 by: John Hicks

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 ---
Hello, I was wondering how to write a DLL that I can use from
php_w32api.dll? I want to get the memory usage using this code:
###########################################################
dl("php_w32api.dll");
$api = new win32;
$api->definetype("MEMORYSTATUS {
long dwLength;
long dwMemoryLoad;
long dwTotalPhys;
long dwAvailPhys;
long dwTotalPageFile;
long dwAvailPageFile;
long dwTotalVirtual;
long dwAvailVirtual;
}");
$api->registerfunction("long GlobalMemoryStatus (MEMORYSTATUS &a) From
kernel32.dll");
$a=$api->InitType("MEMORYSTATUS");
$api->GlobalMemoryStatus($a);
print_r( $a); // Prints like [0] => Resource id #6
class MEMORYSTATUS
{
var $dwLength =0;
var $dwMemoryLoad=0;
var $dwTotalPhys=0;
var $dwAvailPhys=0;
var $dwTotalPageFile=0;
var $dwAvailPageFile=0;
var $dwTotalVirtual=0;
var $dwAvailVirtual=0;
}
$b=new MEMORYSTATUS;
$api->GlobalMemoryStatus($b);
print_r( $b);// Prints all of the names, but all values are 0

###########################################################

So I need another function to which I can pass $a and then get an int back
or something that PHP can hande... I got visual studio 6... I got cygwin as
well... I use Windows ME... Any help is appreciated...

Thanks in advance // DvDmanDT



--- End Message ---
--- Begin Message ---
Ok, I solved the problem by calling GlobalMemoryStatus() inside the DLL and
then using references to the PHP variables... Some things I noticed during
this playing:
- It seems like this code doesn't set the values of $a:
  $a=$api->InitType("MEMORYSTATUS");
  $api->GlobalMemoryStatus($a);
or php doesn't pass the object on next time, 'cause inside the DLL all
values of it was 0 when I passed it as arg... Could also possibly be the
fact that I didn't have any free memory, but that seems little wierd as I
tried more than one time...
- It crashed as soon as I passed 4 arguments or more... Could be my bad
coding though... But the same code worked with only two arguments... The
four arguments were "long &a1,long &a2,long &a3,long &a4" and inside the
function they were assigned values from my MEMORYSTATUS variable... Testing
two at a time worked like I said...

I was wondering, who is the coder(s) of this extension? Does anybody know?

// DvDmanDT



--- End Message ---
--- Begin Message ---
On Saturday 14 June 2003 21:53, DZ wrote:

> I found one minimalistic BBcode script, but it doesnt work.

Wouldn't it be better to find some code which *did* work?

>       Warning: Unknown modifier '1' in f:\_php\_f\bb-code\test.php on line 32
>
> line 32 is such:
>
>       $t = preg_replace_callback( '/[('.$atag.')(=(.*))?](.*)[/1]/isU', 'nc',
> $s);
>
> How to get work it?

I don't know how to get it to work, but doing

$t = preg_replace_callback( '#[('.$atag.')(=(.*))?](.*)[/1]#isU', 'nc', $s);

should at least get rid of the warning.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Your love life will be happy and harmonious.
*/


--- End Message ---
--- Begin Message ---
boy how painfully dweebish is vi why make it harder for yourself :O

-----Original Message-----
From: Jeff Harris [mailto:[EMAIL PROTECTED]
Sent: Sunday, June 15, 2003 2:48 AM
To: M-Ali Mahmoodi
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] php editor?


On Jun 14, 2003, "M-Ali Mahmoodi" claimed that:

|hi all
|i'm a beginner in php
|can anyone help me about useful and powerful editors in php?

vi

-- 
Registered Linux user #304026.
"lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import"
Key fingerprint = 52FC 20BD 025A 8C13 5FC6  68C6 9CF9 46C2 B089 0FED
Responses to this message should conform to RFC 1855.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
possibly not free though ?

-----Original Message-----
From: Aliaksei Kurets [mailto:[EMAIL PROTECTED]
Sent: Saturday, June 14, 2003 9:15 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: php editor?


The best PHP editor I know is Zend Studio. This is a real good editor with
debugging, highlighting and very good code complete.


"M-Ali Mahmoodi" <[EMAIL PROTECTED]> сообщил/сообщила в новостях
следующее: news:[EMAIL PROTECTED]
> hi all
> i'm a beginner in php
> can anyone help me about useful and powerful editors in php?
>
>
>



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Not free... hmmm (this is very argue point :)))

"Electroteque" <[EMAIL PROTECTED]> ???????/???????? ? ????????
?????????: news:[EMAIL PROTECTED]
> possibly not free though ?
>
> -----Original Message-----
> From: Aliaksei Kurets [mailto:[EMAIL PROTECTED]
> Sent: Saturday, June 14, 2003 9:15 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: php editor?
>
>
> The best PHP editor I know is Zend Studio. This is a real good editor with
> debugging, highlighting and very good code complete.
>
>
> "M-Ali Mahmoodi" <[EMAIL PROTECTED]> сообщил/сообщила в новостях
> следующее: news:[EMAIL PROTECTED]
> > hi all
> > i'm a beginner in php
> > can anyone help me about useful and powerful editors in php?
> >
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



--- End Message ---
--- Begin Message --- Because some of us, work directly on the server, instead of modifying files, then uploading to the server to test.... :)

electroteque wrote:

boy how painfully dweebish is vi why make it harder for yourself :O



--- End Message ---
--- Begin Message ---
On Sat, 2003-06-14 at 12:59, electroteque wrote:
> boy how painfully dweebish is vi why make it harder for yourself :O

Please don't start this again. If you want arguments about editors just
read the old ones in the archives. It's highly unlikely that any useful
new arguments will be made if we start a new flamewar over it. :) Just
suggesting one or two editors you like is more useful.



-- 
 Torben Wilson <[EMAIL PROTECTED]>                        +1.604.709.0506
 http://www.thebuttlesschaps.com          http://www.inflatableeye.com
 http://www.hybrid17.com                  http://www.themainonmain.com
 -----==== Boycott Starbucks!  http://www.haidabuckscafe.com ====-----




--- End Message ---
--- Begin Message ---
now theres a sadistic way to code!  I used to use vi... to be honest I like
it.  but on a windows platform crimson editor works well.

"Gerard Samuel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Because some of us, work directly on the server, instead of modifying
> files, then uploading to the server to test.... :)
>
> electroteque wrote:
>
> >boy how painfully dweebish is vi why make it harder for yourself :O
> >
>



--- End Message ---
--- Begin Message --- Why not just use PICO?

Kevin Ison wrote:

now theres a sadistic way to code!  I used to use vi... to be honest I like
it.  but on a windows platform crimson editor works well.

"Gerard Samuel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]


Because some of us, work directly on the server, instead of modifying
files, then uploading to the server to test.... :)

electroteque wrote:



boy how painfully dweebish is vi why make it harder for yourself :O









--- End Message ---
--- Begin Message ---
personnaly I kind of grew up on vi many many moons ago


"Tom Ray" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Why not just use PICO?
>
> Kevin Ison wrote:
>
> >now theres a sadistic way to code!  I used to use vi... to be honest I
like
> >it.  but on a windows platform crimson editor works well.
> >
> >"Gerard Samuel" <[EMAIL PROTECTED]> wrote in message
> >news:[EMAIL PROTECTED]
> >
> >
> >>Because some of us, work directly on the server, instead of modifying
> >>files, then uploading to the server to test.... :)
> >>
> >>electroteque wrote:
> >>
> >>
> >>
> >>>boy how painfully dweebish is vi why make it harder for yourself :O
> >>>
> >>>
> >>>
> >
> >
> >
> >
> >
>



--- End Message ---
--- Begin Message ---
I have tested quite a few editors since i came to php as notepad started to
p1ss me off after some time...
I have never really touched vi so cant say much about that but I think Zend
is pretty good (ill even dare say better) compared to the others(homesite,
phpedit,editplus etc)
you DO get only a 21 day trial...but you can make it a free version if you
want ;-p
Its a very good product and if you can afford it i think you should buy it
as a lot of work has gone into it and the developers deserve the $$.

Please note: I have NOTHING at all to do with ZEND (the company,site and its
software) dont bug me with arguements, this is just my opinion...my 2 cents.

HTH

Cheers,
-Ryan



----- Original Message -----
From: "Gerard Samuel" <[EMAIL PROTECTED]>
To: "electroteque" <[EMAIL PROTECTED]>
Cc: "Jeff Harris" <[EMAIL PROTECTED]>; "M-Ali Mahmoodi"
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, June 14, 2003 9:54 PM
Subject: Re: [PHP] php editor?


> Because some of us, work directly on the server, instead of modifying
> files, then uploading to the server to test.... :)
>
> electroteque wrote:
>
> >boy how painfully dweebish is vi why make it harder for yourself :O
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--- End Message ---
--- Begin Message --- I reccomend you don't talk about cracking Zend software on a list owner by Zend...

Ryan A wrote:

but you can make it a free version if you
want ;-p


-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



--- End Message ---
--- Begin Message ---
What can i say?
 if you aint living on the edge you're taking up too much space....


> I reccomend you don't talk about cracking Zend software on a list owner 
> by Zend...



--- End Message ---
--- Begin Message --- Ryan A wrote:
What can i say?
 if you aint living on the edge you're taking up too much space....



I reccomend you don't talk about cracking Zend software on a list owner by Zend...

Living on the edge is one thing. Biting the hand that feeds you is another.


As for the topic on hand, for Windows, I like UltraEdit, and for Linux I use Quanta.


--- End Message ---
--- Begin Message ---
If you read what i originally wrote you will see that I recomend buying
zend,  I didnt give directions/info to crack anything (as i dont know how to
crack in the first place), if you can afford it compared to all the editors
i have tried zend is the best.
Besides,did I say something that we all dont already know?

Back to the topic, I have not worked on Linux (locally) as yet so have not
tired any linux programs but for windows I still go with Zend instead of
UI....just a personal preference and i am sure there are some who will share
my preference and some who wont.

Cheers,
-Ryan



----- Original Message -----
From: "John Nichel" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, June 15, 2003 1:09 AM
Subject: Re: [PHP] php editor?


> Ryan A wrote:
> > What can i say?
> >  if you aint living on the edge you're taking up too much space....
> >
> >
> >
> >>I reccomend you don't talk about cracking Zend software on a list owner
> >>by Zend...
>
> Living on the edge is one thing.  Biting the hand that feeds you is
another.
>
> As for the topic on hand, for Windows, I like UltraEdit, and for Linux I
> use Quanta.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--- End Message ---
--- Begin Message ---
err to be exact i map my directories with samba and edit straight onto the
server that way :O

-----Original Message-----
From: Kevin Ison [mailto:[EMAIL PROTECTED]
Sent: Sunday, June 15, 2003 7:33 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] php editor?


now theres a sadistic way to code!  I used to use vi... to be honest I like
it.  but on a windows platform crimson editor works well.

"Gerard Samuel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Because some of us, work directly on the server, instead of modifying
> files, then uploading to the server to test.... :)
>
> electroteque wrote:
>
> >boy how painfully dweebish is vi why make it harder for yourself :O
> >
>



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
One thing that works well for me (editor aside) is creating a staging server
(staging.domain.com) and doing all edits there. Then when everything is just
the way you want it, I have a script that copies everything from the staging
site to the live site.

It prevents having to work on your live production site (which can sometimes
cause problems if your changes are right the first time) and it also lets
you work on larger projects over a few days and push everything live at once
without having to copy the files in question one-by-one.

-M

-----Original Message-----
From: electroteque [mailto:[EMAIL PROTECTED]
Sent: Saturday, June 14, 2003 9:56 PM
To: Kevin Ison; [EMAIL PROTECTED]
Subject: RE: [PHP] php editor?


err to be exact i map my directories with samba and edit straight onto the
server that way :O

-----Original Message-----
From: Kevin Ison [mailto:[EMAIL PROTECTED]
Sent: Sunday, June 15, 2003 7:33 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] php editor?


now theres a sadistic way to code!  I used to use vi... to be honest I like
it.  but on a windows platform crimson editor works well.

"Gerard Samuel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Because some of us, work directly on the server, instead of modifying
> files, then uploading to the server to test.... :)
>
> electroteque wrote:
>
> >boy how painfully dweebish is vi why make it harder for yourself :O
> >
>



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--- End Message ---
--- Begin Message ---
this is exactly what i do , edit through samaba on a development server then
cvs up to the live server

-----Original Message-----
From: Mike [mailto:[EMAIL PROTECTED]
Sent: Sunday, June 15, 2003 12:02 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] php editor?


One thing that works well for me (editor aside) is creating a staging server
(staging.domain.com) and doing all edits there. Then when everything is just
the way you want it, I have a script that copies everything from the staging
site to the live site.

It prevents having to work on your live production site (which can sometimes
cause problems if your changes are right the first time) and it also lets
you work on larger projects over a few days and push everything live at once
without having to copy the files in question one-by-one.

-M

-----Original Message-----
From: electroteque [mailto:[EMAIL PROTECTED]
Sent: Saturday, June 14, 2003 9:56 PM
To: Kevin Ison; [EMAIL PROTECTED]
Subject: RE: [PHP] php editor?


err to be exact i map my directories with samba and edit straight onto the
server that way :O

-----Original Message-----
From: Kevin Ison [mailto:[EMAIL PROTECTED]
Sent: Sunday, June 15, 2003 7:33 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] php editor?


now theres a sadistic way to code!  I used to use vi... to be honest I like
it.  but on a windows platform crimson editor works well.

"Gerard Samuel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Because some of us, work directly on the server, instead of modifying
> files, then uploading to the server to test.... :)
>
> electroteque wrote:
>
> >boy how painfully dweebish is vi why make it harder for yourself :O
> >
>



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Hi all,

So I was under the impression that an HTML form "SELECT MULTIPLE" item would
return an array with all of the selected items.  This array can then be used
with any of the standard PHP array functions, yes?

I have 1 HTML page that seems to work fine...  However, another page that is
nearly identical is failing - giving me the following error:  "Wrong
datatype for second argument in call to in_array".  When I look at the
variable, it seems to ONLY contain a string - the first item the user
selected.

The only difference I can see is that the working SELECT MULTIPLE has
numerical values, and the dysfunctional one uses string values - but the
values ARE enclosed in quotation-marks... so I don't know why they're not
POSTing properly as an array.  Is this a known bug or issue?  Any thoughts
or solutions?

Thanks a bunch, take care,

--Noel



--- End Message ---
--- Begin Message --- You need to name it formfield[], not formfield.

Noel Wade wrote:

Hi all,

So I was under the impression that an HTML form "SELECT MULTIPLE" item would
return an array with all of the selected items.  This array can then be used
with any of the standard PHP array functions, yes?

I have 1 HTML page that seems to work fine...  However, another page that is
nearly identical is failing - giving me the following error:  "Wrong
datatype for second argument in call to in_array".  When I look at the
variable, it seems to ONLY contain a string - the first item the user
selected.

The only difference I can see is that the working SELECT MULTIPLE has
numerical values, and the dysfunctional one uses string values - but the
values ARE enclosed in quotation-marks... so I don't know why they're not
POSTing properly as an array.  Is this a known bug or issue?  Any thoughts
or solutions?

Thanks a bunch, take care,

--Noel






-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



--- End Message ---
--- Begin Message ---
Its the littlest things that kill ya....  Thanks a ton!

As a side note, I definitely do NOT have the brackets on the working page -
so its an undefined "feature" (or bug) that numerical-value SELECT MULTIPLE
variables post as an array to PHP.

Take care, and thanks again!

--Noel

----- Original Message -----
From: "Leif K-Brooks" <[EMAIL PROTECTED]>
To: "Noel Wade" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, June 14, 2003 1:26 PM
Subject: Re: [PHP] SELECT MULTIPLE form variable?


> You need to name it formfield[], not formfield.
>
> Noel Wade wrote:
>
> >Hi all,
> >
> >So I was under the impression that an HTML form "SELECT MULTIPLE" item
would
> >return an array with all of the selected items.  This array can then be
used
> >with any of the standard PHP array functions, yes?
> >
> >I have 1 HTML page that seems to work fine...  However, another page that
is
> >nearly identical is failing - giving me the following error:  "Wrong
> >datatype for second argument in call to in_array".  When I look at the
> >variable, it seems to ONLY contain a string - the first item the user
> >selected.
> >
> >The only difference I can see is that the working SELECT MULTIPLE has
> >numerical values, and the dysfunctional one uses string values - but the
> >values ARE enclosed in quotation-marks... so I don't know why they're not
> >POSTing properly as an array.  Is this a known bug or issue?  Any
thoughts
> >or solutions?
> >
> >Thanks a bunch, take care,
> >
> >--Noel
> >
> >
> >
> >
> >
>
> --
> The above message is encrypted with double rot13 encoding.  Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.
>
>
>


--- End Message ---
--- Begin Message --- James E Hicks III wrote:

\0 is a NULL character, IIRC. Either use single quotes:
echo ('EBCO\030774-006\BUBBLER VALVE');
or use two slashes, like you did above:
echo ("EBCO\\030774-006\\BUBBLER VALVE");
---John Holmes...


Problem is that this description is coming from a DB, that's why I was trying to use addslashes, which caused me the same
problems.

Use mysql_escape_string().


$safe = mysql_escape_string('EBCO\\030774-006\\BUBBLER VALVE');

$query = "insert into table (field) values ('$safe')";

---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





--- End Message ---
--- Begin Message --- How do you manually unserialize session data? Using unserialize() on session data from a sessions table is not working for me.

I have modified the gc function of my MySQL session handler to save data from expired session records to another table, 'sessions_saved'. I can get the session data out and into the sessions_saved table okay, but i can't restore some of the saved session variables i need for field values in the sessions_saved table.

In the code below, $sess_data['pid'] is always empty even though I can see it and its value in the serialized session data. The $pid value has already been set to a session value using: session_start(); $_SESSION['pid'] = $pid



function mysql_sess_gc ($sess_maxlife)
{

(code here to query session table for expired sessions)

// loop thru expired sessions and save to 'sessions_saved' table:
while (list($sess_id,$data) = mysql_fetch_array($r))
{
   $sess_data = unserialize($data);

   $pid = $sess_data['pid'];
   $sid = $sess_data['sid'];

//store sessions in saved_sessions table
$query = "INSERT INTO sessions_saved (id,pid,sid,data) VALUES ('$sess_id',$pid,$sid,$data)";


   $result = mysql_query ($query, $mysql_sess_conn_id);
}

(...now delete expired sessions from sessions table)

}


andrew

--- End Message ---
--- Begin Message --- http://us3.php.net/manual/en/function.session-decode.php

Andrew Warner wrote:

How do you manually unserialize session data? Using unserialize() on session data from a sessions table is not working for me.

I have modified the gc function of my MySQL session handler to save data from expired session records to another table, 'sessions_saved'. I can get the session data out and into the sessions_saved table okay, but i can't restore some of the saved session variables i need for field values in the sessions_saved table.

In the code below, $sess_data['pid'] is always empty even though I can see it and its value in the serialized session data. The $pid value has already been set to a session value using: session_start(); $_SESSION['pid'] = $pid



function mysql_sess_gc ($sess_maxlife)
{

(code here to query session table for expired sessions)

// loop thru expired sessions and save to 'sessions_saved' table:
while (list($sess_id,$data) = mysql_fetch_array($r))
{
   $sess_data = unserialize($data);

   $pid = $sess_data['pid'];
   $sid = $sess_data['sid'];

//store sessions in saved_sessions table
$query = "INSERT INTO sessions_saved (id,pid,sid,data) VALUES ('$sess_id',$pid,$sid,$data)";


   $result = mysql_query ($query, $mysql_sess_conn_id);
}

(...now delete expired sessions from sessions table)

}


andrew



-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



--- End Message ---
--- Begin Message --- I'm having a bit of a formatting issue, and I was wondering if someone might have an idea on how to solve it. Basically what I have right now is a script that opens and reads the content of an image directory, each time the script is accessed it writes the contents out to a text file for me. I then open that text file and read it's contents, I want to be able to display thumbnail versions of the pictures, 3 per row and as many rows as needed. Unfortunetly, all I can do right now is 1 per row, this is where I need the help. Here's the code that displays images:

$dat="$_GET[gallery].dat"; $file=fopen($dat, 'r');
$contents = fread ($file, filesize ($dat));
fclose($file);
$img=explode("|",$contents); print "<table width=50% cellpadding=0 cellspacing=3 border=0>";


foreach($img as $image) {
if($image) print "<tr><td><a href=$image><img src=\"$image\" width=150 height=100></a></td></tr>";
}
print "</table>";


So how do I make this work so I can have three cells per table row and it actaully show the proper picture?

TIA

Tom


--- End Message ---
--- Begin Message --- with the proper line breaks:

$dat="$_GET[gallery].dat";
$file=fopen($dat, 'r');
$contents = fread ($file, filesize ($dat));
fclose($file);
$img=explode("|",$contents);

print "<table width=50% cellpadding=0 cellspacing=3 border=0>";

foreach($img as $image) {
if($image) print "<tr><td><a href=$image><img src=\"$image\" width=150 height=100></a></td></tr>";
}
print "</table>";


Tom Ray [Lists] wrote:

I'm having a bit of a formatting issue, and I was wondering if someone might have an idea on how to solve it. Basically what I have right now is a script that opens and reads the content of an image directory, each time the script is accessed it writes the contents out to a text file for me. I then open that text file and read it's contents, I want to be able to display thumbnail versions of the pictures, 3 per row and as many rows as needed. Unfortunetly, all I can do right now is 1 per row, this is where I need the help. Here's the code that displays images:

$dat="$_GET[gallery].dat"; $file=fopen($dat, 'r');
$contents = fread ($file, filesize ($dat));
fclose($file);
$img=explode("|",$contents); print "<table width=50% cellpadding=0 cellspacing=3 border=0>";


foreach($img as $image) {
if($image) print "<tr><td><a href=$image><img src=\"$image\" width=150 height=100></a></td></tr>";
}
print "</table>";


So how do I make this work so I can have three cells per table row and it actaully show the proper picture?

TIA

Tom




--- End Message ---
--- Begin Message --- Hi,

I'm setting up a simple tracking program for a website I'm working on. Currently it records a visitors IP address, but I would like to be able to do a DNS lookup of these IP addresses. Is this possible with PHP and if so, how is it done? I've been looking through Google, and the very few real results I've come across are large perl programs which make little to no sense to me.

Any help would be greatly appreciated.

Thanks
-Tim



--- End Message ---
--- Begin Message --- $_SERVER[REMOTE_HOST];

This will do a reverse lookup on their IP.

Manual Link:
http://ca3.php.net/manual/en/reserved.variables.php#reserved.variables.server

Hope it helps

Tim Thorburn wrote:

Hi,

I'm setting up a simple tracking program for a website I'm working on. Currently it records a visitors IP address, but I would like to be able to do a DNS lookup of these IP addresses. Is this possible with PHP and if so, how is it done? I've been looking through Google, and the very few real results I've come across are large perl programs which make little to no sense to me.

Any help would be greatly appreciated.

Thanks
-Tim





--- End Message ---
--- Begin Message ---
On Sat, 2003-06-14 at 14:38, Tom Ray [Lists] wrote:
> $_SERVER[REMOTE_HOST];
> 
> This will do a reverse lookup on their IP.
> 
> Manual Link:
> http://ca3.php.net/manual/en/reserved.variables.php#reserved.variables.server

Actually, this isn't true. $_SERVER['REMOTE_HOST'] will contain the
hostname of the client if and only if the web server has placed that
value there. Simply referring to the variable does not cause a lookup
to be done.

To do the lookup yourself, use gethostbyaddr():

   http://www.php.net/gethostbyaddr


Hope this clarifies it a bit,

Torben

> Hope it helps
> 
> Tim Thorburn wrote:
> 
> > Hi,
> >
> > I'm setting up a simple tracking program for a website I'm working 
> > on.  Currently it records a visitors IP address, but I would like to 
> > be able to do a DNS lookup of these IP addresses.  Is this possible 
> > with PHP and if so, how is it done?  I've been looking through Google, 
> > and the very few real results I've come across are large perl programs 
> > which make little to no sense to me.
> >
> > Any help would be greatly appreciated.
> >
> > Thanks
> > -Tim


-- 
 Torben Wilson <[EMAIL PROTECTED]>                        +1.604.709.0506
 http://www.thebuttlesschaps.com          http://www.inflatableeye.com
 http://www.hybrid17.com                  http://www.themainonmain.com
 -----==== Boycott Starbucks!  http://www.haidabuckscafe.com ====-----




--- End Message ---
--- Begin Message ---
Having a bit of trouble with my forms returnin 1 in the form fields accept the data 
that was entered.  I think its because of this line, 

$output_fname = isset($HTTP_POST_VARS['fname']);  

I have a command action handler also that works in the same script and it seems to 
work well,  the only problem that Im having is passing back the error to the related 
filed that requires proper data.  I started just passing back a generic message so 
that I could get the routine down, once I get that I will be able to do more.  

Here is a snipit of my code.  
<head>
<?php if ($has_errors) { ?>
                
                Please fix your errors

            <?php foreach($errors as $val) {
                
                    echo $val; } ?>
    <?php } else { ?>
                
                Please fill out form. 
    <?php } ?>

        <form .....
            HTML STUFF.

        </form>

<?php 

            if (count($errors)) $has_errors = true;  // If we find errors, then flag
                if ($has_errors) $command ="data_check"  // Take us back to the 
data_check                             hidden field and set $has_errors true to 
display our errors at the top of our                             form.

?>
<head>
This is really a 2 question issue, and I greatly appreicate you're time.  This is my 
2nd week learning PHP...

Thanks in advance,
Dan

       


--- End Message ---
--- Begin Message ---
Why is my script autopopulating a "1" in the field names and not the orginal
values ?
Is it something to do with this statement ?
$output_fname = isset($HTTP_POST_VARS['fname']);

Im declaring the var and using it in value field in my form.  I know that I
missing something.  Its returning true when value is entered or when its not
and placing a nice 1 in every field of my form.

Im thinking
$output_fname = isset($HTTP_POST_VARS['fname']) ?  $HTTP_POST_VARS['fname']
is the answer and ive tried for several hours to fix it.

-dan

----- Original Message ----- 
From: "Daniel J. Rychlik" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, June 14, 2003 4:54 PM
Subject: [PHP] isset()


Having a bit of trouble with my forms returnin 1 in the form fields accept
the data that was entered.  I think its because of this line,

$output_fname = isset($HTTP_POST_VARS['fname']);

I have a command action handler also that works in the same script and it
seems to work well,  the only problem that Im having is passing back the
error to the related filed that requires proper data.  I started just
passing back a generic message so that I could get the routine down, once I
get that I will be able to do more.

Here is a snipit of my code.
<head>
<?php if ($has_errors) { ?>

                Please fix your errors

            <?php foreach($errors as $val) {

                    echo $val; } ?>
    <?php } else { ?>

                Please fill out form.
    <?php } ?>

        <form .....
            HTML STUFF.

        </form>

<?php

            if (count($errors)) $has_errors = true;  // If we find errors,
then flag
                if ($has_errors) $command ="data_check"  // Take us back to
the data_check                             hidden field and set $has_errors
true to display our errors at the top of our
form.

?>
<head>
This is really a 2 question issue, and I greatly appreicate you're time.
This is my 2nd week learning PHP...

Thanks in advance,
Dan





--- End Message ---
--- Begin Message ---
$output_fname = (isset($HTTP_POST_VARS['fname'])) ? $HTTP_POST_VARS['fname']
: '';

but the value WILL be set regardless... in this case i'd prefer:

if(isset($HTTP_POST_VARS['fname'])) { $output_fname =
$HTTP_POST_VARS['fname']; }


alternatively, I wrote a nice function to pluck out $_POST vars only if
they're set.  you could easily modify it to do $HTTP_POST_VARS instead of
$_POST


http://www.weberdev.com/get_example.php3?count=3662


Justin



on 15/06/03 10:44 AM, Daniel J. Rychlik ([EMAIL PROTECTED]) wrote:

> Why is my script autopopulating a "1" in the field names and not the orginal
> values ?
> Is it something to do with this statement ?
> $output_fname = isset($HTTP_POST_VARS['fname']);
> 
> Im declaring the var and using it in value field in my form.  I know that I
> missing something.  Its returning true when value is entered or when its not
> and placing a nice 1 in every field of my form.
> 
> Im thinking
> $output_fname = isset($HTTP_POST_VARS['fname']) ?  $HTTP_POST_VARS['fname']
> is the answer and ive tried for several hours to fix it.
> 
> -dan
> 
> ----- Original Message -----
> From: "Daniel J. Rychlik" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, June 14, 2003 4:54 PM
> Subject: [PHP] isset()
> 
> 
> Having a bit of trouble with my forms returnin 1 in the form fields accept
> the data that was entered.  I think its because of this line,
> 
> $output_fname = isset($HTTP_POST_VARS['fname']);
> 
> I have a command action handler also that works in the same script and it
> seems to work well,  the only problem that Im having is passing back the
> error to the related filed that requires proper data.  I started just
> passing back a generic message so that I could get the routine down, once I
> get that I will be able to do more.
> 
> Here is a snipit of my code.
> <head>
> <?php if ($has_errors) { ?>
> 
> Please fix your errors
> 
> <?php foreach($errors as $val) {
> 
> echo $val; } ?>
> <?php } else { ?>
> 
> Please fill out form.
> <?php } ?>
> 
> <form .....
> HTML STUFF.
> 
> </form>
> 
> <?php
> 
> if (count($errors)) $has_errors = true;  // If we find errors,
> then flag
> if ($has_errors) $command ="data_check"  // Take us back to
> the data_check                             hidden field and set $has_errors
> true to display our errors at the top of our
> form.
> 
> ?>
> <head>
> This is really a 2 question issue, and I greatly appreicate you're time.
> This is my 2nd week learning PHP...
> 
> Thanks in advance,
> Dan
> 
> 
> 
> 


--- End Message ---
--- Begin Message ---
JH> are associated with a specific id. First, URLs carrying session ids. If
JH> you link to an external site, the URL including the session id might be
JH> stored in the external site's referrer logs. Second, a more active
JH> attacker might listen to your network traffic. If it is not encrypted,
JH> session ids will flow in plain text over the network. The solution here is
JH> to implement SSL on your server and make it mandatory for users."

Also I want to note. If sids are accessible via http_referer, there is
a way to execute php scripts on behalf of a user. For example, user
clicks a link to some php script which will grab sid from referer and
then outputs a html with redirect to another script (for example to
set a forwarding filter or etc). Since sid is right and also script
was called from user's PC, this is a quite bad thing, but
unfortunately this still exists on several web based e-mails. So, be
careful in using only session mechanisms provided by PHP. It's quite
insecure.


-- 
Best regards,
Martchukov Anton aka  VH                    mailto:[EMAIL PROTECTED]


--- End Message ---
--- Begin Message ---
Hi .. i got a problem to restart my apache (2.0.46)  server on my linux
system after i installed PHP 4.3.2.
I get this message:
 
[EMAIL PROTECTED]:/usr/local/apache2/bin/ > ./apachectl restart

Syntax error on line 232 of /usr/local/apache2/conf/httpd.conf:
Cannot load /usr/libexec/libphp4.so into server:
/usr/libexec/libphp4.so: undefined symbol: ap_block_alarms
 
Anyone got any idea on this?
 
Kind regards
Niklas Janzon
 

--- End Message ---
--- Begin Message --- Hello,

On 06/14/2003 02:49 PM, Suhas Pharkute wrote:
I am developing a network application. But I need to distribute it to
different divisions.

I am looking for Ideas for "Securing Source Code" from User.

What you need is an encoder like Turck. It is an extension that stored compiled PHP code in disk files that can be loaded later without the need of the original sources.


http://www.turcksoft.com/en/e_mmc.htm

--

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/


--- End Message ---
--- Begin Message ---
On Jun 14, 2003, "olinux" claimed that:

|hi
|
|--- electroteque <[EMAIL PROTECTED]> wrote:
|> hi there , i am about to build a shopping cart which
|> will interact with a
|> paypal payment system , the cart will use sessions
|> to store the items and
|> basket information before checking out and posting
|> to the paypal form , what
|> i'd like to know is would the cart require a login
|> system to track users and
|> to prevent ppl from making dodgy orders ,
|
|if pure simplicity is a goal, i dont think you need a
|login for customers. who cares if they add items and
|then dont purchase. obviously they would not be able
|to log in again to see the previous orders or current
|order status but you could always implement later.

Actually, to be more simple, for paypal paying customers, I would use
paypal's buy it now buttons. Let them deal with the shopping carts and
sessions.
http://www.paypal.com/cgi-bin/webscr?cmd=p/xcl/rec/singleitem-intro-outside

-- 
Registered Linux user #304026.
"lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import"
Key fingerprint = 52FC 20BD 025A 8C13 5FC6  68C6 9CF9 46C2 B089 0FED
Responses to this message should conform to RFC 1855.



--- End Message ---
--- Begin Message ---
yes i know about that but then the whole basket/cart system is out of your
hands i prefer to send the total with the products and quantities or can you
not do that ? if not i guess adding the individual items to their basket is
the only way the IPN system is confusing aswell :|

-----Original Message-----
From: Jeff Harris [mailto:[EMAIL PROTECTED]
Sent: Sunday, June 15, 2003 1:31 PM
To: olinux
Cc: electroteque; Php-General
Subject: Re: [PHP] shopping cart and login system


On Jun 14, 2003, "olinux" claimed that:

|hi
|
|--- electroteque <[EMAIL PROTECTED]> wrote:
|> hi there , i am about to build a shopping cart which
|> will interact with a
|> paypal payment system , the cart will use sessions
|> to store the items and
|> basket information before checking out and posting
|> to the paypal form , what
|> i'd like to know is would the cart require a login
|> system to track users and
|> to prevent ppl from making dodgy orders ,
|
|if pure simplicity is a goal, i dont think you need a
|login for customers. who cares if they add items and
|then dont purchase. obviously they would not be able
|to log in again to see the previous orders or current
|order status but you could always implement later.

Actually, to be more simple, for paypal paying customers, I would use
paypal's buy it now buttons. Let them deal with the shopping carts and
sessions.
http://www.paypal.com/cgi-bin/webscr?cmd=p/xcl/rec/singleitem-intro-outside

--
Registered Linux user #304026.
"lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import"
Key fingerprint = 52FC 20BD 025A 8C13 5FC6  68C6 9CF9 46C2 B089 0FED
Responses to this message should conform to RFC 1855.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Hi!

I'm trying to sort an array with strings containing swedish characters.
However, the sort order is wrong.

The following code produces "abДЕЖ" while it should be "abЕДЖ".

$list = array("Ж", "Д", "a","Е","b");
setlocale("LC_ALL","se_SE.ISO8859-1");
usort($list, 'strcoll');

for($i=0;$i<count($list);$i++) {
    echo $list[$i];
}

Any ideas? Running  Apache/2.0.43  PHP/4.2.3  Linux 2.4.18

/Johan



--- End Message ---
--- Begin Message ---
I'm using windows me, server apache 1.3 for php.
I had wrote this code and tried it at local host, but the php code didn't work. The 
code is like this:
 
<?
$Greet = "Hello World"
$Today = date("l F d, Y");
?>
<html>
<body>
Today's date is
<?
print("$Today\n");
print("$Greet");
?>
</body>
</html>
Istead of print
Today's date is Sunday June 14, 2003
Hello World
The out put is only "Today's date is". Is my server working with php?
I am really appreciate if anyone can answer my problem. 
Thank you.
 
merry



---------------------------------
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

--- End Message ---
--- Begin Message ---
Merry--

No, it's not working.

Does your Apache httpd.conf file load the PHP modules?

Try changing your tags from <? ... ?> to <?php ... ?>

Try a page that contains only this one line:

<?php phpinfo(); ?>

Good luck.

--John

On Sunday 15 June 2003 01:09 am, Khoo Merry wrote:
> I'm using windows me, server apache 1.3 for php.
> I had wrote this code and tried it at local host, but the
> php code didn't work. The code is like this:
>
> <?
> $Greet = "Hello World"
> $Today = date("l F d, Y");
> ?>
> <html>
> <body>
> Today's date is
> <?
> print("$Today\n");
> print("$Greet");
> ?>
> </body>
> </html>
> Istead of print
> Today's date is Sunday June 14, 2003
> Hello World
> The out put is only "Today's date is". Is my server
> working with php? I am really appreciate if anyone can
> answer my problem. Thank you.
>
> merry
>
>
>
> ---------------------------------
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!

--- End Message ---

Reply via email to