OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 24 Mar 2005 00:51:57 -0000 Issue 3355

php-general-digest-helplists.php.net
Date: Wed Mar 23 2005 - 18:51:57 CST


php-general Digest 24 Mar 2005 00:51:57 -0000 Issue 3355

Topics (messages 211376 through 211428):

php pattern, software development pattern
        211376 by: symbulos partners
        211383 by: Jason Barnett
        211387 by: symbulos partners

Re: Arrays not recognized in Simple XML Objects (using print_r)
        211377 by: Elizabeth Smith

Re: HTML - to - PDF
        211378 by: Jason Barnett

Re: access violation
        211379 by: Leif Gregory

Re: GIF instead of JPG..
        211380 by: Ryan A
        211381 by: Ryan A
        211382 by: Ryan A
        211428 by: Tom Rogers

Re: Borrowed code- how to give credit
        211384 by: Ryan A
        211409 by: Ryan A

php command
        211385 by: D A GERM
        211386 by: Mikey

executed script URL
        211388 by: news
        211389 by: Jason Barnett

Bug in look-behind assertions in PCRE patterns ?
        211390 by: Ian Thurlbeck
        211391 by: Michael Sims

Re: [semi OT]: Planning projects
        211392 by: Chris W. Parker
        211393 by: Chris W. Parker

Re: die function
        211394 by: Barbara Picci

Fedora-Apache2-PHP exec() failure
        211395 by: Bill Rausch
        211416 by: Rasmus Lerdorf
        211426 by: Bill Rausch

session woes
        211396 by: Mignon Hunter
        211397 by: Stephen Johnson
        211398 by: Jason Barnett

Re: reduce the following code "if ($colorVar == 'Black' || $colorVar == 'Red' || $colorVar == 'White' || $colorVar == 'Blue' ){"
        211399 by: Lupita

mail() Alternative?
        211400 by: Dan Joseph
        211401 by: Chris Boget
        211402 by: Dan Joseph
        211403 by: Guillermo Rauch

Pagination
        211404 by: Marquez Design
        211405 by: John Nichel
        211406 by: John Nichel
        211407 by: Chris W. Parker

Converting to a string
        211408 by: PartyPosters
        211410 by: Chris W. Parker
        211417 by: PartyPosters

Re: session woes[RESOLVED]
        211411 by: Mignon Hunter

Insertion of integer in a database
        211412 by: david joffrin
        211414 by: Joseph Connolly
        211415 by: Chris W. Parker

PHP CVS solution
        211413 by: Christian Calloway
        211422 by: M. Sokolewicz

Sending a Table Via mail
        211418 by: PartyPosters
        211419 by: John Nichel
        211424 by: PartyPosters

session questions
        211420 by: gwang5.ncsu.edu
        211421 by: Jason Barnett

how to write IF statement for login script
        211423 by: Nick
        211425 by: M. Sokolewicz
        211427 by: Nick

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


I looked at php pattern (www.phppatterns.com). I did not understand it well.

Is that supposed to be pattern as in software development pattern? If so why
the uml diagrams are not there?

For example

A sample Strategy pattern for form validation.

What does that mean?

I am confused.
--
symbulos partners
-.-
symbulos - ethical services for your organisation
http://www.symbulos.com

attached mail follows:


Symbulos Partners wrote:
> I looked at php pattern (www.phppatterns.com). I did not understand it well.
>
> Is that supposed to be pattern as in software development pattern? If so why
> the uml diagrams are not there?

They are design patterns for code. But the design patterns there are
more micro than your typical UML (though I suppose you could diagram the
design using UML if you really want).

Think of those patterns as a "blueprint for building a class". While
your problem at hand is unique, there are repeatable solutions
(patterns) that you can use and re-use to solve those unique patterns.
*That* is what design patterns are all about.

>
> For example
>
> A sample Strategy pattern for form validation.
>
> What does that mean?

Form validation is a problem you will have over and over again. The
strategy pattern is a *repeatable solution* to that problem.

So you can use the Strategy pattern to solve your form validation
problem the first time around. Then the next time you need to validate
a form you say "hey, wait a minute, I know how to solve this problem!"
Poof! Light bulbs go on, angels sing and the beer flows like water.

Better yet: if you're careful about the way you design your "Strategy"
class, then you can re-use it for future projects. You become more
efficient because now you have this code base that you can re-use.
Easily. *Hopefully*. ;) It takes a lot of practice to get good at
this and even then you will end up scrapping designs later.

>
> I am confused.

Hopefully you're less confused now.

To summarize: if you have a repeatable problem with a single answer that
you can use to answer that problem then design patterns are "A Good
Thing". In addition, having those classes around will make it easier
for you to get a solution the second, third, etc. time around.

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

attached mail follows:


Thanks for your explanation, it makes things clearer, but I need to work on
it a bit more before saying that is perfectly clear for me.

Are there more pattern repositories available than simply
www.phppatterns.com?
--
symbulos partners
-.-
symbulos - ethical services for your organisation
http://www.symbulos.com

attached mail follows:


Yashesh Bhatia wrote:
> hi! i'm trying to use the simple_xml functions to get an arrray of
> data from a sample xml file.
>
> here's my sample_data.xml
> --------------------------------------------------------------------------------------------
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <sample_data>
> <first_names>
> <first_name>amit</first_name>
> <first_name>amar</first_name>
> </first_names>
> </sample_data>
> --------------------------------------------------------------------------------------------
>
> the php file
> --------------------------------------------------------------------------------------------
>
> <?php
> $sample_data = simplexml_load_file("sample_data.xml");
> print_r($sample_data);
> print_r($sample_data->first_names);
> print_r($sample_data->first_names->first_name);
> ?>
> --------------------------------------------------------------------------------------------
>
> output of "$ php test_xml_1.php"
> --------------------------------------------------------------------------------------------
>
> SimpleXMLElement Object
> (
> [first_names] => SimpleXMLElement Object
> (
> [first_name] => Array
> (
> [0] => amit
> [1] => amar
> )
>
> )
>
> )
> SimpleXMLElement Object
> (
> [first_name] => Array
> (
> [0] => amit
> [1] => amar
> )
>
> )
> SimpleXMLElement Object
> (
> [0] => amit
> )
> --------------------------------------------------------------------------------------------
>
>
> The above output shows $sample_data->first_names->first_name as an
> ARRAY in the first 2 print_r 's however when a print_r is run on
> itself it shows it as a SimpleXMLElementObject.
> Question is why the last print_r gives different information
> compared to the other 2.
>
> I also tried running
> $key = array_rand($sample_data->first_names->first_name)
>
> and it gives a warning message
> "Warning: array_rand(): First argument has to be an array in
> /home/yvb/work/practice/php/XML/foo.php on line 16"
>
> any clue how do i use the
> $sample_data->first_names->first_name as an array ?
>
> thx.
>
> yashesh.
>
>
That's how print_r displays objects and nested objects - try a var_dump
on the item and you'll see that simplexml does NOT return arrays but
instead returns simplexml objects - if you want to use array_rand you
can cast
(http://www.php.net/manual/en/language.types.type-juggling.php#language.types.typecasting)
the object to an array, or check out the user notes on simplexml
http://us2.php.net/manual/en/ref.simplexml.php
to find example functions to change a simplexml object to an array
personally I prefer dom and use a domtoarray function - but YMMV -
please read the simplexml documentation again, it returns objects
(nested ones) NOT arrays

attached mail follows:


Matt Babineau wrote:
> Hi All, I have some reports I need converted from HTML to PDF, I'm on a LAMP
> box, so does anyone have any free suggestions?
>

google fpdf

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

attached mail follows:


Hello Rob,

Tuesday, March 22, 2005, 4:14:55 PM, you wrote:
R> That's interesting - it also started happening for me after
R> installing PHP 5.0.3. But I have reverted to 4.3.10 for now, and I
R> can't see how installing 5.0.3 into an entirely separate directory
R> can break my old php install. Hmm..

R> Incidentally, are you using Pear at all?

No, I'm not doing anything with Pear (just haven't gotten around to
it).

I did the same thing you did, installed into a separate directory and
fixed all the references in the webserver, and have deleted any PHP
4.3 files from the Windows/System folder.

Luckily it doesn't appear to be a big security problem as it only
displays the access violation in the browser window (no paths or
anything). A reboot fixes it until I do something like refreshing POST
data a few times again. Until I get the problem resolved, I don't
refresh POST data anymore on that server.

The frustrating thing is that the "crash" doesn't show up in any logs.
Even the Windows system logs.

I also didn't do any major changes from the default php.ini except to
enable some extensions I needed, set up the SMTP stuff, and that's
really about it.

I am running 5.0.3 on other servers (various web servers and MySQL
versions, but all Windows), and am not experiencing this problem. The
only difference with those servers is that 5.0.3 was installed fresh
(no previous PHP). I'm wondering if I missed one of the extension
files somewhere from 4.3.

--
Leif (TB lists moderator and fellow end user).

Using The Bat! 3.0.9.9 Return (pre-beta) under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB

attached mail follows:


Hey!
Thanks for sharing mate!
I'll run it and get back to you if I have any problems.
Cheers,
Ryan

On 3/22/2005 10:49:42 PM, Andras Kende (andraskende.com) wrote:
> > Hi,
>
> > I found this beautiful piece of code on the php site which make a
>
> > proportional thumbnail, problem is its only working with JPEG files...
> and
>
> > not with GIFs, can someone please help me convert it to GIF too?
>
> >
>
> > I tried but got a bit confused as there are no functions that are equal
> to
>
> > "imagecreatetruecolor" that is in the below script.
>
> > The below script works perfectly for jpgs:
>
> >
>
> >
>
> > <?php
>
> > // The file
>
> > $filename = 'test.jpg';
>
> >
>
> > // Set a maximum height and width
>
> > $width = 200;
>
> > $height = 200;
>
> >
>
> > // Content type
>
> > header('Content-type: image/jpeg');
>
> >
>
> > // Get new dimensions
>
> > list($width_orig, $height_orig) = getimagesize($filename);
>
> >
>
> > if ($width && ($width_orig < $height_orig)) {
>
> > $width = ($height / $height_orig) * $width_orig;
>
> > } else {
>
> > $height = ($width / $width_orig) * $height_orig;
>
> >

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005

attached mail follows:


Hey!
Thanks for replying.

I started out to do exactly that: changeing everything from JPEG to GIF, but
I also wanted to know what exactly i was doing so i started to read the
manual for each function that i was using and i got a bit stumped when i
came to "imagecreatetruecolor" as its only for JPEG...hence the confusion.

My server supports GIF and i've been reading up on the image manipulation
parts of the manual...lets see how it goes :-)

Cheers,
Ryan

On 3/22/2005 8:44:39 PM, Mike (phpcrazyted.com) wrote:
> > Hi,
>
> > I found this beautiful piece of code on the php site which
>
> > make a proportional thumbnail, problem is its only working
>
> > with JPEG files...and not with GIFs, can someone please help
>
> > me convert it to GIF too?
>
> >
>
>
>
> If your version of GD supports GIFs (which not all do), then
> it's almost as
> simple as changing every place you see the string "jpeg" to "gif".
>
> Look in the online manual for the image functions. You'll
> see reference to
>
> the ones here (such as imagecreatfromjpeg()) and also ones for PNGs and
> GIFs
>
> and a few others.
>
>
>
> Just realize that when you are reading a file of a particular type, you
> need
>
> to use those image<type>() functions... But in most cases they are
>
> completely interchangable if
> you're passing paths to images of the
> appropriate type.
>
> Hope all of that makes sense :)
>
> -M
>
>
> > I tried but got a bit confused as there are no functions that
> > are equal to "imagecreatetruecolor" that is in the below script.
> > The below script works perfectly for jpgs:
> >
>

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005

attached mail follows:


Hey,
Thanks for replying.

The best part of your reply was:

"Or, you could even use http://php.net/imagegetsize and IGNORE the
filename, and base your decision on what's actually *IN* the file, so when
some idiot renames a jpeg to ".gif" because they think that will make it a
GIF (yes, that really happens)"

hehe, made my day as I just got up :-D

Cheers,
Ryan

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005

attached mail follows:


Hi,

Wednesday, March 23, 2005, 11:30:53 PM, you wrote:
RA> Hi,
RA> I found this beautiful piece of code on the php site which make a
RA> proportional thumbnail, problem is its only working with JPEG files...and
RA> not with GIFs, can someone please help me convert it to GIF too?

RA> I tried but got a bit confused as there are no functions that are equal to
RA> "imagecreatetruecolor" that is in the below script.
RA> The below script works perfectly for jpgs:

Here is a function I use for scaling that you can use as an example,it
also handles transparent gifs.

You can set $x or $y leaving the other at 0 to maintain aspect ratio
or set both to force a fixed box.

function Scale($input,$out,$x,$y){
  $info = getimagesize($input);
  $width = $info[0];
  $height = $info[1];
  $colors = array();
  if($width > 0 && $height > 0){
    if($x > 0){
      $w2 = $x;
      if($width > $w2){
        $scale = $width/$w2;
        $h2 = intval($height/$scale);
      }else{
        $scale = $w2/$width;
        $h2 = intval($height * $scale);
      }
    }elseif($y > 0){
      $h2 = $y;
      if($height > $h2){
        $scale = $height/$h2;
        $w2 = intval($width/$scale);
      }else{
        $scale = $sw2/$height;
        $w2 = intval($width * $scale);
      }
    }
    switch($info[2]){
      case 1:
        $im = ImageCreateFromGif($input);
        $t = ImageColorTransparent($im);
        $itype = "gif";
        if($t != -1){
         $colors = imagecolorsforindex($im, $t);
        }
        $im2 = ImageCreate($w2,$h2);
      break;
      case 2:
        $itype = "jpeg";
        $im = ImageCreateFromJpeg($input);
        $im2 = ImageCreateTrueColor($w2,$h2);
      break;
      case 3:
        $itype = "png";
        $im = ImageCreateFromPng($input);
        $t = ImageColorTransparent($im);
        if($t != -1){
          $colors = imagecolorsforindex($im, $t);
        }
        $im2 = ImageCreateTrueColor($w2,$h2);
      break;
      default:
        return;
      break;
    }
    if(count($colors) > 0){
      $transp = ImageColorAllocate($im2, $colors["red"],$colors["green"], $colors["blue"]);
    }
    imagecopyresampled($im2, $im, 0, 0, 0, 0, $w2, $h2, $width, $height);
    if(count($colors) > 0){
      ImageColorTransparent($im2,$transp);
    }
    if(eregi("\.gif$",$out)){
      ImageGif($im2,$out);
    }elseif(eregi("\.jpe?g",$out)){
      ImageJpeg($im2,$out,90);
    }elseif(eregi("\.png$",$out)){
      ImagePng($im2,$out,20);
    }
  }
}

--
regards,
Tom

attached mail follows:


Well, if your code is open source or you are distributing the code add a
comment right on top of the file like this
/*
This line's : code here
original author was, and I am very greatful to this person for writing this
beautiful piece of code that i am useing
*/

maybe? :-)

Cheers,
Ryan

On 3/22/2005 9:47:36 PM, ceol-i-e.com wrote:
> On Tue, March 22, 2005 4:54 pm, C Drozdowski said:
>
> > I used a single line of code (ver batim) from a pear class in my own
>
> > code. I try to always be honest and not steal code but this single line
>
> > does exactly what I need. The code is for a NPO website and will never
>
> > be sold or anything like that.
>
> >
>
> > How should I give credit for the line of code in my own code?
>

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005

attached mail follows:


> And if you make money from it, send them some money for the effort.
>
yep, money would really tell the author you appreciate his contribution /
what he thought of.

:-)

-Ryan

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005

attached mail follows:


is there a command that will allow me to connect to another box and
execute commands?

for instance, I want to create an automated php script that will connect
to a unix box and run a series of commands. I believe that ssh2_exec()
and ssh2_shell() are not supported in the 4.3.4 version of php I am
running.

I thought of exec(); i could telnet in to the box but I didn't know if
another exec() statement would pass the aurguments to the original
telnet session set up in a previous exec() statement.

attached mail follows:


I think what you need to do is look at the sockets section of the manual.

Regards,

Mikey

> -----Original Message-----
> From: D A GERM [mailto:dgermshepherd.edu]
> Sent: 23 March 2005 14:46
> To: php-generallists.php.net
> Subject: [PHP] php command
>
> is there a command that will allow me to connect to another
> box and execute commands?
>
> for instance, I want to create an automated php script that
> will connect to a unix box and run a series of commands. I
> believe that ssh2_exec() and ssh2_shell() are not supported
> in the 4.3.4 version of php I am running.
>
> I thought of exec(); i could telnet in to the box but I
> didn't know if another exec() statement would pass the
> aurguments to the original telnet session set up in a
> previous exec() statement.
>
> --
> PHP General Mailing List (http://www.php.net/) To
> unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


I'm firt time here so hello everybody

I have some skill in php coding so don't worry, I will no boring
with stupid question.

Due to I'm unable to test my app on all http servers with all configs
I need to know is it possible to get from PHP engine information about
executed script URL (not file system path).

Now what I'm investigated

It's began since I cannot use relative path for Location header on IIS servers. It must
contains URI.

I cannot build the URL with $_SERVER['PHP_SELF'] because it not always
returns relative to server path (due to server configuration it
sometimes returns full URL)

building URL using method described in documentation comments:
$_SERVER['SERVER_NAME'] + $_SERVER['SCRIPT_NAME'] is good until the
system is started with embeded php. If php runs as cgi,
$_SERVER['SCRIPT_NAME'] returns path co cgi.exe

$_SERVER['SCRIPT_FILENAME'] and $_SERVER['PATH_TRANSLATED'] are
filesystem based variables, and are useless because we still have no
information about URL path related to server base URL.

So, is it possible to get this URL automaticly, or I will have add
variable with fixed URL into config file of system I'm working on.

best regards
--
*** Media-IT Micha³ Ko¿usznik ***
*** IT networks - databases - multimedia ***
*** maxymmedia-it.net ***
*** http://www.media-it.net ***

attached mail follows:


Rasmus answered this question a week or two ago. Search the archives
for 'getenv request' and you will likely find the answer.

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

attached mail follows:


Dear All

Is this a bug ?

I'm using look-behind assertions within preg_match()
to ignore certain combinations of patterns. E.g. from
ref. manual is: (?<!foo)bar matches "bar" but only
if it's not preceded by "foo".

Here's my test script:
----------------
$line = '$res = foobar("ddd", "dfdf");';
if (preg_match("/(?<!foo)(bar)/", $line, $matches)) {
         echo "Should NOT match foobar, but found: ".$matches[1];
}

$line = '$res = $bar("ddd", "dfdf");';
if (preg_match("/(?<!\$)(bar)/", $line, $matches)) {
         echo "Should NOT match \$bar, but found: ".$matches[1];
}
----------------

In the first preg_match() is correctly ignores the foobar
function name. However the second preg_match() does NOT
ignore the $bar as I expected.

I converted this to Perl and it correctly ignores both!

Is this a bug, or am I missing something ?

using PHP-4.3.10 + apache 1.3.33 + fc 1

Many thanks

Ian
--
Ian Thurlbeck http://www.stams.strath.ac.uk/
Statistics and Modelling Science, University of Strathclyde
Livingstone Tower, 26 Richmond Street, Glasgow, UK, G1 1XH
Tel: +44 (0)141 548 3667 Fax: +44 (0)141 552 2079

attached mail follows:


Ian Thurlbeck wrote:
> Dear All
>
> Is this a bug ?
[...]
> $line = '$res = $bar("ddd", "dfdf");';
> if (preg_match("/(?<!\$)(bar)/", $line, $matches)) {
> echo "Should NOT match \$bar, but found: ".$matches[1];
> }
> ----------------
>
> In the first preg_match() is correctly ignores the foobar
> function name. However the second preg_match() does NOT
> ignore the $bar as I expected.

This is a quoting issue. Above you are using double quotes, which interpolates
embedded PHP variables. Therefore if you want a literal "$" inside a double-quoted
string you have to escape it, as you have done. However, the "$" character is ALSO
a preg metacharacter (matches end of line). This means that you must also escape it
for the preg parser as well, so you need to escape it twice, by putting another
literal backslash behind it:

if (preg_match("/(?<!\\\$)(bar)/", $line, $matches)) {

Either that or you can use single quotes instead of double quotes:

if (preg_match('/(?<!\$)(bar)/', $line, $matches)) {

Either one will work.

HTH

attached mail follows:


Richard Lynch <mailto:ceol-i-e.com>
    on Tuesday, March 22, 2005 10:31 PM said:

> Personally, I'd opt for working on the macro first, and making that as
> clean and clear as you can, really thinking deeply on it.
>
> Put it away for a day or two and pull it out.
>
> Does it all still make sense?

Ok, I can try this. Sounds good.

> It's much too easy (guilty!) to start diving in and writing
> code/functions/pages without reflecting enough on the big picture.

Yes, and this is what I am trying to avoid.

> Course, you sometimes have the PHB breathing down your neck who will
> accuse you of "not working" if you aren't typing code. Sigh. Time to
> quit *that* job and look for another one.
>
> PS I'm looking for a new job. :-^

Good luck.

Chris.

attached mail follows:


Burhan Khalid <mailto:phplistmeidomus.com>
    on Tuesday, March 22, 2005 10:56 PM said:

> One approach that I liked (I forgot what book it was mentioned in)
> involves using a whiteboard and post-it notes.
>
> You put your entities on the post it notes, then draw flow lines on
> the whiteboard. This way, you can easily move your entities around.

Yeah that might work out pretty well. I found a free mind mapping
program on www.lifehacker.com called FreeMind (found on 2nd page today).
I've yet to try it out (dang thing is only dl'ing at 3.5Kb) but it looks
promising. Anyway, my experiences in the past with mind mapping have
been pretty good so that might play into your post-it notes idea pretty
well.

Chris.

attached mail follows:


Hi all,

just to give you another solution that I've successfully adopted:

function die_script($errmsg)
{
$sendto = "xxxxxxxx.it";
              $from = "noreplyxxxxx.com";
              $subject = "FAILED";
              $message = "CONNECTION FAILED\nTYPE OF ERROR:\n" . mysql_error();
              $message .="\n\n";
              $headers = "From: $from\r\n";
              mail($sendto, $subject, $message, $headers);
             
   print $errmsg . "</body></html>";
   die;
  }
$connessione = mysql_connect ("192.168.168.1","user","password") or
die(die_script($errmsg));
mysql_select_db ("dbnamei");

Thanks for your help
Regards
Barbara

>Barbara Picci wrote:
>> Hi all,
>>
>> I have a machine that must insert in cron in a mysql db in another
>> remote machine.
>> The problem is that I cannot know if the connection in the first machine
>> (adsl) go down because no entry in the machine log is generated. I would
>> like to redirect the die function in a e-mail that say me what happens.
>
>I think the way you want to solve this problem is to create a customized
>error handler. Check out this link:
>
>http://php.net/manual/en/function.set-error-handler.php
>
><?php
>
>function email_error_handler($level, $msg, $file, $line) {
> switch ($level) {
> /** E_ERROR, E_USER_ERROR, etc. */
> mail_to_admin("$level: $msg in $file on line $line");
> }
>}
>
>function mail_to_admin($msg) {
> /** stuff */
>}
>
>?>
>
>--
>Teach a man to fish...
>
>NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
>STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
>STFM | http://php.net/manual/en/index.php
>STFW | http://www.google.com/search?q=php
>LAZY |
>http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
>
>Content-Type: application/pgp-signature; name="signature.asc"
>Content-Description: OpenPGP digital signature
>Content-Disposition: attachment; filename="signature.asc"
>
>Attachment converted: Barbara OS9:signature 276.asc (????/----) (000B65CD)

--
------------------------
Barbara Picci
Micro srl
viale Marconi 222, 09131 Cagliari - tel. (+39) 070400240
http://www.microsrl.com

attached mail follows:


Hi all,

I'm having the same problem as Jim Poserina. Richard pointed out some
things to try. Here's my story.

We installed Fedora 3 on a new box. Then we installed Apache 2 and
PHP 4.3.9 from the RPMs that came on the CDs. Pretty much everything
works as expected, except the exec() functions do not work in the web
server. There is no error message displayed in the browser or in the
error_log of apache. Here's the script:

<?php
$x = exec("/bin/pwd", $y, $z);
echo "<br>x is "; var_dump( $x );
echo "<br>y is "; var_dump( $y );
echo "<br>z is "; var_dump( $z );
?>

Here is the output:

x is string(0) ""
y is array(0) { }
z is int(127)

If I run the php interpreter from the command line, exec() does work
ok. I can turn safe mode on and define a safe_mode_exec_dir and copy
/bin/pwd to it and then run that and the command line interpreter
honors that setting ok. The web page result doesn't change though. No
error message, no output. Just the 127 (-1?)

So, what do I have to change in my setup to get the exec functions to
work in the web server?

Thanks,

Bill Rausch

attached mail follows:


Bill Rausch wrote:
> Hi all,
>
> I'm having the same problem as Jim Poserina. Richard pointed out some
> things to try. Here's my story.
>
> We installed Fedora 3 on a new box. Then we installed Apache 2 and PHP
> 4.3.9 from the RPMs that came on the CDs. Pretty much everything works
> as expected, except the exec() functions do not work in the web server.
> There is no error message displayed in the browser or in the error_log
> of apache. Here's the script:
>
> <?php
> $x = exec("/bin/pwd", $y, $z);
> echo "<br>x is "; var_dump( $x );
> echo "<br>y is "; var_dump( $y );
> echo "<br>z is "; var_dump( $z );
> ?>
>
> Here is the output:
>
> x is string(0) ""
> y is array(0) { }
> z is int(127)
>
> If I run the php interpreter from the command line, exec() does work ok.
> I can turn safe mode on and define a safe_mode_exec_dir and copy
> /bin/pwd to it and then run that and the command line interpreter honors
> that setting ok. The web page result doesn't change though. No error
> message, no output. Just the 127 (-1?)
>
> So, what do I have to change in my setup to get the exec functions to
> work in the web server?

My guess it that it is an selinux issue. That stuff is such a mess in
Fedora. Try playing with that.

-Rasmus

attached mail follows:


At 13:22 -0800 3/23/05, Rasmus Lerdorf wrote:
>Bill Rausch wrote:
>>Hi all,
>>
>>I'm having the same problem as Jim Poserina. Richard pointed out
>>some things to try. Here's my story.
>>
>>We installed Fedora 3 on a new box. Then we installed Apache 2 and
>>PHP 4.3.9 from the RPMs that came on the CDs. Pretty much
>>everything works as expected, except the exec() functions do not
>>work in the web server. There is no error message displayed in the
>>browser or in the error_log of apache. So, what do I have to change
>>in my setup to get the exec functions to work in ...
>
>My guess it that it is an selinux issue. That stuff is such a mess
>in Fedora. Try playing with that.
>
>-Rasmus

Bingo. I'd told my staff NOT to install the Selinux stuff so I never
bothered looking for it because I knew it wasn't there. :(

Thank you very much.

Bill

attached mail follows:


I had my script working beautifully on my box but when transferring to dev server no such luck

Because we have an older version of php on the webservers, I had to get my admin to change the php.ini on the
session.use_trans_id = 1
so that the SID wouldnt show in the URL. But I'm not sure if that's what is causing my problem now.

It seems I'm not able to transfer and use session data from one page to another. I registerd and stored my var in a session variable and can see it on sess_downloads_p2 but then I loose it on p3.

I'm also getting

[23-Mar-2005 09:04:47] PHP Warning: Cannot send session cookie - headers already sent by (output started at /var/www/htdocs/sess_downloads_p2.php:5) in /var/www/htdocs/sess_downloads_p2.php on line 60
[23-Mar-2005 09:04:47] PHP Warning: Cannot send session cache limiter - headers already sent (output started at /var/www/htdocs/sess_downloads_p2.php:5) in /var/www/htdocs/sess_downloads_p2.php on line 60

where line 60 is my session_start();

I'm kinda clueless as to what to try next.

Thanks for any ideas

attached mail follows:


You need to make sure that output_buffering is turned on in your php.ini
file on the dev server.

<?php
/*

Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
stephenthelonecoder.com

562.924.4454 (office)
562.924.4075 (fax)

continuing the struggle against bad code

*/
?>

> From: "Mignon Hunter" <mignon.huntertic.toshiba.com>
> Date: Wed, 23 Mar 2005 11:20:24 -0600
> To: <php-generallists.php.net>
> Subject: [PHP] session woes
>
> I had my script working beautifully on my box but when transferring to dev
> server no such luck
>
> Because we have an older version of php on the webservers, I had to get my
> admin to change the php.ini on the
> session.use_trans_id = 1
> so that the SID wouldnt show in the URL. But I'm not sure if that's what is
> causing my problem now.
>
> It seems I'm not able to transfer and use session data from one page to
> another. I registerd and stored my var in a session variable and can see it on
> sess_downloads_p2 but then I loose it on p3.
>
> I'm also getting
>
> [23-Mar-2005 09:04:47] PHP Warning: Cannot send session cookie - headers
> already sent by (output started at /var/www/htdocs/sess_downloads_p2.php:5) in
> /var/www/htdocs/sess_downloads_p2.php on line 60
> [23-Mar-2005 09:04:47] PHP Warning: Cannot send session cache limiter -
> headers already sent (output started at
> /var/www/htdocs/sess_downloads_p2.php:5) in
> /var/www/htdocs/sess_downloads_p2.php on line 60
>
> where line 60 is my session_start();
>
> I'm kinda clueless as to what to try next.
>
> Thanks for any ideas
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Mignon Hunter wrote:
...
> [23-Mar-2005 09:04:47] PHP Warning: Cannot send session cookie - headers already sent by (output started at /var/www/htdocs/sess_downloads_p2.php:5) in /var/www/htdocs/sess_downloads_p2.php on line 60
> [23-Mar-2005 09:04:47] PHP Warning: Cannot send session cache limiter - headers already sent (output started at /var/www/htdocs/sess_downloads_p2.php:5) in /var/www/htdocs/sess_downloads_p2.php on line 60

Your script has output on line 5. (it's possible that this is
whitespace character(s) as those count as output as well).

<mr_obvious>You currently are trying to send headers after you already
sent output. This is a problem because PHP thought it already sent all
of the headers, but oops, it didn't!</mr_obvious>

If the output buffering answer doesn't work for you then you should go
back to line 5 and verify / eliminate the output that is produced on
that line.

Or you can move the session_start() and / or other functions that are
sending headers before output on line 5. There's more than one way to
skin this cat.

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

attached mail follows:


Thank You that did it.
"Lupita" <lupitalanset.com> wrote in message
news:20050323085439.32609.qmaillists.php.net...
> Hello;
> Can any one show me a way to reduce the following code?
> ######################################################
> <?php
> if ($colorVar == 'Black' || $colorVar == 'Red' || $colorVar == 'White' ||
> $colorVar == 'Blue' ){
> $someVar = "Something";
> }
> ?>
> ########################################################
> I was thinking there must be a way to place all the Colors into a
> $allColorVar and check to see if $colorVar = $allColorVar?

attached mail follows:


Hi All,

I've had a production system moved to a new server. Our geniuses here
have refused to allow sendmail on the server and all my e-mail
functions are now gone. Is there a way around this? I have already
checked the manual, I don't see anything....

--
-Dan Joseph

"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."

attached mail follows:


> I've had a production system moved to a new server. Our geniuses here
> have refused to allow sendmail on the server and all my e-mail
> functions are now gone. Is there a way around this? I have already
> checked the manual, I don't see anything....

You can always look into utilizing PEAR::Mail. Once implemented, tt makes
it very easy to switch how you send email out. I recently had to do that
and
it was as easy as doing a global search and replace.

thnx,
Chris

attached mail follows:


> You can always look into utilizing PEAR::Mail. Once implemented, tt makes
> it very easy to switch how you send email out. I recently had to do that
> and
> it was as easy as doing a global search and replace.

Oh ok. I will look into Pear, thank you Chris!

--
-Dan Joseph

"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."

attached mail follows:


Another way is the famous phpmailer() class.

attached mail follows:


Hello all,

I am wanting to paginate records from a MySQL Database.
I want there to be 5 records on a page, on multiple pages.

Can someone point me in the right direction or show me a way to do this?

I can get five records on a page with a LIMIT statement, however, I can not
get it to show the first five, then put a "next" link to the next 5 and so
on.

(I would like there to be a "next" and "previous.")

Thank you for any help.

--
Steve

attached mail follows:


Marquez Design wrote:
> Hello all,
>
> I am wanting to paginate records from a MySQL Database.
> I want there to be 5 records on a page, on multiple pages.
>
> Can someone point me in the right direction or show me a way to do this?
>
> I can get five records on a page with a LIMIT statement, however, I can not
> get it to show the first five, then put a "next" link to the next 5 and so
> on.
>
> (I would like there to be a "next" and "previous.")

Your next and previous buttons either need to pass where they left off
in the db (either in the query string or by means of a form post), so
that your script will know where to start from.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


Please send replies to the list.

Martin.C.Austinsupervalu.com wrote:
>
> I've been working on this same project for one of my pages, and it seems
> relatively straight forward if you are just using a full set of records
> to paginate, but if you are using a filtered set (or search results)
> then it becomes a bit more tircky to ascertain where in the search
> results you are. I'm still working on that, and reading this thread
> intently.
>
> Thanks,
> */
> Martin Austin
> /*
>
>
> *John Nichel <johnkegworks.com>*
>
> Marquez Design wrote:
> > Hello all,
> >
> > I am wanting to paginate records from a MySQL Database.
> > I want there to be 5 records on a page, on multiple pages.
> >
> > Can someone point me in the right direction or show me a way to do this?
> >
> > I can get five records on a page with a LIMIT statement, however, I
> can not
> > get it to show the first five, then put a "next" link to the next 5
> and so
> > on.
> >
> > (I would like there to be a "next" and "previous.")
>
> Your next and previous buttons either need to pass where they left off
> in the db (either in the query string or by means of a form post), so
> that your script will know where to start from.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


Marquez Design <mailto:smarquezmarquez-design.com>
    on Wednesday, March 23, 2005 12:19 PM said:

> I am wanting to paginate records from a MySQL Database.
> I want there to be 5 records on a page, on multiple pages.
>
> Can someone point me in the right direction or show me a way to do
> this?
>
> I can get five records on a page with a LIMIT statement, however, I
> can not get it to show the first five, then put a "next" link to the
> next 5 and so on.

Since you're already using limit you're doing better than most.

At this point you can do one of two things:

1. When the search is first executed get a count of all available
records and display only the ones you want on your page. On each
subsequent page (next/previous) return, using the LIMIT clause, only
those records you need.

With this technique you'll be able to show the user how many total pages
there are instead of the using guessing as to when they'll reach the end
of their search results. If you don't have a lot of results you might
not care to go this route.

One requirement with this option is that you must pass the total number
of records during each next/previous page transition. This is to tell
the page that you've already done the initial look up.

2. Use the LIMIT clause to return only the records you need.

This is what you seem to be doing already. The only other piece to your
puzzle is to send the starting point for the LIMIT clause on each page
change.

For the first page you probably had "SELECT ... FROM ... LIMIT 0,5".
Considering we're on the first page the "previous" link will not be
clickable since we can't go back any further. However, the "next" link
will pass the value 5 to the page so that the limit clause knows to
start at record 5 on the next pass. i.e. "SELECT ... FROM ... LIMIT
5,5".

So...

Page 0:

previous
<a href="page.php?start=5">next</a>

Page 1:

<a href="page.php?start=0">previous</a>
<a href="page.php?start=10">next</a>

Page 2:

<a href="page.php?start=5">previous</a>
<a href="page.php?start=15">next</a>

etc.

Of course, you'll need to pass all your search criteria (and any other
data you need) within each link as well.

HTH!
Chris.

attached mail follows:


Hello guys,
i am using date("l dS of F Y h:i:s A") and want to put the value in a database as a string,
How do I converting it to a string, this is what I have got so far:-
$v_ship_date = date("l dS of F Y h:i:s A");

Lots of thanks.

  ----- Original Message -----
  From: PartyPosters
  To: php-generallists.php.net
  Sent: Tuesday, March 22, 2005 10:01 PM
  Subject: Passing Arrays between pages

  Hello,
  Please can someone tell me how you pass arrays between PHP pages.
  I have tried something like this and have tried many variations of this but
  nothing working yet ;

  Page 1
  $testArray[0] =Apple;
  $testArray[1] =Banana;
  $testArray[2] =Peach;

  echo "<INPUT NAME = \"kcompany[]\" TYPE = \"hidden\" VALUE=\"$testArray\">";

  Page2
  echo $testArray[1];

  On different variations of this I keep on getting 'Array' when I to return the variable on the second page

  Many Thanks.
  Kaan.

attached mail follows:


MIME-Version: 1.0
Content-Type: text/plain;
        charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Date: Wed, 23 Mar 2005 12:55:37 -0800
Message-ID: <97FD54B5E57A1842AA1A4B232E4761170B320Bati-ex-02.ati.local>
From: "Chris W. Parker" <cparkerswatgear.com>
To: "PartyPosters" <salespartyposters.co.uk>,
        <php-generallists.php.net>
Subject: RE: [PHP] Converting to a string

PartyPosters <mailto:salespartyposters.co.uk>
    on Wednesday, March 23, 2005 12:44 PM said:

> i am using date("l dS of F Y h:i:s A") and want to put the value in
> a database as a string, How do I converting it to a string, this is
> what I have got so far:- $v_ship_date = date("l dS of F Y h:i:s A");

That's pretty much all you need. Just make sure you enclose the data
you're passing to the database in the proper quotes (either ' or ",
depending on your needs).

INSERT INTO table (v_ship_date)
VALUES ('$v_ship_date');

Chris.

p.s. For clarity, it's best to start a completely new email to start a
new thread instead of replying to an already established thread.

attached mail follows:


Thanks guys, you were right - I needed to change the format of the field in
the database.

:D

----- Original Message -----
From: "Daniel Gerzo" <dangerrulez.sk>
To: "PartyPosters" <salespartyposters.co.uk>; <php-generallists.php.net>
Sent: Wednesday, March 23, 2005 8:58 PM
Subject: Re: [PHP] Converting to a string

Hello PartyPosters,

Wednesday, March 23, 2005, 9:43:30 PM, si odoslal:

> Hello guys,
> i am using date("l dS of F Y h:i:s A") and want to put the value in a
database as a string,
> How do I converting it to a string, this is what I have got so far:-
> $v_ship_date = date("l dS of F Y h:i:s A");

  well, php doesn't really cares if you got string or bool or integer
  like c or pascal does. php is converting automatically integers to
  strings and so far, you can add your value to the database whithout
  any manual converting...

> Lots of thanks.

--
Later

+----------==/\/\==----------+ (__) FreeBSD
| DanGer <dangerrulez.sk> | \\\'',) The
| DanGerIRCnet ICQ261701668 | \/ \ ^ Power
| http://danger.rulez.sk | .\._/_) To
+----------==\/\/==----------+ Serve

[ Ved evidenciu o svojich udajoch, je to dokaz tvojej prace. ]

attached mail follows:


Bingo

ya know I knew that about the headers but it threw me since it worked on my box perfectly no matter where I put the session_start();

Lo and behold I check out the php.ini on my box and there it was:
output buffering=4096

I did not know about the output buffering. BUT I just moved my session_start(); to the very tip top in we're in ship shape. Sorry for all the strange sayings

Thanks so much to Jason, Stephen and John

Ciao

>>> Stephen Johnson <maillistspets4u.com> 03/23/05 11:30AM >>>
You need to make sure that output_buffering is turned on in your php.ini
file on the dev server.

<?php
/*

Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
stephenthelonecoder.com

562.924.4454 (office)
562.924.4075 (fax)

continuing the struggle against bad code

*/
?>

> From: "Mignon Hunter" <mignon.huntertic.toshiba.com>
> Date: Wed, 23 Mar 2005 11:20:24 -0600
> To: <php-generallists.php.net>
> Subject: [PHP] session woes
>
> I had my script working beautifully on my box but when transferring to dev
> server no such luck
>
> Because we have an older version of php on the webservers, I had to get my
> admin to change the php.ini on the
> session.use_trans_id = 1
> so that the SID wouldnt show in the URL. But I'm not sure if that's what is
> causing my problem now.
>
> It seems I'm not able to transfer and use session data from one page to
> another. I registerd and stored my var in a session variable and can see it on
> sess_downloads_p2 but then I loose it on p3.
>
> I'm also getting
>
> [23-Mar-2005 09:04:47] PHP Warning: Cannot send session cookie - headers
> already sent by (output started at /var/www/htdocs/sess_downloads_p2.php:5) in
> /var/www/htdocs/sess_downloads_p2.php on line 60
> [23-Mar-2005 09:04:47] PHP Warning: Cannot send session cache limiter -
> headers already sent (output started at
> /var/www/htdocs/sess_downloads_p2.php:5) in
> /var/www/htdocs/sess_downloads_p2.php on line 60
>
> where line 60 is my session_start();
>
> I'm kinda clueless as to what to try next.
>
> Thanks for any ideas
>
> --
> 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

attached mail follows:


Hi folks,

Problem is fairly simple, but how can I insert integer in an SQL statement?

So, I only had strings, but now I have introduced a timestamp column (bigint
to cover the milleseconds), and I have the following statement:
$queryInsert = "INSERT INTO mytables (..., timestamp) VALUES ('";
$queryInsert .= ...; // several columns
$queryInsert .= "', '";
$queryInsert .= time() . "')";
$result = mysql_query($queryInsert);

This is not working as time() returns an integer and .= only works with
strings!

How can I cope with that?

Thanks.
DvJ

attached mail follows:


I don't think the integer is the problem, but if it is you can turn
time() into a variable and then,

$time = time();

david joffrin wrote:

> Hi folks,
>
> Problem is fairly simple, but how can I insert integer in an SQL
> statement?
>
> So, I only had strings, but now I have introduced a timestamp column
> (bigint to cover the milleseconds), and I have the following statement:
> $queryInsert = "INSERT INTO mytables (..., timestamp) VALUES ('";
> $queryInsert .= ...; // several columns
> $queryInsert .= "', '";
> $queryInsert .= time() . "')";
> $result = mysql_query($queryInsert);
>
> This is not working as time() returns an integer and .= only works
> with strings!
>
> How can I cope with that?
>
> Thanks.
> DvJ
>

attached mail follows:


david joffrin <mailto:david_joffrinhotmail.com>
    on Wednesday, March 23, 2005 1:01 PM said:

> So, I only had strings, but now I have introduced a timestamp column
> (bigint to cover the milleseconds)

Why not use VARCHAR instead? Timestamp doesn't need to be numeric does
it? For sure it's not required to be numeric.

> and I have the following statement:
> $queryInsert = "INSERT INTO mytables (..., timestamp)
> VALUES ('"; $queryInsert .= ...; // several columns
> $queryInsert .= "', '";
> $queryInsert .= time() . "')";
> $result = mysql_query($queryInsert);

May I suggest the following?

<?php

$timestamp = time();

$queryInsert = <<<QQQ
INSERT INTO mytables
    (columnA
    , columnB
    , ...
    , timestamp)
VALUES
    ('$valueA'
    , '$valueB'
    , ...
    , $timestamp)

QQQ;

?>

HTH,
Chris.

attached mail follows:


Hiya guys,

I need some type of extremely simple (yet intuitive) CVS solution, preferbly
written in PHP. Namely I want to allow fairly unsavvy computer users (lets
say my mom for example) to checkout files of interest, located on some
server, via a web-interface and PHP\MySQL backbone. I really don't want to
write this myself, does anyone have any suggestions. Thanks in advance,

Christian

attached mail follows:


Christian Calloway wrote:
> Hiya guys,
>
> I need some type of extremely simple (yet intuitive) CVS solution, preferbly
> written in PHP. Namely I want to allow fairly unsavvy computer users (lets
> say my mom for example) to checkout files of interest, located on some
> server, via a web-interface and PHP\MySQL backbone. I really don't want to
> write this myself, does anyone have any suggestions. Thanks in advance,
>
> Christian
Horde's Chora. It's not simple to install, nor is it written in a pretty
way, but it works.
www.horde.org/chora

cvs.php.net uses the same.
- tul

attached mail follows:


Hello is there any way I can send a table (or just tabulated data) via email.
I've tried this but comes up with an error.
$to = myemailaddress.com;

$re = "Test Email from system";

$msg = "<TABLE BORDER=\"2\"><TR>hello</TR></TABLE>"

mail($to, $re, $msg);

Thanks in advance.

attached mail follows:


Message-ID: <4241E1B5.2050404kegworks.com>
Date: Wed, 23 Mar 2005 16:37:57 -0500
From: John Nichel <johnkegworks.com>
MIME-Version: 1.0
To: php-generallists.php.net
Content-Type: text/plain; charset=ISO-8859-1; formatowed
Content-Transfer-Encoding: 8bit
Subject: Re: [PHP] Sending a Table Via mail

PartyPosters wrote:
> Hello is there any way I can send a table (or just tabulated data) via email.
> I've tried this but comes up with an error.
> $to = myemailaddress.com;
>
> $re = "Test Email from system";
>
> $msg = "<TABLE BORDER=\"2\"><TR>hello</TR></TABLE>"
>
>
> mail($to, $re, $msg);

It's in the manual...

http://us4.php.net/manual/en/function.mail.php

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
johnkegworks.com

attached mail follows:


Great thanks! Sorry I didn't realise it was in there.

what I've got so far is the following, I want to include a variable in there
but have tried different combos but can't get it to work reading the
variable.

$to = addadd.me.co.uk

# subject of message
$re = "Test Email from system";
$tablecontent = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01
Transitional//EN'
'http://www.w3.org/TR/html4/loose.dtd'><html><head><title>Untitled
Document</title></head><body><TABLE><TR><TD>hello</td></TR></TABLE></body></
html>";
#message from the form
$msg = $tablecontent;

$message = '
<html>
<head>
  <title>Birthday Reminders for August</title>
</head>
<body>
  <p>Here are the birthdays upcoming in August!</p>
  <table>
   <tr>
     <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
   </tr>
   <tr>
     <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
   </tr>
<TR>
<TD>"$username"</TD>
</TR>

  </table>
</body>
</html>
';

// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

# send the mail now
mail($to, $re, $message,$headers);
########### MAIL ENDS HERE
?>

----- Original Message -----
From: "John Nichel" <johnkegworks.com>
To: <php-generallists.php.net>
Sent: Wednesday, March 23, 2005 9:37 PM
Subject: Re: [PHP] Sending a Table Via mail

> PartyPosters wrote:
> > Hello is there any way I can send a table (or just tabulated data) via
email.
> > I've tried this but comes up with an error.
> > $to = myemailaddress.com;
> >
> > $re = "Test Email from system";
> >
> > $msg = "<TABLE BORDER=\"2\"><TR>hello</TR></TABLE>"
> >
> >
> > mail($to, $re, $msg);
>
> It's in the manual...
>
> http://us4.php.net/manual/en/function.mail.php
>
> --
> John C. Nichel
> ÜberGeek
> KegWorks.com
> 716.856.9675
> johnkegworks.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Hi,
I am new to session of php. I need pass the form content from the the
first page all the way down to the last page to process it. I used to use
$_POST['sth'] to pass the data, but it is very painful since there are
several pages between the first and last page. I am using $_SESSION['sth']
now. It saves a lot of time, but when I clicked the 'Back' button on the
tool bar, I always got the message "The page cannot be displayed". Can you
help me?

Thank you and regards.

Guirong

attached mail follows:


gwang5ncsu.edu wrote:
...
> tool bar, I always got the message "The page cannot be displayed". Can you
> help me?

Yes. Use a real browser like Firefox so that you can get real error
messages ;)

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

attached mail follows:


Hi,
I have a login script which has worked fine in the past, however i need
to change the IF statement. Basically all i want it to do is verify
that $squadnum variable is inbetween 1-98 or is 99. I'm not even
entirely sure if i need to use the ereg function and i dont think the
"1-98" bit is formatted correctly, any help would be much appreciated.

Heres the code i have so far:

if (ereg("1-98", $squadnum)) { // users with id 1-98 should get sent to
squad page
        header("Location: squad.php");
    } else if(ereg("99", $squadnum)) { // 99 is the id number of the
site administrator
        header("Location: admin.php");
    } else {
        header("Location: login.php");
    }

Thanks, Nick

attached mail follows:


Nick wrote:

> Hi,
> I have a login script which has worked fine in the past, however i need
> to change the IF statement. Basically all i want it to do is verify
> that $squadnum variable is inbetween 1-98 or is 99. I'm not even
> entirely sure if i need to use the ereg function and i dont think the
> "1-98" bit is formatted correctly, any help would be much appreciated.
>
> Heres the code i have so far:
>
> if (ereg("1-98", $squadnum)) { // users with id 1-98 should get sent to
> squad page
> header("Location: squad.php");
> } else if(ereg("99", $squadnum)) { // 99 is the id number of the
> site administrator
> header("Location: admin.php");
> } else {
> header("Location: login.php");
> }
>
> Thanks, Nick
how about a non regular-expression solution?
if($squadnum > 0 && $squadnum < 99) {
        header('Location: squad.php');
} elseif($squadnum == 99) {
        header('Location: admin.php');
} else {
        header('Location: login.php');
}

attached mail follows:


Thanks, that seems to have worked.

M. Sokolewicz wrote:

> Nick wrote:
>
>> Hi,
>> I have a login script which has worked fine in the past, however i
>> need to change the IF statement. Basically all i want it to do is
>> verify that $squadnum variable is inbetween 1-98 or is 99. I'm not
>> even entirely sure if i need to use the ereg function and i dont
>> think the "1-98" bit is formatted correctly, any help would be much
>> appreciated.
>>
>> Heres the code i have so far:
>>
>> if (ereg("1-98", $squadnum)) { // users with id 1-98 should get sent
>> to squad page
>> header("Location: squad.php");
>> } else if(ereg("99", $squadnum)) { // 99 is the id number of the
>> site administrator
>> header("Location: admin.php");
>> } else {
>> header("Location: login.php");
>> }
>>
>> Thanks, Nick
>
> how about a non regular-expression solution?
> if($squadnum > 0 && $squadnum < 99) {
> header('Location: squad.php');
> } elseif($squadnum == 99) {
> header('Location: admin.php');
> } else {
> header('Location: login.php');
> }
>