RE: [PHP] there has to be a better way...

2003-10-23 Thread Walter Torres
 -Original Message-
 From: Colin Kettenacker [mailto:[EMAIL PROTECTED]
 Sent: Thursday, October 23, 2003 12:53 AM
 To: jsWalter; [EMAIL PROTECTED]
 Subject: Re: [PHP] there has to be a better way...


 Hi Walter,

 You may want to look into PEAR's config package. It does pretty
 much all you
 have listed here and a lot more. I just started looking into it today.

Thanks Colin.

I saw that it, read it, played with it.

It was just way to big a clunky for what I was looking to do.

I have what need to make this work.

I was just hoping to have a better method of reading the file and ignoring
the blank lines and the commented lines.

I just have this thing about double level IF statements.

Thanks.

Walter

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



[PHP] problem in 2 dimensional Array

2003-10-23 Thread khuram noman
Dear Members

i have 2 problems in 2 dimensional array

1. how to declare global 2 dimensional array in php
2. how to pass 2 dimensional array in function as an
arrgument

waiting for ur soon reply
Khuram Noman

__
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

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



RE: [PHP] problem in 2 dimensional Array

2003-10-23 Thread Martin Towell
 Dear Members
 
 i have 2 problems in 2 dimensional array
 
 1. how to declare global 2 dimensional array in php
 2. how to pass 2 dimensional array in function as an
 arrgument
 
 waiting for ur soon reply
 Khuram Noman

1. $myvar = array();
   $myvar[0] = array();
   $myvar[0][0] = myval;
   etc...

   or directly
   $myvar[0][0] = myval;   

2. The same way you pass any other variable to a function
   myfunc($myvar);

HTH
Martin

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



[PHP] Exporting Data to Excel

2003-10-23 Thread Ben C.
I am using the code below to export my data into an excel file.  The code is
located in a password protected area which is checked against saved session
variables.  However when I put session_start(); the download errors out.
Does any one have any suggestions?  Please help.

?
session_start();

$connection = @mysql_connect($host, $uname, $pass) or die(Couldn't
connect.);
$db = @mysql_select_db($db_name, $connection) or die(Couldn't select
database.);

/* Specify the filename, which includes a datestamp for archival purposes...
*/
$date_stamp = date(Ymd);
$file_name = ExportedData . _ . $date_stamp . .xls;

/* Specify MIME type for tab-separated-values... */
//header(Content-type: text/tab-separated-values);

/* To open file directly into Excel, use this MIME type instead... */
header(Content-type: application/x-msexcel);

/* To force file download... */
header(Content-Disposition: attachment; filename=$file_name);

/* List the spreadsheet column labels (optional)... */
$column_labels = array(Label 1, Label 2 , Label 3);   /* ...and so on
*/
foreach($column_labels as $value) {
  echo($value\t);
}
echo(\n);
/* ...end column labels row */

/* Specify the SELECT query (you will need to change this)... */
$query = SELECT * FROM buyers;

/* Execute the query... */
$result = mysql_query($query);

/* Format data as tab-separated values... */
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
  while (list($key, $value) = each($row)) {
echo ($value . \t);
  }
  echo (\n);
}
?

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



Re: [PHP] Re: PHP3 files compatibilty with PHP4

2003-10-23 Thread Burhan Khalid
Tian, Simon (Contractor) (DSCP) wrote:
Hi all,

I have a website written in php3 , but the isp just did a upgrade of PHP
4.3.3. it was
a php 4 and it worked fine with my php3 progarm
Read this  http://www.php.net/reserved.variables

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Exporting Data to Excel

2003-10-23 Thread Marek Kilimajer
Damn exploder, use session_cache_limiter('private_no_expire'); before 
session_start()

Ben C. wrote:
I am using the code below to export my data into an excel file.  The code is
located in a password protected area which is checked against saved session
variables.  However when I put session_start(); the download errors out.
Does any one have any suggestions?  Please help.
?
session_start();
$connection = @mysql_connect($host, $uname, $pass) or die(Couldn't
connect.);
$db = @mysql_select_db($db_name, $connection) or die(Couldn't select
database.);
/* Specify the filename, which includes a datestamp for archival purposes...
*/
$date_stamp = date(Ymd);
$file_name = ExportedData . _ . $date_stamp . .xls;
/* Specify MIME type for tab-separated-values... */
//header(Content-type: text/tab-separated-values);
/* To open file directly into Excel, use this MIME type instead... */
header(Content-type: application/x-msexcel);
/* To force file download... */
header(Content-Disposition: attachment; filename=$file_name);
/* List the spreadsheet column labels (optional)... */
$column_labels = array(Label 1, Label 2 , Label 3);   /* ...and so on
*/
foreach($column_labels as $value) {
  echo($value\t);
}
echo(\n);
/* ...end column labels row */
/* Specify the SELECT query (you will need to change this)... */
$query = SELECT * FROM buyers;
/* Execute the query... */
$result = mysql_query($query);
/* Format data as tab-separated values... */
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
  while (list($key, $value) = each($row)) {
echo ($value . \t);
  }
  echo (\n);
}
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Opening Files via PHP

2003-10-23 Thread Stephen Tiano
Anyone familiar with PHP AND MYSQL WEB DEVELOPMENT, 2nd edition, by Luke 
Welling and Laura Thomson? And perhaps working on the Macintosh-UNIX 
side of things via OS X.whatever? If so, I ask for your indulgence and 
assistance.

Following advice given me a coupla weeks ago--on this very list, I 
believe--I've bought it to ground myself firmly in PHP and MySQL both, 
before moving on to my platform- and HTML editor-specific choices.

In this case--not surprising, given my second question above--I'm 
learning the UNIX brand on the Macintosh OS X.whatever side of things to 
eventually work with this Dreamweaver MX I've heard is so convenient 
with which to work. That is, once I've properly learned the PHP/HTML 
underpinnings.

And so I've gotten as far as chapter two running the book's code, before 
a problem's occurred that I can't get a handle on. It's obviously 
because I'm new to the world of UNIX and its file conventions.

A file to read and write to has been provided on the book's CD. I've 
copied this file, named oders.txt, in a folder (directory) on my hard 
drive, the path which runs like so:

   [hard drive name]/Library/WebServer/Documents/orders/orders.txt.

And the code the book uses to write to this file is:

   // open file for appending
 $fp = fopen($DOCUMENT_ROOT/../orders/orders.txt, 'a');
 flock($fp, LOCK_EX);

 if (!$fp)
 {
  echo 'pstrong Your order could not be processed at this 
time.  '
.'Please try again later./strong/p/body/html';
   exit;
 }

 fwrite($fp, $outputstring);
 flock($fp, LOCK_UN);
 fclose($fp);
 echo 'pOrder written./p';

Unfortunately, my browser--Netscape 7.02--gives the following in 
response to that code:
   
   Warning: fopen(/Library/WebServer/Documents/../orders/orders.txt) 
[function.fopen]: failed to
   create stream: No such file or directory in
   /Users/stephent/Sites/php_mysql_web_dev/chapter_02/processorder.php 
on line 63

   Warning: flock(): supplied argument is not a valid stream resource
   in /Users/[name I 
use]/Sites/php_mysql_web_dev/chapter_02/processorder.php on line 65

   Your order could not be processed at this time. Please try again later.
   
Can someone point out what I need to do here to make this work?

Thank you.

Stephen Tiano

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


Re: [PHP] setlocale Q

2003-10-23 Thread Christophe Chisogne
jsWalter wrote:
   setlocale(LC_TIME, de_GR);
gives me 'October'?
   setlocale(LC_TIME, de);
gives me 'October'?
   setlocale(LC_TIME, d);
gives me 'oktober'?
I'm on a Win 2k box.
Because locales are really system dependant, as you could
clearly see using gettext translations. (I did fight with it ;)
Win boxes (like yours) uses (M$) non standard locale names like
English_United_States, French_Belgian, German_Standard, etc
http://www.microsoft.com/globaldev/reference/win2k/setup/localsupport.mspx
For Unix boxes, better use fr_BE, fr_FR (better avoid fr).
Aliases like french can work, depending of local config.
Syntax is simply lang_code_lower_country_code_UPPER
where lang_code is the 2-letter std (iso639-2)
http://www.loc.gov/standards/iso639-2/langcodes.html
and country_code is the 2-letter std (iso3166)
http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/index.html
If lucky, you can hope some common names are used,
generally french, german, dutch. But if you use gettext
translations, the path used to fetch translations will differ
(./locale/fr_BE/LC_MESSAGES/domain.mo for Unix boxes,
 ./locale/french/LC_MESSAGES/domain.mo for Win boxes).
Seems there's no easy way other than copy the translations,
if you're code is supposed to run across platforms :(
PS Perhaps you can try the more specific php-i18n list.

Cheers,

Christophe

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


Re: [PHP] Opening Files via PHP

2003-10-23 Thread Marek Kilimajer
Stephen Tiano wrote:
And the code the book uses to write to this file is:

   // open file for appending
 $fp = fopen($DOCUMENT_ROOT/../orders/orders.txt, 'a');
This is what is in the book, you need to change the path to suit your 
setup. Or move the file, it seems moving ./orders/ directory one 
directory up should solve your problem.

Unfortunately, my browser--Netscape 7.02--gives the following in 
response to that code:
  Warning: fopen(/Library/WebServer/Documents/../orders/orders.txt) 
[function.fopen]: failed to
   create stream: No such file or directory in
   /Users/stephent/Sites/php_mysql_web_dev/chapter_02/processorder.php 
on line 63
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Simple array question

2003-10-23 Thread pete M
$array = array(
'fruit1' = 'apple',
'fruit2' = 'orange',
'fruit3' = 'grape',
'fruit4' = 'apple',
'fruit5' = 'apple');
// this cycle echoes all associative array
// key where value equals apple
while ($fruit_name = current($array)) {
if ($fruit_name == 'apple') {
echo key($array).'br';
}
next($array);
}


René fournier wrote:
Is there a simple way to return the key (name) of one element in an 
array? I looked up key() in the docs, but there are no examples or notes...

Thanks.

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


[PHP] Create Popup Window using PHP

2003-10-23 Thread irinchiang


Hi all, 
I have a Delete function here whereby when I click on Delete it will
actually have some kinda popup window to prompt user whether they are sure to
delete the following data.So, anyone have any idea how to create this popup
window using PHP??

Appreciate very much for any help given=)

Regards, 
Irin

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



[PHP] Re: Create Popup Window using PHP

2003-10-23 Thread pete M
need a little bit of Javascript

Here's a cut and paste from one of my projects

script language=JavaScript
function confirmEdit()
{
	var f = document.frmEdit;
	if(confirm('Are you sure you want to save the changes. This operation 
CANNOT BE REVERSED'))
	{
		f.submit();
	}

}
/script
and then a button instead of submit

form name=frmEdit action=save.php method=post
input type=text name=name
input type=text name=address

input type=button name=Button2 value=Save Changes class=butt 
onClick=confirmEdit()

/form

Hope it helps

Pete ;-)



[EMAIL PROTECTED] wrote:

Hi all, 
I have a Delete function here whereby when I click on Delete it will
actually have some kinda popup window to prompt user whether they are sure to
delete the following data.So, anyone have any idea how to create this popup
window using PHP??

Appreciate very much for any help given=)

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


Re: [PHP] Create Popup Window using PHP

2003-10-23 Thread Brad Bonkoski
Impossible, PHP is server side, look into javascript of some other client
side language to create pop-up windows.

- Original Message - 
From: [EMAIL PROTECTED]
To: php [EMAIL PROTECTED]
Sent: Thursday, October 23, 2003 3:00 AM
Subject: [PHP] Create Popup Window using PHP




 Hi all,
 I have a Delete function here whereby when I click on Delete
it will
 actually have some kinda popup window to prompt user whether they are
sure to
 delete the following data.So, anyone have any idea how to create this
popup
 window using PHP??

 Appreciate very much for any help given=)

 Regards,
 Irin

 -- 
 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] Newbie - Can't get sessions to work

2003-10-23 Thread Shaun Campbell
I've tried the suggested code changes and no difference :(  I just don't
think sessions are working for me at all.

I said in my original posting that the second page was creating an empty
file in my session.save_path directory as though the second page has no
reference to the first one.

In my save_path directory I have the following files:

sess_8e603c46412d9c4dd3fa6bf3d98c100f0 KB File23/10/2003 10:37
sess_f548763ea84f7d812539720142ac6efe1 KB File23/10/2003 10:37

The top one presumably created by page 2 is empty and the bottom one
contains

foo|s:5:Hello;bar|s:5:World;

I don't know how sessions work in php and whether they use cookies or not
but it seems to me that the session_start() on page 2 is creating a new
session instead of referring to the current one.

Jason how do I check for those settings? I see nothing in php.ini that
refers to transparent sessions and I believe my browser is accepting
cookies.  Could it be an Apache configuration issue?  I thought sessions
were maintained on the server somehow.

Thanks

Shaun






Jason Wong [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Wednesday 22 October 2003 22:08, Shaun Campbell wrote:
  I've got a problem getting sessions to work and I wondered if anyone
could
  offer any advice.
 
  The example I am using is to get one page to set variables in a session
and
  then use another page to retrieve them.  I am using 4.3.4RC2 and prior
to
  that 4.3..3 on Win2k with IE6 and Apache 1.3.22.

 
  The code is:

 [snip]

 Code looks OK.

 One explanation: you have not enabled transparent sessions, and your
browser
 is not accepting cookies.

 -- 
 Jason Wong - Gremlins Associates - www.gremlins.biz
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 --
 Search the list archives before you post
 http://marc.theaimsgroup.com/?l=php-general
 --
 /*
 Sturgeon's Law:
 90% of everything is crud.
 */

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



Re: [PHP] Newbie - Can't get sessions to work

2003-10-23 Thread Marek Kilimajer
If you want to check for cookie add

echo cookie = .$_COOKIE[session_name()];

to the second page.

To check if transparent sessions are enabled look into phpinfo() output 
- session.use_trans_sid

Shaun Campbell wrote:
I've tried the suggested code changes and no difference :(  I just don't
think sessions are working for me at all.
I said in my original posting that the second page was creating an empty
file in my session.save_path directory as though the second page has no
reference to the first one.
In my save_path directory I have the following files:

sess_8e603c46412d9c4dd3fa6bf3d98c100f0 KB File23/10/2003 10:37
sess_f548763ea84f7d812539720142ac6efe1 KB File23/10/2003 10:37
The top one presumably created by page 2 is empty and the bottom one
contains
foo|s:5:Hello;bar|s:5:World;

I don't know how sessions work in php and whether they use cookies or not
but it seems to me that the session_start() on page 2 is creating a new
session instead of referring to the current one.
Jason how do I check for those settings? I see nothing in php.ini that
refers to transparent sessions and I believe my browser is accepting
cookies.  Could it be an Apache configuration issue?  I thought sessions
were maintained on the server somehow.
Thanks

Shaun





Jason Wong [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
On Wednesday 22 October 2003 22:08, Shaun Campbell wrote:

I've got a problem getting sessions to work and I wondered if anyone
could

offer any advice.

The example I am using is to get one page to set variables in a session
and

then use another page to retrieve them.  I am using 4.3.4RC2 and prior
to

that 4.3..3 on Win2k with IE6 and Apache 1.3.22.

The code is:
[snip]

Code looks OK.

One explanation: you have not enabled transparent sessions, and your
browser

is not accepting cookies.

--
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Sturgeon's Law:
90% of everything is crud.
*/


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


Re: [PHP] Create Popup Window using PHP

2003-10-23 Thread Marek Kilimajer
I use something like:

a href=delete.php?id=123 onclick=return myconfirm('Do you ... 
?',this.href)

script

function myconfirm(str, href) {
if(!confirm(str)) {
return false;
} else {
document.location.href=href + confirm=1;
}
}
/script

In delete.php check for $_GET['confirm'], if set, delete, if not, 
display plain old html yes/no confirmation page, yes link will have 
confirm=1 added to the current location.

[EMAIL PROTECTED] wrote:

Hi all, 
I have a Delete function here whereby when I click on Delete it will
actually have some kinda popup window to prompt user whether they are sure to
delete the following data.So, anyone have any idea how to create this popup
window using PHP??

Appreciate very much for any help given=)

Regards, 
Irin

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


Re: [PHP] Screwing up my results...please help

2003-10-23 Thread Marek Kilimajer
Wait, I think I got you. You want company with the best offer listed 
first toghether with the company's other offers - and these offers 
should be ignored in the next comparation.
So now should be listed another company with second best offer - without 
using the offers from the first company.

Is this how you want it?

Ryan A wrote:

Hi again Marek,

I want the results like this:

  company1
  1plan1 // this is the important one as its the least/most (depending on
DESC or ASC)
  1plan2 // this is all the other plans company1 offers (which meet the sql
parameters)
  company2
  2plan1 // this again is important as its the second least/most (depending
on DESC or ASC)
  2plan2 //this is all the other plans company2 offers (which meet the sql
parameters)
  company3
  3plan1 // this again is important as its the third least/most (depending
on DESC or ASC)
  3plan2 //this is all the other plans company3 offers (which meet the sql
parameters)
  etc

I've pretty much given up on this coz I have been experimenting with
differient code and my brains gone to mush right now...
Thanks for trying.

-Ryan





Still you have shown only how you didn't want the results ordered but
how you want them.
Ryan A wrote:

Hi Marek,
Sorry about the confusion, let me explain.
With default sorting (without $TheOrder) I am getting this:

(using $sqlle = select * from $table_namee where price =$max and
spacee

=$min order by custno,price LIMIT $limitvalue1, $limit; )


company1
1plan1
1plan2
company2
2plan1
2plan2
company3
3plan1
3plan2
etc

Which is the perfect results that I am looking for. This is the code i
am

using to get that output:

if(empty($Tcompany))
{ $Tcompany = $row[4];  }
elseif($Tcompany != $row[4])
{
   //echo plan and html here
   $Tcompany = $row[4];
}
So far so good, I am getting everything exactly the way I want it.

Now  I want to give the user an ability to sort the data according to
the

way he wants itso I am using:
($sqlle = select * from $table_namee where price =$max and spacee=$min
order by $TheOrder, custno LIMIT $limitvalue1, $limit)
and the results are coming out jumbled like this:

company1
1plan1
company3
3plan1
company1
1plan2
company2
2plan1
2plan2
I do basically want to order by both (as you said)...first order by
$TheOrder and make sure it displays by company
Rob from the list said something about caching the result...but I really
couldnt understand...am looking into it though.
Any ideas or questions?

Thanks,
-Ryan






Hi again,

I cannot spot any difference from the original that you already have.

Marek

Ryan A wrote:


Hi,
Thanks for replying.
Yes, i know ordering by both at once  as if they were on the first
place

is


illogical, thats why I need a php answer to wangle  thisI want
the

desired output to be the same when the sort by was by default
price..eg:


company1
1plan1
1plan2
company2
2plan1
2plan2
company3
3plan1
3plan2
etc

What do you think?

Cheers,
-Ryan




How do you mean it? Order by both at once as if they were on the first
place? Is this logicaly possible?
You should post your desired output.

Marek

Ryan A wrote:



Hi Marek,
Thanks for replying.
If I do that I get the companies neatly but the not sorted according
to

the



$TheOrder...:-(

Yep, am checkign user inputs.

Cheers,
-Ryan







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


Re: [PHP] Newbie - Can't get sessions to work

2003-10-23 Thread Shaun Campbell
That's it. Setting use_trans_sid to 1 got sessions working.  I'm now getting
PHPSESSID=7398a182a64f0b2603e369812e130727 appended to the end of the
page2.php URL and only one session file in my temp directory.

One final question. In the php.ini file it says that

Use of trans sid may risk your users security.
; Use this option with caution.

If you don't use this option because of the security impications how else
should you get sessions working?

Thanks

Shaun

PS Marek I'd forgotten but I'd got cookies working yesterday using the code
you suggested.

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



[PHP] Is it worth $49? - codeSECURE 1.0 released - - Protecting PHP code

2003-10-23 Thread aka MacGuru
Hi,

I have read announcement about CodeSecure. I am sorry to say, but I am 
not sure this product is worth $49. The problem is not $49, which is 
very small amount indeed, but the features available with other Open 
Source software.

1) If someone need just PHP obfuscator - here is proven GPL product 
called POBS (http://pobs.mywalhalla.net/).

2) PHP encoding/decoding on the fly without extra PHP extensions is 
possible with GPL-ed software called Phrozen 
(http://sourceforge.net/projects/phrozen/).

3) PHP Scripts may be stored (and distributed to the clients) in 
compiled form with opcode cash TurckMMcache, which is also Open Source.

4) Another (very similar) product called CodeLock 
(http://www.websitecreations.co.nz/codelock/) costs $55, but requires 
option Globals On to be set, and some people reported weird problems 
with it. I do not know if CodeSecure might have (or have not) similar 
issues because of similar architecture.

PS. Anyway, I am welcome to the creative ideas.


Greetings everyone,
We have just launched a new product called codeSECURE and would like 
you to
check it out.

codeSECURE is a PHP obfuscator.

Basically codeSecure is a small collection of scripts to obfuscate or
garble up php code so that PHP developers can protect their 
intellectual
property, distribute locked php scripts, time expiring scripts etc.

While making it nearly impossible for a human to understand or read 
your
code/scripts, they will cause no problem for the computer to decipher 
and
run.

E.g.

$a=Hello world;

will become something like

$23sfaAST3s=v4Mwuz24fz{(2{w;

*
*   Best Regards   ---   Andrei Verovski
*
*   Personal Home Page
*   http://snow.prohosting.com/guru4mac
*   Mac, Linux, DTP, Development, IT WEB Site
*
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP scripts are not executed

2003-10-23 Thread Bas
You can now try it again, on http://212.120.120.108:3/forumBT/index.php.
I have installed as module now...

Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 favicon.ico is not the problem. The problem is The specified network
 name is no longer available. Check out this resource, if that does not
 help, google for the error string.

 http://www.experts-exchange.com/Web/Web_Servers/Apache/Q_20671124.html

 Bas wrote:

  I have checked the error log and the only real error i can see is that
  C:\pub\favicon.ino does not exist... I have added this and now i need
that
  you test again... Thanks, Bas
  Marek Kilimajer [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
 
 Sometimes the pages load, sometimes they don't. Seems like apache is
 crashing, check apache error logs, php installation, installed
modules...
 
 Bas wrote:
 
 
 And, e-mail me the results(on [EMAIL PROTECTED])
 Of the website... Likethe error and so
 Bas [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 
 
 On web, i mean from my pc and on pc i use both
 Marek Kilimajer [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 
 
 Hm, I still don't get you.
 
 On your pc - do you mean you view the pages from your pc or that the
 pages are served from your pc (or both)?
 
 From the web - do you mean you view the pages from the web or that
the
 pages are served from another server on the web?
 
 Bas wrote:
 
 
 
 Internally is on my pc and externally is from the web.
 Marek Kilimajer [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 
 
 
 Hi, first you should explain the meanings of internaly and
 
 externaly
 
 
 in this case.
 
 Bas wrote:
 
 
 
 
 I am running Windows XP, Apache/2.0.44 and php 4.3.3.
 
 I seem that internally all my PHP scripts work. But, externally,
 
 phpBB
 
 
 2.0.6
 
 
 
 does not work...
 
 Sorry for the double message...
 
 And my e-mail has changed... don't spam!!!
 
 
 
 

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



[PHP] Problem with SELECT statement and reference material wanted..

2003-10-23 Thread P M
Hi all!

I'm having trouble retrieving a selection of my database contents. The problem is when 
I search for entries that exactly match a search criteria, see below:

(database connection established successfully here..)

  $result = mysql_query(select * from complete where authorf = '$authorf');

  if ( $r = mysql_fetch_array($result) )
  {
   echo Found entries:ul;
   echo table border=1;

   do
   {
print trtd;
print $r[authorf];
print /tdtd;
print $r[authorl];
print /tdtd;
print $r[title];
print /td/tr;
   } while ($r = mysql_fetch_array($result));

   echo /table;
   mysql_free_result($result);
  }

Now, I know for sure that there's nothing wrong with the code within the do-loop, 
because if I change the SQL query to the following:

$result = mysql_query(select * from complete);

..I will get all entries from the database, nicely output to the page.

(QUESTION 1)
So what is wrong here? I've tried playing with the single quotation marks (') as well 
as using the LIKE parameter with the SELECT statement, but nothing turns out to work. 
See below for an example of the latter..

$result = mysql_query(select * from complete where authorf like '$authorf%');

This returns all table entries, just as the previous example. Perhaps there is 
something about the '%' sign but I have no good reference available.. :-/

I also had an idea about the HTML form item names (such as text boxes) being required 
to be named as the column names in the MySQL table, but that failed miserably also 
(this is what I used in the examples below - substituting form item names doesn't 
change anything..)

Now I'm sure that the error is a simple one, which tends to be make me even more 
frustrated (I¨m practically bald now from tearing my tufts of hair all night long :-) 
). Thanks for any input here!

(QUESTION 2)
Also, another question relevant to PHP/SQL RDBMS's interfacing: Does anyoone know 
where I can find thorough documents on PHP commands for this purpose? Some texts which 
tangents database modelling and optimization would be optimal, since I'm interested in 
those areas also!
Due to my current location in the Balkans with a crappy modem connection and a bad 
selection of book stores I'd prefer online texts, but any tips are welcome! Thanks in 
advance!

Video Populares et Optimates




Re: [PHP] Problem with SELECT statement and reference material wanted..

2003-10-23 Thread Binay
remove ' '(single quotes) around variable name..

cheers
binay
- Original Message -
From: P M [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, October 23, 2003 5:27 PM
Subject: [PHP] Problem with SELECT statement and reference material wanted..


Hi all!

I'm having trouble retrieving a selection of my database contents. The
problem is when I search for entries that exactly match a search criteria,
see below:

(database connection established successfully here..)

  $result = mysql_query(select * from complete where authorf =
'$authorf');

  if ( $r = mysql_fetch_array($result) )
  {
   echo Found entries:ul;
   echo table border=1;

   do
   {
print trtd;
print $r[authorf];
print /tdtd;
print $r[authorl];
print /tdtd;
print $r[title];
print /td/tr;
   } while ($r = mysql_fetch_array($result));

   echo /table;
   mysql_free_result($result);
  }

Now, I know for sure that there's nothing wrong with the code within the
do-loop, because if I change the SQL query to the following:

$result = mysql_query(select * from complete);

..I will get all entries from the database, nicely output to the page.

(QUESTION 1)
So what is wrong here? I've tried playing with the single quotation marks
(') as well as using the LIKE parameter with the SELECT statement, but
nothing turns out to work. See below for an example of the latter..

$result = mysql_query(select * from complete where authorf like
'$authorf%');

This returns all table entries, just as the previous example. Perhaps there
is something about the '%' sign but I have no good reference available.. :-/

I also had an idea about the HTML form item names (such as text boxes) being
required to be named as the column names in the MySQL table, but that failed
miserably also (this is what I used in the examples below - substituting
form item names doesn't change anything..)

Now I'm sure that the error is a simple one, which tends to be make me even
more frustrated (I¨m practically bald now from tearing my tufts of hair all
night long :-) ). Thanks for any input here!

(QUESTION 2)
Also, another question relevant to PHP/SQL RDBMS's interfacing: Does anyoone
know where I can find thorough documents on PHP commands for this purpose?
Some texts which tangents database modelling and optimization would be
optimal, since I'm interested in those areas also!
Due to my current location in the Balkans with a crappy modem connection and
a bad selection of book stores I'd prefer online texts, but any tips are
welcome! Thanks in advance!

Video Populares et Optimates

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



Re: [PHP] Problem with SELECT statement and reference material wanted..

2003-10-23 Thread Marek Kilimajer
$authorf is empty, I guess register_globals is off, you should use
select * from complete where authorf = '$_POST[authorf]'
or
select * from complete where authorf = '$_GET[authorf]'
depending if you use get or post variable.
P M wrote:

Hi all!

I'm having trouble retrieving a selection of my database contents. The problem is when I search for entries that exactly match a search criteria, see below:

(database connection established successfully here..)

  $result = mysql_query(select * from complete where authorf = '$authorf');

  if ( $r = mysql_fetch_array($result) )
  {
   echo Found entries:ul;
   echo table border=1;
   do
   {
print trtd;
print $r[authorf];
print /tdtd;
print $r[authorl];
print /tdtd;
print $r[title];
print /td/tr;
   } while ($r = mysql_fetch_array($result));
   echo /table;
   mysql_free_result($result);
  }
Now, I know for sure that there's nothing wrong with the code within the do-loop, because if I change the SQL query to the following:

$result = mysql_query(select * from complete);

..I will get all entries from the database, nicely output to the page.

(QUESTION 1)
So what is wrong here? I've tried playing with the single quotation marks (') as well 
as using the LIKE parameter with the SELECT statement, but nothing turns out to work. 
See below for an example of the latter..
$result = mysql_query(select * from complete where authorf like '$authorf%');

This returns all table entries, just as the previous example. Perhaps there is something about the '%' sign but I have no good reference available.. :-/

I also had an idea about the HTML form item names (such as text boxes) being required to be named as the column names in the MySQL table, but that failed miserably also (this is what I used in the examples below - substituting form item names doesn't change anything..)

Now I'm sure that the error is a simple one, which tends to be make me even more frustrated (I¨m practically bald now from tearing my tufts of hair all night long :-) ). Thanks for any input here!

(QUESTION 2)
Also, another question relevant to PHP/SQL RDBMS's interfacing: Does anyoone know 
where I can find thorough documents on PHP commands for this purpose? Some texts which 
tangents database modelling and optimization would be optimal, since I'm interested in 
those areas also!
Due to my current location in the Balkans with a crappy modem connection and a bad 
selection of book stores I'd prefer online texts, but any tips are welcome! Thanks in 
advance!
Video Populares et Optimates



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


Re: [PHP] Problem with SELECT statement and reference material wanted..

2003-10-23 Thread Binay
Sorry for my previous post ..
no need of removing ' '(single quotes)

echo you query and then run it on mysql and see u getting the desired
result..

Binay
- Original Message -
From: P M [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, October 23, 2003 5:27 PM
Subject: [PHP] Problem with SELECT statement and reference material wanted..


Hi all!

I'm having trouble retrieving a selection of my database contents. The
problem is when I search for entries that exactly match a search criteria,
see below:

(database connection established successfully here..)

  $result = mysql_query(select * from complete where authorf =
'$authorf');

  if ( $r = mysql_fetch_array($result) )
  {
   echo Found entries:ul;
   echo table border=1;

   do
   {
print trtd;
print $r[authorf];
print /tdtd;
print $r[authorl];
print /tdtd;
print $r[title];
print /td/tr;
   } while ($r = mysql_fetch_array($result));

   echo /table;
   mysql_free_result($result);
  }

Now, I know for sure that there's nothing wrong with the code within the
do-loop, because if I change the SQL query to the following:

$result = mysql_query(select * from complete);

..I will get all entries from the database, nicely output to the page.

(QUESTION 1)
So what is wrong here? I've tried playing with the single quotation marks
(') as well as using the LIKE parameter with the SELECT statement, but
nothing turns out to work. See below for an example of the latter..

$result = mysql_query(select * from complete where authorf like
'$authorf%');

This returns all table entries, just as the previous example. Perhaps there
is something about the '%' sign but I have no good reference available.. :-/

I also had an idea about the HTML form item names (such as text boxes) being
required to be named as the column names in the MySQL table, but that failed
miserably also (this is what I used in the examples below - substituting
form item names doesn't change anything..)

Now I'm sure that the error is a simple one, which tends to be make me even
more frustrated (I¨m practically bald now from tearing my tufts of hair all
night long :-) ). Thanks for any input here!

(QUESTION 2)
Also, another question relevant to PHP/SQL RDBMS's interfacing: Does anyoone
know where I can find thorough documents on PHP commands for this purpose?
Some texts which tangents database modelling and optimization would be
optimal, since I'm interested in those areas also!
Due to my current location in the Balkans with a crappy modem connection and
a bad selection of book stores I'd prefer online texts, but any tips are
welcome! Thanks in advance!

Video Populares et Optimates

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



Re: [PHP] Problem with SELECT statement and reference material wanted..

2003-10-23 Thread Eugene Lee
On Thu, Oct 23, 2003 at 01:57:38PM +0200, P M wrote:
: 
: I'm having trouble retrieving a selection of my database contents. The
: problem is when I search for entries that exactly match a search
: criteria, see below:
: 
: (database connection established successfully here..)
: 
:   $result = mysql_query(select * from complete where authorf = '$authorf');

Try changing this to:

$result = mysql_query(select * from complete where authorf = '
. mysql_escape_string($authorf) . ');

: (QUESTION 2)
: Also, another question relevant to PHP/SQL RDBMS's interfacing: Does
: anyoone know where I can find thorough documents on PHP commands for
: this purpose? Some texts which tangents database modelling and
: optimization would be optimal, since I'm interested in those areas
: also!

If you're using MySQL, be sure to be familiar with PHP's MySQL functions.
And the User Contributed Notes is also a valuable source of information.

http://www.php.net/manual/en/ref.mysql.php

As for database optimizations, that more of a MySQL thing.  So you should
familiar yourself with MySQL's optimization documentation:

http://www.mysql.com/doc/en/MySQL_Optimisation.html

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



Re: [PHP] fsock sending bad request

2003-10-23 Thread daniel
$req = field=1;

its the data i need to post
 Hi,

 Thursday, October 23, 2003, 7:58:19 AM, you wrote:
 deo Hi there the following code doesnt seem to work, i am getting a
 bad request deo sent back from the server, what could be the problem
 of something so deo simple ?

 deo $header .= POST test.php HTTP/1.0\r\n;
 deo $header.= Host: host\r\n;
 deo $header .= Content-Type: application/x-www-form-urlencoded\r\n;
 deo $header .= 'Content-Length: ' . strlen($req) . \n\n;
 deo $header .= Connection: close\n\n;
 deo $header.= $req\n;
 deo $header.= \r\n;




 deo $fp = fsockopen(host, 80, $errno, $errstr, $timeout = 30);
 deo if (!$fp) {
 deo   // ERROR
 deo   echo $errstr ($errno);
 deo } else {

 deo //put the data..
 deo   fputs ($fp, $header . $req);
 deo   while (!feof($fp)) {
 deo //read the data returned...
 deo $res = fgets ($fp, 1024);
 deo  echo $res;
 deo  }
 deo   fclose ($fp);
 deo }


 you probably don't need this in the header

 $header.= $req\n;

 but I have no idea what $req contains

 --
 regards,
 Tom

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



Re: note: [PHP] ob_get_length() returns uncompressed buffer length (after ob_start('ob_gzhandler'))

2003-10-23 Thread Marek Kilimajer
One option I can think of would be to handle the compression in your code:

?php
ob_start();
print aa; // 30 a's
print bb; // 30 b's
print aa; // 30 a's
$output=gzcompress(ob_get_contents());
$ob_get_length=length($output);
header('Content-Length: '.$ob_get_length);
ob_end_clean();
?
daniel hahler wrote:

Hallo PHP-general list,

on Wed, 22 Oct 2003 23:07:06 +0200 I already wrote:

dh Hallo daniel,

don't want to talk only to myself.. this is for everyone.. :)


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


[PHP] Page Reload with after POST request

2003-10-23 Thread Alexander Mueller

I am doing most of my data transfers by POST requests and found it to be
problematic when I want to browse the history with the browser's
navigation buttons. Although it works without problems in Opera (I didnt
try it with Netscape) it leads to a Warning: Page has Expired message
in IE. I understand IE's reason to show the message but noticed browsing
the history (under usage of the same POST transfer mechanism) works with
other PHP scripts (eg: vBulletin) in IE without this message. Any idea
which trick they use to avoid that?

Thanks,
Alexander

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



Re: note: [PHP] ob_get_length() returns uncompressed buffer length (after ob_start('ob_gzhandler'))

2003-10-23 Thread Marek Kilimajer
I forgot the obvious: echo $output; after header(...)

Marek Kilimajer wrote:

One option I can think of would be to handle the compression in your code:

?php
ob_start();
print aa; // 30 a's
print bb; // 30 b's
print aa; // 30 a's
$output=gzcompress(ob_get_contents());
$ob_get_length=length($output);
header('Content-Length: '.$ob_get_length);
ob_end_clean();
?
daniel hahler wrote:

Hallo PHP-general list,

on Wed, 22 Oct 2003 23:07:06 +0200 I already wrote:

dh Hallo daniel,

don't want to talk only to myself.. this is for everyone.. :)



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


Re: [PHP] Page Reload with after POST request

2003-10-23 Thread Marek Kilimajer
After handling the post request and taking the necessery actions (update 
db...), redirect the browser using header('Location: ..');

Alexander Mueller wrote:

I am doing most of my data transfers by POST requests and found it to be
problematic when I want to browse the history with the browser's
navigation buttons. Although it works without problems in Opera (I didnt
try it with Netscape) it leads to a Warning: Page has Expired message
in IE. I understand IE's reason to show the message but noticed browsing
the history (under usage of the same POST transfer mechanism) works with
other PHP scripts (eg: vBulletin) in IE without this message. Any idea
which trick they use to avoid that?
Thanks,
Alexander
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Email Body

2003-10-23 Thread Marek Kilimajer
I use str_pad() for this, it can handle strings that vary in length much 
better then tabs:

tab way:
echo long long name\t1000\t200.00\n;
echo name\t10\t2.00\n;
output:
long long name  1000200.00
name10  2.00
str_pad way:
echo str_pad('long long name', 20,' ').
 str_pad('1000', 10,' ',STR_PAD_LEFT).
 str_pad('200.00', 10,' ',STR_PAD_LEFT).
 \n;
echo str_pad('name', 20,' ').
 str_pad('10', 10,' ',STR_PAD_LEFT).
 str_pad('2.00', 10,' ',STR_PAD_LEFT).
 \n;
output:
long long name1000200.00
name10  2.00
Marek

micro brew wrote:

I am sending an email using mail() and it works fine. 
But the formatting of the body of the email is wrong. 
I want to format part of it in columns sort of like
this:
Name   Quantity  Price

Can this be done neatly without using an html email?

Also what is the trick to making line returns display
properly in the email client?  I've tried using \r\n
with no luck.  I also tried \n.  The characters show
in the email but no line breaks.  Any suggestions?
TIA,

Mike

__
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Attachments with Mail()

2003-10-23 Thread Don Mc Nair
Hi

Can anyone tell me how to add a file as an attachment to an email sent with
something like the following ?

 $headers = From: .$fromaddress.\r\n;
 $headers .= Reply-To: $fromaddress\r\n;
   mail($toaddress, $subject, $mailcontent, $headers);

Thanks
Don


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.529 / Virus Database: 324 - Release Date: 16/10/2003

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



Re: [PHP] is_uploaded_file() security

2003-10-23 Thread Raditha Dissanayake

I don't think so. Test this, but I think you can just type /etc/passwd into
the file name box (instead of using the browse button) and have that value
submitted in the form. May be dependent upon the browser on how it's
handled, though.
 

This does not work with multipart/form-data you need www-urlencoded (or 
just don't set an enctype attribute in your form)

Either way, I can still construct a POST to your site using cURL or
something to simulate sending you a file with a name of a file on your
server.
So, validate that the file is actually an uploaded file and not a path to
something else. That's why the functions exist.
---John Holmes...

 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB  |  with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] fsock sending bad request

2003-10-23 Thread Raditha Dissanayake
hi,

deo $header.= $req\n;

Tom is right but as usual IIS is wrong and expects it :-( so better to 
use it anyway.

deo $fp = fsockopen(host, 80, $errno, $errstr, $timeout = 30);

errno and errstr will not be set unless you pass it by reference.

deo $header.= Host: host\r\n;
Host header is usually used only with HTTP/1.1
all the best



[EMAIL PROTECTED] wrote:

$req = field=1;

its the data i need to post
 

Hi,

Thursday, October 23, 2003, 7:58:19 AM, you wrote:
deo Hi there the following code doesnt seem to work, i am getting a
bad request deo sent back from the server, what could be the problem
of something so deo simple ?
deo $header .= POST test.php HTTP/1.0\r\n;
deo $header.= Host: host\r\n;
deo $header .= Content-Type: application/x-www-form-urlencoded\r\n;
deo $header .= 'Content-Length: ' . strlen($req) . \n\n;
deo $header .= Connection: close\n\n;
deo $header.= \r\n;





deo if (!$fp) {
deo   // ERROR
deo   echo $errstr ($errno);
deo } else {
deo //put the data..
deo   fputs ($fp, $header . $req);
deo   while (!feof($fp)) {
deo //read the data returned...
deo $res = fgets ($fp, 1024);
deo echo $res;
deo  }
deo   fclose ($fp);
deo }
you probably don't need this in the header

$header.= $req\n;

but I have no idea what $req contains

--
regards,
Tom
   

 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB  |  with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] is_uploaded_file() security

2003-10-23 Thread Alexander Mueller
Raditha Dissanayake wrote:
 
 This does not work with multipart/form-data you need www-urlencoded (or
 just don't set an enctype attribute in your form)

What would happen in this case? The given filename would be passed to
the script?!

Alexander
-- 
PINO - The free Chatsystem!
Available at http://www.pino.org

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



[PHP] Re: Page Reload with after POST request

2003-10-23 Thread Alexander Mueller
Robert Sedlacek wrote:
 
 I don't know such a script, but my preferred way would be to make a
 'header(Location: $site);' statement right after processing the
 POST-request and lead the user to the site where the changes can be seen.
 
 This also avoids duplicate db-entries and stuff...
 
 Robert


Marek Kilimajer wrote:
 
 After handling the post request and taking the necessery actions (update
 db...), redirect the browser using header('Location: ..');
 


I suppose the browser does not add the redirecting site to its history.
In this case a redirect is really a good idea :). Thanks for this hint
Robert and Marek.

Alexander

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



Re: [PHP] is_uploaded_file() security

2003-10-23 Thread Raditha Dissanayake
Hi,
Multipart/form-data sends the entire file, if you don't use that enctype 
yes, just the file name is sent.

best regards

Alexander Mueller wrote:

Raditha Dissanayake wrote:
 

This does not work with multipart/form-data you need www-urlencoded (or
just don't set an enctype attribute in your form)
   

What would happen in this case? The given filename would be passed to
the script?!
Alexander
 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB  |  with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] is_uploaded_file() security

2003-10-23 Thread Marek Kilimajer
I tried:
form action=phpinfo.php?_FILES[fake][tmp_name]=/etc/passwd 
method=post enctype=multipart/form-data
Fake: input type=text name=_FILES[fake][tmp_name] 
value=/etc/passwdbr
input type=file name=suborbr
input type=submit
/form

$_FILES superglobal still wasn't poisoned.

Alexander Mueller wrote:

Raditha Dissanayake wrote:

This does not work with multipart/form-data you need www-urlencoded (or
just don't set an enctype attribute in your form)


What would happen in this case? The given filename would be passed to
the script?!
Alexander
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Newbie - Can't get sessions to work

2003-10-23 Thread Curt Zirzow
* Thus wrote Shaun Campbell ([EMAIL PROTECTED]):
 That's it. Setting use_trans_sid to 1 got sessions working.  I'm now getting
 PHPSESSID=7398a182a64f0b2603e369812e130727 appended to the end of the
 page2.php URL and only one session file in my temp directory.
 
 One final question. In the php.ini file it says that
 
 Use of trans sid may risk your users security.
 ; Use this option with caution.
 
 If you don't use this option because of the security impications how else
 should you get sessions working?
 

You turn on the use_cookie option in the php.ini file. And ensure
your web browser is accepting cookies.


Curt
-- 
My PHP key is worn out

  PHP List stats since 1997: 
  http://zirzow.dyndns.org/html/mlists/

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



Re: [PHP] is_uploaded_file() security

2003-10-23 Thread Alexander Mueller
Raditha Dissanayake wrote:
 
 Hi,
 Multipart/form-data sends the entire file, if you don't use that enctype
 yes, just the file name is sent.
 
 best regards

I see, but then $_FILES is probably not set. So it wouldnt be necessary
to use is_uploaded_file() if one solely uses $_FILES (but should
probably nevertheless for any possible bugs - as Marek mentioned). Did I
miss anything?

Alexander
-- 
PINO - The free Chatsystem!
Available at http://www.pino.org

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



Re: [PHP] Attachments with Mail()

2003-10-23 Thread Evan Nemerson
PEAR has a class which may be helpful.

http://pear.php.net/package/Mail_Mime




On Thursday 23 October 2003 04:13 am, Don Mc Nair wrote:
 Hi

 Can anyone tell me how to add a file as an attachment to an email sent with
 something like the following ?

  $headers = From: .$fromaddress.\r\n;
  $headers .= Reply-To: $fromaddress\r\n;
mail($toaddress, $subject, $mailcontent, $headers);

 Thanks
 Don


 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.529 / Virus Database: 324 - Release Date: 16/10/2003

-- 
Evan Nemerson
[EMAIL PROTECTED]

--
A leader is the wave pushed ahead by the ship.

-Leo Nikolaevich Tolstoy

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



[PHP] Array Hell

2003-10-23 Thread Richard Cook
Hi All,
Im having a headache trying to sort this out...

I have my array which is created each time a user adds an item to my basket,
this all works fine. The problem im having is that when the user adds the
item to the cart they have the option of selecting '0' as the quantity which
in effect removes it from the basket.

for example at position 0 on the array below the customer has product
22, the customer has ordered 6.

$array[0][0] = 22
$array[0][1] = 6

If the customer inputs the value 0 into quantity the array looks like this:

$array[0][0] = 22
$array[0][1] = 0


The question is who can i filter the array removing any values that have 0
in [x][1], i would also need to re-order the array from 0 to 'n'.



Hope that all makes sence


And before you ask i have looked everywhere at the manual (i got even more
lost)




Regards


R

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



Re: [PHP] Opening Files via PHP

2003-10-23 Thread Curt Zirzow
* Thus wrote Stephen Tiano ([EMAIL PROTECTED]):
 
 A file to read and write to has been provided on the book's CD. I've 
 copied this file, named oders.txt, in a folder (directory) on my hard 
 drive, the path which runs like so:
 
[hard drive name]/Library/WebServer/Documents/orders/orders.txt.
 
 And the code the book uses to write to this file is:
 
// open file for appending
  $fp = fopen($DOCUMENT_ROOT/../orders/orders.txt, 'a');

echo $DOCUMENT_ROOT;

You'll see exactly where php is looking for to open the file.  You
can either adjust the location where you copied the file or modify
the code to adjust for where you put it.  I would suggest the
former in case other examples use the same structure, you wont have
to deal with this when trying to learn the examples.

 
  flock($fp, LOCK_EX);

I'm not sure why the book doesn't try to lock the file after the
check for valid file handle. This is what causes the second error.

 Unfortunately, my browser--Netscape 7.02--gives the following in 
 response to that code:

Warning: fopen(/Library/WebServer/Documents/../orders/orders.txt) 
 [function.fopen]: failed to
create stream: No such file or directory in
/Users/stephent/Sites/php_mysql_web_dev/chapter_02/processorder.php 
 on line 63
 
Warning: flock(): supplied argument is not a valid stream resource
in /Users/[name I 
 use]/Sites/php_mysql_web_dev/chapter_02/processorder.php on line 65
 

Curt
-- 
My PHP key is worn out

  PHP List stats since 1997: 
  http://zirzow.dyndns.org/html/mlists/

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



[PHP] array of java-objects

2003-10-23 Thread Helke Schröder
Hi,

I'm trying to use our java-code in php.
But strange things happens
Maybe I did a simple mistake..

$MyInf=new Java(myUtil.myInfo);

This is inside of a loop through 3 items:

$MyAttributes=array();
$MyAttributes=$MyInf-MyAttrReader($v, ,, $item);
$c=null;
$c=count($MyAttributes);

so far ok, $c shows the correct number
but when doing this :

reset($MyAttributes);
$sa=$MyAttributes[0];  /* I can use 0 because there are always more than one
elements inside*/
var_dump($sa);

it comes up with a java-object only for the first entry

object(java)(1) { [0]= int(4) }
int(20)
int(36)

And then of course it's impossible to call methods on the objects because
they are no objects

Fatal error: Call to a member function on a non-object

Every hint woul'd be appreciated
thanks, Helke

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



Re: [PHP] is_uploaded_file() security

2003-10-23 Thread Raditha Dissanayake
hi,

I think marek's recent message has answered this already, but i also 
believe  that even in the older system where
you have form fields like input type=file name=userfile result in 
global variables like userfile_name etc the global variables don't get 
populated unless you send the correct enctype.

best regards

Alexander Mueller wrote:

Raditha Dissanayake wrote:
 

Hi,
Multipart/form-data sends the entire file, if you don't use that enctype
yes, just the file name is sent.
best regards
   

I see, but then $_FILES is probably not set. So it wouldnt be necessary
to use is_uploaded_file() if one solely uses $_FILES (but should
probably nevertheless for any possible bugs - as Marek mentioned). Did I
miss anything?
Alexander
 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB  |  with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: link question

2003-10-23 Thread Richard Cook


nextpage.php?recordset=?php echo $recordset[id];?

then use the value of recordset to link back to that information on the next
page.

Is that what you mean?


Regards

R


Davy Campano [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I have a php page that makes a table from data in a mySQL database.
What I want to do is make the first entry in the table be a Unique key
that is a link, that when you click on this key it opens another page
with some more information.  Basically I am trying to figure out how to
pass this key from this page to the next.  Thanks for any help!

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



[PHP] problem with intval and !=

2003-10-23 Thread Cesar Cordovez
Can somebody explain me why is this happening?

$value = 12.3;
$number = intval($value);
echo Number: $number, Value: $valuebr;
// echoes: Number: 12, Value: 12.3
if ($number != $value) {
echo Bad;
} else {
echo Good;  // echoes Good!!
}
The previous should be echoing Bad.  (I think!)

Cesar

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


Re: [PHP] Array Hell

2003-10-23 Thread Curt Zirzow
* Thus wrote Richard Cook ([EMAIL PROTECTED]):
 Hi All,
 Im having a headache trying to sort this out...
 
 If the customer inputs the value 0 into quantity the array looks like this:
 
 $array[0][0] = 22
 $array[0][1] = 0
 
 
 The question is who can i filter the array removing any values that have 0
 in [x][1], i would also need to re-order the array from 0 to 'n'.

foreach ($array as $i =$item) {
  if ( $item[1]) {
$new_array[] = $item;
  }
}
$array = $new_array;

There might be an elegant way with one of the functions in
  http://php.net/array


Curt
-- 
My PHP key is worn out

  PHP List stats since 1997: 
  http://zirzow.dyndns.org/html/mlists/

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



Re[2]: [PHP] fsock sending bad request

2003-10-23 Thread Tom Rogers
Hi,

Thursday, October 23, 2003, 10:32:18 PM, you wrote:
deo $req = field=1;

deo its the data i need to post

But you are sending it twice, and there has to be a cr/lf between the header and
the data I think.

-- 
regards,
Tom


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



Re: [PHP] problem with intval and !=

2003-10-23 Thread Curt Zirzow
* Thus wrote Cesar Cordovez ([EMAIL PROTECTED]):
 Can somebody explain me why is this happening?
 
 $value = 12.3;
 $number = intval($value);
 
 echo Number: $number, Value: $valuebr;
 // echoes: Number: 12, Value: 12.3

I'm guessing you wondering why the .3 is removed.  Thats because
12.3 isn't an integer but a float.

$number = floatval($value);

 
 if ($number != $value) {
   echo Bad;
 } else {
   echo Good;  // echoes Good!!
 }
 
 
 The previous should be echoing Bad.  (I think!)

correct. If you use the floatval() it will echo Good.

Curt
-- 
My PHP key is worn out

  PHP List stats since 1997: 
  http://zirzow.dyndns.org/html/mlists/

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



Re: [PHP] problem with intval and !=

2003-10-23 Thread Marek Kilimajer
What versio of php? I get Bad (which is good ;)

Cesar Cordovez wrote:

Can somebody explain me why is this happening?

$value = 12.3;
$number = intval($value);
echo Number: $number, Value: $valuebr;
// echoes: Number: 12, Value: 12.3
if ($number != $value) {
echo Bad;
} else {
echo Good;  // echoes Good!!
}
The previous should be echoing Bad.  (I think!)

Cesar

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


Re: [PHP] array of java-objects

2003-10-23 Thread Raditha Dissanayake
Hi,
please post your full code
Helke Schröder wrote:

Hi,

I'm trying to use our java-code in php.
But strange things happens
Maybe I did a simple mistake..
$MyInf=new Java(myUtil.myInfo);

This is inside of a loop through 3 items:

$MyAttributes=array();
$MyAttributes=$MyInf-MyAttrReader($v, ,, $item);
$c=null;
$c=count($MyAttributes);
so far ok, $c shows the correct number
but when doing this :
reset($MyAttributes);
$sa=$MyAttributes[0];  /* I can use 0 because there are always more than one
elements inside*/
var_dump($sa);
it comes up with a java-object only for the first entry

object(java)(1) { [0]= int(4) }
int(20)
int(36)
And then of course it's impossible to call methods on the objects because
they are no objects
Fatal error: Call to a member function on a non-object

Every hint woul'd be appreciated
thanks, Helke
 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB  |  with progress bar.


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


[PHP] in_array()/finding page Problem

2003-10-23 Thread Ben G. McCullough
I think I have a flaw of logic in trying to find the correct page in 
a mutli-page sql result.

Goal - find the correct page [results.php?page=x] when linking from 
another page.

Current method - loop through a pagination function looking for the 
matching $id in an array [simplified for illustration]:

[find $maxpages]
$page =1;
$catch=array();
while($page = $maxpages) {
[set start #]
$result = [get sql results - limit  $startnumber, 12]
while($record = mysql_fetch_array($result)) {
extract($record);
$catch[] = $found_id;
}
if(in_array($real_id, $catch, TRUE)) {
$here = $page;
}
$page++;
}
echo results.php?page=$here;

I never seem to get a true return on in_array(), and in testing, I 
don't seem to be getting a full result set with my look up.

I feel that I am missing something in the logic - or I am approaching 
this from the wrong direction.

I originally wanted to do the while test as if in_array is FALSE, 
continue loop but I couldn't get that to work at all.

Thank you for any help you can give this newbie.

--

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


Re: [PHP] fsock sending bad request

2003-10-23 Thread Curt Zirzow
* Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]):
 Hi there the following code doesnt seem to work, i am getting a bad request
 sent back from the server, what could be the problem of something so
 simple ?
 
 $header .= POST test.php HTTP/1.0\r\n;
 $header.= Host: host\r\n;
 $header .= Content-Type: application/x-www-form-urlencoded\r\n;
 $header .= 'Content-Length: ' . strlen($req) . \n\n;
 $header .= Connection: close\n\n;
 $header.= $req\n;
 $header.= \r\n;

The last two lines should be:

  $header.= \r\n;
  $header.= $req; #Note, no \n

Make sure all your headers have \r\n endings.  Technically the $req
is not part of the headers but the actual content to be sent.


Curt
-- 
My PHP key is worn out

  PHP List stats since 1997: 
  http://zirzow.dyndns.org/html/mlists/

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



Re: [PHP] in_array()/finding page Problem

2003-10-23 Thread Marek Kilimajer
You solution is quite resource expensive. I would do:
[find $maxpages]
SELECT COUNT(*)/12 FROM table WHERE id = $real_id;
list($maxpages) = fetch_row()
In result.php use ORDER BY id

Ben G. McCullough wrote:

I think I have a flaw of logic in trying to find the correct page in a 
mutli-page sql result.

Goal - find the correct page [results.php?page=x] when linking from 
another page.

Current method - loop through a pagination function looking for the 
matching $id in an array [simplified for illustration]:

[find $maxpages]
$page =1;
$catch=array();
while($page = $maxpages) {
[set start #]
$result = [get sql results - limit  $startnumber, 12]
while($record = mysql_fetch_array($result)) {
extract($record);
$catch[] = $found_id;
}
if(in_array($real_id, $catch, TRUE)) {
$here = $page;
}
$page++;
}
echo results.php?page=$here;

I never seem to get a true return on in_array(), and in testing, I 
don't seem to be getting a full result set with my look up.

I feel that I am missing something in the logic - or I am approaching 
this from the wrong direction.

I originally wanted to do the while test as if in_array is FALSE, 
continue loop but I couldn't get that to work at all.

Thank you for any help you can give this newbie.

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


Re: [PHP] problem with intval and !=

2003-10-23 Thread Cesar Cordovez
Curt:

My fault!  You are right, but thats not what I want. $value comes from a 
form filled by a user.  I want $value to be an integer.  Not a float. 
So if the user types 12.3 the system has to send an error msg.

Therefore the procedure.

By-the-way, Im using PHP 4.3.3 (on windows XP profesional.  Don't say a 
thing!!! I rather work on my mac!)  =)

Cesar

Curt Zirzow wrote:

* Thus wrote Cesar Cordovez ([EMAIL PROTECTED]):

Can somebody explain me why is this happening?

$value = 12.3;
$number = intval($value);
echo Number: $number, Value: $valuebr;
// echoes: Number: 12, Value: 12.3


I'm guessing you wondering why the .3 is removed.  Thats because
12.3 isn't an integer but a float.
$number = floatval($value);


if ($number != $value) {
echo Bad;
} else {
echo Good;  // echoes Good!!
}
The previous should be echoing Bad.  (I think!)


correct. If you use the floatval() it will echo Good.

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


Re: [PHP] problem with intval and !=

2003-10-23 Thread Curt Zirzow
* Thus wrote Cesar Cordovez ([EMAIL PROTECTED]):
 Curt:
 
 My fault!  You are right, but thats not what I want. $value comes from a 
 form filled by a user.  I want $value to be an integer.  Not a float. 
 So if the user types 12.3 the system has to send an error msg.

Yeah, after reading merek's response I realized I missed what
exactly your problem is.

 
 Therefore the procedure.
 
 By-the-way, Im using PHP 4.3.3 (on windows XP profesional.  Don't say a 
 thing!!! I rather work on my mac!)  =)

Thats odd, I come up with a 'Bad' echo also.  The only thing I can
think of is there is some sort of implicit casting happening to the
$value within the comparison.  But it does seem very strange that
XP would cast but *nix doesn't

In that case test the condition reversed:
  if ($value != $number)


I'm at a loss as to why it doesn't work on your system.


Curt
-- 
My PHP key is worn out

  PHP List stats since 1997: 
  http://zirzow.dyndns.org/html/mlists/

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



Re: [PHP] there has to be a better way...

2003-10-23 Thread Raquel Rice
On Thu, 23 Oct 2003 01:04:55 -0500
Walter Torres [EMAIL PROTECTED] wrote:

  -Original Message-
  From: Colin Kettenacker [mailto:[EMAIL PROTECTED]
 
  Hi Walter,
 
  You may want to look into PEAR's config package. It does pretty
  much all you
  have listed here and a lot more. I just started looking into it
  today.
 
 Thanks Colin.
 
 I saw that it, read it, played with it.
 
 It was just way to big a clunky for what I was looking to do.
 
 I have what need to make this work.
 
 I was just hoping to have a better method of reading the file and
 ignoring the blank lines and the commented lines.
 
 I just have this thing about double level IF statements.
 
 Thanks.
 
 Walter
 

Is there a problem with using your text editor to change all the #
to ; and then using parse_ini_file()?

--
Raquel

I never did give anybody hell. I just told the truth, and they
thought it was hell.
  --Harry S Truman

--
Raquel

I never did give anybody hell. I just told the truth, and they
thought it was hell.
  --Harry S Truman

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



[PHP] sql query/displaying results question

2003-10-23 Thread Adam Williams
I have a php page I am writing with an SQL query.  I am going to query the 
database for a couple of fields.  One of the fields I am querying is the 
title oh the document someone is searching for.  The title will be used at 
the top of the html page and will say:

you are searching for document number ###: document $title 

but then later on down on the page when it starts returning your results:

document $title: document $location

So I will have 1 query that needs to print the document $title at the top 
of the page and then when it starts showing results.  I won't know what 
the document title is until the database is queried (because they are 
doing a query for keywords in the documents stored in that table in the 
database).  So at the top of the page can I use my $title from the 
database and then when I start showing the results, can I show the same 
document $title from the 1st row returned if I am using a while loop, or 
because I already used $title at the top from the 1st row returned, will 
it want to start at the 2nd row returned when I start my while loop to 
return all of the data?

Adam

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



Re: [PHP] array of java-objects

2003-10-23 Thread Helke Schröder
Hi,

thanks for the replay

the var_dump on the array of java-objects looks interesting:

the first, which is ok:

array(8) { [0]= object(java)(1) { [0]= int(3) } [1]= object(java)(1)
 [0]= int(4) } [2]= object(java)(1) { [0]= int(5) } [3]=
object(java)(1) { [0]= int(6) } [4]= object(java)(1) { [0]= int(7) }
[5]= object(java)(1) { [0]= int(8) } [6]= object(java)(1) { [0]=
int(9) } [7]= object(java)(1) { [0]= int(10) } }

but the second is strange:

array(8) { [0]= int(20) [1]= object(java)(1) { [0]= int(21) } [2]=
object(java)(1286082128) { } [3]= object(java)(1) { [0]= int(23) } [4]=
object(java)(1) { [0]= int(24) } [5]= object(java)(1) { [0]= int(25) }
[6]= object(java)(1) { [0]= int(26) } [7]= object(java)(1) { [0]=
int(27) } }

Why is that? The first element of that array is not a java-object.

The same with the third one:

array(9) { [0]= int(37) [1]= object(java)(1) { [0]= int(38) } [2]=
object(java)(1) { [0]= int(39) } [3]= object(java)(1) { [0]= int(40) }
[4]= object(java)(1) { [0]= int(41) } [5]= object(java)(1) { [0]=
int(42) } [6]= object(java)(1) { [0]= int(43) } [7]= object(java)(1)
 [0]= int(44) } [8]= object(java)(1) { [0]= int(45) } }



thanks in advance, Helke

here is the code:

?php

error_reporting(E_ALL);

echo(htmlheadtitletest ldx per php/title/headbody);

$ldaphost=195.180.92.49;

$such_art=inh;

$filter=cn=*;

$base=dc=schule,dc=de;

$LdxInf=null;

$LdxInf=new Java(ldxUtil.LdxInterface);

$ObjectDNs=null;

$ObjectDNs=$LdxInf-FindObjects($ldaphost, , , $filter, $base);

echo(hr);

array_walk($ObjectDNs, traverse_array);

echo(hr);

echo(table);

foreach ($ObjectDNs as $item)

{

$LdxAttributes=null;

echo(trtd bgcolor=\#FF8000\);

var_dump($LdxInf);

echo(/td/tr);

echo(trtd bgcolor=\#00\.$item./td);

$LdxAttributes=array();

$LdxAttributes=$LdxInf-InheritanceReader($ldaphost, ,, $item);

$c=null;

$c=count($LdxAttributes);

echo(td.$c./td/tr);

reset($LdxAttributes);

echo(trtd bgcolor=\#C0C0C0\);

var_dump($LdxAttributes);

echo(/td/tr);

$sa=null;

$sa=new Java('ldxUtil.LdxAttribute');

reset($LdxAttributes);

$sa=$LdxAttributes[0];

echo(trtd bgcolor=\#80\);

var_dump($sa); /*the first object comes as java-object, the both following
as int(20) and int(37)*/

echo(/td/tr);

$s=null;

/*$s=$sa-getAttribute();

echo(trtd bgcolor=\#80FF80\);

var_dump($s);

echo(/td/tr);

echo(trtd.$s./td/tr);*/

unset($s);

unset($sa);

reset($LdxAttributes);

for ($i=0;$i$c;$i++)

{

echo(trtdsome text/td/tr);

$a=null;

$a=new Java('ldxUtil.LdxAttribute');

/*echo(trtd.$LdxAttributes[$i]-getAttribute()./td/tr);*/

unset($a);

}

unset($LdxAttributes);

unset($c);

}

function traverse_array($value) {

print $value.br;

}

unset($ObjectDNs);

unset($LdxInf);

unset($base);

unset($filter);

unset($such_art);

unset($ldaphost);

echo(/table/body/html);

?

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



Re: [PHP] problem with intval and !=

2003-10-23 Thread Cesar Cordovez
The other purpose of this procedure is if the user types 12asdasd into 
$value, $number will be assigned 12 so $value and $number are not the 
same, meaning $value is not a number.  Which is correct, but the 
procedure is not working correctly in PHP when it should.  (It works in 
c, c++, fortran and, believe it or not HyperCard!!!)

Cesar.



Cesar Cordovez wrote:

Curt:

My fault!  You are right, but thats not what I want. $value comes from a 
form filled by a user.  I want $value to be an integer.  Not a float. So 
if the user types 12.3 the system has to send an error msg.

Therefore the procedure.

By-the-way, Im using PHP 4.3.3 (on windows XP profesional.  Don't say a 
thing!!! I rather work on my mac!)  =)

Cesar

Curt Zirzow wrote:

* Thus wrote Cesar Cordovez ([EMAIL PROTECTED]):

Can somebody explain me why is this happening?

$value = 12.3;
$number = intval($value);
echo Number: $number, Value: $valuebr;
// echoes: Number: 12, Value: 12.3


I'm guessing you wondering why the .3 is removed.  Thats because
12.3 isn't an integer but a float.
$number = floatval($value);


if ($number != $value) {
echo Bad;
} else {
echo Good;  // echoes Good!!
}
The previous should be echoing Bad.  (I think!)


correct. If you use the floatval() it will echo Good.

Curt


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


Re: [PHP] problem with intval and !=

2003-10-23 Thread Cesar Cordovez
This is getting weird by the minute.  I changed the script:

if ($number != $value) {
echo Bad;
} else {
echo Good;  // echoes Good!!
}
to:
($number != $value)
($number !== $value)
($number === $value)
and I get the Good stuff...

At this point, I think I have to change the procedure.  This is not 
good.  Any sugestions on how to now if the user types an integer number 
in a field?

Cesar

Curt Zirzow wrote:

* Thus wrote Cesar Cordovez ([EMAIL PROTECTED]):

Curt:

My fault!  You are right, but thats not what I want. $value comes from a 
form filled by a user.  I want $value to be an integer.  Not a float. 
So if the user types 12.3 the system has to send an error msg.


Yeah, after reading merek's response I realized I missed what
exactly your problem is.

Therefore the procedure.

By-the-way, Im using PHP 4.3.3 (on windows XP profesional.  Don't say a 
thing!!! I rather work on my mac!)  =)


Thats odd, I come up with a 'Bad' echo also.  The only thing I can
think of is there is some sort of implicit casting happening to the
$value within the comparison.  But it does seem very strange that
XP would cast but *nix doesn't
In that case test the condition reversed:
  if ($value != $number)
I'm at a loss as to why it doesn't work on your system.

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


Re: [PHP] problem with intval and !=

2003-10-23 Thread Andrea Pinnisi
why don't you use this??

http://it.php.net/manual/it/function.is-integer.php

Cesar Cordovez ha scritto:

This is getting weird by the minute.  I changed the script:

if ($number != $value) {
echo Bad;
} else {
 echo Good;  // echoes Good!!
}
to:
($number != $value)
($number !== $value)
($number === $value)
and I get the Good stuff...

At this point, I think I have to change the procedure.  This is not 
good.  Any sugestions on how to now if the user types an integer 
number in a field?

Cesar

Curt Zirzow wrote:

* Thus wrote Cesar Cordovez ([EMAIL PROTECTED]):

Curt:

My fault!  You are right, but thats not what I want. $value comes 
from a form filled by a user.  I want $value to be an integer.  Not 
a float. So if the user types 12.3 the system has to send an error 
msg.


Yeah, after reading merek's response I realized I missed what
exactly your problem is.

Therefore the procedure.

By-the-way, Im using PHP 4.3.3 (on windows XP profesional.  Don't 
say a thing!!! I rather work on my mac!)  =)


Thats odd, I come up with a 'Bad' echo also.  The only thing I can
think of is there is some sort of implicit casting happening to the
$value within the comparison.  But it does seem very strange that
XP would cast but *nix doesn't
In that case test the condition reversed:
  if ($value != $number)
I'm at a loss as to why it doesn't work on your system.

Curt


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


Re: [PHP] German Date - GMDATE Function

2003-10-23 Thread Don Read

On 22-Oct-2003 Steve Vernon wrote:
 Hello,
 
 When I use the gmdate function, I get the English date, e.g. October. Is
 it
 possible to get the date in German or another language? I really need the
 server setting up so that it can handle different languages.
 

$locale='de_CH.ISO_8859-1'; // Alternate: 'de_DE.ISO_8859-1' 

setlocale(LC_TIME, $locale);

Regards,
-- 
Don Read [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

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



Re: [PHP] in_array()/finding page Problem

2003-10-23 Thread Marek Kilimajer
Ben G. McCullough wrote:

I agree - my solution is VERY resource intensive, but I think I may have 
over simplified my question.

Each item is listed by two categories, $medium and $period. Users can 
get to the item via a 'browse' of either category.  I want to user to be 
able to get back to the browse page they came from, or go to the other 
listing.
Pass current url to the next page, or only the relevant variables, then 
on the next page build the url from suplied variables.

To compound the issue - items are ordered by $sku, not $id.

So the select statement would look more like this:

SELECT COUNT(*)/12 FROM table WHERE medium = $medium ORDER BY $sku
You need to find out $sku of the current row and use

SELECT COUNT(*)/12 FROM table WHERE medium = $medium AND $sku = 
$current_sku

But how would I find the page?

I had figured the only way was to actually go through each loop of pages 
looking for the $id, which is not working, and takes a lot of resources.

While this is only a test project, this issue is based on a real - world 
problem.

You solution is quite resource expensive. I would do:
[find $maxpages]
SELECT COUNT(*)/12 FROM table WHERE id = $real_id;
list($maxpages) = fetch_row()
In result.php use ORDER BY id

Ben G. McCullough wrote:

I think I have a flaw of logic in trying to find the correct page in 
a mutli-page sql result.

Goal - find the correct page [results.php?page=x] when linking from 
another page.

Current method - loop through a pagination function looking for the 
matching $id in an array [simplified for illustration]:

[find $maxpages]
$page =1;
$catch=array();
while($page = $maxpages) {
[set start #]
$result = [get sql results - limit  $startnumber, 12]
while($record = mysql_fetch_array($result)) {
extract($record);
$catch[] = $found_id;
}
if(in_array($real_id, $catch, TRUE)) {
$here = $page;
}
$page++;
}
echo results.php?page=$here;

I never seem to get a true return on in_array(), and in testing, I 
don't seem to be getting a full result set with my look up.

I feel that I am missing something in the logic - or I am approaching 
this from the wrong direction.

I originally wanted to do the while test as if in_array is FALSE, 
continue loop but I couldn't get that to work at all.

Thank you for any help you can give this newbie.



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


Re: [PHP] problem with intval and !=

2003-10-23 Thread Marek Kilimajer
This should be reported as a bug.

I tried few searches and I got

Warning: mysql_fetch_array(): 9 is not a valid MySQL result resource in 
/local/Web/sites/php-bugs-web/search.php on line 182

on bugs.php.net

Cesar Cordovez wrote:

This is getting weird by the minute.  I changed the script:

if ($number != $value) {
echo Bad;
} else {
 echo Good;  // echoes Good!!
}
to:
($number != $value)
($number !== $value)
($number === $value)
and I get the Good stuff...

At this point, I think I have to change the procedure.  This is not 
good.  Any sugestions on how to now if the user types an integer number 
in a field?

Cesar

Curt Zirzow wrote:

* Thus wrote Cesar Cordovez ([EMAIL PROTECTED]):

Curt:

My fault!  You are right, but thats not what I want. $value comes 
from a form filled by a user.  I want $value to be an integer.  Not a 
float. So if the user types 12.3 the system has to send an error msg.


Yeah, after reading merek's response I realized I missed what
exactly your problem is.

Therefore the procedure.

By-the-way, Im using PHP 4.3.3 (on windows XP profesional.  Don't say 
a thing!!! I rather work on my mac!)  =)


Thats odd, I come up with a 'Bad' echo also.  The only thing I can
think of is there is some sort of implicit casting happening to the
$value within the comparison.  But it does seem very strange that
XP would cast but *nix doesn't
In that case test the condition reversed:
  if ($value != $number)
I'm at a loss as to why it doesn't work on your system.

Curt


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


Re: [PHP] problem with intval and !=

2003-10-23 Thread Cesar Cordovez
Because is_integer(12thisisnotanumber) retuns true.



Andrea Pinnisi wrote:

why don't you use this??

http://it.php.net/manual/it/function.is-integer.php

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


Re: [PHP] sql query/displaying results question

2003-10-23 Thread Jason Wong
On Thursday 23 October 2003 22:06, Adam Williams wrote:

 So I will have 1 query that needs to print the document $title at the top
 of the page and then when it starts showing results.  I won't know what
 the document title is until the database is queried (because they are
 doing a query for keywords in the documents stored in that table in the
 database).  So at the top of the page can I use my $title from the
 database and then when I start showing the results, can I show the same
 document $title from the 1st row returned if I am using a while loop, or
 because I already used $title at the top from the 1st row returned, will
 it want to start at the 2nd row returned when I start my while loop to
 return all of the data?

After displaying $title use mysql_data_seek() to return to start of results 
dataset.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
I learned to play guitar just to get the girls, and anyone who says they
didn't is just lyin'!
-- Willie Nelson
*/

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



Re: [PHP] problem with intval and !=

2003-10-23 Thread Robert Cummings
On Thu, 2003-10-23 at 11:41, Cesar Cordovez wrote:
 Because is_integer(12thisisnotanumber) retuns true.
 

Not for me it doesn't. Returns false. Prolly because it's a string. Even
the following returns false for me:

is_integer(12)

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.  |
`'

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



Re: [PHP] problem with intval and !=

2003-10-23 Thread Robert Cummings
On Thu, 2003-10-23 at 11:21, Cesar Cordovez wrote:
 
 At this point, I think I have to change the procedure.  This is not 
 good.  Any sugestions on how to now if the user types an integer number 
 in a field?
 

Here's a really simple way:

if( ereg( '^[[:space:]]*[[:digit:]]+[[:space:]]*', $input ) )
{
// Yaaay, integer input!
}

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.  |
`'

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



Re: [PHP] problem with intval and !=

2003-10-23 Thread Robert Cummings
On Thu, 2003-10-23 at 11:51, Robert Cummings wrote:
 On Thu, 2003-10-23 at 11:21, Cesar Cordovez wrote:
  
  At this point, I think I have to change the procedure.  This is not 
  good.  Any sugestions on how to now if the user types an integer number 
  in a field?
  
 
 Here's a really simple way:
 
 if( ereg( '^[[:space:]]*[[:digit:]]+[[:space:]]*', $input ) )
 {
 // Yaaay, integer input!
 }

Whoops, forgot the trailing $

if( ereg( '^[[:space:]]*[[:digit:]]+[[:space:]]*$', $input ) )
{
// Yaaay, integer input!
}

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.  |
`'

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



Re: [PHP] problem with intval and !=

2003-10-23 Thread Cesar Cordovez
Sorry, typo, this is what I meant,

!is_integer(12thisisnotanumber) retuns true.

but also,

is_integer(12) return false.

therefore,

is_integer(12) return true.

So, how can I check if what ever the user writes is an integer or not, 
knowing that he will write it in a string field.

Any how, I solved the problem with preg_match(/^([0-9]+)$/, $value)

Thanks for your help, list

=)

Robert Cummings wrote:

On Thu, 2003-10-23 at 11:41, Cesar Cordovez wrote:

Because is_integer(12thisisnotanumber) retuns true.



Not for me it doesn't. Returns false. Prolly because it's a string. Even
the following returns false for me:
is_integer(12)

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


Re: [PHP] Email Body

2003-10-23 Thread Don Read

On 22-Oct-2003 micro brew wrote:
 I am sending an email using mail() and it works fine. 
 But the formatting of the body of the email is wrong. 
 I want to format part of it in columns sort of like
 this:
 Name   Quantity  Price
 
 Can this be done neatly without using an html email?
 

sprintf(%-25 %2d %9.2f\n, 
  $name, $qty, $price);

 Also what is the trick to making line returns display
 properly in the email client?  I've tried using \r\n
 with no luck.  I also tried \n.  The characters show
 in the email but no line breaks.  Any suggestions?
 

double-quotes around your string?

Regards,
-- 
Don Read [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

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



RE: [PHP] Images being uploaded in ASCII format

2003-10-23 Thread Pablo Gosse
Hi Tom.

 make sure you have ENCTYPE=multipart/form-data in the form tag

Thanks for the tip, but that's not the problem.  My code is below, and
as you can see there is nothing in the code that would be causing this.
It has to be something in the server, and while there have been a few
posts to these lists about this problem, never a resolution for the
problem.

Here's the code:

?php
function handleupload()
{
if (is_uploaded_file($_FILES['userfile']['tmp_name']))
{
$realname = $_FILES['userfile']['name'];
if(copy($_FILES['userfile']['tmp_name'],
'/path/to/file/'.$realname))
{
echo 'br /'.$realname.' uploaded/font';
}
else
{
echo 'br /'.$realname.'could not be
uploaded/font';
}
}
else
{
echo 'br /Possible file upload attack: filename
'.$_FILES['userfile']['name'].'.';
}
}
?
html
head
titleFile Upload/title
/head
body
?php
if (isset($_POST['method'])  $_POST['method'] == 'upload')
handleupload();
?
form ENCTYPE=multipart/form-data method=POST action=?php echo
$_SERVER['PHP_SELF']; ?
input type=hidden name=method value=upload
File:input type=file name=userfile size=35
input type=submit value=upload name=submit
/form
/body
/html

This is very standard code, yet the images are uploaded in ascii format.

Does anyone have any idea why this is happening?  How can I for the http
uploads to auto-detect?  I've looked through the entire php.ini and
httpd.conf files and I can't seem to find anything, and as I mentioned
above none of the previous posts on this topic have been resolved.

Anyone?

Thanks much in advance,
Pablo

Thursday, October 23, 2003, 4:05:13 AM, you wrote:
PG Hi all.  I'd like to take a brief sentence to introduce myself
first.
PG My name is Pablo Gosse, and I've just recently joined the
php-general
PG list.  I've been using PHP since early 2000, and work as webmaster
PG at the University of Northern British Columbia.

PG I'm running into a problem with file uploads being handled in ascii
PG rather than binary format.

PG I've been writing a CMS for the past few months and the wysiwyg
editor
PG we're integrating has a very nice image manager built in
PG (www.devedit.com).  However, the uploads are being transferred in
ascii
PG format instead of binary (or auto-detect) which is mangling all the
PG images.

PG I've done a lot of research into this but can't seem to pin down the
PG problem.  I've looked through both my php.ini and httpd.conf and
can't
PG seem to find anything there that would remedy this problem.

PG Does anyone have any advice as to where I should be looking to fix
this
PG problem?

PG Thanks much in advance.

PG Cheers,
PG Pablo

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



Re: [PHP] problem with intval and !=

2003-10-23 Thread Curt Zirzow
* Thus wrote Marek Kilimajer ([EMAIL PROTECTED]):
 This should be reported as a bug.
 
 I tried few searches and I got
 
 Warning: mysql_fetch_array(): 9 is not a valid MySQL result resource in 
 /local/Web/sites/php-bugs-web/search.php on line 182

The search seems to work now, what did you search for?


Curt
-- 
My PHP key is worn out

  PHP List stats since 1997: 
  http://zirzow.dyndns.org/html/mlists/

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



Re: [PHP] problem with intval and !=

2003-10-23 Thread Greg Beaver
Hello all,

http://www.php.net/is_numeric

is the function you are looking for.  No need for fancy regexps.

Regards,
Greg
--
phpDocumentor
http://www.phpdoc.org
Cesar Cordovez wrote:
Sorry, typo, this is what I meant,

!is_integer(12thisisnotanumber) retuns true.

but also,

is_integer(12) return false.

therefore,

is_integer(12) return true.

So, how can I check if what ever the user writes is an integer or not, 
knowing that he will write it in a string field.

Any how, I solved the problem with preg_match(/^([0-9]+)$/, $value)

Thanks for your help, list

=)

Robert Cummings wrote:

On Thu, 2003-10-23 at 11:41, Cesar Cordovez wrote:

Because is_integer(12thisisnotanumber) retuns true.



Not for me it doesn't. Returns false. Prolly because it's a string. Even
the following returns false for me:
is_integer(12)

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


Re: [PHP] problem with intval and !=

2003-10-23 Thread Marek Kilimajer
Status: All
Return only bugs in categories: Scripting Engine Problem
Return bugs with operating system: windows
But it is ok now.

Curt Zirzow wrote:

* Thus wrote Marek Kilimajer ([EMAIL PROTECTED]):

This should be reported as a bug.

I tried few searches and I got

Warning: mysql_fetch_array(): 9 is not a valid MySQL result resource in 
/local/Web/sites/php-bugs-web/search.php on line 182


The search seems to work now, what did you search for?

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


Re: [PHP] problem with intval and !=

2003-10-23 Thread Jordan S. Jones
Cesar,

You can take a look into is_numeric () (http://www.php.net/is_numeric).  
It will tell you whether the value is a number or a numeric string, but 
it will also return true if the value is a float. However, at that point 
you know your working with the right type of variable.

Jordan S. Jones

Cesar Cordovez wrote:

Sorry, typo, this is what I meant,

!is_integer(12thisisnotanumber) retuns true.

but also,

is_integer(12) return false.

therefore,

is_integer(12) return true.

So, how can I check if what ever the user writes is an integer or not, 
knowing that he will write it in a string field.

Any how, I solved the problem with preg_match(/^([0-9]+)$/, $value)

Thanks for your help, list

=)

Robert Cummings wrote:

On Thu, 2003-10-23 at 11:41, Cesar Cordovez wrote:

Because is_integer(12thisisnotanumber) retuns true.



Not for me it doesn't. Returns false. Prolly because it's a string. Even
the following returns false for me:
is_integer(12)

Cheers,
Rob.


--
I am nothing but a poor boy. Please Donate..
https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jonesno_note=1tax=0currency_code=USD
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] problem with intval and !=

2003-10-23 Thread John W. Holmes
Greg Beaver wrote:

http://www.php.net/is_numeric

is the function you are looking for.  No need for fancy regexps.
The OP is looking for an integer, but is_numeric() will return true for 
float values and also for numbers in scientific notation. So 12.3 and 
12E3 will be TRUE.

The original $number != intval($number) should work for detecting bad 
input.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


Re: [PHP] problem with intval and !=

2003-10-23 Thread Marek Kilimajer
These are all workarounds around the real problem. If php gets it wrong 
fix php.

Robert Sedlacek wrote:

On Thu, 23 Oct 2003 11:59:44 -0400, Cesar Cordovez wrote:

So, how can I check if what ever the user writes is an integer or not, 
knowing that he will write it in a string field.


Idea:

if(($var + 0) == $var AND is_integer($var + 0)) echo number;

Robert

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


Re: [PHP] problem with intval and !=

2003-10-23 Thread Robert Cummings
On Thu, 2003-10-23 at 12:28, Greg Beaver wrote:
 Hello all,
 
 http://www.php.net/is_numeric
 
 is the function you are looking for.  No need for fancy regexps.

Sorry, that doesn't cut it. He want's integers not floats, and I'm also
sure he doesn't want exponential notation to pass either.

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.  |
`'

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



Re: [PHP] problem with intval and !=

2003-10-23 Thread Robert Cummings
On Thu, 2003-10-23 at 12:43, Marek Kilimajer wrote:
 These are all workarounds around the real problem. If php gets it wrong 
 fix php.

Could you explain how PHP has it wrong?

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.  |
`'

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



Re: [PHP] problem with intval and !=

2003-10-23 Thread Robert Cummings
On Thu, 2003-10-23 at 12:41, John W. Holmes wrote:
 Greg Beaver wrote:
 
  http://www.php.net/is_numeric
  
  is the function you are looking for.  No need for fancy regexps.
 
 The OP is looking for an integer, but is_numeric() will return true for 
 float values and also for numbers in scientific notation. So 12.3 and 
 12E3 will be TRUE.
 
 The original $number != intval($number) should work for detecting bad 
 input.

This doesn't work John, because the the != will convert the $number to
an intval for the comparison; however, after reflecting on your code and
the style you used.. hte following will work :)

$foo = '123fooo';

if( trim( $foo ) != ''.intval( $foo ) )
{  
echo Not same beast!\n;
}
else
{   
echo Same beast!\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.  |
`'

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



[PHP] Array in SQL-table

2003-10-23 Thread Reidar
I want to store an ARRAY in a SQL-table but don't know how to define it in
the table. The PHP-stuff is working OK but the DB-thing isn't.

Anyone tried this? Hopefully it is

Reidar Solberg

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



Re: [PHP] Array in SQL-table

2003-10-23 Thread Jordan S. Jones
If the field isn't required to be searchable, you could just serialize 
the array and shove that into a VARCHAR column.. Then unserialize the 
return value for that column.

Jordan S. Jones

Reidar wrote:

I want to store an ARRAY in a SQL-table but don't know how to define it in
the table. The PHP-stuff is working OK but the DB-thing isn't.
Anyone tried this? Hopefully it is

Reidar Solberg

 

--
I am nothing but a poor boy. Please Donate..
https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jonesno_note=1tax=0currency_code=USD
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] problem with intval and !=

2003-10-23 Thread Marek Kilimajer
This echoes out Bad on my LAMP server as it should, but Good on 
Cesar's windows server:

$value = 12.3;
$number = intval($value);
echo Number: $number, Value: $valuebr;
// echoes: Number: 12, Value: 12.3
if ($number != $value) {
echo Bad;
} else {
echo Good;  // echoes Good!!
}


Robert Cummings wrote:

On Thu, 2003-10-23 at 12:43, Marek Kilimajer wrote:

These are all workarounds around the real problem. If php gets it wrong 
fix php.


Could you explain how PHP has it wrong?

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


Re: [PHP] Images being uploaded in ASCII format

2003-10-23 Thread Raditha Dissanayake
Hi Pablo,

Could you explain what exactly you mean by transferred in ASCII mode? do 
you find that cr/lf combinations are translated (there by corrupting 
your image) or some other corruption takes place?

Have you opened the files with a hex editor to see the contents? I am 
sorry if you have mentioned these before, i don't have the older 
messages in this thread.



Pablo Gosse wrote:

Hi Tom.

 

make sure you have ENCTYPE=multipart/form-data in the form tag
   

Thanks for the tip, but that's not the problem.  My code is below, and
as you can see there is nothing in the code that would be causing this.
It has to be something in the server, and while there have been a few
posts to these lists about this problem, never a resolution for the
problem.
Here's the code:

?php
function handleupload()
{
if (is_uploaded_file($_FILES['userfile']['tmp_name']))
{
$realname = $_FILES['userfile']['name'];
if(copy($_FILES['userfile']['tmp_name'],
'/path/to/file/'.$realname))
{
echo 'br /'.$realname.' uploaded/font';
}
else
{
echo 'br /'.$realname.'could not be
uploaded/font';
}
}
else
{
echo 'br /Possible file upload attack: filename
'.$_FILES['userfile']['name'].'.';
}
}
?
html
head
titleFile Upload/title
/head
body
?php
if (isset($_POST['method'])  $_POST['method'] == 'upload')
handleupload();
?
form ENCTYPE=multipart/form-data method=POST action=?php echo
$_SERVER['PHP_SELF']; ?
input type=hidden name=method value=upload
File:input type=file name=userfile size=35
input type=submit value=upload name=submit
/form
/body
/html
This is very standard code, yet the images are uploaded in ascii format.

Does anyone have any idea why this is happening?  How can I for the http
uploads to auto-detect?  I've looked through the entire php.ini and
httpd.conf files and I can't seem to find anything, and as I mentioned
above none of the previous posts on this topic have been resolved.
Anyone?

Thanks much in advance,
Pablo
Thursday, October 23, 2003, 4:05:13 AM, you wrote:
PG Hi all.  I'd like to take a brief sentence to introduce myself
first.
PG My name is Pablo Gosse, and I've just recently joined the
php-general
PG list.  I've been using PHP since early 2000, and work as webmaster
PG at the University of Northern British Columbia.
PG I'm running into a problem with file uploads being handled in ascii
PG rather than binary format.
PG I've been writing a CMS for the past few months and the wysiwyg
editor
PG we're integrating has a very nice image manager built in
PG (www.devedit.com).  However, the uploads are being transferred in
ascii
PG format instead of binary (or auto-detect) which is mangling all the
PG images.
PG I've done a lot of research into this but can't seem to pin down the
PG problem.  I've looked through both my php.ini and httpd.conf and
can't
PG seem to find anything there that would remedy this problem.
PG Does anyone have any advice as to where I should be looking to fix
this
PG problem?
PG Thanks much in advance.

PG Cheers,
PG Pablo
 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB  |  with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] problem with intval and !=

2003-10-23 Thread Robert Cummings
On Thu, 2003-10-23 at 13:01, Marek Kilimajer wrote:
 This echoes out Bad on my LAMP server as it should, but Good on 
 Cesar's windows server:

Aaaah how true. I wasn't following this much earlier so I don't know if
he is using the most up to date version, in which case it may already be
fixed.

Cheers,
Rob.

 
 $value = 12.3;
 $number = intval($value);
 
 echo Number: $number, Value: $valuebr;
 // echoes: Number: 12, Value: 12.3
 
 if ($number != $value) {
  echo Bad;
 } else {
  echo Good;  // echoes Good!!
 }
 
 
 
 Robert Cummings wrote:
 
  On Thu, 2003-10-23 at 12:43, Marek Kilimajer wrote:
  
 These are all workarounds around the real problem. If php gets it wrong 
 fix php.
  
  
  Could you explain how PHP has it wrong?
  
  Rob.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
-- 
..
| 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.  |
`'

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



Re: [PHP] fsock sending bad request

2003-10-23 Thread Raditha Dissanayake
Hi
hey Curt, I missed that one. Daniel have you looked at RFC 2616?
Curt Zirzow wrote:

* Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]):
 

Hi there the following code doesnt seem to work, i am getting a bad request
sent back from the server, what could be the problem of something so
simple ?
$header .= POST test.php HTTP/1.0\r\n;
$header.= Host: host\r\n;
$header .= Content-Type: application/x-www-form-urlencoded\r\n;
$header .= 'Content-Length: ' . strlen($req) . \n\n;
$header .= Connection: close\n\n;
$header.= $req\n;
$header.= \r\n;
   

The last two lines should be:

 $header.= \r\n;
 $header.= $req; #Note, no \n
Make sure all your headers have \r\n endings.  Technically the $req
is not part of the headers but the actual content to be sent.
Curt
 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB  |  with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Images being uploaded in ASCII format

2003-10-23 Thread Pablo Gosse
Hi Raditha.  Thanks very much for your reply.  I've not been having much
luck with this one.

This is how the images should appear:
http://web.unbc.ca/~gossep/sample_images/1.gif
http://web.unbc.ca/~gossep/sample_images/nav-02.jpg

And here is how they appear after being uploaded:
http://web.unbc.ca/~gossep/sample_images/1_uploaded.gif
http://web.unbc.ca/~gossep/sample_images/nav-02_uploaded.jpg

The results to me seem the same as if an image were FTPed in ascii mode
instead of binary mode (or auto-detect which would ultimately set the
mode to binary).

I just downloaded the XVI32 hex editor, but what should I be looking for
when I open the files and examine the contents?

Some other particulars to this situation:

I've tried uploading the same images through the demo site on the
company from which we purchased our editor (www.devedit.com) and they
upload fine, making me certain it's a system setting on my system
causing the problem.

My system is as follows:

Dell Precision 340 Workstation
RedHat 9.0
Apache 2.0
PHP 4.2.2

Thanks with your help, Raditha.  Greatly appreciated.

Cheers,
Pablo

-Original Message-
From: Raditha Dissanayake [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 23, 2003 10:19 AM
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Images being uploaded in ASCII format


Hi Pablo,

Could you explain what exactly you mean by transferred in ASCII mode? do

you find that cr/lf combinations are translated (there by corrupting 
your image) or some other corruption takes place?

Have you opened the files with a hex editor to see the contents? I am 
sorry if you have mentioned these before, i don't have the older 
messages in this thread.




Pablo Gosse wrote:

Hi Tom.

  

make sure you have ENCTYPE=multipart/form-data in the form tag



Thanks for the tip, but that's not the problem.  My code is below, and
as you can see there is nothing in the code that would be causing this.
It has to be something in the server, and while there have been a few
posts to these lists about this problem, never a resolution for the
problem.

Here's the code:

?php
function handleupload()
{
   if (is_uploaded_file($_FILES['userfile']['tmp_name']))
   {
   $realname = $_FILES['userfile']['name'];
   if(copy($_FILES['userfile']['tmp_name'],
'/path/to/file/'.$realname))
   {
   echo 'br /'.$realname.' uploaded/font';
   }
   else
   {
   echo 'br /'.$realname.'could not be
uploaded/font';
   }
   }
   else
   {
   echo 'br /Possible file upload attack: filename
'.$_FILES['userfile']['name'].'.';
   }
}
?
html
head
titleFile Upload/title
/head
body
?php
if (isset($_POST['method'])  $_POST['method'] == 'upload')
handleupload();
?
form ENCTYPE=multipart/form-data method=POST action=?php echo
$_SERVER['PHP_SELF']; ?
input type=hidden name=method value=upload
File:input type=file name=userfile size=35
input type=submit value=upload name=submit
/form
/body
/html

This is very standard code, yet the images are uploaded in ascii
format.

Does anyone have any idea why this is happening?  How can I for the
http
uploads to auto-detect?  I've looked through the entire php.ini and
httpd.conf files and I can't seem to find anything, and as I mentioned
above none of the previous posts on this topic have been resolved.

Anyone?

Thanks much in advance,
Pablo

Thursday, October 23, 2003, 4:05:13 AM, you wrote:
PG Hi all.  I'd like to take a brief sentence to introduce myself
first.
PG My name is Pablo Gosse, and I've just recently joined the
php-general
PG list.  I've been using PHP since early 2000, and work as webmaster
PG at the University of Northern British Columbia.

PG I'm running into a problem with file uploads being handled in ascii
PG rather than binary format.

PG I've been writing a CMS for the past few months and the wysiwyg
editor
PG we're integrating has a very nice image manager built in
PG (www.devedit.com).  However, the uploads are being transferred in
ascii
PG format instead of binary (or auto-detect) which is mangling all the
PG images.

PG I've done a lot of research into this but can't seem to pin down
the
PG problem.  I've looked through both my php.ini and httpd.conf and
can't
PG seem to find anything there that would remedy this problem.

PG Does anyone have any advice as to where I should be looking to fix
this
PG problem?

PG Thanks much in advance.

PG Cheers,
PG Pablo

  



-- 
Raditha Dissanayake.

http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB  |  with progress bar.

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

Re: [PHP] Images being uploaded in ASCII format

2003-10-23 Thread Raditha Dissanayake
Hi Pablo

Pablo Gosse wrote:

Hi Raditha.  Thanks very much for your reply.  I've not been having much
luck with this one.
welcome

This is how the images should appear:
http://web.unbc.ca/~gossep/sample_images/1.gif
http://web.unbc.ca/~gossep/sample_images/nav-02.jpg
And here is how they appear after being uploaded:
http://web.unbc.ca/~gossep/sample_images/1_uploaded.gif
http://web.unbc.ca/~gossep/sample_images/nav-02_uploaded.jpg
1.gif and 1_uploaded.gif differ by much as 4Kb in length! and the first 
difference occurs at byte number 1276. (I used cmp)

The results to me seem the same as if an image were FTPed in ascii mode
instead of binary mode (or auto-detect which would ultimately set the
mode to binary).
Though the output might look like that it's misleading because you are 
using HTTP post.  Unfortunately PHP does not allow access to raw POST 
data, else this can be debugged by looking at that data. I will mail you 
(offlist) a small perl script that you can use to write out the POST to 
a temp file and may be help you get to the bottom of this.

I just downloaded the XVI32 hex editor, but what should I be looking for
when I open the files and examine the contents?
Khexedit might be installed by default.

all the best



--
Raditha Dissanayake.

http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB  |  with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] problem with intval [CONCLUSION]

2003-10-23 Thread Cesar Cordovez
Everybody:

This problem solved.  It is not PHP's fault, It is mine. When I fixed 
some problems that I thought where non intrusive in this problem, 
everything started working as a charm.

Here is the finished function, it is part of a class called xValidate.

function integer($msg, $prompt, $value, $min, $max, $name) {
$number = intval($value);

if ($value == ) {
$msg[$prompt] = You have to write a number in this field.;
} elseif (!is_numeric($value)) {
$msg[$prompt] = The contents of this field should be a number.;
} elseif ($value != $number) {
$msg[$prompt] = This number should be an integer.;
} else {
xValidate::number($msg, $prompt, $number, $min, $max, $name);
}
}
and just for the curious here is xValidate::number...

function number($msg, $prompt, $number, $min, $max, $name) {		
	if (!empty($min) and ($number  $min)) {
		$msg[$prompt] = This value should be a number greater than or equal 
to $min.;
	} elseif (!empty($max) and ($number  $max)) {
		$msg[$prompt] = This value should be a number less than or equal to 
$max.;
	}
}

Thanks for your interest,

Cesar.

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


RE: [PHP] Images being uploaded in ASCII format

2003-10-23 Thread Ricardo C. Fernandez de C.
Something wrong is with your uploader program... look at this:

Content-Disposition: form-data; name=upload; filename=C:\Documents
and Settin
gs\gossep\Desktop\ewimages\1.gif

And if you look closer to the data in the file, you will see it has 2
GIF or something (GIF8 twice)... so yep, you have something really wrong
with your uploader.

El jue, 23-10-2003 a las 13:22, Pablo Gosse escribió:
 Hi Raditha.  Thanks very much for your reply.  I've not been having much
 luck with this one.
 
 This is how the images should appear:
 http://web.unbc.ca/~gossep/sample_images/1.gif
 http://web.unbc.ca/~gossep/sample_images/nav-02.jpg
 
 And here is how they appear after being uploaded:
 http://web.unbc.ca/~gossep/sample_images/1_uploaded.gif
 http://web.unbc.ca/~gossep/sample_images/nav-02_uploaded.jpg
 
 The results to me seem the same as if an image were FTPed in ascii mode
 instead of binary mode (or auto-detect which would ultimately set the
 mode to binary).
 
 I just downloaded the XVI32 hex editor, but what should I be looking for
 when I open the files and examine the contents?
 
 Some other particulars to this situation:
 
 I've tried uploading the same images through the demo site on the
 company from which we purchased our editor (www.devedit.com) and they
 upload fine, making me certain it's a system setting on my system
 causing the problem.
 
 My system is as follows:
 
 Dell Precision 340 Workstation
 RedHat 9.0
 Apache 2.0
 PHP 4.2.2
 
 Thanks with your help, Raditha.  Greatly appreciated.
 
 Cheers,
 Pablo
 
 -Original Message-
 From: Raditha Dissanayake [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, October 23, 2003 10:19 AM
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] Images being uploaded in ASCII format
 
 
 Hi Pablo,
 
 Could you explain what exactly you mean by transferred in ASCII mode? do
 
 you find that cr/lf combinations are translated (there by corrupting 
 your image) or some other corruption takes place?
 
 Have you opened the files with a hex editor to see the contents? I am 
 sorry if you have mentioned these before, i don't have the older 
 messages in this thread.
 
 
 
 
 Pablo Gosse wrote:
 
 Hi Tom.
 
   
 
 make sure you have ENCTYPE=multipart/form-data in the form tag
 
 
 
 Thanks for the tip, but that's not the problem.  My code is below, and
 as you can see there is nothing in the code that would be causing this.
 It has to be something in the server, and while there have been a few
 posts to these lists about this problem, never a resolution for the
 problem.
 
 Here's the code:
 
 ?php
 function handleupload()
 {
  if (is_uploaded_file($_FILES['userfile']['tmp_name']))
  {
  $realname = $_FILES['userfile']['name'];
  if(copy($_FILES['userfile']['tmp_name'],
 '/path/to/file/'.$realname))
  {
  echo 'br /'.$realname.' uploaded/font';
  }
  else
  {
  echo 'br /'.$realname.'could not be
 uploaded/font';
  }
  }
  else
  {
  echo 'br /Possible file upload attack: filename
 '.$_FILES['userfile']['name'].'.';
  }
 }
 ?
 html
 head
 titleFile Upload/title
 /head
 body
 ?php
 if (isset($_POST['method'])  $_POST['method'] == 'upload')
 handleupload();
 ?
 form ENCTYPE=multipart/form-data method=POST action=?php echo
 $_SERVER['PHP_SELF']; ?
 input type=hidden name=method value=upload
 File:input type=file name=userfile size=35
 input type=submit value=upload name=submit
 /form
 /body
 /html
 
 This is very standard code, yet the images are uploaded in ascii
 format.
 
 Does anyone have any idea why this is happening?  How can I for the
 http
 uploads to auto-detect?  I've looked through the entire php.ini and
 httpd.conf files and I can't seem to find anything, and as I mentioned
 above none of the previous posts on this topic have been resolved.
 
 Anyone?
 
 Thanks much in advance,
 Pablo
 
 Thursday, October 23, 2003, 4:05:13 AM, you wrote:
 PG Hi all.  I'd like to take a brief sentence to introduce myself
 first.
 PG My name is Pablo Gosse, and I've just recently joined the
 php-general
 PG list.  I've been using PHP since early 2000, and work as webmaster
 PG at the University of Northern British Columbia.
 
 PG I'm running into a problem with file uploads being handled in ascii
 PG rather than binary format.
 
 PG I've been writing a CMS for the past few months and the wysiwyg
 editor
 PG we're integrating has a very nice image manager built in
 PG (www.devedit.com).  However, the uploads are being transferred in
 ascii
 PG format instead of binary (or auto-detect) which is mangling all the
 PG images.
 
 PG I've done a lot of research into this but can't seem to pin down
 the
 PG problem.  I've looked through both my php.ini and httpd.conf and
 can't
 PG seem to find anything there that would remedy this problem.
 
 PG Does anyone have any advice as to where I should be looking to fix
 this
 PG problem?
 
 PG 

RE: [PHP] Images being uploaded in ASCII format

2003-10-23 Thread Pablo Gosse
Thanks Raditha.  At least now I know I've been looking in the wrong
place!

I'll look forward to the perl script to see if it sheds any more light
on this situation.

I'm currently running Windoze, but when I boot to Linux later I'll try
Khexedit to see what I can come up with.

Cheers,
Pablo

-Original Message-
From: Raditha Dissanayake [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 23, 2003 10:48 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Images being uploaded in ASCII format

Hi Pablo

Pablo Gosse wrote:

Hi Raditha.  Thanks very much for your reply.  I've not been having
much
luck with this one.

welcome


This is how the images should appear:
http://web.unbc.ca/~gossep/sample_images/1.gif
http://web.unbc.ca/~gossep/sample_images/nav-02.jpg

And here is how they appear after being uploaded:
http://web.unbc.ca/~gossep/sample_images/1_uploaded.gif
http://web.unbc.ca/~gossep/sample_images/nav-02_uploaded.jpg

1.gif and 1_uploaded.gif differ by much as 4Kb in length! and the first 
difference occurs at byte number 1276. (I used cmp)


The results to me seem the same as if an image were FTPed in ascii mode
instead of binary mode (or auto-detect which would ultimately set the
mode to binary).

Though the output might look like that it's misleading because you are 
using HTTP post.  Unfortunately PHP does not allow access to raw POST 
data, else this can be debugged by looking at that data. I will mail you

(offlist) a small perl script that you can use to write out the POST to 
a temp file and may be help you get to the bottom of this.


I just downloaded the XVI32 hex editor, but what should I be looking
for
when I open the files and examine the contents?

Khexedit might be installed by default.

all the best



-- 
Raditha Dissanayake.

http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB  |  with progress bar.

-- 
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] problem with intval and !=

2003-10-23 Thread Marek Kilimajer
I got the error again:
http://bugs.php.net/search.php?search_for=boolean=0limit=10order_by=direction=ASCcmd=displaystatus=Allbug_type%5B%5D=Scripting+Engine+problemphp_os=windowsphpver=assign=author_email=bug_age=0
Curt Zirzow wrote:

* Thus wrote Marek Kilimajer ([EMAIL PROTECTED]):

This should be reported as a bug.

I tried few searches and I got

Warning: mysql_fetch_array(): 9 is not a valid MySQL result resource in 
/local/Web/sites/php-bugs-web/search.php on line 182


The search seems to work now, what did you search for?

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


Re: [PHP] problem with intval and !=

2003-10-23 Thread Curt Zirzow
* Thus wrote Marek Kilimajer ([EMAIL PROTECTED]):
 I got the error again:
 http://bugs.php.net/search.php?search_for=boolean=0limit=10order_by=direction=ASCcmd=displaystatus=Allbug_type%5B%5D=Scripting+Engine+problemphp_os=windowsphpver=assign=author_email=bug_age=0

That reminds me of the time when I had to report a bug about a bug
that I couldn't submit because of the bug.

that page comes up find for me though. I can reproduce it if I take
out a few of the search criteria though.

Curt
-- 
My PHP key is worn out

  PHP List stats since 1997: 
  http://zirzow.dyndns.org/html/mlists/

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



[PHP] get user attributes php/ldap/win2k active directory

2003-10-23 Thread Redmond Militante
hi all

my first email to the list re: php/ldap/win2k AD garnered no responses.  i've got most 
of the problem solved, however i can't get attributes from the ldap server.

i have a login script that authenticates against our win2k active directory domain 
controller.  i'm able to open a connection/bind/verify a password/and close the 
connection.  i'm really having trouble returning a user's attributes (i'm mainly 
concerned with firstname and last name - cn and givenname).

i've been trying for several days to return attributes.  has anyone accomplished this 
with php?  i can't find much relevant info for this particular problem on the 
internet.  if you have any pointers, i'd appreciate hearing them.

i'd post relevant code, but nothing i've tried works, and i'm not sure if the code 
i've tried is even valid...

thanks

redmond
-- 
FreeBSD 5.1-RELEASE-p10 FreeBSD 5.1-RELEASE-p10 #0: Fri Oct 3 21:30:51 CDT 2003
12:45PM  up 9 days,  4:26, 5 users, load averages: 1.00, 1.00, 1.00
 
When I was younger, I could remember anything, whether it had happened
or not; but my faculties are decaying now and soon I shall be so I
cannot remember any but the things that never happened.  It is sad to
go to pieces like this but we all have to do it.
-- Mark Twain
 


pgp0.pgp
Description: PGP signature


[PHP] Avoiding blank lines in HTML when field is empty

2003-10-23 Thread Robb Kerr
I'm a PhP /MySQL newbie so please excuse the simple question. I'm returning
results from a MySQL query on a webpage. My code includes...

td valign=top
  ?php echo $row_rsVandyDivAddresses['First_Name']; ? ?php echo
$row_rsVandyDivAddresses['Last_Name'];?, ?php echo
$row_rsVandyDivAddresses['Degree']; ?
  br
  ?php echo $row_rsVandyDivAddresses['Address']; ?
  br
  ?php echo $row_rsVandyDivAddresses['City']; ?, ?php echo
$row_rsVandyDivAddresses['State']; ??php echo
$row_rsVandyDivAddresses['Zip']; ?
  br
  Phone: ?php echo $row_rsVandyDivAddresses['Phone']; ?
  br
  Email: ?php echo $row_rsVandyDivAddresses['Email']; ?
/td

Here's the problem. Some of the fields are empty (for instance 'Address')
and the way my code is configured a blank line appears in the returned data
when the field is empty. How do I change this code to add a conditional that
only echos the field contents AND the br when the field is NOT empty?

I've tried...

  ?php if (!empty($row_rsVandyDivAddresses['Address']) echo
$row_rsVandyDivAddresses['Address']); ?

but don't know how to include the line break br in the if statement.

Any help is greatly appreciated,
Robb

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



Re: [PHP] Avoiding blank lines in HTML when field is empty

2003-10-23 Thread Chris Shiflett
--- Robb Kerr [EMAIL PROTECTED] wrote:
 Here's the problem. Some of the fields are empty (for instance
 'Address') and the way my code is configured a blank line appears in
 the returned data when the field is empty. How do I change this code
 to add a conditional that only echos the field contents AND the br
 when the field is NOT empty?

if (!empty($foo))
{
 echo $foo . 'br /';
}

Hope that helps.

Chris

=
My Blog
 http://shiflett.org/
HTTP Developer's Handbook
 http://httphandbook.org/
RAMP Training Courses
 http://www.nyphp.org/ramp

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



Re: [PHP] Avoiding blank lines in HTML when field is empty

2003-10-23 Thread Jordan S. Jones
Robb,

You pretty much have it.. Here is what you will most likely want:

?php
if (!empty($row_rsVandyDivAddresses['Address'])  strlen (trim ($row_rsVandyDivAddresses['Address']))  0)
{
	echo $row_rsVandyDivAddresses['Address']) . 'br'; 
}
?

Feel free to format as you wish.

Jordan S. Jones



Robb Kerr wrote:

I'm a PhP /MySQL newbie so please excuse the simple question. I'm returning
results from a MySQL query on a webpage. My code includes...
 

[snip]

I've tried...

 ?php if (!empty($row_rsVandyDivAddresses['Address']) echo
$row_rsVandyDivAddresses['Address']); ?
but don't know how to include the line break br in the if statement.

Any help is greatly appreciated,
Robb
 

--
I am nothing but a poor boy. Please Donate..
https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jonesno_note=1tax=0currency_code=USD
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


  1   2   >