Re: [PHP] Out of the blue question..

2009-04-07 Thread chris smith
 Didn't really read Bruce's email didya Chris?!!

Of course I read it - I guess I misunderstood the intent. No need to
bite my head off - sheesh :P

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] if elseif elseif elseif....

2009-03-05 Thread chris smith
 $obligatoryFieldNotPresent=null;

 foreach($_POST, as $value)
 {
        if(!empty($value)continue;

     Parse error.  ;-P

 There should be no comma there.

That fixes one, what about the rest? ;)

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] sprintf thousand separator.

2009-02-11 Thread chris smith
2009/2/11 João Cândido de Souza Neto j...@consultorweb.cnt.br:
 Hello everybody.

 I´d just like to know if there´s any way of defining a thousand separator to
 a currency value using sprintf.

Use number_format instead of sprintf, it's designed to do what you want.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Database Tables Relation Issue

2009-01-30 Thread chris smith
 I have thought of using comma-separated ID's in special field in the lists
 table of the users who have joined that specific list, but I have also
 thought of doing the same at the users table, then I had another solution
 which is to create new table:

 create table `relations` (
  `listid` int(11),
  `userid` int (11)
 );

 Which will contain the relations.

 I want it to be optimised so when I'm fetching the mailinglists that a
 specific user is registered (by user id) to and when I'm fetching the users
 in specific mailinglist (by mailinglist id) it will be the fastest.

Always use an extra table unless you have an extremely good reason not to.

For example, someone unsubscribes from the list - you would have to
regenerate the whole comma separated list (you might be able to do it
through a query but it'd be very painful). With an extra table, you
just delete the row from the relations table (guess which is going to
be faster).  Same for signup - you just add a new row into the
relations table.

With an extra table, you could also add a field for when they
subscribed to that list, so if they say you're spamming you could show
when they signed up and so on.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Because you guys/gals/girls/women/insert pc term here are a smart lot

2009-01-06 Thread chris smith
 It may be worth mentioning that, IIRC, CHAR is faster due to the fixed
 length. If you can make your table use a fixed length row size (ie no
 variable length columns), it'll be faster.

I'd be interested in seeing tests about this.. I doubt there's any difference.

 Also I could be missing
 something, but I can't see the advantage in VARCHAR since space is not
 really a concern these days.

char is fixed length and padded. If you don't fill up the space, the
db does it for you (even though it seems it's internal only).

http://dev.mysql.com/doc/refman/5.0/en/char.html

When CHAR values are stored, they are right-padded with spaces to the
specified length. When CHAR values are retrieved, trailing spaces are
removed.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Since I speak with some of you more than people I see in person....

2009-01-01 Thread chris smith
And as a side note (some of you already know): for my wife and I
 closing out the year, we heard the heartbeat of our first child for
 the first time today in the ultrasound.  Nothing else will ever again
 matter as much to me as what I am about to embark upon.  I don't think
 any song or sound I've ever heard in my entire life was as beautiful
 as those few seconds.  My heart literally feels so full that it could
 burst at any moment.

Congrats!! That's awesome news, they are so much fun. Half way through
waiting for #3 heh.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] IM Convert PDF-JPG works in command line, not in PHP

2008-12-31 Thread chris smith
 But from PHP, it only works beautifully if I specify complete pathnames for
 convert

/usr/local/imagemagick/ is not in apache's $PATH, so you need to
specify the full location.

 As soon as I try to convert a PDF
 image, it fails:

 ?php
 $command_line = /usr/local/imagemagick/bin/convert
  /var/www/html/original.pdf /var/www/new.jpg;
 system($command_line, $return_var);

Try using exec() so you get the whole return message, might be
something useful in there.

exec($command_line, $return_output, $return_code);

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Offline PDO documentation?

2008-12-29 Thread chris smith
On Mon, Dec 29, 2008 at 6:28 PM, Michelle Konzack
linux4miche...@tamay-dogan.net wrote:
 Hello,

 In my PHP5 documetation I have installed on my system PDO is  mentioned,
 but the files are missing...

 While surfing php.net I have not found the PDO part which I need  Off-
 Line since I am on GSM and surfing/searchin the  internet  is  sometimes
 the hell.

 Can someone point me to the tar archive for the PDO documentation please?

You can download the whole php.net docs:

http://www.php.net/download-docs.php

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Problem with fetching values...

2008-12-29 Thread chris smith
 So, PostgreSQL catch the array by name

pg_fetch_array($db_query, null, PGSQL_ASSOC)

 and MySQL use the position

mysql_fetch_array($db_query, MYSQL_NUM)

Why?

http://www.php.net/mysql_fetch_array

Use MYSQL_ASSOC as the 2nd param, or leave it out and by default it uses BOTH.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] MYSQL insert problems

2008-10-17 Thread chris smith
On Sat, Oct 18, 2008 at 3:22 AM, Frank Stanovcak
[EMAIL PROTECTED] wrote:
 I'm using the following code to try and do a simple insert query.  However
 it won't insert the data into the table, and I get no error messages.  What
 have I done wrong this time?

You will be getting an error.

echo mysql_error();


 DateShipped,Quantity, Cases, Pallets, Weight, FKUSShippedBy, BillofLading,)

Extra comma at the end of BillofLading.

Also you should really use mysql_real_escape_string for non-numeric
values, and at least check stuff like $_SESSION['quantity'] is a
number.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Posting Summary for Week Ending 4 January, 2008: php-general@lists.php.net

2008-01-05 Thread chris smith
 Once it settles down, it will run every Friday at 4:00p to
 summarize the week.  For bragging rights, to keep track of how much
 time you've spent doing community service or whatever else.

Why? Does anybody really care how many emails they send to the list?
While I don't doubt your good intentions, apart from the maybe 30-40
regular posters, there are probably hundreds or thousands more on the
list (I have no idea how big the list is) who don't care about this
and then there are the ones who get the digest version too. Can't you
just put it on your website and have a link to it in your sig or
something?

After all the crap of dealing with off-topic threads about html and
javascript and database questions, is this any better?

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] how to use php from mysql to xml

2008-01-05 Thread chris smith
On Jan 5, 2008 9:14 PM, Yang Yang [EMAIL PROTECTED] wrote:
 hi,everyone,i am a newbuy for php world

 and i have a problem when i study php


 i want to make a script,it works for:
 a mysql table,like

 title authorcontentdate
 a1a2   a3 a4
 b1b2   b3b4
 ..


 and i want to use php ,select it and make a xml to save it ,now i use this
 script


 $resultID = mysql_query($query, $linkID) or die(Data not found.);
 for($x = 0 ; $x  mysql_num_rows($resultID) ; $x++){
   $row = mysql_fetch_assoc($resultID);

Change that to

while ($row = mysql_fetch_assoc($resultID)) {
..
}

You don't need to know the number of rows the query returns (unless
you actually want to use that number, but you don't need it for this
loop).

 it has no problem,but i want to save a xml file ,like this format

See http://www.php.net/fopen  http://www.php.net/fwrite for details
on how to write to a file.

 ?xml version=1.0 encoding=GB2312?
 Table
 Record
 Titlea1/Title
 Authora2/Author
 Contenta3/Content
 date2003-06-29/date
 /Record
 Record
 Titleb1/Title
 Authorb2/Author
 Contentb3/Content
 date2003-06-30/date
 /Record
 
 many record
 /Table

Something like this should work:

while ($row = mysql_fetch_assoc($resultID)) {
  $xml_entry .= record;
  foreach ($row as $fieldname = $data) {
$xml_entry .=  . $fieldname . ;
$xml_entry .= htmlentities($data);
$xml_entry .= / . $fieldname . ;
  }
  $xml_entry .= /record;
}

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] menu andfolder question

2008-01-05 Thread chris smith
On Jan 5, 2008 10:23 PM, Alain Roger [EMAIL PROTECTED] wrote:
 Hi,

 Serveral web sites have a menu and when you pass your mouse over a link, the
 browser statusbar only shows the folder where is located the file link, not
 the complete address including the file link.

 i mean if you take web site : http://www.zend.com/en/
 when you pass your mouse cursor over Company link, it displays only : 
 http://www.zend.com/en/company; in the statusbar of your browser.
 how is it possible whereas the link points to company/index.htm ?

In that example the link takes you to http://www.zend.com/en/company/
- not http://www.zend.com/en/company/index.htm

index.htm is the default file it looks for based on apache config.

See http://httpd.apache.org/docs/2.2/mod/mod_dir.html for more info.
You can set it to whatever you like, but as a rule apache uses
index.html or index.htm or index.php and asp/asp.net uses default.asp
or default.aspx.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] menu andfolder question

2008-01-05 Thread chris smith
On Jan 5, 2008 10:36 PM, Alain Roger [EMAIL PROTECTED] wrote:
 ok, maybe i did not write my question well.
 i already used it because i setup the DirectoryIndex to index.php,
 index.html

 my concern for now, how to have the same behavior on my local computer
 (development computer) ?
 my computer has IP 200.170.1.2 (for example)
 so in my brower i type : 200.170.1.2/myWebSite

 this load my firt index.php webpage to browser... if i pass my mouse cursor
 over menu link Company, it displays
 http://200.170.1.2/myWebSite/200.170.1.2/company
 which is not great :-(

 here is the code i use :
 print div class='MenuItem4'a
 href='.$_SERVER['SERVER_NAME']./company'Company/a/div;

In your case it's taking the existing url and tacking the rest on
which is not what you want.

If you print out $_SERVER['SERVER_NAME'] - it doesn't include the
http[s]:// at the start to make it a complete absolute url. It also
doesn't include your current directory (myWebSite) so even with
http:// at the start you'd end up with http://ip.address/company - not
what you want either.

You should probably have a variable or define for your application url
in your config file so you can:

print a href=' . APPLICATION_URL . /company'Company/a;

It's much safer this way than relying on any $_SERVER variables (which
believe it or not are suspect to XSS attacks/vulnerabilities).

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Join question

2007-11-30 Thread chris smith
On Dec 1, 2007 3:53 PM, Crayon Shin Chan [EMAIL PROTECTED] wrote:
 On Saturday 01 December 2007, tedd wrote:
  At 10:21 AM +0800 11/30/07, Crayon Shin Chan wrote:
  On Friday 30 November 2007, tedd wrote:
I'm trying to understand joins,
  
  Ask on a database related list.

  Really?

 Really.

Considering the rest of the off-topic questions that regularly get
asked on this list it's a bit much to single out this one particular
post.

javascript, css, html - none is directly related to php but all still
get asked here (and 99% of the time answered) - I don't know why
you're making such a big deal about this particular post and haven't
kicked up a fuss about the rest in the past.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Problem retrieving $_POST values

2007-11-13 Thread chris smith
On Nov 13, 2007 7:10 PM, Jon Westcot [EMAIL PROTECTED] wrote:
 Hi Chris:

  Exactly as you have there.
 
  print_r($_POST);
 
  will show you everything.

 Here's a section of what comes back when I do this:

 [mls] = 1234567
 [property_address] = Main St
 [city_arr] = Array
 (
 [0] = CHNDHT
 [1] = CHNDLR
 [2] = GILBER
 [3] = HIGLEY
 [4] = MESA
 [5] = TEMPE
 )

So it is there :)

print_r($_POST['city_arr']);

  How are you creating the field in your form?

 The three fields mentioned above on the form are specified thus:

snip
all looks good.

   Is there some (free g) way to test a php script outside of a web page?
 
  cmd line you can do:
 
  php -l /path/to/file.php

 Is this something I can access through SSH?  And will it show me errors 
 as the script executes?

Oops, I thought you meant for parse errors. That won't tell you about
anything else unfortunately.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Need a hint how to track an error

2007-11-12 Thread chris smith
On Nov 12, 2007 7:38 PM, Ronald Wiplinger [EMAIL PROTECTED] wrote:
 Chris wrote:
  Ronald Wiplinger wrote:
  My php program is working with Firefox, but not with Internet Explorer.
 
  Nothing to do with php, your problem is javascript.
 
  Is there a tool to find the problem?
 
  For IE, try
 
  http://www.microsoft.com/downloads/details.aspx?familyid=e59c3964-672d-4511-bb3e-2d5e1db91038displaylang=en
 
 

 Why do you guys assume javascript

Because you sent us javascript errors.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP] Re: [PHP-DB] Re: MySQL Identifying worst-performing codes

2007-11-08 Thread chris smith
On Nov 9, 2007 1:18 AM, Colin Guthrie [EMAIL PROTECTED] wrote:
 Lasitha Alawatta wrote:
  There is  a tool call idera (SQL diagnostic manager). Basically it is
  a performance monitoring and diagnostics tool.
 
  It has a feature;
  Identifying of worst-performing codes –
 
  Identifies performance bottlenecks such as the worst-performing stored
  procedures, long-running queries, most frequently run queries, SQL
  Statements and SQL batches
 
  http://www.idera.com/Products/SQLdm/Features.aspx
 
 
  I'm looking for a same like tool for MySQL. Is anyone have any  ideas.


 I know this is OT for this list but.

 In addition to the slow query logging I mentioned before (which you
 seemed to appreciate :)), I've just stumbled across this:
 http://rackerhacker.com/mysqltuner/

http://jeremy.zawodny.com/mysql/mytop/ might come in handy too.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Recommend a wiki?

2007-11-08 Thread chris smith
On Nov 9, 2007 8:02 AM, Skip Evans [EMAIL PROTECTED] wrote:
 Hey,

 Anyone want to recommend a wiki package they use
 to document PHP code projects, libraries, etc,
 they are happy with?

I quite like Doku (http://wiki.splitbrain.org/wiki:dokuwiki).

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] mail() silly question

2007-09-01 Thread chris smith
On 9/1/07, Rodrigo Poblanno Balp [EMAIL PROTECTED] wrote:
 I have a question that might be too silly for those of you who are PHP
 gurus.

 Here it comes:

 I had a mail (specifically in the headers) function call like this:

 $header = ;
 $header .= 'From: [EMAIL PROTECTED];
 $header .= 'MIME-Version: 1.0\r\n;
 $header .= 'Content-type: text/html; charset=iso-8859-1\r\n;
 $header .= Reply-To: .utf8_decode($nombreVar).
 .utf8_decode($apellidosVar).$mailVar\r\n;
 $header .= X-Mailer: PHP/.phpversion().\r\n;
 $header .= X-Priority: 1;

 and the mail(...) function always returned TRUE, but the mail was NOT sent.

 After hours of... trial/error debugging, I noticed from an example that
 it should be:

 $header = ;
 $header .= 'From: [EMAIL PROTECTED]' . \r\n;
 $header .= 'MIME-Version: 1.0' . \r\n;
 $header .= 'Content-type: text/html; charset=iso-8859-1' . \r\n;
 $header .= Reply-To: .utf8_decode($nombreVar).
 .utf8_decode($apellidosVar).$mailVar\r\n;
 $header .= X-Mailer: PHP/.phpversion().\r\n;
 $header .= X-Priority: 1;

 Question:

 Why? What's the real difference between
 $header .= 'From: [EMAIL PROTECTED]' . \r\n;
 and
 $header .= 'From: [EMAIL PROTECTED];

Actually that's a parse error ;) You have a single quote at the start
and double at the end.

Anyway, the reason is interpolation. See
http://www.php.net/manual/en/language.types.string.php

Under Single quoted:

.. escape sequences for special characters will not be expanded when
they occur in single quoted strings.

So you end up with a literal '\r\n' at the end of the line, not an
actual carriage return  newline that you expect.

-- 
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] How to pass connection as global variable ?

2007-07-11 Thread chris smith

On 7/11/07, clive [EMAIL PROTECTED] wrote:


 Hi Chris,

 I recreated a new connection in faq.php and it's working now.
 I had the impression that 1 connection could last during a user session,
 but apparently a user session may need many connections.

 Thanks again, Cor


Have a read on persistent connections


That won't help.

All that does is tell the database server to leave the connection
lying around *just in case* someone else decides that a connection is
needed.

http://php.net/mysql_pconnect explains it.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] linking to an image with document_root

2007-06-01 Thread chris smith

On 6/2/07, Richard Lynch [EMAIL PROTECTED] wrote:

On Fri, June 1, 2007 3:16 am, blueboy wrote:
 May be a stupid question but can I link to images with doscument root

 $img_url= $_SERVER['DOCUMENT_ROOT'].'/images/holder.gif';

 echo img src=\$img_url\ width=\250\ height=\163\/;

 I am certain the path is correct,

 If not what are my alternatives?

You could try if faster than you'll get an answer here, but, yes, you
could do that.

You may even want to set up a variable called $IMAGE_ROOT and set it
to $_SERVER['DOCUMENT_ROOT'] in a config/include file, so that if you
ever want to move all your images somewhere else, you only change one
line of code.


How's that going to help when the OP is using a *file path* as an image source ?

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Find MAC Address in PHP

2007-04-24 Thread chris smith

On 4/24/07, Tijnema ! [EMAIL PROTECTED] wrote:

On 4/24/07, Davi [EMAIL PROTECTED] wrote:
 Em Terça 24 Abril 2007 10:07, Tijnema ! escreveu:
  On 4/23/07, Davi [EMAIL PROTECTED] wrote:
   Em Domingo 22 Abril 2007 03:12, Richard Lynch escreveu:
On Fri, April 20, 2007 3:00 pm, Nathaniel Hall wrote:
 ?php $MAC = system(arp 192.168.200.254); echo $MAC; ?
 does not give me any
 output. I have copied arp to a place that the apache user can execute
 from and ensured arp is executable.
   
Use exec and the extra args to get error codes.
  
   ARP is a root-command... =]
 
  Ok, maybe it's because i've builded my own Linux, and didn't wanted to
  have any security, but /sbin/arp has chmod value 755 on my system, and
  so, i can execute it with any user.
 

 cheatter... =P

I hate security ;)
Also, i have Apache running as root, so i can execute everything i want :)


I hope you never make your server public then or try to become a
server-administrator.. Wow.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Find MAC Address in PHP

2007-04-24 Thread chris smith

On 4/25/07, Nathaniel Hall [EMAIL PROTECTED] wrote:

Davi wrote:
 Em Domingo 22 Abril 2007 03:12, Richard Lynch escreveu:

 On Fri, April 20, 2007 3:00 pm, Nathaniel Hall wrote:

 ?php $MAC = system(arp 192.168.200.254); echo $MAC; ?
 does not give me any
 output.  I have copied arp to a place that the apache user can execute
 from and ensured arp is executable.

 Use exec and the extra args to get error codes.


 ARP is a root-command... =]


 Can you run 'arp' and get what you want from command line?


 As web-user? No.


 Can you 'su' to PHP user and *then* run it and get what you want?


 Hum... Not at all... You need to enter the root password... How can you do
 that?
 sudo sounds a little better... But... How about security?

I know it can be done because I have a Fedora Core 4 system doing it
right now.  I didn't have to do anything special for it to work.  The
system I am working on now is a Fedora Core 6 box.  In /var/log/messages
I receive:

Apr 24 09:33:51 STUAUTH kernel: audit(1177425231.020:114): avc:  denied
{ execute } for  pid=31786 comm=httpd name=bash dev=dm-0 ino=916642
scontext=root:system_r:httpd_t:s0
tcontext=system_u:object_r:shell_exec_t:s0 tclass=file


If fixing up selinux doesn't work then look in to using 'sudo'. The
manpage(s) show examples about how to set it up to allow specific
commands to be run without a password.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] PhpMyAdmin slow on windows but fast on linux

2007-04-22 Thread chris smith

On 4/23/07, Don Don [EMAIL PROTECTED] wrote:

Hi all how can i make my phpmyadmin run fast on windows ?  I installed 
phpmyadmin on a linux and windows machines, but the windows version runs 
(executes) too slow, i.e. it takes to long for a page to be loaded, while it 
take less that 3 secs for the linux version.  Both however run on the same 
system config.


The phpmyadmin guys will be able to help you a lot better than we can:

http://sourceforge.net/mail/?group_id=23067

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Zend Guard Performance Problem

2007-03-28 Thread chris smith

On 3/28/07, Sancar Saran [EMAIL PROTECTED] wrote:

On Wednesday 28 March 2007 11:36, Chris wrote:
 Sancar Saran wrote:
  Hi,
 
  Recently we bought Zend Guard and because of Zend encoder we have to use
  another Opcode cacher other than APC.
 
  After searching net I found eAccelerator.
 
  After installing eAccelerator with Zend Guard I saw more than %30 percent
  performance lost against Normal PHP + APC.

 Wouldn't it be better to talk to Zend directly about this? Since you've
 purchased their software they give you support and are pretty helpful.


Really ???,

Owww how can I miss this

Maybe you did not notice they sell own Expensive opcode cache...

If I understand your point of view, I can guess  your reply. If you had rich
enogh to buy a encoder, you can buy that zend cache.


If you have a performance drop of that much something is going wrong
with the interaction between zend  apc.

Two sets of people can solve this:

- zend
- apc.

Zend is the obvious choice because they have access to their source code.

Plus you paid for their software - which includes support.

They might just go Option X in APC doesn't work well with Zend Guard
- change this setting

Or they might go Hey, that's really crap, no idea what's going on
there - give us access to your server or send us a backtrace

Or they might say something else.

You don't know until you ask.
--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] where match question

2007-01-23 Thread chris smith

On 1/23/07, Németh Zoltán [EMAIL PROTECTED] wrote:

On h, 2007-01-22 at 22:53 -0800, Jim Lucas wrote:
 Don wrote:
  I have a db field that contains zip codes separated by comas.
 
  I am trying to get php to return all of the rows that contain a particular
  zip code.
 
 
 
  $query = SELECT * FROM info WHERE MATCH (partialZIP) AGAINST ('$zip');

 try this

 $query = SELECT * FROM info WHERE column LIKE '{$zip}';

I would use

$query = SELECT * FROM info WHERE LOCATE('{$zip}', column)  0;


And how are you going to index that? That's going to be extremely slow
as the size of the table grows.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] where match question

2007-01-23 Thread chris smith

On 1/23/07, Jim Lucas [EMAIL PROTECTED] wrote:

Németh Zoltán wrote:
 On k, 2007-01-23 at 19:46 +1100, chris smith wrote:
 On 1/23/07, Németh Zoltán [EMAIL PROTECTED] wrote:
 On h, 2007-01-22 at 22:53 -0800, Jim Lucas wrote:
 Don wrote:
 I have a db field that contains zip codes separated by comas.

 I am trying to get php to return all of the rows that contain a particular
 zip code.



 $query = SELECT * FROM info WHERE MATCH (partialZIP) AGAINST ('$zip');
 try this

 $query = SELECT * FROM info WHERE column LIKE '{$zip}';
 I would use

 $query = SELECT * FROM info WHERE LOCATE('{$zip}', column)  0;
 And how are you going to index that? That's going to be extremely slow
 as the size of the table grows.


 well, yes.

 better solution is to not store the zip codes in one field with commas,
 but in a separate table which relates to this one. and then you could
 use a query like

 $query = SELECT t1.*, t2.* FROM info t1, zips t2 WHERE t1.id=t2.infoid
 AND t2.zip = '{$zip}';

 greets
 Zoltán Németh

But, since the op is working with existing data, what is the performance
difference between using LIKE or LOCATE?

Pro's vs. Con's


This is getting pretty OT but that's my fault... so I'll post this and
if anyone has any questions send them off-list ;)

This stuff isn't mysql specific, it should be the same across all types of db's.

This:

LIKE '{$zip}'

will be able to use an index on the field because there are no
wildcards involved, so it's much the same as field='{$zip}'. I have no
idea if databases can make this conversion internally, but in theory
it should be the same.

If it's like this:

like '{$zip}%'

that means $zip is at the start of the field and you could use a
partial index (eg on the first 10 characters of the field, search
relevant database docs for how to do that).

If it's like this:

like '%{$zip}'

then $zip is at the end of the field and you'd probably benefit from
creating an extra database field, reversing the last X characters,
creating an index and using that for searching (and create a database
trigger to keep it up to date).

If it's like this:

like '%{$zip}%'

there's not much of a chance for that to use an index because the
string can be anywhere in the field.

LOCATE will be much the same as this because it has to find the string
somewhere in the whole field, then return it's position. Actually it
will probably be a lot worse because of that.

Hopefully that makes things as clear as mud! ;)

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] How to Separate PHP Errors to a file different than Apache Errors

2006-12-22 Thread chris smith

On 12/23/06, Shanon Swafford [EMAIL PROTECTED] wrote:

Hi Guys,

I just cut my website over to Apache2 and PHP5 on FC5.

So now I'm clean up all the PHP Notices.

Does anybody know the config directives I can put in my /etc/php.ini or
etc/httpd/conf.d/php.conf or /etc/httpd/conf/httpd.conf so that I could
separate the php errors file from the apache errors file?


http://www.php.net/manual/en/ref.errorfunc.php

Specifically 'error_log'.

This will be commented out in a default php.ini file, search for it
there, enable it and restart your webserver.

Also the webserver user has to 'own' this file (as with it's other
logs), so check permissions.
--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] random selection from each subfolder

2006-12-21 Thread chris smith

On 12/22/06, Steven Macintyre [EMAIL PROTECTED] wrote:

Ok ... previous problem sorted ... now onto the next ...

The client wants the following;

A scroll bar with 3 random thumbs from each subdirectory in the /images/
folder

I was thinking ...

Going into each folder, getting files, pushing into an array - shuffling
array, taking first three items and combine it to a master array and use
that ...


As you get more  more images this will slow down, might take a while
but it will happen eventually.

Are you storing any info about images in a database (even just the
name and folder they appear in) ? You could use that to your
advantage..

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Shopping Cart

2006-10-28 Thread chris smith

I don't appreciate being scolded.


Spend some time on the list and see how many times this question (or
type of question) gets asked and how many people actually do *some*
sort of work for themselves and you'll appreciate why people ask this
straight away.

If you had said I found product X  Y but they don't fit what I need
then we at least know you've made an effort to do a little research
for yourself.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] User question for PHP

2006-10-20 Thread chris smith

On 10/20/06, Ivo F.A.C. Fokkema [EMAIL PROTECTED] wrote:

On Fri, 20 Oct 2006 15:49:14 +1000, Chris wrote:

 Andy Hultgren wrote:
 To whoever was asking this (sorry didn't see the original email):

 Is it possible to have a PHP script execute as the user of the domain
 instead of the webserver? So when I upload files through a PHP script
 they are owned by me and not wwwrun or nobody?

 I was recently exchanging on this list about that very topic.  It's in the
 archives for this list.  Go to www.php.net and set the dropdown menu in the
 upper right corner of the page to general mailing list, then type File
 Upload Security and chmod into the search field and hit enter.  The
 conversation is within the first few hits on this search.
 The server hosting my site runs with php executing as me (the owner of
 the
 domain), and we covered some of the potential security pitfalls of such a
 situation (mainly centered on the fact that this makes any php script far
 too powerful).  In my situation I couldn't change how the server was set
 up;
 however, the general consensus was that this situation created a number of
 serious security concerns that had to be very carefully addressed.  I would
 avoid this configuration if you have the choice, based purely on the advice
 I received.

 Actually you have that the wrong way around.

 If php is running as www or nobody then any files or directories
 that a php script creates will be done as the web server user.

 That means (potentially) that if domain 'a' creates a file, domain 'b'
 can read and write to that file and even delete it.


 If php is running as you instead, you can control this with appropriate
 chmod commands (at least removing the risk of deleting of files /
 updating of files).

 A shared user (like www or nobody) is a *much* bigger risk than
 separate users.

Unless those separate users have a little more access than just SSH
and FTP access to the machine... I guess that if anyone with special
rights carelessly activates suPHP and leaves the PHP files owned by him,
you'd have PHP scripts capable of reading out special log files and
whatnot.

To my experience, apache (with PHP running as www-data or nobody or
whatever) will not be able to create files or folders without user
intervention (chmod, chown), thus no updating and removing is possible
either by default.


php running through apache:

?php
mkdir('/path/to/dir');
?

Making that in a shared location will allow *any* domain to write to
it, read from it or delete it (forget about possible open_basedir
restrictions).

Running as cgi you don't get that problem.

I could be completely misunderstanding what suPHP does.
--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] User question for PHP

2006-10-20 Thread chris smith

On 10/21/06, Ivo F.A.C. Fokkema [EMAIL PROTECTED] wrote:

On Fri, 20 Oct 2006 23:24:14 +1000, chris smith wrote:

 On 10/20/06, Ivo F.A.C. Fokkema [EMAIL PROTECTED] wrote:
 On Fri, 20 Oct 2006 15:49:14 +1000, Chris wrote:

  Andy Hultgren wrote:
  To whoever was asking this (sorry didn't see the original email):
 
  Is it possible to have a PHP script execute as the user of the domain
  instead of the webserver? So when I upload files through a PHP script
  they are owned by me and not wwwrun or nobody?
 
  I was recently exchanging on this list about that very topic.  It's in the
  archives for this list.  Go to www.php.net and set the dropdown menu in 
the
  upper right corner of the page to general mailing list, then type File
  Upload Security and chmod into the search field and hit enter.  The
  conversation is within the first few hits on this search.
  The server hosting my site runs with php executing as me (the owner of
  the
  domain), and we covered some of the potential security pitfalls of such a
  situation (mainly centered on the fact that this makes any php script far
  too powerful).  In my situation I couldn't change how the server was set
  up;
  however, the general consensus was that this situation created a number of
  serious security concerns that had to be very carefully addressed.  I 
would
  avoid this configuration if you have the choice, based purely on the 
advice
  I received.
 
  Actually you have that the wrong way around.
 
  If php is running as www or nobody then any files or directories
  that a php script creates will be done as the web server user.
 
  That means (potentially) that if domain 'a' creates a file, domain 'b'
  can read and write to that file and even delete it.
 
 
  If php is running as you instead, you can control this with appropriate
  chmod commands (at least removing the risk of deleting of files /
  updating of files).
 
  A shared user (like www or nobody) is a *much* bigger risk than
  separate users.

 Unless those separate users have a little more access than just SSH
 and FTP access to the machine... I guess that if anyone with special
 rights carelessly activates suPHP and leaves the PHP files owned by him,
 you'd have PHP scripts capable of reading out special log files and
 whatnot.

 To my experience, apache (with PHP running as www-data or nobody or
 whatever) will not be able to create files or folders without user
 intervention (chmod, chown), thus no updating and removing is possible
 either by default.

 php running through apache:

 ?php
 mkdir('/path/to/dir');
 ?

 Making that in a shared location will allow *any* domain to write to
 it, read from it or delete it (forget about possible open_basedir
 restrictions).

I see your point and I agree this is an issue, but given the
relatively small incidence of such a situation, I personally would not say
this is a much bigger problem than a PHP file being able to remove all
other files owned by the same owner (i.e. usually the whole site at least)...


Running it as separate users removes safe-mode problems (the file
uploaded will be as www or nobody, the script trying to access it
is user), stops you having to have '777' type permissions on temp
or data directories, user a can't do anything to user bs files
and so on. Plus if your domain gets hacked through php, they can
*only* do damage to your domain. They'd have to hack the other domains
on the server because they are owned by different users...

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] User question for PHP

2006-10-20 Thread chris smith

On 10/21/06, Jochem Maas [EMAIL PROTECTED] wrote:

chris smith wrote:
 On 10/21/06, Ivo F.A.C. Fokkema [EMAIL PROTECTED] wrote:
 On Fri, 20 Oct 2006 23:24:14 +1000, chris smith wrote:

  On 10/20/06, Ivo F.A.C. Fokkema [EMAIL PROTECTED] wrote:



 
  To my experience, apache (with PHP running as www-data or nobody or
  whatever) will not be able to create files or folders without user
  intervention (chmod, chown), thus no updating and removing is possible
  either by default.
 
  php running through apache:
 
  ?php
  mkdir('/path/to/dir');
  ?
 
  Making that in a shared location will allow *any* domain to write to
  it, read from it or delete it (forget about possible open_basedir
  restrictions).

 I see your point and I agree this is an issue, but given the
 relatively small incidence of such a situation, I personally would not
 say
 this is a much bigger problem than a PHP file being able to remove all
 other files owned by the same owner (i.e. usually the whole site at
 least)...

 Running it as separate users removes safe-mode problems (the file
 uploaded will be as www or nobody, the script trying to access it
 is user), stops you having to have '777' type permissions on temp
 or data directories, user a can't do anything to user bs files
 and so on.

but php and the webserver now has full rights over all your files not just
a few of your designated data files. e.g.

exec('rm ~/.ssh/*'); // nice


As nice as

exec('find / -type f | xargs rm -f');

as a shared user ;) Which one does more damage?

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] syntax error help

2006-08-20 Thread chris smith

On 8/20/06, Bigmark [EMAIL PROTECTED] wrote:

Can anyone tell me why this works on my localhost but gets an error on my
server:

?php
$sql = SELECT COUNT(*) FROM leaderboard WHERE points =( SELECT points FROM
leaderboard WHERE username= '$username' );
$result = mysql_query( $sql ) or die ( mysql_error() );
$rank = mysql_result( $result, 0 );
echo $rank;
?


this is the error message but i cant figure it out:

Your Position  You have an error in your SQL syntax. Check the manual that
corresponds to your MySQL server version for the right syntax to use near
'SELECT points FROM leaderboard WHERE username= 'ainslie' )' at


They are different mysql versions.

Your localhost version is 4.1+ which supports sub-selects, the other
one is 4.0 or below.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] active directory and PHP

2006-08-17 Thread chris smith

On 8/17/06, Alain Roger [EMAIL PROTECTED] wrote:

Hi,

I'm new to PHP, so sorry if my question looks like stupid.

I have a web application which use authorization and authentication process
to log-in.
I would like to know if it exists a way to synchronize the authentication
with our Active Directory domain ?


You sure can.

Check out http://www.php.net/ldap

Even though they are ldap functions they can connect/talk to active
directory servers.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Image Destroy

2006-08-15 Thread chris smith

On 8/15/06, Tom Chubb [EMAIL PROTECTED] wrote:

I know this will be really simple, but I'm struggling to get my head round
the use of imagedestroy()
I have some code which uploads an image, resizes to create a smaller image
and thumbnail then deletes the source image.
My question is which images need to be destroyed?


Straight from the manual:
imagedestroy() frees any memory associated with image image. image is
the image identifier returned by one of the image create functions,
such as imagecreatetruecolor()

So any time you call imagecreate* functions you need to also do an imagedestroy.

In your case you need to add

imagedestroy($target_id);
imagedestroy($source_id);


just before

imagejpeg ($target_id,$targetfile,$jpegqual);
return true;
}


--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Image Destroy

2006-08-15 Thread chris smith

On 8/15/06, chris smith [EMAIL PROTECTED] wrote:

On 8/15/06, Tom Chubb [EMAIL PROTECTED] wrote:
 I know this will be really simple, but I'm struggling to get my head round
 the use of imagedestroy()
 I have some code which uploads an image, resizes to create a smaller image
 and thumbnail then deletes the source image.
 My question is which images need to be destroyed?

Straight from the manual:
imagedestroy() frees any memory associated with image image. image is
the image identifier returned by one of the image create functions,
such as imagecreatetruecolor()

So any time you call imagecreate* functions you need to also do an imagedestroy.

In your case you need to add

imagedestroy($target_id);
imagedestroy($source_id);


just before

imagejpeg ($target_id,$targetfile,$jpegqual);
return true;
}


Oops! Move those imagedestroy calls after imagejpeg but before the return ;)

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Upload files problem with IIS server

2006-08-04 Thread chris smith

On 8/5/06, Mace Eliason [EMAIL PROTECTED] wrote:

Hi,

I am having problems with uploading files to a windows server using
php.  I have used the same script on other server with no problems.

 From what I can tell this new server is running windows with IIS.  I
think the problem is with the path.

Does anyone have any suggestions?  Here is a snipet of some of the code.

$uploadDir =  /gamestats/;

  $uploadFile = $uploadDir . $_FILES['bannerfile']['name'];
  echo $bannerfile . br;  /* added for testing */
  echo $uploadDir . br; /* added for testing */
  echo $uploadFile . br; /* added for testing */

  if (move_uploaded_file($_FILES['bannerfile']['tmp_name'], $uploadFile))
  {
 ..


and the errors you get are... ?

check the folder is writable:

echo is_writable:  . is_writable($uploadDir) . br/;

Is that the whole code? I doubt this would work on linux platforms
either because your script will not be able to create /gamestats (ie
in the / folder, not in your /home/httpd/domain.com folder or
where-ever it is).

IIS needs the destination folder marked with 'modify' permissions in
IIS so you can create and delete files, maybe that's the problem.
--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] memory leak - how to find it?

2006-07-31 Thread chris smith

On 7/31/06, Robin Getz [EMAIL PROTECTED] wrote:

I am trying to debug a php script that I downloaded, which has a memory
leak in it.

I was looking for a way to find what variables were in php's memory, and
what size, they were, but I couldn't find anything?

The script is a off-line wiki conversion tool (walks through a wiki to
create a bunch of html files for off line viewing). As the tools walks the
files, and does the conversion, I can see the memory consumption go up and
up as it walks the files, until it hits the mem limit, and crashes.


Depending on how big the wiki is, if it's creating references to
other files it will need a lot of memory to remember all the different
links it has to create (phpdocumentor has a similar issue/reason).

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Nested foreach statement

2006-07-31 Thread chris smith

foreach($_POST['reporton_company'] as $cmp_ind =$arrayd_cmp_id) {
foreach($_POST['report_period'] as $rep_ind =$arrayd_per_id) {
foreach($_POST['questions_groups'] as $group_ind = 
$arrayd_group_no) {
mysql_select_db($database_name, $dname);


Why do that here? That's going to do it for each element in the
arrays, lots of overhead!

Move that outside the first loop.

I'd probably leave it as it is and make sure your data is what you
expect, ie use mysql_real_escape_string in appropriate places.

You could clean up one loop by doing this:

$query_get_list_of_answers = SELECT * FROM answers LEFT JOIN
(questions, period) ON (questions.id=answers.ans_l_question_id AND
period.per_id=ans_l_period_id) where ans_l_company_id =
'$arrayd_cmp_id' AND per_id = '$arrayd_per_id' AND group_no IN ( .
implode(',', $_POST['questions_groups']) . );

but if I can enter dodgy values in the questions_groups form field,
you're hosed.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Class ADODB - Method GenID() in MySQL

2006-07-19 Thread chris smith

On 7/19/06, Renne Rocha [EMAIL PROTECTED] wrote:

  Hello,

  I am using the ADODB class to connect to a MySQL server. I am trying
to generate an ID with the method GenID(), but when I tried this:

  $id = $db-GenID('table');

  The value of $id is equal to zero. I know that MySQL doesn't use
sequences like PostgreSQL does (I've used this code in a PostgreSQL
project), but in the documentation of ADODB I saw that it is possible
to use it. Is there any trick about how to make it work?


You'll need to insert a value into the table first, then you can do:

$query = UPDATE tablename SET id=LAST_INSERT_ID(id+1);
$result = mysql_query($query);
$id = mysql_insert_id();

This is in the mysql docs somewhere...

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] require_once and E_WARNING?

2006-07-06 Thread chris smith

On 7/6/06, Martin Marques martin@bugs.unl.edu.ar wrote:

On Wed, 5 Jul 2006, [EMAIL PROTECTED] wrote:

 Hello all,

 According to the PHP Manual, when require or require_once failes, an
 E_ERROR is triggered: require() and include()  are identical in every way
 except how they handle failure. include() produces a Warning while
 require() results in a  Fatal Error. (With 'Fatal Error' being a link to
 E_ERROR).

 Thing is, when using a custom error handler via set_error_handler(), it
 appears to be triggering an E_WARNING, not an E_ERROR. Using PHP 5.1.4
 under Linux.

 There are one of three possibilities: I am suffering from a lapse in
 lucidity (common), the manual is wrong (possible), or PHP is broken
 somehow (unlikely). I'm guessing it's the first, but what am I doing
 wrong? I'd like to get a second opinion before submitting a bug. I
 searched bugs.php.net but was unable to find anything relevant for 5.1.4.

 Code:
 function default_error_handler($code, $error, $file, $line) {
   switch ($code) {
   case E_ERROR:
  die (Error: $error);
   case E_WARNING:
  die(Warning: $error);
   default:
  die(Something else entirely: $error);
   }
 }

What happens if you put breaks after the die()? This shouldn't be
necesary, but it wouldn't hurt to try. ;-)

As I see in the example of the PHP manual, a break is put even after an
exit(1) call.

 set_error_handler('default_error_handler');
 require('This file does not exist. At least not here!');

Have you tried this handler with something more fatal, like a missing
semi-colon or a } missmatch?


That will cause a parse error and the script won't even run.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Job Opportunities in Web Design company

2006-07-02 Thread chris smith

On 7/2/06, Kevin Waterson [EMAIL PROTECTED] wrote:

This one time, at band camp, tedd [EMAIL PROTECTED] wrote:

 I certainly could have designed/coded a better page, and site, than that -- 
does that count?

 My advice, if you're looking for qualified and experienced help, then reflect 
same in your site.

Had not actually looked at the site, ick..
and, umm, some security on those forms would possibly help.


That would probably explain the job position ;)

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] IMAGECOPYRESIZED(); DOESN'T WORK...

2006-07-01 Thread chris smith

On 7/1/06, BBC [EMAIL PROTECTED] wrote:

I thought I have typed this function correctly, and I didn't know why my
browser couldn't run these script :
?php
$filename = 'test.jpg';
$percent = 0.5;
header('Content-type: image/jpeg');
list($width, $height) = getimagesize($filename);
$newwidth = $width * $percent;
$newheight = $height * $percent;
$thumb = imagecreatetruecolor($newwidth, $newheight);  //1*ERROR
$source = imagecreatefromjpeg($filename);  //2*ERROR
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width,
$height); //3*ERROR
imagejpeg($thumb);
?
and the error output is : call to undefined function
btw, I'm using PHP 4.1.1. Is there any possible that my PHP version can not
run those script?
So, what is the best solution for my problem..?


PHP doesn't have the GD library installed or loaded.

Create a phpinfo page:

?php
phpinfo();
?

there needs to be a big GD section.
--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] ONE PAGE CONNECTS MANY DATABASE

2006-07-01 Thread chris smith

On 7/1/06, BBC [EMAIL PROTECTED] wrote:

Yes I'm using MySQL and the DataBases I mean are in different servers
but the problem is I don't know how to set the host.
All input will be very helpful...


Read the documentation, it's all there.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Quick Question re: Windows/Linux PHP

2006-07-01 Thread chris smith

On 7/1/06, Beauford [EMAIL PROTECTED] wrote:

Hi,

I'm just curious, because I come across this from time to time.

Why does the code below work on Windows and not on Linux. PHP is 5.0 on
Linux and 4.4 on Windows (still can't get 5 on Windows). The code at the
very bottom is how I got it to work on Linux. Also, why is it with the same
setup I can't call a function within a function in Linux, but can in
Windows. Sorry I don't have the error, but something about calling a static
function. Would this be a difference between OS's or with the different
versions of PHP?


You'll have to narrow down what you're having issues with before
anyone will take a look. Is it the regex? Is it lines x - y?

Of course you can call a function within a function in linux. We can't
help debug that without at least the code and the error.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] global class instance

2006-07-01 Thread chris smith

On 7/1/06, sempsteen [EMAIL PROTECTED] wrote:

hi all,
i wonder if there is a way of creating an instance of a class and
reach it direcly from any scope in PHP4. basically what i want is:

class a
{
   function print()
   {
  echo 'sth';
   }
}

$a = new a();

and use this a instance from anywhere ex, in a function that is a
method of another class.

class b
{
   function print()
   {
  $a-print();
   }
}

i don't want to:
   - declare global $foo,
   - use pre-defined $GLOBALS variable,
   - or use a::print


Then you're out of luck.

$a doesn't exist inside class b, how is it supposed to know what $a is ?

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] global class instance

2006-07-01 Thread chris smith

On 7/1/06, chris smith [EMAIL PROTECTED] wrote:

On 7/1/06, sempsteen [EMAIL PROTECTED] wrote:
 hi all,
 i wonder if there is a way of creating an instance of a class and
 reach it direcly from any scope in PHP4. basically what i want is:

 class a
 {
function print()
{
   echo 'sth';
}
 }

 $a = new a();

 and use this a instance from anywhere ex, in a function that is a
 method of another class.

 class b
 {
function print()
{
   $a-print();
}
 }

 i don't want to:
- declare global $foo,
- use pre-defined $GLOBALS variable,
- or use a::print

Then you're out of luck.


Actually you could pass it in:

function print($a) {
 $a-print();
}

but thats going to cause you lots of pain if you call it a lot (ie you
forget to pass it in everywhere).

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] mysqli_stmt::bind_param(), Number of variables doesn't match number of parameters in prepared statement

2006-06-30 Thread chris smith

On 7/1/06, gg15 [EMAIL PROTECTED] wrote:

I wanted to use the prepared statements of mysqli, but the following
problem occured:

If I just use one parameter everything works fine
$prep = $this-mysqli-prepare('INSERT INTO guestbook (Von, Datum)
VALUES (?, NOW())');
$prep-bind_param('s', $this-Von);

but if I try to use two
$prep = $this-mysqli-prepare('INSERT INTO guestbook (Von, Betreff,
Datum) VALUES (?, ?, NOW())');
echo $prep-param_count; // echos 2
$prep-bind_param('ss', $this-Von, $this-Betreff);

I get an error
Warning: mysqli_stmt::bind_param() : Number of variables doesn't
match number of parameters in prepared statement in ...


Is $this-Betreff empty? I wonder if its having issues with an empty var..

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Controlling a scanner with PHP

2006-06-27 Thread chris smith

On 6/27/06, George Pitcher [EMAIL PROTECTED] wrote:

Hi,

I have been asked to look at extending one of my CMS systems to incorporate
integration to a library management system, as well as LDAP and Active
Directory. The requirement also asks for scanning and OCR of documents to be
controlled by the CMS.

Does anyone have any experience of implementing the scanning into a PHP
application?


There *might* be something on the gtk side of things:

http://gtk.php.net/

I highly doubt it, but worth a look.

That's not going to help you do anything from a web server though,
php-gtk apps run from a desktop.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] FTP Problems

2006-06-27 Thread chris smith

On 6/27/06, James Nunnerley [EMAIL PROTECTED] wrote:

I'm trying to create some functionality which requires FTPing onto another
server, using the php functions.

Doing the following comes up with a successful login, but cannot display the
current directory; yet when I FTP directory from the server which is serving
the php pages, it works fine.

// set up basic connection
$conn_id = ftp_connect($ftp_server, 21);
ftp_pasv($conn_id, true);

// login with username and password
$login_result = ftp_login($conn_id, $username, $password);

// check connection
if ((!$conn_id) || (!$login_result)) {

echo FTP connection has failed!;
echo Attempted to connect to $ftp_server for user $usernamebr /;
exit;

} else {

echo Connected to $ftp_server, for user $usernamebr /;

}

echo(ftp_pwd($conn_id).br /); # Comes back with /

$buff = ftp_nlist($conn_id,);


ftp_nlist requires a directory name. A blank string is not a directory name.

http://au.php.net/ftp_nlist

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] GD problems

2006-06-23 Thread chris smith

On 6/24/06, Beauford [EMAIL PROTECTED] wrote:


Here's something else I just noticed. When I run the script below in Windows
it works fine, in Linux I get this error:

Fatal error: Call to undefined function bcmod() in
/usr/local/apache/htdocs/home/cap.php on line 62


David told you about this 3-4 replies ago.

http://marc.theaimsgroup.com/?l=php-generalm=115095875203362w=2

bcmod is a bcmath function, if you don't have bcmath installed you
can't use that function.

http://www.php.net/manual/en/ref.bc.php

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Extracting XMP tags from pictures

2006-06-23 Thread chris smith

On 6/24/06, Dotan Cohen [EMAIL PROTECTED] wrote:

I have successfully extracted IPTC tags from jpegs, but now that I've
switched to F-spot I need to extract XMP data. I have found this:
http://www.ozhiker.com/electronics/pjmt/library/documentation/

But I have been so far unable to extract the tags. I have an example image here:
http://dotancohen.com/xmp_test.jpg
This image has the comment This is a comment and two tags:
People-Yehuda and Place-Sarid.

Has anybody invented a wheel to extract these tags and comment as
strings? I'd love to see it if so.


This link:
http://www.photography-on-the.net/ee/beta/cs_xmp_to_exif.php

was on this page:
http://www.php.net/manual/en/function.exif-read-data.php

The manual usually has something useful.
--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] GD problems

2006-06-23 Thread chris smith

On 6/24/06, Beauford [EMAIL PROTECTED] wrote:

Honestly, I've never seen anything so ridiculous. How is one to know that in
order to get one program to work you have to install 28 others. I'm not
trying to be a smart ass here, but seriously - No where in any documentation
I've read does it say I need to install all these other packages. Would it
just not be simpler to add them to the original package, and then check
whether or not it's installed - if not, install it. Or at the very least
include all the packages needed and the user can install them if need be. By
the way, I never saw Marks post - it might have saved me some time if I had
though.


Complain to the author(s) of the scripts. GD doesn't need bcmath, that
script does.
--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Stream download problem

2006-06-21 Thread chris smith

On 6/21/06, Michael Satterwhite [EMAIL PROTECTED] wrote:

Jochem Maas wrote:
 Michael Satterwhite wrote:

Prathaban Mookiah wrote:

Micheal,

I ran into this problem too. A easy workaround is to right click and
choose 'save as' which worked for me.

I wish that would work. The URL is along the lines of
a href=easy.php?download=streamdltype=full - and it's this that gets
substituted for the filename. It reports that it cannot be written to
the cache.


 is possible for you to change the way the URL is written so that it looks
 like so:

 easy.php/fakepdfname.pdf?download=streamdltype=full

I don't think so (although I'll do some checking). I don't have the
ability to configure apache on this server.


Use mod_rewrite rules in a htaccess file, you don't need apache access.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Need to recompile php 4.3.4

2006-06-16 Thread chris smith

On 6/17/06, Mauricio Pellegrini [EMAIL PROTECTED] wrote:

Hi ,
In order to enable bcmath I need to recompile php 4.3.4 on suse 8.2.


but , I would like to preserve the actual installation just in case
anything goes wrong ( as this is my production server)

What files should I backup / restore if after compilation php is not
working?


My actual installation consists of php 4.3.4 With the Zend Optimizer
and apache 1.329


Install them in different paths (configure --prefix=...), it will make
it a lot easier.

If you installed originally from rpms, you should be able to find
where it put stuff (rpm -qpl php I think).. If you compiled then
phpinfo will show you the original prefix and you can backup that
structure.

Not sure whether ZO will cope with that, but I guess you'll soon find out ;)

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Session puzzle... / why no new session?

2006-06-09 Thread chris smith

On 6/10/06, Ryan A [EMAIL PROTECTED] wrote:

Hi,

I am working on a very simple script, basically adding
features to an older script, I'll write down the main
parts:


?php
ini_set('session.name', 'COSTREAM_SESSION');
session_start();

## authenticate user code comes here

## log the user
my_log(login,$user,$_REQUEST['COSTREAM_SESSION']);

?

and for logout.php I have:
-
ini_set('session.name', 'COSTREAM_SESSION');
session_start();
unset($_SESSION['user']);
session_destroy();
-- redirect user comes here
-

but when I check the DB the session id is always the
same hash, I should be getting new hashes everytime I
login right? I am running the logout script before
logging in again...why is it always giving me the same
hash?


If you're logging straight back in after logging out, maybe not - the
browser might remember the old session. If you log out, close the
browser then go to the login page you should get a new id. If you want
to guarantee a new id, use http://php.net/session_regenerate_id

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Tables vs. databases

2006-06-09 Thread chris smith

On 6/10/06, Antonio Bassinger [EMAIL PROTECTED] wrote:

Hi gang,

Situation:

I've a HTTP server. I intend to run a file upload service. There could be up
to 1 subscribers. Each saving files up to 10 MB.

I made a proof-of-concept service using PHP  MySQL, where there is a single
database, but many tables - a unique table for each subscriber. But I
realize that I may land in trouble with such a huge database. Would it be
better to have a separate database for each subscriber?


On top of the replies you already have you should read these pages:

http://arjen-lentz.livejournal.com/66547.html
http://bobfield.blogspot.com/2006/03/million-tables.html

Though you're not talking about those sort of numbers, you need to be
aware of those limitations (there were more posts on planetmysql.org
about this but I can't find the original page).

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Restrict uploaded scripts

2006-06-08 Thread chris smith

On 6/8/06, Mathias Bundgaard Svesson [EMAIL PROTECTED] wrote:

Hi!
I'm trying to create a CMS where it should be posible to upload script
modules. Those modules should mostly be made by myself, but it is
posible for others to create scripts too. My question is, is it posible
to restrict the modules to their own directory so they don't overwrite
some of the other modules or the CMS itself?


Restrict them to do what exactly?

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] ADODB store session to database

2006-06-07 Thread chris smith

On 6/7/06, weetat [EMAIL PROTECTED] wrote:

Hi all ,

   I am having problem in store session in the database . Below is the
example code from code.


Ask the adodb guys.

http://adodb.sourceforge.net/#mail

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] better way to create custom text file from query results?

2006-06-07 Thread chris smith

On 6/7/06, Ben Liu [EMAIL PROTECTED] wrote:

Hello All,


snip


It seems that there has to be a better way of doing this. Can the
$_POST superglobal be manipulated in this way:

foreach ($_POST as $fieldname) ?


Yes, that will work.

If in doubt give something a try. :)

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Re: Retrieving Content

2006-06-03 Thread chris smith

On 6/3/06, Adam Zey [EMAIL PROTECTED] wrote:

Rodrigo de Oliveira Costa wrote:
 I just discovered the problem I have to retrieve the output of the
 site and not the url since its dynamic. Ca I do it like retrieve the
 output of this url:

 www.tryout.com/1/2/

 And of course store it on a variable? How to do it? I founr the func
 below but couldnt understand how to make it work with a url.

 Thanks guys,
 Rodrigo


 ob_start();
 include('file.php');  //  Could be a site here? What should I do to
 retrieve it from an url?
 $output = ob_get_contents();
 ob_end_clean();
Umm. As I said, just use file_get_contents():

$file = file_get_contents(http://www.tryout.com/1/2/;);


Assuming allow_url_fopen is on.

If not, you could try using curl - see http://www.php.net/curl

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] mail function in 4.2.2

2006-06-01 Thread chris smith

On 6/1/06, Aaron Todd [EMAIL PROTECTED] wrote:

I am working with a server that has version 4.2.2 on it.  I know...I
know...its old.  Its my ISPs server so I don't have too much control over
it.

Anyway,  I am seeing a problem where when I use the mail function to send
out an email only some of the messages get to the destination.  I wrote a
simple test script that runs through a loop and is supposed to send out five
emails.  Usually only one or two of the emails make it.  And on top of that
its not always the first two that get sent.  Here is my test script.  I also
have tried using the sleep command to give it 5 seconds between each email
thinking maybe it was a time thing.

for($i=0;$i5;$i++){
echo $i.br;
mail([EMAIL PROTECTED],test_.$i, test_.$i);
sleep(5);
}

Is there something with this version of PHP that could be effecting the mail
function.  I checked the change log and there has been some improvements to
the mail function, but not much detail on why the changes were necessary.
Just wondering if I have come across an old bug or something.

I've already asked my ISP to upgrade this server so if that's the solution
its on its way to being fixed.  Is there anything else that could be wrong?


Ask the isp if they have mail throttling set up - apart from that
you'll need to work with them to get this fixed. They can access the
mail logs..

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] $_FILES doesn't work but $_POST works

2006-05-31 Thread chris smith

On 5/31/06, kartikay malhotra [EMAIL PROTECTED] wrote:

Thanks for your replies.

1. Did you put the enctype=multipart/form-data into the FORM tag?
Ans: I do not have a form! I'm using a gateway utility to upload files

From documentation of Mbuni MMS gateway:

post-url
Response content is obtained as result of sending a HTTP POST request to the
provided URL. The POST message is *always* encoding (such as that used by a
web browser when an HTML form has the submitted using the
multipart/form-dataenctype=multipart/form-data parameter set). If
http-post-parameters field is given (see below), then the relevant
parameters are sent as part of the request. *X-Mbuni* headers are sent as
well.


http-post-parameters
Used in conjunction with post-url. Parameters are provided in the same way
as would be provided in an HTTP GET request (e.g. *
message=truemyname=testimage=%i*).

2.  Have you tried simply saving $_POST['userfile'] to a file?

 $save = $_POST['userfile'];
 $f=fopen($out,'a');
 copy($save, $out);


Files don't go into $_POST - they go into $_FILES.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] how include works?

2006-05-30 Thread chris smith

On 5/30/06, Arno Kuhl [EMAIL PROTECTED] wrote:

-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED]
Sent: 30 May 2006 06:11
To: Mindaugas L
Cc: php-general@lists.php.net
Subject: Re: [PHP] how include works?


On Tue, May 23, 2006 6:19 pm, Mindaugas L wrote:
 can anybody explain how require works, and what's the difference
 between
 _once and regular? What's going on when php file is processed? In
 manual is
 written just, that it's readed once if include_once. What does to mean
 readed? Thank You

require and include both basically work EXACTLY as if you
copied/pasted the file into your source code, except that you are
out of PHP mode in the included file.

Adding _once means that PHP will ignore the statement if you have
already included or required that file anywhere else in your script
previously.

--

I understand the difference well enough, but I've never really understood
the reason for having both. Is it to help find errors in sloppy coding, or
is there a case where including a file more than once is desirable (and
won't cause an error)?


There was more of a difference earlier on.

On http://www.php.net/manual/en/function.require.php:

Note:  Prior to PHP 4.0.2, the following applies: require()  will
always attempt to read the target file, even if the line it's on never
executes.

Now it behaves the same way except for the failure method (require is
fatal, include is not).

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Upload files problems

2006-05-26 Thread chris smith

On 5/27/06, Ing. Tomás Liendo [EMAIL PROTECTED] wrote:

My host uses safe mode...
What other thing can I do?
Some other method exists to send files besides POST method?


ftp?

You haven't solved your problem which actually has nothing to do with
file uploading (460k is nothing and should upload very quickly).

We haven't seen enough code to work out your actual problem.

Track down where all of your time is going by using the 'time()'
function and go from there.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Monitoring Remote Server Services using php !!!

2006-05-25 Thread chris smith

On 5/25/06, Phil Martin [EMAIL PROTECTED] wrote:

Hi everybody,

  I'm new to the list and also new to php, I hope I can learn many
things from here.
  My first doubt is the following: I'm trying to create a small monitor
system, just to suit my needs in monitoring some services in my application.
I've found some functions that return to me the service by port, name and so
on (getservbyport, getservbyname). What I need is to monitor remote server
services, I mean, lets suppose I have a server 192.168.0.2 with a ssh server
running. I'd like to see the status (up/down) of that server from another
machine, like 192.168.0.1. I don't want to use some monitoring softwares out
there in the web, i know they exist and in fact I use many of them like
nagios, cacti and so on, but I'm planning to do my own small solution.
 What I need is some function that asks me a remote IP, port and
protocol as input data and results TRUE/FALSE (any boolean value), just to
see if the service is up. I did that making a function using nmap, but i
don't want to hold that solution to linux, I'd like to use it at other OS.
My function's syntax is like this

?php
 $ssh_status=service_status (192.168.0.2, 22, tcp);
 if ($ssh_status==TRUE); {
 echo Service UP;
 } else {
 echo Service DOWN;
 }
?


   Does anyone know if there is a similar function in PHP ? I'd be very
happy if somebody knows about a function like that.


No such function exists.

You should check out http://www.nagios.org - it's not php but it does
what you want.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Serialize

2006-05-24 Thread chris smith

On 5/24/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Hi,

Is a serialized array a safe string to insert into a mysql text field? Or is a
function such as mysql_real_escape_string always needed?


*Always* escape your data.

What if your array contains a quote?

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] One works, but the other doesn't

2006-05-23 Thread chris smith

On 5/23/06, Jonas Rosling [EMAIL PROTECTED] wrote:

I find this problem very strange. I've got two parts of code (allmost the
same) in different TD's with vars and arrays (with same name) but it's only
the top code that gives result. I've allso tryied to rename the vars and
TD's in the bottom without any luck. The only vars/arrays that I haven't
mind changing name on yet are some dynamic, like:

${$row[0]} = array();

${$row[0]}[$row[1]] = $row[2];

But I think this could be the main cause, but I'm not really sure. If I
delete the top code the bottom works. Any idéas any one?


Without seeing the whole code involved, my guess is you're resetting
the array with every loop.

Guesses don't help but that's all we can do without seeing any actual code.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Can a script run twice?

2006-05-23 Thread chris smith

On 5/23/06, Lester Caine [EMAIL PROTECTED] wrote:

I'm having very occasional problems with my PHP5 applications which only
seem to be explained if the script is run twice.

Example - page has 'Add Ticket' button, which adds a record and marks it
as being processed by the location that created it. 99.99% of the time
no problems, but just now and again there are two records, with
different primary keys - so the database bit worked - but with very
close now times and identified as being at the same counter. The next
page does not have the 'Add Ticket' button, so it would seem the first
script was trigger twice?

Am I simply going mad ( which is the logical choice ;) ), or is this
something that can happen and needs to be handled?


Someone hitting refresh prematurely?

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] One works, but the other doesn't

2006-05-23 Thread chris smith

On 5/23/06, Jonas Rosling [EMAIL PROTECTED] wrote:

-Ursprungligt meddelande-
Från: chris smith [mailto:[EMAIL PROTECTED]
Skickat: den 23 maj 2006 13:38
Till: Jonas Rosling
Kopia: PHP List
Ämne: Re: [PHP] One works, but the other doesn't


On 5/23/06, Jonas Rosling [EMAIL PROTECTED] wrote:
 I find this problem very strange. I've got two parts of code (allmost the
 same) in different TD's with vars and arrays (with same name) but it's
only
 the top code that gives result. I've allso tryied to rename the vars and
 TD's in the bottom without any luck. The only vars/arrays that I haven't
 mind changing name on yet are some dynamic, like:

 ${$row[0]} = array();

 ${$row[0]}[$row[1]] = $row[2];

 But I think this could be the main cause, but I'm not really sure. If I
 delete the top code the bottom works. Any idéas any one?

Without seeing the whole code involved, my guess is you're resetting
the array with every loop.

Guesses don't help but that's all we can do without seeing any actual code.

Okej, all the code follows bellow. Remember that part 1 allways works. And
they work all seperatly.


Man you do things the hard way. Why use all those variable variables?


$my_data = array();

// Loppar igenom raderna
while($row=mysql_fetch_assoc($result)) {
$code = $row['salesperson_code'];

if (!isset($my_data[$code])) {
$my_data[$code] = array(
'description' = $row['description'],
'total' = $row['totalt'],
'antal' = $row['antal']
);
} else {
$my_data[$code]['description'] = $row['description'];
}
}

var_dump($my_data);

MUCH easier to read and you'll find debugging LOTS easier.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] One works, but the other doesn't

2006-05-23 Thread chris smith

On 5/23/06, Jonas Rosling [EMAIL PROTECTED] wrote:



-Ursprungligt meddelande-
Från: chris smith [mailto:[EMAIL PROTECTED]
Skickat: den 23 maj 2006 14:13
Till: Jonas Rosling
Kopia: PHP List
Ämne: Re: [PHP] One works, but the other doesn't


On 5/23/06, Jonas Rosling [EMAIL PROTECTED] wrote:
 -Ursprungligt meddelande-
 Från: chris smith [mailto:[EMAIL PROTECTED]
 Skickat: den 23 maj 2006 13:38
 Till: Jonas Rosling
 Kopia: PHP List
 Ämne: Re: [PHP] One works, but the other doesn't


 On 5/23/06, Jonas Rosling [EMAIL PROTECTED] wrote:
  I find this problem very strange. I've got two parts of code (allmost
the
  same) in different TD's with vars and arrays (with same name) but it's
 only
  the top code that gives result. I've allso tryied to rename the vars and
  TD's in the bottom without any luck. The only vars/arrays that I haven't
  mind changing name on yet are some dynamic, like:
 
  ${$row[0]} = array();
 
  ${$row[0]}[$row[1]] = $row[2];
 
  But I think this could be the main cause, but I'm not really sure. If I
  delete the top code the bottom works. Any idéas any one?

 Without seeing the whole code involved, my guess is you're resetting
 the array with every loop.

 Guesses don't help but that's all we can do without seeing any actual
code.

 Okej, all the code follows bellow. Remember that part 1 allways works. And
 they work all seperatly.

Man you do things the hard way. Why use all those variable variables?


$my_data = array();

// Loppar igenom raderna
while($row=mysql_fetch_assoc($result)) {
$code = $row['salesperson_code'];

if (!isset($my_data[$code])) {
$my_data[$code] = array(
'description' = $row['description'],
'total' = $row['totalt'],
'antal' = $row['antal']
);
} else {
$my_data[$code]['description'] = $row['description'];
}
}

-
Well, I'm kind of a newbie at this. So you think this will solve my problem?


Look at it this way - Which one is easier to read? Which one do you
think will be easier to work out what's going wrong?

Readability of your code will help you so much. If you come back to
this in a week, will you understand what's going on?

I don't know if my code will give you *exactly* what you want - test
it and see (backup your existing php file, change this code, see what
you get).

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] getRow method of DB_Common class

2006-05-22 Thread chris smith

On 5/22/06, Nirmalya Lahiri [EMAIL PROTECTED] wrote:

Dear all,
 I am using getRow() method ob DB_Common class to get a single row from a 
table. As per document 
http://pear.php.net/manual/en/package.database.db.db-common.getrow.php this 
method return a single dimension array. But when I am using it, it returns a 
two dimension array. I don't know why... Please help me.


You should ask on the pear list - they know the code, we don't.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Cookies https

2006-05-22 Thread chris smith

On 5/22/06, Michael Satterwhite [EMAIL PROTECTED] wrote:

I have a site that is using a shared ssl certificate. When running on
the site, the host is of the form host.com. When running in ssl mode,
the domain is of the form host.certhost.com. ping shows that both
resolve to the same ip address.

Is there a way to create a cookie in the unsecured area and have it
available when going through the ssl certificate?


Nope. They are different domains.

If they were on the same basic domain, you could (see
http://wp.netscape.com/newsref/std/cookie_spec.html specifically the
domain section) but completely different domains isn't an option.

PHP sessions would work though. Explicitly pass the session across and
it should work (well, I think!).

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] HELP - Clean and simple

2006-05-22 Thread chris smith

On 5/22/06, Jonas Rosling [EMAIL PROTECTED] wrote:

I don't know if I'm explaining things in a difficult way or not. But I'm
gonna try to explaine what I want very clean and simple.

1. I wan't to check if an array is decleard or not, refering to a value in a
row/field ($row[0])
2. If it's not decleard I declear it and assign it's name by the value from
a row/field ($row[0])
- Further down I shell fill it with values like $arrayname[$row[2]] =
$row[1] (arrayname based on $row[0])
3. Else if it's decleard fill it with values like above.

Hope someone understands me.


And what code do you have so far? We're not going to write it for you.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Captcha v1.0 (http://www.php.meezerk.com/index.php?page=captcha)

2006-05-21 Thread chris smith

On 5/21/06, Beauford [EMAIL PROTECTED] wrote:


The following are the errors I am getting - quite lengthy.

Thanks


$ make





gcc -DHAVE_CONFIG_H -I. -I. -I. -I/usr/include/freetype2 -g -O2 -MT gdft.lo
-MD -MP -MF .deps/gdft.Tpo -c gdft.c  -fPIC -DPIC -o .libs/gdft.lo
gdft.c:1366:35: fontconfig/fontconfig.h: No such file or directory


You're missing a devel package. Don't know where that one comes from
'coz I don't know what configure switches you are using.

If it's freetype for example, you need the freetype-dev or
freetype-devel package to compile against.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Captcha v1.0 (http://www.php.meezerk.com/index.php?page=captcha)

2006-05-20 Thread chris smith

On 5/21/06, Beauford [EMAIL PROTECTED] wrote:

Hi,

I am trying to get a program, Captcha v1.0, working and not having much
luck. The program says I need PHP version 4.3.10 or later or PHP version 5
and GD Library version 2.0 or later with JPEG support.

I know I have PHP 5, but not sure about the GD Library. I was reading on one
page I was on that this is built in to PHP, but at this point I'm lost. When
I try to compile the latest version on my Slackware box I get nothing but
errors.

Any help would be appreciated.


Help with which bit?

gd - create a phpinfo page and it will show you the version if gd is available.

compile issues  - can't help without seeing the errors.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] [Repost] Getting rid of Web page has expired (POSTDATAerror)

2006-05-18 Thread chris smith

On 5/19/06, Nicolas Verhaeghe [EMAIL PROTECTED] wrote:

I have searched and not found...


http://marc.theaimsgroup.com/?t=10980586931r=1w=2
http://marc.theaimsgroup.com/?t=10751522972r=1w=2
http://marc.theaimsgroup.com/?t=10620110712r=1w=2


--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Perl PHP output format mismatching

2006-05-15 Thread chris smith

On 5/15/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Hello,

I'm currently writing a PHP page, which uses a small Perl script. But I
encounter an annoying problem with endline character.

A small example :

$perl = new Perl();
$perl-eval('print toto\ntata');

In this configuration, the HTML page generated sends me :
toto tata

Of course and you should have understood already :-), I would like :
toto
tata

I suppose I have to do a little manipulation on the PHP streams to make them
correctly interpret the endline character returned by Perl. But I didn't find
what :(


\n is not html so your browser doesn't know you want a newline. What
you need is a br tag.

See http://www.php.net/nl2br

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] php-cli and daemon

2006-05-15 Thread chris smith

On 5/14/06, Michelle Konzack [EMAIL PROTECTED] wrote:

Hello,

I run a webserver which is a frontend for a huge PostgreSQL database.
Now I like to code some stand-alone Apps, which can connect to a
daemon uploading files and geting infos from the database

(NO, the have no right to connect directly to the database)

Questions for now:

1)  How to code a daemon?


This would be a good place to start.

http://www.php.net/pcntl

Depending on your app you might need to look at shared memory, but the
main area to check out would be the process functions.

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


2)  How to use ssl-certs for the connection?
The $USER must use an USB-Key with its one cert.


There are ssl functions you can use:

http://www.php.net/manual/en/ref.openssl.php

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Uploading large files

2006-05-14 Thread chris smith

On 5/14/06, php @ net mines [EMAIL PROTECTED] wrote:

I'm building a site which will be hosted on a shared server (hosting company
won't change any php.ini settings), and the client wants to upload his
clients' data (let's say a zip) so they can loggin and download it from the
site.


Depends on the size of the file. If it's 10M, php will be able to
handle it. If it's 100M, teach them to use ftp - it'll save you so
many headaches.

You can write a java applet if you like but how you do that? Don't
know - you'll have to find a java list :)

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Is it a bug ?

2006-05-13 Thread chris smith

On 5/14/06, Fourat Zouari [EMAIL PROTECTED] wrote:

Code 1 :
-
var_dump(stream_get_contents($rr));
-
Output 1
-
string(185) HTTP/1.1 202 Accepted
Server: Apache2
Content-Length: 24
Connection: close
Content-type: text/html
Pragma: no-cache
Cache-Control: no-cache

0: Accepted for delivery
-


Code 2 :
-
$x = stream_get_contents($rr);
var_dump($x);
-
Output 2
-
string(0) 
-

Am i wrong ?


Without seeing all of the code, we can't tell anything from that.

Post it in http://pastebin.com and send us a url.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] MySQL - HEAP table type

2006-05-13 Thread chris smith

On 5/14/06, Martin Zvarík [EMAIL PROTECTED] wrote:

Hi,
I am sorry for this not being really a PHP question, anyway I use
MySQL database, I have a table, which is HEAP (memory) type and I found
out I can store only about 22000 entries in it, then when I want to
insert new entry it gives me an error that the table is full.

The question is: How can I increase this limit?


Only the mysql documention or lists will be able to answer that.

http://dev.mysql.com


--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Failing FastCGI PHP

2006-05-13 Thread chris smith

On 5/14/06, Frank de Bot [EMAIL PROTECTED] wrote:

I'll start by compiling php with --enable-debug

At the moment I get backtrace results like this:

#0  0x48c7d95b in memcpy () from /usr/lib/libc_r.so.4
#1  0x8977280 in ?? ()
#2  0x10 in ?? ()
#3  0x894e500 in ?? ()
#4  0x894dc00 in ?? ()
#5  0x8962000 in ?? ()
#6  0x8960200 in ?? ()
#7  0x894e4e0 in ?? ()
#8  0x894e4c0 in ?? ()
etc etc etc...

Thus useless :P


Unfortunately yes, rather useless :(

Might get better help on the internals list (I don't know what else to
suggest, was hoping someone else might jump in and help you!).

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] METHOD=POST not worikng

2006-05-13 Thread chris smith

On 5/14/06, IraqiGeek [EMAIL PROTECTED] wrote:

On Saturday, May 13, 2006 4:59 PM GMT,
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 AFAIK it should be working just fine.  I'm not aware of POST not
 working in any circumstance other than PHP not working at all.

 Can you post your test script?  We could better judge what's happening
 based off that.  Just make sure you're referencing the variables with
 $_POST or $_REQUEST, not $_GET.

 Slightly off topic.  If you're not already, always make sure to
 verify/escape your input from POST/GET/RSS/etc.  That will help make
 your pages more secure.  It might seem like you don't need to do it
 right now at the beginning, but it's a good habit to get into... One
 that I need to follow better (especially when I have a really short
 deadline).

 Ray


PHP is indeed working. If I use METHOD=GET instead of POST, the script works
without any issues. Here is the test script I'm using:
html
titletest script/title
body
?php
//If the user wants to add a joke
if(isset($_GET['addtext'])):


You're checking for a get string here, not a post string. So it will
never get into this part of the code.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Security Concerns with Uploaded Images:

2006-05-13 Thread chris smith

On 5/14/06, Nick Wilson [EMAIL PROTECTED] wrote:

Hi all,

are there any security concerns with uploaded images?

My thought is that it wouldnt be too hard to have some kind of script
masquerade as a gif file, and perhaps cause damage.

I cant find anyway to check a file really is a gif/png/jpg (i assume the
mimetype available in $_FILES could be spoofed).

I'd welcome any thoughts in general on this, but specifically if anyone
has experience/knowledge in this area and can point me in the right
direction.


Check the file extension and the mimetype, make sure they are both
valid.. or as someone else suggested, use getimagesize on it - if that
returns false or empty then it's not an image.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Uploading large files

2006-05-13 Thread chris smith

is there a way to upload large files (e.g. 15mb) without changing the
default settings in php.ini***?


According to this page:
http://www.php.net/manual/en/ini.php#ini.list

You can do it with a htaccess file. See comments at the bottom.


Preferably by using php, but if not is there another web tech (e.g. Java
applets) that will allow me to do this?


Sure. Python, ruby, java, perl, whatever you like.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] displaying result problem

2006-05-12 Thread chris smith

On 5/12/06, adi zebic [EMAIL PROTECTED] wrote:

Hi,

I have little problem while displaying a result from one simple querry.
If i insert values into mysql DB in following order (12, 3, 14, 4 )
I allways have  ( 12, 14, 3, 4 ) displaying when query the DB. (same with
letters - dcba - abcd etc)
I would like to be able to display the data like they are inserted into
database.


A database will order things randomly unless you tell it how to order
the results.

As Tedd suggested, add an id field and then you can order by that field:

select * from table order by id ASC;

http://dev.mysql.com/doc/refman/5.1/en/sorting-rows.html

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] suExec problem

2006-05-12 Thread chris smith

On 5/12/06, Laszlo Nagy [EMAIL PROTECTED] wrote:


  Hello,

I have a SuSe 9.3 server, with apache version 2.0.53 and suexec
configured. It was working for months. One day, it stopped working for
ALL virtual hosts. I might have misconfigured something, but I'm not
sure what is the problem. When I start up apache, I see this in the
error_log:


This is more of an apache question. You'll get a quicker answer on their lists:

http://httpd.apache.org/lists.html

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] php.dev, network timeout??

2006-05-12 Thread chris smith

On 5/13/06, Jon [EMAIL PROTECTED] wrote:

This isn't strictly a php question.  Its actually a question about the
mailing lists in general.  I know I must be doing something really
stupid but I seem to be having a lot of problems with network timeouts
while browsing the mailing lists.  The dev mailing list is the worst as
I have yet to successfully make a connection there.  Can anyone give me
some good advice on how to fix this problem?  I'm using thunderbird to
browse.


If you're using thunderbird that means you're using the news groups yes?

Are you using news.php.net or your local isp's mirror copy?

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Failing FastCGI PHP

2006-05-11 Thread chris smith

On 5/11/06, Frank de Bot [EMAIL PROTECTED] wrote:

Hi,

I have made a apache setup with PHP running as FastCGI (apache 2.0.58,
mod_fastcgi 2.4.2, php 5.1.4)
PHP is called directly as FastCGI without a wrapper script.
On a given moment the PHP FastCGI application reaches
dynamicMaxClassProcs. After that happens the PHP FastCGI application
totally crashes and can only be recovered by restarting apache.

PHP Crashes with:

terminated due to uncaught signal '10' ((null)), a core file may have
been generated. 


Are you able to get a core dump and what does it show? Here's some
doco on how to get a backtrace:

http://bugs.php.net/bugs-generating-backtrace.php

That will give us some clues on whether it's php or fastcgi..

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Browser displays blank page, while request still being handled

2006-05-08 Thread chris smith

 I'm guessing it's just a timeout issue - maximum execution time
 exceeded type thing - check your php or apache error logs and see
 what that tells you.. if nothing shows up, turn log_errors on, restart
 apache and see what you get.
I don't think it's a timeout issue on the server-side, because I've
already tried setting MAX_EXECUTION_TIME and MAX_INPUT_TIME to extremly
high values, and got the same result (i.e. the blank page).
By setting them to extremly low values I was able to verify the
app/script/server 's behaviour when it did timeout, and that produced
the expected warning-message for MAX_EXECUTION_TIME exceeded.


A browser has a timeout too.. type about:config in firefox, look for
network.http.connect.timeout - timeout is 30 seconds and
network.http.request.timeout is 120 seconds... thats not a long time.


I couldn't find anything in the logs, although log_errors is turned on,
and the logging levels set to log everything thats possible.

 Try adding some flush() calls to the script. That might get the
 browser to display some content.. Don't know whether it will work though.
That's something I haven't tried yet, so thanks for the tip.

 Copy has to wait until it's finished before telling you the results.
 If it's copying a 20M file, that takes a while.. If you're copying
 multiple 20M files, then hey.. there's you're problem. How many and
 how big are the files in this case?
We're talking about multiple copy operations.  The first one copies 230
files (approx. 40mb) and the second one copies about 2200 files
(195mb).  Most files are under 400kb a piece.


Time how long it takes you to manually copy that amount of data.


 You might be better off running a script to run through cron every 5
 minutes or so and doing it all for you.. then getting it to email you
 the results.

Running the script through cron wouldn't be a good idea.  The app we're
talking about is a kind of Content Management System for photographers,
so the publish-request should only be called when the user has finished
his modifications to the site and is ready to publish them to his website.


The request goes in to a process queue with the relevant details..
obviously this only gets logged right at the end. Cron job runs, finds
the details, does its work..

If you're trying to do all of this in one step I think you're out of
luck and you might need to break up the processes.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Browser displays blank page, while request still being handled

2006-05-08 Thread chris smith

 We're talking about multiple copy operations.  The first one copies 230
 files (approx. 40mb) and the second one copies about 2200 files
 (195mb).  Most files are under 400kb a piece.

 Time how long it takes you to manually copy that amount of data.
Tried the flush() calls in between different parts of the request,
doesn't help :-(
Although I don't get why you'd want me to time the copying, I did.  In
fact, I timed all operations...  Deleting the old files takes about 3
seconds, copying the new data takes about 20 sec, database requests and
generating XML takes another 10 seconds.  All in all, the complete
operation takes  35sec, which should be fast enough to prevent the
browser or server from timing out..


Well, if it took a minute to copy the data, then your disks need
tuning or something and nothing you do in php would affect this.


BTW, would a timeout explain why the browser wants to repost the request
when I trie to view the source-code of the blank-page?


I think that's a firefox thing.. does the same thing happen in IE?


 If you're trying to do all of this in one step I think you're out of
 luck and you might need to break up the processes.
What do you mean by breaking up the processes?  Put them in different
requests, so that one request calls another one?


have a publish site button that opens a small popup window.

step 1 - prepare the new environment (make dirs, whatever)
(refresh automatically)
step 2 - copy the files
(refresh automatically)
step 3 - create the xml
(refresh automatically)
step 4 ...

use a session variable for example to work out where you are up to and
what to do next.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] adding objects to spl.php because it doesn't appear to be there

2006-05-06 Thread chris smith

On 5/6/06, jonathan [EMAIL PROTECTED] wrote:

a sample phpunit. the issue is that this class doesn't seem to be in
my spl (which I don't really use and am not sure how to upgrade).


If it's a sample, where does it come from? Best ask those folk, they
will know how to help you.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] List of sessions

2006-05-06 Thread chris smith

On 5/7/06, tedd [EMAIL PROTECTED] wrote:

Hi:

While we're on the subject of listing sessions, what does the
following code do?

session_start();

$path = ini_get('session.save_path');
$handle = dir($path);

while ($filename = $handle-read())
{
  if (substr($filename, 0, 5) == 'sess_')
  {
$data = file_get_contents($path/$filename);

if (!empty($data))
{
  session_decode($data);
  $session = $_SESSION;
  $_SESSION = array();
  echo(pre);
  echo Session [ .
substr($filename, 5) . ]\n;
  print_r($session);
  echo \n--\n\n;
  echo(/pre);
}
  }
}


Goes through 'session.save_path' and looks for session files. If it
finds one, it opens it and prints it out.

Could be quit dangerous on a shared host, yes.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] set_error_handler() fails

2006-05-05 Thread chris smith

On 5/5/06, icy [EMAIL PROTECTED] wrote:

Richard Lynch wrote:
 It's possible that you have mistaken whatever set_error_handler
 returns for no previous error handler for NULL...

 Are you using === NULL or is_null() to test?

 If not, I suspect it's really returning FALSE or '' and what you think
 is an error condition is, in fact, not an error condition at all.


I use === NULL, so it really returns NULL.
My own error handler is never called so this is another indication that
it fails. PHP doesn't throw any error or exception. I also searched for
an entry in php.ini which might turn own error handlers off but didn't
find anything relevant. Maybe someone can reproduce the bug.
This issue is freaking me out.


What does your code look like?

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] adding objects to spl.php because it doesn't appear to be there

2006-05-05 Thread chris smith

On 5/6/06, jonathan [EMAIL PROTECTED] wrote:

I'm not really sure where to post this but when I run phpunit, it is
throwing an error because  Class 'InvalidArgumentException' not
found. It looks like this is supposed to be in spl.php but I'm not
sure how to add this. Is it possible to just updated spl.php with the
code for InvalidArgumentException or is this something where I will
need to have the sys-admin rebuild php?


When does this happen? You're running make test on a new php build?
Running tests against your own code ?

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Avoiding user refresh of pages with forms

2006-05-04 Thread chris smith

Also, with regards to sending success/failure messages across the
redirection of your forms, I'd recommend considering sessions for
passing the data.  It keeps your URLs clean, and allows you to send
complex data a bit easier (IMHO).  For example if a user makes an
error on a few different form elements, you can send back an array of
messages to the user without having to serialize/unserialize in the
ugly URL.


IE has a url length limit, so depending on how many steps you go
through you might have issues with it not unserializing properly
because the URL gets chopped off...

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Re: php mysql problem

2006-05-03 Thread chris smith

On 5/3/06, Richard Lynch [EMAIL PROTECTED] wrote:

On Tue, May 2, 2006 7:22 am, chris smith wrote:
 On 5/2/06, Ross [EMAIL PROTECTED] wrote:
 This is my database now...I will use the item_id for the order but
 what if I
 want to change item_id 3 to item id 1? How can I push all the items
 down one
 place? How can I delete any gaps when items are deleted.

 Why do you want to do that? There's no benefit in doing this..
 actually it becomes a pain.

 You'd need to update not only this table but any field in other tables
 that references this one as well (and if you miss one, you have a
 completely useless database).

No, we've got past that bit.


I posted that answer yesterday... By the time I got back to the thread
everyone had worked out that he wanted to use it for ordering results
;)


While you are at it, id is an awfully generic name for a field, really.

I personally prefer:
create table foo (foo_id int(11) auto_increment, ...);

But, hey, a lot of folks go with just id on everything, and seem
okay with that.  [shrug]


Very true - would get rather confusing in link tables:

create table news_cat (id int, id int); heh.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



  1   2   3   >