php-general Digest 20 May 2005 11:03:11 -0000 Issue 3465

Topics (messages 215623 through 215638):

Empty string problem
        215623 by: Kristen G. Thorson
        215633 by: Rasmus Lerdorf

Re: Looking for a "developer's" weblog/cms system?
        215624 by: Philip Hallstrom

Re: System Call Troubles
        215625 by: Jos� Luis Palacios Vergara

Re: Image Verification - Problems in Safari, Mac OS X
        215626 by: Marek Kilimajer
        215627 by: Rory Browne

OT - Table help needed~ PLEASE
        215628 by: kevin.newage-hosting.com
        215636 by: Mark Rees

OT - Help creating Tables
        215629 by: kevin.newage-hosting.com

PHP and SSH
        215630 by: Pablo Gosse

Re: Problem With System Call
        215631 by: Kim Madsen

Japanese Fonts in php
        215632 by: Mark Sargent

mysql with php
        215634 by: Rittwick Banerjee

How to confirm subscriptions by e-mail on a PHP site ?
        215635 by: M�rio Gamito
        215638 by: M�rio Gamito

Re: Excellent language PHP5 is!
        215637 by: Jochem Maas

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message --- Following is a snippet of code that I am trying to debug. Most of the time, the variable $sn (set on the last line), correctly contains the variable $this_customer_num. On some occasions, however, it does not contain $this_customer_num. I cannot figure out what may be happening that this value is missing around 1-10% of the time.


<?php

$memberchecker=mysql_query("SELECT id, password, customer_num FROM logins WHERE email = '$email'" );
//email is unique and not null


if (!$memberchecker) {
//handle error


} else {

   if (mysql_num_rows($memberchecker) >= 1) {

       while ($row = mysql_fetch_array($memberchecker)) {

           $this_login_password=$row[password];

if ($this_login_password==$password) {
//$password is a form variable (yes register_globals is on...*sigh*)


               $this_customer_num=$row[customer_num];

$companycheck=mysql_query("SELECT priority, cash_price FROM customers WHERE customer_num='$this_customer_num'"); //customer_num is primary key, so unique and not null

               if (!$companycheck) {

                   //handle error

               } else {

                   if (mysql_num_rows($companycheck) == 1) {

                       while ($cow = mysql_fetch_array($companycheck)) {

                           $id=$row[id];
                           $priority=$cow[priority];
                           $cp=$cow[cash_price];
                           $sn=date(Sz).$this_customer_num.time();
?>


Before anyone yells at me, no I did not write this code. I first thought there might be a problem with the array keys not being quoted, but if that were the case, and an empty string were assigned to $this_customer_num, then I should not be able to pass the second query, since there are no empty string customer_num entries (all of them are at least 9 characters in length).


I have been unable to reproduce an instance where $sn is missing the $this_customer_num variable, and I'm stuck in a kind of political situation where I can only make recommendations, and not change the code myself.

Suggestions on where to start looking? Thanks in advance.
--- End Message ---
--- Begin Message ---
Kristen G. Thorson wrote:
> Following is a snippet of code that I am trying to debug.  Most of the
> time, the variable $sn (set on the last line), correctly contains the
> variable $this_customer_num.  On some occasions, however, it does not
> contain $this_customer_num.  I cannot figure out what may be happening
> that this value is missing around 1-10% of the time.
> 
> 
> <?php
> 
> $memberchecker=mysql_query("SELECT id, password, customer_num FROM
> logins WHERE email = '$email'" );
> //email is unique and not null
> 
> if (!$memberchecker) {
>      //handle error
> 
> } else {
> 
>    if (mysql_num_rows($memberchecker) >= 1) {
> 
>        while ($row = mysql_fetch_array($memberchecker)) {
> 
>            $this_login_password=$row[password];
> 
>            if ($this_login_password==$password) {
>            //$password is a form variable (yes register_globals is
> on...*sigh*)
> 
>                $this_customer_num=$row[customer_num];
> 
>                $companycheck=mysql_query("SELECT priority, cash_price
> FROM customers WHERE customer_num='$this_customer_num'"); //customer_num
> is primary key, so unique and not null
> 
>                if (!$companycheck) {
> 
>                    //handle error
> 
>                } else {
> 
>                    if (mysql_num_rows($companycheck) == 1) {
> 
>                        while ($cow = mysql_fetch_array($companycheck)) {
> 
>                            $id=$row[id];
>                            $priority=$cow[priority];
>                            $cp=$cow[cash_price];
>                            $sn=date(Sz).$this_customer_num.time();
> ?>
> 
> 
> Before anyone yells at me, no I did not write this code.  I first
> thought there might be a problem with the array keys not being quoted,
> but if that were the case, and an empty string were assigned to
> $this_customer_num, then I should not be able to pass the second query,
> since there are no empty string customer_num entries (all of them are at
> least 9 characters in length).
> 
> I have been unable to reproduce an instance where $sn is missing the
> $this_customer_num variable, and I'm stuck in a kind of political
> situation where I can only make recommendations, and not change the code
> myself.
> 
> Suggestions on where to start looking? Thanks in advance.
> 

$companycheck can easily be non-false and contain no rows.  A query that
doesn't match any rows is not a failure, it is simply an empty result
set.  So you wouldn't get into the //handle error code there and your
mysql_num_rows() wouldn't be 1.  This would appear to be possible if
there was some sort of mismatch between the customer ids in the login
table and the customers table.  A bit more error checking should make it
obvious.

-Rasmus

--- End Message ---
--- Begin Message ---
* Philip Hallstrom <[EMAIL PROTECTED]>:
[snip]
I'm thinking it might be nice to have an easy to use web-based cms system
that I could post this sort of stuff too and assign it to a category and
then let google index it.
[snip]
I've used a variety of wikis; you just have to choose one and run with
it. I'm not familiar with many blog packages, but do use Serendipity
(http://www.s9y.org), and have played a little with Jaws
(http://www.jaws-project.com/index.php); they have some nice features
and are relatively easy to set up.

Thanks, I'll take a look at those...

Basically, I want a way to post things I think others might find useful.
I'm not interested in user comments.  I don't care about RSS.  I would
like to easily be able to mark things as "code" or "type this at a shell
prompt" as well as link to entire source files, etc.

If you'r interested in posting "things I think others might find useful", why are you not interested in RSS? How will *others* know when you've posted something new? I find that RSS is a great tool for me to keep track of developers, projects, and other sundries. I rarely use my bookmarks anymore.

Hmm... well, I guess what I meant to say is I'm not interested in all that trackback/ping stuff. I have no delusions that my site will get about 1 visitor a day... me. I just want a place to put things that I can point people to if it's relevant... so in that regards, RSS isn't a feature I need... I'd rather have a really clean way to post blocks of code...


If all else fails... you're a PHP developer -- code your own!

Heh. I was afraid you were going to say that :-) if it comes to that I'll hack up one of the existing ones to do what I want... there's already too many of them out there :)


-philip
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED]

----- Original Message ----- 
From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[email protected]>
Sent: Thursday, May 19, 2005 12:57 PM
Subject: Re: [PHP] System Call Troubles


> Michael Stearne wrote:
> > I am having the strangest problem using system() or exec() or any
> > variation.  None of them work on the Fedora Core 3 system that was
> > just loaded.  The PHP is Version 4.3.11 with Apache 2.0.52, the default
> > installation for Fedora Core 3.  Everything in PHP works as expected
> > except when trying a system call.  If I run :
> > 
> > <?
> > system("/bin/ls /tmp");
> > ?>
> > 
> > on my OS X (Apache/1.3.33 (Darwin) PHP/4.3.4) this returns the desired
> > results, a listing of the tmp directory.  On the Fedora box I get
> > nothing, a blank page.  There is content in the /tmp directory on the
> > Fedora box.
> 
> These sorts of problems are easy to debug.  Switch to your web server
> user id and issue the same command.  You will most often find you have a
> permission problem, or in the Fedora/Redhat world you will find that
> SELinux is yanking your chain.  You may want to read through:
> 
>   http://fedora.redhat.com/docs/selinux-faq-fc3/
> 
> -Rasmus
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message --- Rahul S. Johari wrote:
On 5/18/05 6:23 PM, "Marek Kilimajer" <[EMAIL PROTECTED]> wrote:


BTW, you might not be concerned about it much, but you have a race
condition in your script.


Ave,

What do you mean by "race condition" ?

If more then one user is accesing the page, you might overwrite the first one's verify.png image. Simple and sufficient solution is to append a random string to the filename:


$image_filename= 'verify_' . md5(rand()) . '.png';
ImagePNG($im, $image_filename);
?>
<img src="<?php echo $image_filename; ?>" width="200" height="40">
<?php

Just remember to add some way to remove old images.
--- End Message ---
--- Begin Message ---
if you have an image generated by
http://www.example.com/createimage.php , you could always refer to it
as http://www.example.com/createimage.php/{no_of_seconds_since_unix_epoch}.png

On 5/19/05, Rahul S. Johari <[EMAIL PROTECTED]> wrote:
> 
> On 5/19/05 10:59 AM, "Murray @ PlanetThoughtful"
> <[EMAIL PROTECTED]> wrote:
> 
> 
> > Try forcing the browser to bypass the cache by adding the lines at the
> > following link to your page:
> >
> > http://www.faqts.com/knowledge_base/view.phtml/aid/21068/fid/51
> 
> I thought this would definitely work because it looks like exactly what I
> need. IE is picking up the image from the cache no matter what.. And it
> seemed this piece of code is exactly for that, so that IE doesn't pick up
> images/data from the cache. But it's still not working! IE is still indeed
> picking up the image from the cache.
> 
> This is how the beginning of my php page looks like:
> 
> <?php
> session_start();
> header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
> header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
> header ("Cache-Control: no-cache, must-revalidate"); // for HTTP/1.1
> header ("Pragma: no-cache"); // for HTTP/1.0
> ?>
> 
> Stll... IE is displaying the image that has already been displayed on first
> login attempt... It won't display new Image untill you actually physically
> hit the "REFRESH" button on the browser.
> 
> Any suggestions?
> 
> Rahul S. Johari
> Coordinator, Internet & Administration
> Informed Marketing Services Inc.
> 251 River Street
> Troy, NY 12180
> 
> Tel: (518) 266-0909 x154
> Fax: (518) 266-0909
> Email: [EMAIL PROTECTED]
> http://www.informed-sources.com
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message ---
Hi,

I am working on a program for a clothing manufacture and need some help
designing the tables for the database. I have to track the inventory levels
of each style by color and size and can not figure the tables out. Here is
the information I need to track.

Style number
Color
Size (can have from 1 to 10 different sizes)

Also need to track the transactions. Receipt Number for incoming inventory
and Invoice number for outgoing. 

Can anyone help me figure out how to setup the tables? Once that is done, I
think I can get the rest working.

Thanks!!!
Kevin

--- End Message ---
--- Begin Message ---
Something along these lines should get you started

Tclothes (holds all the possible variations of size, colour and style)
Id PK
Styleid FK to Tstyle
Sizeid FK to Tsize
Colourid FK to Tcolour

Tstyle
Styleid PK
StyleDescription VARCHAR

Tsize
Sizeid PK
SizeDescription VARCHAR

Tcolour
Colourid PK
ColourDescription VARCHAR

Mark
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 20 May 2005 00:12
To: [email protected]
Subject: [PHP] OT - Table help needed~ PLEASE


Hi,

I am working on a program for a clothing manufacture and need some help
designing the tables for the database. I have to track the inventory
levels of each style by color and size and can not figure the tables
out. Here is the information I need to track.

Style number
Color
Size (can have from 1 to 10 different sizes)

Also need to track the transactions. Receipt Number for incoming
inventory and Invoice number for outgoing. 

Can anyone help me figure out how to setup the tables? Once that is
done, I think I can get the rest working.

Thanks!!!
Kevin

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

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**********************************************************************

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**********************************************************************
**********************************************************************


--- End Message ---
--- Begin Message ---
Hi,

 

I am working on a program for a clothing manufacture and need some help
designing the tables for the database. I have to track the inventory levels
of each style by color and size and can not figure the tables out. Here is
the information I need to track.

 

Style number

Color

Size (can have from 1 to 10 different sizes)

 

Also need to track the transactions. Receipt Number for incoming inventory
and Invoice number for outgoing. 

 

Can anyone help me figure out how to setup the tables? Once that is done, I
think I can get the rest working.

 

Thanks!!!

Kevin

 

 


--- End Message ---
--- Begin Message ---
Hi, folks.  Has anyone had any issues using PHP with the libssh2
library?

I had my sysadmin install it, but he's not certain we should be
developing against it in a production environment since it's still alpha
(0.10).

I'm looking for opinions as to whether anyone out there has run into
problems developing against it, or if the general consensus is that
there are no critical concerns about using it as a core part of a large
project.

I personally don't think there are, since I don't think that PHP would
have bindings to this library if it weren't, but I want to have some
other feedback to give to my sysadmin?

Anyone have any opinions?

Cheers and TIA,

Pablo   

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Michael Stearne [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 19, 2005 4:17 PM


> No.  It's RedHat Fedora Core 3.

And? (/etc/selinux/ ;-)

It�s a thing that troubles a lot in Feodora3 installations....

--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/Systemdeveloper

> On 5/19/05, Kim Madsen <[EMAIL PROTECTED]> wrote:
> > > -----Original Message-----
> > > From: Michael Stearne [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, May 19, 2005 9:10 AM
> >
> > > I am having the strangest problem using system() or exec() or any
> > > variation.  None of them work on the Fedora Core 3 system that was
> > > just loaded.  The PHP is Version 4.3.9 with Apache 2.0.52, the default
> > > installation for Fedora Core 3.  Everything in PHP works as expected
> > > except when trying a system call.  If I run :
> > >
> > > <?
> > > system("/bin/ls /tmp");
> > > ?>
> > >
> > > on my OS X (Apache/1.3.33 (Darwin) PHP/4.3.4) this returns the desired
> > > results, a listing of the tmp directory.  On the Fedora box I get
> > > nothing, a blank page.  There is content in the /tmp directory on the
> > > Fedora box.
> >
> > Are You perhaps running SElinux?
> >
> > --
> > Med venlig hilsen / best regards
> > ComX Networks A/S
> > Kim Madsen
> > Systemudvikler/Systemdeveloper
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >

--- End Message ---
--- Begin Message ---
Hi All,

how would one get them to display in php pages..? Is it like ASP where you have to set a codepage number..? I've set this at the top of my pages,
<html lang="Shift_JIS">
and this for the font
<font type=\"Shift_JIS\">$product_data_output</font>
I don't claim to know much about HTML either. I'm just building a little dynamic site for my company, minus any bells and whistles interface wise. Do I have to set something in php/apache for this.? Thanx.


Mark Sargent.
--- End Message ---
--- Begin Message ---
Hi friends,

I am Rittwick Banerjee

and i have made a mysql based user name and password program but I found that
what ever I entered in the user name and password feild the php file dose not working.


I set this code for user name and password

$sql = " SELECT `User_name` AND `User_pass` FROM `user` WHERE `User_name`= '$_POST[user_id]' AND `User_pass` = '$_POST[user_pass]' "

But this code dose not working properly.
This code dosen't checking if the user name and password is correct or incorrect


Please help me with some source code.

Thank you.
--- End Message ---
--- Begin Message ---
Hi,

I'm making this middle-range site (i. e., not so little, bit not so big,
either), and i want users that subscribe to my site to have their
confirmation made by email.

Does anyone sugests a simple, yet effective way to do this ?

Please, don't misunderstand me.
The PHP part i know.
The sugestions i'm asking for are about the mechanism.

Thanking you in advance.

Warm Regards,
-- 
M�rio Gamito
Bastard Administrator in $hell
$Users, you better make your backups
Key FingerPrint: 0xA86C640A

--- End Message ---
--- Begin Message ---
Hi,

I'm making this middle-range site (i. e., not so little, bit not so big,
either), and i want users that subscribe to my site to have their
confirmation made by email.

Does anyone sugests a simple, yet effective way to do this ?

Please, don't misunderstand me.
The PHP part i know.
The sugestions i'm asking for are about the mechanism.

Thanking you in advance.

Warm Regards,
M�rio Gamito

--- End Message ---
--- Begin Message --- Robert Meyer wrote:
Hello All,

Just a comment on PHP5. I never used PHP until just over two weeks ago, though I have been a software engineer since 1975. What one can do with PHP5 is awesome.


What a great recommendation! It was very nice to read how someone who obviously has buckets of IT experience/knowledge is successfully utilizing php.

thanks for sharing your experience with the list! :-)

...
--- End Message ---

Reply via email to