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 16 Jun 2003 19:18:44 -0000 Issue 2121

php-general-digest-helplists.php.net
Date: Mon Jun 16 2003 - 14:18:44 CDT


php-general Digest 16 Jun 2003 19:18:44 -0000 Issue 2121

Topics (messages 151642 through 151710):

Re: php editor?
        151642 by: Lars Torben Wilson
        151645 by: Wim Paulussen
        151653 by: PHPSpooky
        151675 by: James Hatridge
        151679 by: Stefan Dengscherz
        151686 by: Noel Wade
        151687 by: Chris Sherwood

Reverse Phone Number Lookup in importable format
        151643 by: Peter Janett

need config file parsing code.
        151644 by: Daevid Vincent
        151647 by: Lars Torben Wilson

speed on XML files
        151646 by: Diana Castillo
        151652 by: Catalin Trifu
        151660 by: Diana Castillo
        151670 by: Robert Cummings

Re: Zend encoding and security
        151648 by: Zeev Suraski

Software Testing and Internationalization - Free book by LISA/Lemoine International
        151649 by: Alex Lam

error reporting linenumber and filename
        151650 by: Bas Jobsen
        151662 by: Marek Kilimajer

Re: error reporting linenumber and filename[Scanned]
        151651 by: Michael Egan
        151654 by: Bas Jobsen
        151658 by: Ford, Mike [LSS]

Re: Variable variables question?
        151655 by: Ford, Mike [LSS]

Re: Please I need help it's very Urgent (Prevent un-authorized users to download document)
        151656 by: Mishari
        151699 by: Sebastian

Re: Very Weird Problem Continued
        151657 by: Ford, Mike [LSS]

Re: rows by day
        151659 by: Hugh Bothwell

fopen on foto
        151661 by: Diana Castillo

Good PHP Books
        151663 by: Mark McCulligh
        151664 by: Dan Joseph
        151668 by: Mike Brum
        151671 by: Mark McCulligh
        151673 by: John Nichel
        151678 by: Mark McCulligh
        151691 by: Brad Dameron

PhpMyAdmin / MySQL
        151665 by: Pushpinder Singh Garcha

Re: ACL howto
        151666 by: Ernest E Vogelsinger

Re: PHP help/example for booking program
        151667 by: Giuliano
        151692 by: Noel Wade
        151693 by: Brad Dameron

Re: Capturing the input of dynamic form fields (part II)
        151669 by: Terje Torkelsen

WARNING: FW: Virus Found in message "[PHP-DB] Re Now how about Roman Numerals?"
        151672 by: Marios Adamantopoulos
        151696 by: Miles Thompson
        151697 by: Jason Wong

Help inserting compressed data into a mysql database
        151674 by: Mr Percival
        151676 by: Bas Jobsen

interact with .htaccess
        151677 by: Miguel Angelo

HTML...
        151680 by: Johnny Martinez
        151681 by: Van Andel, Robbert
        151682 by: Stefan Dengscherz
        151683 by: Marek Kilimajer
        151684 by: Cal Evans

mysql_errno codes
        151685 by: Thomas Hochstetter
        151688 by: Jay Blanchard
        151689 by: Jeff Harris
        151690 by: David Nicholson
        151701 by: Thomas Hochstetter

Server-initiated HTTP requests
        151694 by: Sander
        151695 by: Brad Dameron
        151698 by: Jason Wong
        151700 by: Sapporo

Emptying the browser cache
        151702 by: Don
        151703 by: Jason Wong
        151706 by: user.domain.invalid
        151707 by: Thomas Bolioli

str_replace() problems actually *_replace() problems to be more accurate
        151704 by: Thomas Bolioli
        151709 by: Terje Torkelsen

two php installations
        151705 by: Terje Torkelsen

timing out exec statements
        151708 by: Dave [Hawk-Systems]

REGISTER_SHUTDOWN_FUNCTION() -- Still Not Working.
        151710 by: Jason Caldwell

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:


On Sun, 2003-06-15 at 22:34, M-Ali Mahmoodi wrote:
> if no newer editors?
> so the old messages suggest the older!

I wasn't suggesting that people not suggest new editors. People
just don't need to argue about it (at least, not on the list).

Cheers,

Torben

> "Lars Torben Wilson" <torbenphp.net> wrote in message
> news:1055624493.879.6.camelali...
> > On Sat, 2003-06-14 at 12:59, electroteque wrote:
> > > boy how painfully dweebish is vi why make it harder for yourself :O
> >
> > Please don't start this again. If you want arguments about editors just
> > read the old ones in the archives. It's highly unlikely that any useful
> > new arguments will be made if we start a new flamewar over it. :) Just
> > suggesting one or two editors you like is more useful.

--
 Torben Wilson <torbenphp.net> +1.604.709.0506
 http://www.thebuttlesschaps.com http://www.inflatableeye.com
 http://www.hybrid17.com http://www.themainonmain.com
 -----==== Boycott Starbucks! http://www.haidabuckscafe.com ====-----

attached mail follows:


My two cents : jEdit
main reasons why :
- syntax highlighting
- works on Linux and Windows (java-based)
- full folding capabilities

Wim

-----Oorspronkelijk bericht-----
Van: M-Ali Mahmoodi [mailto:ma-mahmoodiqom.ac.ir]
Verzonden: Monday, June 16, 2003 7:35 AM
Aan: php-generallists.php.net
Onderwerp: Re: [PHP] php editor?

if no newer editors?
so the old messages suggest the older!

"Lars Torben Wilson" <torbenphp.net> wrote in message
news:1055624493.879.6.camelali...
> On Sat, 2003-06-14 at 12:59, electroteque wrote:
> > boy how painfully dweebish is vi why make it harder for yourself :O
>
> Please don't start this again. If you want arguments about editors just
> read the old ones in the archives. It's highly unlikely that any useful
> new arguments will be made if we start a new flamewar over it. :) Just
> suggesting one or two editors you like is more useful.
>
>
>
> --
> Torben Wilson <torbenphp.net> +1.604.709.0506
> http://www.thebuttlesschaps.com http://www.inflatableeye.com
> http://www.hybrid17.com http://www.themainonmain.com
> -----==== Boycott Starbucks! http://www.haidabuckscafe.com ====-----
>
>
>

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

attached mail follows:


Glory!

UltraEdit (www.ultraedit.com) for windows.. my vote goes for it. Not too
expensive, and way too bright. Been using it for 3 years without a bit
of hesitation.

Zend is pretty good too, if you can afford it.

And big UP to you Ryan A.!! Totally rock man!

Supremacy,
PHPSpooky

______________________________________
"If God had wanted me otherwise, He would have created me otherwise."
 - Johann Wolfgang von Goethe

attached mail follows:


Hi John et al,,
On Sunday 15 June 2003 02:09, John Nichel wrote:

>Linux I use Quanta.

Do you know how (or if) to get Quanta to color code PHP like it does html? If
I could get that then Quanta would be almost perfit.

Thanks

JIM

--
Jim Hatridge
Linux User #88484
------------------------------------------------------
                 BayerWulf
           Linux System # 129656
         The Recycled Beowulf Project
  Looking for throw-away or obsolete computers and parts
   to recycle into a Linux super computer

attached mail follows:


Hi James,

Quanta has built in syntax highlighting for PHP; i have made a small
screenshot: http://www.chowned.us/sd/quanta-php.png

regards

Am Mon, 2003-06-16 um 17.49 schrieb James Hatridge:
> Hi John et al,,
> On Sunday 15 June 2003 02:09, John Nichel wrote:
>
> >Linux I use Quanta.
>
> Do you know how (or if) to get Quanta to color code PHP like it does html? If
> I could get that then Quanta would be almost perfit.
>
> Thanks
>
> JIM
>
> --
> Jim Hatridge
> Linux User #88484
> ------------------------------------------------------
> BayerWulf
> Linux System # 129656
> The Recycled Beowulf Project
> Looking for throw-away or obsolete computers and parts
> to recycle into a Linux super computer
>

attached mail follows:


My favorite little gem is a shareware program called Code-Genie
(www.code-genie.com). Its cheap, fast, a "slim" app, provides tons of
useful little features, and has TOTALLY user-configurable text-coloring.
You can specify a particular coloring scheme for each file extension, so it
automatically picks the scheme for the type of programming you're doing -
very handy! Comes with schemes for all of the most common / simple
programming languages, plus plenty of user-made files for download, too!

It doesn't have any real debugging features, nor can it do fancy things like
track your custom object-functions and color them or present their
arguments - but for a quick, simple, helpful tool - its just perfect!

Take care,

--Noel

attached mail follows:


I use PHPCoder Pro and it works great... hook it into your php and apache
engines and you can run and debug while coding

----- Original Message -----
From: "Noel Wade" <noel.wadechironcompany.com>
To: <php-generallists.php.net>
Sent: Monday, June 16, 2003 9:57 AM
Subject: Re: [PHP] Re: php editor?

> My favorite little gem is a shareware program called Code-Genie
> (www.code-genie.com). Its cheap, fast, a "slim" app, provides tons of
> useful little features, and has TOTALLY user-configurable text-coloring.
> You can specify a particular coloring scheme for each file extension, so
it
> automatically picks the scheme for the type of programming you're doing -
> very handy! Comes with schemes for all of the most common / simple
> programming languages, plus plenty of user-made files for download, too!
>
> It doesn't have any real debugging features, nor can it do fancy things
like
> track your custom object-functions and color them or present their
> arguments - but for a quick, simple, helpful tool - its just perfect!
>
> Take care,
>
> --Noel
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


I'm looking to do a lookup on a list of my incoming phone numbers.
(Basically adding name to a number only caller ID setup.)

I've found a couple sites that allow reverse phone number lookups, most
notably anywho.com, by I'm hoping to find something that would allow me to
easily get the data retuned from a lookup into my PHP application. (XML
would seem the best option, but I'd settle for anything.)

I'm hoping I don't have to try to write a clumsy "web scraper" type thing
using to process this. It's a prototype, so the legalities of mass use can
come later. In other words, a non free option would be viable long term,
and I'm hoping to avoid a legal discussion about scraping this kind of data,
privacy, etc.

Any ideas, resources, etc would be most appreciated.

Thanks,

Peter Janett

New Media One Web Services, LLC
http://www.newmediaone.net
webmaster "at" newmediaone.net
(303)828-9882

attached mail follows:


I am writing an open source web page that I can't believe doesn't exist
already. basically i want to see all the DHCP clients on my network AND
their nice windows names -- that is the tricky part -- I can't find a
tool that does that part. GRRR...
 
Anyways, here is what I have so far if you want to see it:
http://daevid.com/examples/dhcp/index.php
 
To match up the names however I need to parse the
/var/lib/dhcp/dhcp.leases file and map the "client-hostname" tag to the
proper MAC address.
 
So my question is, does anyone have some code (PHP preferred obviously,
but any language should work or be portable) that will take a file of
the form below and split it into the chunks required. Or anything even
close? For example, a 'chunk' would be between the { and } . I'm sure I
can figure this out, but before I go re-inventing the wheel, thought
someone might have done this already to some degree.
 
lease 192.168.1.3 {
  starts 1 2003/06/16 07:38:55;
  ends 1 2003/06/16 07:48:55;
  binding state active;
  next binding state free;
  hardware ethernet 00:80:45:31:d8:29;
}
lease 192.168.1.6 {
  starts 1 2003/06/16 07:39:27;
  ends 1 2003/06/16 07:49:27;
  binding state active;
  next binding state free;
  hardware ethernet 48:54:e8:26:23:38;
  uid "\001HT\350&#8";
  client-hostname "jme";
}
 
when the script is finished I'll post it up for anyone to use on their
own servers...
 
by the way, does anyone know why "arp -n" (what i'm using) shows
machines that are NOT even turned on? like my notebook shows up despite
having been off for several hours? Is there a way to get a real time
list of the machines on my network? I thought that's what arp did, but
apparently not. :(
 
d

attached mail follows:


On Mon, 2003-06-16 at 01:14, Daevid Vincent wrote:
> So my question is, does anyone have some code (PHP preferred obviously,
> but any language should work or be portable) that will take a file of
> the form below and split it into the chunks required. Or anything even
> close? For example, a 'chunk' would be between the { and } . I'm sure I
> can figure this out, but before I go re-inventing the wheel, thought
> someone might have done this already to some degree.
>
> lease 192.168.1.3 {
> starts 1 2003/06/16 07:38:55;
> ends 1 2003/06/16 07:48:55;
> binding state active;
> next binding state free;
> hardware ethernet 00:80:45:31:d8:29;
> }
> lease 192.168.1.6 {
> starts 1 2003/06/16 07:39:27;
> ends 1 2003/06/16 07:49:27;
> binding state active;
> next binding state free;
> hardware ethernet 48:54:e8:26:23:38;
> uid "\001HT\350&#8";
> client-hostname "jme";
> }

I just banged this off the top of my head. Little error checking but you
should be able to see where to add it. It should be tweakable for what
you need, at least to get you going.

<?php
error_reporting(E_ALL);
ini_set('display_errors', true);

class LeaseParser {
    // List designators valid within lease blocks here.
    // Add/modify/remove to suit.
    var $_valid_items =
    array('starts 1',
          'ends 1',
          'binding state active',
          'next binding state',
          'hardware ethernet',
          'uid',
          'client-hostname');

    // Stores any errors we generate during the run. Theses can be
output
    // directly by calling showErrors();
    var $_errors;

    // Storage for the contents of the lease file while it's being
working on.
    var $_file_contents;

    // Stores the parsed lease array.
    var $_leases;

    // Put any options you want to define in here, and use setOption()
to modify
    // it.
    var $_options =
    array('file_name' => '');

    // Private method. Attempts to load the leases file.
    function _loadFile() {
        if (!$fp = fopen($this->_options['file_name'], 'r')) {
            $this->_errors[] = "LeaseParser::_loadFile(): Failed to load
{$this->_options['file_name']}";
            return false;
        }

        if (!$file = fread($fp, filesize($this->_options['file_name'])))
{
            $this->_errors[] = "LeaseParser::_loadFile(): Failed to read
{$this->_options['file_name']}";
            return false;
        }

        $this->_file_contents =& $file;

        return true;
    }

    
    // Private method. Attempts to parse the loaded file contents into a
usable format.
    function _parseFile() {
        if (empty($this->_file_contents)) {
            $this->_errors[] = "LeaseParser::_parseFile(): No leases
file data to parse.";
            return false;
        }

        $f_temp = explode('}', $this->_file_contents);

        $leases = array();

        foreach ($f_temp as $lease_record) {
// echo "<hr>";
// print_r($lease_record);
            if (!preg_match('/^\s*lease
(([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3}))/i',
$lease_record, $lease_matches)) {
                continue;
            }
// echo "{$lease_matches[1]}\n";
            $leases[$lease_matches[1]] = array();
            $working_lease =& $leases[$lease_matches[1]];
            foreach ($this->_valid_items as $valid_item) {
                $matches = array();
                $pattern = "/ *({$valid_item}) (.*)\n/i";
// echo "Checking for $valid_item; $pattern\n";
                if (!preg_match_all($pattern, $lease_record, $matches,
PREG_SET_ORDER)) {
                    continue;
                }
// echo "-----\n";
// print_r($matches);
                $working_lease[$matches[0][1]] = $matches[0][2];
            }
        }

// print_r($leases);

        $this->_leases = $leases;

        return true;
    }

    // If a leases file has been loaded and parsed, this will return
    // the generated array.
    function getLeases() {
        if (!empty($this->_leases)) {
            return $this->_leases;
        }
    }

    // Called by the user to load and parse a lease file. The filename
    // must have already been set.
    function parse() {
        if (!$this->_loadFile()) {
            $this->_errors[] = "LeaseParser::parse(): Could not load
leases file.";
            return false;
        }
        if (!$this->_parseFile()) {
            $this->_errors[] = "LeaseParser::parse(): Could not parse
leases file.";
            return false;
        }
        return true;
    }

    // Sets an option. The option must be defined in $_options.
    function setOption($option, $value) {
        if (!isset($this->_options[$option])) {
            $this->_errors[] = "LeaseParser::setOption(): Attempt made
to set illegal option.";
            return false;
        }
        $old_val = $this->_options[$option];
        $this->_options[$option] = $value;
        return $old_val;
    }

    // Dump any errors to output.
    function showErrors() {
        if (empty($this->_errors)) {
            return false;
        }
        print_r($this->_errors);
        return true;
    }
    

    // Null contstructor.
    function LeaseParser() {
    }
}

$lp =& new LeaseParser();
$lp->setOption('file_name', 'leases.txt');
$lp->parse();
$leases = $lp->getLeases();
print_r($leases);
$lp->showErrors();
?>

> when the script is finished I'll post it up for anyone to use on their
> own servers...
>
> by the way, does anyone know why "arp -n" (what i'm using) shows
> machines that are NOT even turned on? like my notebook shows up despite
> having been off for several hours? Is there a way to get a real time
> list of the machines on my network? I thought that's what arp did, but
> apparently not. :(
>
> d

IIRC it's because arp deals with the kernel cache, not necessarily the
live data. Wouldn't bet my life on it though.

Hope this helps,

Torben

--
 Torben Wilson <torbenphp.net> +1.604.709.0506
 http://www.thebuttlesschaps.com http://www.inflatableeye.com
 http://www.hybrid17.com http://www.themainonmain.com
 -----==== Boycott Starbucks! http://www.haidabuckscafe.com ====-----

attached mail follows:


I have problems receiving large xml files, they take too long, does anyone
have a solution?
thank you,
Diana

attached mail follows:


    Hi,

    Receiving from where ?

Cheers,
Catalin

"Diana Castillo" <dianainterhotel.com> wrote in message
news:20030616090701.87536.qmailpb1.pair.com...
> I have problems receiving large xml files, they take too long, does anyone
> have a solution?
> thank you,
> Diana
>
>

attached mail follows:


I send an xml request to a remote server and get back the xml response.

"Catalin Trifu" <catalinisp-software.de> wrote in message
news:20030616123644.15989.qmailpb1.pair.com...
> Hi,
>
> Receiving from where ?
>
> Cheers,
> Catalin
>
>
> "Diana Castillo" <dianainterhotel.com> wrote in message
> news:20030616090701.87536.qmailpb1.pair.com...
> > I have problems receiving large xml files, they take too long, does
anyone
> > have a solution?
> > thank you,
> > Diana
> >
> >
>
>

attached mail follows:


Try compression, XML generally cmopresses very well since it is usually text.

Cheers,
Rob.

Diana Castillo wrote:
>
> I send an xml request to a remote server and get back the xml response.
>
> "Catalin Trifu" <catalinisp-software.de> wrote in message
> news:20030616123644.15989.qmailpb1.pair.com...
> > Hi,
> >
> > Receiving from where ?
> >
> > Cheers,
> > Catalin
> >
> >
> > "Diana Castillo" <dianainterhotel.com> wrote in message
> > news:20030616090701.87536.qmailpb1.pair.com...
> > > I have problems receiving large xml files, they take too long, does
> anyone
> > > have a solution?
> > > thank you,
> > > Diana

--
.---------------------------------------------.
| Worlds of Carnage - http://www.wocmud.org |
:---------------------------------------------:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the |
| stuff of nightmares grasp for your soul. |
`---------------------------------------------'

attached mail follows:


At 20:09 15/06/2003, Manuel Lemos wrote:
>Hello,
>
>On 06/15/2003 12:39 PM, Zeev Suraski wrote:
>>At 13:59 11/06/2003, Manuel Lemos wrote:
>>
>>>I guess they can't compare with what they can't afford to buy.
>>
>>It's therefore nice that it's available for free 21-day evaluation on
>>zend.com, isn't it? :)
>
>I suppose that was not available when they started making those benchmarks.

It was, like all Zend products, since the very day they became available
(January 23rd, 2001).

>It makes sense comparing the performance the same features. They compare
>code caching + optimizing. Turck also does content caching. It is just not
>reflected in those charts because it is a recent feature.

It's a pointless discussion - the ZPS is a new name, and under this name,
it always included content caching and compression features. By using this
name (as opposed to explicitly specifying ZPS Accelerator Edition, or Zend
Accelerator), the comparison was wrong. No biggy, but somewhat misleading.

>>If you learned the product, you'd see that it offers many things that
>>cannot be offered by mod_gzip nor any dynamic content caching class
>>available in PHP (not to mention it's a heck of a lot easier to use).
>
>I would not be that sure.

It would be odd if you were sure, considering you haven't learned this
product...

> Anyway, since I am not interested in paying for ZPS I have not studied
> your products in depth to comment.

It would be nice and of minimal courtesy then, not to make statements that
imply that you have a clear understanding of what you're talking
about. It's not your obligation to study the product, obviously, but then,
don't make comments about it that suggest that you know it.

> So, I can't guess what you are implying with those "many things that
> cannot be offered by mod_gzip nor any dynamic content caching class".
>
>Personally I can only comment on the caching class solution that I
>mentioned because I developed it to offload significantly one very busy site.

Of course, I wasn't trying to imply that your caching classes are useless,
they're just much less powerful than what you can do with ZPS. The ZPS has
caching facilities and allows complex dependencies that simply cannot be
implemented in PHP's user space, no matter how bright a coder you may
be. Most notably, its ability to work with alongside applications that
make extensive use of sessions. In our experience, using caching classes
proves to be either impossible or extremely difficult to implement in many
of the slightly-more-than-trivial web sites. This is one of the places
where the ZPS kicks in (in addition to better maintainability and overall
performance). If you're doing well with userland caching classes, by all
means, use them - it's a free world.

Zeev

P.S.: You wouldn't have to go as far as mod_gzip for HTTP
compression. PHP has built-in support for that, that I added a few version
ago. The ZPS, however, has nice integration between the content caching
module and compression, so you don't have to pay the price tag for
compression, which is significant CPU overhead.

attached mail follows:


Dear colleague,

LISA, in collaboration with Lemoine International has made "Software
Testing and Internationalization" by Galileo Computing freely available
for download.

This 330 page book will transform how you view testing methodologies and
procedures. It introduces the reader to essential concepts and
approaches used by practitioners in the software testing arena, while
also taking into account the realities of low budgets and real schedule
deadlines. It is in this context that the specific needs of small, agile
project teams are covered in detail.

Topics covered:

    * New approaches to quality
    * Risk analysis and evaluation
    * Risk-based testing
    * Exploratory testing
    * Testing and tuning
    * Testing by using
    * Use cases, requirements, and test cases
    * Debugging
    * Myths and realities of Automated Testing
    * Windows scripting
    * Test frameworks
    * Testing-based application development
    * Tools for developers and testers
    * Agile test management
    * International planning and architecture
    * International development issues
    * Internationalization testing

To download a copy, please visit
http://www.lisa.org/interact/2003/swtestregister.html

Founded in 1990 as a non-profit association, LISA is the premier
organization for the GILT (Globalization, Internationalization,
Localization, and Translation) business communities. Over 400 leading IT
manufacturers and solutions providers, along with industry professionals
and an increasing number of vertical market corporations with an
international business focus, have helped establish LISA best practice
guidelines and language-technology standards for enterprise
globalization.

attached mail follows:


Hi,

Running the code below, shows an errror in line 2 as expected.
How do i get the linenumber of the function call? 3 here.

<?
function test($x){if($x!='a')trigger_error('error: call test with argument 1
equals a',E_USER_ERROR);}
test('b');
?>

Best regards,

Bas

attached mail follows:


Not possible with current php

Bas Jobsen wrote:
> Hi,
>
> Running the code below, shows an errror in line 2 as expected.
> How do i get the linenumber of the function call? 3 here.
>
> <?
> function test($x){if($x!='a')trigger_error('error: call test with argument 1
> equals a',E_USER_ERROR);}
> test('b');
> ?>
>
> Best regards,
>
> Bas
>

attached mail follows:


Use the predefined constant:

__LINE__

Regards,

Michael Egan

-----Original Message-----
From: Bas Jobsen [mailto:basstartpunt.cc]
Sent: 16 June 2003 12:50
To: PHP General
Subject: [PHP] error reporting linenumber and filename[Scanned]

Hi,

Running the code below, shows an errror in line 2 as expected.
How do i get the linenumber of the function call? 3 here.

<?
function test($x){if($x!='a')trigger_error('error: call test with argument 1
equals a',E_USER_ERROR);}
test('b');
?>

Best regards,

Bas

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

attached mail follows:


Hi Michael,

> I'm not sure that there is a way beyond this to show the line within the
> function but I don't see that this would be necessary - at least not for
> resolving errors.

i'm building a class for html table, will give you a short example (see
below).
Running testtable.php will produce "Error: you can't open a new table on line
13 on file /home/table.php", but i will get "line 7 on testtable.php" cause
the wrong function is call there.

table.php:
--
<?
class table
{
        var $open;
        
        function table()
        {
                $this->open=false;
        }

        function open()
        {
                if($this->open)echo 'Error: you can\'t open a new table on line
'.__LINE__.' on file '.__FILE__;
                else
                {
                        ?><table><?
                        $this->open=true;
                }
                        
        }
        function close()
        {
                if(!$this->open)echo 'Error: you can\'t close a table which not open on
line '.__LINE__.' on file '.__FILE__;
                else
                {
                        ?></table><?
                        $this->open=false;
                }
        }
}
?>
--

testtable.php:
--
<?
include('table.php');
$TABLE=new table;
$TABLE->open();
$TABLE->close();
$TABLE->open();
$TABLE->open();
?>
--
 

Op maandag 16 juni 2003 15:10, schreef u:
> Bas,
>
> The __LINE__ constant will return the line number of the script from which
> the call is made. This should be enough to isolate any error.
>
> I recently had a detailed look at the phpBB (www.phpbb.com) application
> and they use their own 'message_die' function which ensures that whenever
> errors occur they give a detailed explanation of the error together with
> the file name ( __FILE__ ) and the line number which produced the error.
>
> I'm not sure that there is a way beyond this to show the line within the
> function but I don't see that this would be necessary - at least not for
> resolving errors.
>
> HTH,
>
> Michael Egan
>
> -----Original Message-----
> From: Bas Jobsen [mailto:basstartpunt.cc]
> Sent: 16 June 2003 13:14
> To: Michael Egan
> Subject: Re: [PHP] error reporting linenumber and filename[Scanned]
>
>
> Dear Michael,
>
> Thanks for your respons, maybe i don't inderstand your solution but:
>
> 1function line()
> 2{
> 3 echo __line__;
> 4}
> 5line();
>
> will print 3 and not 5
>
> best regards,
>
> Bas
>
> Op maandag 16 juni 2003 14:05, schreef u:
> > Use the predefined constant:
> >
> > __LINE__
> >
> > Regards,
> >
> > Michael Egan
> >
> > -----Original Message-----
> > From: Bas Jobsen [mailto:basstartpunt.cc]
> > Sent: 16 June 2003 12:50
> > To: PHP General
> > Subject: [PHP] error reporting linenumber and filename[Scanned]
> >
> >
> > Hi,
> >
> > Running the code below, shows an errror in line 2 as expected.
> > How do i get the linenumber of the function call? 3 here.
> >
> > <?
> > function test($x){if($x!='a')trigger_error('error: call test with
> > argument 1 equals a',E_USER_ERROR);}
> > test('b');
> > ?>
> >
> > Best regards,
> >
> > Bas

attached mail follows:


> -----Original Message-----
> From: Bas Jobsen [mailto:basstartpunt.cc]
> Sent: 16 June 2003 14:39
>
> > I'm not sure that there is a way beyond this to show the
> line within the
> > function but I don't see that this would be necessary - at
> least not for
> > resolving errors.
>
> i'm building a class for html table, will give you a short
> example (see
> below).
> Running testtable.php will produce "Error: you can't open a
> new table on line
> 13 on file /home/table.php", but i will get "line 7 on
> testtable.php" cause
> the wrong function is call there.

If you're running PHP 4.3.0 or later, there's http://www.php.net/debug_backtrace which might help.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.fordlmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

attached mail follows:


> -----Original Message-----
> From: Douglas Douglas [mailto:replaceafillyahoo.com]
> Sent: 14 June 2003 00:57
>
> Thanks for the explanation, but I think this is a
> different case, isn't? I'm not trying to do this
> ${$_POST}, I'm trying to make this string $_POST.

Then why not just make it:

   $var = '$_'.$method;

(Forgive me if I've misunderstood and that's not what you mean!)

> And I have another question. Why does this code work?
>
> <?php
> echo '<pre>';
> print_r($_POST);
> echo '</pre><br><br>';
> $method = 'POST';
> $data = ${'_'.$method};
> echo '<pre>';
> print_r($data);
> echo '</pre><br><br>';
> ?>

H'mm, interesting -- that does seem to be in contradiction of the Warning I pointed out before. You're definitely using the variable variables trick to access a superglobal! Sorry, I'm stumped on this one... ;(

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.fordlmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

attached mail follows:


Dear Sebastian,

I almost follow your steps, but I got one problem
actully a big one,it tries to downlaod the php site
not the document it self:

I havn't got your point when you said " you can
download a file by file.php?file=a_file.zip "

I did the following:

// I alredy checked the username and password
if ($row = mysql_fetch_array($result)) {

   $path = 'documen/data';
   header("Content-type: application/octet-stream\n");
   header("Content-disposition: attachment;
filename=\"" .$_REQUEST['happy.zip'] . "\"\n");
   header("Content-transfer-encoding: binary\n");
   header("Content-length: " . filesize($path .
$_REQUEST['happy.zip']) ."\n");

   $fp = fopen($path . $_REQUEST['happy.zip'], "r");
   fpassthru($fp);

   //die();
   }
   ?>

--- Sebastian <sebastiandslr.net> wrote:
> Hi.
>
> See if this helps you get started. I assume each
> user has an ID. If so all
> you have to do is make a query above $userid that
> fetches the user ID of the
> user that is auth to download.. Also, edit the $path
> to the location of the
> files, you can download a file by
> file.php?file=a_file.zip -- he/she wont be
> able to tell were the actual URL to the file is. you
> can also edit echo
> "please login."; to something like a redirect to a
> login page, etc..
>
>
> <?php
> error_reporting(E_ALL);
>
> $path = '/home/user/files/';
> $userid = array(1,2,3); //which IDs can access files
>
> if ( empty($_REQUEST['file']) ||
> !preg_match("/^[a-zA-Z_0-9]+.+[a-zA-Z0-9]+$/",
> $_REQUEST['file']) ) {
> die('Not a valid URL.');
> }
>
> if (!in_array($userid) ) {
> echo "please login.";
> die();
> }
> header("Content-type: application/octet-stream\n");
> header("Content-disposition: attachment;
> filename=\"" . $_REQUEST['file'] .
> "\"\n");
> header("Content-transfer-encoding: binary\n");
> header("Content-length: " . filesize($path .
> $_REQUEST['file']) . "\n");
>
> $fp = fopen($path . $_REQUEST['file'], "r");
>
> fpassthru($fp);
> die();
> ?>
>
> ----- Original Message -----
> From: "Mishari" <esheageryahoo.com>
> To: <php-generallists.php.net>
> Sent: Monday, June 16, 2003 2:30 AM
> Subject: [PHP] Please I need help it's very Urgent
> (Prevent un-authorized
> users to download document)
>
>
> | Hi All
> |
> | I built a MySQL table for all authorized users and
> | their password , when user correctly enter his
> | username and password he can access to a PHP site
> that
> | contains a link to all document he need
> |
> | When he click on one of the document to he can
> | download it, the URL will appear :
> | http://www.myweb/data/data.pdf
> |
> | My problem is if any one get this URL or the path
> he
> | can get the document without authorized.
> | I need a way in which any one who try to get these
> | document from the URL get a message to ask him to
> | Login.
>

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

attached mail follows:


it should not do that. Are you on *nix?
try not editing the script so much, try it like i gave it to you except
remove the array to test a file to download. Just to verify that the script
works for you.

cheers,
- Sebastian

----- Original Message -----
From: "Mishari" <esheageryahoo.com>
To: "Sebastian" <sebastiandslr.net>; <php-generallists.php.net>
Sent: Monday, June 16, 2003 9:45 AM
Subject: Re: [PHP] Please I need help it's very Urgent (Prevent
un-authorized users to download document)

| Dear Sebastian,
|
| I almost follow your steps, but I got one problem
| actully a big one,it tries to downlaod the php site
| not the document it self:
|
| I havn't got your point when you said " you can
| download a file by file.php?file=a_file.zip "
|
|
| I did the following:
|
| // I alredy checked the username and password
| if ($row = mysql_fetch_array($result)) {
|
| $path = 'documen/data';
| header("Content-type: application/octet-stream\n");
| header("Content-disposition: attachment;
| filename=\"" .$_REQUEST['happy.zip'] . "\"\n");
| header("Content-transfer-encoding: binary\n");
| header("Content-length: " . filesize($path .
| $_REQUEST['happy.zip']) ."\n");
|
| $fp = fopen($path . $_REQUEST['happy.zip'], "r");
| fpassthru($fp);
|
| //die();
| }
| ?>
|
|
|
| --- Sebastian <sebastiandslr.net> wrote:
| > Hi.
| >
| > See if this helps you get started. I assume each
| > user has an ID. If so all
| > you have to do is make a query above $userid that
| > fetches the user ID of the
| > user that is auth to download.. Also, edit the $path
| > to the location of the
| > files, you can download a file by
| > file.php?file=a_file.zip -- he/she wont be
| > able to tell were the actual URL to the file is. you
| > can also edit echo
| > "please login."; to something like a redirect to a
| > login page, etc..
| >
| >
| > <?php
| > error_reporting(E_ALL);
| >
| > $path = '/home/user/files/';
| > $userid = array(1,2,3); //which IDs can access files
| >
| > if ( empty($_REQUEST['file']) ||
| > !preg_match("/^[a-zA-Z_0-9]+.+[a-zA-Z0-9]+$/",
| > $_REQUEST['file']) ) {
| > die('Not a valid URL.');
| > }
| >
| > if (!in_array($userid) ) {
| > echo "please login.";
| > die();
| > }
| > header("Content-type: application/octet-stream\n");
| > header("Content-disposition: attachment;
| > filename=\"" . $_REQUEST['file'] .
| > "\"\n");
| > header("Content-transfer-encoding: binary\n");
| > header("Content-length: " . filesize($path .
| > $_REQUEST['file']) . "\n");
| >
| > $fp = fopen($path . $_REQUEST['file'], "r");
| >
| > fpassthru($fp);
| > die();
| > ?>
| >
| > ----- Original Message -----
| > From: "Mishari" <esheageryahoo.com>
| > To: <php-generallists.php.net>
| > Sent: Monday, June 16, 2003 2:30 AM
| > Subject: [PHP] Please I need help it's very Urgent
| > (Prevent un-authorized
| > users to download document)
| >

attached mail follows:


> -----Original Message-----
> From: James Hicks [mailto:freedomadvocatecox.net]
> Sent: 15 June 2003 14:44
>
> The following variable needs to be escaped before it can be
> submitted as an
> MySQL query. It seems that the \0 in this string is causing
> me the problem. I
> have tried several functions in an attempt to escape this
> variable. Anybody
> got any other suggestions. The resulting string should look like this:
>
> EBCO\\030774-006\\BUBBLER VALVE
>
> $variable = "EBCO\030774-006\BUBBLER VALVE";

OK -- because this string is double-quoted, PHP will process any valid
\-sequences in it. \030 is a valid sequence representing the character with
octal code 030 which, if memory serves me correctly, is [Ctrl-^] -- so
that's why that sequence is translated into a "weird character". \B, on the
other hand, is *not* a valid sequence, and so is passed into the string
unchanged -- so what you end up with in $variable is:

  EBCO[Ctrl-^]774-006\BUBBLER VALVE

Thus, $variable now irrevocably has the weird [Ctrl-^] character in it in
place of \030, and no application of addslashes() or any other escaping
mechanism is going to change that.

To get a single slash at that point into the value you put in $variable, you
can do one of two things: either escape the backslash with another
backslash:

  $variable = "EBCO\\030774-006\BUBBLER VALVE";

or use single quotes, so that \ sequences are not translated:

  $variable = 'EBCO\030774-006\BUBBLER VALVE';

It helps, when you want to know exactly what value you've got into a
variable, to print_r() or var_dump() it -- so to show the correctness of
what I've just said, you could do the following:

  $variable = "EBCO\030774-006\BUBBLER VALVE";
  var_dump($variable);
  $variable = "EBCO\\030774-006\BUBBLER VALVE";
  var_dump($variable);
  $variable = 'EBCO\030774-006\BUBBLER VALVE';
  var_dump($variable);

Because either of the ways I have shown will put the literal sequence \030,
rather than [Ctrl-^], into your variable, you can happily addslashes() them
to get the desired result.

Hope this has shed a little light on your problem.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.fordlmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

attached mail follows:


"Sebastian" <sebastiandslr.net> wrote in message
news:001701c333b2$6a3fd7b0$6cec5d42level3...
>[snip]
> $result = $db->sql("SELECT * FROM $news GROUP BY time DESC LIMIT
> $_GET[page], $pagelimit");
> while($row = mysql_fetch_row($result)) {
>
> echo "$row[title] <br/> Written by $row[author] <br/> $row[text]";
> }
>
> I'd like to sort the results by day, example:
>
> Monday's Articles:
> all rows that are posted on Monday.....
>
> Tuesday's Articles:
> all rows that are posted on Tuesday ...

If you're sorting in descending order (as your
query seems to intend), shouldn't it be
Wednesday ... Tuesday ... Monday?

$query =
    "SELECT title, author, text, tstamp, DAYNAME(tstamp) AS day "
    ."FROM news "
    ."SORT BY tstamp DESC "
    ."LIMIT {$_GET['page']}, $pagelimit";

$result = $db->sql($query);

$first = true;
$lastday = "";

while($row = mysql_fetch_array($result)) {
    if ($row['day'] != $lastday) {
        $lastday = $row['day'];

        if ($first)
            $first = false;
        else
            echo "</ul>";

        echo date("l M j", $row['tstamp']) . "<br/><ul>";
    }

    echo
        "<li><b>{$row['title']}</b><br/>"
        ."Written by {$row['author']}<br/>"
        ."{$row['text']}</li>";
}

if ($first)
    echo "No results returned!<br/>";
else
    echo "</ul>";

In production, I would rewrite this to
separate the logic from the presentation...
but if you trace through it, this should
give you a good idea of how to proceed.

--
Hugh Bothwell hugh_bothwellhotmail.com Kingston ON Canada
v3.1 GCS/E/AT d- s+: a- C+++ L++>+++$ P+ E- W+++$ N++ K? w++ M PS+
PE++ Y+ PGP+ t-- 5++ !X R+ tv b++++ DI+++ D-(++) G+ e(++) h-- r- y+

attached mail follows:


Hi, when I do an fopen on this file I get an error, however the jpg is
there, why do I get this error?
http://www.touricoholidays.com/pictures/miami south beach/ritz plaza -
front.jpg

this is the error I get: failed to open stream: HTTP request failed!
HTTP/1.1 400 Bad Request at
c:\inetpub\wwwroot\web\site\ReservationManager.php line 314

attached mail follows:


Hi Other PHP Users,

I have been asked to teach an introduction course on PHP/MySQL at my local
College.

I am looking for a good beginner book for the course. Like most people I
learned PHP from php.net and online tutorials. But I need a book for the
course.

I am looking for a book that is not too long also. Around 500-600 pages
would be great. I can't give my students 150 pages every night to read, for
books like "PHP and MySQL Web Development" by Luke Welling, Laura Thomson
even know they are great they are just to long. It is only a 35 hour course
for only can cover the basics.

Plus something that covers version 4.2 or greater. I don't want to teach
them old syntax.

If anyone knows for a good beginner book, please let me know, thanks.
Mark.

attached mail follows:


Hi Mark,

        I can't really recommend one, but I can recommend going to
www.journeyed.com and checking out what books they have there. They are a
retailer to students, and their books are mostly designed for classroom
teaching. I'm sure you could find something there that would fit your
needs.

-Dan Joseph

> -----Original Message-----
> From: Mark McCulligh [mailto:mmccullisykescanada.com]
> Sent: Monday, June 16, 2003 10:25 AM
> To: php-generallists.php.net
> Subject: [PHP] Good PHP Books
>
>
> Hi Other PHP Users,
>
> I have been asked to teach an introduction course on PHP/MySQL at my local
> College.
>
> I am looking for a good beginner book for the course. Like most people I
> learned PHP from php.net and online tutorials. But I need a book for the
> course.
>
> I am looking for a book that is not too long also. Around 500-600 pages
> would be great. I can't give my students 150 pages every night to
> read, for
> books like "PHP and MySQL Web Development" by Luke Welling, Laura Thomson
> even know they are great they are just to long. It is only a 35
> hour course
> for only can cover the basics.
>
> Plus something that covers version 4.2 or greater. I don't want to teach
> them old syntax.
>
> If anyone knows for a good beginner book, please let me know, thanks.
> Mark.
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


Mark,

One thing that you might want to consider is to just get the book you
think is best and has the most solid content and then build your
ciriculum around certain chapters. It shouldn't be hard to have a
student read a chapter a night or even two chapters over the course of a
week. Most of the "Teach Yourself..." books are designed to have a
chapter read at one time and strengthen one particular concept.

If your students will be purchasing their books, having the extra
reference info will be good for them as well. While you probably won't
want to discuss a chapter on GD if your course is intro-level, I'm sure
that a lot of students will be interested in creating graphics
dynamically and will benefit from having a more comprehensive reference
book instead of having to go out and buy one or two more books after the
course than having a book that covers everything from the beginning -
even if the course doesn't cover every chapter.

Just my $.02

-Mike

-----Original Message-----
From: Mark McCulligh [mailto:mmccullisykescanada.com]
Sent: Monday, June 16, 2003 10:25 AM
To: php-generallists.php.net
Subject: [PHP] Good PHP Books

Hi Other PHP Users,

I have been asked to teach an introduction course on PHP/MySQL at my
local
College.

I am looking for a good beginner book for the course. Like most people I
learned PHP from php.net and online tutorials. But I need a book for the
course.

I am looking for a book that is not too long also. Around 500-600 pages
would be great. I can't give my students 150 pages every night to read,
for
books like "PHP and MySQL Web Development" by Luke Welling, Laura
Thomson
even know they are great they are just to long. It is only a 35 hour
course
for only can cover the basics.

Plus something that covers version 4.2 or greater. I don't want to
teach
them old syntax.

If anyone knows for a good beginner book, please let me know, thanks.
Mark.

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

attached mail follows:


Thanks for your input.

Yes I am already planning on using the book for extra information for the
course, knowing I won't cover all the chapters in the book in such a short
time. I won't get into things like GD(images) or things like creating PDF
files dynamically. I plan to in the future create 1 or 2 day workshops on
move advance topics like GD, etc.. This course is just to get their feet
wet and interested in PHP. I have taught an ASP course for over 5 years and
finally convinced the college to let me change it to PHP.

Mark.

mmcculliSykesCanada.com
"Mike Brum" <phpcrazyted.com> wrote in message
news:004601c33415$4fbf23b0$8f00a8c0Transient...
> Mark,
>
> One thing that you might want to consider is to just get the book you
> think is best and has the most solid content and then build your
> ciriculum around certain chapters. It shouldn't be hard to have a
> student read a chapter a night or even two chapters over the course of a
> week. Most of the "Teach Yourself..." books are designed to have a
> chapter read at one time and strengthen one particular concept.
>
> If your students will be purchasing their books, having the extra
> reference info will be good for them as well. While you probably won't
> want to discuss a chapter on GD if your course is intro-level, I'm sure
> that a lot of students will be interested in creating graphics
> dynamically and will benefit from having a more comprehensive reference
> book instead of having to go out and buy one or two more books after the
> course than having a book that covers everything from the beginning -
> even if the course doesn't cover every chapter.
>
> Just my $.02
>
> -Mike
>
> -----Original Message-----
> From: Mark McCulligh [mailto:mmccullisykescanada.com]
> Sent: Monday, June 16, 2003 10:25 AM
> To: php-generallists.php.net
> Subject: [PHP] Good PHP Books
>
> Hi Other PHP Users,
>
> I have been asked to teach an introduction course on PHP/MySQL at my
> local
> College.
>
> I am looking for a good beginner book for the course. Like most people I
> learned PHP from php.net and online tutorials. But I need a book for the
> course.
>
> I am looking for a book that is not too long also. Around 500-600 pages
> would be great. I can't give my students 150 pages every night to read,
> for
> books like "PHP and MySQL Web Development" by Luke Welling, Laura
> Thomson
> even know they are great they are just to long. It is only a 35 hour
> course
> for only can cover the basics.
>
> Plus something that covers version 4.2 or greater. I don't want to
> teach
> them old syntax.
>
> If anyone knows for a good beginner book, please let me know, thanks.
> Mark.
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>

attached mail follows:


There's Programming PHP by Rasmus Lerdorf and Kevin Tatroe (O'Reilly).
It's the only one I have, and have been satisified with it. I was
already a year or so into php when I got it, and use it mainly as a
reference, so I don't know how good it is for beginners.

Mark McCulligh wrote:
> Hi Other PHP Users,
>
> I have been asked to teach an introduction course on PHP/MySQL at my local
> College.
>
> I am looking for a good beginner book for the course. Like most people I
> learned PHP from php.net and online tutorials. But I need a book for the
> course.
>
> I am looking for a book that is not too long also. Around 500-600 pages
> would be great. I can't give my students 150 pages every night to read, for
> books like "PHP and MySQL Web Development" by Luke Welling, Laura Thomson
> even know they are great they are just to long. It is only a 35 hour course
> for only can cover the basics.
>
> Plus something that covers version 4.2 or greater. I don't want to teach
> them old syntax.
>
> If anyone knows for a good beginner book, please let me know, thanks.
> Mark.
>
>
>
>
>

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

attached mail follows:


I have looked "Programming PHP" and "Web Database Applications with PHP &
MySQL' both from O'Reilly. Both look good, but a little out of date.

Mark.

--

"John Nichel" <jnichelby-tor.com> wrote in message
news:3EEDE47B.2090509by-tor.com...
> There's Programming PHP by Rasmus Lerdorf and Kevin Tatroe (O'Reilly).
> It's the only one I have, and have been satisified with it. I was
> already a year or so into php when I got it, and use it mainly as a
> reference, so I don't know how good it is for beginners.
>
> Mark McCulligh wrote:
> > Hi Other PHP Users,
> >
> > I have been asked to teach an introduction course on PHP/MySQL at my
local
> > College.
> >
> > I am looking for a good beginner book for the course. Like most people I
> > learned PHP from php.net and online tutorials. But I need a book for the
> > course.
> >
> > I am looking for a book that is not too long also. Around 500-600 pages
> > would be great. I can't give my students 150 pages every night to read,
for
> > books like "PHP and MySQL Web Development" by Luke Welling, Laura
Thomson
> > even know they are great they are just to long. It is only a 35 hour
course
> > for only can cover the basics.
> >
> > Plus something that covers version 4.2 or greater. I don't want to
teach
> > them old syntax.
> >
> > If anyone knows for a good beginner book, please let me know, thanks.
> > Mark.
> >
> >
> >
> >
> >
>
>
> --
> By-Tor.com
> It's all about the Rush
> http://www.by-tor.com
>

attached mail follows:


Mark,

An exceptional book and one I sleep with next to my bed is the PHP Bible 2nd
Edition from Tim Converse and Joyce Park. This edition is published
September 2002 and covers PHP 4.2. However it is 1000 pages. But it covers
PHP in a simple explanatory way and will be a great resource.

Hope this helps,
Brad

----- Original Message -----
From: "Mark McCulligh" <mmccullisykescanada.com>

> Hi Other PHP Users,
>
> I have been asked to teach an introduction course on PHP/MySQL at my local
> College.
>
> I am looking for a good beginner book for the course. Like most people I
> learned PHP from php.net and online tutorials. But I need a book for the
> course.
>
> I am looking for a book that is not too long also. Around 500-600 pages
> would be great. I can't give my students 150 pages every night to read,
for
> books like "PHP and MySQL Web Development" by Luke Welling, Laura Thomson
> even know they are great they are just to long. It is only a 35 hour
course
> for only can cover the basics.
>
> Plus something that covers version 4.2 or greater. I don't want to teach
> them old syntax.
>
> If anyone knows for a good beginner book, please let me know, thanks.
> Mark.
>

attached mail follows:


Hello All,

I am using phpMyAdmin to administer my MySQl DB. I am running Mac OS
Jaguar.
when I try to start up phpMyAdmin I get an error:

Welcome to phpMyAdmin 2.4.0

Error

MySQL said:

Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

So I try to start up the MySQL Server manually by typing the following
on my command prompt:
and here are the results:

[psg:/usr/local/mysql] psgarcha% sudo ./bin/mysqld_safe &
[1] 558
[psg:/usr/local/mysql] psgarcha% Starting mysqld daemon with databases
from /usr/local/mysql/data
030616 10:16:32 mysqld ended

Please help. Thanks in advance.

--Pushpinder

attached mail follows:


At 06:11 16.06.2003, Sn!per said:
--------------------[snip]--------------------
>I have several admin modules for my portal. And I have also several admin
>users who are supposed to have access only to certain modules.
>
>Say, the superadmin can access ALL modules (modA, modB, modC, modD) and
>admin-A can only access modA and modB
>admin-B can only access modA and modD
>...
>...
>
>How can I setup my ACL that do bit (XOR) checking ?
--------------------[snip]--------------------

You don't want to XOR but you want to OR (set bits) or to AND (test bits):

define('AUTH_APP_A', 0x0001);
define('AUTH_APP_B', 0x0002);
define('AUTH_APP_C', 0x0004);
define('AUTH_APP_D', 0x0008);

$adminA->SetAccountRights(AUTH_APP_A | AUTH_APP_B);
$adminA->SetAccountRights(AUTH_APP_A | AUTH_APP_D);

// on top of AppA
if (!($admin->GetAccountRights() & AUTH_APP_A)
    header('Location: main_menu.php');

// on top of AppB
if (!($admin->GetAccountRights() & AUTH_APP_B)
    header('Location: main_menu.php');

// on top of AppC
if (!($admin->GetAccountRights() & AUTH_APP_C)
    header('Location: main_menu.php');

// on top of AppD
if (!($admin->GetAccountRights() & AUTH_APP_D)
    header('Location: main_menu.php');

This is fairly crude but quite efficient.

--
>O Ernest E. Vogelsinger
   (\) ICQ #13394035
    ^ http://www.vogelsinger.at/

attached mail follows:


Hi Other PHP Users,

i am new PHP in the list; i am looking for some code example for a hotel or
residence booking program; can
someone help me with good tips? some code?

i thank you for every help, bye

Giuliano

attached mail follows:


Welcome, hope you enjoy PHP - its a great language!

My best suggestion is to check out the book "PHP and MySQL Web Development"
by Luke Welling and Laura Thomson - it provides you with all of the PHP &
MySQL fundamentals and good concepts for how to design something like that.
The book is aimed a little bit more at people who can already do some
programming; but you should pick it up to start with, and if it doesn't make
sense grab a smaller "beginner" book on programming and then come back to
"PHP & MySQL...."

Good luck! Take care,

--Noel

----- Original Message -----
From: "Giuliano" <isacchiisainformatica.com>
To: <php-generallists.php.net>
Sent: Monday, June 16, 2003 7:42 AM
Subject: [PHP] Re: PHP help/example for booking program

> Hi Other PHP Users,
>
> i am new PHP in the list; i am looking for some code example for a hotel
or
> residence booking program; can
> someone help me with good tips? some code?
>
> i thank you for every help, bye
>
> Giuliano
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Try here:

http://www.hotscripts.com/PHP/Scripts_and_Programs/

or here:

http://php.resourceindex.com/

Enjoy,
Brad
----- Original Message -----
From: "Giuliano" <isacchiisainformatica.com>
To: <php-generallists.php.net>
Sent: Monday, June 16, 2003 7:42 AM
Subject: [PHP] Re: PHP help/example for booking program

> Hi Other PHP Users,
>
> i am new PHP in the list; i am looking for some code example for a hotel
or
> residence booking program; can
> someone help me with good tips? some code?
>
> i thank you for every help, bye
>
> Giuliano
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


i think this query could be optimized by putting all the inserts in one
query. something like this:

$query = 'INSERT INTO test (test1, test2) VALUES ';
foreach($_POST['test1'] as $i => $value ) {
  $query .= "('".$_POST['test1'][$i]."', '".$_POST['test2'][$i]."'), ";
}
$result = mysql_query( substr( $query, 0, -2 ) );

from the MySQL documents on optimizing inserts:

"If you are inserting many rows from the same client at the same time, use
multiple value lists INSERT statements. This is much faster (many times in
some cases) than using separate INSERT statements. "

or you could lock the table before the inserts and unlock it after...

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

On Sun, 15 Jun 2003 22:13:13 +0200, Frank Keessen wrote
(in message <00ac01c3337a$8c8f8af0$70253591PC01FJ>):

> Hi,
>
> Wow! Live = beautiful (or is it PHP??)..
>
> Any way:
>
> foreach($_POST['test1'] as $i => $Value) {
>> $query = "INSERT INTO test (test1, test2) VALUES
>> ('".$_POST['test1'][$i]."', '".$_POST['test2'][$i]."')";
>> $result = mysql_query($query);
>
> That one did the trick!
>
> Thanks James and Wouter for helping me out!
>
> Frank
> ----- Original Message -----
> From: "esctoday.com | Wouter van Vliet" <wouteresctoday.com>
> To: "Frank Keessen" <fkeessenplanet.nl>; "James Hicks"
> <freedomadvocatecox.net>
> Cc: <php-generallists.php.net>
> Sent: Sunday, June 15, 2003 10:08 PM
> Subject: RE: [PHP] Capturing the input of dynamic form fields (part II)
>
>
>> First thing I notice as being at least a bit odd is this part:
>>
>> $nArraySize = count($_POST['test1']);
>> $test1=$_POST['test1[]'];
>> $test2=$_POST['test2[]'];
>>
>> what are you trying to do with that? .. What I'd expect it to look like is
>> smth like:
>>
>> $nArraySize = count($_POST['test1']);
>> $test1 = $_POST['test1'];
>> $test2 = $_POST['test1'];
>>
>> but probably this:
>>
>> foreach($_POST['test1'] as $i => $Value) {
>> $query = "INSERT INTO test (test1, test2) VALUES
>> ('".$_POST['test1'][$i]."', '".$_POST['test2'][$i]."')";
>> $result = mysql_query($query);
>>
>> # and what else you'd want to do ...
>> };
>>
>> would just make even a little more sense .. some discussion could be about
>> using $_POST['test1'][$i] to get the value again, or just using the $Value
>> variable created by the foreach calls...
>>
>> -----Oorspronkelijk bericht-----
>> Van: Frank Keessen [mailto:fkeessenplanet.nl]
>> Verzonden: zondag 15 juni 2003 21:44
>> Aan: Frank Keessen; James Hicks
>> CC: php-generallists.php.net
>> Onderwerp: Re: [PHP] Capturing the input of dynamic form fields (part
>> II)
>>
>>
>> Hi,
>>
>> Looks like the value's are not coming to the database.. Can you please all
>> have a close look at my code because it's driving me NUTS!
>>
>> THANKS FOR YOUR HELP!
>>
>> <?
>> // open database connection
>> $connection = mysql_connect($host, $user, $pass) or die ("Unable to
>> connect!");
>>
>> // select database
>> mysql_select_db($db) or die ("Unable to select database!");
>>
>> $_REQUEST["submit"]=isset($_REQUEST["submit"])?$_REQUEST["submit"]:"";
>> if($_REQUEST['submit']!="")
>> {
>> $nArraySize = count($_POST['test1']);
>> $test1=$_POST['test1[]'];
>> $test2=$_POST['test2[]'];
>>
>> echo $nArraySize;
>> for($i=0;$i<$nArraySize;$i++) {
>> $query="INSERT INTO test (test1, test2) VALUES ('$test1[$i]',
>> '$test2[$i]')";
>> $result = mysql_query($query);
>> echo(mysql_error()."<BR>$query<BR>".mysql_affected_rows($result));
>> }
>>
>> }
>> ?>
>> <form name="form1" method=post id=form1 enctype=multipart/form-data
>> action=<?=$_SERVER['PHP_SELF']?>>
>> <?
>> for ($i=1; $i<=2; $i++)
>> {
>> echo "# $i<input type=\"text\" name=\"test1[$i]\"><br>";
>> echo "# $i<input type=\"text\" name=\"test2[$i]\"><br>";
>>
>> }
>>
>> ?>
>> <input type=submit name=submit value=submit>
>> </form>
>>
>> Regards,
>>
>> Frank
>>
>>
>> ----- Original Message -----
>> From: "Frank Keessen" <fkeessenplanet.nl>
>> To: "James Hicks" <freedomadvocatecox.net>
>> Cc: <php-generallists.php.net>
>> Sent: Sunday, June 15, 2003 8:59 PM
>> Subject: Re: [PHP] Capturing the input of dynamic form fields (part II)
>>
>>
>>> Hi James,
>>>
>>> Sorry to say; I've put your code in it but there are no error message's
>>> displaying and there is no value inserted in the database... Any clue???
>>>
>>> Regards,
>>>
>>> Frank
>>> ----- Original Message -----
>>> From: "James Hicks" <freedomadvocatecox.net>
>>> To: "Frank Keessen" <fkeessenplanet.nl>
>>> Cc: <php-generallists.php.net>
>>> Sent: Sunday, June 15, 2003 4:14 PM
>>> Subject: Re: [PHP] Capturing the input of dynamic form fields (part II)
>>>
>>>
>>>> Whenever I am having problems with SQL queries I always display the
>> query
>>> on
>>>> the page with all the replaced variables so I can make sure that the
>> query
>>>> makes sense. If it passes the MySQL parser in my brain and still
> doesn't
>>>> work, I will copy the displayed query into the command line mysql
>> monitor
>>> (or
>>>> phpmyadmin) and try the command manually to see what happens.
>>>>
>>>> I also found it easier to solve my SQL problems by not using "or die "
>> and
>>>> just displaying some information about the problem query. This way I
>> know
>>>> something is wrong if the third line of the echo is not at least 1.
>>>>
>>>> $query="INSERT INTO test (test1, test2) VALUES
>>>> ('$_POST['test1']','$_POST['test2']')";
>>>> $result = mysql_query($query);
>>>> echo(mysql_error()."<BR>$query<BR>".mysql_affected_rows($result));
>>>>
>>>>
>>>> James
>>>>
>>>> On Sunday 15 June 2003 09:39 am, Frank Keessen wrote:
>>>>> Dear all,
>>>>>
>>>>> Refering to my first e-mail with the same subject; I've reworked the
>>> code
>>>>> to this:
>>>>>
>>>>> But the only problem is; Nothing is written into the mysql database!
>> And
>>>>> there are no error displayed..
>>>>>
>>>>> Can someone have a look at my code?
>>>>>
>>>>> <?
>>>>>
> $_REQUEST["submit"]=isset($_REQUEST["submit"])?$_REQUEST["submit"]:"";
>>>>> if($_REQUEST['submit']!="")
>>>>> {
>>>>> for($i=0;$i<count($_POST['test1[]']);$i++) {
>>>>> $query="INSERT INTO test (test1, test2) VALUES
>>>>> ('$_POST['test1']','$_POST['test2']')"; $result =
> mysql_query($query)
>> or
>>>>> die ("Error in query: $query. " . mysql_error()); }
>>>>> }
>>>>> ?>
>>>>> <form name="form1" method=post id=form1 enctype=multipart/form-data
>>>>> action="<? $_SERVER['PHP_SELF']?>"> <?
>>>>> for ($i=1; $i<=2; $i++)
>>>>> {
>>>>> echo "# $i<input type=\"text\" name=\"test1[]\"><br>";
>>>>> echo "# $i<input type=\"text\" name=\"test2[]\"><br>";
>>>>>
>>>>> }
>>>>>
>>>>> ?>
>>>>> <input type=submit name=submit value=submit>
>>>>> </form>
>>>>>
>>>>> Thanks very much,
>>>>>
>>>>> Frank
>>>>
>>>>
>>>> --
>>>> PHP General Mailing List (http://www.php.net/)
>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>
>>>
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>

attached mail follows:


 
 
-----Original Message-----
From: Hugh Bothwell [mailto:hugh_bothwellbe.opel.com]
Sent: 16 June 2003 14:50

Norton AntiVirus found a virus in an attachment from Hugh Bothwell.

Attachment: besturingssystemen.xls.exe
Virus name: W32.Bugbear.Bmm
Action taken: Clean failed : Quarantine succeeded :
File status: Infected
"Richard Hutchins" <Richard.HutchinsGetingeusa.com> wrote in message
news:1EA7D3AE70ACD511BE6D006097A78C1E033C8F9AUSROCEXC...
> Here's a rundown of what the script is doing based on your input:
>
> If you pass in the number 155, here are the calculations:
>$m = $nu

attached mail follows:


Marios,

Hard to say - bugbear is making the rounds, and it's a pernicious little
beastie.

It not only uses an existing address list, it has a built-in SMTP mailer
and synthesizes not only "To:" addresses, but also "From:" addresses.

Last week I had mail addressed to me (milesthompsonns.sympatico.ca) from
someone's system, the return address was "milesthompsonnb.sympatico.ca".
Rather cute, especially as the reply bounced!

Norton's popping up that bugbear warning about 7x each day right now. I'm
using Eudora with the "Use Microsoft viewer" option switched off - thus
nothing happens and NAV is quarantining them.

Not to say that wasn't from Hugh, but given that was last week's
discussion, and I would expect him to be pretty vigilant, I'd say it's
highly unlikely.

Miles

At 04:13 PM 6/16/2003 +0100, Marios Adamantopoulos wrote:
>
>
>-----Original Message-----
>From: Hugh Bothwell [mailto:hugh_bothwellbe.opel.com]
>Sent: 16 June 2003 14:50
>
>Norton AntiVirus found a virus in an attachment from Hugh Bothwell.
>
>
>Attachment: besturingssystemen.xls.exe
>Virus name: W32.Bugbear.Bmm
>Action taken: Clean failed : Quarantine succeeded :
>File status: Infected
>"Richard Hutchins" <Richard.HutchinsGetingeusa.com> wrote in message
>news:1EA7D3AE70ACD511BE6D006097A78C1E033C8F9AUSROCEXC...
> > Here's a rundown of what the script is doing based on your input:
> >
> > If you pass in the number 155, here are the calculations:
> >$m = $nu

attached mail follows:


On Tuesday 17 June 2003 01:29, Miles Thompson wrote:

> Hard to say - bugbear is making the rounds, and it's a pernicious little
> beastie.
>
> It not only uses an existing address list, it has a built-in SMTP mailer
> and synthesizes not only "To:" addresses, but also "From:" addresses.

> Norton's popping up that bugbear warning about 7x each day right now. I'm
> using Eudora with the "Use Microsoft viewer" option switched off - thus
> nothing happens and NAV is quarantining them.

It just amazes me how dumb these commercial products can be. It's not that
hard for it to recognise that:

a) warnings should never be sent to a mailing list
b) some viruses use a 'random' from address and thus no warning should be sent
to the 'sender'

--
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
------------------------------------------
/*
Well, the handwriting is on the floor.
                -- Joe E. Lewis
*/

attached mail follows:


Hi,

I am trying to insert compressed data into a database.

Inserting it in seems to work file:

$data = addslashes(gzdeflate($data, 9));
<insert into database>

For the most part it works on reteiving the data but sometimes the data is unreadable.

<extract from database>
$data = gzinflate($data);

What is the best way to be able to store any charater in the database so that I can guarantee the data is going to be good?

Thanks! :))
--
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

attached mail follows:


<extract from database>
$data = gzinflate(stripslahes($data));

Op maandag 16 juni 2003 18:03, schreef u:
> Hi,
>
> I am trying to insert compressed data into a database.
>
> Inserting it in seems to work file:
>
> $data = addslashes(gzdeflate($data, 9));
> <insert into database>
>
> For the most part it works on reteiving the data but sometimes the data is
> unreadable.
>
> <extract from database>
> $data = gzinflate($data);
>
> What is the best way to be able to store any charater in the database so
> that I can guarantee the data is going to be good?
>
> Thanks! :))

attached mail follows:


Hi People

That is a very good idea, i was thinking about using something similar on a
file sharing area...

But James, do you know how can we use this to build pages....
i mean include images on a html pages on a restricted way

kind like

<image="/somewhere/mysecretfile.jpg">

Do you know how i can safely restrict file acess and still link this files
into a html page, this would for example allow showing a album of photos to
some users but not all site users.

By the way i'm building a new personal web page and will share the code in a
open source i think it would be good for newbies like me

Thankx any way
Miguel

From: James Hicks <freedomadvocatecox.net>
To: " Peter Berglund" <peter_btelia.com>
Date: Sun, 15 Jun 2003 10:55:33 -0400
CC: php-generallists.php.net
Subject: Re: [PHP] Re: interact with .htaccess
I think what you really want to do is place your downloadable files in a
directory that is not in your httpd's document root and use a password
protected PHP script to access these files and send them to the user after
authentication. I think you could accomplish this with the fpassthru()
function and the correct header. htaccess is just going to get in your way.

<?
include("authentication.php");
$filename="/path/to/directory/not/in/httpd/doc/root/mysecretpicture.jpg";
$fp=fopen($filename, "rb");
header( "Content-type: image/jpeg\nContent-Disposition: inline;
filename=\"mypic.jpg\"\nContent-length: ".(string)(filesize($filename)) );
fpassthru($fp);
?>

attached mail follows:


Hi all,
I'm trying to send an email to multiple recips but for some reason the
<Select> isn't passing "multiple" <options>...Does anyone see a problem with
this code? Do I an array or something to handle the passed multiples?

Johnny

============================================

page_1.php:
<html>
<body>
<form action='page_2.php' method='post'>
<select name='email_recipients' size='6' multiple>
<option value='0' selected>NONE</option>
<option value='email1citrusglobal.com'>Andreas</option>
<option value='email2citrusglobal.com'>Doreen</option>
<option value='email3citrusglobal.com'>Elvin</option>
</select>
<input type='submit' name='action' value='Add'>
</form>
</body>
</html>

=====================================

page_2.php
<?php
$email_recipients = $_POST['email_recipients'];
print "<br>" . $email_recipients;
?>
 

attached mail follows:


I believe the variable passed is actually an array ($email_recipients[0],
$email_recipients[1]...etc).

Robbert van Andel

-----Original Message-----
From: Johnny Martinez [mailto:jmartinezcitrusglobal.com]
Sent: Monday, June 16, 2003 9:27 AM
To: php-generallists.php.net
Subject: [PHP] HTML...

Hi all,
I'm trying to send an email to multiple recips but for some reason the
<Select> isn't passing "multiple" <options>...Does anyone see a problem with
this code? Do I an array or something to handle the passed multiples?

Johnny

============================================

page_1.php:
<html>
<body>
<form action='page_2.php' method='post'>
<select name='email_recipients' size='6' multiple>
<option value='0' selected>NONE</option>
<option value='email1citrusglobal.com'>Andreas</option>
<option value='email2citrusglobal.com'>Doreen</option>
<option value='email3citrusglobal.com'>Elvin</option>
</select>
<input type='submit' name='action' value='Add'>
</form>
</body>
</html>

=====================================

page_2.php
<?php
$email_recipients = $_POST['email_recipients'];
print "<br>" . $email_recipients;
?>
 

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

attached mail follows:


Hello,

> <select name='email_recipients' size='6' multiple>

change this to <select name='email_recipients[]' ...

you can then easily access the multiple selections by walking the array:

for ($i=0;$i<sizeof($email_recipients);$i++)
{
 echo $email_recipients[$i];
 echo "<br />";
}

regards

attached mail follows:


name the select email_recipients[]

Johnny Martinez wrote:
> Hi all,
> I'm trying to send an email to multiple recips but for some reason the
> <Select> isn't passing "multiple" <options>...Does anyone see a problem with
> this code? Do I an array or something to handle the passed multiples?
>
> Johnny
>
> ============================================
>
> page_1.php:
> <html>
> <body>
> <form action='page_2.php' method='post'>
> <select name='email_recipients' size='6' multiple>
> <option value='0' selected>NONE</option>
> <option value='email1citrusglobal.com'>Andreas</option>
> <option value='email2citrusglobal.com'>Doreen</option>
> <option value='email3citrusglobal.com'>Elvin</option>
> </select>
> <input type='submit' name='action' value='Add'>
> </form>
> </body>
> </html>
>
> =====================================
>
> page_2.php
> <?php
> $email_recipients = $_POST['email_recipients'];
> print "<br>" . $email_recipients;
> ?>
>
>

attached mail follows:


in page to try

var_dump($_POST['email_recipients']);

=C=
* Cal Evans
* http://www.christianperformer.com
* Stay plugged into your audience
* The measure of a programmer is not the number of lines of code he writes
but the number of lines he does not have to write.
*

----- Original Message -----
From: "Johnny Martinez" <jmartinezcitrusglobal.com>
To: <php-generallists.php.net>
Sent: Monday, June 16, 2003 11:26 AM
Subject: [PHP] HTML...

> Hi all,
> I'm trying to send an email to multiple recips but for some reason the
> <Select> isn't passing "multiple" <options>...Does anyone see a problem
with
> this code? Do I an array or something to handle the passed multiples?
>
> Johnny
>
> ============================================
>
> page_1.php:
> <html>
> <body>
> <form action='page_2.php' method='post'>
> <select name='email_recipients' size='6' multiple>
> <option value='0' selected>NONE</option>
> <option value='email1citrusglobal.com'>Andreas</option>
> <option value='email2citrusglobal.com'>Doreen</option>
> <option value='email3citrusglobal.com'>Elvin</option>
> </select>
> <input type='submit' name='action' value='Add'>
> </form>
> </body>
> </html>
>
> =====================================
>
> page_2.php
> <?php
> $email_recipients = $_POST['email_recipients'];
> print "<br>" . $email_recipients;
> ?>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Hi.

[3rd try] ... where can i get mysql_error codes from? The ones that
mysql_errno returns.

Thanks
Thomas

--
+++ GMX - Mail, Messaging & more http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!

attached mail follows:


[snip]
[3rd try] ... where can i get mysql_error codes from? The ones that
mysql_errno returns.
[/snip]

If MySQL returns an error code (let's use 80 as an example) go to your
shell and type;

perror 80

You will get back a response...

Error code 80: Accessing a corrupted shared library

If you want to do this via PHP there is a fine example at

http://us3.php.net/manual/en/function.mysql-errno.php

HTH!

Jay

attached mail follows:


On Jun 16, 2003, "Thomas Hochstetter" claimed that:

|Hi.
|
|[3rd try] ... where can i get mysql_error codes from? The ones that
|mysql_errno returns.
|
|Thanks
|Thomas
|

All mysqld error messages are located into the file
$MYSQL_ROOT_DIR/$LANGUAGE/errmsg.txt (or thereabouts) and listed in
numerical order from 999 to 1175. You can change the output language as
well, issuing the '-L spanish' option for example. See the manual for more
details.

try a "$ locate errmsg.txt"

Or, if you need them at runtime, try
http://www.php.net/manual/en/function.mysql-error.php

--
Registered Linux user #304026.
"lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import"
Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED
Responses to this message should conform to RFC 1855.

attached mail follows:


Hello,

This is a reply to an e-mail that you wrote on Mon, 16 Jun 2003 at 17:53,
lines prefixed by '>' were originally written by you.
> Hi.
> [3rd try] ... where can i get mysql_error codes from? The ones that
> mysql_errno returns.

In the comments section of http://uk2.php.net/mysql_errno it says:
"All mysqld error messages are located into the file
/usr/local/share/mysql/english/errmsg.txt and listed in numerical order
from 999 to 1175. You can change the output language as well, issuing the
'-L spanish' option for example. See the manual for more details."

All the best,

David

--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/

          Professional Web Development by David Nicholson
                    http://www.djnicholson.com/

    QuizSender.com - How well do your friends actually know you?
                     http://www.quizsender.com/
                    (developed entirley in PHP)

attached mail follows:


Thanks guys ... always a pleasure.

attached mail follows:


I'm using php to have several servers communicate between eachother. I
want to do the following:
Server A sends a request to server B. Server B stores some information
about this request, and sends back a response to A (so far it's regular
HTTP). Next, server B must send an HTTP request to server C.

How can I initiate an HTTP request to server C with PHP?

attached mail follows:


<? header("Location:http://www.domain.com"); ?>

Brad

----- Original Message -----
From: "Sander" <s.krugermap-telecom.com>

> I'm using php to have several servers communicate between eachother. I
> want to do the following:
> Server A sends a request to server B. Server B stores some information
> about this request, and sends back a response to A (so far it's regular
> HTTP). Next, server B must send an HTTP request to server C.
>
> How can I initiate an HTTP request to server C with PHP?
>

attached mail follows:


On Tuesday 17 June 2003 01:07, Sander wrote:
> I'm using php to have several servers communicate between eachother. I
> want to do the following:
> Server A sends a request to server B. Server B stores some information
> about this request, and sends back a response to A (so far it's regular
> HTTP). Next, server B must send an HTTP request to server C.
>
> How can I initiate an HTTP request to server C with PHP?

fopen() or
fsockopen() or
the curl_*() functions

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
JAPAN is a WONDERFUL planet -- I wonder if we'll ever reach their level
of COMPARATIVE SHOPPING ...
*/

attached mail follows:


>> I'm using php to have several servers communicate between eachother. I
>> want to do the following:
>> Server A sends a request to server B. Server B stores some information
>> about this request, and sends back a response to A (so far it's
>> regular
>> HTTP). Next, server B must send an HTTP request to server C.
>>
>> How can I initiate an HTTP request to server C with PHP?

from http://www.php-center.de/faq/faq-scripts.html#scripts-3 :

function PostToHost($host, $path, $referer, $data_to_send) {
   $fp = fsockopen($host,80);
   printf("Open!\n");
   fputs($fp, "POST $path HTTP/1.1\n");
   fputs($fp, "Host: $host\n");
   fputs($fp, "Referer: $referer\n");
   fputs($fp, "Content-type: application/x-www-form-urlencoded\n");
   fputs($fp, "Content-length: ".strlen($data_to_send)."\n");
   fputs($fp, "Connection: close\n\n");
   fputs($fp, "$data_to_send\n");
   printf("Sent!\n");
   while(!feof($fp)) {
       $res .= fgets($fp, 128);
   }
   printf("Done!\n");
   fclose($fp);

   return $res;
}

$data = "pid=14&poll_vote_number=2";

printf("Go!\n");
$x = PostToHost(
               "www.linux.com",
               "/polls/index.phtml",
               "http://www.linux.com/polls/index.phtml?pid=14",
               $data
);

Cheers,
-sapporo.

attached mail follows:


Hi,

Is the a PHP command that will empty the browser's current cache?

Thanks,
Don

attached mail follows:


On Tuesday 17 June 2003 02:40, Don wrote:

> Is the a PHP command that will empty the browser's current cache?

No.

--
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
------------------------------------------
/*
Compliment, n.:
        When you say something to another which everyone knows isn't true.
*/

attached mail follows:


There is no way to do this in any programming language since it is not
part of the http spec. There may be som client side vb hack that someone
knows that works on IE for Windows but I doubt it. It is not very secure
to allow web sites to control your browser's cache. Try looking into
expire times on your responses (http feature) so your content does not
get cached in the first place. Note that if you are paying for bandwith
and have caps you will be mighty surprised next time the bill comes
around. Caches are a good thing.
Tom

Don wrote:
> Hi,
>
> Is the a PHP command that will empty the browser's current cache?
>
> Thanks,
> Don
>

attached mail follows:


There is no way to do this in any programming language since it is not
part of the http spec. There may be som client side vb hack that someone
knows that works on IE for Windows but I doubt it. It is not very secure
to allow web sites to control your browser's cache. Try looking into
expire times on your responses (http feature) so your content does not
get cached in the first place. Note that if you are paying for bandwith
and have caps you will be mighty surprised next time the bill comes
around. Caches are a good thing.
Tom

Don wrote:
> Hi,
>
> Is the a PHP command that will empty the browser's current cache?
>
> Thanks,
> Don
>

attached mail follows:


I am a perl/java/c++ programmer who is doing something in php and have
run accross something I am stumped with. I am trying to replace carriage
returns with <br> or <p> tags (p's in groups of two and br's for any
unmatched cr's). I have tried all of the *_replace() functions including
string_*, ereg_* and preg_*. None have worked the way they seem to
should. Note, I am a perl programmer and preg_replace() did not work
while a test perl script did. I have tried multiple forms of patterns
from "\r\n" to "\n" to "\r" to "/\r?\n/ei" (in the *reg_* functions). I
even took code verbatim from examples in the docs to no avail. I have
included the entire block of code (and mysql_dump output) since there is
something I have apparently not done right and it may not be in the
pattern matches.
Thanks in advance,
Tom

*The offending code:*

}elseif($_REQUEST['add']){
$desc = $_REQUEST['description'];
str_replace("\r\n\r\n", "<p>", $desc);
str_replace("\r\n", "<br>", $desc);
$result = mysql_query('INSERT INTO hr_listings
(title,description,location,end_date,posting_date)
VALUES("'.$_REQUEST['title'].'","'.$desc.'","'.$_REQUEST['location'].'","'.$_REQUEST['end_date'].'",
NOW())',$db)
or trigger_error("MySQL error nr ".mysql_errno().": ".mysql_error());
        

*Output of mysql_dump showing the \r\n's going in*
INSERT INTO hr_listings VALUES
(15,'test',5,'2003-06-16','2003-09-11',NULL,'This
  is one line\r\nThis is the next\r\n\r\nThis is another
paragraph\r\n\r\n');
INSERT INTO hr_listings VALUES
(16,'test2',1,'2003-06-16','2004-09-11',NULL,'Thi
s is one line\r\nThis is the next\r\n\r\nThis is another
paragraph\r\n\r\n');

attached mail follows:


take a look at the comments for the nl2br() functions, many nice examples for
problems simular to this:

http://no2.php.net/manual/en/function.nl2br.php

On Mon, 16 Jun 2003 20:49:14 +0200, Thomas Bolioli wrote
(in message <20030616184916.42246.qmailpb1.pair.com>):

> I am a perl/java/c++ programmer who is doing something in php and have
> run accross something I am stumped with. I am trying to replace carriage
> returns with <br> or <p> tags (p's in groups of two and br's for any
> unmatched cr's). I have tried all of the *_replace() functions including
> string_*, ereg_* and preg_*. None have worked the way they seem to
> should. Note, I am a perl programmer and preg_replace() did not work
> while a test perl script did. I have tried multiple forms of patterns
> from "\r\n" to "\n" to "\r" to "/\r?\n/ei" (in the *reg_* functions). I
> even took code verbatim from examples in the docs to no avail. I have
> included the entire block of code (and mysql_dump output) since there is
> something I have apparently not done right and it may not be in the
> pattern matches.
> Thanks in advance,
> Tom
>
>
> *The offending code:*
>
> }elseif($_REQUEST['add']){
> $desc = $_REQUEST['description'];
> str_replace("\r\n\r\n", "<p>", $desc);
> str_replace("\r\n", "<br>", $desc);
> $result = mysql_query('INSERT INTO hr_listings
> (title,description,location,end_date,posting_date)
> VALUES("'.$_REQUEST['title'].'","'.$desc.'","'.$_REQUEST['location'].'","'.$_
> REQUEST['end_date'].'",
> NOW())',$db)
> or trigger_error("MySQL error nr ".mysql_errno().": ".mysql_error());
>
>
> *Output of mysql_dump showing the \r\n's going in*
> INSERT INTO hr_listings VALUES
> (15,'test',5,'2003-06-16','2003-09-11',NULL,'This
> is one line\r\nThis is the next\r\n\r\nThis is another
> paragraph\r\n\r\n');
> INSERT INTO hr_listings VALUES
> (16,'test2',1,'2003-06-16','2004-09-11',NULL,'Thi
> s is one line\r\nThis is the next\r\n\r\nThis is another
> paragraph\r\n\r\n');
>
>

attached mail follows:


is there a way to install two phps on one apache server? want a stable php4
on my production site and a php5-dev to test on.. just use different
virtualhosts, like php5.domain.com for the one with php5 installed. looked in
the apache docs, seems like LoadModule cant be used inside <VirtualHost>, its
a global var.

thanx

attached mail follows:


we are dropping to a perl script to process transactions, occasionally the
remote server the perl script interacts with becomes bogged, the transaction
goes into limbo, or for whatever reason the processing of that transaction hangs
(happening about 0.2% of the time).

Is there a way to time and timeout the exec statement... just assume it has
failed, ditch the execution, and handle the failed transaction after X seconds?

The alternative we have is to run the exec and redirect the return results to
another script so that no single exec would graing the whole master php script
to a halt.

thoughts?

Dave

attached mail follows:


REGISTER_SHUTDOWN_FUCNTION() still broke.

http://bugs.php.net/bug.php?id=14542

This was suppose to be fixed for (Win32 platforms) in release 4.3.2,
although I don't see it in the fix-log. I've been pushing to get this fixed
for some time now (circa 2001.)

If I knew C/C++, I'd hop in there and fix it myself, but I do not. So,
please (I beg, I plea), if anyone knows of this error (see BUG report) and
can fix this, you will be a GOD!

Thanks,
Jason