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 3 Feb 2004 01:58:02 -0000 Issue 2567

php-general-digest-helplists.php.net
Date: Mon Feb 02 2004 - 19:58:02 CST


php-general Digest 3 Feb 2004 01:58:02 -0000 Issue 2567

Topics (messages 176571 through 176644):

Re: Can't delete cookies
        176571 by: Marek Kilimajer
        176576 by: Marek Kilimajer

Re: php header information
        176572 by: James E Hicks III

finding news stories in a selection of months
        176573 by: Michael Hill
        176575 by: Miles Thompson

Re: [PHP-DB] Re: [PHP] Oracle + PHP
        176574 by: Luis Moran Ochoa

Re: OOP methodology
        176577 by: chris.neale.somerfield.co.uk

Zlib Compression || Implementation || Bandwidth Savings?
        176578 by: CF High
        176595 by: rush
        176609 by: CF High

Re: How check credit card or magnetic card number.
        176579 by: Pedro
        176592 by: Jas
        176593 by: craig

Flash interface to CLI PHP Script vs GTK
        176580 by: chris.neale.somerfield.co.uk

Str_Replace Command
        176581 by: Christopher J. Crane
        176583 by: Jason Wong
        176584 by: Christopher J. Crane
        176585 by: Jason Wong
        176586 by: Christopher J. Crane
        176587 by: Jason Wong
        176588 by: Matt Matijevich
        176591 by: Christopher J. Crane

Re: The PHP Problem
        176582 by: chris.neale.somerfield.co.uk

Re: Directory Browse Concept
        176589 by: Paul Furman

Reliable remote IPs in SSL?
        176590 by: Geoff Caplan

PHP and MS SQL ?
        176594 by: Mark
        176596 by: John Nichel
        176598 by: John Nichel

Regular expression help?
        176597 by: Jas
        176600 by: Matthew Weier O'Phinney
        176604 by: Adam Bregenzer
        176627 by: Jas
        176628 by: Justin Patrin

Help for code to 'sort list' please
        176599 by: EastLothianDirectory
        176601 by: John Nichel
        176602 by: EastLothianDirectory
        176603 by: John Nichel
        176606 by: Hugh Danaher
        176611 by: Jochem Maas
        176612 by: EastLothianDirectory
        176615 by: Jochem Maas
        176621 by: EastLothianDirectory

Pulling unique data from database into an array
        176605 by: Richard Kurth
        176616 by: Jochem Maas
        176633 by: Richard Kurth
        176634 by: Matt Matijevich

Urgent: PHP Programmer
        176607 by: Cesar Cordovez

Need Help - extract unstructured data for parse reformat and import into DB
        176608 by: Sophia Morgan
        176614 by: Matt Matijevich

POST required header info
        176610 by: Scott Birksted
        176622 by: Stuart

Retrieving class names in a static method
        176613 by: Adam Bregenzer

Help with mail() function
        176617 by: Pooya Eslami
        176618 by: Matt Matijevich
        176619 by: Matt Matijevich
        176620 by: Pooya Eslami
        176623 by: Matt Matijevich
        176641 by: Russell Shaw

Sendmail wrapper
        176624 by: Federico Petronio

My PHP file is not parsed
        176625 by: Reem M.
        176626 by: John W. Holmes

[Stats] PHP Net List: January 2004
        176629 by: Bill Doerrfeld

Adding one month to a given date
        176630 by: merlin
        176631 by: Vail, Warren
        176632 by: Jochem Maas

Thumbnail Page
        176635 by: PETCOL

looking for a way to manually free memory in the middle of a script
        176636 by: kumar mcmillan
        176639 by: Justin Patrin

auto forms from mysql database
        176637 by: Justin French
        176640 by: Justin Patrin
        176642 by: Justin French
        176643 by: Kelly Hallman
        176644 by: Justin Patrin

problem with upload don't understand
        176638 by: tony

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:


Are you sure that the cookie is not unset? You might have an old cookie
with "/" as its path that you see now.

Andrew Wood wrote:

> Can anyone fathom out why I can't get the setcookie function to delete a
> cookie?
>
> I'm calling it with the same arguments as I used to set it originally,
> but with a null string value & an expiry time in the past but the cookie
> persistently remains in the browser.
>
> This how I set it:
> setcookie ("hhubpassword", md5($newpassword) , time() + 1209600,
> "/xchange/");
>
> And this is how I'm trying to delete it:
> setcookie ("hhubpassword", "", time() -3600, "/xchange/");
>
> Thanks
> Andrew
>

attached mail follows:


Please, reply to the whole list, you will have a better chance you will
get the right answer.

Andrew Wood wrote:

> No because even if I manually delete all the cookies in the browser from
> my domain, then reload the page to set them again, then run the PHP code
> to delete them they're still there.
>
> The interesting thing is, the expiry time isn't being altered at all
>

Another thing that comes to my mind: do you have the computer clocks
(both client and server) correct? and timezones?

attached mail follows:


On Monday 02 February 2004 08:57 am, Angelo Zanetti wrote:
> HI all
>
> I have a page that has been written by someone else and when I run it and
> click on a button to valid the username and password to login it sends me
> back the same page with the following:
>
> Warning: Cannot modify header information - headers already sent by (output
> started at c:\program files\apache group\apache\htdocs\zero\db_class.inc:1)
> in c:\program files\apache group\apache\htdocs\zero\login.php on line 26
>

Check db_class.inc, it is probably got a space or something in it and that is
enough to cause this problem. You cannot send anything at all before you use
the header() function.

James Hicks

attached mail follows:


Hi everyone,
I have made written some code (really bad code,I'm sure), that finds the
earliest month that has a news story, and the latest month that has a
news story. the code is below. I now need to loop through somehow, to
build an array, that gives me the month (JAN,FEB,MAR) and the year it
belongs to, along with the number of news stories each month has. I'm a
bit stuck as i'm really new to this stuff,
 
thanks for any help, you guys can give,
heres the code i have:
 
 $strSQL = "SELECT date from ".$tbl_prefix."news where live=1 order by
date asc limit 0,1";
 $result = mysql_query($strSQL,$dbconn);
 $firstresult = mysql_fetch_array($result);
 $firstdate = $firstresult['date'];
 $firstmonth = substr($firstdate, 4, 6);
 $firstyear = substr($firstdate, 0, 4);
 
 
 
 
 $strSQL = "SELECT date from ".$tbl_prefix."news where live=1 order by
date desc limit 0,1";
 $result = mysql_query($strSQL,$dbconn);
 $lastresult = mysql_fetch_array($result);
 $lastdate = $lastresult['date'];
 $lastmonth = substr($lastdate, 4, 6);
 $lastyear = substr($lastdate, 0, 4);
 
 
 
Michael Hill
Senior Developer
Holler

02076891942
www.holler.co.uk

This message is confidential, you may use and apply the information only
for the intended purpose. Internet communications are not secure and
therefore Holler does not accept legal responsibility for the
contents of this message. Any views or opinions expressed are solely
those of the author and may not represent those of Holler.
If you are not the intended recipient, any disclosure, copying,
distribution
or use of it, or any part of it, in any form whatsoever, and any actions
taken or omitted to be taken in reliance on it, is prohibited and may
be unlawful.

 

attached mail follows:


Michael,

Let the database do the work. Check your MySQL docs (assuming you are using
MySQL, otherwise check what you have ) for the month() function. Use this
in your SELECT, aliasing it so that you do not use the term "month", say
pub_month. Your SQL would then look like this ....

  $strSQL = "SELECT date, MONTH(date) as pub_month from
".$tbl_prefix."news where live=1 order by date asc limit 0,1";
(You can do the same thing with the YEAR() function)

Next step is to GROUP your results by the month ...

  $strSQL = "SELECT date, month(date) as pub_month from
".$tbl_prefix."news where live=1 GROUP BY pub_month order by date asc
limit 0,1";

As an aside, why are you limiting results to one record with limit 0,1? For
testing, why don't you drop that? Also, while testing, echo your $strSQL so
see what it looks like. I KNOW we always write correct code every time and
don't need to bother with such an elementary step. Yet doing this seems to
save a lot of time <g>.

If you can, rename your date column to pub_date; "date" is a reserved word
for many database systems or a function name in many languages. Good to
avoid it and then you don't have to always enclose it in quotes, or square
brackets, etc.

Hope this is helpful - Miles

At 03:10 PM 2/2/2004 +0000, Michael Hill wrote:
>Hi everyone,
>I have made written some code (really bad code,I'm sure), that finds the
>earliest month that has a news story, and the latest month that has a
>news story. the code is below. I now need to loop through somehow, to
>build an array, that gives me the month (JAN,FEB,MAR) and the year it
>belongs to, along with the number of news stories each month has. I'm a
>bit stuck as i'm really new to this stuff,
>
>thanks for any help, you guys can give,
>heres the code i have:
>
> $strSQL = "SELECT date from ".$tbl_prefix."news where live=1 order by
>date asc limit 0,1";
> $result = mysql_query($strSQL,$dbconn);
> $firstresult = mysql_fetch_array($result);
> $firstdate = $firstresult['date'];
> $firstmonth = substr($firstdate, 4, 6);
> $firstyear = substr($firstdate, 0, 4);

> $strSQL = "SELECT date from ".$tbl_prefix."news where live=1 order by
>date desc limit 0,1";
> $result = mysql_query($strSQL,$dbconn);
> $lastresult = mysql_fetch_array($result);
> $lastdate = $lastresult['date'];
> $lastmonth = substr($lastdate, 4, 6);
> $lastyear = substr($lastdate, 0, 4);
>
>
>
>Michael Hill
>Senior Developer
>Holler
>
>02076891942
>www.holler.co.uk

attached mail follows:


Ok, thanks....

I will try it.....

Michael Mauch wrote:

>Luis Moran Ochoa wrote:
>
>
>
>>ORACLE_SID=OWEB ; export ORACLE_SID;
>>ORACLE_HOME=/usr/oracle/product; export ORACLE_HOME;
>>TNS_ADMIN=/usr/oracle/product/network/admin; export TNS_ADMIN;
>>ORACLE_BASE=/usr/oracle; export ORACLE_BASE;
>>ORA_NLS33=/usr/oracle/product/ocommon/nls/admin/data; export ORA_NLS33;
>>ORA_NLS=/usr/oracle/product/ocommon/nls/admin/data; export ORA_NLS;
>>NLS_LANG=spanish_spain.we8dec; export NLS_LANG;
>>TNS_ADMIN=/usr/oracle/product/network/admin; export TNS_ADMIN;
>>CLASSPATH=:/usr/local/jre:/usr/oracle/product/jdbc/lib/classes111.zip:
>>export CLASSPATH;
>>LD_LIBRARY_PATH=/usr/oracle/product/lib:/usr/oracle/product/jdbc/lib:
>>export LD_LIBRARY_PATH
>>
>>
>
>Perhaps some variables are set in the start script, but not in your root
>shell. Put a
>
> export >/tmp/apache-start
>
>in the start script to see which variables are set. Boot, move
>/tmp/apache-start to /tmp/apache-boot, stop apache, start apache from
>your root shell. "diff -u /tmp/apache-boot /tmp/apache-start" will show
>the differences.
>
>Or try to unset the locale variables in the start script:
>
>unset LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION LC_ALL
>
>Some parts of Apache/Oracle/whatever-else apparently has trouble with
>locales.
>
>Regards...
> Michael
>
>
>

attached mail follows:


Thanks - very useful way of looking at things. I think I'll opt for applying
this principle to the way I plan to improve my system. Currently far too
bulky. Of course, now the project has progresse, finding time to refactor
and effectively build most of it from scratch, is quite hard.

Cheers

Chris

-----Original Message-----
From: Justin Patrin [mailto:papercranereversefold.com]
Sent: 30 January 2004 17:19
To: php-generallists.php.net
Subject: [PHP] Re: OOP methodology

Wow, that's a lot of stuff in one class. Personally, I've started using
the MVC (Model, View, Controller) architecture. Basically what it does
is seperates Data logic from Display logic and Control logic. Here's how
I've been using it.

Model: Holds and deals with all data for the program, such as database
connections / queries, session data, data consistency. I am currently
using classes which use PEAR DB_DataObject for DB connections, querying,
and data storage.

View: Deals with displaying of data from model. ONLY does displaying, no
processing. Very minimal logic only associated with outputting.
Currently, I am using Smarty entirely for the view. Little no no PHP
code, only Smarty. The View in this case is just a smarty template file.

Controller: Handles requests from the browser. Instantiates Model and
View, calls functions in Model to alter its state (updating from
$_REQUEST vars, for instance). Chooses a view and then tells the view to
display. For me, this is all home-grown PHP.

This architecture can be much more complicated in, say, a C++ program,
but the Server/Client pattern built into web programs makes it much more
simple. The reason that I use this particular architecture is that it
factors all of the pieces of your program very nicely. Later, if you do
things right, you can use a single screen from one program in another
with minimal editing.

Here's a few pages that discuss MVC:
http://ootips.org/mvc-pattern.html
http://st-www.cs.uiuc.edu/users/smarch/st-docs/mvc.html

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield. Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

attached mail follows:


Hey all.

Having a good problem -- our hockey report site has jumped from 10
gigs/month to 30+ gigs/month & growing.

We're getting killed in bandwidth fees at the moment; barring switching to
another host, will utilizing ZLIB compression significantly reduce
bandwidth?

Also, in terms of ZLIB settings, I've ini_set() zlib compression to ON.

Additionally, do I need to ob_start() (& flush) page output?

I am uncertain how to implement the following:

example.php

<?
    session_start();

    ini_set("zlib.output_compression","ON");
    ini_set("zlib.output_compression_level",4);

    ob_start();

    $page_contents = fopen(** read file contents to variable **);

    ob_end_flush();
?>

Thanks for any advice,

--Noah

--

attached mail follows:


"Cf High" <noahnewminddesign.com> wrote in message
news:20040202154436.32395.qmailpb1.pair.com...
> Having a good problem -- our hockey report site has jumped from 10
> gigs/month to 30+ gigs/month & growing.
>
> We're getting killed in bandwidth fees at the moment; barring switching to
> another host, will utilizing ZLIB compression significantly reduce
> bandwidth?

well it depends what uses most of your bandwith. If it is for images, then
compression will not help much since images are allready compressed. In that
case, you may save much more if you can put images in some directory and
tell apache to allow cacheing for that directory.

On the other hand if your bandwith goes mainly on thransfer of html source
for the pages then compression can shave up to 80% of your bandwith usage.

rush
--
http://www.templatetamer.com/

attached mail follows:


Hmmmm....

Looks like the majority of sent bandwidth is html, not image files >> ratio
is at least 10:1 html to images.

With that in mind, setting zlib compression to ON seems the way to go.

Question is, how to implement compression?

Is it enough to just ini_set() zlib compression to ON? i.e. will all content
be automatically be compressed, or do I need to ob_start() & ob_end_clean()
at the start and end of each page?

TIA for any clues -- I'm obviously confused about compression
techniques.....

--Noah

"Rush" <piparush.avalon.hr> wrote in message
news:20040202182507.35173.qmailpb1.pair.com...
> "Cf High" <noahnewminddesign.com> wrote in message
> news:20040202154436.32395.qmailpb1.pair.com...
> > Having a good problem -- our hockey report site has jumped from 10
> > gigs/month to 30+ gigs/month & growing.
> >
> > We're getting killed in bandwidth fees at the moment; barring switching
to
> > another host, will utilizing ZLIB compression significantly reduce
> > bandwidth?
>
> well it depends what uses most of your bandwith. If it is for images, then
> compression will not help much since images are allready compressed. In
that
> case, you may save much more if you can put images in some directory and
> tell apache to allow cacheing for that directory.
>
> On the other hand if your bandwith goes mainly on thransfer of html source
> for the pages then compression can shave up to 80% of your bandwith usage.
>
> rush
> --
> http://www.templatetamer.com/

attached mail follows:


  Hi, how i can check credit card or magnetic card number for a site of
electronic commerce that i have to design.

Sorry for my english.

Pedro.

attached mail follows:


Pedro wrote:
> Hi, how i can check credit card or magnetic card number for a site of
> electronic commerce that i have to design.
>
> Sorry for my english.
>
> Pedro.
<?php
//Check credit card & date on HTML form
if(empty($_POST['cc']) || (empty($_POST['ccd'])) {
   echo "Credit card and date fields not submitted.";
} else {
   //Check formats for various card types & date
   if(eregi("^4[0-9]{16}$",$_POST['cc'])) ||
eregi("^[0-9]{2}/+[0-9]{2}$",$_POST['ccd'])) {
     echo "You card is a Visa Card";
   if(eregi("^5[0-9]{16}$",$_POST['cc'])) || eregi("^[0-9{2}/+[0-9]{2})) {
     echo "Your card is a Mastercard"; }
?>

You get the idea, you may to need to Google around for the various
credit card types and how the need them to be formatted, and my regular
expressions may need to be adjusted as I have not tested them out. But
that is just an example of how you would accomplish your goal.
HTH
Jas

attached mail follows:


> Hi, how i can check credit card or magnetic card number for
> a site of
> electronic commerce that i have to design.
>
> Sorry for my english.
>
> Pedro.
>

I think this should work for you, but it's not production tested yet.

-Craig

function verifyCC($name='', $type='', $number='', $expmonth='',
$expyear='') {
   //make sure all fields are filled in
   if (empty($name) || empty($type) || empty($number) || empty($expyear)
|| empty($expmonth)) {
      return FALSE;
   }

   //verify month makes sense
   if(!is_numeric($expmonth) || $expmonth < 1 || $expmonth > 12) {
      return FALSE;
   }

   // Get the current year
   $currentYear = date('Y');
   expyear = '20' . $expyear;
   settype($currentYear, 'integer');

   //verify year makes sense
   if (!is_numeric($expyear) || $expyear < $currentYear || $expyear >
$currentYear + 10) {
      return FALSE;
   }

   //strip out non-numeric numbers from number
   $number = preg_replace('/[^0-9]/', '', $number);
   $type = strtolower($type);

   //check length and prefix of number
   if ($type == 'mastercard' || $type == 'mc') {
      $validFormat = ereg("^5[1-5][0-9]{14}$", $number);
   }
   elseif ($type == 'visa') {
      $validFormat = ereg("^4[0-9]{12}([0-9]{3})?$", $number);
   }
   elseif ($type == 'amex' || $type == 'american express') {
      $validFormat = ereg("^3[47][0-9]{13}$", $number);
   }
   elseif ($type == 'diners club' || $type == 'dc' || $type = 'diners')
{
      $validFormat = ereg("^3(0[0-5]|[68][0-9])[0-9]{11}$", $number);
   }
   elseif ($type == 'discover' || $type == 'disc') {
      $validFormat = ereg("^6011[0-9]{12}$", $number);
   }
   elseif ($type == 'jcb') {
      $validFormat = ereg("^(3[0-9]{4}|2131|1800)[0-9]{11}$", $number);
   }
   else {
      return FALSE;
   }

   if (!$validFormat) {
      return FALSE;
   }

   //do mod 10 algorithm
   $revNum = strrev($number);
   $sum = 0;

   for($i = 0; $i < strlen($revNum); $i++) {
      $currentNum = substr($revNum, $i, 1);

      //double every second digit
      if($i % 2 == 1) {
         $currentNum *= 2;
      }

      //add digits of 2-digit numbers together
      if($currentNum > 9) {
         $firstNum = $currentNum % 10;
         $secondNum = ($currentNum - $firstNum) / 10;
         $currentNum = $firstNum + $secondNum;
      }

      $sum += $currentNum;
   }

   //check if there's a remainder
   if ($sum % 10 <> 0) {
      return FALSE;
   }

   return TRUE;
}

attached mail follows:


I'm sure people have had wilder ideas, but this is what I'm trying to do.

I'm disappointed by the lack of clear documentation and examples for GTK and
the strange way the package insists on using its own binary php.exe (for
win32) instead of being just a simple extension. And I've yet to find a way
to put 2 buttons on the new window. I tried this 6 months ago, can't
remember the detail but remember thinking at the time, stuff this! Never
again etc. The documentation wasn't clear to me, so I'm not sure what I've
said is strictly true.

I've written an application which iterates through a database, performing
various functions along the way, and at each step there are about 20
variables which I'd like to see. These are output to the console at such
speed that it's hard to see what's going on unless it crashes and you can
look at the error log. I'd like to have a basic GUI for outputting this
information and it occurred to me that I could use PHP's COM functionality
to create a Shockwave Flash object (as I have done in Excel VBA for example)
and then pass data from PHP, through to the custom fields in a custom made
flash object. My application runs in the CLI version of PHP 5. I've tried to
instantiate the flash object, but it doesn't recognise the term Shockwave
Flash Object when I try to create it. Am I just trying to create the object
using the wrong object name?

Or is this because it's a plugin? And if so, how come it works when I
created a test in Excel VBA (where I managed to interact with a flash object
from within a VBA script).

My only other option is to create a Internet Explorer object, load a
document with an embedded flash object and then reference it from there, but
that sounds even more 'cowboy-coder' to me.

My thinking is that if it's easy to talk to a flash object (and I believe
it's possible for a COM object to talk back to PHP) then it strikes me that
a flash file would be an improved interface to PHP than GTK - it looks nicer
for starters, smooth fonts and animation not as hard to implement.

Failing this, I'm considering writing a PHP script with socket support which
can talk to a Flash object in a client-server manner.

Anyone got any thoughts on this?

Thanks

Chris
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield. Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

attached mail follows:


I have never had this problem before and it is probably something simple...
Please take a look at the two foreach statements. I am at a loss as to why
the second line does not actually remove the quotes. The first foreach
statement does so how are they different.

  $StockURL =
"http://finance.yahoo.com/d/quotes.txt?s=xrx,ikn,danky&f=sl1&e=.txt";
  $StockResults = implode('', file("$StockURL"));
  $Rows = split("\n", $StockResults);
  foreach($Rows as $Row) { echo str_replace('"',"",$Row)."<br>\n"; }
  foreach($Rows as $Row) { str_replace('"',"",$Row); echo $Row."<br>\n"; }

Eventually, I need to break apart the $Row into two elements $Symbol and
$Price and then into a two dimensional array. I have done this with the code
below, but so far, I can not get rid of the quotes.

  foreach($Rows as $Row){
    list($Symbol, $Price) = split("\n", $Row);
    $TickerData=array("$Symbol"=>"$Price");
    }

attached mail follows:


On Tuesday 03 February 2004 00:14, Christopher J. Crane wrote:

> $StockURL =
> "http://finance.yahoo.com/d/quotes.txt?s=xrx,ikn,danky&f=sl1&e=.txt";
> $StockResults = implode('', file("$StockURL"));
> $Rows = split("\n", $StockResults);
> foreach($Rows as $Row) { echo str_replace('"',"",$Row)."<br>\n"; }
> foreach($Rows as $Row) { str_replace('"',"",$Row); echo $Row."<br>\n"; }

str_replace() RETURNS the replaced string. It does not alter $Row.

--
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
------------------------------------------
/*
Spiritual leadership should remain spiritual leadership and the temporal
power should not become too important in any church.
- Eleanor Roosevelt
*/

attached mail follows:


Ok I got around it by the following, but now I have a new problem. I can not
get the two dimensional array working. I want to later be able to output a
variable like this $TickerData["IKN"] and it will output the associated
$Price.

  $StockURL =
"http://finance.yahoo.com/d/quotes.txt?s=xrx,ikn,danky&f=sl1&e=.txt";
  $StockResults = implode('', file("$StockURL"));
  $Rows = split("\n", $StockResults);
  foreach($Rows as $Row) {
    list($Symbol, $Price) = split(",", $Row);
   $Symbol = str_replace('"', "", $Symbol);
   $TickerData = array("$Symbol"=>"$Ticker");
    }
  print_r($TickerData);
  echo $TickerData["IKN"]."<br>\n";

"Jason Wong" <php-generalgremlins.biz> wrote in message
news:200402030030.44626.php-generalgremlins.biz...
> On Tuesday 03 February 2004 00:14, Christopher J. Crane wrote:
>
> > $StockURL =
> > "http://finance.yahoo.com/d/quotes.txt?s=xrx,ikn,danky&f=sl1&e=.txt";
> > $StockResults = implode('', file("$StockURL"));
> > $Rows = split("\n", $StockResults);
> > foreach($Rows as $Row) { echo str_replace('"',"",$Row)."<br>\n"; }
> > foreach($Rows as $Row) { str_replace('"',"",$Row); echo
$Row."<br>\n"; }
>
> str_replace() RETURNS the replaced string. It does not alter $Row.
>
> --
> 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
> ------------------------------------------
> /*
> Spiritual leadership should remain spiritual leadership and the temporal
> power should not become too important in any church.
> - Eleanor Roosevelt
> */

attached mail follows:


On Tuesday 03 February 2004 00:52, Christopher J. Crane wrote:
> Ok I got around it by the following, but now I have a new problem. I can
> not get the two dimensional array working. I want to later be able to
> output a variable like this $TickerData["IKN"] and it will output the
> associated $Price.

> print_r($TickerData);

So what does the above show? If it isn't what you expect, figure out *why*.
Like how is $TickerData being assigned.

--
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
------------------------------------------
/*
We have phasers, I vote we blast 'em!
                -- Bailey, "The Corbomite Maneuver", stardate 1514.2
*/

attached mail follows:


Well this is it and it is really got me...
Echoing out the $Symbol and $Price works just fine one row about the
$TickerData array assignment. Yet it outputs nothing.
"Array ( [] => )" is what I get. If I change the line to
$TickerData = array ("$Symbol" => "$Price"); I get nothing, or the same
result. If I change the line to
$TickerData = array ('$Symbo'l => '$Price'); I get the following
Array ( [$Symbol] => $Price ) which tells me the assignment works, but it
seems like the $Symbol and $Price variable are blank when assigning to the
array. I know that they are not blank since they echoed out just fine one
line above.....<GRRRRRR>

  $StockURL =
"http://finance.yahoo.com/d/quotes.txt?s=xrx,ikn,danky&f=sl1&e=.txt";
  $StockResults = implode('', file("$StockURL"));
  $Rows = split("\n", $StockResults);
  foreach($Rows as $Row) {
    list($Symbol, $Price) = split(",", $Row);
 $Symbol = str_replace('"', "", $Symbol);
    echo $Symbol." - ".$Price."<br>\n";
    $TickerData = array ($Symbol => $Price);
    }
  print_r($TickerData);

"Jason Wong" <php-generalgremlins.biz> wrote in message
news:200402030059.46805.php-generalgremlins.biz...
> On Tuesday 03 February 2004 00:52, Christopher J. Crane wrote:
> > Ok I got around it by the following, but now I have a new problem. I can
> > not get the two dimensional array working. I want to later be able to
> > output a variable like this $TickerData["IKN"] and it will output the
> > associated $Price.
>
> > print_r($TickerData);
>
> So what does the above show? If it isn't what you expect, figure out
*why*.
> Like how is $TickerData being assigned.
>
> --
> 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
> ------------------------------------------
> /*
> We have phasers, I vote we blast 'em!
> -- Bailey, "The Corbomite Maneuver", stardate 1514.2
> */

attached mail follows:


On Tuesday 03 February 2004 01:09, Christopher J. Crane wrote:
> Well this is it and it is really got me...
> Echoing out the $Symbol and $Price works just fine one row about the
> $TickerData array assignment. Yet it outputs nothing.
> "Array ( [] => )" is what I get. If I change the line to
> $TickerData = array ("$Symbol" => "$Price"); I get nothing, or the same
> result. If I change the line to
> $TickerData = array ('$Symbo'l => '$Price'); I get the following
> Array ( [$Symbol] => $Price ) which tells me the assignment works, but it
> seems like the $Symbol and $Price variable are blank when assigning to the
> array. I know that they are not blank since they echoed out just fine one
> line above.....<GRRRRRR>

Are you sure that the line: echo $Symbol ...
is displaying something sensible for each $Row?

You're overwriting $TickerData at each iteration of the foreach-loop thus if
your last $Row doesn't contain something sensible neither would $TickerData.

You probably want to use this assignment instead:

  $TickerData[$Symbol] = $Price;

--
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
------------------------------------------
/*
TANSTAAFL
*/

attached mail follows:


<snip>
  $StockURL =
"http://finance.yahoo.com/d/quotes.txt?s=xrx,ikn,danky&f=sl1&e=.txt";
  $StockResults = implode('', file("$StockURL"));
  $Rows = split("\n", $StockResults);
  foreach($Rows as $Row) {
    list($Symbol, $Price) = split(",", $Row);
 $Symbol = str_replace('"', "", $Symbol);
    echo $Symbol." - ".$Price."<br>\n";
    $TickerData = array ($Symbol => $Price);
    }
  print_r($TickerData);
</snip>

why not replace:
$TickerData = array ($Symbol => $Price);

that line reassigns $TickerData to a array with one element in it
everytime you call it. The last time through your loop, $Symbol = ''
and $Price = '', so you get Array ( [] => ) when you print_r

with this:
$TickerData[$Symbol] = $Price;

attached mail follows:


Matt:
This worked perfect. Thank you. I didn't realize it was reassigning, I
thought it would work similar to array_push and add to the existing data. I
get it now, thanks to you.

Thanks again. I had been so frustrated I was losing my objectivity.

Christopher J. Crane
Network Manager - Infrastructure Services
IKON Document Efficiency at Work

-----Original Message-----
From: Matt Matijevich [mailto:matijevichalliancetechnologies.net]
Sent: Monday, February 02, 2004 12:25 PM
To: ccraneikon.com; php-generallists.php.net
Subject: Re: [PHP] Str_Replace Command

<snip>
  $StockURL =
"http://finance.yahoo.com/d/quotes.txt?s=xrx,ikn,danky&f=sl1&e=.txt";
  $StockResults = implode('', file("$StockURL"));
  $Rows = split("\n", $StockResults);
  foreach($Rows as $Row) {
    list($Symbol, $Price) = split(",", $Row); $Symbol = str_replace('"',
"", $Symbol);
    echo $Symbol." - ".$Price."<br>\n";
    $TickerData = array ($Symbol => $Price);
    }
  print_r($TickerData);
</snip>

why not replace:
$TickerData = array ($Symbol => $Price);

that line reassigns $TickerData to a array with one element in it everytime
you call it. The last time through your loop, $Symbol = ''
and $Price = '', so you get Array ( [] => ) when you print_r

with this:
$TickerData[$Symbol] = $Price;

attached mail follows:


I was in the same shoes a few years ago and used this.

http://www.net-language.com/workshops/Default.asp?workshop=21

It's a good guide, shows you how to set up a web server, php and mysql on
your own PC (win32). As it's for a slightly older version of PHP some parts
of the guide don't no longer hold true, but for the most part you shouldn't
have any problems; you should have it all up and running in a few hours.
You'll have an ideal test system to start trying out your code, and should
learn a bit about how to administrate MySQL databases and Apache web servers
in the process.

Hope that helps.

Chris

ps. Recommend you write notes for yourself as you install and setup. eg.
you'll probably only have to do one or two MySQL grant statements to get it
running, which if your like me you'll forget as soon as it works. Every time
I install it I waste 2 hours trawling through manuals trying to get the
syntax right, promising myself Next Time I'll Take Notes. I never do.

-----Original Message-----
From: Ash [mailto:ashmanPunkAss.com]
Sent: 30 January 2004 18:52
To: php-generallists.php.net
Subject: [PHP] The PHP Problem

Hi,
I am totally new to PHP and dont know a thing. I tried looking through the
articles but they were of no use. My Question is:
How can I just write php in a text editor, save it as a .php, and view it in
internet explorer, offline? I have tried everything and it just wont work.
I tried the code:

<?php
echo "Hi, I'm a PHP script!";
?>

in a .php file and nothing happened. Nothing will work, help!

I dont have a website, I just want to write and use the code.

Tnaks from Ashley Williams

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield. Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

attached mail follows:


Well, I'm installing post-nuke to see what that can do. I'm not sure I
like the blog look that most sites have but I guess it has a lot of
options. Probably more practical to just learn enough php to hack
existing code to suit my needs. I had hoped to build something simpler
myself which doesn't need to be so complicated and looks exactly how I
want it to... maybe still possible... we shall see.

Paul Furman wrote:
> I'm beginning to learn PHP to rebuild my web site in such a way that I
> can update it more easily (...and add some other dynamic features ...and
> utilize a database). I like the idea of a simple directory structure and
> it's a sensible way to organize my various projects and topics. So what
> I want is to place some simple text/htm files and jpegs in nested
> folders and have PHP read them onto a template page with header, footer
> & dynamic folder navigation. Sort of a hybrid between a threaded
> discussion group and a photo album generator.
>
> I'm not sure if It's wise to follow the folder structure literally.
> 'Gallery' is a php photo album program http://gallery.menalto.com that
> simulates nested folders with a flat-file pseudo-database. Probably they
> had reasons for not using actual nested folders?
>
> Another reason not to use actual nested folders is that I will probably
> want to have alternative views of the same pictures/pages. I'm a
> gardener so I've got a database of plant descriptions sorted by
> family/genus/species but I also have photo shoots in folders sorted by
> location/date. Then I want to be able to set up pages for my clients
> where I pull out a selection of plants from my list and show them
> particular pictures from my photo collection... so this kind of thing is
> strictly relational database. I like the nested folders because of my
> photo collection, there are many 'seconds' & unedited originals, etc & I
> keep all those under location/date folders and need to go back
> sometimes. Once it becomes a database the folder structure is
> superfluous baggage.
>
> So, if I take the folder route, I guess I'd just nest things under my
> public_html and the url would reflect the current location within the
> folders. But the way I'm being taught to set up a PHP site in class is
> to use a single index.php at the root & hide everything else outside of
> public_html. In this case I would have to create a global variable or
> SCREEN vars in the url with ?SCREEN to keep track of where the visitor
> is located. It would look so much nicer to have nested folder names in
> the url, even if they got long, I like the clear unmistakable logic of
> that.
>
> www.edgehill.net/plants/poacea/festuca/californica
> better than
> www.edgehill.net?FOLDER=plants/poacea/festuca/californica
>
> But to get the first option, I would then have to somehow set the
> template. 'Gallery' urls always look like one folder deep with some
> other optional settings sometimes:
>
> www.edgehill.net/gallery/festuca-californica
> (even if that folder is nested under:
> plants/poacea/festuca/festuca-californica)
>
> Each flat folder contains pictures and a data file with fields for
> various settings. I don't know how PHP knows to take all this to the
> 'Gallery' template. Somehow they say anything under that gallery folder
> should be presented through the gallery templates???
>
> Thanks for any thoughts if you made it this far <g>.

attached mail follows:


Hi folks,

I'm trying to do session-tracking with a get variable as securely as
possible. Obviously, this is an inherently insecure technique, but I
am trying to mitigate the risks.

I see in a paper by the MIT Lab for Computer Science that Yahoo say
they use the remote address for session tracking within the SSL. Yahoo
claim that with HTTPS the IP address does not jump around the way it
does with HTTP proxies, and it can be used reliably for tracking.

Ref: http://cookies.lcs.mit.edu/pubs.html

With Yahoo behind the claim it's tempting to belive it, but somehow it
seems too good to be true. I don't have access to any big logs right
now to check this out. Does anyone have experience with this?

--

Geoff Caplan

attached mail follows:


We are running PHP 4.3.4 with an IIS 5 server on WIN 2K server. PHP works fine on the server, the problem is connecting to a MS SQL database. When I try to access the site I get the following message:
 
 Fatal error: Call to undefined function: mssql_connect() in C:\newdata\linked\db_connect.php on line 2
 
I followed the instructions for MS SQL install from the site below.
http://www.php.net/manual/en/ref.mssql.php
I left out "To get these functions to work, you have to compile PHP with --with-mssql[=DIR], where DIR is the FreeTDS install prefix. And FreeTDS should be compiled using --enable-msdblib. ", b/c it seem like it didn't apply to Windows.
 
Any suggestions?
 
Thanks in advance.

 

---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

attached mail follows:


Mark wrote:
> We are running PHP 4.3.4 with an IIS 5 server on WIN 2K server. PHP works fine on the server, the problem is connecting to a MS SQL database. When I try to access the site I get the following message:
>
> Fatal error: Call to undefined function: mssql_connect() in C:\newdata\linked\db_connect.php on line 2
>
> I followed the instructions for MS SQL install from the site below.
> http://www.php.net/manual/en/ref.mssql.php
> I left out "To get these functions to work, you have to compile PHP with --with-mssql[=DIR], where DIR is the FreeTDS install prefix. And FreeTDS should be compiled using --enable-msdblib. ", b/c it seem like it didn't apply to Windows.
>
> Any suggestions?
>
> Thanks in advance.

Did you do this, and restart your web server....?

"The MSSQL extension is enabled by adding extension=php_mssql.dll to
php.ini."

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

attached mail follows:


Mark wrote:
> I restarted the server and the extension was added by default. Was there
> a need to do the compile?

No, I don't think so. You should only have to compile it if you're on a
*nix machine. I'm not too familiar with Windows and IIS, but it sounds
like the dll isn't getting loaded. Maybe check your error logs to see
if IIS is telling you that. Also, check your extensions directory in
the php.ini, and make sure it's pointing to where the .dll's are. There
are some user comments on the mssql_connect() page of the manual which
may help you out.

http://us4.php.net/manual/en/function.mssql-connect.php

<snip>

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

attached mail follows:


Not sure if anyone knows of a good way to match strings of this type...
00:02:8b:0c:2f:09

I have tried this but its not working.
                         
!eregi("^[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}$",$_POST['mac'])

so it should match 2 characters 0-9a-fA-F
each block of 2 characters is followed by a : and repreated in 6 blocks.

Jas

attached mail follows:


* Jas <jason.gerfenscl.utah.edu>:
> Not sure if anyone knows of a good way to match strings of this type...
> 00:02:8b:0c:2f:09
>
> I have tried this but its not working.
>
> !eregi("^[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}$",$_POST['mac'])

Use the perl compatible regexps instead:

!preg_match('/^([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}$/', $_POST['mac'])

This searches for XX: 5 followed by XX, where XX is 0-9, A-F, or a-f. I
_think_ the POSIX regexps can do some grouping like this as well, but
I'm not absolutely sure.

--
Matthew Weier O'Phinney
Webmaster and IT Specialist
National Gardening Association
802-863-5251 x156
mailto:matthewgarden.org
http://www.garden.org
http://www.kidsgardening.com

attached mail follows:


On Mon, 2004-02-02 at 14:15, Jas wrote:
> I have tried this but its not working.
>
> !eregi("^[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}$",$_POST['mac'])
>
> so it should match 2 characters 0-9a-fA-F
> each block of 2 characters is followed by a : and repreated in 6
> blocks.

That's a long expression, try:
!preg_match('/^([0-9a-f]{2}($|:)){6}/i', $_POST['mac']);

This pattern finds 6 matches of a number or letter (the /i means
case-insensitive) followed by either a ':' or the end of the string.

--
Adam Bregenzer
adambregenzer.net

attached mail follows:


Adam Bregenzer wrote:

> On Mon, 2004-02-02 at 14:15, Jas wrote:
>
>>I have tried this but its not working.
>>
>>!eregi("^[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}$",$_POST['mac'])
>>
>>so it should match 2 characters 0-9a-fA-F
>>each block of 2 characters is followed by a : and repreated in 6
>>blocks.
>
>
> That's a long expression, try:
> !preg_match('/^([0-9a-f]{2}($|:)){6}/i', $_POST['mac']);
>
> This pattern finds 6 matches of a number or letter (the /i means
> case-insensitive) followed by either a ':' or the end of the string.
>
Thanks, that worked like a charm.
Jas

attached mail follows:


Jas wrote:

> Adam Bregenzer wrote:
>
>> On Mon, 2004-02-02 at 14:15, Jas wrote:
>>
>>> I have tried this but its not working.
>>>
>>> !eregi("^[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}$",$_POST['mac'])
>>>
>>>
>>> so it should match 2 characters 0-9a-fA-F
>>> each block of 2 characters is followed by a : and repreated in 6
>>> blocks.
>>
>>
>>
>> That's a long expression, try:
>> !preg_match('/^([0-9a-f]{2}($|:)){6}/i', $_POST['mac']);
>>
>> This pattern finds 6 matches of a number or letter (the /i means
>> case-insensitive) followed by either a ':' or the end of the string.
>>
> Thanks, that worked like a charm.
> Jas

You may want to check out The Regex Coach. It's very helpful. :-)
http://www.weitz.de/regex-coach/

--
paperCrane <Justin Patrin>

attached mail follows:


I have the following sql query in my Php code:

$sql = "SELECT id, date_day, date_month, date_year, title, content FROM $table_name
ORDER BY date_year desc";

The rest of the php code is just a simple db connection with a bullet list
and 'while' loop with an 'echo result' request.

This shows a list of dates with latest year on top of list.
I have Select/Option boxes to chose day,month,year etc to fill in Php form
to update database.

This is result of sql query:

   2-August-2007
  1-January-2007
30-December-2007
     8-July-2006
29-February-2006
    3-March-2006
16-February-2005
  1-January-2004

Although it lists in year order descending (in fact what I asked it to do)
I would like to learn to sort the months and days into desc order properly too.

Can anyone suggest how I achieve this with php code.

Thank you in advance

attached mail follows:


EastLothianDirectory wrote:

> I have the following sql query in my Php code:
>
> $sql = "SELECT id, date_day, date_month, date_year, title, content FROM $table_name
> ORDER BY date_year desc";
>
> The rest of the php code is just a simple db connection with a bullet list
> and 'while' loop with an 'echo result' request.
>
> This shows a list of dates with latest year on top of list.
> I have Select/Option boxes to chose day,month,year etc to fill in Php form
> to update database.
>
> This is result of sql query:
>
> 2-August-2007
> 1-January-2007
> 30-December-2007
> 8-July-2006
> 29-February-2006
> 3-March-2006
> 16-February-2005
> 1-January-2004
>
> Although it lists in year order descending (in fact what I asked it to do)
> I would like to learn to sort the months and days into desc order properly too.
>
> Can anyone suggest how I achieve this with php code.
>
> Thank you in advance
>

Let the db do this. ORDER BY

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

attached mail follows:


Thank you for reply. I already have 'ORDER BY year desc'.

But as I mentioned how do I get the months and day in order too on the same list.

Thank you in advance

---- Original Message ----
From: John Nichel
Date: Mon 2/2/04 19:31
To: EastLothianDirectory
Cc: php-generallists.php.net
Subject: Re: [PHP] Help for code to 'sort list' please

EastLothianDirectory wrote:

> I have the following sql query in my Php code:
>
> $sql = "SELECT id, date_day, date_month, date_year, title, content FROM
$table_name
> ORDER BY date_year desc";
>
> The rest of the php code is just a simple db connection with a bullet list
> and 'while' loop with an 'echo result' request.
>
> This shows a list of dates with latest year on top of list.
> I have Select/Option boxes to chose day,month,year etc to fill in Php form
> to update database.
>
> This is result of sql query:
>
> 2-August-2007
> 1-January-2007
> 30-December-2007
> 8-July-2006
> 29-February-2006
> 3-March-2006
> 16-February-2005
> 1-January-2004
>
> Although it lists in year order descending (in fact what I asked it to do)
> I would like to learn to sort the months and days into desc order properly too.
>
> Can anyone suggest how I achieve this with php code.
>
> Thank you in advance
>

Let the db do this. ORDER BY

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

attached mail follows:


EastLothianDirectory wrote:

> Thank you for reply. I already have 'ORDER BY year desc'.
>
> But as I mentioned how do I get the months and day in order too on the same list.
>
> Thank you in advance
<snip>

Read the documentation for ORDER BY in MySQL. You can sort on multiple
columns. Basically, you can 'ORDER BY year, month, day DESC' (my syntax
may be off), and it order it by the year first, then like years will be
ordered by month, etc.

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

attached mail follows:


Chris,
It looks like your data in date_year is not in a format that supports a
simple DESC sort. Look into getting the column formatted in yyyy-mm-dd
order (see the mysql manual for this). Read the data in your column, format
it, pump it back into the database, then change the column type to 'date'.
Of course, you'll also need to examine any new inputs and get them correctly
formated before they're added to the database.
hugh
----- Original Message -----
From: "EastLothianDirectory" <chriseastlothian.org>
To: <php-generallists.php.net>
Sent: Monday, February 02, 2004 11:18 AM
Subject: [PHP] Help for code to 'sort list' please

> I have the following sql query in my Php code:
>
> $sql = "SELECT id, date_day, date_month, date_year, title, content FROM
$table_name
> ORDER BY date_year desc";
>
> The rest of the php code is just a simple db connection with a bullet list
> and 'while' loop with an 'echo result' request.
>
> This shows a list of dates with latest year on top of list.
> I have Select/Option boxes to chose day,month,year etc to fill in Php
form
> to update database.
>
> This is result of sql query:
>
> 2-August-2007
> 1-January-2007
> 30-December-2007
> 8-July-2006
> 29-February-2006
> 3-March-2006
> 16-February-2005
> 1-January-2004
>
> Although it lists in year order descending (in fact what I asked it to do)
> I would like to learn to sort the months and days into desc order properly
too.
>
> Can anyone suggest how I achieve this with php code.
>
> Thank you in advance
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


EastLothianDirectory wrote:

> I have the following sql query in my Php code:
>
> $sql = "SELECT id, date_day, date_month, date_year, title, content FROM $table_name
> ORDER BY date_year desc";

...

> Although it lists in year order descending (in fact what I asked it to do)
> I would like to learn to sort the months and days into desc order properly too.
>
> Can anyone suggest how I achieve this with php code.

I would do it in the SQL the same way as you have sorted on 'date_year'
e.g.:

$sql = "SELECT id, date_day, date_month, date_year, title, content FROM
$table_name ORDER BY date_year, date_month desc";

this assumes you have a numerical value stored for 'date_month',
otherwise you will have the months sorted alphabetically which probably
does not help. (my gut feeling is that storing the names of the month in
the database is probably not the best way to go about it - have you
looked at datetime/timestamp fields?)

BTW you can also mix DESC/ASC sorting (although this probably does not
make sense to do when considering ordering by 'date' data) e.g.:

$sql = "SELECT id, date_day, date_month, date_year, title, content FROM
$table_name ORDER BY date_year ASC, date_month desc";

the lowdown on sorting in MySQL can be found here:
http://www.mysql.com/doc/en/Sorting_rows.html

more info on datetime fields in MySQL can be found here:
http://www.mysql.com/doc/en/DATETIME.html
and here:
http://www.mysql.com/doc/en/Date_calculations.html

---

alernatively familiarize yourself with PHPs array sorting functions -
e.g. array_multi_sort() (I may have spelt that function incorrectly!),
but I think that it will be alot more hassle to set up an multilevel
array with a second/third array for mapping the month names (assuming
the 'date_month' field contains text) to numbers for sorting purposes
than using the DB beforehand.

>
> Thank you in advance

attached mail follows:


Thank you for replying again but I have already been on the Mysql.com website
and although I did ascertain the correct syntax ie

ORDER BY date_day, date_month, date_year desc

ORDER BY date_day, date_year, date_month desc

ORDER BY date_month, date_day, date_year desc

ORDER BY date_month, date_year, date_day desc

ORDER BY date_year, date_day, date_month desc

ORDER BY date_year, date_month, date_day desc

None of them work mainly because the months get listed alphabetically and not IN
ORDER. For example AUGUST is listed as the first month because it started with 'A'
The year and day being integers were listed correctly.

Now do you see the problem. This is why Mysql.com was no good so I came to PHP for
help.

Thank you in advance to anyone ?? that can help.

---- Original Message ----
From: John Nichel
Date: Mon 2/2/04 19:43
To: php-generallists.php.net
Subject: Re: [PHP] Help for code to 'sort list' please

EastLothianDirectory wrote:

> Thank you for reply. I already have 'ORDER BY year desc'.
>
> But as I mentioned how do I get the months and day in order too on the same list.
>
> Thank you in advance
<snip>

Read the documentation for ORDER BY in MySQL. You can sort on multiple
columns. Basically, you can 'ORDER BY year, month, day DESC' (my syntax
may be off), and it order it by the year first, then like years will be
ordered by month, etc.

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

attached mail follows:


refering to my previous mail: I really don't think its a good idea to
store the months as names in the DB (I recommend a datetime field to
store the complete date info).

but if you must then you will have to define an array which you can use
as a sort key e.g.

array(
        1 => 'January',
        2 => 'February',
        ...etc...
);

and use something like this is combination with a multisort array
function to get the order you want - but the way I see it your better
off changing the DB schema and using a few date related function is
either MySQL or PHP to display the dates in a user friendly way (e.g.
'10 January 2004').

EastLothianDirectory wrote:
> Thank you for replying again but I have already been on the Mysql.com website
> and although I did ascertain the correct syntax ie
>
...
>
> None of them work mainly because the months get listed alphabetically and not IN
> ORDER. For example AUGUST is listed as the first month because it started with 'A'
> The year and day being integers were listed correctly.
>
> Now do you see the problem. This is why Mysql.com was no good so I came to PHP for
> help.
>

attached mail follows:


Was just reading your previous reply and my months are indeed in text and therein
lies the problem.

I will have to completely rewrite the online form which will add a(mysql type)
date to add it and all the fields to the DB.

I will research the 'PHPs array sorting functions' that you mention. It might be
quicker.

......Just thought that it WILL be quicker converting the months in the
SELECT/OPTION boxes to integers then no need to do a complete rewrite although I
should learn how to do the mysql date thing anyway.

Thanks Jochem and also to Hugh for replying.
Chris
-----------------
---- Original Message ----
From: Jochem Maas
Date: Mon 2/2/04 20:47
To: php-generallists.php.net
Subject: Re: [PHP] Help for code to 'sort list' please

refering to my previous mail: I really don't think its a good idea to
store the months as names in the DB (I recommend a datetime field to
store the complete date info).

but if you must then you will have to define an array which you can use
as a sort key e.g.

array(
        1 => 'January',
        2 => 'February',
        ...etc...
);

and use something like this is combination with a multisort array
function to get the order you want - but the way I see it your better
off changing the DB schema and using a few date related function is
either MySQL or PHP to display the dates in a user friendly way (e.g.
'10 January 2004').

EastLothianDirectory wrote:
> Thank you for replying again but I have already been on the Mysql.com website
> and although I did ascertain the correct syntax ie
>
...
>
> None of them work mainly because the months get listed alphabetically and not IN
> ORDER. For example AUGUST is listed as the first month because it started with 'A'
> The year and day being integers were listed correctly.
>
> Now do you see the problem. This is why Mysql.com was no good so I came to PHP
for
> help.
>

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

attached mail follows:


I am pulling data from a database that list the Language a person
  speaks and the id number. It is in a format like this.
  
 user_id field_value
 6 English||Spanish
 2 English
 8 English||Portuguese||Finnish
 5 English||Japanese||German
 3 English
 1 English
 9 German

 each time it looks at a new record it list all the languages that that
 person speaks with a double pipe in between each language.

 What I need to do is find all the unique languages so I can generate a
 list of languages that do not have any repeats in it with each users
 id number that speaks that language. so the
 list above
 would be
 6,2,8,5,3,1 English
 8 Portuguese
 8 Finnish
 5 Japanese
 5,9 German
 6 Spanish

 Using the script below (I am using ADODB for a database layer) I am
 able to pull the data into an array of both fields so it gives me an
 array that looks like this
 Array ( [6] => English||Portuguese||Finnish [2] => English||Portuguese||German [8] => English [7] => English ) )

 But I can not figure out how to split it up so there is a list like I
 have above.
 I know I need to use explode, array_merge and array_unique but I am
 not sure how to set it up so it will work correctly
 
 $sql = "SELECT * FROM default_UserDBElements WHERE field_name = 'Languages'";
  $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
  $recordSet = $conn->Execute($sql);
if (!$recordSet)
print $conn->ErrorMsg();
else
while (!$recordSet->EOF) {
$array[$recordSet->fields['user_id']] = $recordSet->fields['field_value'];
$recordSet->MoveNext();
}

print_r($array);

attached mail follows:


// given an array in the form:

$arrX = array(
        '6' => 'English||Spanish'
        '8' => 'English||Portuguese||Finnish'
        // ...etc...
);

// define a new array & loop thru $arrX like so:

$arrTmp = array()
foreach ($arrX as $langs) {
        $arrTmp = array_merge($arrTmp, explode('||',$langs));
}

// now loop thru the $arrTmp array (and for each item loop the original
$arrX array) as follows:

foreach ($arrTmp as $Tmp) {
        $arrFinal[$Tmp] = array();
        foreach($arrX as $uid => $langs) {
                // is the lang in this users lang list
                if (stristr($langs, $Tmp)) {
                        // yes it is! add the user to this lang
                        $arrFinal[$Tmp][] = $uid;
                }
        }
}

// now dump the results to the screen:

echo ("users lang\n");
foreach ($arrFinal as $lang => $users) {
        echo implode(',',$users)." $lang\n";
}

---

that was off the top of my head; there is probably a better way of doing
it but hopefully it points you in the right direction.

if you don't understand this code I suggest testing it out (there may be
typos!!) - these are basic manipulations and a developing proper
understanding of them is very important to being able to write good code
- I speak from experience when I say the only real way to understand it
is to play with it.

have fun.

Richard Kurth wrote:

> I am pulling data from a database that list the Language a person
> speaks and the id number. It is in a format like this.
>
> user_id field_value
> 6 English||Spanish
> 2 English
> 8 English||Portuguese||Finnish
> 5 English||Japanese||German
> 3 English
> 1 English
> 9 German
>
> each time it looks at a new record it list all the languages that that
> person speaks with a double pipe in between each language.
>
> What I need to do is find all the unique languages so I can generate a
> list of languages that do not have any repeats in it with each users
> id number that speaks that language. so the
> list above
> would be
> 6,2,8,5,3,1 English
> 8 Portuguese
> 8 Finnish
> 5 Japanese
> 5,9 German
> 6 Spanish
>
> Using the script below (I am using ADODB for a database layer) I am
> able to pull the data into an array of both fields so it gives me an
> array that looks like this
> Array ( [6] => English||Portuguese||Finnish [2] => English||Portuguese||German [8] => English [7] => English ) )
>
> But I can not figure out how to split it up so there is a list like I
> have above.
> I know I need to use explode, array_merge and array_unique but I am
> not sure how to set it up so it will work correctly
>
> $sql = "SELECT * FROM default_UserDBElements WHERE field_name = 'Languages'";
> $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
> $recordSet = $conn->Execute($sql);
> if (!$recordSet)
> print $conn->ErrorMsg();
> else
> while (!$recordSet->EOF) {
> $array[$recordSet->fields['user_id']] = $recordSet->fields['field_value'];
> $recordSet->MoveNext();
> }
>
> print_r($array);
>

attached mail follows:


Hello Jochem,
I tried what you suggested and it work just perfect as long as i made
the array by hand. But when I try to generate the array using the
database I can not get it to work. How would I create the array $arrX
from the mysql database.
I have tried this but it does not work properly
while (!$recordSet->EOF) {
$arrX = $recordSet->fields['user_id'] => $recordSet->fields['field_value'];
$recordSet->MoveNext();

$arrX = array(
        "6" => "English||Spanish",
        "8" => "English||Portuguese||Finnish",
        "2" => "English"
);
// define a new array & loop thru $arrX like so:
$arrTmp = array();
foreach ($arrX as $langs) {
        $arrTmp = array_merge($arrTmp, explode('||',$langs));
}
// now loop thru the $arrTmp array (and for each item loop the original
//$arrX array) as follows:
foreach ($arrTmp as $Tmp) {
        $arrFinal[$Tmp] = array();
        foreach($arrX as $uid => $langs) {
                // is the lang in this users lang list
                if (stristr($langs, $Tmp)) {
                        // yes it is! add the user to this lang
                        $arrFinal[$Tmp][] = $uid;
                }
        }
}
// now dump the results to the screen:
echo ("users lang\n");
foreach ($arrFinal as $lang => $users) {
        echo implode(',',$users)." $lang\n";
}

Monday, February 2, 2004, 12:47:25 PM, you wrote:

JM> // given an array in the form:

JM> $arrX = array(
'' =>> 'English||Spanish'
'8' =>> 'English||Portuguese||Finnish'
JM> // ...etc...
JM> );

JM> // define a new array & loop thru $arrX like so:

JM> $arrTmp = array()
JM> foreach ($arrX as $langs) {
JM> $arrTmp = array_merge($arrTmp, explode('||',$langs));
JM> }

JM> // now loop thru the $arrTmp array (and for each item loop the original
JM> $arrX array) as follows:

JM> foreach ($arrTmp as $Tmp) {
JM> $arrFinal[$Tmp] = array();
JM> foreach($arrX as $uid => $langs) {
JM> // is the lang in this users lang list
JM> if (stristr($langs, $Tmp)) {
JM> // yes it is! add the user to this lang
JM> $arrFinal[$Tmp][] = $uid;
JM> }
JM> }
JM> }

JM> // now dump the results to the screen:

JM> echo ("userslang\n");
JM> foreach ($arrFinal as $lang => $users) {
JM> echo implode(',',$users)." $lang\n";
JM> }

JM> ---

JM> that was off the top of my head; there is probably a better way of doing
JM> it but hopefully it points you in the right direction.

JM> if you don't understand this code I suggest testing it out (there may be
JM> typos!!) - these are basic manipulations and a developing proper
JM> understanding of them is very important to being able to write good code
JM> - I speak from experience when I say the only real way to understand it
JM> is to play with it.

JM> have fun.

JM> Richard Kurth wrote:

>> I am pulling data from a database that list the Language a person
>> speaks and the id number. It is in a format like this.
>>
>> user_id field_value
>> 6 English||Spanish
>> 2 English
>> 8 English||Portuguese||Finnish
>> 5 English||Japanese||German
>> 3 English
>> 1 English
>> 9 German
>>
>> each time it looks at a new record it list all the languages that that
>> person speaks with a double pipe in between each language.
>>
>> What I need to do is find all the unique languages so I can generate a
>> list of languages that do not have any repeats in it with each users
>> id number that speaks that language. so the
>> list above
>> would be
>> 6,2,8,5,3,1 English
>> 8 Portuguese
>> 8 Finnish
>> 5 Japanese
>> 5,9 German
>> 6 Spanish
>>
>> Using the script below (I am using ADODB for a database layer) I am
>> able to pull the data into an array of both fields so it gives me an
>> array that looks like this
>> Array ( [6] => English||Portuguese||Finnish [2] =>
>> English||Portuguese||German [8] => English [7] => English ) )
>>
>> But I can not figure out how to split it up so there is a list like I
>> have above.
>> I know I need to use explode, array_merge and array_unique but I am
>> not sure how to set it up so it will work correctly
>>
>> $sql = "SELECT * FROM default_UserDBElements WHERE field_name = 'Languages'";
>> $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
>> $recordSet = $conn->Execute($sql);
>> if (!$recordSet)
>> print $conn->ErrorMsg();
>> else
>> while (!$recordSet->EOF) {
>> $array[$recordSet->fields['user_id']] =
>> $recordSet->fields['field_value'];
>> $recordSet->MoveNext();
>> }
>>
>> print_r($array);
>>

--
Best regards,
 Richard mailto:rdkurthdirectphp.com

attached mail follows:


[snip]
while (!$recordSet->EOF) {
$arrX = $recordSet->fields['user_id'] =>
$recordSet->fields['field_value'];
$recordSet->MoveNext();
[/snip]

while (!$recordSet->EOF) {
$arrX[$recordSet->fields['user_id']] =
$recordSet->fields['field_value'];
$recordSet->MoveNext();
}

attached mail follows:


REQ-2004-01
Programmer I

Position reference #166370
Job will go offline on 2/26/2004

ALeNet, Inc. is a privately held firm based in Coral Gables, Florida. We
are a leading provider of enterprise system consulting services in the
areas of eBusiness, enterprise resource planning (ERP) and customer
relationship management (CRM).

ALeNet has teamed up with leading technology providers to offer the most
comprehensive, integrated suite of ERP, CRM and web solutions available
today.

Our industry recognized IT professionals will focus your ERP, CRM and
e-business strategy efforts to achieve the greatest possible return on
investment (ROI) and highest levels of customer service.

Qualifications
* Knowledge of: PHP (min. 5 years experience)
* HTML+CSS+JavaScript is a must.
* OOP
* SQL or MySQL (preferred)

Position description
Under the general supervision of the Product Development Manager,
reviews, analyzes, and modifies programming systems including encoding,
testing, debugging and installing to support an organization's business
applications. Gathers requirements from users and creates specifications
and develops code. Designs and writes codes to support existing
application. Familiar with standard concepts, practices, and procedures
using PHP, MySQL, HTML, and JavaScript. Relies on limited experience and
judgment to plan and accomplish goals. Performs a variety of IT related
tasks.

Additional information

Locations : Miami, Fort Lauderdale,FL, United States
Percentage travel : No Travel
Position starts : 2/15/2004
Openings available : 3
Work Types : FullTime, Regular, Paid

Contact information

Cesar Cordovez
501 Brickell Key Drive
Suite 203
Miami, FL, United States
33131
Primary Phone : (305) 379-xxxx Ext: 15
Email : phpgurucesamo.com

attached mail follows:


I need to get some guidance on a project. I have to extract unstructured data from a .CSV file and reformat the data to import into MSSQL.

The unstructured data is basically in some kind of sub summary report. Note: the files will include a range from 1 to 12 months of information (month to date). Four different .CSV files would need to be reformatted at the same time. The file size for one is about 1.7 MB and containing roughly around 21,115 rows of data in each.

Would PHP be a good program to use for this project? Has anyone had to reformat unstructured data to insert into a database? If anyone has any suggestions or examples please let me know. J

I was thinking about importing the data into an array then parsing through the information with multiple if statements then using SQL to insert the data into a database. This will be my first PHP parse project so any examples and suggestions to get me started would be greatly appreciated. A small sample of the data structure is below:

Thank You,
Sophia
sophiammac.com

/WCS37 /WCS9 /WCS9 WCS9

                        RETAIL REGIS PAG E1
                        VEHIC LE TYPE CAR &T
                        AREA: PLACE
                MONTH MONTH MONTH
                OCT. SEP. AUG
                2003 2003 2003
GROUP MAK MDL
----- --- --- ----- ----- -----
SPTY COUP AU RSX 3 4 8
CCT CAR FORD FC 4 1 7

REPORT DATE: 1/12/01

                        RETAIL REGIS PAG E1
                        VEHIC LE TYPE CAR &T
                        AREA: PLACE2
                MONTH MONTH MONTH
                OCT. SEP. AUG
                2003 2003 2003
GROUP MAK MDL
----- --- --- ----- ----- -----
SPTY COUP AU RSX 1 7 3
CCT CAR FORD FC 2 2 5

REPORT DATE: 1/12/01

attached mail follows:


<snip>
Would PHP be a good program to use for this project? Has anyone had to
reformat unstructured data to insert into a database? If anyone has any
suggestions or examples please let me know. J
</snip>

If you have not already, look at regular expressions. imho, by far the
best way to parse reports like this.

php would work fine for parsing this data but I prefer perl's regular
expression methods.

attached mail follows:


I'm attempting to have some java code send a post request to a php script,
but the variables are not being assigned correctly. The request comes
through
fine, but the vars keep coming up empty.

The java code works fine with a perl script that grabs the post vars, as
well as
from a simple html form submitting post requests to the script.

The only possible answer we've come up with some missing header
information. Does anyone know where I can find a list of header
requirements,
or have encounter this type of problem before. Using GET is not an option.

attached mail follows:


Scott Birksted wrote:
> I'm attempting to have some java code send a post request to a php script,
> but the variables are not being assigned correctly. The request comes
> through
> fine, but the vars keep coming up empty.
>
> The java code works fine with a perl script that grabs the post vars, as
> well as
> from a simple html form submitting post requests to the script.
>
> The only possible answer we've come up with some missing header
> information. Does anyone know where I can find a list of header
> requirements,
> or have encounter this type of problem before. Using GET is not an option.

Please read this: http://php.net/register_globals

If it's still not clear, check the archives.

If you still can't find an answer come back here and we'll spoon-feed you.

--
Stuart

attached mail follows:


I'm looking for a way to find the class name of an object within a
static method. class_name($this) works for instances, but in a static
method $this does not exist. Also, __CLASS__ isn't inheritable so isn't
really a solution for what I am looking for. Has anybody done this
before?

Here's a theoretical example:

class Foo {
 function getClassName() {
  // ???
 }
}
class Bar extends Foo {
}

echo Foo::getClassName(); // returns 'foo'
echo Bar::getClassName(); // returns 'bar'

One sample application of this would be a debugging method in a base
class that is inherited and used in a static method.

TIA,
Adam

--
Adam Bregenzer
adambregenzer.net

attached mail follows:


Hi, I'm new to php and this newsletter. I have a form on my webpage and a
php file to email it to me but the contents of the text area are not emailed
to me. Can anyone help me with this?

here is the code for my html and php files:

<html>
<head><title>Test</title></head>
<body>
<form action="textareamail.php" method="POST">
Comments: </br>
<textarea rows="10" cols="50" name="TextArea"></textarea>
</br>
<input type="reset" value="Clear">
<input type="submit" value="Submit">
</form>
</body>
</html>

<?php
if ($TextArea="") {
echo "You have to fill out the entire form,
go back and try again.";
} else {
$to = "memyemailaddress.com";
$from = "From-Test";
$subject = "Subject-Test";
$message = "$TextArea";
mail($to, $subject, $message,"From: $from");
echo "Thankyou";
}
?>

attached mail follows:


[snip]
<?php
if ($TextArea="") {
echo "You have to fill out the entire form,
go back and try again.";
} else {
$to = "memyemailaddress.com";
$from = "From-Test";
$subject = "Subject-Test";
$message = "$TextArea";
mail($to, $subject, $message,"From: $from");
echo "Thankyou";
}
?>
[/snip]

What is happening when the form is posted?

This is just a guess, but I think registar_globals is probaby off. try
this

<?php
if ($_POST['TextArea']="") {
echo "You have to fill out the entire form,
go back and try again.";
} else {
$to = "memyemailaddress.com";
$from = "From-Test";
$subject = "Subject-Test";
$message = "$TextArea";
mail($to, $subject, $message,"From: $from");
echo "Thankyou";
}
?>

attached mail follows:


ahh, I have to correct myself

replace this: if ($_POST['TextArea']="") {
with this: if ($_POST['TextArea']=="") {

attached mail follows:


Well the problem is not that it won't get executed, its that every thing
will be sent except the message in the textarea! subject, to and from are
sent fine

attached mail follows:


did you replace ($TextArea="") with ($TextArea=="") ?

 ($TextArea="") will reassign $TextArea to ""

>>> "Pooya Eslami" <mepooyaeslami.com> 2/2/2004 3:00:32 PM >>>
Well the problem is not that it won't get executed, its that every
thing
will be sent except the message in the textarea! subject, to and from
are
sent fine

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

attached mail follows:


Pooya Eslami wrote:
> Hi, I'm new to php and this newsletter. I have a form on my webpage and a
> php file to email it to me but the contents of the text area are not emailed
> to me. Can anyone help me with this?
>
> here is the code for my html and php files:
>
> <html>
> <head><title>Test</title></head>
> <body>
> <form action="textareamail.php" method="POST">
> Comments: </br>
> <textarea rows="10" cols="50" name="TextArea"></textarea>
> </br>
> <input type="reset" value="Clear">
> <input type="submit" value="Submit">
> </form>
> </body>
> </html>
>
> <?php
> if ($TextArea="") {
> echo "You have to fill out the entire form,
> go back and try again.";
> } else {
> $to = "memyemailaddress.com";
> $from = "From-Test";
> $subject = "Subject-Test";
> $message = "$TextArea";

$message=$_POST[TextArea];

> mail($to, $subject, $message,"From: $from");
> echo "Thankyou";
> }
> ?>

A better way (imo) is to do it as javascript and pop up a
window with the message. No server-side processing is then
needed until a successful message is submitted.

attached mail follows:


Hi all... I have a chrooted Apache/PHP on Solaris 8 working fine except
for one PHP function, mail(). I read that in Unix environments there is
not possible to make PHP use a remote SMTP and it needs to find a
sendmail executable un the path.

Since including Postfix in the chrooted env. does not look very nice, I
try to use a wapper (local_FS->remote_SMTP), but I am not happy with the
one I found. It does not handle well the CC, nor the BCC so I change it
a little, but still have issues (for explample if the SMTP does not
responds, it don't try angain and the mail is lost).

Do you know some sendmail wrapper to recomend?

Any help is welcome... Bye!
--
                                         Federico Petronio
                                         petrusactivesec.biz

attached mail follows:


I have installed Apache 2.0.43 (win32