[PHP] Re: splitting CSV rows into multiple SQL inserts?

2005-06-22 Thread Sergey
You can insert file data in DB first, using LOAD DATA INTO FILE, after it'll 
be easy to manipulate this DB table with a help of php-script.

"Vince LaMonica" <[EMAIL PROTECTED]> ???/ ?  ?: 
news:[EMAIL PROTECTED]
>I sent this note off to the php-db list last night, but the more I thought 
>about it, the more I figured this was a general looping question rather 
>than a mysql-specific one.
>
> I am attempting to take a CSV file that has order header and line item 
> data on each line and split it into mulitple insert queries into a mysql 
> db. Each line in the CSV file may only be one order, though it is common 
> for there to be more than one item ordered, so I need to be able to loop 
> to insert the line item values into the proper line item table. I also 
> need to build a counter for a value that is not provided in the CVS for 
> each line item.
>
> Here is a sample of a few lines of the CSV:
>
> 1110,6/20/2005,Jan Doe,1234 Spring 
> St.,Anytown,PA,17033,0618456990,22.50,1,The Sample Book
> 1114,6/22/2005,Jon Smith,888 Main St.,Big 
> City,CA,92648,009444,19.95,1,Coloring Book
> 1114,6/22/2005,Jon Smith,888 Main St.,Big 
> City,CA,92648,9834119933,4.40,1,Picture Book
> 1114,6/22/2005,Jon Smith,888 Main St.,Big 
> City,CA,92648,948922,59.99,4,Coffee Book
>
> In the above file, the last 4 fields [item_num, cost, quantity, title] 
> belong in a line_items table. The first number, the order_number, also 
> goes into the line_items table, as well as the order_header table. The 
> contact info for each customer also goes into the order_header table. I do 
> not want duplicate entries in the order_header table, so I can't just to a 
> simple loop through each line in the text file and do an insert. I need to 
> be able to group an order by the order_number [the 1st field] and insert 
> the correct number of rows in both tables. I also need to create a counter 
> per order showing which line item number each item is. Eg: the Coloring 
> Book would be assigned a 1, the Picture book a 2, and the Coffee Book a 3 
> for order #1114. The Sample Book in order #1110 would be given a 1, since 
> it is the first [and only] item in that order.
>
> I have been successful in assigning each value to a varable and looping 
> through the file via:
>
> while ($line = fgets($fp,1024))
>  {
>   $i++;
>   if ($i > 1) { // using 1 because CSV includes a header row
>  list($order_number, ...) = csv_explode($line);
>
> [i am using an Excel generated CSV with double quotes around each value 
> and so i have a csv_explode function setup to properly extract each value; 
> also the real CSV has about 2 dozen fields - i just cut it down to its 
> basics for the example here]
>
> Doing 2 inserts here and closing the loop is obviously not the answer, 
> since I get duplicate header rows, and I haven't built a counter for the 
> line_item's table's line counter field. The primary key in the line item 
> table is a combo of the order_number and the line_counter. Each fresh 
> order_number needs to reset the line_counter to 1, until all line items 
> for that order are inserted.
>
> I am having difficulty figuring out how to loop through the CSV to do the 
> inserts and create a line item counter. Any tips?
>
> TIA,
>
> /vjl/ 

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



Re: [PHP] Re: splitting CSV rows into multiple SQL inserts?

2005-06-22 Thread Vince LaMonica
On Wed, 22 Jun 2005, Sergey wrote:

} You can insert file data in DB first, using LOAD DATA INTO FILE, after it'll 
} be easy to manipulate this DB table with a help of php-script.

Actually, I can't, as the CSV contains fields for two different tables. I 
may have explained it better here:

I have a CVS file that has order header *and* line item info on each line, 
like:

1110,6/20/2005,Jan Doe,123 Main St,,1,Book
1116,6/22/2005,Jim Smith,44 Here St,19191980,1,CD
1116,6/22/2005,Jim Smith,44 Here St,77736222,1,Tape

The above is actually two orders - one with one line item, and the 2nd 
with two line items. I need to insert data from those lines into two 
tables:

insert into order_header (o_num, date, name, addr)
values ('1110','6/20/2005','Jan Doe','123 Main St'),
   ('1116','6/22/2005','Jim Smith','44 Here St');

insert into line_items (o_num, item_num, quan, desc, line_order)
values ('1110','','1','Book','1'),
   ('1116','19191980','1','CD','1'),
   ('1116','77736222','1','Tape','2');

Note the line_order field - it needs to increment per order for each line 
item added to the line_items table. To complicate matters a bit, I'm 
actually massaging the data before inserting [eg: splitting the name field 
from the CSV into two fields for the mysql db, formatting the date field 
for mysql, etc].

I'm currently doing this process via a form where a user uploads the CVS 
file [created with Excel, complete with the first row being made up the 
Excel table's header]. 

I currently do something like this:

$fp = fopen("/tmp/"."$txt_file", "r");
 while ($line = fgets($fp,1024))
  {
  $i++
  if ($i > 1) { // skip excel header row
list ($o_num, $date, $name, $addr, $item_num, $quan, $desc) = 
csv_explode($line);
// i can now print the vars, but i get duplicate header records when
// there are multiple line items for a particular order. also, i 
// need to generate the line_order field for insertion into the 
// line_items table
}
  }

If I try and do any processing up where my comments are, well, the 
comments tell you what happen. I know I am reading this file line by line, 
so I can't compare order numbers [o_num] to group multiple line item 
orders together. So how do I go about doing that? Read the entire CSV into 
an array? How can that help? Any tips would be most appreciated!

Thanks!

/vjl/

p/s - FYI, cvs_explode() is:

function csv_explode($str, $delim = ',', $qual = "\"") 
{ 
$len = strlen($str); 
$inside = false; 
$word = ''; 
for ($i = 0; $i < $len; ++$i) { 
if ($str[$i]==$delim && !$inside) { 
$out[] = $word; 
$word = ''; 
} else if ($inside && $str[$i]==$qual && ($i<$len && 
$str[$i+1]==$qual)) { 
$word .= $qual; 
++$i; 
} else if ($str[$i] == $qual) { 
$inside = !$inside; 
} else { 
$word .= $str[$i]; 
} 
} 
$out[] = $word; 
return $out; 
} 

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



[PHP] Extra (persistant) tier

2005-06-22 Thread Evert | Rooftop

Hi,

I'm writing a big web application, and trying really hard to seperate 
business logic and presentation, which been no problem up to now.
Because I abstracted the business logic so much the framework became 
heavier, sometimes a simple action can take up to 2 mb memory and 
several extra milliseconds.


I know this doesn't sound much and I'm applying all kinds of technique's 
to reduce resource-usage and increase speed. The thing is, I feel like I 
need to split the business tier up in 2 tiers, one of them being my 
persisitant object manager. The main reason is because every script that 
is executed must do some initialization and database calls, and I think 
I could reduce this by making a persistant tier, but there doesn't seem 
a good way to do this using php except when I would use sockets.


Shared memory doesn't really seem like an option, because I would still 
need to include all the classes to manage it, and when I use shared 
memory, the memory would still be copied into the php memory + having a 
central manager seems like a good idea.


I know I'm pretty vague in my requirements, but I think it should be 
enough to explain what kind of solution I´m looking for, because this 
seems like a big advantage of java over php, or am I mistaken?

If you have any ideas, let me know :)

grt,
Evert
Collab

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



RE: [PHP] Re: So many returned mail notices!

2005-06-22 Thread Kim Madsen
> -Original Message-
> From: Jochem Maas [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 21, 2005 8:13 PM


> 
> "you're" not "your", but it's understandable coming from someone
> named after a car license plate number.

In denmark it costs around 1000€ to get a license plate with Your own name on 
it. On the other hand it´s free to change Your name so, if You wanna have a 
license plate with You name on it... actually he´s quite smart :-)
 
> if there was a 'pointy' scale with spoons at one end and samurai swords at
> the other you're point would weigh in at the spoon end.
> 

I sense Monkey Island humor here?

/Kim


[PHP] eml splitting

2005-06-22 Thread david forums


Hi

Do you are or know where I could find something (already made) to split  
eml (getting headers, body)


I try to have a look on imap extension, but it seems to need an smtp  
server connection.


regards

david

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



Re: [PHP] variable object creating

2005-06-22 Thread olivier
Hi,

Try something like:

$classname = "MyClass";
$construct_params = array("param1","param2","param3");

$return =null;
if(class_exists($classname)){
  $param=explode(" ',' ", $construct_param);  
# You must add here some security checks
  eval("$retrun = new $className($param)");
  var_dump($return);
}

Hope this help!
Olivier

Le Mercredi 22 Juin 2005 05:33, Eli a écrit :
> Hi,
>
> I want to create an object in a form that I get the class name and its
> parameters, and I need to create that object...
> How can this been done?
>
> i.e:
> $classname = "MyClass";
> $construct_params = array("param1","param2","param3");
> /* Now create the object with the given classname and params... how? */
>
> -thanks, Eli

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



Re: [PHP] Re: So many returned mail notices!

2005-06-22 Thread Jochem Maas

Kim Madsen wrote:

-Original Message-
From: Jochem Maas [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 21, 2005 8:13 PM






"you're" not "your", but it's understandable coming from someone
named after a car license plate number.



In denmark it costs around 1000€ to get a license plate with Your own name on 
it. On the other hand it´s free to change Your name so, if You wanna have a 
license plate with You name on it... actually he´s quite smart :-)


thats funny :-). I'd laugh but apparently I owe everyone a beer ;-)

 


if there was a 'pointy' scale with spoons at one end and samurai swords at
the other you're point would weigh in at the spoon end.




I sense Monkey Island humor here?


there is a typewriter gag in there somewhere :-)



/Kim


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



RE: [PHP] eml splitting

2005-06-22 Thread Kim Madsen
> -Original Message-
> From: david forums [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 22, 2005 10:48 AM

> Do you are or know where I could find something (already made) to
split
> eml (getting headers, body)

Use fopen() to read the file line by line, then echo/save the info You
need

--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/Systemdeveloper

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



Re: [PHP] variable object creating

2005-06-22 Thread Jochem Maas

olivier wrote:

Hi,



I answered this also, but apparently I only replied to the OP...
(reproduced here - minus the typos in my first post on this topic :-/)

if (class_exists($className, false)) {
$obj = new $className($construct_params);
} else {
die("Hack off mate.");
}


Try something like:

$classname = "MyClass";
$construct_params = array("param1","param2","param3");

$return =null;
if(class_exists($classname)){
  $param=explode(" ',' ", $construct_param);  


this should be join() not explode(), but even then it won't work,
and even if it did you would only be able to pass strings (i.e. no objects,
arrays, resources, etc)

for this you should probably be looking at call_user_func_array() e.g:

class Test
{
public $v;
function __construct($v = 1) { $this->v = $v; }
}

$className = "Test";

if (class_exists($className, false)) {
// I had to test this to see if it works! the first 2 attempts are bogus
// but you can run them to see what happens -- also the 3 attempt is a 
pretty
// weird construction and I would be interested to know if anybody has 
thoughts
// on calling the ctor in this way (essentially calling it twice)
//
// ATTEMPT 1
//$obj = call_user_func_array(array($className,"__construct"), array(3));
// ATTEMPT 2
//$obj = call_user_func_array(array(new $className,"__construct"), 
array(3));
// ATTEMPT 3
call_user_func_array(array(($obj = new $className),"__construct"), 
array(3));

} else {
die("Hack off mate.");
}

var_dump($obj);




# You must add here some security checks
  eval("$retrun = new $className($param)");


typo! 'retrun' (I spell 'return' like that alot too :-)

btw eval() sucks and is not really needed, although granted it's an 
easy/flexible
solution in terms on being able to pass args to the ctor (constructor), my 
thought
would be that the classes you wish to init this way should have a specific 
interface/design
with regard to accepting ctor args. A very simple example:

class Test
{
function __construct($args = array())
{
extract((array) $args);
}
}


  var_dump($return);
}

Hope this help!
Olivier

Le Mercredi 22 Juin 2005 05:33, Eli a écrit :


Hi,

I want to create an object in a form that I get the class name and its
parameters, and I need to create that object...


oh and don't blindly accept whatever is sent by the form - sanitize the
class name and args before you use them! best general resource for this kind
[php-]thing is (IMHO) http://phpsec.org/ [ "Shifting Expectations" ;-) ]


How can this been done?

i.e:
$classname = "MyClass";
$construct_params = array("param1","param2","param3");
/* Now create the object with the given classname and params... how? */

-thanks, Eli





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



[PHP] Returned mail: see transcript for details

2005-06-22 Thread Post Office
ALERT!

This e-mail, in its original form, contained one or more attached files that 
were infected with a virus, worm, or other type of security threat. This e-mail 
was sent from a Road Runner IP address. As part of our continuing initiative to 
stop the spread of malicious viruses, Road Runner scans all outbound e-mail 
attachments. If a virus, worm, or other security threat is found, Road Runner 
cleans or deletes the infected attachments as necessary, but continues to send 
the original message content to the recipient. Further information on this 
initiative can be found at http://help.rr.com/faqs/e_mgsp.html.
Please be advised that Road Runner does not contact the original sender of the 
e-mail as part of the scanning process. Road Runner recommends that if the 
sender is known to you, you contact them directly and advise them of their 
issue. If you do not know the sender, we advise you to forward this message in 
its entirety (including full headers) to the Road Runner Abuse Department, at 
[EMAIL PROTECTED]

Dear user php-general@lists.php.net,

Your account was used to send a huge amount of unsolicited commercial e-mail 
during the last week.
Probably, your computer was compromised and now runs a trojaned proxy server.

Please follow the instructions in order to keep your computer safe.

Have a nice day,
The lists.php.net support team.

file attachment: jmeryg.zip

This e-mail in its original form contained one or more attached files that were 
infected with the [EMAIL PROTECTED] virus or worm. They have been removed.
For more information on Road Runner's virus filtering initiative, visit our 
Help & Member Services pages at http://help.rr.com, or the virus filtering 
information page directly at http://help.rr.com/faqs/e_mgsp.html. 
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Re: splitting CSV rows into multiple SQL inserts?

2005-06-22 Thread Ben Duffy
I would read in the CSV file, and populate  two arrays, using the
ordernumber as a key in the header array, loop through the header array
containg $o_num, $date, $name, $addr, to do the db inserts.
The details table would be an array of arrays, key would be ordernumber
again, then the sub array would be the line number. You can set to 1, then
increment until you detect a new ordernumber The contents of the detail sub
array contains  $item_num, $quan, $desc. Loop through this this array to
produce your details table inserts.

Ben.



"Vince LaMonica" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Wed, 22 Jun 2005, Sergey wrote:
>
> } You can insert file data in DB first, using LOAD DATA INTO FILE, after
it'll
> } be easy to manipulate this DB table with a help of php-script.
>
> Actually, I can't, as the CSV contains fields for two different tables. I
> may have explained it better here:
>
> I have a CVS file that has order header *and* line item info on each line,
> like:
>
> 1110,6/20/2005,Jan Doe,123 Main St,,1,Book
> 1116,6/22/2005,Jim Smith,44 Here St,19191980,1,CD
> 1116,6/22/2005,Jim Smith,44 Here St,77736222,1,Tape
>
> The above is actually two orders - one with one line item, and the 2nd
> with two line items. I need to insert data from those lines into two
> tables:
>
> insert into order_header (o_num, date, name, addr)
> values ('1110','6/20/2005','Jan Doe','123 Main St'),
>('1116','6/22/2005','Jim Smith','44 Here St');
>
> insert into line_items (o_num, item_num, quan, desc, line_order)
> values ('1110','','1','Book','1'),
>('1116','19191980','1','CD','1'),
>('1116','77736222','1','Tape','2');
>
> Note the line_order field - it needs to increment per order for each line
> item added to the line_items table. To complicate matters a bit, I'm
> actually massaging the data before inserting [eg: splitting the name field
> from the CSV into two fields for the mysql db, formatting the date field
> for mysql, etc].
>
> I'm currently doing this process via a form where a user uploads the CVS
> file [created with Excel, complete with the first row being made up the
> Excel table's header].
>
> I currently do something like this:
>
> $fp = fopen("/tmp/"."$txt_file", "r");
>  while ($line = fgets($fp,1024))
>   {
>   $i++
>   if ($i > 1) { // skip excel header row
> list ($o_num, $date, $name, $addr, $item_num, $quan, $desc) =
csv_explode($line);
> // i can now print the vars, but i get duplicate header records when
> // there are multiple line items for a particular order. also, i
> // need to generate the line_order field for insertion into the
> // line_items table
> }
>   }
>
> If I try and do any processing up where my comments are, well, the
> comments tell you what happen. I know I am reading this file line by line,
> so I can't compare order numbers [o_num] to group multiple line item
> orders together. So how do I go about doing that? Read the entire CSV into
> an array? How can that help? Any tips would be most appreciated!
>
> Thanks!
>
> /vjl/
>
> p/s - FYI, cvs_explode() is:
>
> function csv_explode($str, $delim = ',', $qual = "\"")
> {
> $len = strlen($str);
> $inside = false;
> $word = '';
> for ($i = 0; $i < $len; ++$i) {
> if ($str[$i]==$delim && !$inside) {
> $out[] = $word;
> $word = '';
> } else if ($inside && $str[$i]==$qual && ($i<$len
&& $str[$i+1]==$qual)) {
> $word .= $qual;
> ++$i;
> } else if ($str[$i] == $qual) {
> $inside = !$inside;
> } else {
> $word .= $str[$i];
> }
> }
> $out[] = $word;
> return $out;
> }

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



Re: [PHP] Re: splitting CSV rows into multiple SQL inserts?

2005-06-22 Thread Vince LaMonica
On Wed, 22 Jun 2005, Ben Duffy wrote:

} I would read in the CSV file, and populate  two arrays, using the
} ordernumber as a key in the header array, loop through the header array
} containg $o_num, $date, $name, $addr, to do the db inserts.

Ok, I think I get this, though I am confused about doing the inserts - I 
don't want duplicate rows to be inserted into the header table. Eg:

 1116,6/22/2005,Jim Smith,44 Here St,19191980,1,CD
 1116,6/22/2005,Jim Smith,44 Here St,77736222,1,Tape

The two rows from the CSV above produce the same row data for the header 
table:

 '1116','6/22/2005','Jim Smith','44 Here St'
 '1116','6/22/2005','Jim Smith','44 Here St'

How do I make sure that only one row is inserted? How do I detect the same 
$o_num when building the header array?

/vjl/
  

} The details table would be an array of arrays, key would be ordernumber
} again, then the sub array would be the line number. You can set to 1, then
} increment until you detect a new ordernumber The contents of the detail sub
} array contains  $item_num, $quan, $desc. Loop through this this array to
} produce your details table inserts.
} 
} Ben.
} 
} 
} 
} "Vince LaMonica" <[EMAIL PROTECTED]> wrote in message
} news:[EMAIL PROTECTED]
} > On Wed, 22 Jun 2005, Sergey wrote:
} >
} > } You can insert file data in DB first, using LOAD DATA INTO FILE, after
} it'll
} > } be easy to manipulate this DB table with a help of php-script.
} >
} > Actually, I can't, as the CSV contains fields for two different tables. I
} > may have explained it better here:
} >
} > I have a CVS file that has order header *and* line item info on each line,
} > like:
} >
} > 1110,6/20/2005,Jan Doe,123 Main St,,1,Book
} > 1116,6/22/2005,Jim Smith,44 Here St,19191980,1,CD
} > 1116,6/22/2005,Jim Smith,44 Here St,77736222,1,Tape
} >
} > The above is actually two orders - one with one line item, and the 2nd
} > with two line items. I need to insert data from those lines into two
} > tables:
} >
} > insert into order_header (o_num, date, name, addr)
} > values ('1110','6/20/2005','Jan Doe','123 Main St'),
} >('1116','6/22/2005','Jim Smith','44 Here St');
} >
} > insert into line_items (o_num, item_num, quan, desc, line_order)
} > values ('1110','','1','Book','1'),
} >('1116','19191980','1','CD','1'),
} >('1116','77736222','1','Tape','2');
} >
} > Note the line_order field - it needs to increment per order for each line
} > item added to the line_items table. To complicate matters a bit, I'm
} > actually massaging the data before inserting [eg: splitting the name field
} > from the CSV into two fields for the mysql db, formatting the date field
} > for mysql, etc].
} >
} > I'm currently doing this process via a form where a user uploads the CVS
} > file [created with Excel, complete with the first row being made up the
} > Excel table's header].
} >
} > I currently do something like this:
} >
} > $fp = fopen("/tmp/"."$txt_file", "r");
} >  while ($line = fgets($fp,1024))
} >   {
} >   $i++
} >   if ($i > 1) { // skip excel header row
} > list ($o_num, $date, $name, $addr, $item_num, $quan, $desc) =
} csv_explode($line);
} > // i can now print the vars, but i get duplicate header records when
} > // there are multiple line items for a particular order. also, i
} > // need to generate the line_order field for insertion into the
} > // line_items table
} > }
} >   }
} >
} > If I try and do any processing up where my comments are, well, the
} > comments tell you what happen. I know I am reading this file line by line,
} > so I can't compare order numbers [o_num] to group multiple line item
} > orders together. So how do I go about doing that? Read the entire CSV into
} > an array? How can that help? Any tips would be most appreciated!
} >
} > Thanks!
} >
} > /vjl/
} >
} > p/s - FYI, cvs_explode() is:
} >
} > function csv_explode($str, $delim = ',', $qual = "\"")
} > {
} > $len = strlen($str);
} > $inside = false;
} > $word = '';
} > for ($i = 0; $i < $len; ++$i) {
} > if ($str[$i]==$delim && !$inside) {
} > $out[] = $word;
} > $word = '';
} > } else if ($inside && $str[$i]==$qual && ($i<$len
} && $str[$i+1]==$qual)) {
} > $word .= $qual;
} > ++$i;
} > } else if ($str[$i] == $qual) {
} > $inside = !$inside;
} > } else {
} > $word .= $str[$i];
} > }
} > }
} > $out[] = $word;
} > return $out;
} > }
} 
} 

-- 
Vince J. LaMonica   Knowledge is knowing a street is one way.
[EMAIL PROTECTED]  <*>  Wisdom is still looking in both directions.

  When there's nothing else to read: http://w3log.vjl.org/

-- 
PHP General Mailing List (http://www.ph

[PHP] How to convert documents to PDF using PHP

2005-06-22 Thread Bosky, Dave
I need to find a way to allow users to select multiple files from a list
and generate a single PDF file from them.

The documents are limited to the following formats: MS Word, MS
PowerPoint, MS Excel, Plain Text, gif/jpeg images.

 

Are there any PHP classes or modules that exist which can tackle this
tough task?

 

Thanks,

Dave

 



HTC Disclaimer:  The information contained in this message may be privileged 
and confidential and protected from disclosure. If the reader of this message 
is not the intended recipient, or an employee or agent responsible for 
delivering this message to the intended recipient, you are hereby notified that 
any dissemination, distribution or copying of this communication is strictly 
prohibited.  If you have received this communication in error, please notify us 
immediately by replying to the message and deleting it from your computer.  
Thank you.


Re: [PHP] variable object creating

2005-06-22 Thread olivier
Sorry for typo error, just need my cup of cofee...

Here is a good post for:
http://fr.php.net/manual/fr/function.call-user-func-array.php


from taylor
08-May-2005 12:04

#

I dont like eval too but i think that is depending on the pb we want to 
solve... if you can change contrutor from each object may be better to use 
jockem solution that is more secure (added some change for php4). 

#
class Test
{
   var $v;
   // constructor for php4
   function Test($args){
   $this->__construct($args);
   }
   // constructor for php5   
   function __construct($args = array())
   {
   extract((array) $args);
   $this->v=$v;
   }
}

$className = "Test";
$construct_params = array("v"=>"param1","param2","param3");

//if (class_exists($className, false)) { ---> for php5
if (class_exists($className)) { // for php4
$obj = new $className($construct_params);
} else {
die("Hack off mate.");
}

var_dump($obj);
##

>  // I had to test this to see if it works! the first 2 attempts are
> bogus // but you can run them to see what happens -- also the 3 attempt is
> a pretty // weird construction and I would be interested to know if anybody
> has thoughts // on calling the ctor in this way (essentially calling it
> twice) //

Never see a such solution, but may use a register funct instead...

##
class Test
{
   var $v;

   function Register($objName, $v=1){
  # auto register object if needed
  if(!isset($GLOBALS[$objName])){
 $GLOBALS[$objName]=true;
 $GLOBALS[$objName]=new Test($v);
   }else{
return $GLOBALS[$objName];
   }
   }
   
   function Test($v){
   $this->__construct($v);
   }
   
   function __construct($v)
   {
   $this->v=$v;
   }
}

$className = "Test";
$construct_params = array("obj", "param1","param2","param3");
//if (class_exists($className, false)) { ---> for php5
if (class_exists($className)) { // for php4
   call_user_func_array(array(($className), "Register"), $construct_params);
} else {
die("Hack off mate.");
}

var_dump($obj);
##

Love phpsec too ;-)
Hope this finaly help!
Olivier

Le Mercredi 22 Juin 2005 11:38, Jochem Maas a écrit :
> olivier wrote:
> > Hi,
>
> I answered this also, but apparently I only replied to the OP...
> (reproduced here - minus the typos in my first post on this topic :-/)
>
> if (class_exists($className, false)) {
>  $obj = new $className($construct_params);
> } else {
>  die("Hack off mate.");
> }
>
> > Try something like:
> >
> > $classname = "MyClass";
> > $construct_params = array("param1","param2","param3");
> >
> > $return =null;
> > if(class_exists($classname)){
> >   $param=explode(" ',' ", $construct_param);
>
> this should be join() not explode(), but even then it won't work,
> and even if it did you would only be able to pass strings (i.e. no objects,
> arrays, resources, etc)
>
> for this you should probably be looking at call_user_func_array() e.g:
>
> class Test
> {
>   public $v;
>   function __construct($v = 1) { $this->v = $v; }
> }
>
> $className = "Test";
>
> if (class_exists($className, false)) {
>  // I had to test this to see if it works! the first 2 attempts are
> bogus // but you can run them to see what happens -- also the 3 attempt is
> a pretty // weird construction and I would be interested to know if anybody
> has thoughts // on calling the ctor in this way (essentially calling it
> twice) //
>  // ATTEMPT 1
>  //$obj = call_user_func_array(array($className,"__construct"),
> array(3)); // ATTEMPT 2
>  //$obj = call_user_func_array(array(new $className,"__construct"),
> array(3)); // ATTEMPT 3
>  call_user_func_array(array(($obj = new $className),"__construct"),
> array(3));
>
> } else {
>  die("Hack off mate.");
> }
>
> var_dump($obj);
>
> > # You must add here some security checks
> >   eval("$retrun = new $className($param)");
>
> typo! 'retrun' (I spell 'return' like that alot too :-)
>
> btw eval() sucks and is not really needed, although granted it's an
> easy/flexible solution in terms on being able to pass args to the ctor
> (constructor), my thought would be that the classes you wish to init this
> way should have a specific interface/design with regard to accepting ctor
> args. A very simple example:
>
> class Test
> {
>   function __construct($args = array())
>   {
>   extract((array) $args);
>   }
> }
>
> >   var_dump($return);
> > }
> >
> > Hope this help!
> > Olivier
> >
> > Le Mercredi 22 Juin 2005 05:33, Eli a écrit :
> >>Hi,
> >>
> >>I want to create an object in a form that I get the class name and its
> 

Re: [PHP] variable object creating

2005-06-22 Thread olivier


--  Message transmis  --

Subject: Re: [PHP] variable object creating
Date: Mercredi 22 Juin 2005 14:19
From: olivier <[EMAIL PROTECTED]>
To: php-general@lists.php.net

Sorry for typo error, just need my cup of cofee...

Here is a good post for:
http://fr.php.net/manual/fr/function.call-user-func-array.php


from taylor
08-May-2005 12:04

#

I dont like eval too but i think that is depending on the pb we want to
solve... if you can change contrutor from each object may be better to use
jockem solution that is more secure (added some change for php4).

#
class Test
{
   var $v;
   // constructor for php4
   function Test($args){
   $this->__construct($args);
   }
   // constructor for php5
   function __construct($args = array())
   {
   extract((array) $args);
   $this->v=$v;
   }
}

$className = "Test";
$construct_params = array("v"=>"param1","param2","param3");

//if (class_exists($className, false)) { ---> for php5
if (class_exists($className)) { // for php4
$obj = new $className($construct_params);
} else {
die("Hack off mate.");
}

var_dump($obj);
##

>  // I had to test this to see if it works! the first 2 attempts are
> bogus // but you can run them to see what happens -- also the 3 attempt is
> a pretty // weird construction and I would be interested to know if anybody
> has thoughts // on calling the ctor in this way (essentially calling it
> twice) //

Never see a such solution, but may use a register funct instead...

##
class Test
{
   var $v;

   function Register($objName, $v=1){
  # auto register object if needed
  if(!isset($GLOBALS[$objName])){
 $GLOBALS[$objName]=true;
 $GLOBALS[$objName]=new Test($v);
   }else{
return $GLOBALS[$objName];
   }
   }

   function Test($v){
   $this->__construct($v);
   }

   function __construct($v)
   {
   $this->v=$v;
   }
}

$className = "Test";
$construct_params = array("obj", "param1","param2","param3");
//if (class_exists($className, false)) { ---> for php5
if (class_exists($className)) { // for php4
   call_user_func_array(array(($className), "Register"), $construct_params);
} else {
die("Hack off mate.");
}

var_dump($obj);
##

Love phpsec too ;-)
Hope this finaly help!
Olivier

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



Re: [PHP] variable object creating

2005-06-22 Thread olivier
Sorry for typo error, just need my cup of cofee...

Here is a good post for:
http://fr.php.net/manual/fr/function.call-user-func-array.php
-> see:
from taylor
08-May-2005 12:04
-> using eval.
I dont like eval too but i think that is depending on the pb we want to
solve... if you can change contrutor from each object may be better to use
jockem solution that is more secure (added some change for php4).

-
class Test
{
   var $v;
   // constructor for php4
   function Test($args){
   $this->__construct($args);
   }
   // constructor for php5
   function __construct($args = array())
   {
   extract((array) $args);
   $this->v=$v;
   }
}

$className = "Test";
$construct_params = array("v"=>"param1","param2","param3");

//if (class_exists($className, false)) { ---> for php5
if (class_exists($className)) { // for php4
$obj = new $className($construct_params);
} else {
die("Hack off mate.");
}

var_dump($obj);
-

>  // I had to test this to see if it works! the first 2 attempts are
> bogus // but you can run them to see what happens -- also the 3 attempt is
> a pretty // weird construction and I would be interested to know if anybody
> has thoughts // on calling the ctor in this way (essentially calling it
> twice) //

Never see a such solution, but may use a register funct instead...

-
class Test
{
   var $v;

   function Register($objName, $v=1){
  # auto register object if needed
  if(!isset($GLOBALS[$objName])){
 $GLOBALS[$objName]=true;
 $GLOBALS[$objName]=new Test($v);
   }else{
return $GLOBALS[$objName];
   }
   }

   function Test($v){
   $this->__construct($v);
   }

   function __construct($v)
   {
   $this->v=$v;
   }
}

$className = "Test";
$construct_params = array("obj", "param1","param2","param3");
//if (class_exists($className, false)) { ---> for php5
if (class_exists($className)) { // for php4
   call_user_func_array(array(($className), "Register"), $construct_params);
} else {
die("Hack off mate.");
}

var_dump($obj);


Love phpsec too ;-)
Hope this finaly help!
Olivier

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



[PHP] Re: Extra (persistant) tier

2005-06-22 Thread Catalin Trifu
Hi,

Basically you can take your mind off object persistance in PHP
unless you code a C extension yourself which would do such a thing.
Besides code accelerators and caching techniques there isn't much
to play with; at least none that I know of.

Catalin


Evert | Rooftop wrote:
> Hi,
> 
> I'm writing a big web application, and trying really hard to seperate
> business logic and presentation, which been no problem up to now.
> Because I abstracted the business logic so much the framework became
> heavier, sometimes a simple action can take up to 2 mb memory and
> several extra milliseconds.
> 
> I know this doesn't sound much and I'm applying all kinds of technique's
> to reduce resource-usage and increase speed. The thing is, I feel like I
> need to split the business tier up in 2 tiers, one of them being my
> persisitant object manager. The main reason is because every script that
> is executed must do some initialization and database calls, and I think
> I could reduce this by making a persistant tier, but there doesn't seem
> a good way to do this using php except when I would use sockets.
> 
> Shared memory doesn't really seem like an option, because I would still
> need to include all the classes to manage it, and when I use shared
> memory, the memory would still be copied into the php memory + having a
> central manager seems like a good idea.
> 
> I know I'm pretty vague in my requirements, but I think it should be
> enough to explain what kind of solution I´m looking for, because this
> seems like a big advantage of java over php, or am I mistaken?
> If you have any ideas, let me know :)
> 
> grt,
> Evert
> Collab

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



Re: [PHP] Re: Extra (persistant) tier

2005-06-22 Thread david forums


To make persistant object with php use serialize

and include the object into session.

it's the only way with php

regards

david


Le Wed, 22 Jun 2005 14:43:51 +0200, Catalin Trifu  
<[EMAIL PROTECTED]> a écrit:



Hi,

Basically you can take your mind off object persistance in PHP
unless you code a C extension yourself which would do such a thing.
Besides code accelerators and caching techniques there isn't much
to play with; at least none that I know of.

Catalin


Evert | Rooftop wrote:

Hi,

I'm writing a big web application, and trying really hard to seperate
business logic and presentation, which been no problem up to now.
Because I abstracted the business logic so much the framework became
heavier, sometimes a simple action can take up to 2 mb memory and
several extra milliseconds.

I know this doesn't sound much and I'm applying all kinds of technique's
to reduce resource-usage and increase speed. The thing is, I feel like I
need to split the business tier up in 2 tiers, one of them being my
persisitant object manager. The main reason is because every script that
is executed must do some initialization and database calls, and I think
I could reduce this by making a persistant tier, but there doesn't seem
a good way to do this using php except when I would use sockets.

Shared memory doesn't really seem like an option, because I would still
need to include all the classes to manage it, and when I use shared
memory, the memory would still be copied into the php memory + having a
central manager seems like a good idea.

I know I'm pretty vague in my requirements, but I think it should be
enough to explain what kind of solution I´m looking for, because this
seems like a big advantage of java over php, or am I mistaken?
If you have any ideas, let me know :)

grt,
Evert
Collab




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



RE: [PHP] undefined mysql_connect() ???

2005-06-22 Thread bruce
frank.

try to do an install of php-mysql. you can do this by yum/rpm. this should
get you the ability to run the php commandline test app. let's get this
working 1st. once this is working, we can get your apache working
correctly..

btw, what do you get when you do a 'httpd -l'?

-bruce


-Original Message-
From: Frank Whitsell [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 21, 2005 4:24 PM
To: bruce
Cc: php-general@lists.php.net
Subject: RE: [PHP] undefined mysql_connect() ???



Sheesh, the electric power has just been off for almost an hour!

Here's the result of running "rpm -qa | grep -i php":

  php-4.3.9-3
  php-ldap-4.3.9-3
  php-pear-4.3.9-3

The o/s is Fedora Core 3, and I selected the Server installation, which also
automatically installed apache 2.0.52, php 4.3.9, and mysql 3.23.58, as I
wanted.  And those are all rpm's.

I've installed a number of redhat's, suse's, debian, etc, and never had this
problem...but I have never used (or installed) apache2 before.

The .php files execute fine.  That is, until I try to call the
mysql_connect()
function.  Then I get the undefined-function error.

On apache1.3, the phpinfo() function shows the apache modules loaded, and
that
shows that mod_php4 is loaded.  But on apache2, nothing is mentioned about
php
in the list of loaded modules.

Nevertheless, if I add the LoadModule directive for php4 and restart
apache2,
apache2 complains that the module is already loaded.  And it must be,
because
otherwise, the .php files wouldn't execute.

It's almost as if apache2 is loading it's php module from some other source
that doesn't contain the mysql functions.  By "from some other source", I
mean
that maybe it's not loading the libphp4.so that's in the apache2 modules
directory.

The httpd.conf file has the directive ServerRoot set to /etc/httpd, and the
modules all use the pathname "modules/".  Thus,
"/etc/httpd/modules/ should load the correct module.  But there is
no
mention at all of "libphp4.so" in the httpd.conf file, or anywhere else I
can
find.  In fact, a search for "php" in the httpd.conf file finds nothing.
I'm
really stumped.

  --frank--

--
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] variable object creating

2005-06-22 Thread Jochem Maas

olivier wrote:

Sorry for typo error, just need my cup of cofee...


:-) no probs ... I think we gave the OP plenty to think about!
liked you 'Register' idea - seems like it could work well.

also nice one for pointing out my php5isms - I forget that alot
of stuff I use is php5 only (e.g. second the arg. to class_exists())!



Here is a good post for:
http://fr.php.net/manual/fr/function.call-user-func-array.php


from taylor
08-May-2005 12:04
  
   // build argument list; be sure to escape string delimeters

   $func = create_function('$str', 'return str_replace("\'","\\\'",
$str);');
   $sargs = "'" . join( "','", array_map($func,$args) ). "'";
  
   // build & eval code; return result

   $seval = "return new $type($sargs);";
   return eval($seval);
   }
?>
#

I dont like eval too but i think that is depending on the pb we want to 
solve... if you can change contrutor from each object may be better to use 
jockem solution that is more secure (added some change for php4). 


#
class Test
{
   var $v;
   // constructor for php4
   function Test($args){
   $this->__construct($args);
   }
   // constructor for php5   
   function __construct($args = array())

   {
   extract((array) $args);
   $this->v=$v;
   }
}

$className = "Test";
$construct_params = array("v"=>"param1","param2","param3");

//if (class_exists($className, false)) { ---> for php5
if (class_exists($className)) { // for php4
$obj = new $className($construct_params);
} else {
die("Hack off mate.");
}

var_dump($obj);
##



// I had to test this to see if it works! the first 2 attempts are
bogus // but you can run them to see what happens -- also the 3 attempt is
a pretty // weird construction and I would be interested to know if anybody
has thoughts // on calling the ctor in this way (essentially calling it
twice) //



Never see a such solution, but may use a register funct instead...

##
class Test
{
   var $v;

   function Register($objName, $v=1){
  # auto register object if needed
  if(!isset($GLOBALS[$objName])){
 $GLOBALS[$objName]=true;
 $GLOBALS[$objName]=new Test($v);
   }else{
return $GLOBALS[$objName];
   }
   }
   
   function Test($v){

   $this->__construct($v);
   }
   
   function __construct($v)

   {
   $this->v=$v;
   }
}

$className = "Test";
$construct_params = array("obj", "param1","param2","param3");
//if (class_exists($className, false)) { ---> for php5
if (class_exists($className)) { // for php4
   call_user_func_array(array(($className), "Register"), $construct_params);
} else {
die("Hack off mate.");
}

var_dump($obj);
##

Love phpsec too ;-)
Hope this finaly help!
Olivier

Le Mercredi 22 Juin 2005 11:38, Jochem Maas a écrit :


olivier wrote:


Hi,


I answered this also, but apparently I only replied to the OP...
(reproduced here - minus the typos in my first post on this topic :-/)

if (class_exists($className, false)) {
$obj = new $className($construct_params);
} else {
die("Hack off mate.");
}



Try something like:

$classname = "MyClass";
$construct_params = array("param1","param2","param3");

$return =null;
if(class_exists($classname)){
 $param=explode(" ',' ", $construct_param);


this should be join() not explode(), but even then it won't work,
and even if it did you would only be able to pass strings (i.e. no objects,
arrays, resources, etc)

for this you should probably be looking at call_user_func_array() e.g:

class Test
{
public $v;
function __construct($v = 1) { $this->v = $v; }
}

$className = "Test";

if (class_exists($className, false)) {
// I had to test this to see if it works! the first 2 attempts are
bogus // but you can run them to see what happens -- also the 3 attempt is
a pretty // weird construction and I would be interested to know if anybody
has thoughts // on calling the ctor in this way (essentially calling it
twice) //
// ATTEMPT 1
//$obj = call_user_func_array(array($className,"__construct"),
array(3)); // ATTEMPT 2
//$obj = call_user_func_array(array(new $className,"__construct"),
array(3)); // ATTEMPT 3
call_user_func_array(array(($obj = new $className),"__construct"),
array(3));

} else {
die("Hack off mate.");
}

var_dump($obj);



# You must add here some security checks
 eval("$retrun = new $className($param)");


typo! 'retrun' (I spell 'return' like that alot too :-)

btw eval() sucks and is not really needed, although granted it's an
easy/flexible solution in terms on being able to pass args to the ctor
(constructor), my thou

Re: [PHP] Re: Extra (persistant) tier

2005-06-22 Thread Jochem Maas

david forums wrote:


To make persistant object with php use serialize

and include the object into session.

it's the only way with php



tell it to Mr. Rethans:

http://talks.php.net/show/srm-ffm2004

and also read here to get a better understanding of the possibilities/
limitations:

http://php.net/manual/en/ref.sem.php

Catalin has a point in that its likely that any persistence layer you
manage to add that is not native C will probably be lacking the required
performance.

Have you tried running the code on a Quad-CPU box with 12Gigs of RAM
and 15K drives? that may sound sarcastic but its not meant to be - hardware
is very cheap compared manhours (i.e. your development time) from a business
perspective (regardless of that fact that its seems to take forever to earn 
enough money
to buy a new laptop ;-/ )


regards

david


Le Wed, 22 Jun 2005 14:43:51 +0200, Catalin Trifu  
<[EMAIL PROTECTED]> a écrit:



Hi,

Basically you can take your mind off object persistance in PHP
unless you code a C extension yourself which would do such a thing.
Besides code accelerators and caching techniques there isn't much
to play with; at least none that I know of.

Catalin


Evert | Rooftop wrote:


Hi,

I'm writing a big web application, and trying really hard to seperate
business logic and presentation, which been no problem up to now.
Because I abstracted the business logic so much the framework became
heavier, sometimes a simple action can take up to 2 mb memory and
several extra milliseconds.

I know this doesn't sound much and I'm applying all kinds of technique's
to reduce resource-usage and increase speed. The thing is, I feel like I
need to split the business tier up in 2 tiers, one of them being my
persisitant object manager. The main reason is because every script that
is executed must do some initialization and database calls, and I think
I could reduce this by making a persistant tier, but there doesn't seem
a good way to do this using php except when I would use sockets.

Shared memory doesn't really seem like an option, because I would still
need to include all the classes to manage it, and when I use shared
memory, the memory would still be copied into the php memory + having a
central manager seems like a good idea.

I know I'm pretty vague in my requirements, but I think it should be
enough to explain what kind of solution I´m looking for, because this
seems like a big advantage of java over php, or am I mistaken?
If you have any ideas, let me know :)

grt,
Evert
Collab







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



Re: [PHP] Re: Extra (persistant) tier

2005-06-22 Thread Catalin Trifu
Yes, but putting objects into sessions is pretty inefficient
and makes no sense for database connection and such, since any resources
associated with that object are discarded at script end.

Catalin

david forums wrote:
> 
> To make persistant object with php use serialize
> 
> and include the object into session.
> 
> it's the only way with php
> 
> regards
> 
> david
> 
> 
> Le Wed, 22 Jun 2005 14:43:51 +0200, Catalin Trifu 
> <[EMAIL PROTECTED]> a écrit:
> 
>> Hi,
>>
>> Basically you can take your mind off object persistance in PHP
>> unless you code a C extension yourself which would do such a thing.
>> Besides code accelerators and caching techniques there isn't much
>> to play with; at least none that I know of.
>>
>> Catalin
>>
>>
>> Evert | Rooftop wrote:
>>
>>> Hi,
>>>
>>> I'm writing a big web application, and trying really hard to seperate
>>> business logic and presentation, which been no problem up to now.
>>> Because I abstracted the business logic so much the framework became
>>> heavier, sometimes a simple action can take up to 2 mb memory and
>>> several extra milliseconds.
>>>
>>> I know this doesn't sound much and I'm applying all kinds of technique's
>>> to reduce resource-usage and increase speed. The thing is, I feel like I
>>> need to split the business tier up in 2 tiers, one of them being my
>>> persisitant object manager. The main reason is because every script that
>>> is executed must do some initialization and database calls, and I think
>>> I could reduce this by making a persistant tier, but there doesn't seem
>>> a good way to do this using php except when I would use sockets.
>>>
>>> Shared memory doesn't really seem like an option, because I would still
>>> need to include all the classes to manage it, and when I use shared
>>> memory, the memory would still be copied into the php memory + having a
>>> central manager seems like a good idea.
>>>
>>> I know I'm pretty vague in my requirements, but I think it should be
>>> enough to explain what kind of solution I´m looking for, because this
>>> seems like a big advantage of java over php, or am I mistaken?
>>> If you have any ideas, let me know :)
>>>
>>> grt,
>>> Evert
>>> Collab
>>
>>

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



RE: [PHP] Re: security question...??

2005-06-22 Thread bruce
rene...

the scenario that i'm envisioning could very well cause people to get
ticked. but i also can easily see financial institutions starting to tell
their customers, that unless your system is of a certain level, or running a
certain kind of browser, that you'll get charged more to do business with
them...

security is an issue, and it's going to get larger. and that will require
thinking about the user/client's setup..

if i as a bank, refuse to allow you to signin to my server, because i detect
that your client is not valid/legitimate, meaning i think it's been hacked,
how have i trampled the rights of anyone. i haven't. will some customers
run, sure.. perhaps.. will i potentially feel better. yeah. will i
potentially have something that i can promote as an extra level of security
that others don't have, maybe..

let people continue to read/hear about massive losses of data and see what
happens...

rene, you also have to understand, i'm not trying to determine if the user's
entire system is 'clean/valid'. i'd settle for a way of knowing that the
browser/client that i'm talking to is legitimate!!

-bruce



-Original Message-
From: Rene Brehmer [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 21, 2005 3:18 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Re: security question...??


Documented research indicate that on Tue, 21 Jun 2005 13:37:50 -0700,
"bruce" wrote:

> chris...
>
> what you state is true at the extreme... but in the case of an client app,
i
> could already extract information about the various apps that make up the
> client.. ie if, as in the case of IE, I was able to get information from
the
> IE browser about various dlls that make up the browser. if these pieces of
> information correclt match what msoft would state should be there, then i
> could assume that the app was/is legitimate.

BUT: That would mean that you can't take into account any plugins or
extensions the user might install. And the security leak you're afraid of
might not even be IN the browser program used. It might as well be a packet
sniffer on the outside of the user's firewall ...

> and here's why. while you may not give a damm, there will be a growing
> chorus of people who'll want to know that the developers/sites are doing
> everything they can to ensure the safety of the entire transaction. in
fact,
> i'm willing to bet that somehting like what i've been discussing will be
> delivered, and promoted as a security/selling point...

I think it's more a matter of education and morale than anything else. You
can't take responsibility for all clients not screwing up their own system.
You just have to hope and trust, that when you tell your users to use this
and that browser, and take this and that precaution, that they actually do
it, and not install a whole bunch of crap that creates a security problem.

What you're asking for is basically a way to control what users do on their
own computers, and refuse them if you don't like what they've done. It's
not very short of invasion of privacy. Electronic Arts already do that with
their games (spy on your computer without your permission, and the refuse
you to play the game you legally paid for, because you have other legally
paid programs that they don't approve of).

What you can do however, is to develop an app that can run a security test
locally on the user's computer, and have that app sign off on the user
being safe enough for you to want to deal with him. And then force them to
regularly have to do that again. But I'm telling you, the more troublesome
you make it for your users to use your stuff, the more users you'll loose,
and fast. Mostly thanks to MS and Apple, computer users today know very
little about their computers, or how they work, or how they protect
themselves, and we teach them that they should all and anything that comes
their way. So it's continuingly limited what you can actually ask a
computer user to put up with, they'll just go somewhere else that's less
hazzlesome (that's the whole reason the majority use IE: It's there, it's
easy to use, it gets the job done, and it doesn't complain a whole lot).
The majority of end-users don't care, or know, or understand, simple
security precautions when it comes to network traffic.

Education and discipline is, in the end, the only means to achieve what you
want.

/rambling off
--
Rene Brehmer
aka Metalbunny

We have nothing to fear from free speech and free information on the
Internet, but pop-up advertising!

http://metalbunny.net/
My little mess of things...

--
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] How to convert documents to PDF using PHP

2005-06-22 Thread Burhan Khalid

Bosky, Dave wrote:

I need to find a way to allow users to select multiple files from a list
and generate a single PDF file from them.


http://www.fpdf.org
http://php.net/pdf

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



[PHP] Amy's Site question

2005-06-22 Thread Jack Jackson

Hello,

On a site I'm listing measurements in both inches and cm; in the db 
they're stored as inches. To convert them to cm I'm doing:


 x ($cartoon['art_height'] * 2.54); ?> cm



How can I limit the result of that math to one decimal place, ie, 9.5 
cm, not 9.523 cm?


Thanks in advance,
JJ

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



Re: [PHP] Re: splitting CSV rows into multiple SQL inserts?

2005-06-22 Thread Ben Duffy
Vince,

I have made a couple of changes in the code below, none of this has been
tested, but I have done similar in the past.
As long as u don't have too mauch data to read in, this method gives you the
most flexibility.
If the CSVs are large, you might have to process line by line instead of
using arrays.
If doing line by line, have you considered sql "if not exists (select o_num
from order_header where o_num = '$o_num') insert into" etc. to prevent
duplicates?

Ben



> On Wed, 22 Jun 2005, Ben Duffy wrote:
>
> } I would read in the CSV file, and populate  two arrays, using the
> } ordernumber as a key in the header array, loop through the header array
> } containg $o_num, $date, $name, $addr, to do the db inserts.
>
> Ok, I think I get this, though I am confused about doing the inserts - I
> don't want duplicate rows to be inserted into the header table. Eg:
>
>  1116,6/22/2005,Jim Smith,44 Here St,19191980,1,CD
>  1116,6/22/2005,Jim Smith,44 Here St,77736222,1,Tape
>
> The two rows from the CSV above produce the same row data for the header
> table:
>
>  '1116','6/22/2005','Jim Smith','44 Here St'
>  '1116','6/22/2005','Jim Smith','44 Here St'
>
> How do I make sure that only one row is inserted? How do I detect the same
> $o_num when building the header array?


The key in the array is for example above is 1116,  when you read in the CSV
file for the second line, the array vales for 1116 will just be overwritten
again.
They will not be duplicated.

The way I normally do this type of thing is to do this in your loop of
reading in the CSV variables...

$header= array();
$details= array();
$prev_o_num = 0;
Loop through CVS...

// you should probably do your manipulation on variables here before filling
the arrays.

 $header[$o_num]['date']   = $date;
 $header[$o_num]['name'] = $name;
 $header[$o_num]['addr']  = $addr;


 if ($prev_o_num ==  $o_num){$lineNo++;}  //test to see if new o_num.
 else{$lineNo = 1;}
 $details[$o_num][$lineNo] ['item_num'] = $item_num;
 $details[$o_num][$lineNo] ['quan'] = $quan;
 $details[$o_num][$lineNo] ['desc'] = $desc;

End loop

You now should have two arrays with no duplicates.
The slightly more difficult part is now to loop through the arrays...


foreach ($header as $o_num => $value) {
   extract($value, EXTR_OVERWRITE);
   // etc you should now have your original variable name back.
   // insert into db here
   insert into order_header (o_num, date, name, addr)
   values ('$o_num','$date','$name','$addr'),


   foreach ($details[$o_num] as $line_no => $detailsvalues) {
 extract($detailsvalues, EXTR_OVERWRITE);
 // should have access to $line_no, and the variables within
 insert into line_items (o_num, item_num, quan, desc, line_order)
  values ('$o_num','$item_num','$quan','$desc','$line_no'),
}

}


Not tested, something for u to try.




>
> /vjl/
>
>
> } The details table would be an array of arrays, key would be ordernumber
> } again, then the sub array would be the line number. You can set to 1,
then
> } increment until you detect a new ordernumber The contents of the detail
sub
> } array contains  $item_num, $quan, $desc. Loop through this this array to
> } produce your details table inserts.
> }
> } Ben.
> }
> }
> }
> } "Vince LaMonica" <[EMAIL PROTECTED]> wrote in message
> } news:[EMAIL PROTECTED]
> } > On Wed, 22 Jun 2005, Sergey wrote:
> } >
> } > } You can insert file data in DB first, using LOAD DATA INTO FILE,
after
> } it'll
> } > } be easy to manipulate this DB table with a help of php-script.
> } >
> } > Actually, I can't, as the CSV contains fields for two different
tables. I
> } > may have explained it better here:
> } >
> } > I have a CVS file that has order header *and* line item info on each
line,
> } > like:
> } >
> } > 1110,6/20/2005,Jan Doe,123 Main St,,1,Book
> } > 1116,6/22/2005,Jim Smith,44 Here St,19191980,1,CD
> } > 1116,6/22/2005,Jim Smith,44 Here St,77736222,1,Tape
> } >
> } > The above is actually two orders - one with one line item, and the 2nd
> } > with two line items. I need to insert data from those lines into two
> } > tables:
> } >
> } > insert into order_header (o_num, date, name, addr)
> } > values ('1110','6/20/2005','Jan Doe','123 Main St'),
> } >('1116','6/22/2005','Jim Smith','44 Here St');
> } >
> } > insert into line_items (o_num, item_num, quan, desc, line_order)
> } > values ('1110','','1','Book','1'),
> } >('1116','19191980','1','CD','1'),
> } >('1116','77736222','1','Tape','2');
> } >
> } > Note the line_order field - it needs to increment per order for each
line
> } > item added to the line_items table. To complicate matters a bit, I'm
> } > actually massaging the data before inserting [eg: splitting the name
field
> } > from the CSV into two fields for the mysql db, formatting the date
field
> } > for mysql, etc].
> } >
> } > I'm currently doing this process via a form where a user uploads the
CVS
> } > file [created with Excel, complete 

Re: [PHP] Amy's Site question

2005-06-22 Thread Chris Boget
> On a site I'm listing measurements in both inches and cm; in the db 
> they're stored as inches. To convert them to cm I'm doing:
>  x  ($cartoon['art_height'] * 2.54); ?> cm
> How can I limit the result of that math to one decimal place, ie, 9.5 
> cm, not 9.523 cm?

ummm, round()?

thnx,
Chris

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



Re: [PHP] Amy's Site question

2005-06-22 Thread Richard Davey
Hello Jack,

Wednesday, June 22, 2005, 2:17:48 PM, you wrote:

JJ> How can I limit the result of that math to one decimal place, ie,
JJ> 9.5 cm, not 9.523 cm?

number_format() is your friend.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I do not fear computers. I fear the lack of them." - Isaac Asimov

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



Re: [PHP] Amy's Site question

2005-06-22 Thread Burhan Khalid

Jack Jackson wrote:

Hello,

On a site I'm listing measurements in both inches and cm; in the db 
they're stored as inches. To convert them to cm I'm doing:


 x ($cartoon['art_height'] * 2.54); ?> cm



How can I limit the result of that math to one decimal place, ie, 9.5 
cm, not 9.523 cm?


 x printf('%01.1f',($cartoon['art_height']*2.54)); ?> cm


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



RE: [PHP] Amy's Site question

2005-06-22 Thread Jim Moseby
> Hello,
> 
> On a site I'm listing measurements in both inches and cm; in the db 
> they're stored as inches. To convert them to cm I'm doing:
> 
>  x  ($cartoon['art_height'] * 2.54); ?> cm
> 
> 
> How can I limit the result of that math to one decimal place, ie, 9.5 
> cm, not 9.523 cm?
> 


Use 'number_format()':

string number_format ( float number [, int decimals [, string dec_point [,
string thousands_sep]]])


JM

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



Re: [PHP][ O T ] Re: security question...??

2005-06-22 Thread Jochem Maas

bruce wrote:

rene...

the scenario that i'm envisioning could very well cause people to get
ticked. but i also can easily see financial institutions starting to tell
their customers, that unless your system is of a certain level, or running a
certain kind of browser, that you'll get charged more to do business with
them...



 "Thank you for using CitiBank, unfortunately your implant has classified
you as a liability and you are not allowed log on any more, incidently you
funds have been frozen and all accounts blocked.

Have a nice day."


security is an issue, and it's going to get larger. and that will require
thinking about the user/client's setup..



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



Re: [PHP] Amy's Site question

2005-06-22 Thread Jack Jackson
Thanks everyone! I did look in the manual under operators and must have 
missed the link to round. Thanks to all who replied!




Simon Allison wrote:

http://au3.php.net/round


-Original Message-
From: Jack Jackson [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 22 June 2005 9:18 PM

To: [php] PHP General List
Subject: [PHP] Amy's Site question

Hello,

On a site I'm listing measurements in both inches and cm; in the db 
they're stored as inches. To convert them to cm I'm doing:


 x ($cartoon['art_height'] * 2.54); ?> cm



How can I limit the result of that math to one decimal place, ie, 9.5 
cm, not 9.523 cm?


Thanks in advance,
JJ



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



Re: [PHP] Amy's Site question

2005-06-22 Thread John Nichel

Jack Jackson wrote:

Hello,

On a site I'm listing measurements in both inches and cm; in the db 
they're stored as inches. To convert them to cm I'm doing:


 x ($cartoon['art_height'] * 2.54); ?> cm



How can I limit the result of that math to one decimal place, ie, 9.5 
cm, not 9.523 cm?


Manual -> Strings -> Number_Format
Manual -> Strings -> Printf
Manual -> Math -> Round
Manual -> ...

Oh hell.  It's in the manual.

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



[PHP] Re: PHP autogenerating Website Templates

2005-06-22 Thread chris
So you want a BAMP, instead of a LAMP?

As php files are text based what works for a Linux or a Windows 
distribution, "Should" work for BSD as long as Apache, MySQL and PHP are 
properly configured and they (the php file) don't use OS specific code. Try 
a search of www.hotscripts.com

Chris

"The Doctor" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Question:  Is there a package that can autogenerate a Web Site
> using templates based on BSD/Apache/Mysql/PHP ??
>
> IT would be nice to know.
>
> -- 
> Member - Liberal International
> This is [EMAIL PROTECTED] Ici [EMAIL PROTECTED]
> God Queen and country! Beware Anti-Christ rising!
> nk.ca started 1 June 1995 

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



Re: [PHP] Re: security question...??

2005-06-22 Thread Rory Browne
Okay Bruce:
There's one very major problem with your suggestion - IT CAN NOT BE DONE.

YOU CAN NOT TEST A REMOTE PIECE OF SOFTWARE TO MAKE SURE THAT THERE
HAVE BEEN NO CHANGES TO IT.

There are ways of checking what type of valid browser, or what type of
valid Operating System, your using, but "invalid" or "illegitimate",
would return the same test results as "valid" or "legitimate", since
anybody hacking them would hack them to return the "valid/legitimate"
results to such tests.

Just incase you didn't understand me earlier - YOU CAN NOT RELIABLY
TEST REMOTE SOFTWARE TO MAKE SURE THAT IT HAS NOT BEEN  HACKED AND/OR
CRACKED

On 6/22/05, bruce <[EMAIL PROTECTED]> wrote:
> rene...
> 
> the scenario that i'm envisioning could very well cause people to get
> ticked. but i also can easily see financial institutions starting to tell
> their customers, that unless your system is of a certain level, or running a
> certain kind of browser, that you'll get charged more to do business with
> them...
> 
> security is an issue, and it's going to get larger. and that will require
> thinking about the user/client's setup..
> 
> if i as a bank, refuse to allow you to signin to my server, because i detect
> that your client is not valid/legitimate, meaning i think it's been hacked,
> how have i trampled the rights of anyone. i haven't. will some customers
> run, sure.. perhaps.. will i potentially feel better. yeah. will i
> potentially have something that i can promote as an extra level of security
> that others don't have, maybe..
> 
> let people continue to read/hear about massive losses of data and see what
> happens...
> 
> rene, you also have to understand, i'm not trying to determine if the user's
> entire system is 'clean/valid'. i'd settle for a way of knowing that the
> browser/client that i'm talking to is legitimate!!
> 
> -bruce
> 
> 
> 
> -Original Message-
> From: Rene Brehmer [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 21, 2005 3:18 PM
> To: php-general@lists.php.net
> Subject: Re: [PHP] Re: security question...??
> 
> 
> Documented research indicate that on Tue, 21 Jun 2005 13:37:50 -0700,
> "bruce" wrote:
> 
> > chris...
> >
> > what you state is true at the extreme... but in the case of an client app,
> i
> > could already extract information about the various apps that make up the
> > client.. ie if, as in the case of IE, I was able to get information from
> the
> > IE browser about various dlls that make up the browser. if these pieces of
> > information correclt match what msoft would state should be there, then i
> > could assume that the app was/is legitimate.
> 
> BUT: That would mean that you can't take into account any plugins or
> extensions the user might install. And the security leak you're afraid of
> might not even be IN the browser program used. It might as well be a packet
> sniffer on the outside of the user's firewall ...
> 
> > and here's why. while you may not give a damm, there will be a growing
> > chorus of people who'll want to know that the developers/sites are doing
> > everything they can to ensure the safety of the entire transaction. in
> fact,
> > i'm willing to bet that somehting like what i've been discussing will be
> > delivered, and promoted as a security/selling point...
> 
> I think it's more a matter of education and morale than anything else. You
> can't take responsibility for all clients not screwing up their own system.
> You just have to hope and trust, that when you tell your users to use this
> and that browser, and take this and that precaution, that they actually do
> it, and not install a whole bunch of crap that creates a security problem.
> 
> What you're asking for is basically a way to control what users do on their
> own computers, and refuse them if you don't like what they've done. It's
> not very short of invasion of privacy. Electronic Arts already do that with
> their games (spy on your computer without your permission, and the refuse
> you to play the game you legally paid for, because you have other legally
> paid programs that they don't approve of).
> 
> What you can do however, is to develop an app that can run a security test
> locally on the user's computer, and have that app sign off on the user
> being safe enough for you to want to deal with him. And then force them to
> regularly have to do that again. But I'm telling you, the more troublesome
> you make it for your users to use your stuff, the more users you'll loose,
> and fast. Mostly thanks to MS and Apple, computer users today know very
> little about their computers, or how they work, or how they protect
> themselves, and we teach them that they should all and anything that comes
> their way. So it's continuingly limited what you can actually ask a
> computer user to put up with, they'll just go somewhere else that's less
> hazzlesome (that's the whole reason the majority use IE: It's there, it's
> easy to use, it gets the job done, and it doesn't complain a whole lot

[PHP] Re: Extra (persistant) tier

2005-06-22 Thread Manuel Lemos

Hello,

on 06/20/2005 03:44 PM Evert | Rooftop said the following:

Hi,

I'm writing a big web application, and trying really hard to seperate 
business logic and presentation, which been no problem up to now.
Because I abstracted the business logic so much the framework became 
heavier, sometimes a simple action can take up to 2 mb memory and 
several extra milliseconds.


I know this doesn't sound much and I'm applying all kinds of technique's 
to reduce resource-usage and increase speed. The thing is, I feel like I 
need to split the business tier up in 2 tiers, one of them being my 
persisitant object manager. The main reason is because every script that 
is executed must do some initialization and database calls, and I think 
I could reduce this by making a persistant tier, but there doesn't seem 
a good way to do this using php except when I would use sockets.


Shared memory doesn't really seem like an option, because I would still 
need to include all the classes to manage it, and when I use shared 
memory, the memory would still be copied into the php memory + having a 
central manager seems like a good idea.


I know I'm pretty vague in my requirements, but I think it should be 
enough to explain what kind of solution I´m looking for, because this 
seems like a big advantage of java over php, or am I mistaken?

If you have any ideas, let me know :)


What takes more time and CPU is not quite loading objects in memory, but 
rather executing queries to a database.


What you need is not exactly called an object persistence tier, but 
rather object caching.


I use this generic data caching class, for instance to cache logged user 
profile and session data objects so I do not have to query that same 
information on every request.


http://www.phpclasses.org/filecache

It saves a lot of time and CPU because I use it in a site that keeps 
over 22,000 sessions often for many weeks.


If you have a content site, you can achieve better efficience than this 
by actually caching the content that is not changed frequently, rather 
than caching the objects or the database query results that are used to 
generate that content.


For instance, if you have pages that show articles, you can cache the 
HTML of parts or all of such pages and so you avoid the overhead of 
generating those HTML excerpts every time you need to serve them.


I use the same class above in a site that keeps 550MB of cached content 
in files. It works wonders not only because it is much faster but 
because it allows many concurrent users to read or change the content at 
the same time using maximum efficiency.


BTW, do not bother with shared memory because it is always limited and 
the cache support of your file system often does a better job of keeping 
in memory what is frequently accessed.



--

Regards,
Manuel Lemos

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

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

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



RE: [PHP] undefined mysql_connect() ???

2005-06-22 Thread Frank Whitsell


Yes, updating php and mysql seems like a good idea to me.

Here's the output of httpd -l:

Compiled in modules:
  core.c
  prefork.c
  http_core.c
  mod_so.c

I haven't used yum before (only rpm).  The yum man page presents a number of
commands and options.

I have a couple of questions:

Should I use rpm to remove the currently installed php and mysql packages
before running yum to install (or use yum to remove them), or is removal
necessary?

What's the recommended yum command?  That is, would I want to run "yum install,
update, or upgrade", or any of those?

How should I specify the pkg name?  I want php4, not php5, and I want mysql
3.23.58 (or later if any) but not mysql 4.

So would I use:

  yum install php, or
  yum install php-4.3, or
  yum install php-4.3.9 to get the same version I have currently installed,
  or what?

Thanks again for your saintly patience.

  --frank--

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



Re: [PHP] Amy's Site question

2005-06-22 Thread Angelo Zanetti
what does this have to do with amy's site?
just curious about the subject

John Nichel wrote:

> Jack Jackson wrote:
>
>> Hello,
>>
>> On a site I'm listing measurements in both inches and cm; in the db
>> they're stored as inches. To convert them to cm I'm doing:
>>
>>  x > ($cartoon['art_height'] * 2.54); ?> cm
>>
>>
>> How can I limit the result of that math to one decimal place, ie, 9.5
>> cm, not 9.523 cm?
>
>
> Manual -> Strings -> Number_Format
> Manual -> Strings -> Printf
> Manual -> Math -> Round
> Manual -> ...
>
> Oh hell.  It's in the manual.
>

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



Re: [PHP] undefined mysql_connect() ???

2005-06-22 Thread John Nichel

Frank Whitsell wrote:


Just look on your install CD's for the php-mysql RPM.  If you don't have 
the CD's, get it from here


http://download.fedora.redhat.com/pub/fedora/linux/core/3/i386/os/Fedora/RPMS/

Once you have it...

rpm -ivh php-mysql-4.3.9-3.i386.rpm

That's the version which ships with Fedora 3.  If you have a different 
version, change the command to match the rpm.


Once you've done that, restart Apache.

Done.

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



[PHP] Push refresh from server to clients

2005-06-22 Thread Simone Nanni
Hi everybody,
i have a little question for you.

I wrote a procedure that puts some images in a MySQL database from a "reserved 
area" that can be viewed, choosing in list of them in a "client area".

My problem is that in "client area" users must refresh (F5) their browser to 
see the newly added images in the list.

How can i auto-refresh all opened clients when administrator insert a new image 
(push refresh from server)??

Thanx a lot in advance!

Simone Nanni
Policlinico Tor Vergata, Roma, Italy

[PHP] passing login paramters from php web application to asp web application. help.

2005-06-22 Thread symbulos
Dear friends,

we have a peculiar problem here.

Our customer log in in our customer relationship management application
using a unique if, unique password. We use php with mysql.

We have a partnership with a company which has a crm application developed
in asp, sqlserver. The same customer log in in their crm using a different
pair of unique login, unique password.

We would like to allow the customer to log in our crm (php, mysql), then
pass the parameter on automatically so that they can see also this part of
the crm of the partner (asp, sqlserver) which is of common interest,
without having to log in again.

Do you have a solution for this problem?

Thank you in advance.

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



[PHP] Returned mail: Data format error

2005-06-22 Thread The Post Office
ALERT!

This e-mail, in its original form, contained one or more attached files that 
were infected with a virus, worm, or other type of security threat. This e-mail 
was sent from a Road Runner IP address. As part of our continuing initiative to 
stop the spread of malicious viruses, Road Runner scans all outbound e-mail 
attachments. If a virus, worm, or other security threat is found, Road Runner 
cleans or deletes the infected attachments as necessary, but continues to send 
the original message content to the recipient. Further information on this 
initiative can be found at http://help.rr.com/faqs/e_mgsp.html.
Please be advised that Road Runner does not contact the original sender of the 
e-mail as part of the scanning process. Road Runner recommends that if the 
sender is known to you, you contact them directly and advise them of their 
issue. If you do not know the sender, we advise you to forward this message in 
its entirety (including full headers) to the Road Runner Abuse Department, at 
[EMAIL PROTECTED]

This message was not delivered due to the following reason(s):

Your message could not be delivered because the destination server was
unreachable within the allowed queue period. The amount of time
a message is queued before it is returned depends on local configura-
tion parameters.

Most likely there is a network problem that prevented delivery, but
it is also possible that the computer is turned off, or does not
have a mail system running right now.

Your message could not be delivered within 2 days:
Host 22.210.89.38 is not responding.

The following recipients could not receive this message:


Please reply to [EMAIL PROTECTED]
if you feel this message to be in error.

file attachment: file.zip

This e-mail in its original form contained one or more attached files that were 
infected with the [EMAIL PROTECTED] virus or worm. They have been removed.
For more information on Road Runner's virus filtering initiative, visit our 
Help & Member Services pages at http://help.rr.com, or the virus filtering 
information page directly at http://help.rr.com/faqs/e_mgsp.html. 
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] php - jscript - onclick event..

2005-06-22 Thread bruce
hi..

a somewhat php/jscript question...


i have the following onclick that works...
-
Account


i'd like to be able to have the jscript run if i have a query var foo.
basically, i'd like a way of running the same jscript that gets run during
the onClick, when i select a php function... ie, if i finish a pprocess, i'd
like to set the appropriate page to display.

i thought i could do something like the following:


alert('');
cms_focus ('cms-edit', 1);
  
";
echo "
  
cms_focus ('cms-properties', 1);
  
";
echo "
  
cms_focus ('cms-state', 99);
  
";
echo "
  
return false;
  
";
 }
?>

my hope was that this would effectively simulate the running of the
jscript.. but it didn't seem to work. the tabs/screens don't change, which
indicates that the jscript is not running as i thought it would

the above php/jscript is being called after the jscript cms_focus routine
has been created. in the above sample, i discovered that if i placed all 3
cms_focus calls in the same  block, only the 1st one seemed
to run... however, even with this, while it appears that each cms_focus call
is being made, there's still not apparent change in the display.

the actual cms_focus routine is listed below. all it really does is to set
the focus of the given div/id the given section/id of 99 is set to be a
block display, with the rest set to be unseen.

any ideas/help would be useful.. i'm pretty sure i'm running into a simple
problem.. this should be doable.

if you need me to, i can supply the entire test php page, as it's not too
long.

also, if you need additional clarification, let me know.. this might be
somewhat jumbled.

thanks

-bruce
[EMAIL PROTECTED]


test cms_focus function