[PHP] Read From COM1 port

2005-03-03 Thread Kim Madsen

Hi

I'm having trouble reading from COM1, writing works like a charm but I'd like 
to be able to read the output from a switch or a router in order to determine 
that the command was successful and the configuration actually went fine :-)

doing:

$fp = fopen(COM1, rwb);
fwrite($fp, $username . \r\n);
fwrite($fp, $password . \r\n);

works fine, if I connect using hyperterminal afterwards I'll go straight to the 
menus, which shows that I'm logged in and I can actually config the whole 
device as I want, but I'd like to know, that each of the commands was received 
successful. But if I try to do something like :

$fp = fopen(COM1, rwb);
fwrite($fp, $username . \r\n);
$response = fread($fp, 4096); // is blank! Should return Password: 
if($response == 'password')
  fwrite($fp, $password . \r\n); // Would be lovely if it was able to read 
the return answer Manager  :-) else {
  print no response?;
  exit;
}

This is where it ends. I´ve tried with fputs(), fgets(), fgetc(), popen() and 
others. It seems like what I need is a fwrite(), that doesn't return no of 
bytes, but the response from the device if any.

Anyone got an idea? Or is this just mission impossible? This is just a small 
part of a much larger workflow, which runs in PHP, therefore it would be 
preferred if the configs of switches and routers could be in PHP aswell.

(Posted yesterday in alt.comp.lang.php and the day before in comp.lang.php)
--
Sincerly
Kim Madsen
Systemdeveloper / ComX - http://www.comx.dk

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



Re: [PHP] server compatibilty

2005-03-03 Thread Yannick Warnier
Le jeudi 03 mars 2005 à 10:48 +0530, Prateek Tambi a écrit :
 I got php installed on my pc
 my web server is apache tomcat 4.0 or something will it support php or not
 how can i detect that...
 in the installation readme file there is support for apache 1.3.x and
 apache 2.0.x
 if its not supported than what can i do

Hi Prateek,

Following what you are saying you are running Apache 1.3 or 2.0 (or
both) with Tomcat.

To run PHP, a good way would be to install the PHP module that is
relevant to the Apache server version you are using.

The way to do that depends on your computer's operating system. Do you
know what it is? Windows? Linux Mandrake? Linux Suse? ...?

The best way to try and see if PHP is already installed is to write a
PHP script, put it in your web root folder (depends on the operating
system again) and try to load the page in a web server.

For example, write:
?php
phpinfo();
?

into the info.php file, put in in your web root and try to load it.

If you see nothing but blank, then it failed (which doesn't mean PHP is
not installed, but if it is you still need to configure it).

Please read the installation doc on www.php.net to sort it out.

Yannick

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



Re: [PHP] patch to php 4.3.10 to disabling URL wrappers in include like statements

2005-03-03 Thread Bostjan Skufca @ domenca.si
Well, of course this was never ment to protect you from inside attacks. But if 
you also disable eval() then I believe it's pretty much harder to create a 
successfull attack via chmod-777-write-exec procedure (from outside).

This patch is ment to prevent accidental DOS attacks by recursive inclusion 
(local users) and to in some degree prevent the execution of external code 
via GET/POST variable exploit (remote attack).

But though it is not a complete assessment of security risk it is a step 
towards right direction - one can apply it and start thinking about better 
solution/other risks etc.

regards,
Bostjan


On Wednesday 02 March 2005 20:09, Richard Lynch wrote:
 Bostjan Skufca @ domenca.com wrote:
  From system security's standpoint:
 
  ?php
  $content = file_get_contents('http://www.domain.net/file.inc');
  echo $content;
  ?
 
  is OK, but
 
  ?php
  include('http://www.domain.net/file.inc');
  ?
 
  is NOT!
 
  Nice patch, Tom, will probably use it myself too...

 I'll be interested to see if it works in practice...
 [see previous post of mine]

 Ya never know.

 I still haven't figured out why spam harvesters don't find even the
 simplest obfuscations like %40 and #64;

 But I guess if you come up with a billion fish every time you cast your
 line, you don't worry about buying better bait.

 I *suspect* this situation is different, in that you will have people
 actively trying to alter their attacks to bypass this blockage, and it's
 pretty simple to bypass.

 But, perhaps, it will turn out to be that there are so many unpatched
 wide-open places they can find that they'll never bother you again.

 I sure hope so, for your sake!

 --
 Like Music?
 http://l-i-e.com/artists.htm

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



[PHP] How to handle a 64bit FILETIME?

2005-03-03 Thread Tom Cannaerts
Hello,

I'm processing a binary file, and in that file there is a 64bit FILETIME 
value. This value represents the number of 100-nanoseconds since 1/1/1601.

I would like to convert it to a somewhat more usable value, since I 
eventually will need to display that value as a human readable date.

Any solution is welcome.


Tom 

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



[PHP] DB INSERT CRON

2005-03-03 Thread Shaun
Hi,

I have a web based system that allows users to upload XML files and insert 
them into the database, however some of these files are large and are 
causing the webserver to timeout.

Is it possible to create a cron job that can insert the xml files say every 
hour, then the users of the site would only have to upload the files and not 
wait for the insert?

Any advice / examples here would be great as I am not a UNIX expert!

Thanks 

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



[PHP] DB INSERT CRON

2005-03-03 Thread Shaun
Hi,

I have a web based system that allows users to upload XML files and insert
them into the database, however some of these files are large and are
causing the webserver to timeout.

Is it possible to create a cron job that can insert the xml files say every
hour, then the users of the site would only have to upload the files and not
wait for the insert?

Any advice / examples here would be great as I am not a UNIX expert!

Thanks

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



[PHP] Simple XML

2005-03-03 Thread Uro Gruber
Hello!
I have trouble parsing some XML data. I'm doing EPP client
http://www.iana.org/assignments/xml-registry/ns.html
And responses I get uses XML shemas. Header of response
is
 epp xmlns=urn:ietf:params:xml:ns:epp-1.0
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
   xsi:schemaLocation=urn:ietf:params:xml:ns:epp-1.0
   epp-1.0.xsd
And then
resData
  domain:chkData xmlns:domain=urn:ietf:params:xml:ns:domain-1.0 
xsi:schemaLocation=urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd
domain:cd
  domain:name avail=1bar.com/domain:name
/domain:cd
domain:cd
  domain:name avail=1foo.com/domain:name
/domain:cd
  /domain:chkData
/resData

But I cant get to this cd If I print_r complete response object it 
looks like it works, but then when I use
 resdata-chkData I got empty object.

Any help would be great
regards
Uros
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] default mysql connection character-set

2005-03-03 Thread arusp
hi,

is there a Runtime Configuration variable (php.ini) that defines default mysql 
connection character-set like my.cnf's default-character-set = in the 
[client] segment ? 

otherwise i have to execute mysql_query('SET CHARACTER SET latin5'); 
everytime after connecting the database .

thanks

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



[PHP] Can't save multiple files if I'm using values pulled from another file...

2005-03-03 Thread Foofy
I'm writing a script that transfers files from a list file and saves them  
locally. M

If I use values from the list for the filenames of the saved files, it  
appears that none of the files are saved 'cept for the last one. If I put  
the values in an array directly in the script file, all is well. I have  
confirmed that the values are different and I've tried other methods to  
load the file, such as fgets. Here is a simplified version of my script  
that has the same problem:

?php
$linklist = file('links.txt');
foreach ($linklist as $link) {
echo saving to $linkbr; // confirm link name
$file = fopen ($link, 'w'); // write dummy text to file
fwrite($file, 'blah');
fclose($file);
}
?
And in links.txt I have:
link one
link two
link three
If I run the script, the only file that will have been created is link  
three or whatever is on the bottom. If however, I replace the first line  
with:
	
	$linklist = array(link one, link two, link three);

Then the script works as expected. What am I missing? I've wasted three  
hours trying to figure this out and I don't know what I could be screwing  
up. :(

Foofy
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Preventing data from being reposted?

2005-03-03 Thread rory walsh
Is there anyway I can prevent data from being reposted when I hit the 
back button on my browser? When I hit back I get a message from my 
browser asking do I want to repost the data, can I prevent this window 
from appearing?

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


Re: [PHP] Preventing data from being reposted?

2005-03-03 Thread eoghan
you can use header()
http://ie.php.net/header
rory walsh wrote:
Is there anyway I can prevent data from being reposted when I hit the 
back button on my browser? When I hit back I get a message from my 
browser asking do I want to repost the data, can I prevent this window 
from appearing?

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


Re: [PHP] Preventing data from being reposted?

2005-03-03 Thread rory walsh
Thanks Eoghan, I have tried the following but it still reposts the data 
from the form and goes back a page?

header(Cache-control: private);
header(Cache-Control: no-store, no-cache, must-revalidate);
header(Cache-Control: post-check=0, pre-check=0, false);
header(Pragma: no-cache);
Am I write in assuming that the above headers should prevent the user 
from going back in the first place as no cache has been taken?

Eoghan wrote:
you can use header()
http://ie.php.net/header
rory walsh wrote:
Is there anyway I can prevent data from being reposted when I hit the 
back button on my browser? When I hit back I get a message from my 
browser asking do I want to repost the data, can I prevent this window 
from appearing?

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


Re: [PHP] How to handle a 64bit FILETIME?

2005-03-03 Thread Jochem Maas
Tom Cannaerts wrote:
Hello,
I'm processing a binary file, and in that file there is a 64bit FILETIME 
value. This value represents the number of 100-nanoseconds since 1/1/1601.

I would like to convert it to a somewhat more usable value, since I 
eventually will need to display that value as a human readable date.
the BC maths extension may be what you want (in order to convert the
64bit 'number'** to something you can use with date functions)
http://nl2.php.net/manual/en/ref.bc.php
** your 64bit FILETIME 'number' should be passed to the relevant bc_*() funcs
as a string
Any solution is welcome.
Tom 

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


Re: AW: [PHP] How to sort a Multidimensional array?

2005-03-03 Thread Jochem Maas
Mirco Blitz wrote:
 
Sorry for multipost. My ISP delayed sends for about an houre. I didn't
recognize it.
ok - please realise that SMTP is quite robust - mail servers will keep 
trying for days
before giving up (in which case you will eventually get a reply saying the 
sending
failed) - your posts will get thru just it sometimes takes a long time - the 
server(s?)
running the php mail lists are rather overworked :-)
I don't whether you're using PHP5 but if you are then here is a class that does 
what you
want (there are a few examples at the bottom) - I won't explain how it works, 
because:
a, the examples should tell you enough.
b, it forces you to have a look at the source code :-)
?php
/**
 * MDASort.class.php :: simple interface to sort a mutlidimensional array
 *
 * We often have arrays of arrays where the sub-arrays are rows of data
 * (either created or extracted from a database) - this class allows us to
 * easily sort arrays in the base container array by any number of keys found
 * in the sub-arrays. be aware that it is assumed that the array keys found in 
the
 * sub arrays are associative. Also maybe the _sortcmp method could be enhanced 
to
 * allow arbitrary levels of arrays to be sorted: by calling sort() on a level
 * N array also the sortKeys contents would then have to be checked to see if
 * they applied to the current (sub-)array
 *
 * @author  Some guy on PHP comment board. 
http://php.net/manual/en/function.usort.php
 * @author  Jochem Maas [EMAIL PROTECTED]
 *
 * Apologies to 'Some guy on PHP comment board' for not being able to state his 
name here!
 */
/**
 * This file and its contents is not copyrighted;
 * The contents are free to be used by anybody under any conditions.
 */
class MDASort {
private $dataArray; //the array we want to sort.
private $sortKeys;  //the order in which we want the array to be sorted.
function __construct()
{
if ($cnt = func_num_args()) {
$args = func_get_args();
if (isset($args[0])) {
$this-setData($args[0]);
}
if (isset($args[1])) {
$this-setSortKeys($args[1]);
}
if (isset($args[2])  $args[2] === true) {
$this-sort();
}
}
}
function _sortcmp($a, $b, $i=0)
{
   $r = strnatcmp($a[$this-sortKeys[$i][0]],$b[$this-sortKeys[$i][0]]);
   if ($this-sortKeys[$i][1] == DESC) $r = $r * -1;
   if($r==0) {
   $i++;
   if ($this-sortKeys[$i]) $r = $this-_sortcmp($a, $b, $i);
   }
   return $r;
}
function sort()
{
   if(count($this-sortKeys)) {
   usort($this-dataArray, array($this,_sortcmp));
   }
}
function setData($dataArray = array())
{
$this-dataArray = $dataArray;
}
function setSortKeys($sortKeys = array())
{
$this-sortKeys = $sortKeys;
}
function getData()
{
return $this-dataArray;
}
function getSortKeys()
{
return $this-sortKeys;
}
}
/* example of usage */
/*
$sorter = new MDASort;
$sorter-setData( array(
   array(name = hank, headsize = small, age = 32),
   array(name = sade, headsize = petit, age = 36),
   array(name = hank, headsize = large, age = 33),
   array(name = sade, headsize = large, age = 32),
   array(name = john, headsize = large, age = 32),
   array(name = hank, headsize = small, age = 36),
   array(name = hank, headsize = small, age = 40)
));
$sorter-setSortKeys( array(
   array('name','ASC'),
   array('headsize','DESC'),
   array('age','ASC'),
));
$sorter-sort();
$sortedArray = $sorter-getData();
*/
/* 2nd example of usage */
/*
$data = array(
   array(name = hank, headsize = small, age = 32),
   array(name = sade, headsize = petit, age = 36),
   array(name = hank, headsize = large, age = 33),
   array(name = sade, headsize = large, age = 32),
   array(name = john, headsize = large, age = 32),
   array(name = hank, headsize = small, age = 36),
   array(name = hank, headsize = small, age = 40)
);
$sort = array(
   array('name','ASC'),
   array('headsize','DESC'),
   array('age','ASC'),
);
$sorter = new MDASort($data, $sort);
$sorter-sort();
$sortedArray = $sorter-getData();
*/
/* 3rd example of usage */
/*
$data = array(
   array(name = hank, headsize = small, age = 32),
   array(name = sade, headsize = petit, age = 36),
   array(name = hank, headsize = large, age = 33),
   array(name = sade, headsize = large, age = 32),
   array(name = john, headsize = large, age = 32),
   array(name = hank, headsize = small, age = 36),
   array(name = hank, headsize = small, age = 40)
);
$sort = array(
   array('name','ASC'),
   array('headsize','DESC'),
   array('age','ASC'),
);
$sorter = new MDASort($data, $sort, true);  // auto sort
$sortedArray = $sorter-getData();
*/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Preventing data from being reposted?

2005-03-03 Thread Jochem Maas
rory walsh wrote:
Thanks Eoghan, I have tried the following but it still reposts the data 
from the form and goes back a page?

header(Cache-control: private);
header(Cache-Control: no-store, no-cache, must-revalidate);
header(Cache-Control: post-check=0, pre-check=0, false);
header(Pragma: no-cache);
Am I write in assuming that the above headers should prevent the user 
from going back in the first place as no cache has been taken?
no - just that if they do then the page will have to be reloaded (under
std conditions the user then gets the 'Are you sure you want to repost?' kind
of message)
before asking anything more on this topic, look up a thread on this
lists archive entitled
'Clear POST variables on page refresh'
this should give you headsup on the issues + a good suggestion by Richard
Lynch on how to handle this (his idea uses md5 hashes to 'auth' specific POST
actions, when the POST occurs the given hash is invalidated... read original 
thread
for full info)

Eoghan wrote:
you can use header()
http://ie.php.net/header
rory walsh wrote:
Is there anyway I can prevent data from being reposted when I hit the 
back button on my browser? When I hit back I get a message from my 
browser asking do I want to repost the data, can I prevent this 
window from appearing?


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


Re: [PHP] Preventing data from being reposted?

2005-03-03 Thread Gareth Williams
Wouldn't using GET instead of POST help?
Gareth Williams
venditor.com
Buy cool stuff online at a 
href=http://www.venditor.com;venditor.com/a

On 3 Mar 2005, at 14:20, Jochem Maas wrote:
rory walsh wrote:
Thanks Eoghan, I have tried the following but it still reposts the 
data from the form and goes back a page?
header(Cache-control: private);
header(Cache-Control: no-store, no-cache, must-revalidate);
header(Cache-Control: post-check=0, pre-check=0, false);
header(Pragma: no-cache);
Am I write in assuming that the above headers should prevent the user 
from going back in the first place as no cache has been taken?
no - just that if they do then the page will have to be reloaded (under
std conditions the user then gets the 'Are you sure you want to 
repost?' kind
of message)

before asking anything more on this topic, look up a thread on this
lists archive entitled
'Clear POST variables on page refresh'
this should give you headsup on the issues + a good suggestion by 
Richard
Lynch on how to handle this (his idea uses md5 hashes to 'auth' 
specific POST
actions, when the POST occurs the given hash is invalidated... read 
original thread
for full info)

Eoghan wrote:
you can use header()
http://ie.php.net/header
rory walsh wrote:
Is there anyway I can prevent data from being reposted when I hit 
the back button on my browser? When I hit back I get a message from 
my browser asking do I want to repost the data, can I prevent this 
window from appearing?

--
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


Re: [PHP] Preventing data from being reposted?

2005-03-03 Thread rory walsh
Cheers, I'll take a look, I had tried a search but thunderbird didn't 
find anything, even with the exact thread title I had to google it? 
Anyway I'll take a look.

Jochem Maas wrote:
rory walsh wrote:
Thanks Eoghan, I have tried the following but it still reposts the 
data from the form and goes back a page?

header(Cache-control: private);
header(Cache-Control: no-store, no-cache, must-revalidate);
header(Cache-Control: post-check=0, pre-check=0, false);
header(Pragma: no-cache);
Am I write in assuming that the above headers should prevent the user 
from going back in the first place as no cache has been taken?

no - just that if they do then the page will have to be reloaded (under
std conditions the user then gets the 'Are you sure you want to repost?' 
kind
of message)

before asking anything more on this topic, look up a thread on this
lists archive entitled
'Clear POST variables on page refresh'
this should give you headsup on the issues + a good suggestion by Richard
Lynch on how to handle this (his idea uses md5 hashes to 'auth' specific 
POST
actions, when the POST occurs the given hash is invalidated... read 
original thread
for full info)


Eoghan wrote:
you can use header()
http://ie.php.net/header
rory walsh wrote:
Is there anyway I can prevent data from being reposted when I hit 
the back button on my browser? When I hit back I get a message from 
my browser asking do I want to repost the data, can I prevent this 
window from appearing?


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


Re: [PHP] Preventing data from being reposted?

2005-03-03 Thread eoghan
i think ive missed a few mails there...?
rory walsh wrote:
Cheers, I'll take a look, I had tried a search but thunderbird didn't 
find anything, even with the exact thread title I had to google it? 
Anyway I'll take a look.

Jochem Maas wrote:
rory walsh wrote:
Thanks Eoghan, I have tried the following but it still reposts the 
data from the form and goes back a page?

header(Cache-control: private);
header(Cache-Control: no-store, no-cache, must-revalidate);
header(Cache-Control: post-check=0, pre-check=0, false);
header(Pragma: no-cache);
Am I write in assuming that the above headers should prevent the 
user from going back in the first place as no cache has been taken?

no - just that if they do then the page will have to be reloaded (under
std conditions the user then gets the 'Are you sure you want to 
repost?' kind
of message)

before asking anything more on this topic, look up a thread on this
lists archive entitled
'Clear POST variables on page refresh'
this should give you headsup on the issues + a good suggestion by 
Richard
Lynch on how to handle this (his idea uses md5 hashes to 'auth' 
specific POST
actions, when the POST occurs the given hash is invalidated... read 
original thread
for full info)


Eoghan wrote:
you can use header()
http://ie.php.net/header
rory walsh wrote:
Is there anyway I can prevent data from being reposted when I hit 
the back button on my browser? When I hit back I get a message 
from my browser asking do I want to repost the data, can I prevent 
this window from appearing?



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


Re: [PHP] php DBMS

2005-03-03 Thread Devraj Mukherjee
We have been looking at implmenting Prevalyer for PHP but it to us seems 
impossible to do as the PHP engine is not designed like an application 
server.

To add to this we are now in the process of writing an entpire PHP app 
server and will then be writing the Prevalyer layer as well as DB 
abstraction layers for PHP5.

Devraj
Richard Lynch wrote:
Chris W. Parker wrote:
Gerben mailto:[EMAIL PROTECTED]
   on Wednesday, March 02, 2005 10:22 AM said:

Thanks for all your responses, but I think I wasn't clear enough of my
intentions.
Actually, that what I'm looking for; A database engine written in PHP.
Even if something like this did exist why would you want it over MySQL?

They have licensing issues with MySQL, I guess.
I'd go with http://postgresql.org in that case, rather than roll my own,
but that's just me :-)

--
Devraj Mukherjee ([EMAIL PROTECTED])
Eternity Technologies Pty. Ltd. ACN 107 600 975
P O Box 5949 Wagga Wagga NSW 2650 Australia
Voice: +61-2-69717131 / Fax: +61-2-69251039
http://www.eternitytechnologies.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Preventing data from being reposted?

2005-03-03 Thread Jochem Maas
Gareth Williams wrote:
Wouldn't using GET instead of POST help?
in a way it could - but you don't usually want to use a GET as this
can be easily spoofed (i.e. anyone could send you a link or post one in a forum
that would do the post action without warning you)
which comes down to: you should be 'certified' if you use GET to allow
users to submit a payment confirmation - you only want a FORM to be able to
submit such a confirmation rather than allowing any old link to issue such a
confirmation
for a much better description on why using GET is 'bad' in this kind of 
situation
I refer you to posts made by Richard Lynch (I think??) in the last 6 weeks 
(can't remember the
subject Im afraid)

Gareth Williams
venditor.com
Buy cool stuff online at a href=http://www.venditor.com;venditor.com/a
On 3 Mar 2005, at 14:20, Jochem Maas wrote:
rory walsh wrote:
Thanks Eoghan, I have tried the following but it still reposts the 
data from the form and goes back a page?
header(Cache-control: private);
header(Cache-Control: no-store, no-cache, must-revalidate);
header(Cache-Control: post-check=0, pre-check=0, false);
header(Pragma: no-cache);
Am I write in assuming that the above headers should prevent the user 
from going back in the first place as no cache has been taken?

no - just that if they do then the page will have to be reloaded (under
std conditions the user then gets the 'Are you sure you want to 
repost?' kind
of message)

before asking anything more on this topic, look up a thread on this
lists archive entitled
'Clear POST variables on page refresh'
this should give you headsup on the issues + a good suggestion by Richard
Lynch on how to handle this (his idea uses md5 hashes to 'auth' 
specific POST
actions, when the POST occurs the given hash is invalidated... read 
original thread
for full info)

Eoghan wrote:
you can use header()
http://ie.php.net/header
rory walsh wrote:
Is there anyway I can prevent data from being reposted when I hit 
the back button on my browser? When I hit back I get a message from 
my browser asking do I want to repost the data, can I prevent this 
window from appearing?

--
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


Re: [PHP] Preventing data from being reposted?

2005-03-03 Thread Jochem Maas
eoghan wrote:
i think ive missed a few mails there...?
rory walsh wrote:
Cheers, I'll take a look, I had tried a search but thunderbird didn't 
find anything, even with the exact thread title I had to google it? 
Anyway I'll take a look.
my first google hit on search for the exact title gave me this:
http://www.issociate.de/board/post/171234/Clear_POST_variables_on_page_refresh.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] DB INSERT CRON

2005-03-03 Thread Devraj Mukherjee
Hi Shaun,
Depending on the urgency of the data being transported into the database 
from the XML file, you could even run a server process that will wait 
for a new file to be added to a nominated directory and add the data to 
the database.

As far as I know you could possibly use the PHP engine to that from the 
command line, command line invocation will not timeout as web scripts. 
Cron is a good idea if you dont mind the delay.

If you had a server process you could have the data insertion completed 
quite instantly, relatively anyway.

You could also write the server side stuff in say Python or a language 
of the like.

Let us know if you need any further specific help.
Devraj
Shaun wrote:
Hi,
I have a web based system that allows users to upload XML files and insert 
them into the database, however some of these files are large and are 
causing the webserver to timeout.

Is it possible to create a cron job that can insert the xml files say every 
hour, then the users of the site would only have to upload the files and not 
wait for the insert?

Any advice / examples here would be great as I am not a UNIX expert!
Thanks 


--
Devraj Mukherjee ([EMAIL PROTECTED])
Eternity Technologies Pty. Ltd. ACN 107 600 975
P O Box 5949 Wagga Wagga NSW 2650 Australia
Voice: +61-2-69717131 / Fax: +61-2-69251039
http://www.eternitytechnologies.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php DBMS

2005-03-03 Thread Jochem Maas
Richard Lynch wrote:
Chris W. Parker wrote:
Gerben mailto:[EMAIL PROTECTED]
   on Wednesday, March 02, 2005 10:22 AM said:

Thanks for all your responses, but I think I wasn't clear enough of my
intentions.
Actually, that what I'm looking for; A database engine written in PHP.
Even if something like this did exist why would you want it over MySQL?

They have licensing issues with MySQL, I guess.
I'd go with http://postgresql.org in that case, rather than roll my own,
but that's just me :-)
thats only because you've never used firebird ;-)

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


Re: [PHP] Re: Authentication fails

2005-03-03 Thread John Swartzentruber
On 3/2/2005 5:21 PM Richard Lynch wrote:
John Swartzentruber wrote:
VirtualHost 66.92..XX:80 10.X.0.3:80
ServerName john.swartzentruber.us
ServerAdmin webmasXXXtzentruber.us
DocumentRoot /var/www/vhosts/swartzentruber.us/john/html
Directory /var/www/vhosts/swartzentruber.us/john/html
AllowOverride AuthConfig
Options Indexes Includes FollowSymLinks
Order allow,deny
Allow from all
/Directory
/VirtualHost

Nothing I can see...
I guess the next thing I would advise would be:
1. Write/steal a Perl CGI script that does a simple POST processing, and
see if *IT* can work.  Either your webserver is messing up POST, or PHP
is.  If Perl can't work POST, it's your webserver.  If Perl *can* do POST,
it's probably PHP.
2. File a bug report (after searching for them) in the PHP or Apache bugs
systems.
I'm still clueless, but I did find something interesting. I found a 
small PHP form example in the PHP book that I'm reading. I ran it and it 
works correctly. That seems to indicate that Apache isn't the problem. 
Somehow my one fairly stripped down script is different from another 
very stripped down script. When I have the time, my task will be to try 
to figure out what is different between the two scripts.

Thanks for your help and your time. I'll try to report back when I find 
out something new.

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


Re: [PHP] Can't save multiple files if I'm using values pulled from another file...

2005-03-03 Thread Jason Wong
On Thursday 03 March 2005 19:53, Foofy wrote:
 I'm writing a script that transfers files from a list file and saves
 them locally. M

 If I use values from the list for the filenames of the saved files, it
 appears that none of the files are saved 'cept for the last one. If I
 put the values in an array directly in the script file, all is well. I
 have confirmed that the values are different and I've tried other
 methods to load the file, such as fgets. Here is a simplified version
 of my script that has the same problem:

Thank you for helping others to help you by constructing a simplified 
example.

  ?php
  $linklist = file('links.txt');

file() - ... each element of the array corresponds to a line in the 
file, with the newline still attached ...

That's most likely your problem. The last line of your file most likely 
does not have a trailing NL character that is why it is the only line 
that works.

-- 
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
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] Variable Replacement

2005-03-03 Thread Jochem Maas
James Williams wrote:
 Hey guys, I'm coding a forum right now and I just decided that I needed 
James,
I'll assume that you're coding a forum because you feel like it. :-)
(i.e. there are lots of forum 'packages' out there)
to code some variable replacement to create a simple template system. 
This is the code I have but it doesn't work

   
   |?php
   $tpl = file http://php.net/file(tpl/head.tpl);
it makes it a little less readable if you add the links to the manual next 
to
each function call anyhow...
what is the content of 'tpl/head.tpl'?
does $tpl contain what you think it does?
does $config contain what you think it does?
(have you got error_reporting on 'full'?)
   $code = str_replace
   http://php.net/str_replace({sitename},$config['sitename'],$tpl);
I very much doubt that this is causing a problem BUT you might want
to change that last line:
from: $code = str_replace({sitename},$config['sitename'],$tpl);
to:   $code = str_replace('{sitename}',$config['sitename'],$tpl);

   foreach ($code as $codeline) {
 print http://php.net/print($codeline);
   }
instead of the loop try (not that this has anything to do with the problem):
echo join('',$code);
   ?|
   
This simply results in a mess, with only the pictures showing up on my 
could you post an example?
because AFAICS the bit of code you posted should work ok.
page... I know this code is horrible but I have no idea how to go about 
doing this. I've never worked with reading files and whatnot before

there are _lots_ of php template 'engines' out there; one of the most 
wellknown
is Smarty. why not give it a whirl, it might do what you want, and even if it 
doesn't
you can pickup a few ideas along the way (just dive into their source :-)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php DBMS

2005-03-03 Thread Jochem Maas
Chris W. Parker wrote:
Chris W. Parker 
on Wednesday, March 02, 2005 10:38 AM said:

Gerben mailto:[EMAIL PROTECTED]
   on Wednesday, March 02, 2005 10:22 AM said:

Thanks for all your responses, but I think I wasn't clear enough of
my intentions. Actually, that what I'm looking for; A database
engine written in PHP. 
Even if something like this did exist why would you want it over
MySQL?

Now for something more constructive: I found this
http://www.c-worker.ch/txtdbapi/index_eng.php.
if Gerben was to use this then why wouldn't he want to use SQLite,
which is the same idea (SQL interface to flatfile storage) but written
by the PHP devs (in C, so its much faster + I think you can assume the devs 
really
know what they are doing) and included as std. in PHP5?
that said the TXTDB package does look good and if you are using PHP4 then maybe
you should go with that instead (PHP4 does not have SQLite AFAICR)

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


Re: [PHP] php DBMS

2005-03-03 Thread M. Sokolewicz
Jochem Maas wrote:
Chris W. Parker wrote:
Chris W. Parker 
on Wednesday, March 02, 2005 10:38 AM said:

Gerben mailto:[EMAIL PROTECTED]
   on Wednesday, March 02, 2005 10:22 AM said:

Thanks for all your responses, but I think I wasn't clear enough of
my intentions. Actually, that what I'm looking for; A database
engine written in PHP. 

Even if something like this did exist why would you want it over
MySQL?

Now for something more constructive: I found this
http://www.c-worker.ch/txtdbapi/index_eng.php.
if Gerben was to use this then why wouldn't he want to use SQLite,
which is the same idea (SQL interface to flatfile storage) but written
by the PHP devs (in C, so its much faster + I think you can assume the 
devs really
know what they are doing) and included as std. in PHP5?
sqlite isn't written by the php devs. It's simply included in the 
distributions; just like bcmath is.
SQLite itself is a free OS library, usable by pretty much everyone

that said the TXTDB package does look good and if you are using PHP4 
then maybe
you should go with that instead (PHP4 does not have SQLite AFAICR)


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


Re: [PHP] Can't save multiple files if I'm using values pulled from another file...

2005-03-03 Thread Jochem Maas
Foofy wrote:
I'm writing a script that transfers files from a list file and saves 
them  locally. M

If I use values from the list for the filenames of the saved files, it  
appears that none of the files are saved 'cept for the last one. If I 
put  the values in an array directly in the script file, all is well. I 
have  confirmed that the values are different and I've tried other 
methods to  load the file, such as fgets. Here is a simplified version 
of my script  that has the same problem:

?php
$linklist = file('links.txt');
foreach ($linklist as $link) {
echo saving to $linkbr; // confirm link name
$file = fopen ($link, 'w'); // write dummy text to file
try changing the above line to:
  $file = fopen (rtrim($link), 'w'); // write dummy text to file
$link should contain a complete path to the file, or possible a valid URL.
also maybe you should check that your file handle is ok, so maybe do this 
instead:
  if ($file = fopen (rtrim($link), 'w')) {
fwrite($file, 'blah');
fclose($file);  
  }
also there are the following functions:
is_file()
is_dir()
is_readable()
is_writable()
fwrite($file, 'blah');
fclose($file);
}
?
And in links.txt I have:
link one
link two
link three
If I run the script, the only file that will have been created is link  
three or whatever is on the bottom. If however, I replace the first 
line  with:

$linklist = array(link one, link two, link three);

Then the script works as expected. What am I missing? I've wasted three  
hours trying to figure this out and I don't know what I could be 
screwing  up. :(

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


Re: [PHP] Preventing data from being reposted?

2005-03-03 Thread rory walsh
Yeah I got it, cheers. Actually the problem I am getting is more to do 
with my session variables I think? Here is the jist of the code.

if(log out button has been pressed)
{
session_variable=no
}
if(log in button has been pressed)
{
session_variable=yes
}
if(session_variable==yes)
{
display the string you have logged in and place a button on the page 
so they can log out.
}
else display you are not logged in

The problem is that I can always get back to the you have logged in 
display by simply pressing back, even though once the user hits the 
logout button the variable is no longer yes? I have to hit the back 
button a few times to get the you have logged in message. No doubt 
there are mistakes elsewhere in my code, but can anyone just verify that 
the above code should run without a problem?


Jochem Maas wrote:
eoghan wrote:
i think ive missed a few mails there...?
rory walsh wrote:
Cheers, I'll take a look, I had tried a search but thunderbird didn't 
find anything, even with the exact thread title I had to google it? 
Anyway I'll take a look.

my first google hit on search for the exact title gave me this:
http://www.issociate.de/board/post/171234/Clear_POST_variables_on_page_refresh.html 

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


Re: [PHP] sql query

2005-03-03 Thread Jochem Maas
Jason Petersen wrote:
On Wed, 2 Mar 2005 13:02:39 +0200, William Stokes [EMAIL PROTECTED] wrote:
Hello
Can someone explain this to me. I don't know how to read this.
if (!$variable = mysql_query(select id,sessid from users where ...
What is this if(!

This is a way to run a SQL query, capture the return value, and
perform an action if the query failed. For code readability, I would
probably write that as two statements:
$variable = mysql_query(SELECT * FROM blah);
if(!$variable) { error_handler(mysql_error()); }
in terms of readability an alternative if to write it like so:
if(! ($variable = mysql_query(SELECT * FROM blah)) {
// do stuff
}
what you have to realise is that the expression '$variable = mysql_query(SELECT * 
FROM blah)'
has a return value itself - which just happens to be the same as the value of 
$variable.
to put it another way, when you do:
echo $variable;
your not saying:
 output the contents of this variable
but your actually saying:
 output the result of the expression '$variable'
it just so happens that the result of the expression is this case
if the contents of $variable.
hopefully you get what I mean!, no doubt there are others that can explain it 
better!
See the documentation for information on mysql_query return values:
http://us2.php.net/manual/en/function.mysql-query.php
Jason
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Preventing data from being reposted?

2005-03-03 Thread Jochem Maas
rory walsh wrote:
Yeah I got it, cheers. Actually the problem I am getting is more to do 
with my session variables I think? Here is the jist of the code.

if(log out button has been pressed)
{
session_variable=no
}
if(log in button has been pressed)
{
session_variable=yes
}
if(session_variable==yes)
{
display the string you have logged in and place a button on the page 
so they can log out.
}
else display you are not logged in
the psuedo code seems ok - no way of knowing how this reflects
on your actual code tho.
The problem is that I can always get back to the you have logged in 
display by simply pressing back, even though once the user hits the 
logout button the variable is no longer yes? I have to hit the back 
button a few times to get the you have logged in message. No doubt 
there are mistakes elsewhere in my code, but can anyone just verify that 
the above code should run without a problem?
maybe you are looking at cached pages in your browser?
if 'session_variable==yes' equates to true then you should send out
headers that tell the browser not to cache the output (or make it
private/force-revalidation)


Jochem Maas wrote:
eoghan wrote:
i think ive missed a few mails there...?
rory walsh wrote:
Cheers, I'll take a look, I had tried a search but thunderbird 
didn't find anything, even with the exact thread title I had to 
google it? Anyway I'll take a look.

my first google hit on search for the exact title gave me this:
http://www.issociate.de/board/post/171234/Clear_POST_variables_on_page_refresh.html 


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


Re: [PHP] Can't save multiple files if I'm using values pulled from another file...

2005-03-03 Thread Foofy
On Thu, 03 Mar 2005 09:06:22 -0500, [EMAIL PROTECTED] wrote:
That's most likely your problem. The last line of your file most likely
does not have a trailing NL character that is why it is the only line
that works.
Thank you for your help! My server dude looked around and yes, the files  
were being saved, but they weren't showing up because my FTP client didn't  
understand filenames with newline characters. rtrim() did the trick.  
Thanks again! You have no idea how much time I've wasted on this. :)

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Spam and this list

2005-03-03 Thread Jochem Maas
AdamT wrote:
On Tue, 01 Mar 2005 11:11:47 -0500, bob [EMAIL PROTECTED] wrote:
Well, this time it took just 11 days to get my first bit of spam from
this mailing list.
Do you mean the spam was from php-general@lists.php.net ?
Or do you mean that you know for sure that your address was harvested
from this list?
I've not noticed getting any extra spam since joining, personally. 
Don't forget that:

a) Emails you send to this list may be forwarded elsewhere, with your
address included
b) The email address you use for this list may have been 'brute-forced'
c) Some malicious oik may have posted your address somewhere else world-readable
d) You might have accidentally posted it someplace else (eg register
for access to our forums, we promise not to use it for blah blah blah,
please tick a box, etc, etc).
the complete posts to this list (and many others) can be found on websites
all over the place - no doubt harvesters visit there regularly - then
again you may just be seeing a general upturn in the number of spam
being:
a, sent to you
b, getting thru to your inbox (spamfilters need adjusting?)

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


Re: [PHP] Preventing data from being reposted?

2005-03-03 Thread rory walsh
I'm pretty sure I am looking at cached pages but the problem with this 
seems to be that some browsers support these header directives and 
others don't, i.e. Firefox.

The following work in IE but not Firefox
header(Cache-control: private);
header(Cache-Control: no-store, no-cache, must-revalidate);

maybe you are looking at cached pages in your browser?
if 'session_variable==yes' equates to true then you should send out
headers that tell the browser not to cache the output (or make it
private/force-revalidation)


Jochem Maas wrote:
eoghan wrote:
i think ive missed a few mails there...?
rory walsh wrote:
Cheers, I'll take a look, I had tried a search but thunderbird 
didn't find anything, even with the exact thread title I had to 
google it? Anyway I'll take a look.


my first google hit on search for the exact title gave me this:
http://www.issociate.de/board/post/171234/Clear_POST_variables_on_page_refresh.html 



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


Re: [PHP] Re: PHP 5.1 CVS Interface Question

2005-03-03 Thread Jochem Maas
Gavin Roy wrote:
Stolen from a oo reference site (who's URL I no longer have handy):
An object interface--or simply interface--defines methods that can be
implemented by a class. Interfaces are declared like classes, but
cannot be directly instantiated and do not have their own method
definitions. Rather, it is the responsibility of any class that
supports an interface to provide implementations for the interface's
methods. A variable of an interface type can reference an object whose
class implements that interface; however, only methods declared in the
interface can be called using such a variable.
That goes with my understanding as interfaces being one more level of
abstraction from abstract classes.  That is they define the rules for
the classes that implement them, but not any code (where an abstract
class can implement code).  I guess my understanding of an interface
is wrong?
no not really - only the PHP devs have a particular view of what an 
interface
should be / how it should be used. other groups have different views.
personally I don't _think_ you are using a 'good' paradigm for you class 
heirachy -
but its impossible to tell for sure - I'd have to see much more code :-)
btw: if you drop the 'static' from the interface definition and from the class 
definitions
(of the interface) you can still use/call the methods statically...
...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] mailserver logfile analyser

2005-03-03 Thread woldhekkie
thanks verry much RICHARD,

learning to program is hell for newbies.
tried vb.net, autoit,purebasic,asp and more.
Not one of them is perfect.
It seems php is easyer learning than asp, so i will stick with php. Our 
mail/webserver does both.

I deeply respect programmers. it would be nice if i could also think my 
programs.
But i am just an administrator.
One question:
A php programmer like you can program anything, but do you ? Can you make 
money with it.
Or is it just like everything else: verry difficult.

regards,

Erik

P.S. Nice music



Richard Lynch [EMAIL PROTECTED] schreef in bericht 
news:[EMAIL PROTECTED]
 woldhekkie wrote:
 Our mailserver writes a logfile every day, but it takes hours to analyse
 it
 manualy.

 I (newby) am trying to write a php script that reads the the logfile line
 by
 line and try to get a top 50 of spammers/clients that mail too much...

 I can get line by line all information like email-adres, from , to , 
 bytes
 send , but how to store it in a array ?
 If a line is read and the emailadres already pressent in the array, it
 should not ad this emailadress again, but add a counter +1

 In the end i want an array containing all emailadreses and how often they
 were counted.

 This is how far i get: (sorry, it is in Dutch)
 It shows all from and to emailadresses. Not bad for a newby, but it took
 one
 week to do.

 ?php
 $fp=;$line=;$aantal=0;

 $emails = array(); //maybe use $froms = array(); $tos = array();

 echo TABLE BORDER=3;
 echo TRTD ALIGN=\center\ From:/TDTD
 ALIGN=\center\To:/TD/TR;
 if($fp = fopen(C:\smtp\SMTP-Activity-050226.log,r)) {
 while (!feof ($fp)) {
$line = fgets($fp, 4096);
if(strstr($line,SMTP-IN)) {
   if(strstr($line,MAIL FROM )) {
   $aantal++;
   $start=strpos($line,);
   $end=strpos($line,);
   $from=str_replace(,  , str_replace(,  ,
 substr($line,$start,$end-$start)));

 $emails[$from]++; //maybe use $froms[$email]++;

 //Fancier version:
 $emails[$from] = isset($emails[$from]) ? $emails[$from] + 1 : 1;

   echo TRTD.$from./TD;
 }
   if(strstr($line,RCPT TO )) {
   $start=strpos($line,);
   $end=strpos($line,);

 //Same pattern as above
 $to = str_replace(,  , str_replace(,  ,
 substr($line,$start,$end-$start)));
 $emails[$to]++;

   echo TD . str_replace(,  , str_replace(,  ,
 substr($line,$start,$end-$start)))./TD;
   }
   }
   }
 echo /TR/TABLE;
 fclose($fp);
   }
 echo Totaal aantal:  $aantal BR;

 echo Top 10:table;
 arsort($emails);
 reset($emails);
 for ($i = 0; $i  10; $i++){
  list($email, $count) = each($emails);
  echo trtd align='right'$email/tdtd
 align='right'$count/td/tr\n;
 }
 echo /table;

 //If you want $froms/$tos separate, copy/paste code above and do it for 
 both

 ?

 -- 
 Like Music?
 http://l-i-e.com/artists.htm 

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



Re: [PHP] Preventing data from being reposted?

2005-03-03 Thread Jochem Maas
rory walsh wrote:
I'm pretty sure I am looking at cached pages but the problem with this 
seems to be that some browsers support these header directives and 
others don't, i.e. Firefox.

The following work in IE but not Firefox
header(Cache-control: private);
header(Cache-Control: no-store, no-cache, must-revalidate);
I'd guess that should work but maybe the 'private' throws firefox a 
curveball, anyway here
are the headers I use to 'privatise' logged in sessions:
header(Expires: .gmdate(D, d M Y H:i:s, strtotime('1-Jan-1980')) .  
GMT);
// always modified
header(Last-Modified:  . gmdate(D, d M Y H:i:s) .  GMT);
// HTTP/1.1
header(Cache-Control: no-store, no-cache, must-revalidate);
header(Cache-Control: post-check=0, pre-check=0, false);
// HTTP/1.0
header(Pragma: no-cache);
I put that lot together from trial and error more than anything,
if it sucks then somebody please say something!
1 piece of advice when debugging stuff to do with sessions:
everytime you test whatever it is your doing close all you browser windows 
(kill the app)
first then open a new browser and then perform the actions you want to test.
and just to be absolutely sure first clear the browser cache.

maybe you are looking at cached pages in your browser?
if 'session_variable==yes' equates to true then you should send out
headers that tell the browser not to cache the output (or make it
private/force-revalidation)


Jochem Maas wrote:
eoghan wrote:
i think ive missed a few mails there...?
rory walsh wrote:
Cheers, I'll take a look, I had tried a search but thunderbird 
didn't find anything, even with the exact thread title I had to 
google it? Anyway I'll take a look.


my first google hit on search for the exact title gave me this:
http://www.issociate.de/board/post/171234/Clear_POST_variables_on_page_refresh.html 




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


[suspicious - maybe spam] Re: [PHP] php DBMS

2005-03-03 Thread Jochem Maas
...
sqlite isn't written by the php devs. It's simply included in the 
distributions; just like bcmath is.
SQLite itself is a free OS library, usable by pretty much everyone
my apologies - i was under the impression that some/few of the php devs
were also responsible for SQLite.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] mailserver logfile analyser

2005-03-03 Thread Richard Lynch
woldhekkie wrote:
 thanks verry much RICHARD,

 learning to program is hell for newbies.
 tried vb.net, autoit,purebasic,asp and more.
 Not one of them is perfect.
 It seems php is easyer learning than asp, so i will stick with php. Our
 mail/webserver does both.

 I deeply respect programmers. it would be nice if i could also think my
 programs.
 But i am just an administrator.
 One question:
 A php programmer like you can program anything, but do you ? Can you make
 money with it.
 Or is it just like everything else: verry difficult.

Like anything else, you can make money at it, with a ton of work.

The problem with most get rich quick schemes, is it's really the other guy
who gets rich quick. :-)

I personally make less money than I should because I don't do boring
projects or ones that I think the client will drive me crazy. [shrug]

Just not worth it to me.

I'd rather flip burgers at McDonald's than work with a client/project I hate.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Spam and this list

2005-03-03 Thread Richard Lynch
Jochem Maas wrote:
 AdamT wrote:
 On Tue, 01 Mar 2005 11:11:47 -0500, bob [EMAIL PROTECTED] wrote:
   
Well, this time it took just 11 days to get my first bit of spam from
this mailing list.

Folks, I think the OP set up a custom email before posting, and it took
only 11 days for it to get harvested and spam to pour in.

Frankly, I'm surprised it took that long.

Or maybe that's only the spam that got past existing filtering.

Perhaps a concerted effort to contact responsible administrators of
archive to get them to obfuscate email addresses is a Good Idea.

Dunno who's going to actually *DO* it, mind you...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Spam and this list

2005-03-03 Thread John Nichel
Richard Lynch wrote:
Jochem Maas wrote:
AdamT wrote:
On Tue, 01 Mar 2005 11:11:47 -0500, bob [EMAIL PROTECTED] wrote:
   
Well, this time it took just 11 days to get my first bit of spam from
this mailing list.

Folks, I think the OP set up a custom email before posting, and it took
only 11 days for it to get harvested and spam to pour in.
Frankly, I'm surprised it took that long.
Or maybe that's only the spam that got past existing filtering.
Perhaps a concerted effort to contact responsible administrators of
archive to get them to obfuscate email addresses is a Good Idea.
Dunno who's going to actually *DO* it, mind you...
That would be a lonnng list of admins.  This list (as well as 
most OS lists) seems to archived everywhere these days.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] DB INSERT CRON

2005-03-03 Thread Richard Lynch
Devraj Mukherjee wrote:
 Depending on the urgency of the data being transported into the database
 from the XML file, you could even run a server process that will wait
 for a new file to be added to a nominated directory and add the data to
 the database.

 As far as I know you could possibly use the PHP engine to that from the
 command line, command line invocation will not timeout as web scripts.
 Cron is a good idea if you dont mind the delay.

command line PHP will time out as well, but you can specify a custom
php.ini for it to reset the timeout to any value you like, including '0',
which means no time out at all.

I'd actually time/test it with sample data and then set the time-out to
metric time of the longest run.

metric time: double it and add 30

Allowing the user to just upload/input their data and then let cron handle
the slow stuff is DEFINITELY a Good Idea, in general.

There are a ton of background processes you can do to off-load slow things
from the user-interface.

Don't make people wait for the computer!  People time is expensive. 
Computer time is cheap.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] Preventing data from being reposted?

2005-03-03 Thread Chris W. Parker
Jochem Maas mailto:[EMAIL PROTECTED]
on Thursday, March 03, 2005 5:57 AM said:

 Gareth Williams wrote:
 
 Wouldn't using GET instead of POST help?
 
 in a way it could - but you don't usually want to use a GET as this
 can be easily spoofed (i.e. anyone could send you a link or post one
 in a forum that would do the post action without warning you)
 
 which comes down to: you should be 'certified' if you use GET to allow
 users to submit a payment confirmation - you only want a FORM to be
 able to submit such a confirmation rather than allowing any old link
 to issue such a confirmation

POST can be easily spoofed as well. I can recreate the form found on
your site on my own server and submit my data that way. I can also
submit POST by constructing my own headers in PHP (or just about any
other language for that matter). In both of those cases the data was
submitted in a way unexpected by the site author.

POST is not a security measure. I think what's special about POST is
that it is meant to hold a lot more data. With GET there is a limit to
how long the querystring can be.



Chris.

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



Re: [PHP] Preventing data from being reposted?

2005-03-03 Thread Richard Lynch
Jochem Maas wrote:
 Gareth Williams wrote:

 Wouldn't using GET instead of POST help?

 in a way it could - but you don't usually want to use a GET as this
 can be easily spoofed (i.e. anyone could send you a link or post one in a
 forum
 that would do the post action without warning you)

 which comes down to: you should be 'certified' if you use GET to allow
 users to submit a payment confirmation - you only want a FORM to be able
 to
 submit such a confirmation rather than allowing any old link to issue such
 a
 confirmation

 for a much better description on why using GET is 'bad' in this kind of
 situation
 I refer you to posts made by Richard Lynch (I think??) in the last 6 weeks
 (can't remember the
 subject Im afraid)

Gah!

I'm actually the one who said you should *NOT* fool yourself that POST is
any more secure than GET.

Only the dumbest of the dumb can't figure out how to save an HTML form and
modify it to POST whatever they want to your script.

Choosing POST over GET should be a matter of aesthetics, not security.

I have many scripts that will behave the same with GET or POST input.

Or, more correctly, would do the same thing if you were trying to spoof
them with GET/POST input.

The most common example is to view/edit a record in the database, I often
use a link with GET to get to the edit page, and that has a FORM (POST) to
the same page to update the record.

I'll use REQUEST all over, and if somebody manages to break in and wants
to use GET instead of POST to hack it, I don't see a hell of a lot of
difference.

If they're smart enough to get past the authentication, they're sure as
hell smart enough to do a forged POST.  [shrug]

GET is only easier to spoof that POST if you're comparing really really
really stupid people with really really stupid people...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Spam and this list

2005-03-03 Thread Jochem Maas
John Nichel wrote:
Richard Lynch wrote:
Jochem Maas wrote:
AdamT wrote:
On Tue, 01 Mar 2005 11:11:47 -0500, bob [EMAIL PROTECTED] wrote:

   
Well, this time it took just 11 days to get my first bit of spam from
this mailing list.

Folks, I think the OP set up a custom email before posting, and it took
only 11 days for it to get harvested and spam to pour in.
Frankly, I'm surprised it took that long.
Or maybe that's only the spam that got past existing filtering.
Perhaps a concerted effort to contact responsible administrators of
archive to get them to obfuscate email addresses is a Good Idea.
Dunno who's going to actually *DO* it, mind you...
That would be a lonnng list of admins.  This list (as well as 
most OS lists) seems to archived everywhere these days.

I'm willing to bet that half the servers that archive mailing lists are 
doing ao
for nefarious SEO reasons (it doesn't matter what the content is - as long as
they can wrap it in paid advertising)
- the upshot being they really don't give a  about spam harvesters.
...so you get half the admins being cool and obsfucating email addrs on pages
containing list archives and the email harvesters using the other halfs 
archives :-(
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] default mysql connection character-set

2005-03-03 Thread Richard Lynch
[EMAIL PROTECTED] wrote:
 is there a Runtime Configuration variable (php.ini) that defines default
 mysql connection character-set like my.cnf's default-character-set = in
 the [client] segment ?

 otherwise i have to execute mysql_query('SET CHARACTER SET latin5');
 everytime after connecting the database .

E.

Your mysql_connect should be in an include file anyway, so you should only
have this in ONE file in the first place...

I don't think there's a performance issue for SET CHARACTER SET ... is
there?

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Preventing data from being reposted?

2005-03-03 Thread Jochem Maas
Richard Lynch wrote:
Jochem Maas wrote:
Gareth Williams wrote:
Wouldn't using GET instead of POST help?
in a way it could - but you don't usually want to use a GET as this
can be easily spoofed (i.e. anyone could send you a link or post one in a
forum
that would do the post action without warning you)
which comes down to: you should be 'certified' if you use GET to allow
users to submit a payment confirmation - you only want a FORM to be able
to
submit such a confirmation rather than allowing any old link to issue such
a
confirmation
for a much better description on why using GET is 'bad' in this kind of
situation
I refer you to posts made by Richard Lynch (I think??) in the last 6 weeks
(can't remember the
subject Im afraid)

Gah!
I'm actually the one who said you should *NOT* fool yourself that POST is
any more secure than GET.
oops!
Only the dumbest of the dumb can't figure out how to save an HTML form and
modify it to POST whatever they want to your script.
Choosing POST over GET should be a matter of aesthetics, not security.
the point I was trying to make is that if you use POST then you know that 
the
user had to submit a form. the reason to use POST therefore is simply that
a _third_party_ cannot trick one of your users into clicking a link
that actually changes a
I have many scripts that will behave the same with GET or POST input.
Or, more correctly, would do the same thing if you were trying to spoof
them with GET/POST input.
The most common example is to view/edit a record in the database, I often
use a link with GET to get to the edit page, and that has a FORM (POST) to
the same page to update the record.
I'll use REQUEST all over, and if somebody manages to break in and wants
to use GET instead of POST to hack it, I don't see a hell of a lot of
difference.
If they're smart enough to get past the authentication, they're sure as
hell smart enough to do a forged POST.  [shrug]
you are right - actually I code pretty much the way you describe - but
I was meaning a situation where the user is not the hacker but that the hacker
is a third party trying to trick the user into performing an action
which is a lot easier to do with out alerting the user if the relevant action
can be triggered by a GET.
imagine a link:
a href=http://www.example.com?a=10pay=MrX;so payment/a
a href=http://www.example.com?a=1pay=MrHacker;read more/a
then image that as a FORM.
my point is that the link is alot easier to drop into someone (elses) site than
a form.
but yes you are right when it comes down to it. thanks for the catch.
remind me again why we acknowledge the difference between POST and GET in 2005?
GET is only easier to spoof that POST if you're comparing really really
really stupid people with really really stupid people...
so you have met parents

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


Re: [PHP] Simple XML

2005-03-03 Thread Richard Lynch
Uroš Gruber wrote:
   epp xmlns=urn:ietf:params:xml:ns:epp-1.0
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=urn:ietf:params:xml:ns:epp-1.0
 epp-1.0.xsd

 And then

  resData
domain:chkData xmlns:domain=urn:ietf:params:xml:ns:domain-1.0
 xsi:schemaLocation=urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd
  domain:cd
domain:name avail=1bar.com/domain:name
  /domain:cd
  domain:cd
domain:name avail=1foo.com/domain:name
  /domain:cd
/domain:chkData
  /resData

 But I cant get to this cd If I print_r complete response object it
 looks like it works, but then when I use
   resdata-chkData I got empty object.

I don't do XML, but some WILD GUESSES come to mind...

First, what's with the : in the tags?

I'm guessing that maybe you need to get to:
$resdata-domain:chkData
Except, of course, PHP doesn't allow a : in a member property name.

Maybe the : is some XML thing I just don't get, but maybe whomever wrote
your XML parser didn't get it either...

So what you've got is an object constructed with invalid properties that
you can't possibly access.

Maybe if you type-case that object to an array, and use:
$resData['domain:chkData']
you would get what you want...

If all else fails, scrap the fancy XML parser, and go with:

?php
  $xml = /* Load XML into a single long string */;
  $resDatas = explode('resData', $xml);
  while (list(, $resData) = each($resDatas)){
$chkDatas = explode('domain:chkData', $resData);
while (list(, $chkData) = each($resDatas)){
  $cds = explode('domain:cd', $chkData);
  while (list(, $cd) = each($cds)){
preg_match('domain:name
avail=([01])([a-zA-Z0-9\\.-]*)/domain:name', $cd, $cddata);
echo $cddata[2]: , ($cddata[1] ? 'available' : 'taken'), br
/\n;
  }
}
  }
?

It's crude, but it's not like the XML here is all that complicated anyway.

XML bigots are probably ready to turn their flame-throwers on me.  Oh well.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] How to handle a 64bit FILETIME?

2005-03-03 Thread Richard Lynch
Tom Cannaerts wrote:
 I'm processing a binary file, and in that file there is a 64bit FILETIME
 value. This value represents the number of 100-nanoseconds since 1/1/1601.

 I would like to convert it to a somewhat more usable value, since I
 eventually will need to display that value as a human readable date.

In addition to the BC_MATH package, there's some new-fangled extension to
PHP that does the same kind of stuff.

I'm not quite sure how you are going to get the 32 bytes into a string
suitable for sending *TO* either of those packages, however...

I'm guessing you'll have to read 32 bits, throw that into BC_MATH,
multiply by 0x, grab the next 32 bits, and add that in BC_MATH...

Then, you'll have to divide by 100-nanoseconds and/or subtract enough
seconds to get to whatever time format you want to use.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



RE: [PHP] Preventing data from being reposted?

2005-03-03 Thread Richard Lynch
 POST is not a security measure. I think what's special about POST is
 that it is meant to hold a lot more data. With GET there is a limit to
 how long the querystring can be.

POST also has a (larger) limit.

Actually, both *could* be limitless.

A server is require to have NO LESS THAN $x for its limit on GET.
A server is require to have NO LESS THAN $y for its limit on POST.

$y  $x but it has a (possible) limit.

Servers are recommended to have the limits as high as possible.

So, again, it boils down to this:
POST versus GET is an aesthetic choice, not Security, not Performance.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Re: Simple XML

2005-03-03 Thread Jason Barnett
?php

ini_set('html_errors', 0);

$xml = XML
?xml version=1.0?
epp xmlns=urn:ietf:params:xml:ns:epp-1.0
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=urn:ietf:params:xml:ns:epp-1.0.xsd 
  resData
domain:chkData xmlns:domain=urn:ietf:params:xml:ns:domain-1.0
xsi:schemaLocation=urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd
  domain:cd
domain:name avail=1bar.com/domain:name
  /domain:cd
  domain:cd
domain:name avail=1foo.com/domain:name
  /domain:cd
/domain:chkData
  /resData
/epp
XML;

$sxe = simplexml_load_string($xml);

/** Just try to match any cd node we can find */
var_dump($sxe-xpath('//cd'));

/** Now we go through all children manually */
$i = $j = $k = 0;
foreach ($sxe-children() as $resData) {
  var_dump($i++);
  foreach ($resData-children() as $chkData) {
var_dump($j++);
foreach ($chkData-children() as $cd) {
  var_dump($k++);
  var_dump($cd);
  var_dump($cd-I_dont_exist);
}
  }
}

/** OK great... now we try to find it through its namespace */
var_dump($sxe-xpath('//domain:cd'));

/** So what do we know?  Not much for certain without checking
out the source code, but libxml2 support for XML schemas is
incomplete.  We know that xmlXPathEval failed to evaluate the
namespace... and since this is a libxml2 function I would doubt
any PHP function would be able to interpret namespaces correctly...
or at least you have to register the namespace somehow...  */

?


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-generalw=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Read From COM1 port

2005-03-03 Thread Richard Lynch
Kim Madsen wrote:
 I'm having trouble reading from COM1, writing works like a charm but I'd
 like to be able to read the output from a switch or a router in order to
 determine that the command was successful and the configuration actually
 went fine :-)

 doing:

 $fp = fopen(COM1, rwb);

You might try this:

$input = fopen(COM1, rb);
$output = fopen(COM1, wb);

Use $output to write, and $input to read.

Another possibility would be to check the manual...

I don't thing 'rwb' is the correct way to fopen for read/write access.

'wb+' would be a better answer, I think.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Simple XML

2005-03-03 Thread Jochem Maas
Richard Lynch wrote:
Uro Gruber wrote:
 epp xmlns=urn:ietf:params:xml:ns:epp-1.0
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
   xsi:schemaLocation=urn:ietf:params:xml:ns:epp-1.0
   epp-1.0.xsd
And then
resData
  domain:chkData xmlns:domain=urn:ietf:params:xml:ns:domain-1.0
xsi:schemaLocation=urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd
domain:cd
  domain:name avail=1bar.com/domain:name
/domain:cd
domain:cd
  domain:name avail=1foo.com/domain:name
/domain:cd
  /domain:chkData
/resData
But I cant get to this cd If I print_r complete response object it
out of interest what does print_r() actually output? better yet what does
var_dump() actually output? (i.e. post the output please)
looks like it works, but then when I use
 resdata-chkData I got empty object.

I don't do XML, but some WILD GUESSES come to mind...
First, what's with the : in the tags?
that'll be designating namespaces.
although I never knew you could stipulate as namespace in
a tag that actually references/loads said namespace:
domain:chkData xmlns:domain=urn:ietf:params:xml:ns:domain-1.0
xsi:schemaLocation=urn:ietf:params:xml:ns:domain-1.0 
domain-1.0.xsd
BTW: I remember reading about problems with namespace when using simpleXML 
(actually I remember
reading that namespaces where not supported) - this information maybe 
completely wrong (or
just out of date), anyway check the php-internals archives for more info on that
I'm guessing that maybe you need to get to:
$resdata-domain:chkData
Except, of course, PHP doesn't allow a : in a member property name.
Maybe the : is some XML thing I just don't get, but maybe whomever wrote
your XML parser didn't get it either...
So what you've got is an object constructed with invalid properties that
you can't possibly access.
Maybe if you type-case that object to an array, and use:
$resData['domain:chkData']
you would get what you want...
If all else fails, scrap the fancy XML parser, and go with:
?php
  $xml = /* Load XML into a single long string */;
  $resDatas = explode('resData', $xml);
  while (list(, $resData) = each($resDatas)){
$chkDatas = explode('domain:chkData', $resData);
while (list(, $chkData) = each($resDatas)){
  $cds = explode('domain:cd', $chkData);
  while (list(, $cd) = each($cds)){
preg_match('domain:name
avail=([01])([a-zA-Z0-9\\.-]*)/domain:name', $cd, $cddata);
echo $cddata[2]: , ($cddata[1] ? 'available' : 'taken'), br
/\n;
  }
}
  }
?
It's crude, but it's not like the XML here is all that complicated anyway.
XML bigots are probably ready to turn their flame-throwers on me.  Oh well.
I'm all out of gas, oh hang on I don't even like XML that much :-) - with 
php4
I found XML a bit nightmarish, and all that namespace stuff can, well, really
screw up your day... I think Uro knows that already :-/

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


Re: [PHP] Weird WMV/Media Player behaviour (Loading media file twice)

2005-03-03 Thread Richard Lynch
Cabbar Duzayak wrote:
 My php file (used below) does nothing, but logs the requests+checks
 access, opens the actual .wmv file and prints it out. The problem when
 I use the following code is that, media player (for some reason) sends
 2 requests to the source (http://www.mydomain.com/aa/bb/cc.wmv) to
 show this instead of one, the first one reads something like 65K, then
 it sends the second request to retrieve the whole file... I checked it
 in various ways (verified that it is not because of .htaccess, my
 code!), but could not figure out why. And,  2 requests come within 1
 second difference (the server is on a local network).

Does it happen the same in a different browser?

Perhaps the *browser* snags the first 65K to see if it really *IS* a
MediaPlayer file, and then hands off the URL to Media Player or its plugin
or whatever, which gets the whole file to play it.

The media player itself may also have plugins for reading the beginning of
a .wmv file in order to display the artist, title, etc info as text, then
a different plugin to read the actual audio, which snags the whole file.

 Does anyone have any idea why this is happening and how I can avoid
 this double request?

I doubt you can avoid it at all...

It's also remotely possible that WMV files have embedded quality levels,
so the first 56K is a test to see what sort of connection speed is
available, and then Media Player decides to get the HiFi or LoFi (or
whatever) from the stream...  That would be a really dumb way to do things
(unlike Apple's RTSP protocol) but we *are* talking Microsoft, here, and
they do a *lot* of dumb things :-)

I sincerely doubt this last explanation has any basis in fact -- Only that
it *could* be true, given what little I know of WMV and MS...  Is WMV even
an open standard, or is it all hidden?

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Data Encryption

2005-03-03 Thread Richard Lynch
Erbacher Karl wrote:
 I'm not sure if this is even a PHP question, but I'm hoping someone can
 help
 me. I need to encipher data to be stored in a database and then I need to
 be
 able to decipher it to use it.  I was thinking of using DES and I obtained
 a
 pair of keys, but I'm not sure where to go from there. I've scoured the
 internet for help, but I just can't figure out which is the best way to do
 what I need to do.  If someone could please point me in the right
 direction
 I'd really appreciate it. Once data is sent in a form, how do I encipher
 it
 before saving it in the database and then how do I decipher it to be used
 later on?
 Also, not to sound helpless, but I'm pretty new to PHP and I don't quite
 have a handle on the jargon, so if it could be explained as simply as
 possible that would be helpful.

http://php.net/mhash might have what you need...

Not sure it supports DES though.

Where/how are you going to store/transmit/use the private half of the
key-pair?...

Seems like an awful lot of work to encrypt all this if your private key
isn't going to be super-protected...

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Document root, preferred way to find it???

2005-03-03 Thread Richard Lynch
Leif Gregory wrote:
 http://www.devtek.org/tutorials/dynamic_document_root.php

 I'm still looking for a better way, cause this is kludgy.

include_path

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] How to handle a 64bit FILETIME?

2005-03-03 Thread M. Sokolewicz
Richard Lynch wrote:
Tom Cannaerts wrote:
I'm processing a binary file, and in that file there is a 64bit FILETIME
value. This value represents the number of 100-nanoseconds since 1/1/1601.
I would like to convert it to a somewhat more usable value, since I
eventually will need to display that value as a human readable date.

In addition to the BC_MATH package, there's some new-fangled extension to
PHP that does the same kind of stuff.
I'm not quite sure how you are going to get the 32 bytes into a string
suitable for sending *TO* either of those packages, however...
I'm guessing you'll have to read 32 bits, throw that into BC_MATH,
multiply by 0x, grab the next 32 bits, and add that in BC_MATH...
Then, you'll have to divide by 100-nanoseconds and/or subtract enough
seconds to get to whatever time format you want to use.
or, since you won't be showing it in such precision, you could cut off a 
whole bunch from the end, and simply divide by a factor 
10^numbers_you_let_off less :)

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


[PHP] [noob] can't submit simple form, need help

2005-03-03 Thread p80
any idea why this simple peace of code is not working?

http://hashphp.org/pastebin?pid=1880

thanx in advance

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



[PHP] What is the 'cli' interface.

2005-03-03 Thread Daniel Guerrier
I am getting this error using ezpublish to import RSS
feeds.  Does anyone know what this means.

PHP is currently using the 'apache2handler' interface.
Make sure it is using the 'cli' interface.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



RE: [PHP] [noob] can't submit simple form, need help

2005-03-03 Thread Jay Blanchard
[snip]
any idea why this simple peace of code is not working?

// code that will be executed if the form has been submitted: 
$submit_post=$_REQUEST['submit']; 
 
if ($submit_post=='yes') 
[/snip]

Probably because $_REQUEST['submit'] !== 'yes'

print_r($_REQUEST); to see the array

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



RE: [PHP] [noob] can't submit simple form, need help

2005-03-03 Thread Warren Vail
 $submit_post=$_REQUEST['submit']; 
  
 if ($submit_post=='yes') { 
 
looks like the value in your form is not 'yes' but 'submit'


 pinput type=submit name=submit value=submit /  /p 

if this is not it, perhaps we should see more.

Warren Vail

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



Re: [PHP] [noob] can't submit simple form, need help

2005-03-03 Thread Jochem Maas
p80 wrote:
any idea why this simple peace of code is not working?
now lets see:
   1.  ?php
   2.  // code that will be executed if the form has been submitted:
   3.  $submit_post=$_REQUEST['submit'];
   4.
   5.  if ($submit_post=='yes') {
$submit_post  will never equal 'yes' because your submit buttons value is
'submit' and its name is also 'submit', the POST value is are overwriting
the GET value (thats default order for php anyway)
removing the name attribute of the submit button should do the trick.
   6.
   7.  // connect to the database
   8.  // (you may have to adjust the hostname,username or password)
   9.
  10.  include db.php;
  11.
  12.
  13.  $result=MYSQL_QUERY(INSERT INTO machines
  14.  (description_fr) .
  15.  VALUES ('$form_description_en'));
you might want to sanitize $form_description_en before sticking it in your
query like that. see http://php.net/mysql_escape_string
  16.  $bob = $img-image_name;
who is bob... why are you trying to get the property of
a non-existent object? php will have a fatal one on this.
  17.
  18.  #$thumbdata = addslashes(fread(fopen('.thumb/$bob', r)));
  19.
  20.
  21.
  22.
  23.  $id= mysql_insert_id();
  24.
  25.  print query success!;
  26.  echo $form_description_en;
the quotes around the var above are a waste of cpu.
the following will do:
echo $form_description_en;
  27.  MYSQL_CLOSE();
  28.
  29.  }
  30.
  31.
  32.  ?
  33.
  34.  form method=post action=test.php?submit=yes 
enctype=multipart/form-data /
  35.Description:br  /
  36.  textarea name=form_description_en  id=form_description_en rows=4 
cols=40/textareabr  /
  37.
  38.  pinput type=submit name=submit value=submit /  /p
  39.
  40.  /form
http://hashphp.org/pastebin?pid=1880
thanx in advance
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] What is the 'cli' interface.

2005-03-03 Thread Jay Blanchard
[snip]
Make sure it is using the 'cli' interface.
[/snip]

Command Line Interface

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



Re: [PHP] What is the 'cli' interface.

2005-03-03 Thread Jochem Maas
Daniel Guerrier wrote:
I am getting this error using ezpublish to import RSS
feeds.  Does anyone know what this means.
if you want to ask a new question then dont reply to an existing
post. post a new message.
PHP is currently using the 'apache2handler' interface.
Make sure it is using the 'cli' interface.
Command Line Interpreter. it a special 'kind' of php that built
specifically to be used on the cmdline (e.g. DOS on windows,
bash on linux, etc)
__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: [PHP] Re: Authentication fails - problem line found

2005-03-03 Thread John Swartzentruber
I stripped down my original script until it started receiving POST data, 
then I kept modifying it until I figured out where the problem was. I 
found it, but I'm still as clueless as every.

To summarize: I have a form that posts to the same script that contains 
the form. In its original state, when the script is called after I 
submit the form data, the $_POST[] data is completely empty and the 
_SERVER variable that indicates the type of data is set to GET.

In the script is the following code:
if (IsSet($_POST[action])) {
//$action = $_POST[action];
} else {
$action = $_GET[action];
}
Normally the second line is not commented. When I comment out that line, 
then the $_POST array has all of the data I would expect it to. When it 
is not commented, then it does not work.

Just to make sure that I am really confused, this bit of code is *after* 
the call to var_dump($_POST), but *before* the code that creates the form.

Does anyone have any ideas about why setting this variable has such a 
large and seemingly unrelated affect?

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


Re[2]: [PHP] Document root, preferred way to find it???

2005-03-03 Thread Tom Rogers
Hi,

Thursday, March 3, 2005, 11:54:48 AM, you wrote:

A If I'm reading you correctly, then a truly transportable include might look 
like
A this:

A $doc_root= (isset($_SERVER['path_translated'])?
A $_SERVER['path_translated'] : 
A  $_SERVER['document_root'];


Exactly

-- 
regards,
Tom

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



RE: [PHP] Preventing data from being reposted?

2005-03-03 Thread pmpa
Hi!
If I understand you correctly, I hope this helps:

?
// file.php

ob_start();
session_start();

If (!isset($_SESSION['login'])){
If ( !( isset($_POST['name'])  isset($_POST['password']) 
trim($_POST['name'])!=  trim($_POST['password'])!= ) ){
?
form method=post action=file.php
input type=text name=name
input type=password name=password
/form
?
}
else {
if (trim($_POST['name'])==yourname 
trim($_POST['password'])==yourpassword){
$_SESSION['login']=$_POST['name'];
Header(Location file.php);
}
else {
// wrong data.
Header(Location file.php);
}
}
}
else {
$name=$_SESSION['login'];
echo You are logged as .$name;
}
?

There are probably some errors I haven't run the code.
Pedro.

-Mensagem original-
De: rory walsh [mailto:[EMAIL PROTECTED] 
Enviada: quinta-feira, 3 de Março de 2005 12:01
Para: php-general@lists.php.net
Assunto: [PHP] Preventing data from being reposted?

Is there anyway I can prevent data from being reposted when I hit the 
back button on my browser? When I hit back I get a message from my 
browser asking do I want to repost the data, can I prevent this window 
from appearing?

-- 
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



RE: [PHP] Preventing data from being reposted?

2005-03-03 Thread pmpa
Sorry, Wrong Reply!!
My mistake :(

-

Hi!
If I understand you correctly, I hope this helps:

?
// file.php

ob_start();
session_start();

If (!isset($_SESSION['login'])){
If ( !( isset($_POST['name'])  isset($_POST['password']) 
trim($_POST['name'])!=  trim($_POST['password'])!= ) ){
?
form method=post action=file.php
input type=text name=name
input type=password name=password
/form
?
}
else {
if (trim($_POST['name'])==yourname 
trim($_POST['password'])==yourpassword){
$_SESSION['login']=$_POST['name'];
Header(Location file.php);
}
else {
// wrong data.
Header(Location file.php);
}
}
}
else {
$name=$_SESSION['login'];
echo You are logged as .$name;
}
?

There are probably some errors I haven't run the code.
Pedro.

-Mensagem original-
De: rory walsh [mailto:[EMAIL PROTECTED] 
Enviada: quinta-feira, 3 de Março de 2005 12:01
Para: php-general@lists.php.net
Assunto: [PHP] Preventing data from being reposted?

Is there anyway I can prevent data from being reposted when I hit the 
back button on my browser? When I hit back I get a message from my 
browser asking do I want to repost the data, can I prevent this window 
from appearing?

-- 
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



Re: [PHP] Document root, preferred way to find it???

2005-03-03 Thread Leif Gregory
Hello Richard,

Thursday, March 3, 2005, 1:15:38 PM, you wrote:
RL include_path

In the php.ini? But wouldn't that affect every virtual host on the
server? Meaning I'd have to put all the includes for every virtual
host in the same place?


Cheers,
Leif Gregory 

-- 
TB Lists Moderator (and fellow registered end-user)
PCWize Editor  /  ICQ 216395  /  PGP Key ID 0x7CD4926F
Web Site http://www.PCWize.com

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



[PHP] which class it is?

2005-03-03 Thread yangshiqi
I have a question that how to get the class name, which is initialized by
other class or function.

For example:

Class a

{

 Function a(){}

}

 

Class b

{

 Function b()

 {

  $a= new a;

  ...

 }

}

 

How can I get class b's name in a?

 

 

Best regards,

Yang Shiqi

 

 

 

 



[PHP] email attach and contain message together

2005-03-03 Thread agung
Hi all

I have the problem which I would like to send email with contain and
attachment ( excel file) together not just a part.
What should I do with the term please help

here the part of the code I use :

?php
$boundary = '-=' . md5( uniqid ( rand() ) );

$to =  $HTTP_POST_VARS['email']. ', ';
$to .=  $HTTP_POST_VARS['email2']. ', ';
$to .=  $HTTP_POST_VARS['email3']. ', ';
$to .=  $HTTP_POST_VARS['email4']. ', ';
$to .=  $HTTP_POST_VARS['email5'];
$subject = $HTTP_POST_VARS['subject'];
$message = $HTTP_POST_VARS['message'];

 $headers = MIME-Version: 1.0\r \n;
$headers .= Content-type: text/html; charset=iso-8859-1\r \n;
 $headers .= X-Priority: 3\r \n;
$headers .= X-MSMail-Priority: High\r \n;
$headers .= From: Batukaru Team [EMAIL PROTECTED]\r \n;
 $headers .= Bcc: [EMAIL PROTECTED];

 $headers .= Content-Type: application/xls\r \n;
 $headers .= Content-Transfer-Encoding: base64\n;
 $headers .= Content-Disposition: attachment; filename=test.xls\r \n;

$path = test.xls;
$fp = fopen($path, 'r');
do //we loop until there is no data left
{
   $data = fread($fp, 8192);
   if (strlen($data) == 0) break;
   $content .= $data;
 } while (true);
$content_encode = chunk_split(base64_encode($content));

$headers .= $content_encode . \n;
$headers .= -- . $boundary . \n;


regards.

agung

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



[PHP] upload and resize image script

2005-03-03 Thread p80
hey all
I'm looking for a simple script that would upload an image and resize it to 
thumbnail using a form to upload the picture. anyone has a good script for 
that?

thanx in advance

Pat

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



[PHP] Re: mysql problems

2005-03-03 Thread Jed R. Brubaker
Thank you both for your responces.

Unfotuantely there is no form that instantiates this action. So the double 
submit (while a good idea), is not possible.

As for some sample code, it is part of a rather complicated system that 
makes a number of changes but essentailly what is going on is this:

1. Grab all items that we need to do some shipping stuff to.
2. Foreach through the items, giving each item number to a function to 
assign it to a customer and create a mailling label.

That simple!

The interesting this is this - the duplicate record is inserted into the 
mailing labels queue. I can see it long before I grab the data for output to 
labels. Moreover, I can tell that the problem isn't in the original item 
select statement because the function (executed for each item) would have 
created different insert times in the database based on the now( ).

More ideas?

Thanks!


Jed R. Brubaker [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Hi all -

 I could use a lead on a problem. I just don't know where to start.

 I have a PHP script that populates a database table. No big deal. It 
 creates mailing labels. However, a weird things keeps happening - every 
 once in a while, a query is run twice. It is the same query, same 
 information, even the same time (there is a now() in the query - and it is 
 identical).

 So the question is a simple one - is this a PHP problem or a MySQL 
 problem? Or somewhere in the MySQL extension? And how would I know?

 There is one clue to this otherwise vague problem. I believe that this 
 predominantly happens when the database is under an above average load.

 I would appreciate any help that I might be able to get.

 Thank you. 

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