[PHP] Auto update feature from PHP app - like antivirus definitions

2004-01-27 Thread Terence
Hi,

Has anyone ever tried to produce an auto-update feature for your PHP
application?
Say a client downloads version 1, and a month later version 1.1 is
available, which makes
changes to a few scripts say, add_user.php, modify_user.php and
display_users.php

Does anyone have a method or way in which these scripts (say the source is
available from the
project homepage via a URL - something like
http://theproject/updates/version1.1/add_user.php.gz) can
be downloaded and replace the current one on the client's server? Just
theory or a finger
to point me in a general direction would be great.

Hope this makes sense.

Thanks
Terence

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



RE: [PHP] Auto update feature from PHP app - like antivirus definitions

2004-01-27 Thread Vincent DUPONT
Maybe a PEAR package do do the trick. Have a look at PEAR_PackageFileManager on 
http://pear.php.net/package/PEAR_PackageFileManager

I never used it, but plan to do.
I you use it, please keep me informed

Maybe you could have something more trivial if you just need to download a single file.

Vincent

-Original Message-
From: Terence [mailto:[EMAIL PROTECTED]
Sent: mardi 27 janvier 2004 9:17
To: [EMAIL PROTECTED]
Subject: [PHP] Auto update feature from PHP app - like antivirus
definitions


Hi,

Has anyone ever tried to produce an auto-update feature for your PHP
application?
Say a client downloads version 1, and a month later version 1.1 is
available, which makes
changes to a few scripts say, add_user.php, modify_user.php and
display_users.php

Does anyone have a method or way in which these scripts (say the source is
available from the
project homepage via a URL - something like
http://theproject/updates/version1.1/add_user.php.gz) can
be downloaded and replace the current one on the client's server? Just
theory or a finger
to point me in a general direction would be great.

Hope this makes sense.

Thanks
Terence

-- 
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] su idn't working from within php

2004-01-27 Thread Nitin Mehta
hi all

i was trying to execute some commands as an authorized user from within my php script 
with

exec (su username -c \sudo command\ 21;, $output);

but it gives me 

standard in must be a tty

how can i make it work? it runs perfectly at command prompt

I even tried to ssh, but the problem is where should i copy the rsa-key generated with 
keygen, as the scripts are run as apache/http user..

Plz help me out of this

Thanx in advance
Nitin

[PHP] String value modified on replace

2004-01-27 Thread Sheni R. Meledath
Hello:

I have a string variable with the following value
$httppath = http://www.mysite.org;;
This variable is stored in an include file.
When I use this variable in another document, where the setting file is 
included, the value of the above variable is getting replaced with:
http:/!
 /www.mysite.org/

There is an exclamation mark and a line break inserted between the 2 
forward slashes. Could anybody help me to figure out this problem.

Sheni R Meledath
[EMAIL PROTECTED] 

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


[PHP] Size of session?

2004-01-27 Thread motorpsychkill
I'm not sure if this has been covered (I searched the archives) but does
anyone know if there is a size limit on what a session can store?  What is
this dependant on?

Thanks!

-m

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



[PHP] Re: php document management systems

2004-01-27 Thread David Robley
In article [EMAIL PROTECTED], 
[EMAIL PROTECTED] says...
 Anyone know of any php document management systems? if its open source that
 would be even better.
 
 TIA
 

http://www.google.com/search?q=php+document+management+systems should give 
you a few pointers
-- 
Quod subigo farinam

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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



Re: [PHP] PCRE vs. POSIX-extended for regular expressions

2004-01-27 Thread Adam i Agnieszka Gasiorowski FNORD
Pablo Gosse wrote:

 Hi all.  Quick quesiton about PCRE vs. POSIX-extended regular
 expressions.
 
 How much of a difference is there between these two types of regular
 expressions.  I know I've read that PCRE is faster, but is it that much
 of a difference?

PCRE are _way_ more advanced, I, personally,
 prefer them. Read about the syntax in the 
 fine manual.

-- 
Seks, seksi, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info  { iWanToDie }   WiNoNa)   (
http://szatanowskie-ladacznice.0-700.pl  foReVeR(  *  )
Poznaj jej zwiewne ksztaty... http://www.opera.com 007

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



[PHP] Re: help with mysql

2004-01-27 Thread Krit Kanrat
Hi,

Are you sure that you already enable mysql function on your web server ?

Krit Kanrat

Tom Flood [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello,

 I am just beginning my learning of php and its uses with mysql.  I wrote a
 small program to add information into a mysql database.  However my script
 returns the following error:

 Fatal error: Call to undefined function: mysql_connect() in
 /var/www/html/ephi/mysql.php on line 16

 what is the problem here? How can I fix it?

 I truly appreciate any help given.

 Tom Flood
 [EMAIL PROTECTED]

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



Re: [PHP] Size of session?

2004-01-27 Thread Marek Kilimajer
php memory limit if php has been compiled with --enable-memory-limit and 
the limit is enabled, else it is limited by the platform php runs on

motorpsychkill wrote:
I'm not sure if this has been covered (I searched the archives) but does
anyone know if there is a size limit on what a session can store?  What is
this dependant on?
Thanks!

-m

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


Re: [PHP] su idn't working from within php

2004-01-27 Thread Marek Kilimajer
Why do you need su? Set up sudo for apache user.

Nitin Mehta wrote:
hi all

i was trying to execute some commands as an authorized user from within my php script with

exec (su username -c \sudo command\ 21;, $output);

but it gives me 

standard in must be a tty

how can i make it work? it runs perfectly at command prompt

I even tried to ssh, but the problem is where should i copy the rsa-key generated with keygen, as the scripts are run as apache/http user..

Plz help me out of this

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


RE: [PHP] Re: Can we make .exe programs with php?

2004-01-27 Thread Jay Blanchard
[snip]
Depending upon why you want an executable, if its to run on a client
machine
as an app then check out php-gtk.
[/snip]

There is also a thing called PriadoBlender, haven't really tried it
though.

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



[PHP] Let openbasedir limited folks use system-wide includes

2004-01-27 Thread MIKE YRABEDRA


Hello,

I use php admin flags to give each of my clients different permissions. All
of them , by default, are limited to their directory using openbasedir
parameter.

I also have phpmailer set up so everyone can use it as an include or require
function.

The only problem is, the folks locked into their directories cannot use it.
It gives an openbase directory error every time.

Does anyone know of a solution for this without compromising security?



++
Mike Yrabedra (President)
323 Incorporated 
Home of MacDock.com, MacAgent.com and MacShirt.com
++
W: http://www.323inc.com/
P: 770.382.1195
F: 734.448.5164
E: [EMAIL PROTECTED]
I: ichatmacdock
++
Whatever you do, work at it with all your heart,
as working for the Lord, not for men.
~Colossians 3:23 {{{
++

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



[PHP] tourico holidays

2004-01-27 Thread Diana Castillo
Is there anyone out there using XML with php to connect to Tourico Holidays?
If so I need your help.
thanks.

--
--
Diana Castillo
Global Reservas, S.L.
C/Granvia 22 dcdo 4-dcha
28013 Madrid-Spain
Tel : 00-34-913604039
Fax : 00-34-915228673
email: [EMAIL PROTECTED]
Web : http://www.hotelkey.com
  http://www.destinia.com

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



[PHP] Re: Verify cCPIGgLq for robleyd@ozemail.com.au

2004-01-27 Thread David Robley
On 27 Jan 2004 at 20:46, Piers Lauder wrote:

 Hi!
 
 Your message has been received, but it hasn't been delivered to me
 yet.  As I don't have any record of you sending me mail from this
 address before, I need to verify that you're not a spammer. Please
 reply and alter the Subject line to remove the word REMOVETHISWORD,
 and your previous message will be delivered, as will all your future
 messages.
 
 Thanks, and apologies for the inconvenience.
 
 Piers Lauder.
 
 Note: your original message is appended below.
 
 Please check it carefully.
 
 If it didn't originate from you, then a spammer is probably impersonating
 your address.
 
 In which case please ignore this message.
 
  Original Message 
 
 Received: by staff.cs.usyd.edu.au with postie; Tue, 27 Jan 2004 20:46:17
 +1000 Received: by staff.cs.su.oz.au with MHSnet; Tue, 27 Jan 2004
 20:46:15 +1100 Received: from lists.php.net by MHSnet id 3+3XC-2AA+3XBd;
 Tue, 27 Jan 2004 20:46:14 +1100 Received: from pb1.pair.com. by
 staff.cs.usyd.edu.au.; Tue, 27 Jan 2004 20:46:14 +1100 Received: (qmail
 44558 invoked by uid 1010); 27 Jan 2004 09:45:20 - Mailing-List:
 contact [EMAIL PROTECTED]; run by ezmlm Precedence: bulk
 list-help: mailto:[EMAIL PROTECTED] list-unsubscribe:
 mailto:[EMAIL PROTECTED] list-post:
 mailto:[EMAIL PROTECTED] Delivered-To: mailing list
 [EMAIL PROTECTED] Received: (qmail 44508 invoked by uid 1010); 27
 Jan 2004 09:45:20 - Delivered-To: [EMAIL PROTECTED]
 Delivered-To: [EMAIL PROTECTED] To:
 [EMAIL PROTECTED] From: David Robley [EMAIL PROTECTED]
 Date: Tue, 27 Jan 2004 20:15:32 +1030 Message-ID:
 [EMAIL PROTECTED] References:
 [EMAIL PROTECTED] Organization: Norfolke 
 Goode MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15
 Content-Transfer-Encoding: 7bit X-Newsreader: MicroPlanet Gravity v2.60
 X-Posted-By: 203.103.155.63 Subject: [PHP] Re: php document management
 systems
 
 In article [EMAIL PROTECTED], 
 [EMAIL PROTECTED] says...
  Anyone know of any php document management systems? if its open source
  that would be even better.
  
  TIA
  
 
 http://www.google.com/search?q=php+document+management+systems should give
 you a few pointers -- Quod subigo farinam
 
 A: Because it messes up the order in which people normally read text. Q:
 Why is top-posting such a bad thing? A: Top-posting. Q: What is the most
 annoying thing on usenet?
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

It would appear that you have subscribed to the php mailing list, but you 
are requiring people to confirm that their messages to the list, and 
hence to you, are valid. You are probably missing qiute a few messages as 
a result. You might wish to reconsider this approach, as it may tend to 
annoy some people. I appreciate that you may be concerned about 
unsolicited mail, but I suspect that using this approach on a mailing 
list may be counter productive.

-- 
David Robley
Quod subigo farinam

My hair's been cut off, Tom said distressfully.

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



RE: [PHP] Seems Simple enough

2004-01-27 Thread Ford, Mike [LSS]
On 26 January 2004 16:56, Christopher J. Crane wrote:

 Ok here is the wierd thing.
 I pasted more code, it seems to not work because of me
 changing the number
 format.
 
 This works ...
  if($Balance = 10001) {
$Balance = number_format($Balance,2,'.',',');
echo font color=\green\\$$Balance/fontbr\n; } 
if($Balance = ) { $Balance =
number_format($Balance,2,'.',','); echo font
color=\red\\$$Balance/fontbr\n; }  else { $Balance =
number_format($Balance,2,'.',','); echo font
 color=\purple\\$$Balance/fontbr\n; } 
 
 This does not ...
   $SummaryResults = mysql_query(SELECT * FROM Accounting WHERE
 UserID='$UserID' LIMIT 1) or die(Invalid query);
   while($SummaryField = mysql_fetch_array($SummaryResults)) {
 $Balance = number_format($SummaryField[Balance],2,'.',',');

$Balnace is now (for example) 10,000.00; comma is not a valid character in a PHP 
number, so when interpreted as a number this will convert to 10.

  } if($Balance = 10001) { echo font
 color=\green\\$$Balance/fontbr\n; }
  elseif($Balance = ) { echo font

10 is =  so...

 color=\red\\$$Balance/fontbr\n; }
  else { echo font color=\purple\\$$Balance/fontbr\n; }

But I have to ask, why include all the invariant parts in every branch of your if-else 
chain?  As a general principle, I try to put only the parts that are genuinely 
different inside conditionals, so in this case I'd probably write something like:

   echo 'font color=';
   if ($Balance = 10001):
  echo 'green';
   elseif ($Balance = ):
  echo 'red';
   else:
  echo 'purple';
   endif;
   echo '$', number_format($Balance, 2, '.', ','), /fontbr /\n;

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 
 

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



Re: [PHP] Let openbasedir limited folks use system-wide includes

2004-01-27 Thread Jason Wong
On Tuesday 27 January 2004 18:59, MIKE YRABEDRA wrote:

 The only problem is, the folks locked into their directories cannot use it.
 It gives an openbase directory error every time.

 Does anyone know of a solution for this without compromising security?

safe_mode_include_dir

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
If you want your spouse to listen and pay strict attention to every
word you say, talk in your sleep.
*/

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



Re: [PHP] can't figure out this mysql error

2004-01-27 Thread Jason Wong
On Tuesday 27 January 2004 02:23, Chris W. Parker wrote:

 If I put the two functions mysql functions within the query method I
 created I get an error on those two lines BUT the program continues as
 normal WITH the data being printed to the page just as I want it to.
 Clearly the mysql resource being complained about is actually valid and
 not invalid considering that the data I'm trying to retrieve is printed
 to the page.

 Any other ideas?

Post some *concise* code which illustrates the problem.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Your supervisor is thinking about you.
*/

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



Re: [PHP] Repost - Form/Session Problem with sample code = Probably easy question - Thanks for any help!

2004-01-27 Thread Jason Wong
On Monday 26 January 2004 05:11, Paul wrote:
 I am trying to use a back button to allow a user to change submitted form
 values.

 The problem I am having is that when they submit the form a second time,
 regardless of what is entered, the variable $test does not change and keeps
 only the first value assigned to it! I am able to solve this by using
 session_unset($test); but I don't understand what is happening/why I should
 need to do this.

 Any help appreciated, here is some sample code to illustrate. Running this,
 only what is typed in first for $test is kept after that it will not take
 on new values!

[snip]

If you're using a relatively new version of php, it is strongly recommended 
that you code for register_globals = Off and accordingly use the 
corresponding method of handling sessions (manual  Session handling 
functions).

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Man who falls in blast furnace is certain to feel overwrought.
*/

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



RE: [PHP] unexpected include parse error

2004-01-27 Thread Ford, Mike [LSS]
On 27 January 2004 05:50, Paul Furman wrote:

 Shawn McKenzie wrote:
  I've noticed in both of your posts that you aren't terminating the
  line before the include with a ;
 
 Yup, thanks!
 
 Then I fixed my global problem without bugging you guys too.

Actually, no you didn't -- you just bypassed it.

 Final result:
 
 
 #call.php
$dirstr= ./;
include 'scandir.php';
scandir('$dirstr');

Becasue single-quoted strings don't do variable interpolation, you are
actually passing the literal string '$dirstr' to the function -- no the
*value* of $dirstr, which is what you want.  If you needed to use quotes
here, they should be double ones -- but, actually, you don't need quotes at
all: since what you really you want is the value of $dirstr, this will do
the trick:

scandir($dirstr);

 #scandir.php
function scandir($dirstr) {

Well, now this $dirstr will be set to '$dirstr', which clearly isn't a valid
directory path!

   global $dirstr; #I HAD TO ADD THIS LINE ALSO

But you've now bypassed that by equivalencing it to the global version of
$dirstr, which, of course, still contains './', so the rest of the function
works.  Once you take the quotes off the function call above, you also won't
need this global statement.

   $files = array();
   $fh = opendir($dirstr);
   while (false !== ($filename = readdir($fh))) {
   array_push($files, $filename);
   }
   closedir($fh);
   return $files;
}
 
   FYI...
   If you use / then you don't have to escape it like // only the \.
   Also, instead of .\\ you can use '.\'

Actually, no you can't, because in single quoted strings \' is the sequence
to insert a single quote!  So you still ahve ti use '.\\'.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP] unexpected include parse error

2004-01-27 Thread Ford, Mike [LSS]
On 27 January 2004 05:18, Shawn McKenzie wrote:

  
  PS I'm on my windows apache server but the forward slash seems to
  work in php  that keeps it portable. I tried it both ways.

Yes -- PHP internally translates between / and \ on Windows, precisely for portability 
reasons.  Thus, you can write your code using / and port it easily between Windows and 
*n*x systems -- this is a boon if, like me, you do development work on a Windows 
server but have a *n*x server for your live site.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



[PHP] PDF and dynamic PNG

2004-01-27 Thread Dominik Heeb
Hello,

I succeed in creating PDF files dynamically with PHP (including inserting
static PNG images), and also succeed in creating PNG images dynamically.

However, I can't insert dynamically created PNG images into PDF files,
neither with pdf_open_image_file, nor with pdf_open_png.

Is this impossible?

   D o m i n i k


Example:

function putimage ($pdf, $fullfilename, $x, $y, $width) {

  // init
  $extension = substr($fullfilename, strrpos ($fullfilename, .)+1);
  $pdfimage = pdf_open_image_file($pdf, $extension, $fullfilename);

  // define scale
  $sourceimagewidth = pdf_get_value ($pdf, imagewidth, $pdfimage);
  $scale = $width / $sourceimagewidth;

  // put image
  pdf_place_image($pdf, $pdfimage, $x, $y, $scale);
}

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



[PHP] ILQWPNMPY

2004-01-27 Thread rasmus
The message contains Unicode characters and has been sent as a binary attachment.


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

[PHP] Remove Dynamic String between StringA and StringB

2004-01-27 Thread Jack Bauer
Hi :),

i tried your code zu replace some parts of a string,
the problem is that this method only replaces when
there is only 1 word between stringA and stringB.
i got the problem that the part between both strings
is a dynamic one and much larger then 1 word.
i really tried to use the php manual and google
to find some help for this, but i got no luck with that :(

$stringA = AA;
$stringB = BB;
$string = AA oneword BB AA two words BB;

$pattern = /$stringA.\w*.$stringB/;
$replacement = ;
echo preg_replace($pattern, $replacement, $string);

i think it have to do something with the \w in the pattern,
is there a parameter to resolve my problem too?


regards
manuel

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



[PHP] MS SQL / PHP

2004-01-27 Thread Enda Nagle
I have a potentially stupid problem with PHP and MSSQL on a Windows
server...

I can connect to the database and insert data to the tables etc but cannot
retrieve data...

This is the code I'm using:

//---
$list2 = $conn-Execute(SELECT * FROM elive.registration) or
DIE($conn-ErrorMsg());

while (!$list2-EOF){

  $Msku = $list2-Fields(sku);
  $Mname = $list2-Fields(name);
  $Memailaddress = $list2-Fields(emailadd);
  $Mcountry = $list2-Fields(country);
  $Mnumdevices = $list2-Fields(numdevices);
  $Msource = $list2-Fields(source);

echo
trtd$Msku/tdtd$Mname/tdtd$Memailaddress/tdtd$Mcountry/td
td$Mnumdevices/tdtd$Msource/td/tr;
  $list2-MoveNext();
}
//---

The returned info is:

 Object  Object  Object  Object  Object  Object

Am I doing something stupid?

Presumably, the code is the same as I am already using on an adodb
connection on a Linux box to a MySQL server?

Thanks for the help

Enda
Enda Nagle
+353 86 168 0774
[EMAIL PROTECTED]
www.nightsol.net

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



[PHP] order by

2004-01-27 Thread christian tischler
Is there a way wuth php to create a list ordered by more than one column
like in excel or access.

something like ORDER BY points AND score

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



Re: [PHP] order by

2004-01-27 Thread Stuart
christian tischler wrote:
Is there a way wuth php to create a list ordered by more than one column
like in excel or access.
something like ORDER BY points AND score
Use http://php.net/usort and use both 'columns' in the comparison function.

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


Re: [PHP] Remove Dynamic String between StringA and StringB

2004-01-27 Thread Martin Luethi
$pattern = /$stringA.*?$stringB/;

.*? - matches everything between $stringA and $stringB
  the ? means: stop matching after the first occurence
  of $stringB (quantifier minimizer). otherwise .* would
  match everything between the first occurence of $stringA
  and the last occurence of $stringB
- http://ch2.php.net/manual/de/pcre.pattern.syntax.php

g. tinu

Tue, 27 Jan 2004 13:25:27 +0100 Jack Bauer [EMAIL PROTECTED]:

Hi :),

i tried your code zu replace some parts of a string,
the problem is that this method only replaces when
there is only 1 word between stringA and stringB.
i got the problem that the part between both strings
is a dynamic one and much larger then 1 word.
i really tried to use the php manual and google
to find some help for this, but i got no luck with that :(
$stringA = AA;
$stringB = BB;
$string = AA oneword BB AA two words BB;
$pattern = /$stringA.\w*.$stringB/;
$replacement = ;
echo preg_replace($pattern, $replacement, $string);
i think it have to do something with the \w in the pattern,
is there a parameter to resolve my problem too?
regards
manuel
--
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] Writing CRON jobs!

2004-01-27 Thread Hamid Hossain
Is there any good reference on how to use CRON (I mean on the net)?

I need to fire some PHP pages at scheduled time daily or weekly, ... so on.

Regards,
Hamid
_
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

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


RE: [PHP] Writing CRON jobs!

2004-01-27 Thread Jay Blanchard
[snip]
Is there any good reference on how to use CRON (I mean on the net)?

I need to fire some PHP pages at scheduled time daily or weekly, ... so
on.
[/snip]

http://www.unixgeeks.org/security/newbie/unix/cron-1.html

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



Re: [PHP] Writing CRON jobs!

2004-01-27 Thread Stuart
Hamid Hossain wrote:
Is there any good reference on how to use CRON (I mean on the net)?

I need to fire some PHP pages at scheduled time daily or weekly, ... so on.
http://www.google.com/search?q=cron+tutorial+php

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


[PHP] Googlebot

2004-01-27 Thread Hartley, Matt
Is Googlebot (or any other bot) able to follow links that are php?

e.g.
a href=Contact.phpContact Us/a
a href=Product.phpimg src=Images/product.jpg width=110 height=111
border=0/a

Is there a way to invite bots to your site?

Thanks
Matt


RE: [PHP] order by

2004-01-27 Thread Thomas Svenson
christian tischler wrote:
 Is there a way wuth php to create a list ordered by more than one
 column like in excel or access.

 something like ORDER BY points AND score

You might want to look at GROUP BY command too
http://www.mysql.com/doc/en/Group_by_functions_and_modifiers.html

/T

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



[PHP] Re: Using templates (Code User Interface)

2004-01-27 Thread Skrol29
Hi,

Always I have a problem that I don't know how to make my code away from
the user interface files.
I tried to use some template classes, but I did'nt like what I tired
because some if statments are used inside the template.

I have to react to this.
TinyButStrong is a PHP Template Engine that does truly separate code and
user interface.
It is so true that you can make your templates 100% with Visual (WYSIWYG)
Html Editors (Dreamweaver, Frontpage, .. what you wish).

Of course, when coding template, you often need conditional display in
some ways.

To do so, TinyButStrong has two features:
- Php event functions that you can define on a TBS tag/block and which
enables the tag's contents to be managed in the Php side.
- Parameters If/then/else on TBS tags/blocks just to simplify the
template.

---
Skrol 29
www.tinybutstrong.com
---

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



Re: [PHP] Googlebot

2004-01-27 Thread Stuart
Hartley, Matt wrote:
Is Googlebot (or any other bot) able to follow links that are php?

e.g.
a href=Contact.phpContact Us/a
a href=Product.phpimg src=Images/product.jpg width=110 height=111
border=0/a
Yes.

Is there a way to invite bots to your site?
For most, yes.

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


[PHP] Re: help with mysql

2004-01-27 Thread Tom Flood
Thank you both, here is the entire code :

1html
2head
3titleUntitled Document/title
4meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
5/head
6
7body
8?php
9 $name = $_GET[name];
10 $address = $_GET[address];
11$city = $_GET[city];
12print Name is $namebr\n;
13print Address is $addressbr\n;
14print City is $citybr\n;
15
16mysql_connect(tflood, thomas91);
17
18$result = mysql_query(
19 insert into ephi.info
20 (name, address, city) values
21 ('$name', '$address', '$city')
22);
23if ($result) {
24 print EOT
25
26 h1 Thank you. /h1
27 Your signup is highly appreciated.  To show our appreciation, we will
send you something that you, in turn, will appreciate. p
28 Remember our motto: Once a Sinfonian, Always a Sinfonian, Long Live
Sinfonia!
29EOT;
30  }
31  else {
32   print Something went wrong dunbass;
33  }
34  mysql_close();
35?
36/body/html




As far as mysql working on the machine, it is.  I am able to use the mysql
command to loginto the server and query my databases.  And I have the MySQL
Command Center installed and am able to see the databases on my computer
just fine.


Thank you for your help.

Tom

Krit Kanrat [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 Are you sure that you already enable mysql function on your web server ?

 Krit Kanrat

 Tom Flood [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Hello,
 
  I am just beginning my learning of php and its uses with mysql.  I wrote
a
  small program to add information into a mysql database.  However my
script
  returns the following error:
 
  Fatal error: Call to undefined function: mysql_connect() in
  /var/www/html/ephi/mysql.php on line 16
 
  what is the problem here? How can I fix it?
 
  I truly appreciate any help given.
 
  Tom Flood
  [EMAIL PROTECTED]

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



Re: [PHP] Re: help with mysql

2004-01-27 Thread Martin Luethi
line 16: mysql_connect(tflood, thomas91);

I think you mean: mysql_connect(localhost, tflood, thomas91);
otherwise mysql_connect takes tflood as Server and thomas91 as
Username (if so, its better to replace passwords with * before
posting)
- http://ch.php.net/mysql_connect
after connecting you need to choose a database, e.g.
line 17: mysql_select_db(databasename);
also make sure that the mysql-extension is installed and loaded.
to check this, create a textfile phpinfo.php with this content:
?
phpinfo();
?
check the output for information about mysql

g. tinu

Tue, 27 Jan 2004 08:51:52 -0500 Tom Flood [EMAIL PROTECTED]:

Thank you both, here is the entire code :

1html
2head
3titleUntitled Document/title
4meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
5/head
6
7body
8?php
9 $name = $_GET[name];
10 $address = $_GET[address];
11$city = $_GET[city];
12print Name is $namebr\n;
13print Address is $addressbr\n;
14print City is $citybr\n;
15
16mysql_connect(tflood, thomas91);
17
18$result = mysql_query(
19 insert into ephi.info
20 (name, address, city) values
21 ('$name', '$address', '$city')
22);
23if ($result) {
24 print EOT
25
26 h1 Thank you. /h1
27 Your signup is highly appreciated.  To show our appreciation, we will
send you something that you, in turn, will appreciate. p
28 Remember our motto: Once a Sinfonian, Always a Sinfonian, Long Live
Sinfonia!
29EOT;
30  }
31  else {
32   print Something went wrong dunbass;
33  }
34  mysql_close();
35?
36/body/html


As far as mysql working on the machine, it is.  I am able to use the mysql
command to loginto the server and query my databases.  And I have the MySQL
Command Center installed and am able to see the databases on my computer
just fine.
Thank you for your help.

Tom

Krit Kanrat [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hi,

Are you sure that you already enable mysql function on your web server ?

Krit Kanrat

Tom Flood [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hello,

 I am just beginning my learning of php and its uses with mysql.  I wrote
a
 small program to add information into a mysql database.  However my
script
 returns the following error:

 Fatal error: Call to undefined function: mysql_connect() in
 /var/www/html/ephi/mysql.php on line 16

 what is the problem here? How can I fix it?

 I truly appreciate any help given.

 Tom Flood
 [EMAIL PROTECTED]
--
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-01-27 Thread Marek Kilimajer
... ORDER BY points [DESC|ASC], score [DESC|ASC]

christian tischler wrote:
Is there a way wuth php to create a list ordered by more than one column
like in excel or access.
something like ORDER BY points AND score

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


Re: [PHP] MS SQL / PHP

2004-01-27 Thread Marek Kilimajer
try print_r($Msku) and see what comes out

Enda Nagle wrote:

I have a potentially stupid problem with PHP and MSSQL on a Windows
server...
I can connect to the database and insert data to the tables etc but cannot
retrieve data...
This is the code I'm using:

//---
$list2 = $conn-Execute(SELECT * FROM elive.registration) or
DIE($conn-ErrorMsg());
while (!$list2-EOF){

  $Msku = $list2-Fields(sku);
  $Mname = $list2-Fields(name);
  $Memailaddress = $list2-Fields(emailadd);
  $Mcountry = $list2-Fields(country);
  $Mnumdevices = $list2-Fields(numdevices);
  $Msource = $list2-Fields(source);
echo
trtd$Msku/tdtd$Mname/tdtd$Memailaddress/tdtd$Mcountry/td
td$Mnumdevices/tdtd$Msource/td/tr;
  $list2-MoveNext();
}
//---
The returned info is:

 Object  Object  Object  Object  Object  Object

Am I doing something stupid?

Presumably, the code is the same as I am already using on an adodb
connection on a Linux box to a MySQL server?
Thanks for the help

Enda
Enda Nagle
+353 86 168 0774
[EMAIL PROTECTED]
www.nightsol.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] MS SQL / PHP

2004-01-27 Thread Enda Nagle
Hi Marek,

Thanks for your reply.

Tried that and got the following output:
COM Object ( [0] = Resource id #3 ) COM Object ( [0] = Resource id #9 )
COM Object ( [0] = Resource id #15 ) COM Object ( [0] = Resource id #21 )

There are 4 records in the table at the moment, and its performing the loop
etc for the recordset but just isn't returning the data (or returning data
in a readable format).

Thanks

Enda
--



-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED]
Sent: 27 January 2004 14:05
To: Enda Nagle
Cc: PHP List
Subject: Re: [PHP] MS SQL / PHP


try print_r($Msku) and see what comes out

Enda Nagle wrote:

 I have a potentially stupid problem with PHP and MSSQL on a Windows
 server...

 I can connect to the database and insert data to the tables etc but cannot
 retrieve data...

 This is the code I'm using:

 //---
 $list2 = $conn-Execute(SELECT * FROM elive.registration) or
 DIE($conn-ErrorMsg());

 while (!$list2-EOF){

   $Msku = $list2-Fields(sku);
   $Mname = $list2-Fields(name);
   $Memailaddress = $list2-Fields(emailadd);
   $Mcountry = $list2-Fields(country);
   $Mnumdevices = $list2-Fields(numdevices);
   $Msource = $list2-Fields(source);

 echo

trtd$Msku/tdtd$Mname/tdtd$Memailaddress/tdtd$Mcountry/td
 td$Mnumdevices/tdtd$Msource/td/tr;
   $list2-MoveNext();
 }
 //---

 The returned info is:

  Object  Object  Object  Object  Object  Object

 Am I doing something stupid?

 Presumably, the code is the same as I am already using on an adodb
 connection on a Linux box to a MySQL server?

 Thanks for the help

 Enda
 Enda Nagle
 +353 86 168 0774
 [EMAIL PROTECTED]
 www.nightsol.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



[PHP] Tip For The Day

2004-01-27 Thread Jay Blanchard
When constructing arrays where you are meddling with fixed width
substrings in a larger file make sure that the array item does not
contain a tab or you will certainly get unexpected results;

$arrBadInfo (
'AMARILLOHOUSE   ',
'KJONES  HOUSE   ', --- 16 characters wide, or is it?
'DCOLLINSCUSTSVC ',
'LAWTON  JCOLEMAN',
};

Both above appear to be 16 characters wide in the editor of your choice
(I am using Zend at the moment). However, if there is a tab between
KJONES and HOUSE, the HOUSE is moved to the right the appropriate number
of characters (or inappropriate as it were) and produce undesired
results. I have been working on this issue since 5 am this morning when
I finally decided to print_r() the array (consisting of 192 elements).
Lo and behold (and slapping my forehead thusly) we saw that there were
tabs in the result. Replacing the tabs with the proper number of spaces
fixed the result.

Actually this tip applies to all strings in which you expect there to be
a fixed width. Beware the tab, especially if you are bring in the data
from a source (cuttin' n' pastin') outside of your editor.

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



Re: [PHP] Remove Dynamic String between StringA and StringB

2004-01-27 Thread memoimyself
On 27 Jan 2004 at 13:25, Jack Bauer wrote:

 i tried your code zu replace some parts of a string,
 the problem is that this method only replaces when
 there is only 1 word between stringA and stringB.

Of course. \w* will match alphanumeric characters, but not whitespace, and word 
boundaries are typically whitespace.

 i really tried to use the php manual and google to find some help for
 this, but i got no luck with that :( 

It's not a question of luck; it's a question of investing a little of your time in 
reading and 
learning. You don't want to spend your time doing that but expect other people to 
spend 
theirs providing you with all the answers you need. You've been given a few pointers 
(such as the online introductory guide to regular expressions, which will tell you 
everything about matching word characters, non-word characters etc etc) but don't 
seem to have taken any interest in them, because of course that would mean you'd 
have to actually spend an hour or so of your valuable time doing some reading. Bear in 
mind that other people's time is *also* valuable.

 i think it have to do something with the \w in the pattern, 
 is there a parameter to resolve my problem too?

Go to http://msdn.microsoft.com/library/en-
us/script56/html/js56reconIntroductionToRegularExpressions.asp and read it, especially 
the Regular Expression Syntax section. After doing that, read the relevant part of the 
PHP manual. Things will start to make sense soon enough.

Erik

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



[PHP] Script timeout?

2004-01-27 Thread Ben Ramsey
I'm trying to run a query against a database with a PHP script that 
cycles through each record (about 4,000+) and sends and e-mail to them 
if they have an e-mail address present.  The problem is that everytime I 
do this, it processes about 430 records and stops.  There is no error 
message generated.  Could this be due to a script timeout?  If so, how 
do I raise the timeout value?

-Ben

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


Re: [PHP] MS SQL / PHP

2004-01-27 Thread Marek Kilimajer
You need to find out what $list2-Fields(sku); returns. This is not 
php anymore, check COM reference.

Enda Nagle wrote:

Hi Marek,

Thanks for your reply.

Tried that and got the following output:
COM Object ( [0] = Resource id #3 ) COM Object ( [0] = Resource id #9 )
COM Object ( [0] = Resource id #15 ) COM Object ( [0] = Resource id #21 )
There are 4 records in the table at the moment, and its performing the loop
etc for the recordset but just isn't returning the data (or returning data
in a readable format).
Thanks

Enda
--


-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED]
Sent: 27 January 2004 14:05
To: Enda Nagle
Cc: PHP List
Subject: Re: [PHP] MS SQL / PHP
try print_r($Msku) and see what comes out

Enda Nagle wrote:


I have a potentially stupid problem with PHP and MSSQL on a Windows
server...
I can connect to the database and insert data to the tables etc but cannot
retrieve data...
This is the code I'm using:

//---
$list2 = $conn-Execute(SELECT * FROM elive.registration) or
DIE($conn-ErrorMsg());
while (!$list2-EOF){

 $Msku = $list2-Fields(sku);
 $Mname = $list2-Fields(name);
 $Memailaddress = $list2-Fields(emailadd);
 $Mcountry = $list2-Fields(country);
 $Mnumdevices = $list2-Fields(numdevices);
 $Msource = $list2-Fields(source);
echo

trtd$Msku/tdtd$Mname/tdtd$Memailaddress/tdtd$Mcountry/td

td$Mnumdevices/tdtd$Msource/td/tr;
 $list2-MoveNext();
}
//---
The returned info is:

Object  Object  Object  Object  Object  Object

Am I doing something stupid?

Presumably, the code is the same as I am already using on an adodb
connection on a Linux box to a MySQL server?
Thanks for the help

Enda
Enda Nagle
+353 86 168 0774
[EMAIL PROTECTED]
www.nightsol.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] Googlebot

2004-01-27 Thread Raditha Dissanayake
If you read the pages on google you will know the answer.

Hartley, Matt wrote:

Is Googlebot (or any other bot) able to follow links that are php?

e.g.
a href=Contact.phpContact Us/a
a href=Product.phpimg src=Images/product.jpg width=110 height=111
border=0/a
Is there a way to invite bots to your site?

Thanks
Matt
 



--
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 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Script timeout?

2004-01-27 Thread memoimyself
Hello Ben,

On 27 Jan 2004 at 9:27, Ben Ramsey wrote:

 I'm trying to run a query against a database with a PHP script that 
 cycles through each record (about 4,000+) and sends and e-mail to them 
 if they have an e-mail address present.  The problem is that everytime I 
 do this, it processes about 430 records and stops.  There is no error 
 message generated.  Could this be due to a script timeout?  If so, how 
 do I raise the timeout value?

Look up set_time_limit in the PHP manual. Also, consider retrieving all the records 
first 
with a single db query, storing all e-mails in an array, and then sending out the 
e-mails 
in a separate operation. Why query your db 4000+ times when you can query it only  
once?

Good luck,

Erik

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



Re: [PHP] Script timeout?

2004-01-27 Thread Ben Ramsey
Ah... I was trying to lookup the word timeout, which was giving me 
nothing.  Thanks!  Also, shouldn't I be receiving an error message if 
the script is, in fact, timing out?  I have checked display_errors and 
it is turned on.



[EMAIL PROTECTED] wrote:

Hello Ben,

On 27 Jan 2004 at 9:27, Ben Ramsey wrote:


I'm trying to run a query against a database with a PHP script that 
cycles through each record (about 4,000+) and sends and e-mail to them 
if they have an e-mail address present.  The problem is that everytime I 
do this, it processes about 430 records and stops.  There is no error 
message generated.  Could this be due to a script timeout?  If so, how 
do I raise the timeout value?


Look up set_time_limit in the PHP manual. Also, consider retrieving all the records first 
with a single db query, storing all e-mails in an array, and then sending out the e-mails 
in a separate operation. Why query your db 4000+ times when you can query it only  
once?

Good luck,

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


Re: [PHP] Script timeout?

2004-01-27 Thread Marek Kilimajer
set_time_limit()

This function has no effect in safe mode, you will need another 
workaround, for example send fisrt 400 emails and redirect the browser 
to send next 400 emails and so on untill you are done.

Ben Ramsey wrote:

I'm trying to run a query against a database with a PHP script that 
cycles through each record (about 4,000+) and sends and e-mail to them 
if they have an e-mail address present.  The problem is that everytime I 
do this, it processes about 430 records and stops.  There is no error 
message generated.  Could this be due to a script timeout?  If so, how 
do I raise the timeout value?

-Ben

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


Re: [PHP] Googlebot

2004-01-27 Thread Frank Tudor
That's not very helpful.

I am also curious about this.

Anyone have a more thought provoking answer?

Frank

--- Raditha Dissanayake [EMAIL PROTECTED] wrote:
 If you read the pages on google you will know the answer.
 
 Hartley, Matt wrote:
 
 Is Googlebot (or any other bot) able to follow links that are
 php?
 
 e.g.
 a href=Contact.phpContact Us/a
 a href=Product.phpimg src=Images/product.jpg
 width=110 height=111
 border=0/a
 
 Is there a way to invite bots to your site?
 
 Thanks
 Matt
 
   
 
 
 
 -- 
 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 150 KB | with progress bar.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

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



Re: [PHP] Googlebot

2004-01-27 Thread Ben Ramsey
Perhaps this link will help:
http://www.google.com/webmasters/
Frank Tudor wrote:

That's not very helpful.

I am also curious about this.

Anyone have a more thought provoking answer?

Frank

--- Raditha Dissanayake [EMAIL PROTECTED] wrote:

If you read the pages on google you will know the answer.

Hartley, Matt wrote:


Is Googlebot (or any other bot) able to follow links that are
php?

e.g.
a href=Contact.phpContact Us/a
a href=Product.phpimg src=Images/product.jpg
width=110 height=111

border=0/a

Is there a way to invite bots to your site?

Thanks
Matt




--
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 150 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] su idn't working from within php

2004-01-27 Thread Nitin Mehta
but how would i store keys for apache?

- Original Message - 
From: Marek Kilimajer [EMAIL PROTECTED]
To: Nitin Mehta [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, January 27, 2004 4:03 PM
Subject: Re: [PHP] su idn't working from within php


 Why do you need su? Set up sudo for apache user.

 Nitin Mehta wrote:
  hi all
 
  i was trying to execute some commands as an authorized user from within
my php script with
 
  exec (su username -c \sudo command\ 21;, $output);
 
  but it gives me
 
  standard in must be a tty
 
  how can i make it work? it runs perfectly at command prompt
 
  I even tried to ssh, but the problem is where should i copy the rsa-key
generated with keygen, as the scripts are run as apache/http user..
 
  Plz help me out of this
 
  Thanx in advance
  Nitin

 -- 
 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] Script timeout?

2004-01-27 Thread Marek Kilimajer
You should. I know I did in older version of php, now I don't.

Ben Ramsey wrote:

Ah... I was trying to lookup the word timeout, which was giving me 
nothing.  Thanks!  Also, shouldn't I be receiving an error message if 
the script is, in fact, timing out?  I have checked display_errors and 
it is turned on.



[EMAIL PROTECTED] wrote:

Hello Ben,

On 27 Jan 2004 at 9:27, Ben Ramsey wrote:


I'm trying to run a query against a database with a PHP script that 
cycles through each record (about 4,000+) and sends and e-mail to 
them if they have an e-mail address present.  The problem is that 
everytime I do this, it processes about 430 records and stops.  There 
is no error message generated.  Could this be due to a script 
timeout?  If so, how do I raise the timeout value?


Look up set_time_limit in the PHP manual. Also, consider retrieving 
all the records first with a single db query, storing all e-mails in 
an array, and then sending out the e-mails in a separate operation. 
Why query your db 4000+ times when you can query it only  once?

Good luck,

Erik


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


Re: [PHP] Googlebot

2004-01-27 Thread Stuart
Frank Tudor wrote:
Anyone have a more thought provoking answer?
Do some minimal research (Google is good for this) and you would find 
the answers yourself.

Hartley, Matt wrote:
Is Googlebot (or any other bot) able to follow links that are
php?
Yes. Most spiders will crawl over most types of URL. As Raditha said, 
Google has several pages of information on this for it's crawling 
activities, and most other legit spiders have similar resources.

Is there a way to invite bots to your site?
Google has a page where you can submit your site for crawling. Some 
other spiders also have this, but it depends on the purpose of the 
spider and the philosophy it follows.

There are many, many, many, many, many, ..., many, many resources on 
search engine optimisation all over the web. Use them. Find them with... 
you guessed it... Google!

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


Re: [PHP] Script timeout?

2004-01-27 Thread Ben Ramsey
I'm running PHP 5.0 beta 3, and I have seen script timeout errors 
before.  It's just odd that I wasn't receiving them this time. 
Increasing the timeout helped, but didn't fully correct the problem.  I 
just kept changing the SQL statement to WHERE user_key = [id number 
where it left off] so that it would send in batches and not send to the 
same people twice.

I didn't code this originally or I would've used a SQL JOIN to combine 
two tables of data instead of hitting the database a second time for 
each record encountered as my other programmer did.  So, I'm going to 
revise the scripts for future use and then do as someone said and save 
all the e-mail addresses to an array (and perhaps even free the result 
set) before sending.

Thanks!

-Ben

Marek Kilimajer wrote:

You should. I know I did in older version of php, now I don't.

Ben Ramsey wrote:

Ah... I was trying to lookup the word timeout, which was giving me 
nothing.  Thanks!  Also, shouldn't I be receiving an error message if 
the script is, in fact, timing out?  I have checked display_errors 
and it is turned on.



[EMAIL PROTECTED] wrote:

Hello Ben,

On 27 Jan 2004 at 9:27, Ben Ramsey wrote:


I'm trying to run a query against a database with a PHP script that 
cycles through each record (about 4,000+) and sends and e-mail to 
them if they have an e-mail address present.  The problem is that 
everytime I do this, it processes about 430 records and stops.  
There is no error message generated.  Could this be due to a script 
timeout?  If so, how do I raise the timeout value?




Look up set_time_limit in the PHP manual. Also, consider retrieving 
all the records first with a single db query, storing all e-mails in 
an array, and then sending out the e-mails in a separate operation. 
Why query your db 4000+ times when you can query it only  once?

Good luck,

Erik



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


RE: [PHP] MS SQL / PHP

2004-01-27 Thread Enda Nagle
Got it!

The rs objects need to be written as follows:

to give the following code:

$list2 = $conn-Execute(SELECT * FROM elive.registration) or
DIE($conn-ErrorMsg());

while (!$list2-EOF){

  $Msku = $list2-Fields(sku);
  $Mname = $list2-Fields(name);
  $Memailaddress = $list2-Fields(emailadd);
  $Mcountry = $list2-Fields(country);
  $Mnumdevices = $list2-Fields(numdevices);
  $Msource = $list2-Fields(source);

print (trtd . $list2-Fields[sku]-value . /tdtd .
$list2-Fields[name]-value . /tdtd .
$list2-Fields[emailadd]-value . /tdtd .
$list2-Fields[country]-value . /tdtd .
$list2-Fields[numdevices]-value . /tdtd .
$list2-Fields[source]-value . /td/tr);

$list2-MoveNext();
}

-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED]
Sent: 27 January 2004 14:34
To: Enda Nagle
Cc: PHP List
Subject: Re: [PHP] MS SQL / PHP


You need to find out what $list2-Fields(sku); returns. This is not
php anymore, check COM reference.

Enda Nagle wrote:

 Hi Marek,

 Thanks for your reply.

 Tried that and got the following output:
 COM Object ( [0] = Resource id #3 ) COM Object ( [0] = Resource id #9 )
 COM Object ( [0] = Resource id #15 ) COM Object ( [0] = Resource id
#21 )

 There are 4 records in the table at the moment, and its performing the
loop
 etc for the recordset but just isn't returning the data (or returning data
 in a readable format).

 Thanks

 Enda
 --



 -Original Message-
 From: Marek Kilimajer [mailto:[EMAIL PROTECTED]
 Sent: 27 January 2004 14:05
 To: Enda Nagle
 Cc: PHP List
 Subject: Re: [PHP] MS SQL / PHP


 try print_r($Msku) and see what comes out

 Enda Nagle wrote:


I have a potentially stupid problem with PHP and MSSQL on a Windows
server...

I can connect to the database and insert data to the tables etc but cannot
retrieve data...

This is the code I'm using:

//---
$list2 = $conn-Execute(SELECT * FROM elive.registration) or
DIE($conn-ErrorMsg());

while (!$list2-EOF){

  $Msku = $list2-Fields(sku);
  $Mname = $list2-Fields(name);
  $Memailaddress = $list2-Fields(emailadd);
  $Mcountry = $list2-Fields(country);
  $Mnumdevices = $list2-Fields(numdevices);
  $Msource = $list2-Fields(source);

echo



trtd$Msku/tdtd$Mname/tdtd$Memailaddress/tdtd$Mcountry/td

td$Mnumdevices/tdtd$Msource/td/tr;
  $list2-MoveNext();
}
//---

The returned info is:

 Object  Object  Object  Object  Object  Object

Am I doing something stupid?

Presumably, the code is the same as I am already using on an adodb
connection on a Linux box to a MySQL server?

Thanks for the help

Enda
Enda Nagle
+353 86 168 0774
[EMAIL PROTECTED]
www.nightsol.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

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



Re: [PHP] su idn't working from within php

2004-01-27 Thread Marek Kilimajer
You need to edit /etc/sudoers file and allow apache to execute 
command. And you also need to be carefull what you are doing or you 
will create a security hole.

Nitin Mehta wrote:
but how would i store keys for apache?

- Original Message - 
From: Marek Kilimajer [EMAIL PROTECTED]
To: Nitin Mehta [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, January 27, 2004 4:03 PM
Subject: Re: [PHP] su idn't working from within php



Why do you need su? Set up sudo for apache user.

Nitin Mehta wrote:

hi all

i was trying to execute some commands as an authorized user from within
my php script with

exec (su username -c \sudo command\ 21;, $output);

but it gives me

standard in must be a tty

how can i make it work? it runs perfectly at command prompt

I even tried to ssh, but the problem is where should i copy the rsa-key
generated with keygen, as the scripts are run as apache/http user..

Plz help me out of this

Thanx in advance
Nitin
--
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] Random questions from database

2004-01-27 Thread Alex Hogan
Hi All,

 

I want to have a series of questions that are randomized for a particular
lesson.  This part is easy.

 

I have taken the results from the db and put it in an array and then used
shuffle() to randomize the questions.

 

while($row = mssql_fetch_array($result))

{

$id[] = $row['id'];

$ques[] = $row['question'];

}

 

srand((float)microtime()*100);

shuffle($ques);

 

foreach($ques as $ranQues){

echo trtd$ranQues /td/tr\n;

}

 

What I'm wanting to do now is to add the id for each of the questions so
that I can track which one is the correct answer and which are the
distractors.  I will have something that looks like this.

 

Foreach($ques as $ranQues){

echo trtda href=\$id\$ranQues/a/td/tr\n;

}

 

My problem is keeping the $id with the $ranQues after I do the shuffle.

 

I think I am on a solid approach but if there is a simplier way please let
me know.

 

 

 

alex hogan

 



** 
The contents of this e-mail and any files transmitted with it are 
confidential and intended solely for the use of the individual or 
entity to whom it is addressed.  The views stated herein do not 
necessarily represent the view of the company.  If you are not the 
intended recipient of this e-mail you may not copy, forward, 
disclose, or otherwise use it or any part of it in any form 
whatsoever.  If you have received this e-mail in error please 
e-mail the sender. 
** 




[PHP] handling .zip and .sit files

2004-01-27 Thread Joey Manley
I'm working on an application which allows cartoonists to upload and
schedule comic strips at webcomicsnation.com.

At present, the way it works is that the cartoonist uploads a strip on one
page of a wizard style form, then enters metadata about the strip (date it
should go live, description, title, which series it belongs to, etc., etc)
on another page of the same wizard.

This works for about 90% of our alpha testers.

However, many of the cartoonists have digital archives that go back for
years, and are looking for a way to mass-upload, say, five hundred strips,
and have them entered into the database automatically.  Since most of the
people with this problem have been using the popular Keenspace.com
file-naming convention, the dates these files were originally supposed to
go live on the cartoonist's site are easily derived from the filename
(e.g. 20030101.gif).  For various reasons, I am unable to give FTP access to
the cartoonists -- only http upload.

What I'd like to find is a pre-written (free or commercial) object that will

a).  Open an uploaded .zip or .sit archive.
b).  Allow me to manipulate the files -- move them to each cartoonist's own
directory, for example, and rename them to some random value.
c).  Allow me to enter data records for each file, based on its original
filename (I can't collect ALL the metadata that will be needed this way, but
the date field is the way that the cartoonist's archives are organized, so I
can at least get the strips in the correct order in the public archive) and,
of course its new filename.

I've found plenty of ways to open and manipulate .tar files, but these
cartoonists (generally using Mac's) aren't really going to be comfortable
with that.  I've also found at least one object that will allow me to open
.zip files (I think -- haven't tested it), but, again, some of these guys go
all freaky on me when they can't do exactly what they're used to doing.
Which is, of course, the perogative of the paying user (grin).  They'd
rather have .sit.

Anybody know of anything like this?

If not, is anybody willing to give me a quote for developing something like
this for me?

Thanks!

Joey
www.webcomicsnation.com

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



RE: [PHP] Script timeout?

2004-01-27 Thread jon roig
Two ways we deal with long running scripts like this are:
1) Run it from the command line. Usually, PHP drives web pages... But it
can be used as a scripting language just like perl. Beginning the script
with set_time_limit(0) kills the timeout. Also, running from the command
line gets around all the weird browser display issues that one sometimes
sees.
2) Mark your place as you go. Maybe include a field called something
like lastSent. When each email goes out, mark it. That way, you can
recover it later if something happens.

-- jon

---
jon roig
web developer
email: [EMAIL PROTECTED]
phone: 888.230.7557



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 27, 2004 7:36 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Script timeout?


Hello Ben,

On 27 Jan 2004 at 9:27, Ben Ramsey wrote:

 I'm trying to run a query against a database with a PHP script that
 cycles through each record (about 4,000+) and sends and e-mail to them

 if they have an e-mail address present.  The problem is that everytime
I 
 do this, it processes about 430 records and stops.  There is no error 
 message generated.  Could this be due to a script timeout?  If so, how

 do I raise the timeout value?

Look up set_time_limit in the PHP manual. Also, consider retrieving all
the records first 
with a single db query, storing all e-mails in an array, and then
sending out the e-mails 
in a separate operation. Why query your db 4000+ times when you can
query it only  
once?

Good luck,

Erik

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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.564 / Virus Database: 356 - Release Date: 1/19/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.564 / Virus Database: 356 - Release Date: 1/19/2004
 

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



[PHP] How to echo something if not exist?

2004-01-27 Thread Radwan Aladdin
Hi all..

I want to echo something if the GET value was not exist in the database..
So for example : The user enters his email address and if this email was not found in 
the field of the email addresses in the table.. then echo Invalid Email Address

So how to do it?

Regards..


Re: [PHP] su idn't working from within php

2004-01-27 Thread Jas
Marek Kilimajer wrote:
You need to edit /etc/sudoers file and allow apache to execute 
command. And you also need to be carefull what you are doing or you 
will create a security hole.

Nitin Mehta wrote:

but how would i store keys for apache?

- Original Message - From: Marek Kilimajer 
[EMAIL PROTECTED]
To: Nitin Mehta [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, January 27, 2004 4:03 PM
Subject: Re: [PHP] su idn't working from within php



Why do you need su? Set up sudo for apache user.

Nitin Mehta wrote:

hi all

i was trying to execute some commands as an authorized user from within


my php script with

exec (su username -c \sudo command\ 21;, $output);

but it gives me

standard in must be a tty

how can i make it work? it runs perfectly at command prompt

I even tried to ssh, but the problem is where should i copy the rsa-key


generated with keygen, as the scripts are run as apache/http 
user..

Plz help me out of this

Thanx in advance
Nitin


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


Can I recommend you don't try to add the apache webserver user to your 
sudoers file?  Big no-no.  If anyone tries to issue a 'su' command on 
your server from a web based form for example you could compromise your 
machine.  I have a more elegant solution... create a shell script 
'command.sh' and then setup a cron job to execute the script every so 
often.  Let me show you an example...

[shell.sh]
#!/bin/sh
if test -f /path/to/file
then
  echo file found, proceeding to execute command as root
  code to be run as root
  echo removing temporary file used to signal process
  rm -dfr /path/to/file
else
  echo file was not found, exiting shell gracefully
  exit 0
fi
[end shell.sh]
[script.php]
if(!emtpy($yourvariable)) {
  echo variable found, creating temporary file to flag shell script to 
execute;
  system(touch /path/to/file);
} else {
  echo variable not present, exiting; }
[end script.php]

[crontab file]
*/5 * * * * /path/to/shell.sh /tmp/php_log 21
[end crontab file]
*** make sure you are root when adding this command to your cron jobs
This way your cronjob runs every five minutes and executes your shell 
script.  Your shell script checks to see if a temporary file is present 
and if it is executes the command on the server as the root user.  No 
privledge escalation holes.

Hope this helps, let me know if it doesn't or if you don't have 
dedicated hosting.
Jas

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


[PHP] Design Languages for site design

2004-01-27 Thread Daniel Brown
Not sure if this is off topic or not, apologises in advance if it is. 

Does anyone here use any software design languages (is that the right
term?) like UML when they are designing Php driven web sites? As I am
looking to start a new site/project and I want to design it properly
instead of making it up as I go along like I usually do. And I was
wondering if any of the software design languages like UML were any use
for this?

Does anyone here use UML or something similar when they are designing
their next site/php project?

Cheers,

Daniel

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



[PHP] Using unset with $_SESSION

2004-01-27 Thread trlists
I am trying to find a reliable method to clean out all session 
variables and start clean.

Running PHP 4.3.1 on Win2K developing a web app to run on Linux.  
Session cookies are enabled, register globals is off.  I access all 
session variables with $_SESSION.

What I have found is that if I use unset($_SESSION), set a single 
variable, and redirect, the OLD session data is passed to the new page. 
However if I use session_unset() or $_SESSION = array() and set my 
single variable, the data is passed properly.

Shouldn't unset($_SESSION) work?


Example:

Delete the session file, run something that leaves other session data 
around (or just leave it empty if you prefer), then try this:

test1.php:

 ?php
 session_start();
 # Can also use session_unset() below
 $_SESSION = array();
 $_SESSION[Test1] = test1;
 header(Location: http://localhost/test2.php;);
 exit;
 ?

test2.php:
 
 ?php
 session_start();
 var_dump($_SESSION);
 ?

This will work, the second script will show only the single element 
Test1 in $_SESSION.

However if you replace:

 $_SESSION = array();

in test1.php with:

 unset($_SESSION);

then test2.php will show whatever session data was present prior to 
invoking test1, and will not show the Test1 array element in 
$_SESSION.  In other words it not only retains the old values, but 
fails to save the new ones.

 --
 Tom Rawson

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



[PHP] Re: Stupid newbie question = Why don't I need a ; after this line?

2004-01-27 Thread Paul
Thanks guys. Duhhh. I was taught to always put ;'s and any dev software that
writes it's own code does the same. I also remember adding them because I
was getting error's at some point, perhaps PHP3.

Is it considered better practice to use them? Otherwise I've been wasting
keystrokes. I only noticed this when I was going over some code.




Paul [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Thanks for any advice.

 Can anyone tell me why I do not get any errors with ( no ; after _id'] )

 ?php echo $row_otherlawyer['lawyer_id']?

 ?php echo NO ERROR;?

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



Re: [PHP] Writing CRON jobs!

2004-01-27 Thread Ray
On Tuesday 27 January 2004 07:13, Stuart wrote:
 Hamid Hossain wrote:
  Is there any good reference on how to use CRON (I mean on the
  net)?
 
  I need to fire some PHP pages at scheduled time daily or weekly,
  ... so on.

 http://www.google.com/search?q=cron+tutorial+php

depending on how you need them to fire off

a) if cron is on the same machine as the php script, then write the 
script as a command-line php script
http://www.php.net/manual/en/features.commandline.php

b) if cron is on a different machine, create a normal web php script 
with some sort of security and use lynx -dump to call it from cron
lynx -dump https://user:[EMAIL PROTECTED]/iben1Bj7s1N/sEg4gIh6G.php

either way add the job to the /etc/crontab file
man 5 crontab
minute hour day of month month day of week user command
ie
27 2 * * * bob php4 -q /usr/local/scripts/update.php

at 2:27am everyday, run 'php4 -q /usr/local/scripts/update.php' as 
the user bob

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



Re: [PHP] Using unset with $_SESSION

2004-01-27 Thread Stuart
[EMAIL PROTECTED] wrote:
I am trying to find a reliable method to clean out all session 
variables and start clean.
http://php.net/session_destroy

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


Re: [PHP] How to echo something if not exist?

2004-01-27 Thread Miguel J. Jimnez
Radwan Aladdin wrote:

Hi all..

I want to echo something if the GET value was not exist in the database..
So for example : The user enters his email address and if this email was not found in the field 
of the email addresses in the table.. then echo Invalid Email Address
So how to do it?

Regards..

You must use a select statement to know if it exists or not... kind of:
 
$rs = mysql_query(select email from table_name where email='$email');
if (mysql_num_rows($rs) == 0)
   // Does not exist
else
   // Does exist



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

Re: [PHP] Using unset with $_SESSION

2004-01-27 Thread trlists
On 27 Jan 2004 Stuart wrote:

  I am trying to find a reliable method to clean out all session 
  variables and start clean.
 
 http://php.net/session_destroy

That destroys the file but (at least the docs say) does not clean out 
the global variables, and does not seem to work in my example.

 --
 Tom Rawson

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



Re: [PHP] Using unset with $_SESSION

2004-01-27 Thread Stuart
[EMAIL PROTECTED] wrote:
On 27 Jan 2004 Stuart wrote:

I am trying to find a reliable method to clean out all session 
variables and start clean.
http://php.net/session_destroy
That destroys the file but (at least the docs say) does not clean out 
the global variables, and does not seem to work in my example.
In that case, try this...

foreach (array_keys($_SESSION) as $key)
unset($_SESSION[$key]);
Untested, but should work.

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


Re: [PHP] Re: Stupid newbie question = Why don't I need a ; after this line?

2004-01-27 Thread -{ Rene Brehmer }-
I always use them ... but it's mainly 'cause if I ever need to expand the
code, I won't have to remember to add them ... it's for the same reason I
always use the braces '{ ... }' even though the short form would work just
as well in many cases ... 

I tend to expand my code alot with time (as I make it more advanced), and
recycle it across multiple projects ... it's simply easier if all the
thingies are there already, as it produces far less errors when copy/pasting
from file to file

Rene

Fate would have it, that on Tue, 27 Jan 2004 09:56:02 -0600, Paul wrote:

Thanks guys. Duhhh. I was taught to always put ;'s and any dev software that
writes it's own code does the same. I also remember adding them because I
was getting error's at some point, perhaps PHP3.

Is it considered better practice to use them? Otherwise I've been wasting
keystrokes. I only noticed this when I was going over some code.

-- 
Rene Brehmer
aka Metalbunny

http://metalbunny.net/
References, tools, and other useful stuff...

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



Re: [PHP] Using unset with $_SESSION

2004-01-27 Thread trlists
On 27 Jan 2004 Stuart wrote:

 In that case, try this...
 
 foreach (array_keys($_SESSION) as $key)
  unset($_SESSION[$key]);

Yes, I had tried that but forgot to mention it.  It does work.

However, I'm still mystified as to why unset($_SESSION) not only 
doesn't remove old data from the sesison file when the script exits, 
but prevents the new variable I create after that from being saved.

Perhaps $_SESSION as created by PHP is special and is tied to the 
session storage, whereas if it is destroyed with unset and then 
recreated that link is lost.  That would explain the behavior.

 --
 Tom Rawson

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



[PHP] Unix-Apache: running apache as different user

2004-01-27 Thread Eli Hen
Hello All,

I have PHP installed on Apache and Unix with several vhosts so each vhost
has its own user account on Unix.
Now when accessing a webpage, Apache runs with user httpd.. but I want it to
run as the user of the vhost account.. How can I do that?

thanks in advnce,
-Lorderon

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



Re: [PHP] newbie issues with control structures HTML form

2004-01-27 Thread Stuart
Jonno Agnew wrote:
I wondered if I can ask you two follow-up questions?
On-list, yes. Off-list, yes, at consultancy rates.

(1) On Useractive's PHP environment, if ($guessnumb) { seems to work 
fine, but on my PHP 4.3.4 environment it doesn't. Is there some setting 
I need to tweak, and if so could you walk me through a way of making the 
change? I know register_globals is turned OFF in my set-up but don't 
know how to turn it on or if that's wise.
http://php.net/register_globals (best to code for register_globals off).

(2) Regarding your code below. I recognize these two statements as some 
sort of arrays. How do I actually write the equivalent code to evaluate 
if the variable has been passed/set, then do either this or that?
if (isset($_GET['guessnumb']))
{
...
}
--
Stuart
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Design Languages for site design

2004-01-27 Thread Brent Baisley
UML is a universal language that can be used for PHP, a factory, 
Java, Legos, etc. I had entertained reading up on and learning UML last 
year, but was convinced, by friends, it wasn't worth it unless you 
would be using it all the time (meaning working at a large company). I 
think they are actually working on a new version of UML that is 
supposed to simplify it.

That doesn't mean you shouldn't have good planning. An entity 
relationship diagram is still crucial for your database. But UML may be 
overkill, especially for a single developer. Personally, I started 
reading up on design patterns instead. You may actually already be 
using the most popular design pattern, MVC (Model, View Controller). 
You should be able to find a bunch of articles on the net on the MVC 
technique, including a few specific to PHP.
I still tend to make it up as I go along more than I should, but my 
mistakes are a lot easier to fix if I design around MVC. UML is still 
on my list of things to learn, but it's just lower than other things.

On Jan 27, 2004, at 10:50 AM, Daniel Brown wrote:

Not sure if this is off topic or not, apologises in advance if it is.

Does anyone here use any software design languages (is that the right
term?) like UML when they are designing Php driven web sites? As I am
looking to start a new site/project and I want to design it properly
instead of making it up as I go along like I usually do. And I was
wondering if any of the software design languages like UML were any use
for this?
Does anyone here use UML or something similar when they are designing
their next site/php project?
--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PEAR / PHP / IIS Inetinfo consuming more and more memory

2004-01-27 Thread Vincent DUPONT
Hi all,
 
I'm developing a web appl. with PHP and PEAR, using mainly PEAR::MDB, PEAR::Config, 
and Smarty template engine.
Under Win2000, the system seems to go slower and slower from the morning to the 
evening. A quick Task Manager, and ...
 
My inetinfo.exe process consumes most of my RAM . I wonder if this is related to PHP 
and / or PEAR??
I'm not really a fan of IIS but...
 
Are there some tricks to free memory on runtime?
 
Vincent
 


[PHP] sending mail with attachment problems

2004-01-27 Thread tony
Hi,

i'm trying to send emails with attachment but i get an error
at $file = fread($fp, $att_size);
and i don't understand why, any help is appreciated.
code is below

 $subject = $_REQUEST['subject'];
 $cc  = $_REQUEST['cc'];
 $from= $_REQUEST['from'];
 $message = $_REQUEST['text'];
 $att = $_FILES['attachment'];
 $filename = /home/prog/www/phpmail.txt;

 $handle = fopen ($filename, r);

  $fp   = fopen($att_name, r);
  $file = fread($fp,$att_size);
  $file = chunk_split(base64_encode($file));
  $num  = md5( time() );

  $hdr  = From:$from\r\n;
  $hdr .= CC:$cc\r\n;
  $hdr .= MIME-Version: 1.0\r\n;
  $hdr .= Content-type: multipart/mixed; ;
  $hdr .= boundary=$num \r\n;
  $hdr .= --$num\r\n;

  $hdr .= Content-type: text/plain\r\n;
  $hdr .= Content-Transfer-Encoding: 8bit\r\n\n;
  $hdr .= $message\r\n;
  $hdr .= --$num\n;

  $hdr .= Content-type: $att_type; ;
  $hdr .= name=\$att_name\\r\n;
  $hdr .= Content-Transfer-Encoding: base64\r\n;
  $hdr .= Content-Disposition: attachment; ;
  $hdr .= filename=\$att_name\\r\n\n;
  $hdr .= $file\r\n;
  $hdr .= --$num--;

  do{
   $data = fread($handle, 128);
   if (strlen($data) == 0) {
break;
   }
   mail($data,$subject,,$hdr);
   print done to $data  with attachment;

  }while(true);
fclose($handle);

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



Re: [PHP] Unix-Apache: running apache as different user

2004-01-27 Thread BAO RuiXian


Eli Hen wrote:

Hello All,

I have PHP installed on Apache and Unix with several vhosts so each vhost
has its own user account on Unix.
Now when accessing a webpage, Apache runs with user httpd.. but I want it to
run as the user of the vhost account.. How can I do that?
 

What version of Apache you are using? If you are using Apache 2, the 
answer is no, while for Apache 1.3, yes, you just need to add suitable 
user directive for each vhost. Hope this helps.

Best

Bao

thanks in advnce,
-Lorderon
 

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


Re: [PHP] Random questions from database

2004-01-27 Thread memoimyself
Hello Alex,

On 27 Jan 2004 at 9:25, Alex Hogan wrote:

 while($row = mssql_fetch_array($result))
 
 {
 
 $id[] = $row['id'];
 
 $ques[] = $row['question'];
 
 }

To keep question and id together even after shuffling the array, why don't you build 
an 
array of arrays like this:

$i = 0;
$questions = array();

while( $row = mssql_fetch_array($result) )
{
$questions[$i]['ques'] = $row['question'];
$questions[$i]['id'] = $row['id'];
$i++;
}

 srand((float)microtime()*100);

You don't need to seed the random number generator if you're using PHP 4.2.0 or 
above.

 shuffle($ques);
 
  (...)
 
 What I'm wanting to do now is to add the id for each of the questions so
 that I can track which one is the correct answer and which are the
 distractors.  I will have something that looks like this.
 
 
 Foreach($ques as $ranQues){
 
 echo trtda href=\$id\$ranQues/a/td/tr\n;
 
 }
  
 
 My problem is keeping the $id with the $ranQues after I do the shuffle.

That's not a problem if you follow my previous suggestion. All you need to do is:

foreach($questions as $ranQues)
{
echo trtda href=\$ranQues['id']\$ranQues['ques']/a/td/tr\n;
}

Hope this helps.

Erik


[PHP] COM objects

2004-01-27 Thread C C
Hi,

I am running PHP 4.3.4 on Windows 2000 server with
Apache 2.0.48. I am using COM objects in some of the
pages. My question is, how do I release them when I'm
done? Right now, I'm unsetting them, but after a few
days I get COM+ Errors in the Event Viewer:

The COM+ Services DLL (comsvcs.dll) was unable to load
because allocation of thread local storage failed. 

Process Name: Apache.exe
Error Code = 0x80070008 : Not enough storage is
available to process this command.
COM+ Services Internals Information:
File: .\comsvcs.cpp, Line: 289

Anyone have any suggestions? Thanks,

CC

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

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



Re: [PHP] sending mail with attachment problems

2004-01-27 Thread memoimyself
Hello Tony,

On 27 Jan 2004 at 16:47, tony wrote:

 Hi,
 
 i'm trying to send emails with attachment but i get an error (...)

I haven't even had a look at your code, but sending e-mails with attachments can be 
quite tricky, so I suggest that instead of trying to re-invent the wheel you use 
Richard 
Heyes's excellent (and free) HTML Mime Mail class available at 
http://www.phpguru.org/mime.mail.html .

Cheers,

Erik

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



Re: [PHP] Writing CRON jobs!

2004-01-27 Thread Brian V Bonini
On Tue, 2004-01-27 at 08:08, Hamid Hossain wrote:
 Is there any good reference on how to use CRON (I mean on the net)?
 

The best source is the man page crontab(5)


-- 
BrianGnuPG - KeyID: 0x04A4F0DC | URL: www.gfx-design.com/keys
  Key Server: pgp.mit.edu
==
gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC
GnuPG: http://gnupg.org
http://www.biglumber.com/x/web?qs=0x2C35011004A4F0DC
Linux Registered User #339825 at http://counter.li.org


signature.asc
Description: This is a digitally signed message part


Re: [PHP] Size of session?

2004-01-27 Thread John W. Holmes
From: motorpsychkill [EMAIL PROTECTED]


 I'm not sure if this has been covered (I searched the archives) but does
 anyone know if there is a size limit on what a session can store?  What is
 this dependant on?

I think you already got your answer. I'd just like to say that if you have
to ask this question, odds are you're using sessions in a bad way...

---John Holmes...

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



Re: [PHP] order by

2004-01-27 Thread Brian V Bonini
On Tue, 2004-01-27 at 07:34, christian tischler wrote:
 Is there a way wuth php to create a list ordered by more than one column
 like in excel or access.
 
 something like ORDER BY points AND score

... ORDER BY column1, column2, etc...;

-- 
BrianGnuPG - KeyID: 0x04A4F0DC | URL: www.gfx-design.com/keys
  Key Server: pgp.mit.edu
==
gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC
GnuPG: http://gnupg.org
http://www.biglumber.com/x/web?qs=0x2C35011004A4F0DC
Linux Registered User #339825 at http://counter.li.org


signature.asc
Description: This is a digitally signed message part


Re: [PHP] Server / filename manipulation

2004-01-27 Thread Shaun
One question,

Do you know if this is possible with IIS?

Thanks for your help

Shaun [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Perfect, complicated but perfect!

 Thanks

 Raditha Dissanayake [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  hi,
 
  If i understand you correctly this can be done using apache url
  rewrites.  We have done something similar (though not with php) on
  http://www.kelanisearch.com/  on this site regardless of the page that's
  accessed the same script is called, isn't that what you are looking for?
 
  If so there is an excellent guide to URL rewriting distributed with the
  apache docs.
 
  all the best
 
 
  Can be done using
  Shaun wrote:
 
  Hi,
  
  I have an question on how to create a completely database / xml driven
 site
  i.e. the page names, links, the site map etc are held in the database.
I
  think I have solved most problems but what I would really like to do is
  limit the number of pages I need. Can I manipulate the server such that
 if I
  have links to a pages; a href=red_hats.phpred_hats.php/a and a
  href=yellow_hats.phpyellow_hats.php/a can both these links and
 others
  link to a different page that dynamically constructs whilst the links
 aren't
  altered. Maybe is there some way that a default php page is called that
  reads the link of the page called and constructs appropriately etc.
  
  I would be most grateful for your input on this.
  
  
  
 
 
  --
  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 150 KB | with progress bar.

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



Re: [PHP] handling .zip and .sit files

2004-01-27 Thread John Nichel
Joey Manley wrote:

I'm working on an application which allows cartoonists to upload and
schedule comic strips at webcomicsnation.com.
At present, the way it works is that the cartoonist uploads a strip on one
page of a wizard style form, then enters metadata about the strip (date it
should go live, description, title, which series it belongs to, etc., etc)
on another page of the same wizard.
This works for about 90% of our alpha testers.

However, many of the cartoonists have digital archives that go back for
years, and are looking for a way to mass-upload, say, five hundred strips,
and have them entered into the database automatically.  Since most of the
people with this problem have been using the popular Keenspace.com
file-naming convention, the dates these files were originally supposed to
go live on the cartoonist's site are easily derived from the filename
(e.g. 20030101.gif).  For various reasons, I am unable to give FTP access to
the cartoonists -- only http upload.
What I'd like to find is a pre-written (free or commercial) object that will

a).  Open an uploaded .zip or .sit archive.
b).  Allow me to manipulate the files -- move them to each cartoonist's own
directory, for example, and rename them to some random value.
c).  Allow me to enter data records for each file, based on its original
filename (I can't collect ALL the metadata that will be needed this way, but
the date field is the way that the cartoonist's archives are organized, so I
can at least get the strips in the correct order in the public archive) and,
of course its new filename.
I've found plenty of ways to open and manipulate .tar files, but these
cartoonists (generally using Mac's) aren't really going to be comfortable
with that.  I've also found at least one object that will allow me to open
.zip files (I think -- haven't tested it), but, again, some of these guys go
all freaky on me when they can't do exactly what they're used to doing.
Which is, of course, the perogative of the paying user (grin).  They'd
rather have .sit.
Anybody know of anything like this?

If not, is anybody willing to give me a quote for developing something like
this for me?
Zip files are a breeze if php is compiled with --with-zip.  However, I 
don't know of any way to handle .sit (and would be real interested to 
know if it can be done).

http://us4.php.net/zip

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


Re: [PHP] handling .zip and .sit files

2004-01-27 Thread David O'Brien
At 12:39 PM 1/27/2004, John Nichel wrote:
Joey Manley wrote:

I'm working on an application which allows cartoonists to upload and
schedule comic strips at webcomicsnation.com.
this for me?
Zip files are a breeze if php is compiled with --with-zip.  However, I 
don't know of any way to handle .sit (and would be real interested to know 
if it can be done).

http://us4.php.net/zip


Looking around I found this:

http://www.stuffit.com/win/sdk/

maybe someone could make an extension out of it or at least
you could system() their linux version and then manipulate the
extracted files.
-Dave


David G. O'Brien
Web Services Coordinator / Systems Administrator
NACCRRA
The Nation's Network of Child Care Resource  Referral
1319 F Street NW, Suite 500
Washington, DC 20004
(202) 393-5501 ext. 113
(202) 393-1109 fax
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: COM objects

2004-01-27 Thread pete M
I personally abandoned using any com object a few months ago as 
maintaining and identifying similar problems took mmore time that 
writing effective code to make the system steady...

C C wrote:
Hi,

I am running PHP 4.3.4 on Windows 2000 server with
Apache 2.0.48. I am using COM objects in some of the
pages. My question is, how do I release them when I'm
done? Right now, I'm unsetting them, but after a few
days I get COM+ Errors in the Event Viewer:
The COM+ Services DLL (comsvcs.dll) was unable to load
because allocation of thread local storage failed. 

Process Name: Apache.exe
Error Code = 0x80070008 : Not enough storage is
available to process this command.
COM+ Services Internals Information:
File: .\comsvcs.cpp, Line: 289
Anyone have any suggestions? Thanks,

CC

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Regex Help

2004-01-27 Thread karthikeyan.balasubramanian
Hi Ben,

  Your code works but If i remove the delimter [] which
I gave so that you could capture the data which needs to be
picked it doesnt work?.  Any help?

Karthikeyan B
- Original Message -
From: Ben Ramsey [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; Karthikeyan
[EMAIL PROTECTED]
Sent: Monday, January 26, 2004 11:56 PM
Subject: [PHP] Re: Regex Help


 Check the PHP manual for preg_match()
 (http://us3.php.net/manual/en/function.preg-match.php).

 I did play around with it a little bit, and I think I've got a starting
 point for you to work with.  Try out this code and then play around with
 it to get the results you need.  $matches[2][0] will hold the full line
 for Mayberry Mob.  You could then just use the substr() function to pull
 the data from that line.

 The code is, as follows:

 $subject = 
 =
 NF [1/21/04] E Race 11 Grade B [5-16] Going F

 U Too Tipsy  60½ 2 1 1 1   1 1   1 ½  30.46   4.40  Held Firm
Inside

 Dream Away   62  8 2 3 2   3 2 ½  30.51   17.90 Up For Plc
Mdtk

 Pounce N Bounce  70  5 4 2 1   2 3 2  30.58   4.50  Held Show
Inside

 Oneco Conor  67½ 7 8 4 5   4 4 2  30.60   6.90  Evenly Inside

 Krazy Kirk   70  4 3 6 7   5 5 5  30.79 * 1.90  Varied
 Little Mdtrk

 Mayberry Mob 73½ 1 6 5 6   6 6 10 31.15   5.30  Never
 Prominent Ins

 Jw Alley's Wish  60  3 7 8 9   7 7 10 31.17   6.50  No Factor
Mdtrk

 Rooftop Comet56  6 5 7 8   8 8 19 31.79   21.80 Never In It
Mdtk
 
 ;
 $pattern = /\[(\d+\/\d+\/\d+|\d+\-\d+)\]|(Mayberry Mob.*)/;
 if (preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER)) {
 print_r($matches);
 } else {
 echo no match.;
 }

 Hope that helps!



 Karthikeyan wrote:

  Sorry last time I forgot to put subject on my mail.  So here
  I am putting appropriate subject and sending it.
 
  Hi All,
 
Just wondering if somebody can help me with this small regex search.
  The information I wanted to capture is the one in the Square Bracket.
  i.e Date : 1/21/04, Race Type: 5-16, Dog Position: 6(Mayberry Mob)
 
  =
  NF [1/21/04] E Race 11 Grade B [5-16] Going F
 
  U Too Tipsy  60½ 2 1 1 1   1 1   1 ½  30.46   4.40  Held Firm
  Inside
 
  Dream Away   62  8 2 3 2   3 2 ½  30.51   17.90 Up For Plc
Mdtk
 
  Pounce N Bounce  70  5 4 2 1   2 3 2  30.58   4.50  Held Show
  Inside
 
  Oneco Conor  67½ 7 8 4 5   4 4 2  30.60   6.90  Evenly
Inside
 
  Krazy Kirk   70  4 3 6 7   5 5 5  30.79 * 1.90  Varied
  Little Mdtrk
 
  [Mayberry Mob] 73½ 1 6 5 6   6 6 10 31.15   5.30  Never
  Prominent Ins
 
  Jw Alley's Wish  60  3 7 8 9   7 7 10 31.17   6.50  No Factor
Mdtrk
 
  Rooftop Comet56  6 5 7 8   8 8 19 31.79   21.80 Never In It
  Mdtk
  
 
  Looking forward to hear some response.
 
  Have a great day.
 
  Karthikeyan B
 

 --
 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] How to make the value updated always?

2004-01-27 Thread Radwan Aladdin
Hello..

How to make the PHP file (Login page) to update a value every 5 seconds for example 
from the database..

So if the connection is alive it will update the value. But if the connection 
diconnected with the database then it will stop doing that.. then in the comming login 
it will do the same..

So how to do that?

And also I want to know if the user didn't logout from his account.. I mean closed the 
APP (VB APP) without pressing the Logout button.. so will it continue updating the 
database? or it will automatically stop that?

Regards..


[PHP] No headers from CGI scripts?

2004-01-27 Thread Len Borowski
I'm in the process of moving some scripts from a RH linux 7.x box(using
apache 1.3 and php4) to Debian stable.  I've installed apache 2 and php4
from source since Debian stable does not support apache 2 but I'm having
trouble with some of the scripts that were being executed as CGI on the
old RH 7.x box.  These scripts no longer seem to generate valid headers
if I run them as cgi scripts.

Typical code that failts might look like this...

#!/usr/bin/php
?php
require_once('body.inc');
setcookie(lsl_entry,set);

$body = introBody();

echo $body;
?

I tried inserting header('Content-Type: text/html') but that doesn't
seem to do anything.  I tried executing the script using CLI php and the
same thing happens, no headers are sent.

The relevant lines from the apache configuration look like...
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
Directory /usr/lib/cgi-bin
 AllowOverride FileInfo
 Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
 Order allow,deny
 Allow from all
/Directory

Additionally, we need to be able to execute php scripts outside the
cgi-bin and so I have added the following to the apache2 config...

AddType application/x-httpd-php .php

What am I doing wrong here?  I'm most confused because the header
function doesn't seem to be working as expected. Can anyone lend some
insight?

-Len

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



Re: [PHP] Tip For The Day

2004-01-27 Thread Robert Cummings
On Tue, 2004-01-27 at 09:19, Jay Blanchard wrote:
 When constructing arrays where you are meddling with fixed width
 substrings in a larger file make sure that the array item does not
 contain a tab or you will certainly get unexpected results;
 
 $arrBadInfo (
   'AMARILLOHOUSE   ',
   'KJONES  HOUSE   ', --- 16 characters wide, or is it?
   'DCOLLINSCUSTSVC ',
   'LAWTON  JCOLEMAN',
   };
 
 Both above appear to be 16 characters wide in the editor of your choice
 (I am using Zend at the moment). However, if there is a tab between
 KJONES and HOUSE, the HOUSE is moved to the right the appropriate number
 of characters (or inappropriate as it were) and produce undesired
 results. I have been working on this issue since 5 am this morning when
 I finally decided to print_r() the array (consisting of 192 elements).
 Lo and behold (and slapping my forehead thusly) we saw that there were
 tabs in the result. Replacing the tabs with the proper number of spaces
 fixed the result.
 
 Actually this tip applies to all strings in which you expect there to be
 a fixed width. Beware the tab, especially if you are bring in the data
 from a source (cuttin' n' pastin') outside of your editor.

Event better... turn your editor's tab character to 4 spaces, then your
code never contains those despicable tab characters and you won't
accidentally insert tabs into strings :)

Cheers,
Rob
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Tip For The Day

2004-01-27 Thread Alex Pilson
At 1:40 PM -0500 1/27/04, Robert Cummings wrote:
On Tue, 2004-01-27 at 09:19, Jay Blanchard wrote:
 When constructing arrays where you are meddling with fixed width
 substrings in a larger file make sure that the array item does not
 contain a tab or you will certainly get unexpected results;
 $arrBadInfo (
'AMARILLOHOUSE   ',
'KJONES  HOUSE   ', --- 16 characters wide, or is it?
'DCOLLINSCUSTSVC ',
'LAWTON  JCOLEMAN',
};
 Both above appear to be 16 characters wide in the editor of your choice
 (I am using Zend at the moment). However, if there is a tab between
 KJONES and HOUSE, the HOUSE is moved to the right the appropriate number
 of characters (or inappropriate as it were) and produce undesired
 results. I have been working on this issue since 5 am this morning when
 I finally decided to print_r() the array (consisting of 192 elements).
 Lo and behold (and slapping my forehead thusly) we saw that there were
 tabs in the result. Replacing the tabs with the proper number of spaces
 fixed the result.
 Actually this tip applies to all strings in which you expect there to be
 a fixed width. Beware the tab, especially if you are bring in the data
 from a source (cuttin' n' pastin') outside of your editor.
Event better... turn your editor's tab character to 4 spaces, then your
code never contains those despicable tab characters and you won't
accidentally insert tabs into strings :)
Couldn't you trim the items before placing into an array?
--
---
Alex Pilson
FlagShip Interactive, Inc.
[EMAIL PROTECTED]
---
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Tip For The Day

2004-01-27 Thread Chris Shiflett
--- Robert Cummings [EMAIL PROTECTED] wrote:
 Event better... turn your editor's tab character to 4 spaces, then
 your code never contains those despicable tab characters and you won't
 accidentally insert tabs into strings :)

And your file sizes increase by 25%, and you enforce your tab preference
on every other developer (rather than letting them choose their own), and
you'd better hope that everyone's editor can perform operations on
vertical selections of text, otherwise changes in identation becomes a
huge hassle.

I think tabs are great. :-)

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/

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



Re: [PHP] Unix-Apache: running apache as different user

2004-01-27 Thread Mike Migurski
I have PHP installed on Apache and Unix with several vhosts so each vhost
has its own user account on Unix. Now when accessing a webpage, Apache
runs with user httpd.. but I want it to run as the user of the vhost
account.. How can I do that?

http://httpd.apache.org/docs/suexec.html

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



Re: [PHP] Tip For The Day

2004-01-27 Thread Chris Shiflett
--- Alex Pilson [EMAIL PROTECTED] wrote:
 Couldn't you trim the items before placing into an array?

That would not have helped him, because trim() doesn't remove any
whitespace in between characters.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security Handbook
 Coming mid-2004
HTTP Developer's Handbook
 http://httphandbook.org/

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



Re: [PHP] Tip For The Day

2004-01-27 Thread Robert Cummings
On Tue, 2004-01-27 at 13:49, Chris Shiflett wrote:
 --- Robert Cummings [EMAIL PROTECTED] wrote:
  Event better... turn your editor's tab character to 4 spaces, then
  your code never contains those despicable tab characters and you won't
  accidentally insert tabs into strings :)
 
 And your file sizes increase by 25%, and you enforce your tab preference

Hard-drives are cheap, and I don't see anyone writing scripts at the Gig
level yet.

 on every other developer (rather than letting them choose their own), and

Yes but now every developer knows there's 4 spaces there, and not 3
spaces and a tab, or 2 tabs and a space, all of which can look like crap
if you change your preferred tab width anyways.

 you'd better hope that everyone's editor can perform operations on
 vertical selections of text, otherwise changes in identation becomes a
 huge hassle.

My editor does vertical selection fine.

 I think tabs are great. :-)

Its all good, it's like inline braces versus dropped braces and every
other coding style debate :) There's no winner.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



RE: [PHP] Tip For The Day

2004-01-27 Thread Jeremy
[snip]
Its all good, it's like inline braces versus dropped braces and every
other coding style debate :) There's no winner.
[/snip]

pfft. Inline braces wins hands down ;p

-J

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



[PHP] Re: odbc functions - not binary safe?

2004-01-27 Thread Anthony
If you're connecting to the mySQL database through ODBC (why not just
connect directly to mySQL server?) ... then you probably have to escape with
a single quote.  For most ODBC drivers you escape ' with '' (two single
quotes) . took me a while to figure that one out, but works for me. :)

- Anthony

C C [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 I'm trying to insert binary data into a MS SQL Server
 database. Text files are added fine, but binary files
 with null bytes are not. The field I'm adding the
 binary data to is image type. I get an error about
 unclosed quotation marks at the null byte, but I've
 replaced ' with ''.

 I tried escaping the null byte with a backslach, but
 it just changes it to the string \0 when I download
 it.

 Anyone have any ideas about this?

 __
 Do you Yahoo!?
 Yahoo! SiteBuilder - Free web site building tool. Try it!
 http://webhosting.yahoo.com/ps/sb/

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



Re: [PHP] Tip For The Day

2004-01-27 Thread John Nichel
Chris Shiflett wrote:
snip
And your file sizes increase by 25%, and you enforce your tab preference
on every other developer (rather than letting them choose their own), and
you'd better hope that everyone's editor can perform operations on
vertical selections of text, otherwise changes in identation becomes a
huge hassle.
I think tabs are great. :-)
I guess it boils down to personal preference.  Up until a year ago, 
every bit of programming that I have ever done, I was free to use tabs. 
 The place I'm at now, wants us to use spaces (and set your editor's 
tab to use spaces), and I just can't get used to it.  However, there are 
guys working with me who have always used spaces, and think tabs are 
just wrong.

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


Re: [PHP] Tip For The Day

2004-01-27 Thread John Nichel
Jeremy wrote:
[snip]

Its all good, it's like inline braces versus dropped braces and every
other coding style debate :) There's no winner.
[/snip]

pfft. Inline braces wins hands down ;p

-J

It's on now.  Somebody set up the ring for the cage match.  Last brace 
standing at the end wins. ;)

--
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] drop down list not populating

2004-01-27 Thread Montagna, Dan
Hi
 
I've got the code for a drop down list and the drop down box displays--but
with no info in it.  The underlying table is populated so I could use some
advice on what might be wrong from here
 
SELECT
  ?
include(includes/db.php);
 
MYSQL_CONNECT(HOST,USER,PASS) OR DIE(Unable to connect to database); 
@mysql_select_db(DB) or die( Unable to select database);
 
$query=(select * from community order by community);
 
$result=mysql_query($query) or die (Unable to Make the Query: .
mysql_error() ); 
 
while($row=mysql_fetch_array($result)){ 
 
echo OPTION VALUE=.$row['community']./OPTION;
}
?
/SELECT
 
Any ideas?
 
Thanks
 
Dan
 


  1   2   >