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

2005-05-20 Thread php-general-digest-help

php-general Digest 20 May 2005 11:03:11 - 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:
php-general@lists.php.net


--
---BeginMessage---
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---
---BeginMessage---
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];
 

RE: [PHP] Problem With System Call

2005-05-20 Thread Kim Madsen

 -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
 
 

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



[PHP] Japanese Fonts in php

2005-05-20 Thread Mark Sargent
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.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Empty string problem

2005-05-20 Thread Rasmus Lerdorf
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

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



[PHP] mysql with php

2005-05-20 Thread Rittwick Banerjee
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.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] OT - Table help needed~ PLEASE

2005-05-20 Thread Mark Rees
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: php-general@lists.php.net
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

EOE

**
**


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



[PHP] How to confirm subscriptions by e-mail on a PHP site ?

2005-05-20 Thread Mário Gamito
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

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



Re: [PHP] Excellent language PHP5 is!

2005-05-20 Thread Jochem Maas
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! :-)
...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] How to confirm subscriptions by e-mail on a PHP site ?

2005-05-20 Thread Mário Gamito
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

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



Re: [PHP] mysql with php

2005-05-20 Thread eoghan
$sql = select User_name, User_pass from user where User_name = 
'$_POST[user_id]' and User_pass = '$_POST[user_pass]';

assuming user_id isnt an int
Rittwick Banerjee wrote:
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.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Bar codes

2005-05-20 Thread Emil
Hello!
Sorry if this is off topic. I'm making a php site where one can order a 
kit and now I would like to mark the kits with bar codes generated by 
the php script. I would also need some kind of bar code hardware reader 
and some way for a computer to read the result from the bar code reader, 
guess php might not work here so I might create some java application or 
whatever.

I've never done anything like this before, do you know of any good 
starting points? I don't know anything about bar codes.

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


Re: [PHP] How to confirm subscriptions by e-mail on a PHP site ?

2005-05-20 Thread Mário Gamito
Hi George,

Thank you for your answer.

The future users of the site i'm doing can register freely.
No need for aproval.

I just want to ensure that there are no fake subscriptions or fake e-mails.

I was thinking more in something like an email sent back after the form
fill, with an URL back to the site that makes the conformation.
I'm doing some experimentations on this field.

When they fill in the form, all data goes to the DB along with a random
generated code. There's a boolean field called confirmed, that has an
obvious job, i. e., defaults to FALSE.
After that, i send them a mail with an URL ending in ?code=345njkh53h23
If they click on them and the codes match, the boolean field in the DB
switches to TRUE.

I think it's a bit complicated engine for such a simple field.

Any sugestion about easying the process ?

Warm Regards,
Mário Gamito



George Pitcher wrote:
 Mario,
 
 My site is for universities. Each university has their own administrator,
 responsible for authorising each of their own subscribers. No that is
 probably overkill. However, when a new subscriber registers (simple data
 gathering form - including preferred password), the system sends off an
 email to the appropriate administrator, who logs in, awards access level (we
 have 5 different access levels) and then an email is sent to the new user
 confirming all the details.
 
 So you could have the response to the data gathering form, record the info
 in a db and then send an email to the new user.
 
 I also have a small form on the login page that if the user enters their
 email address, and its the one they registered with, it sends their login
 details inc passwords to that email address. Saves me having to sort it out.
 
 Hope this helps.
 
 George in Oxford
 
 
-Original Message-
From: Mário Gamito [mailto:[EMAIL PROTECTED]
Sent: 20 May 2005 9:21 am
To: php-general@lists.php.net
Subject: [PHP] How to confirm subscriptions by e-mail on a PHP site ?


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

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



Re: [PHP] How to confirm subscriptions by e-mail on a PHP site ?

2005-05-20 Thread Duncan Hill
On Friday 20 May 2005 09:21, Mário Gamito typed:
 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 ?

When the user subs, generate a token in a DB table.

Send the token to the user via email with a URL to click.  Use 
mime/alternative if you want to send html and plain text so their client can 
choose the rendering method.

If you get the click where the token matches (and perhaps first name or 
similar), they've confirmed their desire to subscribe.  Do what you need to 
do with the confirmation and remove the token from the table.  Record a 
history of IP etc to show that they DID indeed confirm their sub.  Gives you 
proof that they asked for it if they contend it's spam.

-- 
My mind not only wanders, it sometimes leaves completely.

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



RE: [PHP] mysql with php

2005-05-20 Thread Jim Moseby
 -Original Message-
 From: Rittwick Banerjee [mailto:[EMAIL PROTECTED]
 Sent: Friday, May 20, 2005 3:59 AM
 To: php-general@lists.php.net
 Subject: [PHP] mysql with php
 
 
 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.


Your code seems non-sensical to me. There are lots pf considerations to take
into account with passwords and security, but on a very basic level. heres
what I think you're after:

$sql=select User_pass from user where user_name = $_POST[user_id];
$result=mysql_query($sql);
$row=mysql_fetch_array($result);

if($row[user_pass]==$_POST[user_pass]){
  echo Access Granted!
}else{
  echo Access Denied!
}


JM

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



Re: [PHP] How to confirm subscriptions by e-mail on a PHP site ?

2005-05-20 Thread Rory Browne
You can either email them an URL containing an activation code, which
would have them activate in their browser.

If you don't understand the terms .forwared, or MTA, you should
probably either learn more about them or skip to the third paragraph.
If you want them to activate using their email client, the question
isn't quite(although almost) so simple. You can either use the
.forward mechanism, to parse the response mail, and deal with it
accordingly(assuming you're using a .forward capable MTA).

Alternatively you can have them reply to an account, and set up a cron
job(assuming you're on unix) to have PHP check the account using it's
imap functions every minute. The first way would be preferable.



On 5/20/05, Mário Gamito [EMAIL PROTECTED] wrote:
 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
 
 --
 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



RE: [PHP] mysql with php

2005-05-20 Thread George Pitcher
Noticed that there was still something missing in this:

$sql = select User_name, User_pass from user where User_name = 
'$_POST['user_id']' and User_pass = '$_POST['user_pass']';

Quotes around the POST Args.

George

 -Original Message-
 From: eoghan [mailto:[EMAIL PROTECTED]
 Sent: 20 May 2005 11:21 am
 To: Rittwick Banerjee
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] mysql with php
 
 
 $sql = select User_name, User_pass from user where User_name = 
 '$_POST[user_id]' and User_pass = '$_POST[user_pass]';
 
 assuming user_id isnt an int
 
 Rittwick Banerjee wrote:
  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.
  
 
 -- 
 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



RE: [PHP] How to confirm subscriptions by e-mail on a PHP site ?

2005-05-20 Thread Jim Moseby
What I do is generate a random key, save it in the database, send them an
email with a link that they must click to validate their email:

http://www.mysite.com/[EMAIL PROTECTED][EMAIL PROTECTED]
9j(*(hn3983n*(j

Its not foolproof, I know, but it is simple and effective, as you say.

Heres a quick and dirty function to generate the key:

function KeyGen($length){  // Generates random, mixed case, alphanumeric
string of $length characters.
 
for($len=$length,$r='';strlen($r)$len;$r.=chr(!mt_rand(0,2)?mt_rand(48,57):
(!mt_rand(0,1)?mt_rand(65,90):mt_rand(97,122;
  return $r;
}

JM


 -Original Message-
 From: Mário Gamito [mailto:[EMAIL PROTECTED]
 Sent: Friday, May 20, 2005 5:13 AM
 To: php-general@lists.php.net
 Subject: [PHP] How to confirm subscriptions by e-mail on a PHP site ?
 
 
 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
 
 -- 
 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



Re: [PHP] How to confirm subscriptions by e-mail on a PHP site ?

2005-05-20 Thread Marcus Joyce
The way i did it was, put a 25char hash inside the registered column,
then sent an email to the user containing something like
domain.com?user=id_numberhash=hash
then i did select userID where userID = $_GET['user']  registered = 
$_GET['hash']

(not exactly the sql phrase, but i dont feel like adding %s's and 
mysql_real_escape_strings to it but you get the picture)

then from the data i got, i did
if($row_is_returned)
{
  update users set registered=yes WHERE userID = $_GET['user'];
}
and that was it.
Marcus
Mário Gamito wrote:
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
 

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


Re: [PHP] mysql with php

2005-05-20 Thread [EMAIL PROTECTED]
try this:
$sql = 
   SELECT User_name, User_pass
   FROM `user`
   WHERE User_name= '$_POST[user_id]'
   AND User_pass = '$_POST[user_pass]'
   ;
-afan
Rittwick Banerjee wrote:
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.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Bar codes

2005-05-20 Thread Jim Moseby
 Hello!
 
 Sorry if this is off topic. I'm making a php site where one 
 can order a 
 kit and now I would like to mark the kits with bar codes generated by 
 the php script. I would also need some kind of bar code 
 hardware reader 
 and some way for a computer to read the result from the bar 
 code reader, 
 guess php might not work here so I might create some java 
 application or 
 whatever.
 
 I've never done anything like this before, do you know of any good 
 starting points? I don't know anything about bar codes.
 
 Regards Emil
 

If I understand you correctly, a person orders a kit, you print a barcode,
on a sticker for instance, and apply it to the kit they order.  You then
want to be able to scan the barcode, when you ship it for instance, back
into the application.

For this you will need a TTF barcode font (available on the web for free), a
barcode scanner (check out Symbol, and Wasp), and a label printer.

There are many, relatively inexpensive, barcode reader solutions that simply
plug into a USB port, or go between your keyboard and your computer.  Scans
data in just as if you had typed it.


JM

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



[PHP] ftp_fput() limit is 10 characters

2005-05-20 Thread mayo
I'm trying to ftp a file. I looked in the php manual and I don't see a
character limit for ftp_fput().
I'm getting the following error
 
ftp_fput(): Specified object name too long, limit is 10 characters:
CF-20050520. in /home/www/cf/test.php on line 45
There was a problem while uploading CF-20050520.txt
 
thx
 
mayo


Re: [PHP] Bar codes

2005-05-20 Thread Leif Gregory
Hello Emil,

Friday, May 20, 2005, 4:45:49 AM, you wrote:
E I've never done anything like this before, do you know of any good
E starting points? I don't know anything about bar codes.

http://www.phpclasses.org and search for barcode


-- 
Leif (TB lists moderator and fellow end user).

Using The Bat! 3.5 Return RC9 under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB

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



Re: [PHP] Bar codes

2005-05-20 Thread James E Hicks III
Emil wrote:
Hello!
Sorry if this is off topic. I'm making a php site where one can order 
a kit and now I would like to mark the kits with bar codes generated 
by the php script. I would also need some kind of bar code hardware 
reader and some way for a computer to read the result from the bar 
code reader, guess php might not work here so I might create some java 
application or whatever.

I've never done anything like this before, do you know of any good 
starting points? I don't know anything about bar codes.

Regards Emil
I've written an entire Warehouse Management System using PHP that 
utilizes barcoding extensively. We use zebra printers and various 
barcode reading wands (usually USB connected) with wedges. Most of these 
wands allow you to set a postfix code to send after it sends the wanded 
data. I just set this to CRLF and that allows for easy wanding into 
webpages that are specially designed to accept this type of input.

The Zebra printers use a language called ZPL. We created our basic label 
templates using ZPL and use PHP to fill out the template and send it on 
to the cups server (which handles sending the data to the Zebra printer).

Good Luck, this will be a fun project!
James Hicks
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Image Verification - Problems in Safari, Mac OS X

2005-05-20 Thread Rahul S. Johari

Ave,

On 5/19/05 6:08 PM, Rory Browne [EMAIL PROTECTED] wrote:

 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

It's sounding logical, but could you explain a little more... I'm not sure
how to use no_of_seconds_since_unix_epoch ...

Thanks,

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



[PHP] ZEND Certification

2005-05-20 Thread Martin Zvarik
Hi,

anyone has taken ZEND PHP Certification Exam??? Please can you give me
some information about it?

Thank you,

Martin

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



[PHP] Getting parameters from the URL

2005-05-20 Thread Mário Gamito
Hi,

Following the previous discussion regarding confirmation of
subscriptions (to all the people who replied, my thanks), i now generate
an URL something like this:


http://www.bar.com/[EMAIL PROTECTED]code=vu782

Then in file confirma_registo_action.php, i do:

  $email= $_GET['email'];
  $code = $_GET['code'];
  print($email);
  print($code);

for testing, but it does print nothing.
So, i'm not getting the parameters from the URL.
I have register_globals=Off in php.ini

Why is this wrong and how to make it right ?

Thanking you in advance.

Warm Regards,
Mário Gamito

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



Re: [PHP] Image Verification - Problems in Safari, Mac OS X

2005-05-20 Thread Rahul S. Johari

Ave,

On 5/19/05 5:41 PM, Marek Kilimajer [EMAIL PROTECTED] wrote:

 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.

Solutions works for me too... Gets rid of the multi-user problem. Thanks for
pointing it out and suggesting the solution.

The other Cache problem still persists. Don't know what to do about it. Is
just not working out in IE.
 

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



[PHP] Getting parameters from a URL coming from outside the site

2005-05-20 Thread Mário Gamito
Hi,

Following the previous discussion regarding confirmation of
subscriptions (to all the people who replied, my thanks), i now generate
an URL something like this:


http://www.bar.com/[EMAIL PROTECTED]code=vu782
This hit will come from someone's mail client.

Then, in file confirma_registo_action.php, i do:

  $email= $_GET['email'];
  $code = $_GET['code'];
  print($email);
  print($code);

for testing, but it does print nothing.
So, i'm not getting the parameters from the URL.
I have register_globals=Off in php.ini

Why is this wrong and how to make it right ?

Thanking you in advance.

Warm Regards,

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



Re: [PHP] Getting parameters from the URL

2005-05-20 Thread Richard Davey
Hello Mário,

Friday, May 20, 2005, 4:48:07 PM, you wrote:

MG http://www.bar.com/[EMAIL PROTECTED]code=vu782

MG for testing, but it does print nothing. So, i'm not getting the
MG parameters from the URL. I have register_globals=Off in php.ini

MG Why is this wrong and how to make it right ?

Try dumping out the whole of $_GET to see if you are receiving
anything at all:

?php
 print_r($_GET);
?

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I do not fear computers. I fear the lack of them. - Isaac Asimov

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



[PHP] PHP5 binaries

2005-05-20 Thread Marcus Bointon
It seems that none of the current major Linux distros provide PHP5  
binary installation packages. By major I mean, RedHat, Fedora (it  
will be in F4 when released), Mandriva, Debian, Ubuntu, possibly  
others. Seriously, none have standard PHP5 packages, even optional  
ones. Does no-one use PHP5??? It's not exactly bleeding edge, having  
made a final release nearly a year ago.

I'm trying to set up an automatable installation system for such  
evident rarities as RedHat Enterprise Linux 4, and I just can't find  
anything workable. Even php4 binaries are rare (especially ones with  
flexible options including things like pcntl). Perl is massively  
supported, with binaries for hundreds of extensions widely available.  
Why does PHP get such second-rate treatment? Is it particularly hard  
to build packages for?

I'm quite used to building PHP5 from source, but it's not the most  
elegant way of deploying things. The PHP download page says Most  
Linux distributions come with PHP these days, so if you do not want  
to compile your own, go to your distribution's download site., but  
that's no use if no-one actually provides them for current releases.

Even in the various rpm repositories PHP5 is a rare beast - for  
example rpmforge's members don't include it. rpmbone provides some  
very basic rpms, but they suffer from dependency problems (even when  
accessed via apt-get).

Any other ideas?
Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] ZEND Certification

2005-05-20 Thread Greg Donald
On 5/20/05, Martin Zvarik [EMAIL PROTECTED] wrote:
 anyone has taken ZEND PHP Certification Exam???

http://zend.com/store/education/certification/yellow-pages.php

 Please can you give me
 some information about it?

http://zend.com/store/education/certification/zend-php-certification.php


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



Re: [PHP] Japanese Fonts in php

2005-05-20 Thread Marek Kilimajer
Mark Sargent wrote:
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.
To specify a codepage in html, put correct meta tag in head section:
meta http-equiv=Content-Type content=text/html; charset=Shift_JIS
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] ZEND Certification

2005-05-20 Thread Rory Browne
On 5/20/05, Martin Zvarik [EMAIL PROTECTED] wrote:
 Hi,
 
 anyone has taken ZEND PHP Certification Exam???
Yes. Loads of people here have taken it. Loads of other people here
set the questions.


 Please can you give me some information about it?
I'm sure you'll get lots of useful and encourageing information about
it. In the meantime you might want to search the archives.

 
 Thank you,
 
 Martin
 
 --
 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



Re: [PHP] PHP5 binaries

2005-05-20 Thread Duncan Hill
On Friday 20 May 2005 17:58, Marcus Bointon wrote:
 It seems that none of the current major Linux distros provide PHP5  
 binary installation packages. By major I mean, RedHat, Fedora (it  
 will be in F4 when released), Mandriva, Debian, Ubuntu, possibly  
 others. Seriously, none have standard PHP5 packages, even optional  
 ones. Does no-one use PHP5??? It's not exactly bleeding edge, having  
 made a final release nearly a year ago.

Kubuntu (ie, Ubuntu with KDE as default) has php5 available as a standard i386 
package according to aptitude.  No amd64 binary package by the looks though.

And depending on whether you consider gentoo 'major' or not.. php5 has been 
the default for the past 3 releases or so.

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



[PHP] Can I prevent Server variables from being spoofed ?

2005-05-20 Thread Graham Anderson
Can the server variable 'user agent'  be modified/spoofed  by the user?
 I have a bunch movies that I want to only open if the user agent 
contains Quicktime Player...
In my case, if the user agent string contains Quicktime Player, a movie 
url is written for Quicktime to open
If the user agent contains  a browser, I want php to deny accessnot 
write the url for Quicktime to read

is is possible for a script kiddie to spoof user agent server variables 
to fool the server ?

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


[PHP] Cache Problems

2005-05-20 Thread Rahul S. Johari

Ave,

My whole Auto-Image verification application and has come to get stuck at
the Cache in IE. It¹s working fine in Safari on Mac, but IE is picking up
the image from the Cache no matter what. I¹ve tried the following:

header(Expires: Mon, 26 Jul 1997 05:00:00 GMT);
header(Last-Modified:  . gmdate(D, d M Y H:i:s) .  GMT);
header(Cache-Control: no-store, no-cache, must-revalidate);
header(Cache-Control: post-check=0, pre-check=0, false);
header(Pragma: no-cache);

Which I understood is to tell the browser not to load the page or it¹s
images from the Cache.. But it still does. Nothing is working out. I don¹t
know how to get that page to load fresh from the server and not IE¹s cache
so it won¹t display the same Image over and over.

Any suggestions?

Thanks,
 
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] __get() not reentrant?

2005-05-20 Thread Christopher J. Bottaro
Maybe I'm using reentrant incorrectly, but here is what I mean...

class Test  {
   function __get($nm)  {
  if ($nm == 'x')
 return $this-func();
  elseif ($nm == 'y')
 return 'y';
  elseif ($nm == 'xx')
 return 'x';
   }
   function func()   {
  return $this-xx;
   }
}
$t = new Test();
print $t-y . \n;
print $t-xx . \n;
print $t-x . \n;
print $t-func() . \n;

I would expect the following code to output:
y
x
x
x

But instead, it outputs:
y
x

x

Is this a bug?  This limitation is not documented (maybe it should be?).

-- C

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



Re: [PHP] Getting parameters from a URL coming from outside the site

2005-05-20 Thread Brian V Bonini
On Fri, 2005-05-20 at 12:51, Mário Gamito wrote:

 Why is this wrong and how to make it right ?

I did this and sent myself a link to it via email, clicked it from
within my email client (Evolution) which launched a browser and called
the script successfully writing the vars to test.txt. Of course this is
not use-able in the real world but it works for testing...

http:/foobar.com/[EMAIL PROTECTED]code=vu782

?php

$filename=test.txt;

if(!file_exists($filename)) {
touch($filename);
}

$content = $_GET['email'] . :;
$content .= $_GET['code'] . \n;

$fp = fopen($filename, 'ab');
fwrite($fp, $content);
fclose($fp);

header(Location: http://foobar.com/test.txt;);

?


-- 

s/:-[(/]/:-)/g


BrianGnuPG - KeyID: 0x04A4F0DC | Key Server: pgp.mit.edu
==
gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC
Key Info: http://gfx-design.com/keys
Linux Registered User #339825 at http://counter.li.org

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



Re: [PHP] Can I prevent Server variables from being spoofed ?

2005-05-20 Thread Rasmus Lerdorf
Graham Anderson wrote:
 Can the server variable 'user agent'  be modified/spoofed  by the user?
 
  I have a bunch movies that I want to only open if the user agent
 contains Quicktime Player...
 In my case, if the user agent string contains Quicktime Player, a movie
 url is written for Quicktime to open
 If the user agent contains  a browser, I want php to deny accessnot
 write the url for Quicktime to read
 
 is is possible for a script kiddie to spoof user agent server variables
 to fool the server ?

Of course.  Some browsers, like Opera, even have a preferences thing
where you can type in whatever user agent string you want.  But even
without that it is a trivial thing to spoof.  Anything that comes across
the wire to you can be spoofed.  This includes the Host: header, the
Referer: header, the User-Agent, cookies, whatever.

-Rasmus

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



Re: [PHP] Can I prevent Server variables from being spoofed ?

2005-05-20 Thread Rory Browne
Not only can the user agent string be easly spoofed, but as a result
of its abuse by certain webmasters(mostly Banks) Browsers such as
Opera, and I believe Konqueror, have a setting that allows you to
change the user agent string as a configuration option.

The UserAgent is a hint. It is most definatly not a gurantee. 

On 5/20/05, Graham Anderson [EMAIL PROTECTED] wrote:
 Can the server variable 'user agent'  be modified/spoofed  by the user?
 
   I have a bunch movies that I want to only open if the user agent
 contains Quicktime Player...
 In my case, if the user agent string contains Quicktime Player, a movie
 url is written for Quicktime to open
 If the user agent contains  a browser, I want php to deny accessnot
 write the url for Quicktime to read
 
 is is possible for a script kiddie to spoof user agent server variables
 to fool the server ?
 
 
 many thanks :)
 
 g
 
 --
 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



Re: [PHP] Can I prevent Server variables from being spoofed ?

2005-05-20 Thread Graham Anderson
are there any php methods that can accurately determine who the client 
is ?
mine is pretty basic...if I am a browser, then deny access
g
On May 20, 2005, at 1:15 PM, Chris Shiflett wrote:

Graham Anderson wrote:
Can the server variable 'user agent' be modified/spoofed  by the user?
Yes, this value is being sent by the client.
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Getting parameters from the URL

2005-05-20 Thread Mário Gamito
Hi Richard,

It still doesn't works.
Maybe it's because it's being launched from outside the site (i. e., the
referrer is not from the site ?).

Maybe something's in php.ini ?

Any ideas ?

Warm Regards,
Mário Gamito

Richard Davey wrote:
 Hello Mário,
 
 Friday, May 20, 2005, 4:48:07 PM, you wrote:
 
 MG http://www.bar.com/[EMAIL PROTECTED]code=vu782
 
 MG for testing, but it does print nothing. So, i'm not getting the
 MG parameters from the URL. I have register_globals=Off in php.ini
 
 MG Why is this wrong and how to make it right ?
 
 Try dumping out the whole of $_GET to see if you are receiving
 anything at all:
 
 ?php
  print_r($_GET);
 ?
 
 Best regards,
 
 Richard Davey

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



Re: [PHP] Can I prevent Server variables from being spoofed ?

2005-05-20 Thread Chris Shiflett
Graham Anderson wrote:
Can the server variable 'user agent' be modified/spoofed  by the user?
Yes, this value is being sent by the client.
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Can I prevent Server variables from being spoofed ?

2005-05-20 Thread Graham Anderson
is there another way to get reasonably accurate environment variables ?
In my case,if  movies are being opened in a browser...deny access
g

On May 20, 2005, at 12:35 PM, James E Hicks III wrote:
Graham Anderson wrote:
Can the server variable 'user agent'  be modified/spoofed  by the 
user?

is is possible for a script kiddie to spoof user agent server 
variables to fool the server ?

Yes. Most good browsers will allow you to do this.
James
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Can I prevent Server variables from being spoofed ?

2005-05-20 Thread Leif Gregory
Hello Graham,

Friday, May 20, 2005, 12:46:28 PM, you wrote:
G Can the server variable 'user agent' be modified/spoofed by the
G user?

Oh yeah Firefox and Opera are easy to change.


-- 
Leif (TB lists moderator and fellow end user).

Using The Bat! 3.5 Return RC9 under Windows XP 5.1
Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB

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



[PHP] Should this not return true?!?!

2005-05-20 Thread Dustin Krysak
Hi there (newbie here) - I have the following snippet of code..
$sexId = $_POST['sex'];
$fName = $_POST['fName'];
$lName = $_POST['lName'];
if ($status = $db-query(INSERT INTO names (nameId, sexId, fName,  
lName) VALUES ('', $sexId, '$fName', '$lName'))) {
 print Your data was added to the database successfully!;
} else {
 print Your data could not be added to the database!;
}

Assuming my query was successful, should it not return true and print  
the success message?

For some reason it is doing just the opposite. The data is added, but  
it displays the error instead.

Am I misunderstanding something?
d
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Can I prevent Server variables from being spoofed ?

2005-05-20 Thread Brent Baisley
Think about it. The server can only tell what the user agent is by what 
the user reports. For all you know it could just be a perl script or 
just a terminal session reporting as being Quicktime.
So yes, a script kiddie could spoof the user agent. Heck, some browsers 
even allow you to specify the user agent you want to report.

On May 20, 2005, at 2:46 PM, Graham Anderson wrote:
Can the server variable 'user agent'  be modified/spoofed  by the user?
 I have a bunch movies that I want to only open if the user agent 
contains Quicktime Player...
In my case, if the user agent string contains Quicktime Player, a 
movie url is written for Quicktime to open
If the user agent contains  a browser, I want php to deny 
accessnot write the url for Quicktime to read

is is possible for a script kiddie to spoof user agent server 
variables to fool the server ?

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

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Code to bypass a certain php.ini directive

2005-05-20 Thread Mário Gamito
Hi,

I have this server with display_errors=Off in php.ini

Now that i'm developing a new site. is there some code i can insert in
the begining of a .php file to set only for this file (not sitewide)
display_errors=On ?

Thanking you in advance.

Warm regards,
Mário Gamito

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



Re: [PHP] Should this not return true?!?!

2005-05-20 Thread Philip Hallstrom
Hi there (newbie here) - I have the following snippet of code..
$sexId = $_POST['sex'];
$fName = $_POST['fName'];
$lName = $_POST['lName'];
if ($status = $db-query(INSERT INTO names (nameId, sexId, fName, lName) 
VALUES ('', $sexId, '$fName', '$lName'))) {
print Your data was added to the database successfully!;
} else {
print Your data could not be added to the database!;
}

Assuming my query was successful, should it not return true and print the 
success message?

For some reason it is doing just the opposite. The data is added, but it 
displays the error instead.

Am I misunderstanding something?
Hmmm... couple of things:
Your if statement isn't checking the value of '$status'.  It's checking if 
the assignment *to* $status is true or false.  At least I think so.

So, I think at a minimum you want:
if ( $db-query.
Also, what is $db-query supposed to return upon success?  In the unix 
world, programs typically return zero to indicate success and use other 
values to differentiate b/n all the possible errors.  if $db-query is 
doing that, then that's the problem.

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


[PHP] multiple queries, one transaction

2005-05-20 Thread mayo
I have a site where I need to do multiple queries in sequence. 
 
 
I see there is a way to do consider all querys and to fail the entire
procedure if one query fails. It's a BEGIN and COMMIT statement.
 
mysql_query(BEGIN); // starts the transaction
 
 
mysql_query(COMMIT); // ends the transaction
 
I'm just not certain how it's used.
 
Thx, mayo
 
 
 


Re: [PHP] Can I prevent Server variables from being spoofed ?

2005-05-20 Thread Rasmus Lerdorf
Graham Anderson wrote:
 thanks...
 I'l start exploring other options
 g
 On May 20, 2005, at 2:35 PM, Marek Kilimajer wrote:
 
 Graham Anderson wrote:

 is there another way to get reasonably accurate environment variables ?
 In my case,if  movies are being opened in a browser...deny access


 no, there is no way

 

You may be able to trick it.  If your goal is to make it only work in
Quicktime, or some other standalone application like that, chances are
pretty good that it doesn't implement everything a full browser
implements.  For example, does it follow a redirect?  Does it do
Javascript at all?  Not that someone won't be able to hack around these
tricks, but you could probably come up with something that would prevent
the majority of people from accessing your content directly with a browser.

-Rasmus

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



Re: [PHP] Code to bypass a certain php.ini directive

2005-05-20 Thread Richard Lynch
On Fri, May 20, 2005 3:06 pm, Mário Gamito said:
 I have this server with display_errors=Off in php.ini

 Now that i'm developing a new site. is there some code i can insert in
 the begining of a .php file to set only for this file (not sitewide)
 display_errors=On ?

Search http://apache.org for .htaccess and use php_value display_errors
1 in it.

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




Re: [PHP] multiple queries, one transaction

2005-05-20 Thread Richard Lynch
On Fri, May 20, 2005 2:02 pm, mayo said:
 I have a site where I need to do multiple queries in sequence.

In sequence, or as one single atomic un-interruptable action?

Cuz, like, just doing them in sequence is real straight forward:

$query = select ... ;
$meaningful_variable_names_are_good = mysql_query($query...
$query = select ... ;
$another_good_variable = mysql_query($query...

 I see there is a way to do consider all querys and to fail the entire
 procedure if one query fails. It's a BEGIN and COMMIT statement.

That is called a transaction.

And it is rather hefty performance penalties on your database.

And you need your tables to be innoDB or ??? but not the default MyISAM in
MySQL.

 mysql_query(BEGIN); // starts the transaction


Just put your queries in here.

ONLY do this if the queries succeed!
If they fail, do mysql_query(ROLLBACK);

 mysql_query(COMMIT); // ends the transaction

 I'm just not certain how it's used.

It's a lot easier to do the queries (you did all the hard work already)
than it is to figure out if you REALLY need them or not...

If you can avoid the transaction, and still have quality data and quality
application, you can gain significant performance that way...

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



Re: [PHP] Getting parameters from the URL

2005-05-20 Thread Richard Lynch
On Fri, May 20, 2005 1:21 pm, Mário Gamito said:
 It still doesn't works.
 Maybe it's because it's being launched from outside the site (i. e., the
 referrer is not from the site ?).

That's not it, almost for sure.

The entire Internet www would crumble if that were a common cause of the
problem :-)

 Maybe something's in php.ini ?

Maybe the EGCPS settings have no 'G' in them?

Is PHP itself working???

Put this at the top of your script:
?php phpinfo();?

Do you see a huge blue page with all kinds of PHP information?

If not, you don't have PHP working.

 Any ideas ?

 Warm Regards,
 Mário Gamito

 Richard Davey wrote:
 Hello Mário,

 Friday, May 20, 2005, 4:48:07 PM, you wrote:

 MG
 http://www.bar.com/[EMAIL PROTECTED]code=vu782

 MG for testing, but it does print nothing. So, i'm not getting the
 MG parameters from the URL. I have register_globals=Off in php.ini

 MG Why is this wrong and how to make it right ?

 Try dumping out the whole of $_GET to see if you are receiving
 anything at all:

 ?php
  print_r($_GET);
 ?

 Best regards,

 Richard Davey

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

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



Re: [PHP] Should this not return true?!?!

2005-05-20 Thread Richard Lynch
On Fri, May 20, 2005 1:53 pm, Dustin Krysak said:
 Hi there (newbie here) - I have the following snippet of code..

 $sexId = $_POST['sex'];
 $fName = $_POST['fName'];
 $lName = $_POST['lName'];

 if ($status = $db-query(INSERT INTO names (nameId, sexId, fName,
 lName) VALUES ('', $sexId, '$fName', '$lName'))) {
   print Your data was added to the database successfully!;
 } else {
   print Your data could not be added to the database!;
 }

 Assuming my query was successful, should it not return true and print
 the success message?

How would we know? :-)

Of the 10,000 PHP Database Abstraction classes out there, you haven't told
us which one you are using.

So there is *NO* *WAY* to tell what the query() method returns, is there?

Actually, you don't even tell us which DATABASE you are using, so while I
say MySQL below, I mean whatever database you are using

When it *DOES* fail, why don't you log the error message MySQL provides?
error_log(@mysql_error());

Only, most likely, the database abstraction layer you haven't told us
about has some fancy method to get that information.

 For some reason it is doing just the opposite. The data is added, but
 it displays the error instead.

Then, most likely, the particular database abstraction layer you have
chosen doesn't work the same way as mysql_query().  So you have to adjust
your code to work with the API of that database abstraction layer, which
we can't possibly begin to tell you how to do, since we don't know what
database abstraction software you are using.

 Am I misunderstanding something?

Definitely how to ask a good question :-)

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



Re: [PHP] Cache Problems

2005-05-20 Thread Richard Lynch
On Fri, May 20, 2005 12:11 pm, Rahul S. Johari said:
 My whole Auto-Image verification application and has come to get stuck at
 the Cache in IE. It¹s working fine in Safari on Mac, but IE is picking up
 the image from the Cache no matter what. I¹ve tried the following:

Are you clearing out the cache after you add these headers?

Cuz, like, if it gets IN the cache, the new headers you send don't count,
cuz it never asks for them.

 header(Expires: Mon, 26 Jul 1997 05:00:00 GMT);

Send something in the past, but not that far...  It might decide to ignore
you if you lie that much.

 header(Last-Modified:  . gmdate(D, d M Y H:i:s) .  GMT);
 header(Cache-Control: no-store, no-cache, must-revalidate);
 header(Cache-Control: post-check=0, pre-check=0, false);

I think having too many of these is going to mess you up...

 header(Pragma: no-cache);

 Which I understood is to tell the browser not to load the page or it¹s
 images from the Cache.. But it still does. Nothing is working out. I don¹t
 know how to get that page to load fresh from the server and not IE¹s cache
 so it won¹t display the same Image over and over.

If you really want to guaranteee no cahing in all browsers for all time,
the random URL is the way to go.  It's a shame that browsers will ignore
the caching headers, but since they do, I don't feel guilty making them
suck down more images then they should.

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



Re: [PHP] Code to bypass a certain php.ini directive

2005-05-20 Thread M Saleh EG
Sure you can!
 ini_set(display_errors, On);
 HTH.

 On 5/21/05, Mário Gamito [EMAIL PROTECTED] wrote: 
 
 Hi,
 
 I have this server with display_errors=Off in php.ini
 
 Now that i'm developing a new site. is there some code i can insert in
 the begining of a .php file to set only for this file (not sitewide)
 display_errors=On ?
 
 Thanking you in advance.
 
 Warm regards,
 Mário Gamito
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
M.Saleh.E.G
97150-4779817


Re: [PHP] ftp_fput() limit is 10 characters

2005-05-20 Thread Richard Lynch
On Fri, May 20, 2005 7:31 am, mayo said:
 I'm trying to ftp a file. I looked in the php manual and I don't see a
 character limit for ftp_fput().
 I'm getting the following error

 ftp_fput(): Specified object name too long, limit is 10 characters:
 CF-20050520. in /home/www/cf/test.php on line 45
 There was a problem while uploading CF-20050520.txt

That's because it's your FTP server imposing that limit, not PHP, not FTP
in general, just that server.

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



Re: [PHP] Image Verification - Problems in Safari, Mac OS X

2005-05-20 Thread Richard Lynch
On Thu, May 19, 2005 6:05 am, Rahul S. Johari said:
 I did actually remove the Header which declared it as a Image/PNG and
 everything seemed to work in both the browsers.

Great.  Now it works in 2 browsers, and breaks in 237.

You MUST separate the two.

Period.

 Here's my situation though... I can't separate out these two files because
 when a user is on the verification page, where the Image exists, in case
 he
 reloads or refreshes the page, a new image should be generated and
 displayed, so that the verification code is different each time you reach
 the verification page. If I was to keep the image code in a different
 page,
 the verification page will pick up the same PNG image and display the same
 security code over and over without changing it.

So you need some kind of secret token buried in the HTML which you can
decode in the image and in their submit to see if they actually used human
eyeballs to see the image.

There are dozens of scripts out there that do this -- Perhaps you should
review them to see how they work.

The simplest solution I know of is to make up a random string and store it
in an SQL table with the word in the image.

http://php.net/uniquid http://php.net/md5 etc.

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



[PHP] update blues

2005-05-20 Thread Jim Sara Feldman

Hi:

I have a partially finished app using PHP and MySQL that runs on  Mac 
G4 running System 10.3.9. Undoubtedly, I upgraded too many things all 
at the same time. Something broke. PHP and MySQL are both running. I 
can use the latest phpMyADMIN and everything is there in the 
database, so that should check both PHP and MySQL. Here are the 
changes in hardware and software:


New Old

Mac G5  G4
System  Tiger (10.4)10.3.9
PHP 4.3.10  4.3.4
MySQL   4.1.11  4.0.17
myAdmin 2.6.2   2.5.4

When I run the app, I get the login page with no difficulty, but that 
takes me back to the page member.php which attempts to start a 
session and then from there to check the validity of the login by 
comparing the login variables to those stored in the database. The 
attempt to use session_start(); now gets me the the following two 
warnings:


Warning: session_start(): Cannot send session cookie - headers 
already sent by (output started at 
/Library/WebServer/Documents/testit/Logsafe_project/db_fns.php:212) 
in /Library/WebServer/Documents/testit/Logsafe_project/member.php on 
line 14


Warning: session_start(): Cannot send session cache limiter - headers 
already sent (output started at 
/Library/WebServer/Documents/testit/Logsafe_project/db_fns.php:212) 
in /Library/WebServer/Documents/testit/Logsafe_project/member.php on 
line 14


No cookie is created, so it is not obvious why it is complaining. I 
suspect something in the apache script for starting php. Can anyone 
suggest a good place to look?


Jim
--
Jim Feldman
14 Linda Lane
Newton, MA 02461

617-527-0509