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 20 Jun 2006 03:21:49 -0000 Issue 4195

php-general-digest-helplists.php.net
Date: Mon Jun 19 2006 - 22:21:49 CDT


php-general Digest 20 Jun 2006 03:21:49 -0000 Issue 4195

Topics (messages 238288 through 238369):

Array
        238288 by: Rob W.
        238290 by: Jay Blanchard
        238291 by: Brad Bonkoski
        238294 by: John Nichel

Re: A way to stop spam on this list
        238289 by: Barry
        238296 by: tedd
        238300 by: tedd
        238301 by: Robert Cummings
        238308 by: Ryan A
        238319 by: MOKULEN_IMADICA
        238343 by: Ryan A
        238367 by: tedd

An annoying session problem
        238292 by: Alex Major
        238293 by: phpninja
        238299 by: Alex Major
        238302 by: Stut
        238305 by: tedd
        238306 by: tedd
        238309 by: Alex Major
        238349 by: Richard Lynch

Re: PHP Session
        238295 by: tedd

Re: trouble getting PDO going on ubuntu 6.06 installation
        238297 by: Richard Harding

running conditions while looping through arrays....
        238298 by: IG
        238304 by: Adam Zey
        238353 by: Richard Lynch

Re: Slow loading (was Re: [PHP] Re: How to run one php app from another? RECAP)
        238303 by: tedd

mime.magic adding more types
        238307 by: Mark Steudel
        238354 by: Jochem Maas

regex brain-toot
        238310 by: Jay Blanchard
        238311 by: John Nichel
        238312 by: Robert Cummings
        238313 by: Jay Blanchard
        238314 by: Jay Blanchard
        238315 by: John Nichel
        238316 by: Jay Blanchard
        238317 by: John Nichel
        238318 by: Jay Blanchard

Re: SMS with php recommendation (a bit 0T i guess)
        238320 by: Daevid Vincent

Re: remove keys from array
        238321 by: Daevid Vincent

Still trying to figure this out...
        238322 by: Rob W.
        238324 by: Jochem Maas
        238326 by: John Nichel
        238327 by: Jon Anderson
        238333 by: tedd
        238335 by: Jochem Maas
        238337 by: Rob W.
        238338 by: Rob W.
        238341 by: Rob W.
        238342 by: Robert Cummings
        238344 by: Rob W.
        238345 by: Richard Lynch
        238346 by: Jochem Maas
        238356 by: Rob W.
        238357 by: Rob W.
        238362 by: Robert Cummings

Simulating mysql_real_escape_string
        238323 by: Tim Traver
        238325 by: John Nichel
        238348 by: Richard Lynch

Re: Serving a graphic downloads it instead of displaying it
        238328 by: Brian Dunning

IMAP Search
        238329 by: CodeHeads
        238331 by: CodeHeads
        238336 by: Richard Lynch
        238340 by: CodeHeads
        238350 by: Jochem Maas

IMAP Multiple Pages
        238330 by: CodeHeads

Re: Want some PHP e-book
        238332 by: Daevid Vincent
        238334 by: tedd

GD problems
        238339 by: Beauford
        238347 by: Richard Lynch
        238351 by: Beauford
        238359 by: Chris
        238366 by: Beauford
        238368 by: Chris

Re: PHP Automation
        238352 by: Richard Lynch

Organizing a group project
        238355 by: Matt Palermo
        238358 by: Chris

Re: How to run one php app from another? RECAP
        238360 by: Chris
        238363 by: Richard Lynch
        238364 by: Chris

Re: GET, POST, REQUEST
        238361 by: Richard Lynch
        238365 by: Richard Lynch

mysql_db_query & INSERT
        238369 by: Prathaban Mookiah

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:


  $query="SELECT switchport FROM network";
  $result=mysql_query($query);
  $sql_range=array($result['switchport']);

Anybody tell me what i'm doing wrong and why this isnt going in to an array?

attached mail follows:


[snip]
  $query="SELECT switchport FROM network";
  $result=mysql_query($query);
  $sql_range=array($result['switchport']);

Anybody tell me what i'm doing wrong and why this isnt going in to an
array?
[/snip]

Use mysql_fetch_array()

$sql_range = mysql_fetch_array($result);

attached mail follows:


Your result variable is a result identifier, not the actual data...

check out:
http://www.php.net/manual/en/function.mysql-fetch-row.php

or something similar...
-Brad

Rob W. wrote:

> $query="SELECT switchport FROM network";
> $result=mysql_query($query);
> $sql_range=array($result['switchport']);
>
>
>Anybody tell me what i'm doing wrong and why this isnt going in to an array?
>
>

attached mail follows:


Rob W. wrote:
> $query="SELECT switchport FROM network";
> $result=mysql_query($query);
> $sql_range=array($result['switchport']);
>
>
> Anybody tell me what i'm doing wrong and why this isnt going in to an array?

Because you're not understanding what the function mysql_query() is
doing. Look at the manual to learn about the MySQL functions.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnicheldotcomholdingsofbuffalo.com

attached mail follows:


Jochem Maas schrieb:
> Rory Browne wrote:
>> Do you know who the list admin is?
>>
>> php-general has been traditionally "admined" by users flaming people
>> posting
>> "bad content".
>>
>> This doesn't work for spam.
>
> just wait till we have spambots with AI and emotion subroutines ;-)
>
Oh yeah then i will have it to bring me some beer when i watch football :D

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

attached mail follows:


At 5:10 PM +0200 6/19/06, Barry wrote:
>Jochem Maas schrieb:
>>Rory Browne wrote:
>>>Do you know who the list admin is?
>>>
>>>php-general has been traditionally "admined" by users flaming people
>>>posting
>>>"bad content".
>>>
>>>This doesn't work for spam.
>>
>>just wait till we have spambots with AI and emotion subroutines ;-)
>>
>Oh yeah then i will have it to bring me some beer when i watch football :D

No, it will be watching football drinking your beer.

tedd
--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


At 10:05 AM +0200 6/19/06, Rory Browne wrote:
>Do you know who the list admin is?
>
>php-general has been traditionally "admined" by users flaming people posting
>"bad content".

That works surprisingly well. :-)

>This doesn't work for spam.
>
>Having that said, feel free to set up procmail or something like that, to
>block message with chinese/japanese characters.

Every spam I receive via this list, I report to spamcop (provided that it's less than 3 hours old).

I don't know if that does anything, but at least I "feel" like I'm doing something.

tedd

--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


On Mon, 2006-06-19 at 03:34, Denis Gerasimov wrote:
> Hello Robert,
>
> > I think you should quit whining like a spoilt brat *lol*. I get
> > something like 3 a day. Big fricking whoop.
>
> I am subscribed to most of the PHP mailing lists, not only to PHP general.
> There is the same problem too. So receive something more than just "3 a
> day".

I'm subscribed to 6 PHP mailing lists. Are you going somewhere with
this? Should we pull down our pants next and measure?

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:


--- Robert Cummings <robertinterjinn.com> wrote:

> On Mon, 2006-06-19 at 03:34, Denis Gerasimov wrote:
> > Hello Robert,
> >
> > > I think you should quit whining like a spoilt
> brat *lol*. I get
> > > something like 3 a day. Big fricking whoop.
> >
> > I am subscribed to most of the PHP mailing lists,
> not only to PHP general.
> > There is the same problem too. So receive
> something more than just "3 a
> > day".
>
> I'm subscribed to 6 PHP mailing lists. Are you going
> somewhere with
> this? Should we pull down our pants next and
> measure?
 
Ummm, I'm for the measuring thing, once and for all, I
want to be know as the freak., gotta save for that
operation to lose a few inches....

:p

Cheers,
Ryan

------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

attached mail follows:


Dear Denis and List members,

> I am very tired of deleting spam messages received from PHP mailing lists
  
uu...I was tired more than you are,Denis,undoubtedly.
Because I am a Japanese.I think that the person who can not read
Japanese spam is fortunate.

> As I can see most of the spam messages are in Chinese / Japanese.

The Japanese spammer is sending spam to us from "pair.com".
So I added in a header_checks file of my postfix:

/message-ID:.*pair.com/ DISCARD

.Since I added that,the japanse spam doesnt't reach.

The list may lock mails of contents(body) written in japanese,I think.
The PHP mailing list for the people who read and write Japanese exists
in Japan.I don't join in that my-home-ground's list,because I can buy
books related with PHP which was written in Japanese.There is good
introducers of PHP in Japan(there is not only spammer but also good
programmer in Japan!).The reason why I join to this English version is
that I wants to get advices earlier than publishing new books related
with PHP in Japan.

Unfortunately I am not familiar with English to the extent that I can
send advice to my dear list in each time,but I always appreciate
members.

Wishing not to dislike Japanese because of Japanese spammer.

Thank you for reading.

With Love,

Madoca

ps$B!'(BI use the hn, "MOKULEN", in the net.
$B!I(BMOKULEN$B!I(B is the magnolia to say in English.
There is a meaning that "I love nature" in "MOKULEN".

http://imadica.jp/
http://www.mokulen.com/
https://mokulen.jp

attached mail follows:


--- MOKULEN_IMADICA <webmastermokulen.jp> wrote:

> Dear Denis and List members,
>
> > I am very tired of deleting spam messages received
> from PHP mailing lists
>
> uu...I was tired more than you
> are,Denis,undoubtedly.
> Because I am a Japanese.I think that the person who
> can not read
> Japanese spam is fortunate.
>
> > As I can see most of the spam messages are in
> Chinese / Japanese.
>
> The Japanese spammer is sending spam to us from
> "pair.com".
> So I added in a header_checks file of my postfix:
>
> /message-ID:.*pair.com/ DISCARD
>
> .Since I added that,the japanse spam doesnt't reach.
>
> The list may lock mails of contents(body) written in
> japanese,I think.
> The PHP mailing list for the people who read and
> write Japanese exists
> in Japan.I don't join in that my-home-ground's
> list,because I can buy
> books related with PHP which was written in
> Japanese.There is good
> introducers of PHP in Japan(there is not only
> spammer but also good
> programmer in Japan!).The reason why I join to this
> English version is
> that I wants to get advices earlier than publishing
> new books related
> with PHP in Japan.
>
> Unfortunately I am not familiar with English to the
> extent that I can
> send advice to my dear list in each time,but I
> always appreciate
> members.
>
> Wishing not to dislike Japanese because of Japanese
> spammer.
>
> Thank you for reading.
>
> With Love,
>
> Madoca

Madoca,
Spammers are scum no matter which nationality they
come from so dont bother too much about it, and I
think people would have to be real small (more like
tiny) minded to dislike Japanese (or the Japanese
people) due to one rotten apple.

As for your English, I think its really good, I
daresay if any of us (English speaking people) tried
to write in your language it would be a lot....lot
worse.

Cheers!
Ryan

------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

attached mail follows:


At 4:17 PM -0700 6/19/06, Ryan A wrote:
>--- MOKULEN_IMADICA <webmastermokulen.jp> wrote:
>
> > Unfortunately I am not familiar with English to the
>> extent that I can
>> send advice to my dear list in each time,but I
>> always appreciate
> > members.
>>
>-snip-
>
>As for your English, I think its really good, I
>daresay if any of us (English speaking people) tried
>to write in your language it would be a lot....lot
>worse.
>
>Cheers!
>Ryan

It would be nice if the English speaking people knew how to write English.

tedd
--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


Hi there.
I'm working my way through a new script, but I've stumbled into a problem.
Some data that I've set into a session, won't be processed by part of my php
code, but then later on in the page I can get the session value to output.

Also, just so that its clear, the mysql code is correct (I can put it into
phpmyadmin and get results from it.

Heres the code (this code is 'included' in another page, where the session
originates and session_start(); is set.)

<?php
// Lets see how much the person has at the moment.
    $current_resource_query = "SELECT food, wood, stone, gold, population
FROM game_resources WHERE user_id = '".$_SESSION['user_id']."'";
    $current_resource_result = mysql_query($current_resource_query);
    $current_resource = mysql_fetch_assoc($current_resource_result);
    
?>
<table width="100%" cellspacing="1" cellpadding="1">
  <tr>
    <td colspan="5"><?php $userid ?> <?php $_SESSION['username'] ?></td>
  </tr>
  <tr>
    <td width="20%">Food: <?php $current_resource['food'] ?></td>
    <td width="20%">Wood: <?php $current_resource['wood'] ?></td>
    <td width="20%">Stone: <?php $current_resource['stone'] ?></td>
    <td width="20%">Gold: <?php $current_resource['gold'] ?></td>
    <td width="20%">Session id is: <?php echo ''.$_SESSION['user_id'].''
?></td>
  </tr>
</table>

The error may not necessarily be to do with the session, but non of the
$current_resources are showing.

Thanks for any help guys/gals.

attached mail follows:


 <td colspan="5"><?php $userid ?> <?php $_SESSION['username'] ?></td>

that should be <?= $_SESSION['username'] ?> or <?php echo
$_SESSION['username']; ?>

its all in how you call the variables.. <?php $somevar ?> isint telling the
variable to do anything.

-phpninja

-----Original Message-----

From: Alex Major [*mailto:alex.majorallydm.co.uk* <alex.majorallydm.co.uk>]

Sent: Monday, June 19, 2006 8:26 AM

To: php-generallists.php.net

Subject: [PHP] An annoying session problem

Hi there.

I'm working my way through a new script, but I've stumbled into a problem.

Some data that I've set into a session, won't be processed by part of my php
code, but then later on in the page I can get the session value to output.

Also, just so that its clear, the mysql code is correct (I can put it into
phpmyadmin and get results from it.

Heres the code (this code is 'included' in another page, where the session
originates and session_start(); is set.)

<?php

// Lets see how much the person has at the moment.

$current_resource_query = "SELECT food, wood, stone, gold, population FROM
game_resources WHERE user_id = '".$_SESSION['user_id']."'";

$current_resource_result = mysql_query($current_resource_query);

$current_resource = mysql_fetch_assoc($current_resource_result);

?>

<table width="100%" cellspacing="1" cellpadding="1">

<tr>

<td colspan="5"><?php $userid ?> <?php $_SESSION['username'] ?></td>

</tr>

<tr>

<td width="20%">Food: <?php $current_resource['food'] ?></td>

<td width="20%">Wood: <?php $current_resource['wood'] ?></td>

<td width="20%">Stone: <?php $current_resource['stone'] ?></td>

<td width="20%">Gold: <?php $current_resource['gold'] ?></td>

<td width="20%">Session id is: <?php echo ''.$_SESSION['user_id'].''

?></td>

</tr>

</table>

The error may not necessarily be to do with the session, but non of the
$current_resources are showing.

Thanks for any help guys/gals.

--

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

attached mail follows:


Thanks for pointing that out, however I've changed the code to:

<?php
// Lets see how much the person has at the moment.
    $current_resource_query = "SELECT food, wood, stone, gold, population
FROM game_resources WHERE user_id = '".$_SESSION['user_id']."'";
    $current_resource_result = mysql_query($current_resource_query);
    $current_resource = mysql_fetch_assoc($current_resource_result);
    
?>
<table width="100%" cellspacing="1" cellpadding="1">
  <tr>
    <td colspan="5"><?php echo $_SESSION['username'] ?></td>
  </tr>
  <tr>
    <td width="20%">Food: <?php echo $current_resource['food'] ?></td>
    <td width="20%">Wood: <?php echo $current_resource['wood'] ?></td>
    <td width="20%">Stone: <?php echo $current_resource['stone'] ?></td>
    <td width="20%">Gold: <?php echo $current_resource['gold'] ?></td>
    <td width="20%">Session user_id is: <?php echo $_SESSION['user_id']
?></td>
  </tr>
</table>

And I'm still not getting the output correctly.
I don't think that the SELECT query is working properly, is there problem
with how I've put:
        WHERE user_id = '".$_SESSION['user_id']."'

Regards,
Alex.

On 19/6/06 16:51, "phpninja" <phpninjagmail.com> wrote:

> <td colspan="5"><?php $userid ?> <?php $_SESSION['username'] ?></td>
>
> that should be <?= $_SESSION['username'] ?> or <?php echo
> $_SESSION['username']; ?>
>
> its all in how you call the variables.. <?php $somevar ?> isint telling the
> variable to do anything.
>
> -phpninja

attached mail follows:


Alex Major wrote:
> Thanks for pointing that out, however I've changed the code to:
>
> <?php
> // Lets see how much the person has at the moment.
> $current_resource_query = "SELECT food, wood, stone, gold, population
> FROM game_resources WHERE user_id = '".$_SESSION['user_id']."'";
> $current_resource_result = mysql_query($current_resource_query);
> $current_resource = mysql_fetch_assoc($current_resource_result);
>
> ?>
> <table width="100%" cellspacing="1" cellpadding="1">
> <tr>
> <td colspan="5"><?php echo $_SESSION['username'] ?></td>
> </tr>
> <tr>
> <td width="20%">Food: <?php echo $current_resource['food'] ?></td>
> <td width="20%">Wood: <?php echo $current_resource['wood'] ?></td>
> <td width="20%">Stone: <?php echo $current_resource['stone'] ?></td>
> <td width="20%">Gold: <?php echo $current_resource['gold'] ?></td>
> <td width="20%">Session user_id is: <?php echo $_SESSION['user_id']
> ?></td>
> </tr>
> </table>
>
> And I'm still not getting the output correctly.
> I don't think that the SELECT query is working properly, is there problem
> with how I've put:
> WHERE user_id = '".$_SESSION['user_id']."'
>

1. Check $current_resource_result for equivalence (===) to false and
print mysql_error() if it is. That will tell you if the SQL query failed
and why.
2. You may also want to print $current_resource_query to confirm that
the session variable actually exists.
3. There is no 3, but there certainly is a spoon.

-Stut

attached mail follows:


Alex Major wrote:
>And I'm still not getting the output correctly.
>I don't think that the SELECT query is working properly, is there problem
>with how I've put:
> WHERE user_id = '".$_SESSION['user_id']."'

Maybe I'm all wet here, but what's the the periods?

Why isn't it:

WHERE user_id = '"$_SESSION['user_id']"'

or as I like to do.

$user_id = $_SESSION['user_id'];

WHERE user_id = '$user_id'

hth's & that I'm right.

tedd
--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


At 12:27 AM +0700 6/20/06, Gmail nya Suprie wrote:
>tedd wrote:
>>Alex Major wrote:
>>
>>>And I'm still not getting the output correctly.
>>>I don't think that the SELECT query is working properly, is there problem
>>>with how I've put:
>>> WHERE user_id = '".$_SESSION['user_id']."'
>>>
>>
>>Maybe I'm all wet here, but what's the the periods?
>>
>>Why isn't it:
>>
>>WHERE user_id = '"$_SESSION['user_id']"'
>>
>
>I don't think the script will work... the period is used to combine two variables or string
>example :
>$foo = "hai ";
>$bar = "there ";
>so $foo.$bar will produce "hai there"

Yes, I understand concatenation operators -- but I don't think they will work in this setting.

Just try my suggestion and see if it will work.

tedd

--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


Hmpf, well I feel like a real tit now.
I tried all the posted suggestions, and still couldn't figure out why it
wasn't working.
I went back to re-code the whole page from scratch, started off with include
'connection.php', then it hit me...i hadn't included the connection file in
the parent file to the include, so it wasn't (and couldn't) connect to the
database. I put the connection file into the parent file, and now its
working!

Sorry to have taken so much time up with such a silly little thing.

Regards,
Alex.

On 19/6/06 18:52, "tedd" <teddsperling.com> wrote:

> At 12:27 AM +0700 6/20/06, Gmail nya Suprie wrote:
>> tedd wrote:
>>> Alex Major wrote:
>>>
>>>> And I'm still not getting the output correctly.
>>>> I don't think that the SELECT query is working properly, is there problem
>>>> with how I've put:
>>>> WHERE user_id = '".$_SESSION['user_id']."'
>>>>
>>>
>>> Maybe I'm all wet here, but what's the the periods?
>>>
>>> Why isn't it:
>>>
>>> WHERE user_id = '"$_SESSION['user_id']"'
>>>
>>
>> I don't think the script will work... the period is used to combine two
>> variables or string
>> example :
>> $foo = "hai ";
>> $bar = "there ";
>> so $foo.$bar will produce "hai there"
>
> Yes, I understand concatenation operators -- but I don't think they will work
> in this setting.
>
> Just try my suggestion and see if it will work.
>
> tedd

attached mail follows:


On Mon, June 19, 2006 10:26 am, Alex Major wrote:
> Hi there.
> I'm working my way through a new script, but I've stumbled into a
> problem.
> Some data that I've set into a session, won't be processed by part of
> my php
> code, but then later on in the page I can get the session value to
> output.
>
> Also, just so that its clear, the mysql code is correct (I can put it
> into
> phpmyadmin and get results from it.
>
> Heres the code (this code is 'included' in another page, where the
> session
> originates and session_start(); is set.)
>
> <?php
> // Lets see how much the person has at the moment.
> $current_resource_query = "SELECT food, wood, stone, gold,
> population
> FROM game_resources WHERE user_id = '".$_SESSION['user_id']."'";

First, figure out if the query you THINK you are sending is what you
are sending:
echo $current_resource_query;

Yes, I know you said you did this, but keep it in here for debugging
for awhile.

Most crucial, is to make SURE the 'user_id' really is what you expect,
and not just glance at the 32-character gobbledy-gook and say "Yeah,
that's right."

> $current_resource_result = mysql_query($current_resource_query);

Next, you HAVE to do error-checking with mysql_error();

> $current_resource = mysql_fetch_assoc($current_resource_result);
>
> ?>
> <table width="100%" cellspacing="1" cellpadding="1">
> <tr>
> <td colspan="5"><?php $userid ?> <?php $_SESSION['username']
> ?></td>
> </tr>
> <tr>
> <td width="20%">Food: <?php $current_resource['food'] ?></td>
> <td width="20%">Wood: <?php $current_resource['wood'] ?></td>
> <td width="20%">Stone: <?php $current_resource['stone'] ?></td>
> <td width="20%">Gold: <?php $current_resource['gold'] ?></td>
> <td width="20%">Session id is: <?php echo
> ''.$_SESSION['user_id'].''
> ?></td>
> </tr>
> </table>
>
> The error may not necessarily be to do with the session, but non of
> the
> $current_resources are showing.
>
> Thanks for any help guys/gals.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


At 10:04 AM +0100 6/19/06, James Nunnerley wrote:
>Hi Folks,
>
>-snip-
>
>Are we missing something, or is it really magic?

It's really magic.

I've written a very simple example (code included) at:

http://www.weberdev.com/get_example-4349.html

and demo at:

http://xn--ovg.com/session

As for CAPTCHA, check out:

http://xn--ovg.com/captcha

hth's

tedd
--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


Richard Harding wrote:
> I am trying to get PDO going on a new desktop with Ubuntu 6.06. I have
> installed php5, php5-dev, etc and have php5 working with no problems. I
> then did a pecl install pdo and that installed ok. When I run phpinfo()
> I get that PDO is activated and the drivers has no value.
>
> I am now trying to install pdo_mysql and getting the following:
> checking for PDO includes... checking for PDO includes...
> /usr/include/php/ext
> configure: error:
> You've configured extension pdo_mysql, which depends on extension pdo,
> but you've either not enabled pdo, or have disabled it.
>
> ERROR: `/tmp/tmptDnQ5L/PDO_MYSQL-1.0.2/configure' failed
>
> When I list the contents of /usr/include/php/ext I get:
> ls /usr/include/php/ext/pdo
> php_pdo_driver.h php_pdo.h
>
> Any ideas as to where i need to go from here?

I ended up just finding instructions on manually building the pdo_mysql
driver.

http://bhiv.com/category/linux/

I'll go and post a bug in the Ubuntu package lists and see if there is
anything that can be done about how the packages are built, but at least
I have a not so bad answer. I can build my php install 90% from packages
and build one myself.

Thanks for the help.

Rick

attached mail follows:


I want to run filters on an pop3 inbox.

I have the following arrays which I'll get from the database-

$subject
$email
$body
$subject_like
$email_like
$body_like

I then go through each email in turn using this loop-

$popy = "{".$pop3."/pop3:110}INBOX";
   $mailbox = imap_open($popy, $un, $pw);
     $num_messages = imap_num_msg($mailbox);
if ($num_messages <= $no_srch) {$rrt = 0;} else {$rrt =
$num_messages-$no_srch;}
   for($i=$num_messages; $i>($rrt); $i--) {

What I want to do is to check if the email address or subject or body of
each email is exactly like any of the details stored in the arrays
$subject, $email, $body and to check if the email address or subject or
body contains a word or phrase from the arrays $subject_like,
$email_like, $body_like.

For example-

$subject[0] = "SPAM"; $email[0]= "";
$body[0] = "";
$subject_like[0] = "";
$email_like[0] = "";
$body_like[0] = "";
// If the subject of the email = "spam"

$subject[1] = ""; $email[1]= "spamspammer.com";
$body[1] = "";
$subject_like[1] = "";
$email_like[1] = "";
$body_like[1] = "";
// if the email address of the email = "spamspammer.com"

$subject[2] = ""; $email[2]= "";
$body[2] = "spam body text";
$subject_like[2] = "";
$email_like[2] = "";
$body_like[2] = "";
// if the body of the email = "spam body text"

$subject[3] = "SPAM"; $email[3]= "spamspammer.com";
$body[3] = "";
$subject_like[3] = "";
$email_like[3] = "";
$body_like[3] = "";
// if the subject of the email = "SPAM" AND the email address =
"spamspammer.com"

$subject[4] = "SPAM"; $email[4]= "";
$body[4] = "";
$subject_like[4] = "";
$email_like[4] = "";
$body_like[4] = "spam text";
// if the subject of the email = "SPAM" AND the body contains "spam text"

If any of the above conditions are met then the email message is then
stored in a database and deleted of the POP3 server.

Is there a quick way of doing the above? The only way I can think of is
by looping through each array for every email. This is really really
slow. I'd be grateful for some help here....

Ian

attached mail follows:


IG wrote:
> I want to run filters on an pop3 inbox.
>
> I have the following arrays which I'll get from the database-
>
> $subject
> $email
> $body
> $subject_like
> $email_like
> $body_like
>
> I then go through each email in turn using this loop-
>
>
>
> $popy = "{".$pop3."/pop3:110}INBOX";
> $mailbox = imap_open($popy, $un, $pw);
> $num_messages = imap_num_msg($mailbox);
> if ($num_messages <= $no_srch) {$rrt = 0;} else {$rrt =
> $num_messages-$no_srch;}
> for($i=$num_messages; $i>($rrt); $i--) {
>
>
> What I want to do is to check if the email address or subject or body of
> each email is exactly like any of the details stored in the arrays
> $subject, $email, $body and to check if the email address or subject or
> body contains a word or phrase from the arrays $subject_like,
> $email_like, $body_like.
>
> For example-
>
> $subject[0] = "SPAM"; $email[0]= "";
> $body[0] = "";
> $subject_like[0] = "";
> $email_like[0] = "";
> $body_like[0] = "";
> // If the subject of the email = "spam"
>
> $subject[1] = ""; $email[1]= "spamspammer.com";
> $body[1] = "";
> $subject_like[1] = "";
> $email_like[1] = "";
> $body_like[1] = "";
> // if the email address of the email = "spamspammer.com"
>
> $subject[2] = ""; $email[2]= "";
> $body[2] = "spam body text";
> $subject_like[2] = "";
> $email_like[2] = "";
> $body_like[2] = "";
> // if the body of the email = "spam body text"
>
> $subject[3] = "SPAM"; $email[3]= "spamspammer.com";
> $body[3] = "";
> $subject_like[3] = "";
> $email_like[3] = "";
> $body_like[3] = "";
> // if the subject of the email = "SPAM" AND the email address =
> "spamspammer.com"
>
> $subject[4] = "SPAM"; $email[4]= "";
> $body[4] = "";
> $subject_like[4] = "";
> $email_like[4] = "";
> $body_like[4] = "spam text";
> // if the subject of the email = "SPAM" AND the body contains "spam text"
>
>
> If any of the above conditions are met then the email message is then
> stored in a database and deleted of the POP3 server.
>
> Is there a quick way of doing the above? The only way I can think of is
> by looping through each array for every email. This is really really
> slow. I'd be grateful for some help here....
>
> Ian
>
>

Unless I'm mistaken,

for ( $x = 0; $x < count($subject); $x++ )
{
        if ( $subject[$x] == "SPAM" || $email[$x] == "spamspammer.com" ||
$body[$x] == "spam body text")
        {
                # Mail is spam! Do something.
        }
}

Or something like that. I'm not exactly sure what your criteria are.
What I'm doing above is looping through the mail messages one at a time,
and checking all aspects of that email in each loop iteration. If you're
doing complex analysis on each message, then that is probably the
fastest way.

If you're simply searching for things, you could always do array
searches. So, search through $email with array_search or perhaps
array_intersect. Then you don't need to loop at all.

Regards, Adam Zey.

attached mail follows:


On Mon, June 19, 2006 11:05 am, IG wrote:
> I want to run filters on an pop3 inbox.

You may want to just use IMAP protocol...

> I have the following arrays which I'll get from the database-
>
> $subject
> $email
> $body
> $subject_like
> $email_like
> $body_like
>
> I then go through each email in turn using this loop-

I do it just like this:

http://l-i-e.com/imap/index.phps

> $popy = "{".$pop3."/pop3:110}INBOX";
> $mailbox = imap_open($popy, $un, $pw);
> $num_messages = imap_num_msg($mailbox);
> if ($num_messages <= $no_srch) {$rrt = 0;} else {$rrt =
> $num_messages-$no_srch;}
> for($i=$num_messages; $i>($rrt); $i--) {
>
>
> What I want to do is to check if the email address or subject or body
> of
> each email is exactly like any of the details stored in the arrays
> $subject, $email, $body and to check if the email address or subject
> or
> body contains a word or phrase from the arrays $subject_like,
> $email_like, $body_like.
>
> For example-
>
> $subject[0] = "SPAM"; $email[0]= "";
> $body[0] = "";
> $subject_like[0] = "";
> $email_like[0] = "";
> $body_like[0] = "";
> // If the subject of the email = "spam"
>
> $subject[1] = ""; $email[1]= "spamspammer.com";
> $body[1] = "";
> $subject_like[1] = "";
> $email_like[1] = "";
> $body_like[1] = "";
> // if the email address of the email = "spamspammer.com"
>
> $subject[2] = ""; $email[2]= "";
> $body[2] = "spam body text";
> $subject_like[2] = "";
> $email_like[2] = "";
> $body_like[2] = "";
> // if the body of the email = "spam body text"
>
> $subject[3] = "SPAM"; $email[3]= "spamspammer.com";
> $body[3] = "";
> $subject_like[3] = "";
> $email_like[3] = "";
> $body_like[3] = "";
> // if the subject of the email = "SPAM" AND the email address =
> "spamspammer.com"
>
> $subject[4] = "SPAM"; $email[4]= "";
> $body[4] = "";
> $subject_like[4] = "";
> $email_like[4] = "";
> $body_like[4] = "spam text";
> // if the subject of the email = "SPAM" AND the body contains "spam
> text"
>
>
> If any of the above conditions are met then the email message is then
> stored in a database and deleted of the POP3 server.
>
> Is there a quick way of doing the above? The only way I can think of
> is
> by looping through each array for every email. This is really really
> slow. I'd be grateful for some help here....

I found that using SpamAssassin (SA), and setting up a different
directory for each 'score' in SA and then sorting my incoming email
for a month by 'score' into those boxes...

pretty much, everything scoring higher than 1 or 2 was spam.

After I trashed all 3+ SA, my own personal spam filters in PHP were
pretty superfluous.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Manuel:

Thank you for your most detailed explanation -- I must admit most of it is over my head. However, I shall study the concept further and place your email in my "to learn" collection (I have one and it's growing faster than I can keep up).

But as of now, I can now run one php application from another, which was the request that started this thread.

tedd

----

At 3:48 AM -0500 6/19/06, Manuel Amador (Rudd-O) wrote:
>PHP tends to send output in content transfer encoding "chunked" (I think
>this is true when output buffering is on). <?php ?> blocks usually have
>their output sent in one chunk. The browser renders the chunks as they
>come, but oftentimes they delay rendering until a sensible number of
>HTML closing tags have arrived.
>
>Now, on to the real answer to your question. No, under normal
>conditions you can't have your users' browsers interact with a live PHP
>script. Web programming is Web REQUEST->PHP RESPONSE, and you must use
>support technology (like sessions, cookies or manual carryover of form
>data) to make session state persistence possible.
>
>In other words: no, if the user clicks a button, it doesn't "call a
>function or branch in an if/then control statement" immediately.
>Rather, an entirely new PHP process, totally unaware of the former one,
>is called upon to service that request.
>
>Now, while in the PHP realm, there *is* one way to have your web client
>follow the pattern "REQUEST->RESPONSE,RESPONSE,RESPONSE" ad infinitum.
>
>This is called slow loading (or Comet), and basically involves:
>
>- having the web client load a PHP script through a hidden IFRAME
>- having the PHP script *never* finish execution (unless, of course, the
>user hits Stop in his browser window), and continually send data through
>the connection (plus one ob_flush() after each chunk just to be
>politically correct). Usually, data payloads ("page updates") are to be
>carried on via JavaScript snippets, because that's about the only
>technology that allows for browser state manipulation "in vivo", I mean,
>live as the connection goes and never finishes.
>
>Given a properly architected solution, this kind of technology can
>outperform the famous AJAX, both in response times and in server load.
>Given a poorly done solution, this kind of technology can be as bad or
>dramatically worse than AJAX.
>
>Plus, you gotta remember that PHP usually has a maximum duration on
>scripts, so you need to architect around that (which isn't hard to do,
>namely you have a counter and as the counter approaches the maximum load
>time, just a few seconds earlier you send a <script>location.href
>= ...</script> to have the browser reload the IFRAME, and exit() your
>PHP script.
>
>
>
>El vie, 16-06-2006 a las 17:04 -0400, tedd escribió:
>> At 3:52 PM -0500 6/16/06, Richard Lynch wrote:
>> >On Fri, June 16, 2006 8:26 am, tedd wrote:
>> >> At 2:35 PM +0200 6/16/06, Barry wrote:
>> >>>But once output is made. You can't remove it.
>> >>>
>> >>>That isn't possible with PHP.
>> >>
>> >> I think I get it now.
>> >>
>> >> PHP does everything before the user see's anything.
>> >
>> >This is not quite 100% correct...
>> >
>> >PHP output is buffered, possibly by PHP with ob_start and friends, and
>> >then possibly by Apache, and then possibly by TCP packets and their
>> >ordered arrival (or not) and then by the browser, but...
>> >
>> >It is entirely possible to construct a trivial example proving that
>> >PHP can still be runing and finishing output while the browser has
>> >rendered the beginning of the page.
>> >
>> >You can mostly THINK of it as PHP finishing before user sees anything,
>> >as that will get you in a lot less trouble than thinking the other way
>> >around, but to be pedantic, you should be aware it's not quite that
>> >simple.
>>
>> Good explanation and point.
>>
>> How's this for the obvious -- the user doesn't see anything until php is done with it. That doesn't mean that the entire operation must be finished, but rather anything that the user see's (while and after loading) php has already finished with.
> >
>> That about right?
>>
>> tedd
>> --
>> ------------------------------------------------------------------------------------
>> http://sperling.com http://ancientstones.com http://earthstones.com
>>

--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


Hi there,

I'm writing some code that looks at a video file given to it and writes up
the correct embed html and outputs it to the browser. I though that I would
use mime_content_type() function to detect the type of each video, but after
enabling it, I found that it doesn't have the mime type for windows media
player. After some researching I had some following questions:

1. Can someone explain what each column means in the magic.mime file:

0 short 0143561 application/x-bcpio

2. Does anyone have any windows media, realplayer mime types they'd like to
share for the magic.mime file

3. I saw that the mime_type extension have been deprecated in favor of pecl
fileinfo, is installing and using the pecl extension as easy as pear install
fileinfo? Does it detect windows media, real player, and quicktime videos?

4. Any other suggestions on detecting what type of video file is being
processed? I suppose looking at file extensions is another method, though I
like the idea of mime type detection over file extension examination.

Thanks, Mark

attached mail follows:


Mark Steudel wrote:
> Hi there,
>
> I'm writing some code that looks at a video file given to it and writes up
> the correct embed html and outputs it to the browser. I though that I would
> use mime_content_type() function to detect the type of each video, but after
> enabling it, I found that it doesn't have the mime type for windows media
> player. After some researching I had some following questions:
>
> 1. Can someone explain what each column means in the magic.mime file:
>
> 0 short 0143561 application/x-bcpio
>
> 2. Does anyone have any windows media, realplayer mime types they'd like to
> share for the magic.mime file
>
> 3. I saw that the mime_type extension have been deprecated in favor of pecl
> fileinfo, is installing and using the pecl extension as easy as pear install

I believe that it should be:

pecl install fileinfo

> fileinfo? Does it detect windows media, real player, and quicktime videos?

I have no idea. reading the source of the extension gives me the impression
that it may rely on the same magic.mime file you have been looking at (I
might very well be completely wrong) - at any rate it relies on some kind of
'mime db'

>
> 4. Any other suggestions on detecting what type of video file is being
> processed? I suppose looking at file extensions is another method, though I
> like the idea of mime type detection over file extension examination.

looking at the file extension is a bit lame and definitely insecure ...
going the route of checking the mimetype (i.e. using code that actually checks
the file to try to determine what it is) would be the way to go.

then again maybe you could do both to cover all bases (e.g. file extension check fallback)?

[just thinking out loud]

>
> Thanks, Mark
>

attached mail follows:


I have a field that contains a value in parenthesis', but also contains
other text, for instance; (it is a legacy app that I am working with,
and by legacy I am saying pre-1980)

Upper voltage (124.1)

I know that \([0-9]*\) will get me (124.1), but I am totally forgetting
how to get 124.1 without the parenthesis without trimming ...ack. Swift
kickage appreciated.

Thanks!

Jay Blanchard
Pocket Communications
Systems Manager
210-447-1221

attached mail follows:


Jay Blanchard wrote:
> I have a field that contains a value in parenthesis', but also contains
> other text, for instance; (it is a legacy app that I am working with,
> and by legacy I am saying pre-1980)
>
> Upper voltage (124.1)
>
> I know that \([0-9]*\) will get me (124.1), but I am totally forgetting
> how to get 124.1 without the parenthesis without trimming ...ack. Swift
> kickage appreciated.
>
\(([0-9]*)\)

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnicheldotcomholdingsofbuffalo.com

attached mail follows:


On Mon, 2006-06-19 at 14:42, John Nichel wrote:
> Jay Blanchard wrote:
> > I have a field that contains a value in parenthesis', but also contains
> > other text, for instance; (it is a legacy app that I am working with,
> > and by legacy I am saying pre-1980)
> >
> > Upper voltage (124.1)
> >
> > I know that \([0-9]*\) will get me (124.1), but I am totally forgetting
> > how to get 124.1 without the parenthesis without trimming ...ack. Swift
> > kickage appreciated.
> >
> \(([0-9]*)\)

Jay,

You won't match the dot btw:

    \(([.0-9]*)\)

Which is crude since it will match more than one dot :)

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:


[snip]
\(([0-9]*)\)
[/snip]

I had done this before and still get the parenthesis...

ereg("\(([0-9]*)\)", "Upper Voltage (124.1)", $regs);

attached mail follows:


[snip]
You won't match the dot btw:

    \(([.0-9]*)\)

Which is crude since it will match more than one dot :)
[/snip]

Typo on my part.... \(([0-9\.]*)\)...but still gets parenthesis

attached mail follows:


Jay Blanchard wrote:
> [snip]
> \(([0-9]*)\)
> [/snip]
>
> I had done this before and still get the parenthesis...
>
> ereg("\(([0-9]*)\)", "Upper Voltage (124.1)", $regs);
>

Ahhhh....not PCRE. Can't help you there, as I've never used the ereg
functions. However...

preg_match ( "/\((\d{1,}.*?)\)/", "Upper Voltage (124.1)", $regs );

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnicheldotcomholdingsofbuffalo.com

attached mail follows:


[snip]
Ahhhh....not PCRE. Can't help you there, as I've never used the ereg
functions. However...

preg_match ( "/\((\d{1,}.*?)\)/", "Upper Voltage (124.1)", $regs );
[/snip]

Still returns parentheses

ereg("[^\(][0-9\.]*" , "Upper Voltage (124.1)", $regs );

gets rid of opening bracket, but

ereg("[^\(][0-9\.]*[^\)]" , "Upper Voltage (124.1)", $regs );

doesn't

attached mail follows:


Jay Blanchard wrote:
> [snip]
> Ahhhh....not PCRE. Can't help you there, as I've never used the ereg
> functions. However...
>
> preg_match ( "/\((\d{1,}.*?)\)/", "Upper Voltage (124.1)", $regs );
> [/snip]
>
> Still returns parentheses
>
> ereg("[^\(][0-9\.]*" , "Upper Voltage (124.1)", $regs );
>
> gets rid of opening bracket, but
>
> ereg("[^\(][0-9\.]*[^\)]" , "Upper Voltage (124.1)", $regs );
>
> doesn't
>

Do you have to use ereg? The preg_match pattern I posted works fine.
It will return an array, first element being the whole string it
matched, next element will be what it matched _inside_ the parentheses
(less the parentheses) (if it matches anything that is).

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnicheldotcomholdingsofbuffalo.com

attached mail follows:


[snip]
Do you have to use ereg? The preg_match pattern I posted works fine.
It will return an array, first element being the whole string it
matched, next element will be what it matched _inside_ the parentheses
(less the parentheses) (if it matches anything that is).
[/snip]

Thanks John....the brain fart continued. I was echoing $regs[0] instead
of $regs[1]....too many hours, not enough caffeine or sleep. I am
getting too old....

attached mail follows:


For what it's worth, most cell phone providers have an email gateway which
works just as good as an SMS message (and it's free!).

Just find the email address to send to for each carrier and store in a
table.

For example, for my Cingular (AT&T) phone, it is my XXXXXXXXXXmmode.com
Where the X's represent the phone number.

Cheers,

DÆVID

> -----Original Message-----
> From: Ryan A [mailto:genphpyahoo.com]
> Sent: Sunday, June 18, 2006 11:17 AM
> To: php php
> Subject: [PHP] SMS with php recommendation (a bit 0T i guess)
>
> Hey,
>
> Right now I am using PSWIN to send SMS messages from
> my php scripts, can anybody recommend a (reliable)
> company that i can use instead?
>
> We "fill up" on 25euros everytime on pswin, so i am
> not looking for a "free" provider, just a reliable and
> good priced one.
>
> PSwin is good, problem is they are charging us a euro
> .20 per day just for using the service, so even if we
> dont send a single sms per day we are getting
> charged...not good.
>
> Thanks,
> Ryan
>
> ------
> - The faulty interface lies between the chair and the keyboard.
> - Creativity is great, but plagiarism is faster!
> - Smile, everyone loves a moron. :-)
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


http://www.php.net/manual/en/function.unset.php

So if you had:
$foo = Array ( [0] => 2, [ID] => 2, [1] => asdasd, [CategoryName] => asdasd
) );

unset($foo[0]);
unset($foo[1]);

Yields:

$foo = Array ( [ID] => 2, [CategoryName] => asdasd ) );

DÆVID

> -----Original Message-----
> From: Richard Lynch [mailto:ceol-i-e.com]
> Sent: Monday, June 12, 2006 12:49 PM
> To: Ahmed Abdel-Aliem
> Cc: php-generallists.php.net
> Subject: Re: [PHP] remove keys from array
>
> On Sun, June 11, 2006 6:57 am, Ahmed Abdel-Aliem wrote:
> > hi all
> > when i have array in the form of :
> > Array ( [0] => 2 [ID] => 2 [1] => asdasd [CategoryName] =>
> asdasd ) )
> > how can i make it in the form of :
> > Array ( [ID] => 2 [CategoryName] => asdasd ) )
> >
> > can anyone help me with that plz ?
>
>
> I don't even understand the question...
>
> Where did this array come from?
>
>
> --
> Like Music?
> http://l-i-e.com/artists.htm
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Ok, I am still trying to get this figured out from what I tried doing last night. If anybody wants to try it, please be my guest. This is the deal. Create an INTEGER table. Put the numbers 1 - 24 in it. Leave out like number 8, 9, 22, 23 ect.. Now create a php statement that will take and pull that out of the database, find out the missing numbers and display them as an html drop down selection.

And tedd in response to why, is because the values that are already located in the database represent in use already. They represent a server port that a server is sitting on, so that's not the problem. I could have done that along time ago.

Any help is appreciated but here is the current code that I have.

  $query="SELECT switchport FROM network";
  $result=mysql_query($query);
  $sql_range=mysql_fetch_array($result);
  $true_range=range(1,24);
  $next_range=array_diff($true_range,$sql_range);
  foreach ($next_range as $final_range) {
     echo "<option value='$final_range'>$final_range\n";
  }

attached mail follows:


Rob W. wrote:
> Ok, I am still trying to get this figured out from what I tried doing last night. If anybody wants to try it, please be my guest. This is the deal.
> Create an INTEGER table. Put the numbers 1 - 24 in it.
> Leave out like number 8, 9, 22, 23 ect..

I'll assume the DB creation and filling is something you have already covered/dealt with.

> Now create a php statement that will take and pull that out of the database,

this you have already (as per your example code).

> find out the missing numbers and display them as an html drop down selection.
> And tedd in response to why, is because the values that are already located in the
> database represent in use already. They represent a server port that a server is sitting on
> , so that's not the problem. I could have done that along time ago.

huh? whats not a problem, what could have done a long time ago? (and why didn't you?)

> Any help is appreciated but here is the current code that I have.
>

try the apples below....

>
> $query="SELECT switchport FROM network";
> $result=mysql_query($query);
> $sql_range=mysql_fetch_array($result);
> $true_range=range(1,24);
> $next_range=array_diff($true_range,$sql_range);
> foreach ($next_range as $final_range) {
> echo "<option value='$final_range'>$final_range\n";
> }
>

$sqlRange = array();
if ($res = mysql_query('SELECT switchport FROM network')) {
        while ($row = mysql_fetch_array($res)) $sqlRange[] = $row['switchport'];
}

echo '<select name="port">';
foreach (array_diff(range(1,24), $sqlRange) as $port) {
        echo '<option value="',$port,'">',$port,'</option>';
}
echo '</select>';

/*

NOTE:

1. you have to loop your mysql result to get each port that is already used in the DB into you array
2. try to output something that resembles proper HTML (an <option> without a closing tag sucks)

 */

attached mail follows:


Jochem Maas wrote:
<snip>
> echo '<option value="',$port,'">',$port,'</option>';
<snip>
> 2. try to output something that resembles proper HTML (an <option> without a closing tag sucks)
>

Pfffftttt I never close my option tags that way....

<option value="foo" />Bar

:-p

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnicheldotcomholdingsofbuffalo.com

attached mail follows:


John Nichel wrote:
> Pfffftttt I never close my option tags that way....
>
> <option value="foo" />Bar
>
> :-p
>
I didn't think this would compute as proper XHTML...Sure enough
validator.w3c.org says:

Error /Line 10 column 10/: character data is not allowed here.

|<option />*t*est|

You have used character data somewhere it is not permitted to appear.
Mistakes that can cause this error include putting text directly in the
body of the document without wrapping it in a container element (such as
a <p>aragraph</p>) or forgetting to quote an attribute value (where
characters such as "%" and "/" are common, but cannot appear without
surrounding quotes).

attached mail follows:


At 5:48 PM -0400 6/19/06, Jon Anderson wrote:
>John Nichel wrote:
>>Pfffftttt I never close my option tags that way....
>>
>><option value="foo" />Bar
>>
>>:-p
>>
>I didn't think this would compute as proper XHTML...Sure enough validator.w3c.org says:
>
>Error /Line 10 column 10/: character data is not allowed here.
>
>|<option />*t*est|
>
>You have used character data somewhere it is not permitted to appear. Mistakes that can cause this error include putting text directly in the body of the document without wrapping it in a container element (such as a <p>aragraph</p>) or forgetting to quote an attribute value (where characters such as "%" and "/" are common, but cannot appear without surrounding quotes).

It depends upon what DOCTYPE you use.

For example, if you use:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

There's nothing wrong with closing, or not closing, an option tag in just about any fashion you want. In fact all four below will validate:

<option value="123" > item

<option value="123" /> item

<option value="123"> item </option>

<option value="123"/> item </option>

As far as using "value=", I believe the DOCTYPE determines what tags are allowed what attributes.

As for XHTML, I find that an unusual bird for validation and getting things to work well.

tedd

--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


John Nichel wrote:
> Jochem Maas wrote:
> <snip>
>> echo '<option value="',$port,'">',$port,'</option>';
> <snip>
>> 2. try to output something that resembles proper HTML (an <option>
>> without a closing tag sucks)
>>
>
> Pfffftttt I never close my option tags that way....
>
> <option value="foo" />Bar

but that's different, you have your official dr. Evil's certification
of evilHTML(tm) engineering. :->

>
> :-p
>

attached mail follows:


This also didnt work, Still giving me no output just like the last try.
  ----- Original Message -----
  From: Xavier Casto
  To: Rob W.
  Cc: php-generallists.php.net
  Sent: Monday, June 19, 2006 4:33 PM
  Subject: Re: [PHP] Still trying to figure this out...

  Have you ever thought of doing something like this:

  for($i = 0; $i <= $maxport; $i++)
  {
      $query="SELECT switchport FROM network WHERE switchport = ".$i;
      $result=mysql_query($query);
      if(empty($result))
      {
          echo "<p>$i</p>";
      }
  }

  It should only return the ones that aren't in the table and they will automatically be sorted in ascending order.

  On 6/19/06, Rob W. <robfiberuplink.com> wrote:
    Ok, I am still trying to get this figured out from what I tried doing last night. If anybody wants to try it, please be my guest. This is the deal. Create an INTEGER table. Put the numbers 1 - 24 in it. Leave out like number 8, 9, 22, 23 ect.. Now create a php statement that will take and pull that out of the database, find out the missing numbers and display them as an html drop down selection.

    And tedd in response to why, is because the values that are already located in the database represent in use already. They represent a server port that a server is sitting on, so that's not the problem. I could have done that along time ago.

    Any help is appreciated but here is the current code that I have.

      $query="SELECT switchport FROM network";
      $result=mysql_query($query);
      $sql_range=mysql_fetch_array($result);
      $true_range=range(1,24);
      $next_range=array_diff($true_range,$sql_range);
      foreach ($next_range as $final_range) {
         echo "<option value='$final_range'>$final_range\n";
      }

attached mail follows:


Yep, and still nothing output's.

----- Original Message -----
From: "Xavier Casto" <xaviercasto.net>
To: "'Rob W.'" <robfiberuplink.com>
Cc: <php-generallists.php.net>
Sent: Monday, June 19, 2006 6:20 PM
Subject: RE: [PHP] Still trying to figure this out...

> You did make sure to assign a numerical value to $maxport?
>
> -----Original Message-----
> From: Rob W. [mailto:robfiberuplink.com]
> Sent: Monday, June 19, 2006 6:15 PM
> To: php-generallists.php.net
> Subject: Re: [PHP] Still trying to figure this out...
>
> This also didnt work, Still giving me no output just like the last try.
> ----- Original Message -----
> From: Xavier Casto
> To: Rob W.
> Cc: php-generallists.php.net
> Sent: Monday, June 19, 2006 4:33 PM
> Subject: Re: [PHP] Still trying to figure this out...
>
>
> Have you ever thought of doing something like this:
>
> for($i = 0; $i <= $maxport; $i++)
> {
> $query="SELECT switchport FROM network WHERE switchport = ".$i;
> $result=mysql_query($query);
> if(empty($result))
> {
> echo "<p>$i</p>";
> }
> }
>
>
> It should only return the ones that aren't in the table and they will
> automatically be sorted in ascending order.
>
>
>
> On 6/19/06, Rob W. <robfiberuplink.com> wrote:
> Ok, I am still trying to get this figured out from what I tried doing
> last night. If anybody wants to try it, please be my guest. This is the
> deal. Create an INTEGER table. Put the numbers 1 - 24 in it. Leave out
> like
> number 8, 9, 22, 23 ect.. Now create a php statement that will take and
> pull
> that out of the database, find out the missing numbers and display them as
> an html drop down selection.
>
> And tedd in response to why, is because the values that are already
> located in the database represent in use already. They represent a server
> port that a server is sitting on, so that's not the problem. I could have
> done that along time ago.
>
> Any help is appreciated but here is the current code that I have.
>
>
> $query="SELECT switchport FROM network";
> $result=mysql_query($query);
> $sql_range=mysql_fetch_array($result);
> $true_range=range(1,24);
> $next_range=array_diff($true_range,$sql_range);
> foreach ($next_range as $final_range) {
> echo "<option value='$final_range'>$final_range\n";
> }
>
>
>
>
>
>

attached mail follows:


Nope, I still dont get anything back from that.

So i'm still stuck in the mud.

----- Original Message -----
From: "Jochem Maas" <jochemiamjochem.com>
To: "Rob W." <robfiberuplink.com>
Cc: <php-generallists.php.net>
Sent: Monday, June 19, 2006 4:05 PM
Subject: Re: [PHP] Still trying to figure this out...

> Rob W. wrote:
>> Ok, I am still trying to get this figured out from what I tried doing
>> last night. If anybody wants to try it, please be my guest. This is the
>> deal.
>> Create an INTEGER table. Put the numbers 1 - 24 in it.
>> Leave out like number 8, 9, 22, 23 ect..
>
> I'll assume the DB creation and filling is something you have already
> covered/dealt with.
>
>> Now create a php statement that will take and pull that out of the
>> database,
>
> this you have already (as per your example code).
>
>> find out the missing numbers and display them as an html drop down
>> selection.
>> And tedd in response to why, is because the values that are already
>> located in the
>> database represent in use already. They represent a server port that a
>> server is sitting on
>> , so that's not the problem. I could have done that along time ago.
>
> huh? whats not a problem, what could have done a long time ago? (and why
> didn't you?)
>
>> Any help is appreciated but here is the current code that I have.
>>
>
> try the apples below....
>
>>
>> $query="SELECT switchport FROM network";
>> $result=mysql_query($query);
>> $sql_range=mysql_fetch_array($result);
>> $true_range=range(1,24);
>> $next_range=array_diff($true_range,$sql_range);
>> foreach ($next_range as $final_range) {
>> echo "<option value='$final_range'>$final_range\n";
>> }
>>
>
> $sqlRange = array();
> if ($res = mysql_query('SELECT switchport FROM network')) {
> while ($row = mysql_fetch_array($res)) $sqlRange[] = $row['switchport'];
> }
>
> echo '<select name="port">';
> foreach (array_diff(range(1,24), $sqlRange) as $port) {
> echo '<option value="',$port,'">',$port,'</option>';
> }
> echo '</select>';
>
> /*
>
> NOTE:
>
> 1. you have to loop your mysql result to get each port that is already
> used in the DB into you array
> 2. try to output something that resembles proper HTML (an <option> without
> a closing tag sucks)
>
> */
>
>

attached mail follows:


On Mon, 2006-06-19 at 16:39, Rob W. wrote:
> Ok, I am still trying to get this figured out from what I tried doing last night. If anybody wants to try it, please be my guest. This is the deal. Create an INTEGER table. Put the numbers 1 - 24 in it. Leave out like number 8, 9, 22, 23 ect.. Now create a php statement that will take and pull that out of the database, find out the missing numbers and display them as an html drop down selection.
>
> And tedd in response to why, is because the values that are already located in the database represent in use already. They represent a server port that a server is sitting on, so that's not the problem. I could have done that along time ago.
>
> Any help is appreciated but here is the current code that I have.
>
>
  $query="SELECT switchport FROM network";
> $result=mysql_query($query);
> $sql_range=mysql_fetch_array($result);
> $true_range=range(1,24);
> $next_range=array_diff($true_range,$sql_range);
> foreach ($next_range as $final_range) {
> echo "<option value='$final_range'>$final_range\n";
> }

<?php

    $range = array_flip( range( 1, 24 ) );

    $query = "SELECT switchport FROM network ";
    if( ($result = mysql_query( $query )) !== false )
    {
        while( ($row = mysql_fetch_array( $result )) !== false )
        {
            unset( $range[$row[0]] );
        }
    }

    foreach( $range as $switchport => $foo )
    {
        echo '<option value="'.$switchport.'">'.$switchport.'</option>'."\n";
    }

?>

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:


Yeah, that's what i'm trying to print is the missing numbers in the db.

That's what I've been trying to figure out this whole time.

----- Original Message -----
From: "Xavier Casto" <xaviercasto.net>
To: "'Rob W.'" <robfiberuplink.com>
Cc: <php-generallists.php.net>
Sent: Monday, June 19, 2006 6:34 PM
Subject: RE: [PHP] Still trying to figure this out...

>
> Are there any numbers missing in your database table between 0 and the
> number you assigned to $maxport?
>
> -----Original Message-----
> From: Rob W. [mailto:robfiberuplink.com]
> Sent: Monday, June 19, 2006 6:26 PM
> To: php-generallists.php.net
> Subject: Re: [PHP] Still trying to figure this out...
>
> Yep, and still nothing output's.
>
>
> ----- Original Message -----
> From: "Xavier Casto" <xaviercasto.net>
> To: "'Rob W.'" <robfiberuplink.com>
> Cc: <php-generallists.php.net>
> Sent: Monday, June 19, 2006 6:20 PM
> Subject: RE: [PHP] Still trying to figure this out...
>
>
>> You did make sure to assign a numerical value to $maxport?
>>
>> -----Original Message-----
>> From: Rob W. [mailto:robfiberuplink.com]
>> Sent: Monday, June 19, 2006 6:15 PM
>> To: php-generallists.php.net
>> Subject: Re: [PHP] Still trying to figure this out...
>>
>> This also didnt work, Still giving me no output just like the last try.
>> ----- Original Message -----
>> From: Xavier Casto
>> To: Rob W.
>> Cc: php-generallists.php.net
>> Sent: Monday, June 19, 2006 4:33 PM
>> Subject: Re: [PHP] Still trying to figure this out...
>>
>>
>> Have you ever thought of doing something like this:
>>
>> for($i = 0; $i <= $maxport; $i++)
>> {
>> $query="SELECT switchport FROM network WHERE switchport = ".$i;
>> $result=mysql_query($query);
>> if(empty($result))
>> {
>> echo "<p>$i</p>";
>> }
>> }
>>
>>
>> It should only return the ones that aren't in the table and they will
>> automatically be sorted in ascending order.
>>
>>
>>
>> On 6/19/06, Rob W. <robfiberuplink.com> wrote:
>> Ok, I am still trying to get this figured out from what I tried doing
>> last night. If anybody wants to try it, please be my guest. This is the
>> deal. Create an INTEGER table. Put the numbers 1 - 24 in it. Leave out
>> like
>> number 8, 9, 22, 23 ect.. Now create a php statement that will take and
>> pull
>> that out of the database, find out the missing numbers and display them
>> as
>> an html drop down selection.
>>
>> And tedd in response to why, is because the values that are already
>> located in the database represent in use already. They represent a server
>> port that a server is sitting on, so that's not the problem. I could have
>> done that along time ago.
>>
>> Any help is appreciated but here is the current code that I have.
>>
>>
>> $query="SELECT switchport FROM network";
>> $result=mysql_query($query);
>> $sql_range=mysql_fetch_array($result);
>> $true_range=range(1,24);
>> $next_range=array_diff($true_range,$sql_range);
>> foreach ($next_range as $final_range) {
>> echo "<option value='$final_range'>$final_range\n";
>> }
>>
>>
>>
>>
>>
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

attached mail follows:


On Mon, June 19, 2006 3:39 pm, Rob W. wrote:
> $query="SELECT switchport FROM network";
> $result=mysql_query($query);

//If you wanna use fetch_array or whatever, fine.
//But I dunno how to use it and don't care to learn.
//And haven't felt the need for a decade now.
//So there :-)
while (list($switchport) = msyql_fetch_row($result)){

//> $sql_range=mysql_fetch_array($result);

  $sql_range[] = $switchport;
}

> $true_range=range(1,24);
> $next_range=array_diff($true_range,$sql_range);
> foreach ($next_range as $final_range) {
> echo "<option value='$final_range'>$final_range\n";
> }

Your previous code had only one (1) switchport from the DB, the first
one in use.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Rob W. wrote:
> Nope, I still dont get anything back from that.

it will AT THE VERY LEAST return the string:

        '<select name="port"></select>'

do you have any idea what you have in your database???

and have you ever heard of print_r() or var_dump()? you can use them
to *investigate* your problem.

...

>> $sqlRange = array();
>> if ($res = mysql_query('SELECT switchport FROM network')) {
>> while ($row = mysql_fetch_array($res)) $sqlRange[] = $row['switchport'];
>> }

var_dump($sqlRange, array_diff(range(1,24), $sqlRange));

>>
>> echo '<select name="port">';
>> foreach (array_diff(range(1,24), $sqlRange) as $port) {
>> echo '<option value="',$port,'">',$port,'</option>';
>> }
>> echo '</select>';
>>
>> /*
>>
>> NOTE:
>>
>> 1. you have to loop your mysql result to get each port that is already
>> used in the DB into you array
>> 2. try to output something that resembles proper HTML (an <option>
>> without a closing tag sucks)
>>
>> */
>>
>>
>

attached mail follows:


Nope, still does nothing.

----- Original Message -----
From: "Xavier Casto" <xaviercasto.net>
To: "'Rob W.'" <robfiberuplink.com>
Cc: <php-generallists.php.net>
Sent: Monday, June 19, 2006 6:49 PM
Subject: RE: [PHP] Still trying to figure this out...

>I think the problem is I forgot to reset $result to 0....
>
>
>> for($i = 0; $i <= $maxport; $i++)
>> {
>> $query="SELECT switchport FROM network WHERE switchport = ".$i;
>> $result=mysql_query($query);
>> if(empty($result))
>> {
>> echo "<p>$i</p>";
>
> $result=0;
>
>> }
>> }
>
>
> Though I still haven't tested it, I don't have a current installation of
> MySQL...
>
> -----Original Message-----
> From: Xavier Casto [mailto:xaviercasto.net]
> Sent: Monday, June 19, 2006 6:34 PM
> To: 'Rob W.'
> Cc: php-generallists.php.net
> Subject: RE: [PHP] Still trying to figure this out...
>
>
> Are there any numbers missing in your database table between 0 and the
> number you assigned to $maxport?
>
> -----Original Message-----
> From: Rob W. [mailto:robfiberuplink.com]
> Sent: Monday, June 19, 2006 6:26 PM
> To: php-generallists.php.net
> Subject: Re: [PHP] Still trying to figure this out...
>
> Yep, and still nothing output's.
>
>
> ----- Original Message -----
> From: "Xavier Casto" <xaviercasto.net>
> To: "'Rob W.'" <robfiberuplink.com>
> Cc: <php-generallists.php.net>
> Sent: Monday, June 19, 2006 6:20 PM
> Subject: RE: [PHP] Still trying to figure this out...
>
>
>> You did make sure to assign a numerical value to $maxport?
>>
>> -----Original Message-----
>> From: Rob W. [mailto:robfiberuplink.com]
>> Sent: Monday, June 19, 2006 6:15 PM
>> To: php-generallists.php.net
>> Subject: Re: [PHP] Still trying to figure this out...
>>
>> This also didnt work, Still giving me no output just like the last try.
>> ----- Original Message -----
>> From: Xavier Casto
>> To: Rob W.
>> Cc: php-generallists.php.net
>> Sent: Monday, June 19, 2006 4:33 PM
>> Subject: Re: [PHP] Still trying to figure this out...
>>
>>
>> Have you ever thought of doing something like this:
>>
>> for($i = 0; $i <= $maxport; $i++)
>> {
>> $query="SELECT switchport FROM network WHERE switchport = ".$i;
>> $result=mysql_query($query);
>> if(empty($result))
>> {
>> echo "<p>$i</p>";
>> }
>> }
>>
>>
>> It should only return the ones that aren't in the table and they will
>> automatically be sorted in ascending order.
>>
>>
>>
>> On 6/19/06, Rob W. <robfiberuplink.com> wrote:
>> Ok, I am still trying to get this figured out from what I tried doing
>> last night. If anybody wants to try it, please be my guest. This is the
>> deal. Create an INTEGER table. Put the numbers 1 - 24 in it. Leave out
>> like
>> number 8, 9, 22, 23 ect.. Now create a php statement that will take and
>> pull
>> that out of the database, find out the missing numbers and display them
>> as
>> an html drop down selection.
>>
>> And tedd in response to why, is because the values that are already
>> located in the database represent in use already. They represent a server
>> port that a server is sitting on, so that's not the problem. I could have
>> done that along time ago.
>>
>> Any help is appreciated but here is the current code that I have.
>>
>>
>> $query="SELECT switchport FROM network";
>> $result=mysql_query($query);
>> $sql_range=mysql_fetch_array($result);
>> $true_range=range(1,24);
>> $next_range=array_diff($true_range,$sql_range);
>> foreach ($next_range as $final_range) {
>> echo "<option value='$final_range'>$final_range\n";
>> }
>>
>>
>>
>>
>>
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

attached mail follows:


    $range = array_flip( range( 1, 24 ) );

    $query = "SELECT switchport FROM network ";
    if( ($result = mysql_query( $query )) !== false )
    {
        while( ($row = mysql_fetch_array( $result )) !== false )
        {
            unset( $range[$row[0]] );
        }
    }

    foreach( $range as $switchport => $foo )
    {
        echo '<option
value="'.$switchport.'">'.$switchport.'</option>'."\n";

        $result = 0;
    }

With that, I dont get anything, Not sure what you mean by empty to is_null
ect..

- Rob

----- Original Message -----
From: "Xavier Casto" <xaviercasto.net>
To: "'Rob W.'" <robfiberuplink.com>
Cc: <php-generallists.php.net>
Sent: Monday, June 19, 2006 7:37 PM
Subject: RE: [PHP] Still trying to figure this out...

> Ok Rob,
>
> I tested my code in Oracle (obviously changed for that database type)
> and discovered I needed to change "empty" to "is_null" I had forgotten
> that
> empty represents zero but we aren't getting a count so we needed to check
> for a null.
>
> it worked me for once I made that change and didn't need to do the other
> change I had previously mentioned.
>
> -----Original Message-----
> From: Rob W. [mailto:robfiberuplink.com]
> Sent: Monday, June 19, 2006 6:50 PM
> To: php-generallists.php.net
> Subject: Re: [PHP] Still trying to figure this out...
>
> Yeah, that's what i'm trying to print is the missing numbers in the db.
>
> That's what I've been trying to figure out this whole time.
>
> ----- Original Message -----
> From: "Xavier Casto" <xaviercasto.net>
> To: "'Rob W.'" <robfiberuplink.com>
> Cc: <php-generallists.php.net>
> Sent: Monday, June 19, 2006 6:34 PM
> Subject: RE: [PHP] Still trying to figure this out...
>
>
>>
>> Are there any numbers missing in your database table between 0 and the
>> number you assigned to $maxport?
>>
>> -----Original Message-----
>> From: Rob W. [mailto:robfiberuplink.com]
>> Sent: Monday, June 19, 2006 6:26 PM
>> To: php-generallists.php.net
>> Subject: Re: [PHP] Still trying to figure this out...
>>
>> Yep, and still nothing output's.
>>
>>
>> ----- Original Message -----
>> From: "Xavier Casto" <xaviercasto.net>
>> To: "'Rob W.'" <robfiberuplink.com>
>> Cc: <php-generallists.php.net>
>> Sent: Monday, June 19, 2006 6:20 PM
>> Subject: RE: [PHP] Still trying to figure this out...
>>
>>
>>> You did make sure to assign a numerical value to $maxport?
>>>
>>> -----Original Message-----
>>> From: Rob W. [mailto:robfiberuplink.com]
>>> Sent: Monday, June 19, 2006 6:15 PM
>>> To: php-generallists.php.net
>>> Subject: Re: [PHP] Still trying to figure this out...
>>>
>>> This also didnt work, Still giving me no output just like the last try.
>>> ----- Original Message -----
>>> From: Xavier Casto
>>> To: Rob W.
>>> Cc: php-generallists.php.net
>>> Sent: Monday, June 19, 2006 4:33 PM
>>> Subject: Re: [PHP] Still trying to figure this out...
>>>
>>>
>>> Have you ever thought of doing something like this:
>>>
>>> for($i = 0; $i <= $maxport; $i++)
>>> {
>>> $query="SELECT switchport FROM network WHERE switchport = ".$i;
>>> $result=mysql_query($query);
>>> if(empty($result))
>>> {
>>> echo "<p>$i</p>";
>>> }
>>> }
>>>
>>>
>>> It should only return the ones that aren't in the table and they will
>>> automatically be sorted in ascending order.
>>>
>>>
>>>
>>> On 6/19/06, Rob W. <robfiberuplink.com> wrote:
>>> Ok, I am still trying to get this figured out from what I tried doing
>>> last night. If anybody wants to try it, please be my guest. This is the
>>> deal. Create an INTEGER table. Put the numbers 1 - 24 in it. Leave out
>>> like
>>> number 8, 9, 22, 23 ect.. Now create a php statement that will take and
>>> pull
>>> that out of the database, find out the missing numbers and display them
>>> as
>>> an html drop down selection.
>>>
>>> And tedd in response to why, is because the values that are already
>>> located in the database represent in use already. They represent a
>>> server
>>> port that a server is sitting on, so that's not the problem. I could
>>> have
>>> done that along time ago.
>>>
>>> Any help is appreciated but here is the current code that I have.
>>>
>>>
>>> $query="SELECT switchport FROM network";
>>> $result=mysql_query($query);
>>> $sql_range=mysql_fetch_array($result);
>>> $true_range=range(1,24);
>>> $next_range=array_diff($true_range,$sql_range);
>>> foreach ($next_range as $final_range) {
>>> echo "<option value='$final_range'>$final_range\n";
>>> }
>>>
>>>
>>>
>>>
>>>
>>>
>>
>> --
>> 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:


On Mon, 2006-06-19 at 21:09, Rob W. wrote:
> $range = array_flip( range( 1, 24 ) );
>
> $query = "SELECT switchport FROM network ";
> if( ($result = mysql_query( $query )) !== false )
> {
> while( ($row = mysql_fetch_array( $result )) !== false )
> {
> unset( $range[$row[0]] );
> }
> }
>
> foreach( $range as $switchport => $foo )
> {
> echo '<option
> value="'.$switchport.'">'.$switchport.'</option>'."\n";
>
> $result = 0;
> }
>
>
> With that, I dont get anything, Not sure what you mean by empty to is_null
> ect..

You have mixed up replies... either way I suggest you look at what YOU
are doing wrong. The above code is sound. (although I don't know who
slipped in "$result = 0;" since it serves no purpose.

What I suggest you do is add echo statements thoughout the loops. To see
which loops are entered and how many times etc. More than likely you
have some kind of error reporting disabled and you have a bug elsewhere
in your code of which none of us are privy.

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:


Hi all,

ok, have a relatively complicated architecture of php scripts in place,
and after reading more about SQL injection, want to make sure that I
clean my data completely before I enter it into a MySQL db.

I tend to clean the data on the way into the app, which has many
subroutines that process the data. I've written generic functions to
wrap queries to the database.

So, because I don't yet have an open connection to the database when the
data comes in the front door, or even when I am constructing the query,
I cannot use mysql_real_escape_string to clean the data.

Is there a way to essentially duplicate the mysql_real_escape_string if
you already know the character set that the MySQL db is using ???

When I'm constructing a query, it doesn't make sense to open the
connection just to use that function.

Can I just use the depricated mysql_escape_string ? or is there maybe a
sequence of addcslashes parameters that can accomplish the same thing ???

Thanks,

Tim.

attached mail follows:


Tim Traver wrote:
> Hi all,
>
> ok, have a relatively complicated architecture of php scripts in place,
> and after reading more about SQL injection, want to make sure that I
> clean my data completely before I enter it into a MySQL db.
>
> I tend to clean the data on the way into the app, which has many
> subroutines that process the data. I've written generic functions to
> wrap queries to the database.
>
> So, because I don't yet have an open connection to the database when the
> data comes in the front door, or even when I am constructing the query,
> I cannot use mysql_real_escape_string to clean the data.
>
> Is there a way to essentially duplicate the mysql_real_escape_string if
> you already know the character set that the MySQL db is using ???
>
> When I'm constructing a query, it doesn't make sense to open the
> connection just to use that function.
>
> Can I just use the depricated mysql_escape_string ? or is there maybe a
> sequence of addcslashes parameters that can accomplish the same thing ???
>

mysql_escape_string() should be fine. The only difference between the
two is that 'real' uses your connection to determine the current
character set.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnicheldotcomholdingsofbuffalo.com

attached mail follows:


Honestly, just connect to the database earlier in your code...

if you insist on not doing that, use mysql_escape_strign and just
forget ever moving to Unicode data.

On Mon, June 19, 2006 3:58 pm, Tim Traver wrote:
> Hi all,
>
> ok, have a relatively complicated architecture of php scripts in
> place,
> and after reading more about SQL injection, want to make sure that I
> clean my data completely before I enter it into a MySQL db.
>
> I tend to clean the data on the way into the app, which has many
> subroutines that process the data. I've written generic functions to
> wrap queries to the database.
>
> So, because I don't yet have an open connection to the database when
> the
> data comes in the front door, or even when I am constructing the
> query,
> I cannot use mysql_real_escape_string to clean the data.
>
> Is there a way to essentially duplicate the mysql_real_escape_string
> if
> you already know the character set that the MySQL db is using ???
>
> When I'm constructing a query, it doesn't make sense to open the
> connection just to use that function.
>
> Can I just use the depricated mysql_escape_string ? or is there maybe
> a
> sequence of addcslashes parameters that can accomplish the same thing
> ???
>
> Thanks,
>
> Tim.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Jun 17, 2006, at 12:06 PM, a couple of guys wrote:

> header("Content-type: image/jpeg");
> notice "jpeg" - not "jpg".

Thanks all - this was indeed the problem. :)

attached mail follows:


Hello all,

I am having a problem trying to get the subject corenspond with the
message ID on a search.

here is my code so far:
echo "<h1>Search Results</h1>";
$WORDS = $_POST['words'];
$search1 = "BODY \"$WORDS\"";
$SEARCH = imap_search($conn, $search1, SE_UID);
$arrData = $SEARCH;
$mailHeader = imap_headerinfo($conn, $arrData);
if($SEARCH == FALSE) {
        echo "<p>Sorry, did not find anything you were searching for</p>";
} else {
foreach ($arrData as $ID) {
   echo "$ID - TOOK OUT THE HTML<br>\n";
}
}

This is the first for messing with IMAP! LOL

Thanks in advance,
Will

attached mail follows:


Hello all,

I am having a problem trying to get the subject corenspond with the
message ID on a search.

here is my code so far:
echo "<h1>Search Results</h1>";
$WORDS = $_POST['words'];
$search1 = "BODY \"$WORDS\"";
$SEARCH = imap_search($conn, $search1, SE_UID);
$arrData = $SEARCH;
$mailHeader = imap_headerinfo($conn, $arrData);
if($SEARCH == FALSE) {
        echo "<p>Sorry, did not find anything you were searching for</p>";
} else {
foreach ($arrData as $ID) {
   echo "$ID - TOOK OUT THE HTML<br>\n";
}
}

This is the first for messing with IMAP! LOL

Thanks in advance,
Will

attached mail follows:


Of all the functions to use with, and to ignore error messages and
warnings, IMAP is the *last* one you want to do that with.

Add some error checking, and just forget using

Meanwhile, both your questions didn't actually have a question, nor
any explanation of what was going wrong or right or...

http://www.catb.org/~esr/faqs/smart-questions.html

On Mon, June 19, 2006 5:00 pm, CodeHeads wrote:
> Hello all,
>
> I am having a problem trying to get the subject corenspond with the
> message ID on a search.
>
> here is my code so far:
> echo "<h1>Search Results</h1>";
> $WORDS = $_POST['words'];
> $search1 = "BODY \"$WORDS\"";
> $SEARCH = imap_search($conn, $search1, SE_UID);
> $arrData = $SEARCH;
> $mailHeader = imap_headerinfo($conn, $arrData);
> if($SEARCH == FALSE) {
> echo "<p>Sorry, did not find anything you were searching for</p>";
> } else {
> foreach ($arrData as $ID) {
> echo "$ID - TOOK OUT THE HTML<br>\n";
> }
> }
>
> This is the first for messing with IMAP! LOL
>
> Thanks in advance,
> Will
>

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Mon, June 19, 2006 7:12 pm, Richard Lynch wrote:
> Of all the functions to use with, and to ignore error messages and
> warnings, IMAP is the *last* one you want to do that with.
>
> Add some error checking, and just forget using
>
> Meanwhile, both your questions didn't actually have a question, nor
> any explanation of what was going wrong or right or...
>
> http://www.catb.org/~esr/faqs/smart-questions.html
>
> On Mon, June 19, 2006 5:00 pm, CodeHeads wrote:
>> Hello all,
>>
>> I am having a problem trying to get the subject corenspond with the
>> message ID on a search.
>>
>> here is my code so far:
>> echo "<h1>Search Results</h1>";
>> $WORDS = $_POST['words'];
>> $search1 = "BODY \"$WORDS\"";
>> $SEARCH = imap_search($conn, $search1, SE_UID);
>> $arrData = $SEARCH;
>> $mailHeader = imap_headerinfo($conn, $arrData);
>> if($SEARCH == FALSE) {
>> echo "<p>Sorry, did not find anything you were searching for</p>";
>> } else {
>> foreach ($arrData as $ID) {
>> echo "$ID - TOOK OUT THE HTML<br>\n";
>> }
>> }
>>
>> This is the first for messing with IMAP! LOL
>>
>> Thanks in advance,
>> Will
>>

Ummmm, you referred me to a page about smart questions......what about
your TOP posting?????

Nevermind, I see the PHP list is filled with smart asses so I will find it
out on my own.

And YES, there was a question in there, I guess everyone has a simple mind.

Will

attached mail follows:


CodeHeads wrote:

...

>
> Ummmm, you referred me to a page about smart questions......what about
> your TOP posting?????

Richard has more than enough karma on this list to get away with a top-post
every half hour or so.

>
> Nevermind, I see the PHP list is filled with smart asses so I will find it
> out on my own.

<insert any number of smartass/sarcastic/told-u-so type comments here>

>
> And YES, there was a question in there, I guess everyone has a simple mind.

I suppose we have to infer the question?

>
> Will
>

attached mail follows:


Hello again,
Here is another problem I am having. I would like to setup multiple pages on
a IMAP archive reader I am working on.

I cannot seem to get the multiple pages working right.
Here is my code.

$threads = imap_thread($conn);
foreach ($threads as $key => $val) {
  $tree = explode('.', $key);
  if ($tree[1] == 'num') {
   $header = imap_headerinfo($conn, $val);
   echo "<ul>\n\t<li>TOOK OUT HTML CODE\n";
} elseif ($tree[1] == 'branch') {
echo "\t</li>\n</ul>\n"; }
}

Sorry, still learning. :)

Will

attached mail follows:


> http://www.hudzilla.org/phpbook/

WOW! That online book is awesome. I consider myself an expert at PHP/mySQL
and there were some things in there that I didn't know.

Thanks Ligaya,

DÆVID

attached mail follows:


At 3:17 PM -0700 6/19/06, Daevid Vincent wrote:
> > http://www.hudzilla.org/phpbook/
>
>WOW! That online book is awesome. I consider myself an expert at PHP/mySQL
>and there were some things in there that I didn't know.
>
>Thanks Ligaya,
>
>DÆVID

Same here and I'm not an expert. :-)

tedd
--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com

attached mail follows:


I finally broke down and reinstalled PHP using the info from the site below,
but GD is still not working. Phpinfo() shows it is enabled, as are the other
libraries. So I'm lost as to what I am missing?

http://tanksoftware.com/tutes/installingphp.html

Any help is appreciated.

B

attached mail follows:


On Mon, June 19, 2006 5:43 pm, Beauford wrote:
> I finally broke down and reinstalled PHP using the info from the site
> below,
> but GD is still not working. Phpinfo() shows it is enabled, as are the
> other
> libraries. So I'm lost as to what I am missing?
>
> http://tanksoftware.com/tutes/installingphp.html

If phpinfo() shows GD and all the cool libraries, then you're
definitely on the right track.

Now you just have to tell us what makes you think it's "not working"
and what you mean by "not working" and what your code looks like
and...

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Hi again,

I started again to see if I could get it to work. I first removed everything
(libpng, libjpeg, zlib, and PHP). Then as before I followed the info in the
link below. Now I get the following when I run make for PHP. Note also that
I can not compile gd on it's own, I had to find a Slackware package for it.
Could this be the problem? Again, I have no idea what else to do as I have
followed all the info I could find on how to get this to work. I have also
included some info on gd below.

Thanks

 /home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c -o ext/gd/libgd/gd_jpeg.o &&
echo > ext/gd/libgd/gd_jpeg.lo
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:38:21: jpeglib.h: No such file
or directory
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:39:20: jerror.h: No such file
or directory
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:49: error: parse error before
"cinfo"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: In function
`fatal_jpeg_error':
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:54: error: `cinfo' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:54: error: (Each undeclared
identifier is reported only once
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:54: error: for each function
it appears in.)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: At top level:
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:96: error: parse error before
"cinfo"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: In function `gdImageJpegCtx':
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:100: error: storage size of
`cinfo' isn't known
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:101: error: storage size of
`jerr' isn't known
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:104: error: syntax error
before "row"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:105: error: `JSAMPROW'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:107: error: `JDIMENSION'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:107: error: parse error before
"nlines"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:117: error: `row' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:130: error: `JCS_RGB'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:133: error: `TRUE' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:143: error: parse error before
"_safe_emalloc"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:144: error: `JSAMPLE'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:145: error: `rowptr'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:150: error: `JPEG_LIB_VERSION'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:154: error: `JPEG_COM'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:171: error: `nlines'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:194:2: #error IJG JPEG library
BITS_IN_JSAMPLE value must be 8 or 12
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: At top level:
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:230: error: parse error before
"cinfo"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: In function
`gdImageCreateFromJpegCtx':
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:240: error: storage size of
`cinfo' isn't known
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:241: error: storage size of
`jerr' isn't known
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:244: error: syntax error
before "row"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:246: error: `JSAMPROW'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:246: error: parse error before
"rowptr"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:249: error: `JDIMENSION'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:249: error: parse error before
"nrows"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:260: error: `row' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:276: error: `JPEG_APP0'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:278: error: `TRUE' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:279: error: `JPEG_HEADER_OK'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:300: error: `JCS_CMYK'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:300: error: `JCS_YCCK'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:303: error: `JCS_RGB'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:330: error:
`jpeg_saved_marker_ptr' undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:330: error: parse error before
"marker"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:336: error: `marker'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:354: error: `JSAMPLE'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:356: error: `rowptr'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:360: error: syntax error
before "currow"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:362: error: `nrows' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:367: error: `currow'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:373: error: syntax error
before "currow"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: At top level:
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:446: error: field `pub' has
incomplete type
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:462: error: parse error before
"cinfo"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: In function `init_source':
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:464: error: `cinfo' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:470: error: `TRUE' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: At top level:
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:509: error: parse error before
"cinfo"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: In function
`fill_input_buffer':
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:511: error: `cinfo' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:534: error: `JERR_INPUT_EMPTY'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:536: error: `JWRN_JPEG_EOF'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:539: error: `JPEG_EOI'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:545: error: `FALSE' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:547: error: `TRUE' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: At top level:
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:563: error: parse error before
"cinfo"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: In function
`skip_input_data':
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:565: error: `cinfo' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:570: error: `num_bytes'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: At top level:
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:602: error: parse error before
"cinfo"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:617: error: parse error before
"cinfo"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: In function
`jpeg_gdIOCtx_src':
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:628: error: `cinfo' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:630: error: `j_common_ptr'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:630: error: parse error before
"cinfo"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:632: error: parse error before
"cinfo"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:640: error:
`jpeg_resync_to_restart' undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:642: error: `infile'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: At top level:
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:651: error: field `pub' has
incomplete type
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:665: error: parse error before
"cinfo"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: In function
`init_destination':
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:667: error: `cinfo' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:670: error: `j_common_ptr'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:670: error: parse error before
"cinfo"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: At top level:
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:700: error: parse error before
"cinfo"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: In function
`empty_output_buffer':
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:702: error: `cinfo' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:705: error: `JERR_FILE_WRITE'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:711: error: `TRUE' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: At top level:
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:724: error: parse error before
"cinfo"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: In function
`term_destination':
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:726: error: `cinfo' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:731: error: `JERR_FILE_WRITE'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: At top level:
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:742: error: parse error before
"cinfo"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c: In function
`jpeg_gdIOCtx_dest':
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:752: error: `cinfo' undeclared
(first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:753: error: `j_common_ptr'
undeclared (first use in this function)
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:753: error: parse error before
"cinfo"
/home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:760: error: `outfile'
undeclared (first use in this function)
make: *** [ext/gd/libgd/gd_jpeg.lo] Error 1

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

** Configuration summary for gd 2.0.33:

   Support for PNG library: yes
   Support for JPEG library: yes
   Support for Freetype 2.x library: yes
   Support for Fontconfig library: yes
   Support for Xpm library: yes
   Support for pthreads: yes

gd_jpeg.c:47:21: jpeglib.h: No such file or directory
gd_jpeg.c:48:20: jerror.h: No such file or directory
gd_jpeg.c:60: error: parse error before "cinfo"
gd_jpeg.c: In function `fatal_jpeg_error':
gd_jpeg.c:65: error: `cinfo' undeclared (first use in this function)
gd_jpeg.c:65: error: (Each undeclared identifier is reported only once
gd_jpeg.c:65: error: for each function it appears in.)
gd_jpeg.c: At top level:
gd_jpeg.c:112: error: parse error before "cinfo"
gd_jpeg.c: In function `gdImageJpegCtx':
gd_jpeg.c:116: error: storage size of `cinfo' isn't known
gd_jpeg.c:117: error: storage size of `jerr' isn't known
gd_jpeg.c:120: error: syntax error before "row"
gd_jpeg.c:121: error: `JSAMPROW' undeclared (first use in this function)
gd_jpeg.c:123: error: `JDIMENSION' undeclared (first use in this function)
gd_jpeg.c:123: error: parse error before "nlines"
gd_jpeg.c:149: error: `row' undeclared (first use in this function)
gd_jpeg.c:161: error: `JCS_RGB' undeclared (first use in this function)
gd_jpeg.c:164: error: `TRUE' undeclared (first use in this function)
gd_jpeg.c:178: error: parse error before "gdCalloc"
gd_jpeg.c:188: error: `rowptr' undeclared (first use in this function)
gd_jpeg.c:193: error: `JPEG_LIB_VERSION' undeclared (first use in this
function)
gd_jpeg.c:198: error: `JPEG_COM' undeclared (first use in this function)
gd_jpeg.c:222: error: `nlines' undeclared (first use in this function)
gd_jpeg.c:250:2: #error IJG JPEG library BITS_IN_JSAMPLE value must be 8 or
12
gd_jpeg.c: At top level:
gd_jpeg.c:283: error: parse error before "cinfo"
gd_jpeg.c: In function `gdImageCreateFromJpegCtx':
gd_jpeg.c:293: error: storage size of `cinfo' isn't known
gd_jpeg.c:294: error: storage size of `jerr' isn't known
gd_jpeg.c:297: error: syntax error before "row"
gd_jpeg.c:299: error: `JSAMPROW' undeclared (first use in this function)
gd_jpeg.c:299: error: parse error before "rowptr"
gd_jpeg.c:301: error: `JDIMENSION' undeclared (first use in this function)
gd_jpeg.c:301: error: parse error before "nrows"
gd_jpeg.c:318: error: `row' undeclared (first use in this function)
gd_jpeg.c:333: error: `JPEG_APP0' undeclared (first use in this function)
gd_jpeg.c:335: error: `TRUE' undeclared (first use in this function)
gd_jpeg.c:336: error: `JPEG_HEADER_OK' undeclared (first use in this
function)
gd_jpeg.c:360: error: `JCS_CMYK' undeclared (first use in this function)
gd_jpeg.c:361: error: `JCS_YCCK' undeclared (first use in this function)
gd_jpeg.c:367: error: `JCS_RGB' undeclared (first use in this function)
gd_jpeg.c:444: error: `jpeg_saved_marker_ptr' undeclared (first use in this
function)
gd_jpeg.c:444: error: parse error before "marker"
gd_jpeg.c:453: error: `marker' undeclared (first use in this function)
gd_jpeg.c:481: error: `JSAMPLE' undeclared (first use in this function)
gd_jpeg.c:488: error: `rowptr' undeclared (first use in this function)
gd_jpeg.c:493: error: syntax error before "currow"
gd_jpeg.c:495: error: `nrows' undeclared (first use in this function)
gd_jpeg.c:502: error: `currow' undeclared (first use in this function)
gd_jpeg.c:514: error: syntax error before "currow"
gd_jpeg.c: At top level:
gd_jpeg.c:634: error: field `pub' has incomplete type
gd_jpeg.c:653: error: parse error before "cinfo"
gd_jpeg.c: In function `init_source':
gd_jpeg.c:655: error: `cinfo' undeclared (first use in this function)
gd_jpeg.c:661: error: `TRUE' undeclared (first use in this function)
gd_jpeg.c: At top level:
gd_jpeg.c:700: error: parse error before "cinfo"
gd_jpeg.c: In function `fill_input_buffer':
gd_jpeg.c:702: error: `cinfo' undeclared (first use in this function)
gd_jpeg.c:739: error: `JERR_INPUT_EMPTY' undeclared (first use in this
function)
gd_jpeg.c:740: error: `JWRN_JPEG_EOF' undeclared (first use in this
function)
gd_jpeg.c:743: error: `JPEG_EOI' undeclared (first use in this function)
gd_jpeg.c:749: error: `FALSE' undeclared (first use in this function)
gd_jpeg.c:751: error: `TRUE' undeclared (first use in this function)
gd_jpeg.c: At top level:
gd_jpeg.c:768: error: parse error before "cinfo"
gd_jpeg.c: In function `skip_input_data':
gd_jpeg.c:770: error: `cinfo' undeclared (first use in this function)
gd_jpeg.c:775: error: `num_bytes' undeclared (first use in this function)
gd_jpeg.c: At top level:
gd_jpeg.c:810: error: parse error before "cinfo"
gd_jpeg.c:828: error: parse error before "cinfo"
gd_jpeg.c: In function `jpeg_gdIOCtx_src':
gd_jpeg.c:839: error: `cinfo' undeclared (first use in this function)
gd_jpeg.c:842: error: `j_common_ptr' undeclared (first use in this function)
gd_jpeg.c:842: error: parse error before "cinfo"
gd_jpeg.c:846: error: parse error before "cinfo"
gd_jpeg.c:855: error: `jpeg_resync_to_restart' undeclared (first use in this
function)
gd_jpeg.c:857: error: `infile' undeclared (first use in this function)
gd_jpeg.c: At top level:
gd_jpeg.c:866: error: field `pub' has incomplete type
gd_jpeg.c:882: error: parse error before "cinfo"
gd_jpeg.c: In function `init_destination':
gd_jpeg.c:884: error: `cinfo' undeclared (first use in this function)
gd_jpeg.c:888: error: `j_common_ptr' undeclared (first use in this function)
gd_jpeg.c:888: error: parse error before "cinfo"
gd_jpeg.c: At top level:
gd_jpeg.c:920: error: parse error before "cinfo"
gd_jpeg.c: In function `empty_output_buffer':
gd_jpeg.c:922: error: `cinfo' undeclared (first use in this function)
gd_jpeg.c:926: error: `JERR_FILE_WRITE' undeclared (first use in this
function)
gd_jpeg.c:931: error: `TRUE' undeclared (first use in this function)
gd_jpeg.c: At top level:
gd_jpeg.c:945: error: parse error before "cinfo"
gd_jpeg.c: In function `term_destination':
gd_jpeg.c:947: error: `cinfo' undeclared (first use in this function)
gd_jpeg.c:954: error: `JERR_FILE_WRITE' undeclared (first use in this
function)
gd_jpeg.c: At top level:
gd_jpeg.c:966: error: parse error before "cinfo"
gd_jpeg.c: In function `jpeg_gdIOCtx_dest':
gd_jpeg.c:976: error: `cinfo' undeclared (first use in this function)
gd_jpeg.c:979: error: `j_common_ptr' undeclared (first use in this function)
gd_jpeg.c:979: error: parse error before "cinfo"
gd_jpeg.c:987: error: `outfile' undeclared (first use in this function)
make[2]: *** [gd_jpeg.lo] Error 1
make[2]: Leaving directory `/home/beauford/gd-2.0.33'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/beauford/gd-2.0.33'
make: *** [all] Error 2

-----Original Message-----
From: Beauford [mailto:php-usernetscan.ca]
Sent: June 19, 2006 6:43 PM
To: php-generallists.php.net
Subject: [PHP] GD problems

I finally broke down and reinstalled PHP using the info from the site below,
but GD is still not working. Phpinfo() shows it is enabled, as are the other
libraries. So I'm lost as to what I am missing?

http://tanksoftware.com/tutes/installingphp.html

Any help is appreciated.

B

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

attached mail follows:


Beauford wrote:
> Hi again,
>
> I started again to see if I could get it to work. I first removed everything
> (libpng, libjpeg, zlib, and PHP). Then as before I followed the info in the
> link below. Now I get the following when I run make for PHP. Note also that
> I can not compile gd on it's own, I had to find a Slackware package for it.
> Could this be the problem? Again, I have no idea what else to do as I have
> followed all the info I could find on how to get this to work. I have also
> included some info on gd below.
>
> Thanks
>
> /home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c -o ext/gd/libgd/gd_jpeg.o &&
> echo > ext/gd/libgd/gd_jpeg.lo
> /home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:38:21: jpeglib.h: No such file
> or directory
> /home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:39:20: jerror.h: No such file
> or directory

You need the libjpeg-devel, libpng-devel and so on packages to compile
support for these into php. I don't know slackware, so they might be
called -dev or something, but you need the "dev" packages which contain
the header files.

--
Postgresql & php tutorials
http://www.designmagick.com/

attached mail follows:


Thanks for the reply, but what are these for then - libpng and libjpeg? No
where does it say I need anything else. I have searched and searched for
information on installing this and never have I seen anything about -devel
packages. Even in the link I gave it says nothing about this. I've just
spent the last hour searching for these packages and can't even come close
to finding anything - all I get is the ones I've already installed, which
I'm thinking are one and the same - and they say Windows is bad. It only
took me 5 minutes in Windows to get this working. As you can see I'm way
pass frustrated.

Thanks again

-----Original Message-----
From: Chris [mailto:dmagickgmail.com]
Sent: June 19, 2006 9:10 PM
To: Beauford
Cc: php-generallists.php.net
Subject: Re: [PHP] GD problems

Beauford wrote:
> Hi again,
>
> I started again to see if I could get it to work. I first removed
> everything (libpng, libjpeg, zlib, and PHP). Then as before I followed
> the info in the link below. Now I get the following when I run make
> for PHP. Note also that I can not compile gd on it's own, I had to find a
Slackware package for it.
> Could this be the problem? Again, I have no idea what else to do as I
> have followed all the info I could find on how to get this to work. I
> have also included some info on gd below.
>
> Thanks
>
> /home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c -o
> ext/gd/libgd/gd_jpeg.o && echo > ext/gd/libgd/gd_jpeg.lo
> /home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:38:21: jpeglib.h: No
> such file or directory
> /home/shared/php-5.0.0/ext/gd/libgd/gd_jpeg.c:39:20: jerror.h: No such
> file or directory

You need the libjpeg-devel, libpng-devel and so on packages to compile
support for these into php. I don't know slackware, so they might be called
-dev or something, but you need the "dev" packages which contain the header
files.

--
Postgresql & php tutorials
http://www.designmagick.com/

attached mail follows:


Beauford wrote:
> Thanks for the reply, but what are these for then - libpng and libjpeg? No
> where does it say I need anything else. I have searched and searched for
> information on installing this and never have I seen anything about -devel
> packages. Even in the link I gave it says nothing about this. I've just
> spent the last hour searching for these packages and can't even come close
> to finding anything - all I get is the ones I've already installed, which
> I'm thinking are one and the same - and they say Windows is bad. It only
> took me 5 minutes in Windows to get this working. As you can see I'm way
> pass frustrated.

Some things you learn from experience or asking questions :)

It's reasonably standard if you want to compile something into another
program, you need the headers (which are in the -devel package mostly).
Databases are slightly different in that mysql and postgres (at least)
give you a mysql_config and pg_config to tell you about different stuff.

This of course all depends on which system you are running. Most package
based systems separate things out so the base package installs binaries
only, and the -devel package installs headers and things you need to
compile against it. Port systems (*bsd and gentoo for eg) of course are
different again.

I thought php told you what you needed, I know some other programs will
stop the configure script and say "to compile support for X you need
package Y installed". Obviously not..

--
Postgresql & php tutorials
http://www.designmagick.com/

attached mail follows:


On Mon, June 19, 2006 8:32 am, Jef Sullivan wrote:
> I have a situation that I'm not sure how it can be done with PHP. I
> have
> written a web-application that produces
>
> a monthly statement for our customers. Now, I need to automate the
> printing of these monthly statements.
>
> The way I was thinking of doing this was through Perl. However, I have
> discovered that a Perl script will not
> work.

Errrr. A Perl script would work if you could learn Perl...

> I know I can build the URL to the monthly statement. What I don't know
> how to do is automate this process

On Un*x, use "man 5 crontab" in the shell, or Google for it.
On Windows, set up a "Scheduled Task"

> and get it to print to a specific printer. Any help would be greatly
> appreciated.

You're on your own for getting a printer to work...

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Hello all. I'm the webmaster and developer of all the software and content
at SweetPHP.com. I have a few ideas for some new scripts that I would love
to work on, but don't have enough time to fully commit. I would love to
start up a group effort for a few things and be part of a development team,
this way, I get to help out, but I won't have to carry the entire load
myself. I've seen the great products that come from great development
teams. Up until this point I've pretty much just been developing software
on my own. As a change of pace, I would love to start up a group project
for a couple ideas I've had. Does anyone know of good sites that might be a
starting point for something like this? Maybe a site where I could create
the idea for a project and any interested people could sign up (or apply) to
join the development team? I could announce it on my site, but I don't know
if I have too many developers visiting, so that might not be the best way.
If anyone has done anything similar to this in the past, please give me your
feedback. I still plan on developing software on my own, but I'd love to
opportunity work with and learn from other developers as well.

Thanks,

Matt Palermo
http://sweetphp.com

attached mail follows:


Matt Palermo wrote:
> Hello all. I'm the webmaster and developer of all the software and content
> at SweetPHP.com. I have a few ideas for some new scripts that I would love
> to work on, but don't have enough time to fully commit. I would love to
> start up a group effort for a few things and be part of a development team,
> this way, I get to help out, but I won't have to carry the entire load
> myself. I've seen the great products that come from great development
> teams. Up until this point I've pretty much just been developing software
> on my own. As a change of pace, I would love to start up a group project
> for a couple ideas I've had. Does anyone know of good sites that might be a
> starting point for something like this? Maybe a site where I could create
> the idea for a project and any interested people could sign up (or apply) to
> join the development team? I could announce it on my site, but I don't know
> if I have too many developers visiting, so that might not be the best way.
> If anyone has done anything similar to this in the past, please give me your
> feedback. I still plan on developing software on my own, but I'd love to
> opportunity work with and learn from other developers as well.

Sourceforge.net or freshmeat.net have everything you need to do all of
this.. Create a new project, announce some "jobs", see what happens.. it
has cvs etc all set up already so you don't have to.

I'm sure there are plenty of other sites like these, but these would be
your more popular ones.

If it's database specific, there is forge.mysql.com for mysql, or
pgfoundry.org for postgresql.

--
Postgresql & php tutorials
http://www.designmagick.com/

attached mail follows:


Manuel Amador (Rudd-O) wrote:
> Excuse me... in which scenarios isn't fork() available? As far as I
> know, it even works on Windows (albeit slower... not that you'll be
> gaining any performance by curl'ing your URL - that's actually slower
> than fork()).

It's (probably) not that the fork() etc commands don't work on windows,
just that the php functions don't.

http://www.php.net/pcntl

--
Postgresql & php tutorials
http://www.designmagick.com/

attached mail follows:


On Mon, June 19, 2006 8:13 pm, Chris wrote:
> Manuel Amador (Rudd-O) wrote:
>> Excuse me... in which scenarios isn't fork() available? As far as I
>> know, it even works on Windows (albeit slower... not that you'll be
>> gaining any performance by curl'ing your URL - that's actually
>> slower
>> than fork()).
>
> It's (probably) not that the fork() etc commands don't work on
> windows,
> just that the php functions don't.
>
> http://www.php.net/pcntl

fork() in anything other than CLI/CGI is dangerous because PHP
extensions (and/or web-server extensions) are not known to be
thread-safe.

So, by definition, when you fork in a web-server, you are just ASKING
for an intermittent bug, that will be virtually impossible to catch
with QA and which will bite you in the ass when you are slashdotted,
i.e. at the worst possible time.

If your run a special PHP server with NOTHING loaded into it, no
mysql, no gd, no nothing, you could *MAYBE* have some reasonable
chance of it not puking all over you blue suede shoes...

But I sure wouldn't bet the company bottom line on it.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


Richard Lynch wrote:
> On Mon, June 19, 2006 8:13 pm, Chris wrote:
>> Manuel Amador (Rudd-O) wrote:
>>> Excuse me... in which scenarios isn't fork() available? As far as I
>>> know, it even works on Windows (albeit slower... not that you'll be
>>> gaining any performance by curl'ing your URL - that's actually
>>> slower
>>> than fork()).
>> It's (probably) not that the fork() etc commands don't work on
>> windows,
>> just that the php functions don't.
>>
>> http://www.php.net/pcntl
>
> fork() in anything other than CLI/CGI is dangerous because PHP
> extensions (and/or web-server extensions) are not known to be
> thread-safe.

I'm not debating any of that, he asked why the functions don't work in
windows, I said that the php functions don't, not necessarily that
fork() doesn't.

--
Postgresql & php tutorials
http://www.designmagick.com/

attached mail follows:


On Sat, June 17, 2006 1:25 pm, Ben Ramsey wrote:
> Using $_REQUEST is similar to using register_globals. You simply
> cannot
> trust the origin of the data. It's possible that a variable by the
> name
> of "foo" exists as a cookie, POST value, and GET value. If you use
> $_REQUEST, you cannot be assured that the value you are getting is
> from
> the scope you intend to retrieve it.

But it may well be that your script just doesn't CARE where the data
came from.

GET, POST, COOKIE, whatever.

If somebody is using my pagination script, and wants links or buttons
or whatever, I don't really give a damn where $page comes from.

It has to be a positive int, but I don't care how they code the user
interface.

$_REQUEST is very handy for that.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


On Sun, June 18, 2006 2:19 am, Satyam wrote:
> ----- Original Message -----
> From: "Rory Browne" <rory.brownegmail.com>
>
>>
>> Good code won't be vulnerable to register_globals either, but having
>> register_globals on is a security problem because there are security
>> flaws
>> that can only be exploited when register_globals is enabled.
>>
>
> Actually, code quality cannot overcome the vulnerability of
> register_globals. Every program will have global variables.

You clearly do not really understand the meaning behind
"register_globals" and "global variables" in PHP... :-)

Or perhaps you don't consider initializing variables as code quality
issue.

Because if you initialize EVERY variable, register_globals on/off has
zero effect.

That said:

Sooner or later, somebody will make a mistake and not initialize a
variable, or even mis-type a variable name, or succumb to client
demands and install some icky badly-written forum, shopping cart,
blog, or whatever with un-initialized variables, and then you're
screwed.

So turn register_globals OFF.

--
Like Music?
http://l-i-e.com/artists.htm

attached mail follows:


I have run into a tricky situation and need some help to work my way through
the problem. I use MySQL.

I accept some data from the user and insert them into two tables.

1. I insert part of the data into the first table. I do not specify the
primary key field. It is auto generated through auto_increment. All the
other fields can have duplicates.
2. Then I want to insert the other part of the data along with the primary
key that was automatically generated during the previous insert operation
into the second table.

My problem is this: How do I retrieve the auto generated primary key field
in the first table during the first insert operation. I cannot go back to
the table and query using the data I inserted since as I mentioned earlier
there can be duplicates. I simply cannot retreive the maximum value since
some other user could have inserted something during that time.

Any ideas?

Thanks in advance.

Cheers,

Prathap