Re: [PHP] Serious Fopen Problems - not newbie :)

2001-09-01 Thread Philip Murray

Depending on the version of PHP you're using, this might help:

Versions prior to PHP 4.0.5 do not handle HTTP redirects. Because of
this, directories must include trailing slashes.

It's from the fopen() manual page, http://www.php.net/fopen

Cheers

 -  -- -  -   -
Philip Murray - [EMAIL PROTECTED]
http://www.open2view.com - Open2View.com
- -  -- -   -

 This is a snippet from my code.

 $FILE = http://www.somehost.com;;

 $fp = fopen($FILE, r);

 if(!$fp){
  print(Somethings screwy);
 }
 else{
  do stuff
 }

 Any suggestions?

 Paul

 Speedboy wrote:

   I'm sure http://www.php.net exists.  :)
 
  No, what my sentence meant was you're trying to do some operations on a
  mis-typed file descripter?
 
  $fp = fopen...
  fputs($fp2...
   ^- There should be no 2.
 
  Possibly something like that?
 
  with fopen().  Everytime I try to use fopen, I get some weird
error
  messages.  If I do fopen(http://www.php.net;, r) - I get this
error
  message: Undefined error:
  If I try doing
  fopen(http://www.somehost.com/~myname/somefile.php?var=value;,
r) - I
  get this message:   Bad file descriptor
   
You're trying to do operations on a file descripter that doesn't
exist?


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] something like SSI ?

2001-08-14 Thread Philip Murray

Quoting Martin [EMAIL PROTECTED]:
 Ok, this may seem like a dumb newbie question...
 
 Is there an function like ASP's Server Side Include in PHP ? Or what is best
 to use instead, fread ?
 

Check out

include();
require();
include_once();
require_once();

It's all in the manual

-- 

 -  -- -  -   -
Philip Murray - [EMAIL PROTECTED]
http://www.open2view.com - Open2View.com
- -  -- -   -


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Share Session Vars on 2 servers

2001-07-31 Thread Philip Murray

Hi Paul,

If you have a single database between the 2 servers you could implement your
own session handlers using PostgreSQL, Mysql or any other db for that
matter.

http://php.net/manual/en/function.session-set-save-handler.php


Shouldn't be to difficult to do at all I imagine.

Hope this helps!

 -  -- -  -   -
Philip Murray - [EMAIL PROTECTED]
http://www.open2view.com - Open2View.com
- -  -- -   -

- Original Message -
From: Paul R. Jackson [EMAIL PROTECTED]
 I have developed a well tested password protection system using session
 vars. We have 2 web servers with half of our pages on each (for reasons I
 wont go into). What I need to be able to do is have a single login that
 would then work on both servers. Which basically means sharing session
vars
 on 2 servers.

 Yes sure I could use just straight cookies because both servers live under
 the same main domain but I have the system already in place and I dont
want
 to change it.

 I think it could be done by forcing the 2 servers to use the session temp
 same directory with 'session.save_path' variable by using a NFS share. But
 we would prefer not to do that. And in fact if that was the only solution
we
 would just do without.

 Is there soemthing else I can do.

 Paul





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] File Upload

2001-07-29 Thread Philip Murray

Quoting Gerard Samuel [EMAIL PROTECTED]:
 Hey all, Im running freebsd 4.3, apache 1.3.20, mysq.3.23.39, php 4.0.6.
 Im trying to figure out file uploading.
 If I echo $pic, $pic_name, $pic_size, $pic_type, after the form is 
 submitted, everything echoes correctly.
 
 In my script I have ==
 $archive_dir = /files/www/data/archive;
 $filename = basename($pic_name);
 if (!copy($pic, $archive/$filename))

Shouldn't that be 

if( !copy( $pic, $archive_dir/$filename ) );

 echo Error: $filename cannot be uploaded.;
 else echo Successfully uploaded $filename.;
 
 When I submit the form, it outputs ==
 Error: Dscf0005.jpg cannot be uploaded.
 
 I chmoded the folder to 777 and still the same results.
 

It's always the simple things. :) 

-- 

 -  -- -  -   -
Philip Murray - [EMAIL PROTECTED]
http://www.open2view.com - Open2View.com
- -  -- -   -


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: HTTP header question.

2001-07-29 Thread Philip Murray

Quoting Ben Bleything [EMAIL PROTECTED]:
 I'm fully aware of that.  The issue is not the refreshing (that works
 fine)...
 
 Here's a little more detail:
 
 if(!$login)
 {
   if($failure)
   // complain
 
   // show the form
 }
 else
 {
   if(user_is_good)
   // take them to the next page
   else
   // complain
 }
 
 The //complain in the else section is this:
 
 Unset($login); // so it won't try to authenticate again
 $failure = true; // so the form knows to complain
 header(Location: login.php);
 
 Okay.  So, just to clear things up, I'm not sending anything before
 this.  This happens IMMEDIATELY after the user clicks on Submit...
 
 What I'm looking for is a way to do this such that the user does not see
 anything more than http://host.name.here/rams/login.php in their address
 bar when it failed... doing it the way I show above does not work, and
 the alternative ( header(Location: login.php?failure=true) ) does not
 satisfy my requirement.
 
 So... anybody else?
 -

How about using javascript?

For example

form name=loginFailure action=login.php method=POST
input type=hidden name=failure value=true
[...any other data you want...]
/form

script language=Javascript type=text/javascript
!--
document.forms[0].submit()

// or document.forms['loginFailure'].submit();
// --
/script

It's untested, but you get the idea.

Cheers

-- 

 -  -- -  -   -
Philip Murray - [EMAIL PROTECTED]
http://www.open2view.com - Open2View.com
- -  -- -   -


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] END block

2001-07-28 Thread Philip Murray

Hi Erick, 

It's all in the manual...

http://php.net/manual/en/function.register-shutdown-function.php

Cheers

 -  -- -  -   -
Philip Murray - [EMAIL PROTECTED]
http://www.open2view.com - Open2View.com
- -  -- -   -

- Original Message - 
From: Erick Calder [EMAIL PROTECTED]
To: PHP [EMAIL PROTECTED]
Sent: Sunday, July 29, 2001 3:50 PM
Subject: [PHP] END block


 is there an equivalent to Perl's END block? i.e some way to automatically
 run certain code when a page is about to end?
 
 1k thx - e
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] $this-db-Record[WLPcountry.name]

2001-07-22 Thread Philip Murray

- Original Message -
From: Mike Gifford [EMAIL PROTECTED]

 Hello,

 I'm using phplib to add functionality to my bibliography app.  However I'm
not
 sure how to deal with selected data from different tables with the same
field name.

 The example I provided in the signature was:
 $this-db-Record[WLPcountry.name]

  Which needs to be differentiated from:
 $this-db-Record[WLPpublisher.name]

 Any suggestions would be useful...


You can use the AS keyword to rename the fields to whatever you want, for
example:

 SELECT
 WLPbib.bibID,
 WLPbib.title,
 WLPbib.publicationDate,
 WLPbib.URL,
 WLPpublisher.name AS publisher_name,
 WLPaddress.city,
 WLPaddress.state,
 WLPaddress.countryID,
 WLPcountry.name AS country_name,
 WLPprofile.firstName,
 WLPprofile.middleName,
 WLPprofile.lastName,
 WLPprofile.organization
 FROM
 WLPbib


So then, you'd have:

$this-db-Record[country_name]

and

$this-db-Record[publisher_name]

Hope this helps!

Cheers
 -  -- -  -   -
Philip Murray - [EMAIL PROTECTED]
http://www.open2view.com - Open2View.com
- -  -- -   -


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] What's wrong with this regular expression?

2001-07-20 Thread Philip Murray

Hi James,

This is what you want

$body=eregi_replace (a
href=\([^]+)\([^]+)/a,[url=\\\1\]\\2[/url],$body);

You were checking for no ['s in the string instead of no 's or 's

 -  -- -  -   -
Philip Murray - [EMAIL PROTECTED]
http://www.open2view.com - Open2View.com
- -  -- -   -


- Original Message -
From: James Crowley [EMAIL PROTECTED]
To: PHP List [EMAIL PROTECTED]
Sent: Saturday, July 21, 2001 6:26 AM
Subject: [PHP] What's wrong with this regular expression?


 Hi,
 Could someone please point out where I've gone wrong with this regular
 expression...?

 $body=a href=\http://www.fred.com\;my test/a or a
 href=\/show.asp?id=333\here/a;
 $body=eregi_replace (a
 href=\([^\\[]*)\([^\\[]*)/a,[url=\\\1\]\\2[/url],$body);

 #$body should now be
 [url=http://www.fred.com]my test[/url] or
 [url=/show.asp?id=333]here[/url]
 #but instead, it is
 [url=http://www.fred.com;my test/a or a
 href=\/show.asp?id=333\]here[/url]
 echo $body;

 Thanks

 - James

 Editor, VB Web
 ==
 Web   - http://www.vbweb.co.uk
 Email - [EMAIL PROTECTED]
 ICQ#  - 60612011
 Fax   - +44(0)8707052859
 ==


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] report generation with PHP

2001-07-17 Thread Philip Murray



 În 17 Jul 2001 19:47:23 +1200 Philip Murray a scris:
  What about using a Windows COM object? There should be one for Access
and if
  not you can use the Word one and generate word documents
 Don't use Words for that... We've had to generate invoices to be
snail-mailed,

I've also done the same thing. Approximately 400 invoices a day all from a
backend administration website. However, we forked out a license to use the
PDF library.

 imagine if the address in the invoiced didn't matched the envelope's
transparent
 area... (don't think a word document can handle 6000 invoices anyway)

Yes, well true. But, the point was there is the facility to use a COM object
instead of some multi-server or java kludge. If you can find a COM object to
do the task (Matt: you talked about using Access for your needs) then
that'll probably be the easiest/fasted solution on Win32 (short of paying
for PDF).

On a side note, is there some Adobe license which prevents people writing
Free for use PDF libraries? Or is it just by chance that the 2 that exist
require you to purchase a license?

Philip Murray


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Regular expressions

2001-07-17 Thread Philip Murray

In Perl you can do this:

$foo =~ tr/012/mpf/;

Which is the same as:

$foo = str_replace(0, m, $foo);
$foo = str_replace(1, p, $foo);
$foo = str_replace(2, f, $foo);

in PHP.

Is there a more elegant way of doing this in PHP? I tried preg_replace but
it didn't seem to like my regexp.

Any ideas?

 -  -- -  -   -
Philip Murray
[EMAIL PROTECTED]
- -  -- -   -


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] does php have a response.flush function

2001-07-15 Thread Philip Murray

Hi  Andrew,

It's flush();

http://nz.php.net/manual/en/function.flush.php

Cheers
 -  -- -  -   -
Philip Murray - [EMAIL PROTECTED] 
http://www.open2view.com - Open2View.com
- -  -- -   -

- Original Message - 
From: Andrew Austin [EMAIL PROTECTED]
To: Php Lists (E-mail) [EMAIL PROTECTED]
Sent: Monday, July 16, 2001 12:40 AM
Subject: [PHP] does php have a response.flush function


 Does php have a funciton like reponse.flush in asp
 
 aa
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] How to force a file download

2001-07-13 Thread Philip Murray

Try sticking in a

Header(Content-Disposition: attachment; filename=\$filename\);

It should work with IE5.5, but it's hard to tell with Internet Explorer as
it changes from version to version.

 -  -- -  -   -
Philip Murray - Senior Systems Engineer
[EMAIL PROTECTED] - Open2View.com
http://www.open2view.com
- -  -- -   -

- Original Message -
From: Santiago Romero [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, July 13, 2001 10:23 PM
Subject: [PHP] How to force a file download



  Hi!

  I have some code that outputs (from a php3 cgi) email attachments
  under horde/IMP webmail. I would like ALL attachment (including
  all understood by web browser mime types) to be SAVED to disk,
  and not opened.

  I tryed to send them as application/octet-stream but Explorer
  does open them (Netscape treats them correctly and asks me
  to save to disk or open them). Under Explorer, if the output of
  clicking on the Download attach link is pure text, it opens
  it directly on the web browser instead of saving it (that's
  what i want! :). On PDFs, it opens acrobat reader, BUT man!,
  I'm passing it application/octet-stream, this should force
  explorer to save it!

  Any idea?
 --
 Santiago Romero
 Departamento de Sistemas
 [EMAIL PROTECTED]

 Av. Primado Reig 189, entlo
 46020 Valencia - Spain
 Telf. (+34) 96 332 12 00
 Fax. (+34) 96 332 12 01
 http://www.servicom2000.com


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] The need for strong typing...

2001-07-12 Thread Philip Murray

If you were writing rigorous financial applications, I would hope you were
doing enough testing and checking that things like that didn't happen in the
first place.

You shouldn't be lazy and rely on the language to correct your mistakes.
Strong typing only gets in the way (w/ PHP at least), especially since input
validation should consist more than just checking the datatype.

Cheers

 -  -- -  -   -
Philip Murray - Senior Systems Engineer
[EMAIL PROTECTED] - Open2View.com
http://www.open2view.com
- -  -- -   -

- Original Message -
From: Dr. Evil [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, July 13, 2001 1:43 PM
Subject: [PHP] The need for strong typing...



 As you know, gases such as oxygen and acetylene are distributed to
 welders in pressurized containers.  As you can guess, it is very
 important to put the right stuff in the right container.  Let's say
 you have a container of acetylene, and you accidentally top it up with
 some pure oxygen.  This is likely to be a life-altering exerpience,
 and not in the New Age chanting-in-a-sweat-lodge sense if you know
 what I mean.

 The naive solution to this problem is to put a big sign up that says,
 Warning: be very careful about which gas you put into which tank.
 I'm sure that was the first approach that was tried when pressurized
 tanks for welding were first developed.  After a few people died by
 putting the O2 in the C2H2 tank, someone came up with a brilliant
 solution: Let's put reverse threads on the O2 tank attachments.  That
 way, the tank, and all the hoses and connectors that go with it, can
 never be attached to a C2H2 tank, because of a physical contraint in
 the connections themselves.  O2 uses left-hand twist and C2H2 uses
 right-hand twist, and so the two will never meet.  No matter how
 asleep, negligent, or incompetent the filling operator is, he'll never
 end up with O2 in the C2H2 tank.  Even the sharpest, most cautious
 tank filler will eventually make a mistake if he does it enough times,
 but never if the threads are reversed.

 Data structure contraints are exactly the same idea.  In my DB I have
 a table for payments.  Every time Alice pays Bob, a row gets added
 to this table, with one of the columns being amount of transfer.  Of
 course, on the PHP side, I put in a check:

 if($amount = 0) { // error condition }

 but, in addition to that, in the database itself, I have

  CONSTRAINT amount  0

 built into the table definition.  That way, no matter what goes wrong
 on the PHP side, Bob will never be able to say, Pay alice -$1mil,
 and find his account $1mil richer.  The value is checked (several
 times) in the PHP side, but the right behavior is built into the data
 structure (table) itself.

 Strong typing is a sort of constraint.  Just like I don't want to be
 using O2 when I think I'm using C2H2, I would like to be sure that
 I've got an INT and not a STRING when I expect an INT.  Saying write
 a bunch of functions to check user input, and don't make any mistakes
 is just like putting up a sign that says, Be very careful to not put
 O2 in the C2H2 tank.  Yeah, if I were perfect, that would be enough,
 but in the real world, when you're dealing with serious things like
 exploding tanks and money, you want some built-in constraints in the
 system.  You want correctness to be enforced at several different,
 independent layers.

 This same design principle applies in many different realms: my
 motorcycle has completely independent front and rear brakes, so even
 if one system fails entirely, I can still stop.  My Glock has three
 independent safety systems (trigger block, firing pin block,
 decocking) which must each be operational for it to fire.  It's just
 good design to have redundant constraints to achieve high reliability
 and safety.  Strong typing is one of those contraints.

 This doesn't mean that PHP should be changed to allow strong typing.
 It may mean though that PHP isn't the right language for rigorous
 applications like financial transactions.


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] ereg parse error problem

2001-07-12 Thread Philip Murray

Hi Lara,

The problem isn't with the if(ereg) line, its the line above.

Put a semi-colon at the end of your $string = ..[snip].. line

Cheers

 -  -- -  -   -
Philip Murray - Senior Systems Engineer
[EMAIL PROTECTED] - Open2View.com
http://www.open2view.com
- -  -- -   -

- Original Message -
From: Lara J. Fabans [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, July 13, 2001 1:59 PM
Subject: [PHP] ereg parse error problem


 Hi, friends,

 I'm receiving a parse error on the if (ereg... )
 lines of this code.  I looked at the online manual and modeled my two
 ereg's after it.
 When I kept getting parse errors, I decided to copy the original from the
 manual into
 my code, and it too received a parse error.

 Can someone please help me resolve this?

 Thank you,

 Lara


 -
 ?php

 $string = lt;a href=quot;http://www.qksrv.net/click-297915-361662quot;
 target=quot;_topquot; gt; lt;img
 src=quot;http://www.123posters.com/images/m-mase01.jpgquot;
 alt=quot;Mase Necklacequot;gt;lt;/agt; lt;img
 src=quot;http://www.qksrv.net/image-297915-361662quot;
 height=quot;1quot; width=quot;1quot; border=quot;0quot;gt;

 if (ereg (([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}), $string, $regs))
 {
  echo $regs[3].$regs[2].$regs[1];
 } else {
  echo Invalid date format: $date;
 }


 if (ereg (img src=quot;(.*)quot;, $string, $regs))
 {
 echo $regs[1];
 } else
 {
 echo nope1;
 }

 if (eregi(a href=quot;(.*)quot;, $string, $regs))
 {
 echo $regs[1];
 } else
 {
 echo nope2;
 }
 ?
 -
 Lara J. Fabans
 Lodestone Software, Inc
 [EMAIL PROTECTED]


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] using image place holders in a database field?

2001-07-10 Thread Philip Murray

This should do it for you

?

$string = Here is a picture ##flowers.jpg## of some flowers;
$string = ereg_replace(##(.+)##, img src=\\\1\, $string);

print($string);
// prints 'Here is a picture img src=flowers.jpg of some flowers'

?

The ##(.+)## parts matches any string with two # at the start and the end,
the img src=\\\1\ part replaces the ##string## with img src=string.
The \\1 is a reference to the string matched with (.+) in the first
parameter. '.+' matches any character 1 or more times.

 -  -- -  -   -
Philip Murray
[EMAIL PROTECTED]
- -  -- -   -

- Original Message -
From: Matthew Delmarter [EMAIL PROTECTED]
To: PHP Mailing List [EMAIL PROTECTED]
Sent: Wednesday, July 11, 2001 3:47 PM
Subject: [PHP] using image place holders in a database field?


 Hi all,

 I want to use image place holders in a mysql field. The field will store a
 newsletter article and I want to include and display an image in the
 article.

 For example I will have:
 the article text ##image_name## some more article text.

 I will use str_replace to replace ##image_name## with the html tag to
 display such as img src='/images/image_name'.

 But - I don't know how to write the str_replace! Can anyone help?

 Also, is there are better way to do this?? Can I have images displayed in
 the middle of text from a field some other way?

 I also cannot seem to find much on using place holders in a field - but I
 can see it's advantages.

 I hope this all makes sense...

 Regards,

 Matthew Delmarter


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] using image place holders in a database field?

2001-07-10 Thread Philip Murray

Oops. That should've been

$string = ereg_replace(##([^#]+)##, img src=\\\1\, $string);


- Original Message -
From: Philip Murray [EMAIL PROTECTED]
To: Matthew Delmarter [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, July 11, 2001 3:57 PM
Subject: Re: [PHP] using image place holders in a database field?


 This should do it for you

 ?

 $string = Here is a picture ##flowers.jpg## of some flowers;
 $string = ereg_replace(##(.+)##, img src=\\\1\, $string);

 print($string);
 // prints 'Here is a picture img src=flowers.jpg of some flowers'

 ?

 The ##(.+)## parts matches any string with two # at the start and the
end,
 the img src=\\\1\ part replaces the ##string## with img
src=string.
 The \\1 is a reference to the string matched with (.+) in the first
 parameter. '.+' matches any character 1 or more times.

  -  -- -  -   -
 Philip Murray
 [EMAIL PROTECTED]
 - -  -- -   -

 - Original Message -
 From: Matthew Delmarter [EMAIL PROTECTED]
 To: PHP Mailing List [EMAIL PROTECTED]
 Sent: Wednesday, July 11, 2001 3:47 PM
 Subject: [PHP] using image place holders in a database field?


  Hi all,
 
  I want to use image place holders in a mysql field. The field will store
a
  newsletter article and I want to include and display an image in the
  article.
 
  For example I will have:
  the article text ##image_name## some more article text.
 
  I will use str_replace to replace ##image_name## with the html tag to
  display such as img src='/images/image_name'.
 
  But - I don't know how to write the str_replace! Can anyone help?
 
  Also, is there are better way to do this?? Can I have images displayed
in
  the middle of text from a field some other way?
 
  I also cannot seem to find much on using place holders in a field - but
I
  can see it's advantages.
 
  I hope this all makes sense...
 
  Regards,
 
  Matthew Delmarter
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] System V Semaphores

2001-04-10 Thread Philip Murray

Hi,

I've been trying to use SystemV Semaphores as a kind of locking system in a
webpage, but after a few hours I get this message:

Warning: semget() failed for key 0x0: No space left on device in
/1/home//admin/htdocs/prop/lock.php on line 8

Warning: 0 is not a SysV semaphore index in
/1/home//admin/htdocs/prop/lock.php on line 19

Couldn't grab lock!

It isn't disk space, and there's plenty of free memory. So how do I fix it
and stop it doing it in the future?

Apart from this it seems to work fine. I've attached some sample code which
is pretty much exactly what I'm doing.


Cheers



? 
class Lock {

var $lock = 1;
var $id;

function Lock() {
$this-id = sem_get($lock);
}

function unLock() {
sem_release($this-id);
return 0;
}

function checkLock() {
if(!sem_acquire($this-id)) {
echo "Couldn't grab lock!";
return -1;
}
return 0;
}

}
?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


Re: [PHP] Creating a gif thumbnail, without the libgd1.6 or earlier version!

2001-03-06 Thread Philip Murray

Try using ImageMagick on the command line via System() or Exec() or
whatever.

http://www.imagemagick.org/

-=--==- -- -  --
Philip Murray
[EMAIL PROTECTED]


- Original Message -
From: "Zenith" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, March 06, 2000 3:12 PM
Subject: [PHP] Creating a gif thumbnail, without the libgd1.6 or earlier
version!


 How to create some thumbnail, from orginally a GIF image, to a GIF
 thumbnail.
 I dun't the libgd 1.6 or before.
 Or can we just use libgd1.8 , open a GIF image, and create a thumbnail
with
 PNG format?



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Problems with pdflib-3.02

2001-03-02 Thread Philip Murray

I have script that generates a pdf width some text and two images in it. One
of the images is just a header and works fine. The other is a photo, now,
this sometimes works and sometimes doesn't.  I can't figure out why.

When the photo doesn't appear I eventually get a box saying something like
"An I/O processing error occured". Sorry, can't remember the exact message,
and as I write this message I can't seem to get it back. Also, when you
print one of the broken PDF's it locks up the browser (works fine on the
non-broken ones).

Here is the script I use to send the generated PDF to the browser:

?

if(file_exists("/path/to/file/photo.gif")) {
$pic = pdf_open_image_file($pdf, "gif", "/path/to/file/photo.gif");
pdf_place_image($pdf, $pic, 38, 450, 1.5);
}





pdf_show_boxed($pdf, "$rcpt_name\n$address\n\nInvoice no:
$invoice_no\nDue Date: $rowdata[duewhen]\n\nNet Price: \$$netprice\nGST:
\$$gst\n\nTotal to pay: \$$total", 380, 10, 200, 150, "right");

pdf_end_page($pdf);
pdf_close($pdf);
fclose($fp);

header( "Content-type: application/x-pdf" );
header( "Content-Disposition: filename=$REMOTE_USER.$id.pdf" );
header( "Content-Description: PDF Format Invoice" );
header("Location: /invoicing/$REMOTE_USER.$id.pdf");

?


Anyhelp would be muchly appreciated.

Cheers

PS, Its all in IE5.x in win98/win2k

Philip Murray
[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]