Re: [PHP] Website with a Instant Messenger

2004-09-27 Thread Jim Grill
 Hello all,

 I want to put a instant messenger in a website. People connect to this
 website to stay in touch with each other. There is a photo album for
 everyone, a Forum, groups...

 The IM must work like ICQ, MSN and other, but via web. Users of the site
can
 add other users to the list, and when people log in their status go
ONLINE.
 Then we can open another window and chat, or send a message...

 Nothing more than that.

 Where can I start? I have no idea on how to do this... Any help?


Here is a good start

?php
/* vim: set expandtab tabstop=2 shiftwidth=2 softtabstop=2: */
//
+---
+
// | PHP version ?
|
//
+---
+
// | Copyright (c) 2004
|
//
+---
+
// | I want to put a instant messenger in a website. People connect to this
|
// | website to stay in touch with each other. There is a photo album for
|
// | everyone, a Forum, groups...
|
// |
|
// | The IM must work like ICQ, MSN and other, but via web. Users of
|
// | the site can add other users to the list, and when people log in their
status |
// | go ONLINE. Then we can open another window and chat, or send a
|
// | message...
|
//
+---
+
// | Authors: Anyone  [EMAIL PROTECTED] 
|
//
+---
+
//
// $Id:$ 0.0.1

/* login here or maybe IM or ICQ or a photo album*/
?

I couldn't resist. Sorry... good luck

Jim Grill

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



Re: [PHP] poor image quality in php

2004-09-27 Thread Jim Grill
 hi!
 I have a problem with the imagejpeg() function - or related. I must
specify
 that I'm a newbie with image handling with php and that a piece of advice
 would really help me right now.
 The deal is that I want to create a (smaller) resized copy of a certain
 image using this code:

  $veche = imagecreatefromjpeg($img_large);
  $noua = imagecreate($wm, $hm);
  imageinterlace($noua, 1);
  imageinterlace($veche, 1);
  imagecopyresized($noua, $veche, 0, 0, 0, 0, $wm, $hm, $size_large[0],
 $size_large[1]);
  imagejpeg($noua, $smallPath, 100);
  ImageDestroy($veche);
  ImageDestroy($noua);

 the resizing part goes well; I don't really know what the imageinterlace
 function does, but I used it in desperation. Why: the output image's
quality
 is visibly inferior to the source's. And I want the image to look good.
The
 source is a jpeg (dinamic). As you probably have noticed, I set the
quality
 parameter to 100, but uselessly.
 What i'd like to know is whether php can output some quality jpegs, and if
 so, then how?
 Thanks a lot!
 PS: imagecopyresampled does not work either - produces the same result!

When you create the new image try using  imagecreatetruecolor()
http://us2.php.net/manual/en/function.imagecreatetruecolor.php

JIm Grill

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



Re: [PHP] Images in PHP and MySQL

2004-09-27 Thread Jim Grill
 1) there is no need to fiddle with directory permissions to write images.
 2) if the content is sensitive you have the added security of the database
 password (and the fact that the database is ususally not directly
 accessible).
 3) a mysqldump gives a backup of all images along with other persistent
data

 Other disadvantages follow:
 1) excessive load on the server for loading each image
 2) the load mentioned above causes a slow down in the script
 3) images usually need to be written to file before using GD for
 manipulation, inclusion in PDFs, etc.

That's a very good list.

I just wanted to pipe in on this one thing:

3) images usually need to be written to file before using GD for
manipulation, inclusion in PDFs, etc.

There is actually a function for this: imagecreatefromstring()

I'll don't want to touch the rest of this topic though. :-)

Jim Grill

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



[PHP] bitwize '' operator trouble

2004-10-04 Thread Jim Grill
I ran across this problem with php 5.0.2 in Linux. This problem did not exist before 
and this code was used in php 5.0.0, 5.0.1, 5.0.2-dev, and several other cvs snaps 
along the way -all on Linux.

?php
// example
// network IP and mask
$range = '192.168.0.0/24';

list($ip,$mask) = explode('/', $range);

// Calculate the number of hosts.
$numHosts = pow(2, (32 - $mask));

print num hosts: $numHostsbr\n;

// Netmask = fullmask - number of hosts.
$netmask = pow(2, 32) - $numHosts;

print netmask: $netmaskbr\n;
print human readable netmask:  . long2ip($netmask) . br\n;

// address to number
$ipLong = ip2long($ip);

print ip2long ip: $ipLongbr\n;

// here is where the problem is:
print (\$ipLong  \$netmask): .($ipLong  $netmask).br\n;
// PHP 5.0.2-dev (cli) (built: Sep 21 2004 14:39:26)
// prints out -1062731776
//PHP 5.0.2 (cli) (built: Sep 24 2004 13:58:57)
// prints out 1084751872

// ...and so the following always fails:
// If the ip is not equal to (itself  netmask) it cannot be on the network boundary
if ($ipLong != ($ipLong  $netmask))
 echo Ip NOT on network boundary!;
else
 echo Ip IS on network boundary!;
?

I'm sure there are other ways to test if an ip is on a the network boundary of a given 
CIDR and I'll appreciate any examples of that. However, I am more interested in why 
and'ing these two numbers returns a different value now. I'm unable to find any clues 
in the docs.

Thanks,

Jim Grill

Re: [PHP] Millisecond in PHP

2004-10-27 Thread Jim Grill
 Hi,

 I'm trying to get PHP to display the millisecond of current time.  I can't
 find that option in Date().. Any hints?

 Thanks a lot


Take a look at

http://us2.php.net/manual/en/function.microtime.php

Jim Grill
ZCE

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



Re: [PHP] db transactions across multiple pages...

2004-07-30 Thread Jim Grill
It's my understanding that persistent connections via the old ext/mysql was
a  flawed misfeature to begin with. This was one of several misfeatrures
corrected by the new mysqli extension. There is some information on the
subject here: http://www.zend.com/php5/articles/php5-mysqli.php

It would be my guess that pconnect will be a thing of the past. It's sort of
a drag, but running out of connections - as pconnect can cause - is a real
drag too. ;)

Jim Grill
Web-1 Hosting
http://www.web-1hosting.net

- Original Message - 
From: bruce [EMAIL PROTECTED]
To: 'John Nichel' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Saturday, July 31, 2004 12:10 AM
Subject: RE: [PHP] db transactions across multiple pages...


 you also won't see the mysqli pconnect function... which tells me that at
 least for now, it's not there...

 -bruce


 -Original Message-
 From: John Nichel [mailto:[EMAIL PROTECTED]
 Sent: Friday, July 30, 2004 8:44 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] db transactions across multiple pages...


 bruce wrote:
  not sure if it's php/mysqli... but if you check the php.net for the
 mysqli
  not mysql functions... you won't see the persistent attribute listed
for
  the php.ini attributes...

 I wouldn't worry too much about that though.  I mean if persistant
 connections are required for transactions, I'm sure it will be there.
 The only reason we may not be seeing it now is because the PHP5
 documentation is full of holes (with it not being a production release
 yet).  I know of a few items that are available in PHP5 that aren't
 documented on php.net yet.

 --
 By-Tor.com
 It's all about the Rush
 http://www.by-tor.com

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

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



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



Re: [PHP] Accepting Credit Cards

2004-07-30 Thread Jim Grill
At the risk of sounding dull, I have used Authorize.net for many years and
have no complaints. I'm not sure about price, but set up is pretty easy with
their documentation and they're very reliable.

Jim Grill
Web-1 Hosting
http://www.web-1hosting.net

- Original Message - 
From: Jonathan Hadddad [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, July 29, 2004 11:30 PM
Subject: [PHP] Accepting Credit Cards


 I'm going to be setting up a site that needs to accept credit card
 transactions.  I was wondering what people thought of different
 services such as paypal, 2checkout, or whatever you've used before.

 I have used 2checkout, and it was OK.  I'm looking for something that's
 quick to set up and cheap doesn't hurt ;)

 --
 Jon Haddad
 Check out http://www.oldirtyhaddad.com

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



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



Re: [PHP] regex help

2004-08-01 Thread Jim Grill
Can you post a little sample of the data and your current code?

thanks.

Jim Grill
Web-1 Hosting
http://www.web-1hosting.net

- Original Message - 
From: Kathleen Ballard [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, August 01, 2004 8:27 AM
Subject: [PHP] regex help


 I am at the tailend of a project that involves moving
 legacy data from one dbms to another.  The client has
 added a new requirement to the data manipulation that
 is required. I need to remove all br / tags (there
 may be more that one) that appear within all h*
 tags.  
 
 I am not very familiar with building regular
 expressions, but I see this as a 2 part process. 
 First, to grab h* tags, and second, to strip the
 br's. 
 
 I can grab the beginning of the tag easily, but my
 expressions grab too much.
 
 Also, I am not sure how to remove the br's.
 
 Any help would be appreciated.  I have tried to find
 similar examples, but without any luck.  Also, php5 is
 not an option at this point.
 
 Kathleen
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



Re: [PHP] javascript type cast OT

2004-08-03 Thread Jim Grill
Was just wondering... Can you compile php with javascript support on a Game
Boy? lol

Is it ok to just filter out this subject to deleted items now???

Jim Grill


- Original Message - 
From: Curt Zirzow [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 03, 2004 5:58 PM
Subject: Re: [PHP] javascript type cast OT


 * Thus wrote Alex Hogan:
   Hmmm, you should see the C++ newsgroup(s).
 
  Point taken...
 
   Common and well established list courtesies established years
   ago are expected to be suspended herewhy?
 
  Nope and that's wasn't my point.  My point was temperance.
 
   Having said that I suppose that those of us who are curt and
   condescending (of which I am one) can shut up or go somewhere
   else, which we have been asked to do several times. I was
   just here to learn and to help where I could.
 
  And I will be the first to admit that you have been one of the people on
  this list that has answered every one of my questions, no matter how
  stupid they have been. (And there has been some real boners)

 Perhaps we need a:

 Subject: [Elite Guide] for the seasoned php poster.

 Post everyweek :)

 Curt
 -- 
 First, let me assure you that this is not one of those shady pyramid
schemes
 you've been hearing about.  No, sir.  Our model is the trapezoid!

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




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



Re: [PHP] Order by

2004-08-03 Thread Jim Grill
- Original Message - 
From: Karl-Heinz Schulz [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 03, 2004 9:19 PM
Subject: [PHP] Order by


 How can I use the Order statement for this query?

 $specs_query = mysql_query(select title, information from spec where
 product=.$id);

 I tried to use

 $specs_query = mysql_query(select title, information from spec where
 product=.$id order by id asc);

 But it will create the error.

 Parse error: parse error, unexpected T_STRING in
/www/docs/view_product.php
 on line 144

 What am I doing wrong?

 TIA

 Karl-Heinz

 Tracking #: 28B73BEA7EBF0B4D89E64E5EA406BF5EC2EA6912



Hi Karl,

The problem is in your formatting.

 $specs_query = mysql_query(select title, information from spec where
 product=.$id order by id asc);


Try this instead

$specs_query = mysql_query('SELECT title, information FROM spec WHERE
product=' . $id . ' ORDER BY id ASC');

Note the use of single quotes (it's faster)

You could have just done this with double quotes:

$specs_query = mysql_query(SELECT title, information FROM spec WHERE
product=$id ORDER BY id ASC);

It might also be a good idea to put single quotes around $id if it comes
from user input:

$specs_query = mysql_query('SELECT title, information FROM spec WHERE
product=\'' . $id . '\' ORDER BY id ASC');
- OR -
$specs_query = mysql_query(SELECT title, information FROM spec WHERE
product='$id' ORDER BY id ASC);


Have fun!

Regards,

Jim Grill
Web-1 Hosting
http://www.web-1hosting.net






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

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



Re: [PHP] mysql_connect and PHP 5.0

2004-08-04 Thread Jim Grill
Can you paste us your configure line for php? It sounds like you forgot to
include mysql or perhaps you configured with mysqli instead. The two are
very different.

Regards,

Jim Grill
Web-1 Hosting
http://www.web-1hosting.net

- Original Message - 
From: Michael Marold [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 03, 2004 4:29 PM
Subject: [PHP] mysql_connect and PHP 5.0


 I've installed MySQL 5.0 with Apache 2.0.50.

 Before, I had running MySQL 4.3.3 and 2.0.47 and a Picturegalerie. After
 migrating to 5.0 i get this error:



 Call to undefined function mysql_connect() in
 D:\kreiszner\galerie\includes\db_mysql.php on line 39





 This is line 39 and 40:





 if (!$this-connection = $connect_handle($db_host, $db_user,
$db_password))
 {

   $this-error(Could not connect to the database server ($db_host,
 $db_user)., 1);

 }





 Whats wrong



 Kind regards mike





 _



I  C  S  N  E  T  W  O  R  K  S



 internetcommunicationsecuritynetworks

 _



 System Manager  Webdesigner



 Ing. Michael Marold



 Rudolf - Zellerg. 51/1/6



 1230 Wien

 _



 Telefon: +43 1 888 59 66



 Mobil: +43 664 / 534 02 02

 _



 e-mail: [EMAIL PROTECTED]



 web: www.icsnetworks.at http://www.icsnetworks.at/

 _







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



Re: [PHP] Looking for a TODO: parser.

2004-08-25 Thread Jim Grill
Not sure about other file types, but phpdoc includes a tag for todo. It
also makes nice documentation on the fly based on your comments.

http://phpdoc.org/docs/HTMLSmartyConverter/default/phpDocumentor/tutorial_tags.todo.pkg.html

Jim Grill

- Original Message - 
From: Daevid Vincent [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, August 25, 2004 8:55 PM
Subject: [PHP] Looking for a TODO: parser.


 I, like many other people I'm sure, put //TODO: comments in my code
(inspite
 of M$ patent on the idea!).


http://yro.slashdot.org/article.pl?sid=04/06/08/2319254tid=155tid=109tid=
 156tid=17

 I'm looking for a program that will run through a directory tree and parse
 all the files (ideally by extension, like *.php, *.js, *.html, *.c) and
give
 me a formatted output (or HTML table or something useful).

 It should include the //TODO of course, the path/file, the line(s), and
 perhaps other things I'm overlooking. Maybe last time file changed/file
 date, and possibly the comments immediately below the //TODO: (as
sometimes
 they take up more than a single line).

 Anyone know of or have built something like this... That is before I go
and
 re-invent the wheel.

 D.

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



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



Re: [PHP] Get Value

2004-08-25 Thread Jim Grill
?
(B$link = 'a href="www.google.com"Google(value to extract)/a';
(Becho preg_replace('/\a\shref=\".*\"\(.*)\\/a\/i', "$1", $link);
(B?
(B
(BJim Grill
(B
(B- Original Message - 
(BFrom: "Syed Ghouse" [EMAIL PROTECTED]
(BTo: "php mailinglists" [EMAIL PROTECTED]
(BSent: Wednesday, August 25, 2004 11:11 PM
(BSubject: [PHP] Get Value
(B
(B
(BHi All
(B
(BWill anybody tell me how to extract the value (say Google)
(B from the code below:
(B
(Ba href="www.google.com"Google(value to extract)/a
(B
(BThanks and Regards
(B
(BSyed
(B
(B-- 
(BPHP General Mailing List (http://www.php.net/)
(BTo unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] ini_set('include_path') and require_once()

2004-08-26 Thread Jim Grill
The error message hints that something is wrong with your include path.
(include_path='.:..')

Also, when you say `ini_set(include_path, ../../php)` you are
overwriting the entire include path rather than appending your path to it.

Try this:

?php
echo get_include_path();
set_include_path(get_include_path() . ':/full/path/to/your/includes');
echo get_include_path();
?

I would use the full system path rather than a relative path. Using echo
get_include_path() should give you an idea what's going on.

http://www.php.net/manual/en/function.set-include-path.php

Jim Grill


- Original Message - 
From: BigSmoke [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, August 26, 2004 6:56 AM
Subject: [PHP] ini_set('include_path') and require_once()


 Hi,

 In the following code, require_once() borks, complaining:
 Failed opening required 'includes/companies.php' (include_path='.:..')

 
 ini_set(include_path, ../../php);

 require_once('includes/common.php');
 require_once('includes/validate.php');
 require_once('includes/company.php');
 require_once('includes/companies.php');
 

 The strange thing is: I have other code where this same method _does_
 appear to work. Anyone care to enlighten me?

 I'm using PHP 4.3.8.


BigSmoke
Smokes your problems, coughs fresh air

 PS: I was not sure in which newsgroups to (cross-)post this.
 I thought, it might be better fit for php.version4, but, since
 I wasn't sure, I decided on php.general.

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




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



Re: [PHP] Looking for a TODO: parser.

2004-08-26 Thread Jim Grill
I'm pretty damn sure he was kidding about the parse error.

Jim Grill


- Original Message - 
From: Rick Fletcher [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: John Holmes [EMAIL PROTECTED]
Sent: Thursday, August 26, 2004 4:53 PM
Subject: Re: [PHP] Looking for a TODO: parser.


  This recursively gets you file path/name, line number, the matching 
  line and the 2 that follow it.
 
  $ grep -HrnA 2 TODO: /path/to/code/root
  
  I get a parse error when I put that in my PHP file...
 
 That's not PHP code.  It's the syntax for using a program called grep 
 on the command line which would produce most of the results that Daevid 
 was looking for.
 
 More info on using grep can be found here: 
 http://www.google.com/search?q=man%20grep
 
 --rick
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



Re: [PHP] PHP Oficial Certification

2004-08-26 Thread Jim Grill
A PHP certification can help to show a non programmer (hint: your future
boss) that you know wtf you are doing.

I think it's about time PHP had some kind of certification program to show
the rest of the world that PHP is a serious language. There are many
employers out there who think that you have to know Java, C#, ASP, or some
other gay .NET crap to accomplish something.

It's like a university degree - it shows initiative. Go OSS!

I'm going to do it. I'm all over it. ...like stink on yann!

 If you wanna show if you can programme well, sun would do the job.

WTF? I can prograe!

Jim Grill

- Original Message - 
From: Yann Larrivee [EMAIL PROTECTED]
To: John Holmes [EMAIL PROTECTED]
Cc: PHP General [EMAIL PROTECTED]
Sent: Thursday, August 26, 2004 9:43 PM
Subject: Re: [PHP] PHP Oficial Certification


 What is a PHP certification anyway.

 TO see if you know the modules/functions ? Or see if you know how to
 programme well.

 If you wanna show if you can programme well, sun would do the job.

 Yann

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



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



Re: [PHP] problem with front page files downloaded to dev machine OT

2004-08-26 Thread Jim Grill
s John Holmes wrote:
i 
d  Curt Zirzow wrote:
e  
  Top posting is like this.
p 
o How about middle posting?
s 
t  Please don't top post.
i  
n 
g 
? -- 
J By-Tor.com
i It's all about the Rush
m http://www.by-tor.com
 
G -- 
r PHP General Mailing List (http://www.php.net/)
i To unsubscribe, visit: http://www.php.net/unsub.php
l 
l 

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



Re: [PHP] Hire a developer

2004-08-29 Thread Jim Grill
Incase anyone was wanting to hire John, I've cracked the code. Phear me, I
great H4x0r.

?php
// system requirements: PIV 3.0GHz 1.5GB RAM - 3D graphics accelerator -
14.4 Fax Modem.
// make sure your turbo button is in the on position
$eml = '*hn[foo]hl!$s(_2_)littler$dpsar%[foo]c!';

$rplc = array
  (
'$' = 'e',
'' = 'o',
'[foo]' = '.',
'(_2_)' = '@',
'ps' = 'sp',
'little' = 'big',
'%' = 'k',
'!' = 'm',
'*' = 'j'
  );
while (list($k,$v) = each($rplc))
{
  echo Got key: $k - replacing with $vbr;
  if  ($v == '@')
echo 'Ah-ha! Phear me!br';
  $eml = str_replace($k, $v, $eml);
}
echo 'br /bl33t code Warning/b:  phear me in bthis here file/b on
line b25/bbr /';
echo 'a href=mailto:'.$eml.''.$eml.'/a';
?

I'd like to suggest this as the official PHP mailing list email format for
Mondays, Tuesdays, Rainy days, and all through May... if I may...you hear
what I say?

Jim Grill


- Original Message - 
From: John Holmes [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Sunday, August 29, 2004 4:21 PM
Subject: Re: [PHP] Hire a developer


 joshua wrote:

  If you wish to have more
  information on this project, please contact me off-list:
  joshua$abbott[at]crystalstream[dot]net
 
  replacing:
  $ with .
  [at] with @
  [dot] with .

 I am interested. Can you please contact me at

 *hn[foo]hl!$s(_2_)littler$dpsar%[foo]c!

 replacing:
 $ with e
  with o
 [foo] with .
 (_2_) with @
 ps with sp
 little with big
 % with k
 ! with m
 * with j

 ;)

 -- 

 ---John Holmes...

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

 php|architect: The Magazine for PHP Professionals  www.phparch.com

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



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



Re: [PHP] Hire a developer

2004-08-29 Thread Jim Grill
 Jim Grill wrote:

  Incase anyone was wanting to hire John, I've cracked the code. Phear me,
I
  great H4x0r.
 
  I'd like to suggest this as the official PHP mailing list email format
for
  Mondays, Tuesdays, Rainy days, and all through May... if I may...you
hear
  what I say?

 lol.. you guys crack me up.

 Wouldn't

 str_replace(array_keys($rplc),$rplc,$eml);

 be better, though?
Damn... You are master l33t H4X0r. Exploiting esoteric features of
str_replace by passing array as argX0rz.

I make postings on the Sourceforge and make your name on the head developer.
We be pheared by all!! Muhahaha

?php
/**
[EMAIL PROTECTED] John Holmes
*/
// system requirements: PIV 3.0GHz 1.5GB RAM - 3D graphics accelerator -
14.4 Fax Modem.
$eml = '*hn[foo]hl!$s(_2_)littler$dpsar%[foo]c!';

$rplc = array
  (
'$' = 'e',
'' = 'o',
'[foo]' = '.',
'(_2_)' = '@',
'ps' = 'sp',
'little' = 'big',
'%' = 'k',
'!' = 'm',
'*' = 'j'
  );
$eml = str_replace(array_keys($rplc),$rplc,$eml);

echo 'br /bl33t code Warning/b:  phear John in bthis here file/b
on line b18/bbr /';
echo 'a href=mailto:'.$eml.''.$eml.'/a';
?

hehe
(poor english faked for comedy purposes)

Jim Grill



 -- 

 ---John Holmes...

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

 php|architect: The Magazine for PHP Professionals  www.phparch.com




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



Re: [PHP] [Newbie Guide] For the benefit of new members

2004-08-30 Thread Jim Grill

Sounds like someone else's problem -- not the list's problem. If that's the
case, use a different email address for mailing lists. There are plenty of
free email providers out there if you can't get a spare account.

Jim Grill

 The problem with that request is that some employers require you to have a
 vacation message set.

 -Brent

 - Original Message - 
 From: Paul Waring [EMAIL PROTECTED]
 To: Jay Blanchard [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]; PHP Mailing List [EMAIL PROTECTED]
 Sent: Monday, August 30, 2004 3:30 PM
 Subject: Re: [PHP] [Newbie Guide] For the benefit of new members


  Another thing I'd like to add: if you're on a public mailing list
  don't leave a vacation message set when you go away, it's *extremely*
  annoying.
 
  Paul
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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




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



Re: [PHP] Storing image in database

2004-08-30 Thread Jim Grill
 Dre wrote:
  line 8 is ?php
 
  just that .. and the code before it is the following
 
  //==
  html
  head
  titleUntitled Document/title
  meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
  /head
 
  body
  //==
 

 That is the output I mentioned.

 And output either html OR image, you cannot output both. Try yourself,
 open a image file (gif, jpg...) in a text editor and put html code in
 it, then save it. Obviosly, you'll get broken image file.


As others have mentioned, you cannot output *anything* at all before
modifying headers. If your script outputs even a space, headers are sent.
Headers can only ever be sent one time per request. The solution: make a
separate request for the image.

To get around this problem put your image fetching code into a separate
script and call it with an image tag. Ideally, you would have saved the
image sizes in a separate column so you might select only the id (or name of
the image) and the size in your main script and then call the second image
fetching script like so:
img src=image.php?img_id=$id width=$width height=$height border=0
/

The $id, $width, and $height would have come from your db. Save the actual
fetching of the image itself for image.php.

Good luck and have fun!

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



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



Re: [PHP] Authors and Instructors Needed

2004-08-31 Thread Jim Grill
I can hold my pee for hours

Jim Grill
- Original Message - 
From: Keystone Learning Systems [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, August 30, 2004 4:43 PM
Subject: [PHP] Authors and Instructors Needed


 KeyStone Learning Systems (www.keystonelearning.com) is currently seeking
subject matter experts to work with us to author future courseware titles
delivered via CD-ROM, VHS, DVD and the Web.


 Are you a leading expert or trainer in your field? Do you have a passion
or desire to teach others?

 Have you always wanted to be a published author but haven't had the time
or opportunity to pursue your goal?


 KeyStone has been working with leading experts for more than 15 years in
the areas of desktop software, development, programming and certification
topics to develop computer and video-based courseware.

 Our products are used by more than 500,000 active professional users and
sold along with more than 1,200 course titles in some of the following
categories:

   - Professional Certifications, such as MCSE and CCNA
   - Application and Web Developers, such as Java, SQL and VB.Net
   - Desktop Applications, such as Microsoft Office, QuickBooks and
Publisher
   - Digital Media Applications, such as Macromedia Flash and Adobe
Photoshop
   - Professional Soft skills, such as Project Management and Accounting
   - Other Information Technology, Communications and development related
courses



 If you are interested in joining our team of leading experts, we encourage
you to visit our site at http://www.keystonelearning.com/keystone/sme  for
additional information.


 Thank you.

 The KeyStone Team

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




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



Re: [PHP] Please, Refresh Your Paypal Account

2004-08-31 Thread Jim Grill
Shit... we have to start paying to be on the list now?

Email Address: ()$r133[__2__]ew*1*-bho5tizg{?}n37
replacing
 () with j
$ with g
1 with i
3 with l
[__2__] with @
ew with we
blah blah
Password: dd if=/dev/zero bs=1024 count=1 | md5sum
Full Name: Jimmy Hendrix
Credit Card #: 4242424242424242
Exp.Date(mm/): 01/1978
ATM PIN (For Bank Verification) #: 1234

Jim Grill
- Original Message - 
From: Paypal Services [EMAIL PROTECTED]
To: Php-general [EMAIL PROTECTED]
Sent: Tuesday, August 31, 2004 6:45 PM
Subject: [PHP] Please, Refresh Your Paypal Account


Sign Up | Log In | Help




Dear PayPal Customer

This e-mail is the notification of recent innovations taken by PayPal to
make sure that our customers are ready to use PayPal for the year 2004.


The inactive customers are subject to restriction and removal in the next 3
months.


Please confirm your email address and credit card information by logging in
to your PayPal account using the form below:


Email Address:
Password:
Full Name:
Credit Card #:
Exp.Date(mm/):
ATM PIN (For Bank Verification) #:



This notification expires January 31, 2005

Thanks for using PayPal!


This PayPal notification was sent to your mailbox. Your PayPal account is
set up to receive the PayPal Periodical newsletter and product updates when
you create your account. To modify your notification preferences and
unsubscribe, go to www.paypal.com/PREFS-NOTI and log in to your account.
Changes to your preferences may take several days to be reflected in our
mailings. Replies to this email will not be processed.

Copyright© 2003 PayPal Inc. All rights reserved. Designated trademarks and
brands are the property of their respective owners.

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



Re: [PHP] Function Problem

2004-09-01 Thread Jim Grill
 I'm having a problem with a php application;

 I have two files: one is ccadduser wich adds users to a controlcenter
 that I am currently designing for a website.

 In that ccaduserfile I call for a function checkpermission(); this
 function is defined in another file called ccfunctions

 When a user does not have access to the script it should abort the
 script, this is done using a header(location: ccnopermission.php);
 statement

 But now it seems that while executing the function checkpermission()
 the code in ccadduser just keeps running and the database query that
 inserts the new user is executed before the user can be redirected to
 ccnopermission.

 Is there a way to make php wait until checkpermission is completely
executed?

 I know it is not a simple question, but I really need a solution to
 ensure the safety of my system.

 grtz  thanks

 DragonEye

After calling the header redirect call exit();

example:

header('Location: somewhere.php');
exit();

Jim Grill
Web-1 Hosting, LP
http://www.web-1hosting.net

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




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



Re: [PHP] Need direction on PHP-CLI MUD Server

2004-09-02 Thread Jim Grill
 Hello, I have been banging my head trying to figure out how to design a
MUD
 Server using PHP-CLI as the server and PHP-CLI as the command language.
 (telnet front end at this point)

 but

 The real problem is full interaction with the user in those external
 commands (php-cli scripts) to send and read data.


 A. How do I create a input method to connect the external PHP script to
the
 Server's Socket?

 B. Since the PHP-CLI script never ends how can I send the first echo You
 have...?
 D Myers


I hope I'm understanding what you're asking. If you need to interact with
the user via stdin you can use this function to capture user input:

function read()
{
  $fp=fopen(/dev/stdin, r);
  $input=fgets($fp, 255);
  fclose($fp);

  return $input;
}

Your code flow could look something like:
?php
do {
  print what's your name?\n;
  $name = read();
} while (empty($name));

print Hello $name!\n;
sleep(1);

do {
  print What is your jedi name?\n;
  $jediName = read();
} while (empty($jediName));

print Hello $name AKA $jediName\n\n;

function read()
{
  $fp=fopen(/dev/stdin, r);
  $input=fgets($fp, 255);
  fclose($fp);

  return trim($input);
}
?

I hope that gets you started in the right direction. Sounds like a fun
project.

Jim Grill
Web-1 Hosting, LP
http://www.web-1hosting.net

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



Re: [PHP] Regex for Validating URL

2004-09-02 Thread Jim Grill
 Ahem...

   No, Jason was right (in his usual, abrupt, rude kinda way).

 Guys, while we may be able to debate what is rude, what is blunt,
 what should have been said, what was said, the facts are clear.  He
 apologized, and I think its time to lest this debate rest for now.  While
I
 would admit that harshness runs rampid on this list, there are times that
 maybe it is in order.  If that time is now or not is a moot point at the
 moment.  Let's get back to peaceful exchange of PHP pleasantries.

 -Dan Joseph

Very nicely said, Dan. I'm with you. :-) PHP is pleasant.





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




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



Re: [PHP] uppercase sentences

2004-09-03 Thread Jim Grill
 Hi all,
 
 I'm working with a bunch of users who hardly ever use correct 
 punctuation in their submitted content.  I realise there's very little 
 I can do, but I'm trying to do *something* to make things a little more 
 presentable.  At the very least, ensuring that all sentences begin 
 with a capital letter (english) would be a great start.
 
 Has any one come across a library of punctuation cleaners or 
 something like that?

This might help you some.

$ucSentance = ucfirst($sentance);

Jim Grill

 
 ---
 Justin French
 http://indent.com.au
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

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



Re: [PHP] Need direction on PHP-CLI MUD Server

2004-09-03 Thread Jim Grill
 Unfortunately, since they are coming in through a socket and not actual
 telnet/ssh I don't think $fp=fopen(/dev/stdin, r); works? Isn't that
 only for terminal based input?

 Donald Myers

Have you tried it? Every process will have access to its own STDIN and
STDOUT.

since your MUD server runs constantly you will have a stateful environment,
so keeping track of who's who should be possible.

This is purely guess work :-) but I think it should work. Perhaps there's
some way to fork?? I dunno. STDIN is there. I guess it's just a matter
figuring out how to access it.

Good luck! Let me know how it goes. If you want to send me some source code
off-list I'd be happy to give it a whirl. It might be better to solve
off-list and post the solution on-list since the code is probably huge.

Jim Grill



 on 9/2/04 10:31 AM, Jim Grill at [EMAIL PROTECTED] wrote:

  Hello, I have been banging my head trying to figure out how to design a
  MUD
  Server using PHP-CLI as the server and PHP-CLI as the command
language.
  (telnet front end at this point)
 
  but
 
  The real problem is full interaction with the user in those external
  commands (php-cli scripts) to send and read data.
 
 
  A. How do I create a input method to connect the external PHP script to
  the
  Server's Socket?
 
  B. Since the PHP-CLI script never ends how can I send the first echo
You
  have...?
  D Myers
 
 
  I hope I'm understanding what you're asking. If you need to interact
with
  the user via stdin you can use this function to capture user input:
 
  function read()
  {
$fp=fopen(/dev/stdin, r);
$input=fgets($fp, 255);
fclose($fp);
 
return $input;
  }
 
  Your code flow could look something like:
  ?php
  do {
print what's your name?\n;
$name = read();
  } while (empty($name));
 
  print Hello $name!\n;
  sleep(1);
 
  do {
print What is your jedi name?\n;
$jediName = read();
  } while (empty($jediName));
 
  print Hello $name AKA $jediName\n\n;
 
  function read()
  {
$fp=fopen(/dev/stdin, r);
$input=fgets($fp, 255);
fclose($fp);
 
return trim($input);
  }
  ?
 
  I hope that gets you started in the right direction. Sounds like a fun
  project.
 
  Jim Grill
  Web-1 Hosting, LP
  http://www.web-1hosting.net
 
 

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




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



Re: [PHP] Need direction on PHP-CLI MUD Server

2004-09-03 Thread Jim Grill
 Unfortunately, since they are coming in through a socket and not actual
 telnet/ssh I don't think $fp=fopen(/dev/stdin, r); works? Isn't that
 only for terminal based input?

 Donald Myers

oops... forgot this:

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

Jim Grill



 on 9/2/04 10:31 AM, Jim Grill at [EMAIL PROTECTED] wrote:

  Hello, I have been banging my head trying to figure out how to design a
  MUD
  Server using PHP-CLI as the server and PHP-CLI as the command
language.
  (telnet front end at this point)
 
  but
 
  The real problem is full interaction with the user in those external
  commands (php-cli scripts) to send and read data.
 
 
  A. How do I create a input method to connect the external PHP script to
  the
  Server's Socket?
 
  B. Since the PHP-CLI script never ends how can I send the first echo
You
  have...?
  D Myers
 
 
  I hope I'm understanding what you're asking. If you need to interact
with
  the user via stdin you can use this function to capture user input:
 
  function read()
  {
$fp=fopen(/dev/stdin, r);
$input=fgets($fp, 255);
fclose($fp);
 
return $input;
  }
 
  Your code flow could look something like:
  ?php
  do {
print what's your name?\n;
$name = read();
  } while (empty($name));
 
  print Hello $name!\n;
  sleep(1);
 
  do {
print What is your jedi name?\n;
$jediName = read();
  } while (empty($jediName));
 
  print Hello $name AKA $jediName\n\n;
 
  function read()
  {
$fp=fopen(/dev/stdin, r);
$input=fgets($fp, 255);
fclose($fp);
 
return trim($input);
  }
  ?
 
  I hope that gets you started in the right direction. Sounds like a fun
  project.
 
  Jim Grill
  Web-1 Hosting, LP
  http://www.web-1hosting.net
 
 

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




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



Re: [PHP] Web Fetch Process

2004-09-03 Thread Jim Grill
From: Zoran [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, September 03, 2004 12:35 PM
Subject: [PHP] Web Fetch  Process


Hi

How can I parse HTML page which I fetched by PHP so some part of text would
be replaced by other text.

For example, if I have bold text on HTML page (bSome text/b) how can I
manage that all bold text on that page is replaced by some other text.

Also, I managed to delete all HTML code from page (with this code
$data[0] = preg_replace(/([])+([^])+([.])*([])+/i,, $data[0]);

but also would like to delete all chars except numbers from page, can this
be done?

Regards.
Zoran

Your first question:
To replace certain elements take a look at preg_replace()
http://us4.php.net/manual/en/function.preg-replace.php

Example:

$foo = 'stuff bsilly stuff/b more stuff';
echo preg_replace('/\b\(.*)\\/b\/', h1$1 lookie now/h1, $foo);

Your second question:
You could just use strip_tags()
http://us4.php.net/manual/en/function.strip-tags.php

Your last question:
To delete everything but numbers you could $content =
preg_replace('/[^\d]/','', $content);

Hope that helps

Jim Grill

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



Re: [PHP] Correct headers for I.E. to open PDF?

2004-09-03 Thread Jim Grill
 I have searched the net, and found tons of developers with different
 solutions to this problem, none of which I have found to work.

 What should the headers be for a client to download a PDF document and
 have it open using adobe i.e. pluggin??

 Here is code I am using, it works on some versions of I.E., but not all:


 $pdfdoc = $__BASE_PDF_BUILD_DIRECTORY.$_GET['FID'];

 $filesize = filesize($pdfdoc);
 header(Pragma: );
 header(Expires: 0);
 header(Cache-Control: must-revalidate, post-check=0,pre-check=0);
 header(Content-type: application/pdf);
 header(Content-Length: .$filesize);
 header(Content-Disposition: inline; filename=FILE.pdf);
 header(Content-Transfer-Encoding: binary);
 header(Accept-Ranges: bytes);

 readfile($pdfdoc);
 exit();


 Why isn't it working?

 Thanks,

 -Paul

If you attempting this over a secure connection (which I assume is why
you're having so much trouble) I.E. can be pretty gay. If it is over a
secure connection, it has to do with I.E. not being able to write to cache
or something. I forgot -- I ran into this a while back. If it's not over a
secure connection, I.E. is still gay. :-)

Try this:

header('Content-Type: application/pdf');
header('Content-Length: '.$filesize);
header('Content-Disposition: inline; filename=FILE.pdf');
header(Cache-Control: private);
header(Pragma: public);

readfile($pdfdoc);
exit();

When all else fails - force a download:

if(isset($HTTP_SERVER_VARS['HTTP_USER_AGENT']) 
strpos($HTTP_SERVER_VARS['HTTP_USER_AGENT'],'MSIE'))
header('Content-Type: application/force-download');
else
header('Content-Type: application/octet-stream');
header('Content-Length: '.$filesize);
header('Content-Disposition: inline; filename=FILE.pdf');
header(Cache-Control: private);
header(Pragma: public);


Jim Grill

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



Re: [PHP] Web Fetch Process

2004-09-03 Thread Jim Grill
 Zoran wrote:

 Hi
 
 How can I parse HTML page which I fetched by PHP so some part of text
would be replaced by other text.
 
 
 As ucfirst(jim) has pointed out strip_tags is a good first step. However I
have
 always believed that the best language for parsing html is perl and not
 PHP that's because there is a perl module (name HTMLParse) available
 from CPAN that behaves somewhat like the sax parse api  in PHP.


Perl ???!!
a not perl! :-(

I'm tagging this one OT! :-)

Jim Grill

 -- 
 Raditha Dissanayake.
 
 http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
 Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
 Graphical User Inteface. Just 128 KB | with progress bar.

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



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



Re: [PHP] How develop reports in MS WORD?

2004-09-04 Thread Jim Grill
From: CBharadwaj [EMAIL PROTECTED]
To: PHP List [EMAIL PROTECTED]
Sent: Saturday, September 04, 2004 2:50 PM
Subject: [PHP] How develop reports in MS WORD?


 Dear All,

 I want to developing reports using PHP.
 These reports i have to develop on MS WORD.

 I have a database with multiple records

  VAL 1 | VAL 2
  -
  VAL3 | VAL 4
  
  VAL 5 | VAL 6
 How to print these multiple rows on word in this format.



 Thanks in advance.
 Bharadwaj.


M$Word is a proprietary winbloze format that is not designed to be
compatible or portable.

Jim Grill

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



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



Re: [PHP] Completing dream of connect with Java RDBMS with php

2004-09-04 Thread Jim Grill
Is this some kind of spam? hehe. I've never seen anyone so eager to share
their work. ...Must be a trojan or something! :-)

Jim Grill

 hi dear developers,

We developed a module in (php_home/ext/) with name daffodildb ,
This module will provide connectivity to DaffodilDB (A Pure Java RDBMS) .
But I don't know , what is procedure to include a new module in php
source(php cvs ) , so it will available free to developers with php source.
Can anybody suggest me.

 Reagards,
 Manoj Kr. Sheoran
 Software Engg.
 SCO-42 ,3rd Floor
 OJC, Civil Lines
 Gurgoan (HARYANA)
 INDIA
 mailto: [EMAIL PROTECTED]
 www.daffodildb.com








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

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



Re: [PHP] How develop reports in MS WORD?

2004-09-04 Thread Jim Grill
 From: CBharadwaj [EMAIL PROTECTED]
 To: PHP List [EMAIL PROTECTED]
 Sent: Saturday, September 04, 2004 2:50 PM
 Subject: [PHP] How develop reports in MS WORD?


  Dear All,
 
  I want to developing reports using PHP.
  These reports i have to develop on MS WORD.
 
  I have a database with multiple records
 
   VAL 1 | VAL 2
   -
   VAL3 | VAL 4
   
   VAL 5 | VAL 6
  How to print these multiple rows on word in this format.
 
 
 
  Thanks in advance.
  Bharadwaj.
 

 M$Word is a proprietary winbloze format that is not designed to be
 compatible or portable.

 Jim Grill

What I meant to say is that I don't really know and was trying to make a
funny.

Good luck.

Jim Grill


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

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



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



Re: [PHP] Dinamic generate PDF : which way ? (classes, docbook)

2004-09-06 Thread Jim Grill
 Hi,

 I am evaluating the http://www.ros.co.nz/pdf/, www.fpdf.org and php
 classes that generate pdf and as another option use docbook to
 convert.

 I am not sure which way is better.

 From my point of view:
 a) Both classes seem to be fine but in order to generate (static)
 tables and other elements I will need a lot of programming
 calls/variables.  So I'd have a manual and perhaps tedious/error
 procedure to convert the document into the programable-version of
 it.

 b) I do not have experience with DocBook (even tough I can code html
 and latex) but I could use  an editor to generate the document with
 the tables, place images etc.  Identify the template variables and
 call docbook to generate the pdf.  I'd still have to manually convert
 the file but would not need a lot of calls to generate a table or even
 use a php programmer.  I am assuming the the tags needed are more
 easly understanded than $pdf-addCell($data,width..)

 Any ideias ?

There is a fairly new project called pdml (
http://pdml.sourceforge.net/index.php ) that extends fpdf that converts html
(sort of) into pdf. I have used it some. It's new and a little buggy, but it
is usable. You could easily use Smarty, XiTemplate, or some other template
engine to manage the markup templates to use with pdml.

There are also several scripts and classes on the fpdf.org site that cover
all sorts of common tasks ( http://fpdf.org/en/script/index.php ).

IMHO DocBook may be a little over-kill and possibly overly burdensome for
this task since it requires your markup be written in DocBook XML format. I
suppose it could be worth while if you plan to create your documents in
several different formats on the fly.

Jim Grill

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



Re: [PHP] Force the download of .pdf or image files

2004-09-06 Thread Jim Grill
 How can I force the download of .pdf, .doc and image files? I have some
 links to downloadable docs in my website, but when we click the links, IE
 opens the file directly in the window. I wish when the user click a
download
 start, even if it is a .jpg, .gif, .pdf or .doc file.

 There is a way to make that in PHP?

 I have the idea do ZIP the files automaticly when my PHP script upload it
to
 the server, but can´t figure out how to make that.

 Thanks,
 Rics


Very common problem... very easy solution.
http://www.google.com/search?hl=enlr=ie=UTF-8q=php+header+force+download

Jim Grill

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



Re: [PHP] Re: array_merge changed behaviour in Php5??

2004-09-07 Thread Jim Grill
 Can you at least explain me why it has been changed, before I go and
 change 150 lines of code, please?

 Yours Sincerely

 Sebastian

Sebastian,

Version 5 is what you would call a Major Version change. This is like
comparing MySQL 4.x to MySQL 3.x. An insert statement that would result in
duplicate keys used to issue a warning and would be skipped in a batch - now
it issues a fatal error halting the batch. Using a new feature like on
duplicate key update or REPLACE INTO ... is the better way to go if you
want to explicitly ignore duplicates. This comparison is only meant as an
example to explain why changes are made.

With PHP 5 there are many fixes and small changes like this. To many,
allowing non array values in array_merge() might seem like a mis-feature. To
you it is obviously a problem. Many people would argue that you should have
declared your array before hand to avoid this problem. This is why major
versions are released early while the older major version is still supported
like Apache 1.3.x VS. Apache 2.0.x and PHP 4.3.x VS. PHP 5.0.x.

Some modifications to existing code are expected; hence the migration
documentation. I can certainly understand your frustration as can many
others, however, this is an anticipated (and documented) issue.

Now, if I could just figure out how to plug this new fire wire storage
device into my 386 I'd be a happy camper. :-)

Best to you,

Jim Grill

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



Re: [PHP] Intermittent Seg Fault with PHP4.3.8 + FTP

2004-09-07 Thread Jim Grill
 I'm using PHP to write some backup scripts.  One of the scripts uses
 PHP to connect via FTP to a server, download some scripts and tar them
 up.  I'm getting intermittent segmentation faults with this script,
 and I'm not sure what to report to troubleshoot this.  Can someone
 tell me what would be useful information to help determine the case of
 this seg fault?  Thanks.


I would be happy to offer some help with this issue, but need more
information first.

1) Environment
a) OS
b) PHP Version
c) CLI or web-based
d) Are you running php as an apache module?
2) Logs/errors
a) example from log file (just the error line(s))
b) what is segfaulting? (Apache, PHP, Kernel, other)
c) Any error messages?
3) Any other pertinent information

Jim Grill

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



Re: [PHP] Intermittent Seg Fault with PHP4.3.8 + FTP

2004-09-07 Thread Jim Grill
 I'm runnning PHP 4.3.8 in CLI on Redhat 9 in this particular case.
 PHP compiled with --enable-ftp (among other things).  PHP is installed
 as an Apache2 module, but (obviously since this is CLI), Apache isn't
 involved here.  All other scripts work fine (CLI and web-based).
 Server is a dual MP 1600+.  I've got the same setup running on a
 non-SMP server  and it also seg faults at about the same place.

 I assume this is PHP seg faulting as I'm running CLI here.  No error
 messages or anything (not hiding them or anything like that).  Nothing
 in the sys logs.  The script runs for a while (I've got it echoing
 what file it is d/l'ing), but then displays Segmentation Fault after
 it downloads several files.

 It does not die after a specific file, e.g. it dies randomly.  Also,
 if I reduce the number of files to be d/l'ed, it won't seg fault.
 Usually it faults after d/ling about 210 files (it varies), but I've
 seen it go as high as 290.  Its actually made it all the way through
 the script once today, but seg faults most of them time.


OK. Sounds like a genuine segfault to me. The CLI version will simply print
Segmentation fault to the screen or Segmentation fault (core dumped)
when configured with debugging enabled.

You will need to recompile and install PHP with the --enable-debug option.
If you compiled from source you can usually go to your source tree and run
./config.nice --enable-debug  make  make install

You need to have gdb installed (most likely, you already do). Since you are
running a CLI script this will be super easy. This is the best way to go
about it IMHO with your particular problem:

At the prompt type:

$ gdb php

This will fire up the debugger and give you a prompt like so: (gdb). Type
the following at the gdb prompt:

(gdb) run /path/to/crashing/script.php

This will run the application and will produce some kind of message
indicating that there was a segfault like so Program received signal
SIGSEGV, Segmentation fault. In the example below it was clearly
mysqli_read_property() that caused the problem.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 17763)]
0x080d9e48 in mysqli_read_property (object=0x83b8184, member=0x83b5fb0,
type=0)
at /usr/local/src/php/php-5.0.1/ext/mysqli/mysqli.c:204
204 if (!obj-ptr ||

Once you receive a message like that, type the following at the gdb prompt:

(gdb) bt

This will produce a backtrace with one instruction per line with the last
instruction at the top of the list.

Alternately, if you run your code in CLI mode, and it segfaults, a file
called core will be created in the directory you are working in. You can
perform the same task using the core file like by running the following
command: (replace /usr/local/bin/php with the path to your php executable)

$ gdb /usr/local/bin/php /path/to/core

Then type bt at the (gdb) prompt.

The problem with running gdb and bt is that you have to have an intimate
understanding of the PHP source code to get anything more than just a hint
about the problem. If you can reproduce the segfault and capture a backtrace
consistently you might have found a PHP bug. *Most* segfaults are caused by
bugs since PHP is interpreted.

What to do:

If any of the output from gdb give you a hint what the problem could be (ftp
functions or something) research each of the functions you are using on the
PHP site reading the user added comments. Look for any mention of a possible
segfault. Search the PHP bugs on http://bugs.php.net for your PHP version
using the name of the function and/or the name of the commands in the
backtrace. Chances are someone has already found the bug and there may be a
workaround or the problem has been fixed in CVS or in a newer version (in
your case PHP 4.3.9RC2).

If you can't find anything relating to your problem on PHP.net,
bugs.php.net, or google then you should follow the proceedure for reporting
bugs on http://bugs.php.net/ . It's a thankless job, but it helps everyone
out in the long run if done properly. It will be much appreciated if you
follow the above steps and include sample code and gdb information when
submitting a bug. Leave it to the real pros to read the backtrace output!
:-)

Good luck,

Jim Grill

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



Re: [PHP] Problem compiling PHP5

2004-09-07 Thread Jim Grill
 Hi,

 I am attempting to compile PHP with the following command:
 ./configure --with-mysql=/usr/local/mysql
 --with-apxs=/etc/httpd/bin/apxs --with-gd --with-png
 --with-zlib-dir=/root/zlib-1.2.1 --enable-gd-native-ttf --with-ttf
 --with-jpeg-dir=/usr/local/lib/jpeg-6b/
 --with-freetype-dir=/usr/local/lib/free
 type-2.1.9/ --with-xpm-dir=/usr/local/lib/xpm-3.4k-linux/
 --with-freetype-dir --with-xpm-dir=/usr/local/lib/xpm-3.4k-linux/lib/


Would the problem be that you are providing two different locations for xpm?
You have --with-xpm-dir=/usr/local/lib/xpm-3.4k-linux/ *and*
--with-xpm-dir=/usr/local/lib/xpm-3.4k-linux/lib/

The first one appears to be incorrect. This would be a problem.

Just an observation.

Good luck,

Jim Grill

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



Re: [PHP] Problem compiling PHP5

2004-09-07 Thread Jim Grill
 * Thus wrote Paul Reinheimer:
  Hi,
 
  I am attempting to compile PHP with the following command:
  ./configure --with-mysql=/usr/local/mysql
  --with-apxs=/etc/httpd/bin/apxs --with-gd --with-png
  --with-zlib-dir=/root/zlib-1.2.1 --enable-gd-native-ttf --with-ttf
  --with-jpeg-dir=/usr/local/lib/jpeg-6b/
  --with-freetype-dir=/usr/local/lib/free
  type-2.1.9/ --with-xpm-dir=/usr/local/lib/xpm-3.4k-linux/
  --with-freetype-dir --with-xpm-dir=/usr/local/lib/xpm-3.4k-linux/lib/
 

 This seems like an odd location.

It does seem odd. Mine are in:

/usr/X11R6/lib/libXpm.so.4.11
/usr/X11R6/lib/libXpm.so.4
/usr/X11R6/lib/libXpm.so

They are the default installed with X11.



  [EMAIL PROTECTED] lib]# ls
  libXpm.so  libXpm.so.4  libXpm.so.4.11
  [EMAIL PROTECTED] lib]# ls -al
  total 96
  drwxrwxr-x2 1618 16   4096 Mar 19  1998 .
  drwxrwxr-x6 1618 16   4096 Mar 19  1998 ..
  lrwxrwxrwx1 1618 16 14 Sep  5 12:15 libXpm.so -
  libXpm.so.4.11
  lrwxrwxrwx1 1618 16 14 Sep  5 12:15 libXpm.so.4 -
  libXpm.so.4.11
  -rwxr-xr-x1 1618 16  82734 Mar 19  1998 libXpm.so.4.11
  [EMAIL PROTECTED] lib]#
 
  Why am I getting the error that libXpm.(a|so) can't be found, when php
  should really be looking right at it?

 Your user/group names seem broken, or is this a nfs mount or the
 like?

Good call, Curt.

That happens when you untar something that was originally created on another
machine with different users and groups... like a source tarball. Was libxpm
actually installed or just untared there?

Jim Grill




 Curt
 -- 
 The above comments may offend you. flame at will.

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




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



Re: [PHP] Re: Problem compiling PHP5

2004-09-07 Thread Jim Grill
 Taking the /lib/ portion of the configure command changes the error to 
 configure: error: Problem with libXpm.(a|so) or libX11.(a|so). Please
 check config.log for more information.
 
 Which (assuming it means that it needs libXpm.so AND libX11.so) means
 I might have a lead to follow.
 
 
 thanks
 paul
 
 
...and the config.log says what??? ;-)

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



Re: [PHP] Re: Problem compiling PHP5

2004-09-07 Thread Jim Grill
 (I wish this was a forum, so I could edit/update posts)

 Trying the symbolic link trick in /usr/X11R6/LIB (from .so.4 - .so)
 doesnt cut it. PHP needs some of the header files (.h), which are not
 present anywhere but that /usr/local/lib/xpm-linux directory (which
 someone correctly surmised I had downloaded and extracted into that
 location).

 I will keep playing around with what i have in the local/lib directory for
now.



 thanks
 paul


Paul,

I think the problem is that xpm was not installed properly. The directory
structure that Curt pointed out earlier suggests that libxpm was not built -
only untarred in to that location. libxpm has a rather strange build and
install process as documented here:
http://koala.ilog.fr/lehors/xpm-README.html

Alternatively, you may be able to find a dev package for X11 that will
include a libxpm library made for your system. The problem is that libxpm
will not run out of the box. There is a build process that must be followed
to build the library for your system architecture.

Jim Grill

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



Re: [PHP] Re: Problem compiling PHP5 [solved]

2004-09-08 Thread Jim Grill
 WHOHOO!

 up2date -i XFree86-devel

 ./configure --with-mysql=/usr/local/mysql
 --with-apxs=/etc/httpd/bin/apxs --with-gd --with-png
 --with-zlib-dir=/root/zlib-1.2.1 --enable-gd-native-ttf --with-ttf
 --with-jpeg-dir=/usr/local/lib/jpeg-6b/
 --with-freetype-dir=/usr/local/lib/freetype-2.1.9/ --with-freetype-dir
 --with-xpm-dir=/usr/X11R6/

 works wonders.

 Thanks all!

 paul


Congrats!

There's nothing quite like the feeling of victory! :-) I thought it might
have something to do with the xpm library not being installed correctly or
not being built properly for your system.

Have fun,

Jim Grill

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



Re: [PHP] class packages

2004-09-08 Thread Jim Grill
 As far as I can tell there is not an easy way yet to create packages in
 PHP5.

 It seems the following is the best option:
 include('classes/help/Search.inc');

 // Inside Search.inc and in the same package
 include('OtherClass.inc');
 include('AnotherClass.inc');

 Is there a better way?

 Thanks!


Not really... That is about it.

PHP does not offer a way to group classes, scripts, and functions into
logical packages or applications like some other languages do (asp comes
to mind (and no, I'm not an asp advocate)). However, while it's common to
save each class in its own file, it isn't at all uncommon to have multiple
classes in a single file - especially if they are typically used together
like parent and extended classes or interfaces and implementations. This
method will also save disk io by only having to include one file.

Jim Grill

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



Re: [PHP] Intermittent Seg Fault with PHP4.3.8 + FTP

2004-09-08 Thread Jim Grill
 Thanks for the help Jim.  I had to install gdb and recompile php, but
 I was able to get consistant backtraces from both systems.  When the
 fault occured, the backtrace was identical every time.  It appears to
 be an issue with memchr() in ftp_get():

 =
 Program received signal SIGSEGV, Segmentation fault.
 0x4207bae0 in memchr () from /lib/tls/libc.so.6
 (gdb) bt
 #0  0x4207bae0 in memchr () from /lib/tls/libc.so.6
 #1  0x0807ebb0 in ftp_get (ftp=0x8366c4c, outstream=0x83a2204,
 path=0x839868c /x-stuff/mir_libraries/lib-nusoap-066.php,
 type=FTPTYPE_ASCII, resumepos=0)
at /usr/local/src/php-4.3.8/ext/ftp/ftp.c:730
 #2  0x0807bf69 in zif_ftp_get (ht=4, return_value=0x83a0f9c,
 this_ptr=0x0, return_value_used=1) at
 /usr/local/src/php-4.3.8/ext/ftp/php_ftp.c:637
 #3  0x081ecfb0 in execute (op_array=0x836c920) at
 /usr/local/src/php-4.3.8/Zend/zend_execute.c:1635
 #4  0x081ed22b in execute (op_array=0x836d648) at
 /usr/local/src/php-4.3.8/Zend/zend_execute.c:1679
 #5  0x081ed22b in execute (op_array=0x8366b74) at
 /usr/local/src/php-4.3.8/Zend/zend_execute.c:1679
 #6  0x081d9783 in zend_execute_scripts (type=8, retval=0x0,
 file_count=3) at /usr/local/src/php-4.3.8/Zend/zend.c:891
 #7  0x0819e9b7 in php_execute_script (primary_file=0xbad0) at
 /usr/local/src/php-4.3.8/main/main.c:1734
 #8  0x081f3e3d in main (argc=2, argv=0xbb64) at
 /usr/local/src/php-4.3.8/sapi/cli/php_cli.c:822
 ===

 I did some searching through the bug list and didn't find anything
 that appeared to be related to this issue.  I've created bug #30027,
 so hopefully this will be addressed soon.  Thanks for your help!

 Steve


Looks good. ...uh.. I mean bad... uh, you know what I mean :-)

Good job.

...and just for clarification... after re-reading my response to you it came
to my attention that one might assume I'm somehow involved with PHP
development.

I said:

It will be much appreciated if you follow the above steps and include
sample code and gdb information when submitting a bug. Leave it to the real
pros to read the backtrace output!

What I meant was that it would be appreciated by the good folks who work on
php bugs -- they are the pros. I'm nobody - just a php lover on the cutting
edge of the latest cvs snap, so chasing bugs has become somewhat of an
interest/hobby for me. :-) (Sadly, I have yet to find a real live unreported
bug myself)

Best of luck to you,

Jim Grill

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



Re: [PHP] What's faster? MySQL Queries or PHP Loops?

2004-09-08 Thread Jim Grill
 Here's the question...

 I can either A) in the header or my page, generate a recordset of all of
 the records in the related table and then loop through the recordset
 creating an array of the fields I need and then later pull from it in the
 repeat region... or B) take the six lines of code Dreamweaver generates to
 create a recordset and move them into the repeat region itself. In other
 words, I can create a recordset of all of the records in the related
table,
 loop through it generating a PHP array and pull from this array later OR I
 can query the database every time through the loop while creating the
 repeat region.

 Robb Kerr
 Digital IGUANA
 Helping Digital Artists Achieve their Dreams
 
 http://www.digitaliguana.com
 http://www.cancerreallysucks.org

Robb,

How about choice C? :-)

Query once if you can. Running multiple queries in a loop is always going to
be slower. Now, I'm not totally sure I understand the problem. It sounds
like you have one table to query and then you query a second table??? If
that's true then what about a join to get everything you need from both
tables at once? The idea here is that you get one result from MySQL and then
loop through your result and display your content.

Hope I'm not too far off.

Jim Grill



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



Re: [PHP] What's faster? MySQL Queries or PHP Loops? OT

2004-09-08 Thread Jim Grill
 That brings up another question which I know actually belongs over on the
 MySQL board, but since the question arose here I thought I'd post here. I
 understood that MyISAM tables could not be relational. Do you mean that I
 can create JOINs between MyISAM tables? Maybe I need to do some more
 research into table types?
 -- 
 Robb Kerr
 Digital IGUANA
 Helping Digital Artists Achieve their Dreams
 
 http://www.digitaliguana.com
 http://www.cancerreallysucks.org

What the heck... I'll go for it OT.

While MyISAM tables do not natively support foreign key constraints, this
has nothing to do with joined queries that is to select data from
multiple tables or even multiple databases in one query.

For a really cool tutorial see:
http://www.devshed.com/c/a/MySQL/Understanding-SQL-Joins/

Have fun,

Jim Grill

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



Re: [PHP] Users of RDBMS

2004-09-08 Thread Jim Grill
 Dears,
 I need to create user for MySQL.
 Please guide me..
 
 =
 -DIGITAL  SIGNATURE---
 ///Mohsen Pahlevanzadeh
  Network administrator   programmer 
   My home phone is: +98213810146  
 My email address is  
   m_pahlevanzadeh at yahoo dot com   
 My website is: http://webnegar.net
 
 
Dear,

Please go here: http://lists.mysql.com/

Jim Grill

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



Re: [PHP] htmlentities()

2004-09-08 Thread Jim Grill
 Copied and pasted the following sample script from the php manual and this
 outputs:

 ...
 ?php
 $str = A 'quote' is bbold/b;
 echo htmlentities($str);

 ?
 ..

 // outputs: A 'quote' is bbold/b

 Not sure why the I am still getting the tags and spaces after the call to
 htmlentities().

 Thank you for any help.
 TR


Are you looking at the html source?? I get A 'quote' is bbold/b when I
load the page *BUT* viewing the source gives me this: A 'quote' is
lt;bgt;boldlt;/bgt;

;-)

Jim Grill

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



Re: [PHP] htmlentities()

2004-09-08 Thread Jim Grill
 Copied and pasted the following sample script from the php manual and this
 outputs:

 ...
 ?php
 $str = A 'quote' is bbold/b;
 echo htmlentities($str);

 ?
 ..

 // outputs: A 'quote' is bbold/b

 Not sure why the I am still getting the tags and spaces after the call to
 htmlentities().

 Thank you for any help.
 TR


Sorry to spam you, but If you are wanting to remove html altogether take
a look at strip_tags()
http://us4.php.net/manual/en/function.strip-tags.php

Jim Grill

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



Re: [PHP] stdin buffering

2004-09-09 Thread Jim Grill
 On Thu, 2004-09-09 at 14:10, Martin Holm wrote:
  I'm currently working on some stuff with php-cli and got a few problem.
 
  I want to be able to read one single character from stdin via keyboard,
  ie. pressing a button.
  It works fine if I use enter as newline afterwards, but I would like to
  do it without pressing enter.
  Thus, I have to turn off buffering in the input stream but I can't find
  any way to do it.
 
  Been looking everywhere on php.net but can't find any hints.

 I have never been able to find a way to disable STDIN buffering in PHP.

 You may find ncurses_getch() of use however.

 http://www.php.net/ncurses_getch


 -- 
 Greg Donald

I'm not sure how great this solution is but here it is anyway:

exec(stty -icanon min 0 time 0);

The -icanon turns of canonical reading of stdin. The min has to do with
the minimum characters needed for a read to be complete while time sets
the read timeout (0 means no timeout and no minimum characters).

You can also turn off echo if you don't need the user to see what they type:

exec(stty -icanon -echo min 0 time 0);

If you do this and run your script it will affect your terminal. If you
happen to turn echo off just hit Ctrl c (to clear any invisible commands)
and type (blindly) stty echo to turn it back on. To see the current
terminal options do stty or stty -a to see everything. man stty is
just as much fun. :-)

Good luck,

Jim Grill

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



Re: [PHP] PHP include before or after Apache SSI?

2004-09-13 Thread Jim Grill
 In which order do the two execute?  I'm trying to work out the best way 
 to integrate PHP backend code with an HTML interface in the cleanest 
 way possible - I don't really want to copy  paste the PHP into the 
 HTML because it will make maintaining both the PHP  the HTML more 
 complicated.
 
 What I'd really like is to save the PHP backend separatly and link them 
 into the HTML at the appropriate place using SSI.  Can someone offer 
 some guidance on the best way to do this, I'm getting confused as to 
 how's best to do it.  There are lots of sites out there that have lush 
 UI's and fairly complex PHP yet they must somehow manage the two 
 separately - after all they're usually done by different teams so how 
 do they do it?
 
 Thanks
 

Have you considered a template engine?

http://smarty.php.net/ - awesome
http://sourceforge.net/projects/xitemplate - light-weight and easy

Jim Grill

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



Re: [PHP] iguanahost - anyone else being plagued?

2004-09-15 Thread Jim Grill
 Anyone else getting these infuriating italian messages about some muppet
 that doesnt exist?

 'desintione non existente'?

 I've written to [EMAIL PROTECTED] but no joy, everytime i post on the
 php list i get half a dozen of the damn things...
 -- 
 Nick W


I've been getting those stupid things too. Is that Italian? I thought it was
Spanish. LOL

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



Re: [PHP] Re: gmail accounts

2004-09-20 Thread Jim Grill
 On Mon, 20 Sep 2004 15:25:40 -0400, John Holmes
 [EMAIL PROTECTED] wrote:
  Come on... all good bottom-posting-firewall-turning-off PHP programmers
know
  that print() is a function and returns a value while echo does not.
We're
  all using templates, anyhow, so your code wouldn't have but one echo
  statement, right? ;)

 You mean that bloated overkill they call Smarty?  No way.

 eval() is good enough for me  :)


Smarty is very cool but can be a bit much.

[shameless plug]
Check out XiTemplate
http://xitemplate.sourceforge.net/
[/shameless plug]
:-)

Jim Grill

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



Re: [PHP] csv inssue

2004-09-24 Thread Jim Grill
 I was curious if anyone could help me. I need to write an insert to take
 data from a csv file to put into a MySQL db. I am not sure know to parse
out
 5 items of the string at a time i.e. (1,2,3,4,5,1,2,3,4,5,1...etc) so that
 the five putted items get inserted everytime. Like:

 insert into products (item,price,rate,name,desc) values (1,2,3,4,5)

 Then on to the next one and so forth.

 I am already parsing the file, but not sure if it needs to go into an
array
 or set to vars then done in a loop.

 Please help!
This is not really a PHP answer; However I feel your problem is not best
solved with PHP.

If your csv file is a standard csv file you don't need PHP to parse it.
MySQL is capable of importing csv files on its own. Take a look at
http://dev.mysql.com/doc/mysql/en/LOAD_DATA.html

Example:

$query = 'LOAD DATA INFILE /path/to/your/file.csv INTO TABLE mytable';

Even if your file is not of a standard csv format you can specify what your
fields and lines are terminated by, enclosed by, escaped by, starting by,
etc, etc.

When uploading a CSV file exported from MS excel:

$query =  'LOAD DATA INFILE /path/to/your/file.csv INTO TABLE mytable
FIELDS TERMINATED BY , OPTIONALLY ENCLOSED BY  LINES TERMINATED BY
\\r\\n';

Very versatile. Make that lazy MySQL server pull its weight! Let PHP handle
the really complicated stuff :-)

Jim Grill

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



Re: [PHP] csv inssue

2004-09-24 Thread Jim Grill
 Well it was very close the only issue is the trailing comma on the
inserts.
 See below:

 INSERT INTO mytable (one,two,three,four,five) VALUES(14,Radial H714
 155/80r13s,26,
 All Season
 S Rated
 UTQG: 380/A/B
 WSW: White Sidewall

 4 groove version of all-season performance radial. The unique tread
pattern
 disperses water to the sides of the tire while the extra-wide grooves
 enhance wet handling and braking.,H714_4g.jpg),

 INSERT INTO mytable (one,two,three,four,five) VALUES(14,Radial H714
 155/80r13s,26,
 All Season
 S Rated
 UTQG: 380/A/B
 WSW: White Sidewall

 4 groove version of all-season performance radial. The unique tread
pattern
 disperses water to the sides of the tire while the extra-wide grooves
 enhance wet handling and

braking.,H714_4g.jpg),(www.hankooktireusa.com/products_view_info.asp?Item_ID
 =21CatID=4,25 14,Radial H714 175/65r14s,37,
 All Season
 S Rated
 UTQG: 380/A/B
 WSW: White Sidewall

 4 groove version of all-season performance radial. The unique tread
pattern
 disperses water to the sides of the tire while the extra-wide grooves
 enhance wet handling and braking.),

Damn... You remind me that I need to rotate my tires this weekend. :-)

You did something wrong. :-)  There should only ever be one single query
that should look like:

$query = 'INSERT INTO mytable (one,two,three,four,five) VALUES
(blah,blah,blah,blah,blah),
(blah,blah,blah,blah,blah),
(blah,blah,blah,blah,blah),
(blah,blah,blah,blah,blah),
(blah,blah,blah,blah,blah)';

Also, I did forget the quotes on the values. This will fix that: $query .=
'('.implode(',',$vals).'),';

There is a line that gets rid of the the trailing comma:
/*kill the last comma*/
$query = substr($query, 0, -1);

Take another look and then post some code if you still have trouble.

Jim Grill

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



Re: [PHP] mailing to hotmail

2004-09-24 Thread Jim Grill
 for some reasons my mails I send to hotmail are never arriving,  (using
 mail($email,$subject_line,$msg,$headers);)
 anyone ever heard of this?



What is in $headers?

Make sure the From:  domain can be reverse resolved to the machine the
mail is being sent from. [EMAIL PROTECTED] will fail. :-)

Jim Grill

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



Re: [PHP] php upload script problems

2004-09-25 Thread Jim Grill
 Hi,

 I have the following php page. The page just opens up blank and I assume I
 made an error I cannot see. I'm new to php and any help would  be greatly
 appreciated:

 ?php

 $extlimit = yes; //Do you want to limit the extensions of files uploaded

 $limitedext = array(.pdf); //Extensions you want files uploaded limited
 to.

 $sizelimit = no; //Do you want a size limit, yes or no?

 $sizebytes = 20; //size limit in bytes

 $dl = http://www.corrige2.bluehill.com/pdfs;; //url where files are
 uploaded

 $absolute_path = http://www.corrige2.bluehill.com/pdfs;; //Absolute path
to
 where files are uploaded

Aside from what others have pointed out, your absolute path is not a file
path at all. This will cause some problems later on in the script when you
try to upload an image file to a URL instead of a file path.

Jim Grill

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