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 Dec 2003 09:42:35 -0000 Issue 2451

php-general-digest-helplists.php.net
Date: Wed Dec 03 2003 - 03:42:35 CST


php-general Digest 3 Dec 2003 09:42:35 -0000 Issue 2451

Topics (messages 171607 through 171651):

sendmail vs smpt
        171607 by: Pablo Gosse
        171608 by: David T-G
        171609 by: Manuel Lemos

replace %rand[x]-[y]% macro in string with random string
        171610 by: daniel hahler
        171611 by: Richard Davey
        171612 by: Luke
        171613 by: Robert Cummings
        171614 by: Luke
        171615 by: daniel hahler
        171616 by: daniel hahler
        171617 by: daniel hahler
        171618 by: Luke

Re: Finding array in MySQL (I'm not asking the right question)
        171619 by: Dave G

Simple table sorting
        171620 by: Tommi Virtanen
        171621 by: Robert Cummings

news service
        171622 by: BigMark
        171623 by: Luke

Unicode translation
        171624 by: Louie Miranda
        171633 by: Luke
        171634 by: Leif K-Brooks
        171636 by: Louie Miranda
        171639 by: Luke
        171640 by: Louie Miranda
        171643 by: Chris

Conditional anchor href value
        171625 by: Eric Blanpied
        171626 by: Martin Towell
        171628 by: Chris Shiflett
        171645 by: Eric Blanpied
        171646 by: Eric Blanpied

" " in a Variable
        171627 by: Dimitri Marshall
        171629 by: Chris Shiflett
        171630 by: Dimitri Marshall
        171631 by: Richard Davey
        171632 by: Jason Sheets

Re: reload farmes
        171635 by: Luke

Virtual Directory Support
        171637 by: Ralph Guzman

Re: Generate automatic list of dates
        171638 by: Luke

refresh data
        171641 by: BigMark
        171642 by: Richard Davey
        171644 by: BigMark

Re: DHCP web interface. New version.
        171647 by: Daevid Vincent

Re: Dealing with large classes over several files
        171648 by: Kim Steinhaug

Re: XML, strings and foreign (swedish/danish) characters
        171649 by: Victor Spång Arthursson

Doubts With Select Queries
        171650 by: irinchiang.justeducation.com

Images On-Fly
        171651 by: Dejan Dujak

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:


Hi all. I'm curious as to the performance difference between scripts
that use sendmail vs. smtp for their mailing abilities.

 

I use the following class for delivering emails,
http://phpmailer.sourceforge.net <http://phpmailer.sourceforge.net/> ,
and since I don't have sendmail running on my local machine I'm using
the smtp server of the university where I work to deliver my messages.
However, it seems to be a bit sluggish.

 

I'm going to run a test of switching the mail handler from smtp to
sendmail once the application is in its permanent home in a few weeks,
but for now does anyone have any opinions on this, and is there any
advantage to using one over the other?

Thanks in advance,

Pablo

attached mail follows:


Pablo --

...and then Pablo Gosse said...
%
% Hi all. I'm curious as to the performance difference between scripts
% that use sendmail vs. smtp for their mailing abilities.

Using sendmail will almost always be very very much faster because

  - you're talking to the local machine
  - you're offloading the mail process to something else

and so if you can do so -- even if your machine is only set up with a
"dumb" mailer that only knows how to talk to your U's smarthost -- I
would recommend that you run, not walk, to do so :-)

HTH & HAND

:-D
--
David T-G * There is too much animal courage in
(play) davidtgjustpickone.org * society and not sufficient moral courage.
(work) davidtgworkjustpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)

iD8DBQE/zQ0eGb7uCXufRwARAiliAKCB5oB7w3j6Z4H4GJwW195+a6UyawCgkYgr
lLOwgcgz/14SUpNfDJ2Avy0=
=wyXJ
-----END PGP SIGNATURE-----

attached mail follows:


Hello,

On 12/02/2003 07:50 PM, Pablo Gosse wrote:
> Hi all. I'm curious as to the performance difference between scripts
> that use sendmail vs. smtp for their mailing abilities.
>
>
>
> I use the following class for delivering emails,
> http://phpmailer.sourceforge.net <http://phpmailer.sourceforge.net/> ,
> and since I don't have sendmail running on my local machine I'm using
> the smtp server of the university where I work to deliver my messages.
> However, it seems to be a bit sluggish.
>
>
>
> I'm going to run a test of switching the mail handler from smtp to
> sendmail once the application is in its permanent home in a few weeks,
> but for now does anyone have any opinions on this, and is there any
> advantage to using one over the other?

Forget SMTP. There is a myth that SMTP is faster than queuing message
via sendmail but that is just a reflex that some people do not
understand how it works.

What you need to understand is that sending messages usually consists on
two things: queueing and deliverying.

Usually you do not deliver messages directly to the end recipient. You
just pass them to a MTA (Mail Transfer Agent) that will take care of the
delivery.

When you you pass the message to sendmail program, depending on it may
be configured, it may either try to deliver the message immediately and
return when it is done, or just leave the message on the local queue for
later delivery.

When you relay the message to a SMTP server, usually it just queues the
message there for later delivery.

Obviously, if you use sendmail and it tries to deliver the message
immediately, it will take eventually a little more time, but the message
is already delivered. If the message is queued for later delivery, your
PHP script does not have to wait so much but the message may take much
longer to be deliver.

Even if you just want to queue the messages for later delivery to free
your PHP scripts, sendmail can do it much faster because you will be
using local interprogram communication to injec the message in the local
queue. If you do it via SMTP server, you need to establish a TCP
connection which is much slower even when the SMTP server is in the same
machine.

If you just want to free your PHP scripts and leave messages in the
queue, what you may need to do is to pass sendmail the appropriate
switches to tell it to do it so.

For that, you can check sendmail documentation to see the available
modes, or you may want to try this e-mail message composing and sending
class that has sub-classes specialized in delivering via mail()
function, sendmail, qmail and SMTP.

The sendmail subclass provides options that translate to the appropriate
sendmail switches. For faster queueing, set the delivery_mode variable
of the sendmail_message_class to SENDMAIL_DELIVERY_DEFERRED .

If you can have a qmail MTA in your machine, use qmail because it is by
far the most efficient.

http://www.phpclasses.org/mimemessage

--

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/

attached mail follows:


Hello PHP-list,

I'm building a script, that provides a honeypot of invalid email
addresses for spambots.. for this I want to provide a macro for the
templates that looks like %rand[x]-[y]%, where [x] and [y] are
integers, that specify the length of the random script.
My first thoughts were about the best parsing of the %rand..%-part,
but now I came to a point, where I could also need suggestions on the
random string generation..
It considers very basic word generations and the only meaningful word
I discovered was 'Java'.. *g

For generation of a random string with length 1.000.000 it takes about
13 seconds on my xp 1600+.. that's quite a lot, imho, so suggestions
are very welcome..

the script goes here, ready to copy'n'paste:

--------------------------------------------------------------
list($low, $high) = explode(" ", microtime());
$this->timerstart = $high + $low;

function parserandstr($toparse){
 $debug = 0;

 $new = '';
 $ch = array(
    'punct' => array('.', '.', '.', '..', '!', '!!', '?!'),
    'sep' => array(', ', ' - '),
    'vocal' => array('a', 'e', 'i', 'o', 'u'),
    'cons_low' => array('x', 'y', 'z'),
    'cons_norm' => array('b', 'c', 'd', 'f', 'g', 'h', 'j', 'k',
                 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w')
 );
 while ( ($pos = strpos($toparse, '%rand')) !== FALSE){
  if ($debug) echo '<br><br>$pos: ' . $pos;
  $new .= substr($toparse, 0, $pos);
  if ($debug) echo '<br>$new: "' . $new . '"';

  $toparse = substr($toparse, $pos + 5);
  if ($debug) echo '<br>$toparse: "' . $toparse . '"';
  
  $posclose = strpos($toparse, '%', 1);
  if ($debug) echo '<br>$posclose: "' . $posclose . '"';
  if ($posclose){
   $rlength = substr($toparse, 0, $posclose);
   if ($debug) echo '<br>$rlength: "' . $rlength . '"';
   
   $possep = strpos($rlength, '-');
   $minrlen = substr($rlength, 0, $possep);
   $maxrlen = substr($rlength, $possep + 1);
   if ($debug) echo '<br>$minrlen: "' . $minrlen . '"';
   if ($debug) echo '<br>$maxrlen: "' . $maxrlen . '"';
   
   $rlen = rand($minrlen, $maxrlen);
   
   // generate random string
   $randstr = ''; $inword = 0; $insentence = 0; $lastchar = '';
   for($j = 0; $j < $rlen; $j++){
      if ($inword > 3 && rand(0, 5) == 1) { // punctuation chars
       if (rand(0,5) > 0) $char = ' ';
       else {
        $char = $ch['punct'][rand(0, count($ch['punct'])-1)] . ' ';
        $j += strlen($char)-1;
        $insentence = 0;
       }
       $inword = 0;
      }
      else {
       if (!$lastwasvocal && rand(0, 10) > 6) { // vocals
        $char = $ch['vocal'][rand(0, count($ch['vocal'])-1)];
        $lastwasvocal = true;
       } else {
          do {
           if (rand(0, 30) > 0) // normal priority consonants
            $char = $ch['cons_norm'][rand(0, count($ch['cons_norm'])-1)];
           else $char = $ch['cons_low'][rand(0, count($ch['cons_low'])-1)];
          } while ($char == $lastchar);
          $lastwasvocal = false;
       }
       $inword++;
       $insentence++;
    }
    
    if ($insentence == 1 || ($inword == 1 && rand(0, 30) < 10))
     $randstr .= strtoupper($char);
    else $randstr .= $char;
    $lastchar = $char;
   }
   
   $new .= $randstr;
   if ($debug) echo '<br>$new: ' . $new;

   $toparse = substr($toparse, $posclose + 1);
   if ($debug) echo '<br>$toparse: "' . $toparse . '"';
  } else $new .= '%rand';
 }
 return $new . $toparse;
}
 
function pre_dump($var, $desc=''){
 echo '<pre>::'.$desc.'::<br>'; var_dump($var); echo '</pre>';
}

#$s = parserandstr('random string comes here: '
    . '%rand10-1000%. this is a fake %rand and should not be killed..');
$s = parserandstr('%rand200000-200000%');
echo '<br><br>' . $s;
echo '<br><br>' . strlen($s);

list($low, $high) = explode(" ", microtime());
$t = $high + $low;
printf("<br>loaded in: %.4fs", $t - $this->timerstart);
------------------------------------------------------------

--
shinE!
http://www.thequod.de ICQ#152282665
PGP 8.0 key: http://thequod.de/danielhahler.asc

attached mail follows:


Hello Daniel,

Tuesday, December 2, 2003, 10:46:33 PM, you wrote:

dh> For generation of a random string with length 1.000.000 it takes about
dh> 13 seconds on my xp 1600+.. that's quite a lot, imho, so suggestions
dh> are very welcome..

Just so we're clear on this - you're creating a string (an email
address) of a million characters? I don't know my mail RFC's that well, but
I'm sure this is well beyond what it considers "standard".

Does the string HAVE to make sense? I mean does a spambot really
care less, or can even detect, what the email address contains? Surely
just creating a truly random string would suffice (and indeed remove
the need for the rather elaborate function you posted). I fully accept
I might be missing the whole point here :)

--
Best regards,
 Richard mailto:richlaunchcode.co.uk

attached mail follows:


result on my laptop for default script settings
(P4 2.66, 512mb ram)

200000
loaded in: 1.3158s

please tell me what you think of this? if you like it i can email it to you
(as a php file)

----------begin php code---------------
<?php

class honeyPot {
 //define word lengths
 var $umin;
 var $umax;
 var $dmin;
 var $dmax;
 //define address count
 var $addresses;
 var $userfordomain;
 var $emails;
 var $countrys;

 function honeyPot($usermin = 3, $usermax = 15, $addresses = 10,
$userfordomain = false, $domainmin = 3, $domainmax = 15){
  $this->umin = $usermin;
  $this->umax = $usermax;
  $this->addresses = $addresses;
  $this->userfordomain = $userfordomain;
  $this->dmin = $domainmin;
  $this->dmax = $domainmax;
  $this->countrys = array("","au","cz","andsoforth");
  $this->types =
array("com","co","org","gov","mil","id","tv","cc","andsoforth");
 }

 function createAddressArray(){
  $i=0;
  $addressarray = array();
  while($i<$this->addresses){
   $addressarray[] = $this->makeAddress();
   $i++;
  }
  return $addressarray;
 }
 function displayAddresses(){
  $i=0;
  $addressstring = "";
  while($i<$this->addresses){
   $addressstring .= $this->makeAddress() . "<br>";
   $i++;
  }
  echo $addressstring;
  return $addressstring;
 }
 function makeAddress(){
  $user = $this->createRandString();
  if($this->userfordomain == false){
   $domain = $this->createRandString("domain");
  }else{
   $domain = $user;
  }

  $address = $user . "" . $domain . "." . $this->createType();
  $country = $this->createCountry();
  if($country != ""){
   $address .= "." . $country;
  }

  return $address;
 }

 function createRandString($type = "user"){
  srand((double) microtime() * 948625);
  if($type=="user"){
   $length = rand($this->umin, $this->umax);
  }else{
   $length = rand($this->dmin, $this->dmax);
  }
  $string = "";
  $numbersmin = 48;
  $numbersmax = 57;
  $lowercaselettersmin = 97;
  $lowercaselettersmax = 122;
  $whichset = 0;
  while($length >= 0){
   $set = rand(0,100);
   if($set < 5){
    $string .= "_";
   }elseif($set < 32){
    $string .= chr(rand($numbersmin, $numbersmax));
   }else{
    $string .= chr(rand($lowercaselettersmin, $lowercaselettersmax));
   }

   $length--;
  }

  return $string;
 }
 function createType(){
  srand ((double) microtime() * 845676);
  $tid = rand(0, count($this->types)-1);
  return $this->types[$tid];
 }
 function createCountry(){
  srand ((double) microtime() * 375797);
  $cid = rand(0, count($this->countrys)-1);
  return $this->countrys[$cid];
 }
}

$test = new honeyPot();
print_r($test->createAddressArray());
echo "<br><br>\n\n";
$test->displayAddresses()
?>
--------end php code----------

--
Luke

"Daniel Hahler" <phpnetgulthequod.de> wrote in message
news:233427766.20031202234633thequod.de...
> Hello PHP-list,
>
> I'm building a script, that provides a honeypot of invalid email
> addresses for spambots.. for this I want to provide a macro for the
> templates that looks like %rand[x]-[y]%, where [x] and [y] are
> integers, that specify the length of the random script.
> My first thoughts were about the best parsing of the %rand..%-part,
> but now I came to a point, where I could also need suggestions on the
> random string generation..
> It considers very basic word generations and the only meaningful word
> I discovered was 'Java'.. *g
>
> For generation of a random string with length 1.000.000 it takes about
> 13 seconds on my xp 1600+.. that's quite a lot, imho, so suggestions
> are very welcome..
>
> the script goes here, ready to copy'n'paste:
>
> --------------------------------------------------------------
> list($low, $high) = explode(" ", microtime());
> $this->timerstart = $high + $low;
>
> function parserandstr($toparse){
> $debug = 0;
>
> $new = '';
> $ch = array(
> 'punct' => array('.', '.', '.', '..', '!', '!!', '?!'),
> 'sep' => array(', ', ' - '),
> 'vocal' => array('a', 'e', 'i', 'o', 'u'),
> 'cons_low' => array('x', 'y', 'z'),
> 'cons_norm' => array('b', 'c', 'd', 'f', 'g', 'h', 'j', 'k',
> 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w')
> );
> while ( ($pos = strpos($toparse, '%rand')) !== FALSE){
> if ($debug) echo '<br><br>$pos: ' . $pos;
> $new .= substr($toparse, 0, $pos);
> if ($debug) echo '<br>$new: "' . $new . '"';
>
> $toparse = substr($toparse, $pos + 5);
> if ($debug) echo '<br>$toparse: "' . $toparse . '"';
>
> $posclose = strpos($toparse, '%', 1);
> if ($debug) echo '<br>$posclose: "' . $posclose . '"';
> if ($posclose){
> $rlength = substr($toparse, 0, $posclose);
> if ($debug) echo '<br>$rlength: "' . $rlength . '"';
>
> $possep = strpos($rlength, '-');
> $minrlen = substr($rlength, 0, $possep);
> $maxrlen = substr($rlength, $possep + 1);
> if ($debug) echo '<br>$minrlen: "' . $minrlen . '"';
> if ($debug) echo '<br>$maxrlen: "' . $maxrlen . '"';
>
> $rlen = rand($minrlen, $maxrlen);
>
> // generate random string
> $randstr = ''; $inword = 0; $insentence = 0; $lastchar = '';
> for($j = 0; $j < $rlen; $j++){
> if ($inword > 3 && rand(0, 5) == 1) { // punctuation chars
> if (rand(0,5) > 0) $char = ' ';
> else {
> $char = $ch['punct'][rand(0, count($ch['punct'])-1)] . ' ';
> $j += strlen($char)-1;
> $insentence = 0;
> }
> $inword = 0;
> }
> else {
> if (!$lastwasvocal && rand(0, 10) > 6) { // vocals
> $char = $ch['vocal'][rand(0, count($ch['vocal'])-1)];
> $lastwasvocal = true;
> } else {
> do {
> if (rand(0, 30) > 0) // normal priority consonants
> $char = $ch['cons_norm'][rand(0, count($ch['cons_norm'])-1)];
> else $char = $ch['cons_low'][rand(0,
count($ch['cons_low'])-1)];
> } while ($char == $lastchar);
> $lastwasvocal = false;
> }
> $inword++;
> $insentence++;
> }
>
> if ($insentence == 1 || ($inword == 1 && rand(0, 30) < 10))
> $randstr .= strtoupper($char);
> else $randstr .= $char;
> $lastchar = $char;
> }
>
> $new .= $randstr;
> if ($debug) echo '<br>$new: ' . $new;
>
> $toparse = substr($toparse, $posclose + 1);
> if ($debug) echo '<br>$toparse: "' . $toparse . '"';
> } else $new .= '%rand';
> }
> return $new . $toparse;
> }
>
> function pre_dump($var, $desc=''){
> echo '<pre>::'.$desc.'::<br>'; var_dump($var); echo '</pre>';
> }
>
> #$s = parserandstr('random string comes here: '
> . '%rand10-1000%. this is a fake %rand and should not be killed..');
> $s = parserandstr('%rand200000-200000%');
> echo '<br><br>' . $s;
> echo '<br><br>' . strlen($s);
>
> list($low, $high) = explode(" ", microtime());
> $t = $high + $low;
> printf("<br>loaded in: %.4fs", $t - $this->timerstart);
> ------------------------------------------------------------
>
>
> --
> shinE!
> http://www.thequod.de ICQ#152282665
> PGP 8.0 key: http://thequod.de/danielhahler.asc

attached mail follows:


On Tue, 2003-12-02 at 18:33, Richard Davey wrote:
> Hello Daniel,
>
> Tuesday, December 2, 2003, 10:46:33 PM, you wrote:
>
> dh> For generation of a random string with length 1.000.000 it takes about
> dh> 13 seconds on my xp 1600+.. that's quite a lot, imho, so suggestions
> dh> are very welcome..
>

I missed the original post, and I'm too lazy to go looking, but the
following code runs in approx. 2.75 seconds on my Athlon 2400 running
linux:

    $chars = '0123456789'
            .'abcdefghijklmnopqrstuvwxyz'
            .'ABCDEFGHIJKLMNOPQRSTUVWXYZ';

    $charArray = array();
                         
    for( $i = 0; $i < 1000000; $i++ )
    {
        $charArray[] = $chars[rand( 0, 61 )];
    }

It's runs much faster than using a .= style of string creation.

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

attached mail follows:


i forgot to mention, that being a class, you should be able to set any of
the variable you want (either on class creation: new honeyPot($value1,
$value2, etc); or with the class variables, $spambot = new honeyPot;
$spambot->addresses = 50; //amount to create)

Luke

attached mail follows:


on Tue, 2 Dec 2003 23:33:47 +0000 Richard Davey wrote:

RD> Just so we're clear on this - you're creating a string (an email
RD> address) of a million characters? I don't know my mail RFC's that well, but
RD> I'm sure this is well beyond what it considers "standard".

We're not clear.. ;)
the function I've posted is designed for templates, that handle the
output my script generates.. it's useful to have non-email text
portions in between or a short random string for the mailto-links
description..

RD> Does the string HAVE to make sense?

I found it better to follow some rules..
At first that were spaces in between and it got bigger.. if I'd write
a spambot I would check if the page I'm lurking on is a oneliner or
does only contain non-email words with > 20 characters, and so on..

--
shinE!
http://www.thequod.de ICQ#152282665
PGP 8.0 key: http://thequod.de/danielhahler.asc

attached mail follows:


on Wed, 3 Dec 2003 10:54:10 +1100 Luke wrote:

L> result on my laptop for default script settings
L> (P4 2.66, 512mb ram)
L> 200000
L> loaded in: 1.3158s

thanks for the test..

L> please tell me what you think of this? if you like it i can email it to you
L> (as a php file)

Looks good, I have already something similar as "generate invalid
addresses" in my project, which only needs translation of the config
section and some logging statistics, which are done in MySQL.

At first, I only wanted to do a floodprotection for the notifybyemail
feature, but now I'm with the whole config part into db.. :o)

Anyone who'd like to betatest this, is very welcomed to drop me an
email.

A release post will also go here..

--
shinE!
http://www.thequod.de ICQ#152282665
PGP 8.0 key: http://thequod.de/danielhahler.asc

attached mail follows:


on 02 Dec 2003 18:56:28 -0500 Robert Cummings wrote:

RC> I missed the original post, and I'm too lazy to go looking, but the
RC> following code runs in approx. 2.75 seconds on my Athlon 2400 running
RC> linux:

it is 4.3 seconds on xp 1600+..

RC> $chars = '0123456789'
RC> .'abcdefghijklmnopqrstuvwxyz'
RC> .'ABCDEFGHIJKLMNOPQRSTUVWXYZ';

RC> $charArray = array();
                         
RC> for( $i = 0; $i < 1000000; $i++ )
RC> {
RC> $charArray[] = $chars[rand( 0, 61 )];
RC> }

RC> It's runs much faster than using a .= style of string creation.

..and replacing "$charArray[] =" with "$s .=" crawls this down to 3.5
seconds - so this is faster here..

winxp, php 4.3.4, Apache 1.xx

--
shinE!
http://www.thequod.de ICQ#152282665
PGP 8.0 key: http://thequod.de/danielhahler.asc

attached mail follows:


final note, for anyone who finds this interesting

in the class, if you update the following 2 variables, this is the proper
list

$this->countrys =
array("",".ac",".ad",".ae",".af",".ag",".ai",".al",".am",".an",".ao",".aq","
.ar",".as",".at",".au",".aw",".az",".ba",".bb",".bd",".be",".bf",".bg",".bh"
,".bi",".bj",".bm",".bn",".bo",".br",".bs",".bt",".bv",".bw",".by",".bz",".c
a",".cc",".cd",".cf",".cg",".ch",".ci",".ck",".cl",".cm",".cn",".co",".cr","
.cu",".cv",".cx",".cy",".cz",".de",".dj",".dk",".dm",".do",".dz",".ec",".ee"
,".eg",".eh",".er",".es",".et",".fi",".fj",".fk",".fm",".fo",".fr",".ga",".g
d",".ge",".gf",".gg",".gh",".gi",".gl",".gm",".gn",".gp",".gq",".gr",".gs","
.gt",".gu",".gw",".gy",".hk",".hm",".hn",".hr",".ht",".hu",".id",".ie",".il"
,".im",".in",".io",".iq",".ir",".is",".it",".je",".jm",".jo",".jp",".ke",".k
g",".kh",".ki",".km",".kn",".kp",".kr",".kw",".ky",".kz",".la",".lb",".lc","
.li",".lk",".lr",".ls",".lt",".lu",".lv",".ly",".ma",".mc",".md",".mg",".mh"
,".mk",".ml",".mm",".mn",".mo",".mp",".mq",".mr",".ms",".mt",".mu",".mv",".m
w",".mx",".my",".mz",".na",".nc",".ne",".nf",".ng",".ni",".nl",".no",".np","
.nr",".nu",".nz",".om",".pa",".pe",".pf",".pg",".ph",".pk",".pl",".pm",".pn"
,".pr",".ps",".pt",".pw",".py",".qa",".re",".ro",".ru",".rw",".sa",".sb",".s
c",".sd",".se",".sg",".sh",".si",".sj",".sk",".sl",".sm",".sn",".so",".sr","
.st",".sv",".sy",".sz",".tc",".td",".tf",".tg",".th",".tj",".tk",".tm",".tn"
,".to",".tp",".tr",".tt",".tv",".tw",".tz",".ua",".ug",".uk",".um",".us",".u
y",".uz",".va",".vc",".ve",".vg",".vi",".vn",".vu",".wf",".ws",".ye",".yt","
.yu",".za",".zm",".zw");
  $this->types = array("com","org","gov","mil","net");

luke

attached mail follows:


> Totally wrong ! It's always better to have maximum work done by MySQL

So does that mean that this:

> $countUser = count($arrayUser);
> for($i = 0; $i < $countUser; $i++){
> $sql = "SELECT email FROM table WHERE id = '" . $arrayUser[$i] .
> "' ";
> }

... is faster than this:

> "SELECT email FROM table WHERE id IN ('" .
> implode("','",$array) . "')";

... ?

--
Cheers!
Dave G
mlautotelic.com

attached mail follows:


Hi!

I have simple table like:

name department
[data: first name] [data: dep. no]
[data: second name] [data: dep. no]

Now I have only sorting which sorts using ORDER BY name. How I
make header name / department active link, which I can change sorting
order Department and then back to Name?

regards,

gustavus

attached mail follows:


On Tue, 2003-12-02 at 21:30, Tommi Virtanen wrote:
> Hi!
>
> I have simple table like:
>
> name department
> [data: first name] [data: dep. no]
> [data: second name] [data: dep. no]
>
> Now I have only sorting which sorts using ORDER BY name. How I
> make header name / department active link, which I can change sorting
> order Department and then back to Name?

If you mean so that the user can click the "department" column heading
and have the data sorted by department, then you can create a link to
the current page with url parameters orderBy and disposition. For
instance:

    myPage.php?orderBy=department&disposition=ascending

Then in your page you can check the values of these and modify the
"ORDER BY" clause of your query. The following example exemplifies what
I'm saying:

     $qString =
        "SELECT "
       ." name, "
       ." department "
       ."FROM "
       ." foo_table "
       ."ORDER BY ";

    if( isset( $_GET['orderBy'] )
        &&
        $_GET['orderBy'] == 'department' )
    {
        $qString .= 'department ';
    }
    else
    {
        $qString .= 'name ';
    }

    if( isset( $_GET['disposition'] )
        &&
        $_GET['disposition'] == 'desc' )
    {
        $qString .= 'DESC ';
    }
    else
    {
        $qString .= 'ASC ';
    }
     
    mysql_query( $qString );
   
HTH,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


Hi i had your php news account setup on my outlook express buti lost it what do i put as the address

Mark

attached mail follows:


news.php.net

and subscribe to the group php.general

make sure you have all your email addresses and stuff setup in the account
because it may ask you to send a confirmation

no user/pass required

--
Luke

"Bigmark" <neretliswestnet.com.au> wrote in message
news:001801c3b948$ba42a6e0$a6aaadcaPEWTER...
Hi i had your php news account setup on my outlook express buti lost it what
do i put as the address

Mark

attached mail follows:


Guys,

A problem arised on my application when a user enters a Unicode format code
on the site. Well, we really catch every information and i really need to
get some explanation about it.

ex:

C = U+0108: Latin Capital Letter C With Circumflex

Now this unicode character does not have any keystroke on my computer, i
only have "Character Map (Windows)" to generate this.

On my php form i can type this clearly, but once preview it changes the
character to Í or something similar (I guess).

But when i used a Unicode character that has a keystroke value ë for example
once preview it generates the correct character.

Any bright ideas on this?

-- -
Louie Miranda
http://www.axishift.com

attached mail follows:


Yeah, i had a similar problem, i dont know if its the same, but i found that
adding
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
in the head of the html output fixed it

Luke
----- Original Message -----
From: "Louie Miranda" <louieaxishift.ath.cx>
Newsgroups: php.general
To: <php-generallists.php.net>
Sent: Wednesday, December 03, 2003 2:09 PM
Subject: Unicode translation

> Guys,
>
> A problem arised on my application when a user enters a Unicode format
code
> on the site. Well, we really catch every information and i really need to
> get some explanation about it.
>
> ex:
>
> C = U+0108: Latin Capital Letter C With Circumflex
>
> Now this unicode character does not have any keystroke on my computer, i
> only have "Character Map (Windows)" to generate this.
>
> On my php form i can type this clearly, but once preview it changes the
> character to Í or something similar (I guess).
>
> But when i used a Unicode character that has a keystroke value ë for
example
> once preview it generates the correct character.
>
> Any bright ideas on this?
>
>
> -- -
> Louie Miranda
> http://www.axishift.com

attached mail follows:


Luke wrote:

>Yeah, i had a similar problem, i dont know if its the same, but i found that
>adding
><meta http-equiv="content-type" content="text/html; charset=UTF-8">
>in the head of the html output fixed it
>
>
Even better, use header('Content-Type: text/html; charset=UTF-8') at the
beginning of your PHP page.

attached mail follows:


Does all unicode characters have an equivalent key-stroke? and in even
different fonts?

-- -
Louie Miranda
http://www.axishift.com

----- Original Message -----
From: "Leif K-Brooks" <eurleifecritters.biz>
To: "Luke" <webmasterbuild3d.com.au>
Cc: <php-generallists.php.net>
Sent: Wednesday, December 03, 2003 11:52 AM
Subject: Re: [PHP] Re: Unicode translation

> Luke wrote:
>
> >Yeah, i had a similar problem, i dont know if its the same, but i found
that
> >adding
> ><meta http-equiv="content-type" content="text/html; charset=UTF-8">
> >in the head of the html output fixed it
> >
> >
> Even better, use header('Content-Type: text/html; charset=UTF-8') at the
> beginning of your PHP page.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


no, but on windows, you should be able to access most of them (depending on
the font) by using ALT+(number pad code)
eg ALT+(num pad)0169 gives you -> ©

Luke

--
Luke
"Louie Miranda" <louieaxishift.ath.cx> wrote in message
news:00e501c3b958$8e4f7b20$020119acadmwebdevws...
> Does all unicode characters have an equivalent key-stroke? and in even
> different fonts?
>
>
> -- -
> Louie Miranda
> http://www.axishift.com
>
>
> ----- Original Message -----
> From: "Leif K-Brooks" <eurleifecritters.biz>
> To: "Luke" <webmasterbuild3d.com.au>
> Cc: <php-generallists.php.net>
> Sent: Wednesday, December 03, 2003 11:52 AM
> Subject: Re: [PHP] Re: Unicode translation
>
>
> > Luke wrote:
> >
> > >Yeah, i had a similar problem, i dont know if its the same, but i found
> that
> > >adding
> > ><meta http-equiv="content-type" content="text/html; charset=UTF-8">
> > >in the head of the html output fixed it
> > >
> > >
> > Even better, use header('Content-Type: text/html; charset=UTF-8') at the
> > beginning of your PHP page.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >

attached mail follows:


Yes, i just learned that windows uses a decimal code and there is a hex
value too.
Well, since some unicode characters dont have a decimal value, its really
getting harder to solve this kind of problems. :(

-- -
Louie Miranda
http://www.axishift.com

----- Original Message -----
"Luke" <webmasterbuild3d.com.au> wrote in message
news:20031203050304.58557.qmailpb1.pair.com...
> no, but on windows, you should be able to access most of them (depending
on
> the font) by using ALT+(number pad code)
> eg ALT+(num pad)0169 gives you -> ©
>
> Luke
>
> --
> Luke

attached mail follows:


I'm not quite following this and I'm not sure what exactly you're having a
problem with, but I'll try to explain some stuff that it looks like will
help.

Unicode(UTF-8) is a variable multi-byte format. Each character is
represented by 1 to 4 bytes, UTF-8 character number 0x108(264) happens to
require 2 bytes.

So, if anything is trying to read UTF-8 characters with the rules for a
single byte character set you will see the C Circumflex as two separate
characters. UTF-8 should display fine on web page if you set the charset
(like the previous emails incstructed you too) and the users OS supports
UTF-8 (Windows 2000 and XP do, probably the recent flavors of linux as
well).

ISO-8859-1 (Which is the most prevalent character set on the internet) is
single-byte. UTF-8 and ISO-8859-1 do share characters, Every character from
0x00(0) to 0x7f(127) in ISO-8859-1 is a single byte character in UTF-8, with
the same nubmer. So if you are trying to display one of these characters in
the other format, it will appear normal, while all UTF-8 characters
0x80(128) and above will be different and not display correctly.

Are you just trying to store data to be able to retrieve it later?

A block of text submitted to a webform maintains the character set of the
webpage that submitted it (at least in my experience, there may be some
exceptions to this though it is dependant on the browser). So you shouldn't
have any problems displaying the data if the character set on the submitting
page and displaying page are identical.

If a character doesn't fall into a particular character set, there is no way
to store it. UTF-8 is a good catch all because it can handle just about any
character out there.

Plenty of information about Unicode can be found here:
http://www.unicode.org/

Chris

-----Original Message-----
From: Louie Miranda [mailto:louieaxishift.ath.cx]
Sent: Tuesday, December 02, 2003 9:21 PM
To: php-generallists.php.net
Subject: Re: [PHP] Re: Unicode translation

Yes, i just learned that windows uses a decimal code and there is a hex
value too.
Well, since some unicode characters dont have a decimal value, its really
getting harder to solve this kind of problems. :(

-- -
Louie Miranda
http://www.axishift.com

----- Original Message -----
"Luke" <webmasterbuild3d.com.au> wrote in message
news:20031203050304.58557.qmailpb1.pair.com...
> no, but on windows, you should be able to access most of them (depending
on
> the font) by using ALT+(number pad code)
> eg ALT+(num pad)0169 gives you -> ©
>
> Luke
>
> --
> Luke

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

attached mail follows:


I'm working on a page which displays details for a given record, and allows
the user to flip back and forth through a large set of records, much like a
set of index cards. "Previous" and "Next" buttons reload the "card" with the
new record id.

It is important that the URLs for the "cards" be very simple and static
(easily bookmarked), along the lines of: "card.php?id=123".

The complexity comes because there are a number of ways in which one would
want to flip back and forth: by date, by creator, etc. We have a select menu
on the card which provides these options.

If the prev/next buttons and select menu are part of a form, one can check
the menu upon the reload of the page and find the correct new id, but the
page in this case will not have a useful, clean URL. Most likely it will
reference the referring card. We don¹t want that.

What we need is a way of saying "if the menu says date, use this id", etc.

It seemed to me that we might be looking at problem requiring a client-side
solution, but my javascript experiments have been frustrating, and seem to
be veering into browser-conditional waters - one of the great arguments for
server-side scripting.

Still the js approach has been closest to what we need: the php script puts
all the possible links from that card into the page, and then the js
function uses the correct one.

Does anyone have any advice?

Thanks

-eric

attached mail follows:


you might be able to put the id of the next/prev card as the value of the
<option>
and then use javascript to generate the url.

the only reliance then would be that the browser as JS enabled, as the above
should be possible with the most basic of JS

HTH
Martin

> -----Original Message-----
> From: Eric Blanpied [mailto:listsblanpied.net]
> Sent: Wednesday, 3 December 2003 2:05 PM
> To: php-general
> Subject: [PHP] Conditional anchor href value
>
>
> I'm working on a page which displays details for a given
> record, and allows
> the user to flip back and forth through a large set of
> records, much like a
> set of index cards. "Previous" and "Next" buttons reload the
> "card" with the
> new record id.
>
> It is important that the URLs for the "cards" be very simple
> and static
> (easily bookmarked), along the lines of: "card.php?id=123".
>
> The complexity comes because there are a number of ways in
> which one would
> want to flip back and forth: by date, by creator, etc. We
> have a select menu
> on the card which provides these options.
>
> If the prev/next buttons and select menu are part of a form,
> one can check
> the menu upon the reload of the page and find the correct new
> id, but the
> page in this case will not have a useful, clean URL. Most
> likely it will
> reference the referring card. We don¹t want that.
>
> What we need is a way of saying "if the menu says date, use
> this id", etc.
>
> It seemed to me that we might be looking at problem requiring
> a client-side
> solution, but my javascript experiments have been
> frustrating, and seem to
> be veering into browser-conditional waters - one of the great
> arguments for
> server-side scripting.
>
> Still the js approach has been closest to what we need: the
> php script puts
> all the possible links from that card into the page, and then the js
> function uses the correct one.
>
> Does anyone have any advice?
>
> Thanks
>
> -eric
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> __________ Information from NOD32 1.568 (20031202) __________
>
> This message was checked by NOD32 for Exchange e-mail monitor.
> http://www.nod32.com
>
>
>
>

attached mail follows:


--- Eric Blanpied <listsblanpied.net> wrote:
> Still the js approach has been closest to what we need: the php script
> puts all the possible links from that card into the page, and then the
> js function uses the correct one.
>
> Does anyone have any advice?

Let PHP choose the correct one?

Maybe something like this will work:

<a href="foo.php?bar=<? echo $bar; ?>">Click here</a>

Then, you can let PHP choose what the appropriate value of bar should be.
Show us some code, and I'm sure we can give you more specific examples.

Chris

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

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

attached mail follows:


    Chris Shiflett wrote:

> --- Eric Blanpied <listsblanpied.net> wrote:
>> Still the js approach has been closest to what we need: the php script
>> puts all the possible links from that card into the page, and then the
>> js function uses the correct one.
>>
>> Does anyone have any advice?
>
> Let PHP choose the correct one?
>
> Maybe something like this will work:
>
> <a href="foo.php?bar=<? echo $bar; ?>">Click here</a>
>
> Then, you can let PHP choose what the appropriate value of bar should be.

The trouble is that the value of $bar is dependent on the value of a select
list. And, as noted in my original post, the hrefs for the pages need to end
up being nice, static URLs which cleanly point to the correct data.

-e

attached mail follows:


    Martin Towell wrote:

> you might be able to put the id of the next/prev card as the value of the
> <option>
> and then use javascript to generate the url.
>
> the only reliance then would be that the browser as JS enabled, as the above
> should be possible with the most basic of JS

That's not all that different from what I'm doing. The following gets called
from the left arrow graphic:

function getLinkLeft(form) {
    var prevDate= <?php echo "\"$prevDate\""; ?>;
    var prevSrce= <?php echo "\"$prevSrce\""; ?>;
    
    if (form.setarrows.value == "date") {
        location=prevDate;
    } else {
        location=prevResults;
    }
}

...

<a href="javascript:getLinkLeft(self)"><img src="arrow.gif"></a>

I know next-to-no javascript, so this has all been cobbled together via an
afternoon's research. It appears to be what _should_ work, but it only
behaves in one browser out of six I've tried (Safari).

I'd just as soon ditch the JS, since I don't want to rely on it being
enabled for this site. I just can't think of a server-side approach.

-e

attached mail follows:


Hi there,
I'm sure this is an easy fix, but how do you either prevent users from being
able to input " " in a field or make it so that it doesn't affect the code?

Thanks in advance,
Dimitri Marshall

attached mail follows:


--- Dimitri Marshall <webmasterdyntdesign.com> wrote:
> how do you either prevent users from being able to input " " in a
> field or make it so that it doesn't affect the code?

Can you give an example of affecting the code? You can store spaces in
variables just fine.

Chris

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

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

attached mail follows:


Sorry, what I mean is...

I have a field in a form where users input text.

If the user inputs something like: Hi there, "this is a quote" and you
should know it.

Then only... <Hi there, > get's inserted because of the double quotes.

Is that more clear?

Dimitri Marshall

"Chris Shiflett" <shiflettphp.net> wrote in message
news:20031203033701.81274.qmailweb14307.mail.yahoo.com...
> --- Dimitri Marshall <webmasterdyntdesign.com> wrote:
> > how do you either prevent users from being able to input " " in a
> > field or make it so that it doesn't affect the code?
>
> Can you give an example of affecting the code? You can store spaces in
> variables just fine.
>
> Chris
>
> =====
> Chris Shiflett - http://shiflett.org/
>
> PHP Security Handbook
> Coming mid-2004
> HTTP Developer's Handbook
> http://httphandbook.org/

attached mail follows:


Hello Dimitri,

Wednesday, December 3, 2003, 3:28:19 AM, you wrote:

DM> I'm sure this is an easy fix, but how do you either prevent users from being
DM> able to input " " in a field or make it so that it doesn't affect the code?

Assuming you mean the double quote marks, and not a blank space, use
the function htmlspecialchars() to convert the double quotes into PHP
and SQL friendly HTML entities.

--
Best regards,
 Richard mailto:richlaunchcode.co.uk

attached mail follows:


Try using htmlentities() to convert the characters to the html entities
that can be stored and displayed.

http://www.php.net/htmlentities

Jason

Dimitri Marshall wrote:

>Sorry, what I mean is...
>
>I have a field in a form where users input text.
>
>If the user inputs something like: Hi there, "this is a quote" and you
>should know it.
>
>Then only... <Hi there, > get's inserted because of the double quotes.
>
>Is that more clear?
>
>Dimitri Marshall
>
>
>"Chris Shiflett" <shiflettphp.net> wrote in message
>news:20031203033701.81274.qmailweb14307.mail.yahoo.com...
>
>
>>--- Dimitri Marshall <webmasterdyntdesign.com> wrote:
>>
>>
>>>how do you either prevent users from being able to input " " in a
>>>field or make it so that it doesn't affect the code?
>>>
>>>
>>Can you give an example of affecting the code? You can store spaces in
>>variables just fine.
>>
>>Chris
>>
>>=====
>>Chris Shiflett - http://shiflett.org/
>>
>>PHP Security Handbook
>> Coming mid-2004
>>HTTP Developer's Handbook
>> http://httphandbook.org/
>>
>>
>
>
>

attached mail follows:


i use

  echo "<SCRIPT language=\"JavaScript\">\n";
  echo "javascript:top.location.href='{$placetogo}';\n";
  echo "</SCRIPT>";

and if you want to refresh a specific frame, replace top in the script for
the frame name
--
Luke

"Christian Jancso" <christiancafe.ch> wrote in message
news:3FCC9DE0.FE2AC2A2cafe.ch...
> Hi there
>
> I have some problems with PHP.
>
> I have a website with different frames where different actions take
> place.
> One frame needs a button (here: "Delete") which:
> 1. reloads another frame
> 2. reloads itself
>
> The code looks like:
>
> if (isset($_POST['action']))
> {
> if ($_POST['action'] == "Delete")
> {
> $id = $_POST['absolute'];
>
> $activity = mysql_query("SELECT id FROM
> activity WHERE station = '$station'");
> $activity_fetch = mysql_fetch_array($activity);
>
> $delete_activity = mysql_query("DELETE FROM
> activity where id = '$id'");
>
> $update_stations = mysql_query("UPDATE
> stations set status = 1, timestatus = 0 where station = '$station'");
>
> header("Location: http://127.0.0.1/empty.php");
>
> }
> }
>
> With HTML it is <body onload="........">. But this doesn`t work here
> because I have sent the header already.
> Can anyone help me?
>
>
> TIA
> Christian
> --
> ----------------------------
> NextNet IT Services
> Christian Jancso
> phone +41.1.210.33.44
> facsimile +41.1.210.33.13
> ----------------------------

attached mail follows:


I have a new installation of PHP 4.1.2 and it appears I cannot run php
scripts outside of apache root directory. I look at phpinfo() and I saw
Virtual Directory Support is set to disabled. I'm suspecting this could me
the problem, but I have not been able to find anything on google or the
lists explaining how to enable this.

Any help is appreciated.

attached mail follows:


that should do it :)
<?

$first_date = "2003-12-01";
$end_date = "2004-01-15";

$ufirst = strtotime($first_date);
$uend = strtotime($end_date);
echo "ufirst: " . $ufirst;
echo "<br>uend: " . $uend;
while($ufirst <= $uend){
 //do other stuff here, insert into database etc
 $ufirst = strtotime("+1 day", $ufirst);
 $formatted = date("d/m/Y", $ufirst);
 echo "<br>ufirst: " . $ufirst . " : " . $formatted;
}

?>

---
Luke

"Tommi Virtanen" <mailinglistgwad.net> wrote in message
news:6.0.0.22.2.20031202105039.03868be862.165.180.66...
> Hi!
>
> $first_date = 2003-12-01
> $end_date = 2004-01-15
>
>
> while ( $first_date <= $end_date) {
>
> $sql = "INSERT INTO time_table (id, date, person_id) VALUES
> (35,$first_date,0)";
> $result = mysql_query($sql, $conn);
>
> [next date] WHAT CODE TO HERE????
>
> }
>
> eg.
>
> first insert row is 35, 2003-12-01,0
> next should be 35,2003-12-02,0 etc....
> ...
> and last 35,2004-01-15,0

attached mail follows:


At the moment this code accepts changes and deletes from the Db but when the
submit button is pressed it echos------------- 'Record updated/edited' and i
have to go back and refresh to view the updated list, how can i just have it
refresh. When you open the file it shows the list but when editing it
disappears.

<html>

<?php
$db = mysql_connect("localhost", "root");

mysql_select_db("mydb",$db);

if ($submit) {

  // here if no ID then adding else we're editing

  if ($id) {

    $sql = "UPDATE employees SET first='$first',last='$last' WHERE id=$id";

  } else {

    $sql = "INSERT INTO employees (first,last) VALUES ('$first','$last')";

  }

  // run SQL against the DB

  $result = mysql_query($sql);

  echo "Record updated/edited!<p>";

} elseif ($delete) {

// delete a record

    $sql = "DELETE FROM employees WHERE id=$id";

    $result = mysql_query($sql);

    echo "$sql Record deleted!<p>";

} else {

  // this part happens if we don't press submit

  if (!$id) {

 // print the list if there is not editing

    $result = mysql_query("SELECT * FROM employees",$db);

    while ($myrow = mysql_fetch_array($result)) {

 printf("<ahref=\"%s?id=%s\">%s- V - %s......</a>\n", $PHP_SELF,
$myrow["id"], $myrow["first"],$myrow["last"]);

   printf("<a href=\"%s?id=%s&delete=yes\">(DELETE)</a><br>", $PHP_SELF,
$myrow["id"]);

    }

  }

  ?>

  <P>

<br>

  <P>

  <form method="post" action="<?php echo $PHP_self?>">

  <?php

  if ($id) {

    ?>

    <input type=hidden name="id" value="<?php echo $id ?>">
  <?php

  }

  ?>
  Team A:<input type="Text" name="first" value="<?php echo $first?>">
<br><br>
  Team B:<input type="Text" name="last" value="<?php echo $last ?>"><br><br>

      <input type="Submit" name="submit" value="Enter Team Names">

  </form>

<?php

}

?>
</body>

</html>

attached mail follows:


Hello BigMark,

Wednesday, December 3, 2003, 6:04:03 AM, you wrote:

B> At the moment this code accepts changes and deletes from the Db but when the
B> submit button is pressed it echos------------- 'Record updated/edited' and i
B> have to go back and refresh to view the updated list, how can i just have it
B> refresh. When you open the file it shows the list but when editing it
B> disappears.

The problem is that you're only printing the list if there has been no
editing of the database, when in actual fact you want to print the
list regardless.

Why not just remove this part?

  // this part happens if we don't press submit
  if (!$id) {

--
Best regards,
 Richard mailto:richlaunchcode.co.uk

attached mail follows:


Nope that didnt work!

attached mail follows:


Once again, I have a new version of my DHCP web page. The major fix in this
one is that it does an "nmap -v -p 80 192.168.1.0/24" (thanks to Mike Klinke
for the idea) to re-populate the "arp -n". The old version of my program
would not always show ALL devices on the network. Some would also show up as
"incomplete". I have removed all incomplete ones for this version, but you
could simply comment out the line to put them back if you want them. You can
specify the server's IP manually (as in the case of dual NIC cards), or let
the script figure it out for you.

http://daevid.com/examples/dhcp/

Daevid.

> -----Original Message-----
> From: Daevid Vincent [mailto:daeviddaevid.com]
> Sent: Monday, July 28, 2003 9:41 PM
> To: php-generallists.php.net
> Subject: [PHP] DHCP web interface. New version.
>
> Heya. I've just put up a new version of the DHCP web front
> end if anyone is
> using it or has a need for this type of thing.
>
> Major feature of this version:
>
> * a bug where if the arp table showed an "(incomplete)", I
> ignored the entry
> since the MAC is the hash key, many machines wouldn't show
> up as they kept
> over writing each other (of course, they were bunk anyways)
> * ping & nmap tests (if ping fails, nmap is used as a backup)
> this is useful for firewalls that may block ICMP
> * tests can be disabled for radically faster page rendering
> (off by default)
> * 10 minute refresh by default rather than 10 second.
> * SORTING! by IP now, rather than arp entries
> * many more icons (tivo, zaurus, replay, linux, notebook,
> servers, DAR, etc)
> * complete/incomplete tally
> * Name in config file is only used if dhcp doesn't show a name already
>
> This is also IMHO an excellent way for a beginer or advanced
> coder alike to
> see some very useful OOP/PHP coding as I use arrays of
> objects, sorting by
> variables IN the object (custom sort algorithm with key
> integrity), hashing,
> system calls, regex parsing, DHTML, etc.
>
> If anyone knows how to force the arp table to be current,
> that would help.
> Sometimes a machine is on the network, and I *know* for a
> fact it is, but it
> doesn't show up in "arp -n" *grumble*.
>
> Follow the link below.
> http://daevid.com/examples/dhcp/

attached mail follows:


umm... It all looks good except this one :

        function foo::f ()

This is where you get the T_ error. Dont know what you are
trying to do here, but thats the error anyways, :)

Your first example is all correct,

    // myclass.inc.php
    class foo
    {
        // constructor and destructor
        function f () {}
    }

Dont know if it helps you though.

--
Kim Steinhaug
---------------------------------------------------------------
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
---------------------------------------------------------------

"Callum Urquhart" <callumdevnet-uk.net> wrote in message
news:20031202175534.94665.qmailpb1.pair.com...
> This may well have come up before as it is an obvious problem/question.
>
> Coming from a C++ background, I define a class in a header file and define
> the functions for that class in a seperate source file. Now the question:
is
> this possible in PHP4?
>
> I have tried the obvious:
>
> // myclass.inc.php
>
> class foo
> {
> // constructor and destructor
> function f () {}
> }
>
>
> // myclass.php
>
> function foo::f ()
> {
> // define here
> }
>
>
> This gives me an error: unexpected T_PAAMAYIM_NEKUDOTAYIM
> Is this possible in PHP4, and if not, why not? It's an obvious problem,
> namely for code management.
>
>
> -Callum Urquhart
> www.pastecode.net

attached mail follows:


2003-12-02 kl. 12.23 skrev Manuel Lemos:

> You just need to use the proper input/output encodings.

Doesn't work at all…

The code

// Prepare the content of the xml-file to go to the xsl-parser
$xml = str_replace("?", chr(63), $contents);
$xml = str_replace("<empty/>", $kurt, $xml);
$xml = trim($xml);
$xml = utf8_encode($xml);
echo $xml;
makes the string

"<?xml version="1.0" encoding="utf-8"?>"

become

"<?xml version="1.0" encoding="utf-8"?>"

And the crap in fron of the string, which seems to come from nowhere,
makes the parser complain about not well formed markup in the
xml-source…

Regards,

Victor

attached mail follows:


Hi all:

Having some doubts with sql select queries here :

Right now, I have a "student" and a "withdraw" tables.
For example, when student "John" has withdrawn, his name will be inserted
into "withdraw" table but John's record will be kept in "student" table for a
period of 30 days before it is deleted from "student" table. In the meantime,
in "student" table, the status for John should be set to "0" (inactive).
Wonder the solutions I have mentioned is possible? And if so, how shld i go
about doing it ??....Hope to get some help really soon...Thanks in advance!

    student table withdraw table
----------------------- -------------------------------------
|student_name | status | student_name | withdraw_reason
----------------------- -------------------------------------
| John | 0 | John | migrate
----------------------- -------------------------------------
| James | 1 |
-----------------------

Regards,
Irin Chiang.

attached mail follows:


Hallo People,

I have one problem with creating images on-fly.

Therefore I created 2 files:

1. resize_image.php with the following

<?php

if (!$max_width)

$max_width = 150;

if (!$max_height)

$max_height = 100;

$size = GetImageSize($image);

$width = $size[0];

$height = $size[1];

$x_ratio = $max_width / $width;

$y_ratio = $max_height / $height;

if ( ($width <= $max_width) && ($height <= $max_height) ) {

$tn_width = $width;

$tn_height = $height;

}

else if (($x_ratio * $height) < $max_height) {

$tn_height = ceil($x_ratio * $height);

$tn_width = $max_width;

}

else {

$tn_width = ceil($y_ratio * $width);

$tn_height = $max_height;

}

$src = ImageCreateFromJpeg($image);

$dst = ImageCreate($tn_width,$tn_height);

ImageCopyResized($dst, $src, 0, 0, 0, 0,

$tn_width,$tn_height,$width,$height);

header("Content-type: image/jpeg");

ImageJpeg($dst, null, -1);

ImageDestroy($src);

ImageDestroy($dst);

?>

AND

2. filex.php .In that file i read from database where the image is stored en

then i show small images(thumbnails).

thet part of the code is :

<?php do { ?>

<tr>

<td width="156" height="32" valign="top"><?php echo

$row_rsSubGroup['name']; ?></td>

<td colspan="2" valign="top"><?php

$fotolink="../dbtest/".$row_rsSubGroup['image_1']);

echo "<IMG

SRC=\"resize_image.php?image=$fotolink\">";

?>

</td>

</tr>

<?php } while ($row_rsSubGroup = mysql_fetch_assoc($rsSubGroup)); ?>

This doesn't WORK. Please HELP.