[PHP] Enabling MySQL support Problemmmmm!!!!

2005-03-29 Thread wan nordiana Wan Abd Kadir
Hello,

I am having problem with enabling MySQL Support. I am using PHP 5 and mysql 
4.3.1

The problem is that when I start my PHP info page, PHP
module gives me an error: "PHP Startup: Unable to load
dynamic library '...' - The specified module could not
be found". BUT THEY ARE!!! A part of my php.ini file
is:

;Windows Extensions
;Note that ODBC support is built in, so no dll is needed for it.
;
;extension=php_bz2.dll
;extension=php_cpdf.dll
;extension=php_curl.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_dbx.dll
;extension=php_exif.dll
;extension=php_fdf.dll
;extension=php_filepro.dll
;extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_ifx.dll
;extension=php_iisfunc.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_java.dll
;extension=php_ldap.dll
;extension=php_mbstring.dll
;extension=php_mcrypt.dll
;extension=php_mhash.dll
;extension=php_mime_magic.dll
;extension=php_ming.dll
;extension=php_mssql.dll
;extension=php_msql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll
;extension=php_openssl.dll
;extension=php_oracle.dll
;extension=php_pdf.dll
;extension=php_pgsql.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
;extension=php_sockets.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
;extension=php_w32api.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
;extension=php_yaz.dll
;extension=php_zip.dll

The one without ; line is the one that the PHP could not find suach as 
php_mysql.dll
in my C:\PHP folder should i have those file? because when i check in the 
folder, i do not have any file named php_mysql.dll. and also should i have the 
ext folder in there? Pleas help me.



-
Do you Yahoo!?
 Yahoo! Small Business - Try our new resources site! 

Re: [PHP] PHP 5 Strings are References?!

2005-03-29 Thread Chris
Richard Lynch wrote:

On Tue, March 29, 2005 7:58 pm, Chris said:
 

Richard Lynch wrote:
   

Aha!
Okay, here's the previous session question boiled down to its simplest:
\n";
?>
Now, hit this page, re-load it, and what do *YOU* expect
$_SESSION['name']
to output?
A) 'Richard Lynch', because you never re-assigned $_SESSION['name']
B) 'Fooey' because $name is a reference, and you changed it, so that
changed your session data.
*I* expected A)
Alas, the reality is B)
G.  I do *NOT* want all my strings to suddenly turn into
pointers.
If I wanted that kind of headache, I'd be coding in C! :-)
I should have known this from the get-go, when I saw & in my session data
with var_dump($_SESSION);  *WHY* are strings suddenly turning into
references?  They're *NOT* objects!
I'm about to go re-read the PHP 5 sections of the manual with a
fine-tooth
comb to see if I just missed this as an upgrade issue.
It's pretty much going to break a hell of a lot of scripts, that's for
sure.
Somebody please tell me this is a Bug, not a "Feature"
PHP 5.0.3
FreeBSD 5.3-RELEASE

 

Are you sure you don't have register_globals enabled?
   

Actually, they *ARE* enabled by my webhost.
I don't really think that's relevant, however, as PHP is storing $name
back *IN* to my $_SESSION data, just because I did:
$name = $_SESSION['name'];
$name = "Fooey";
$name is a STRING.
It's not an object.
It should *NOT* be a Reference!
But it is a Reference, so changing $name alters $_SESSION['name']
 

Sorry, meant to reply to list, not just you.
All I'm saying is that Sessions act extremely oddly with 
register_globals enabled.

With register_globals on I believe the global variable, acts as a 
reference. It's not because it's a string, it's because it's a session 
variable, and it needs to keep track of changes to the variable.

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


RE: [PHP] Re: ISO encoding of subject in mail?

2005-03-29 Thread Kim Madsen

> -Original Message-
> From: M. Sokolewicz [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 29, 2005 6:09 PM

> convert it to quoted-printable using eg. imap_8bit()

That seems to be, what I want _but_ NO PHP is printed after I call this 
function. I turns out that we haven´t got PHP compiled with imap support and 
the setup shows no errors as default (never worked with that, it confused me a 
lot :-)

/kim

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



Re: [PHP] Re: ISO encoding of subject in mail?

2005-03-29 Thread Lars B. Jensen
  i vaguely recall some new (aka 5.04) functions added to the mbstring
extension to handle this.
Hmm... I´m programming on a platform with 4.3.10, so that won´t work for 
me. Might just create my own function since it´s 6 chars that needs to be 
converted...
beware of biting dog when proceeding with mbstring functions, as some is 
buggy for some languages (in my case Japanese)

--
Lars B. Jensen, Internet Architect
CareerCross Japan
Japan's premier online career resource for english speaking professionals
http://www.careercross.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Re: ISO encoding of subject in mail?

2005-03-29 Thread Kim Madsen

> -Original Message-
> From: l0t3k [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 30, 2005 7:07 AM

> Kim,
>   i vaguely recall some new (aka 5.04) functions added to the mbstring
> extension to handle this.

Hmm... I´m programming on a platform with 4.3.10, so that won´t work for me. 
Might just create my own function since it´s 6 chars that needs to be 
converted... 
 
> BTW, are you _the_ Kim Madsen of TKBMMemtable fame ?

Hehe, I doubt that since I have NO clue what the heck You´re talking about :-)

/Kim

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



Re: [PHP] HTTP RAW CONETNE question

2005-03-29 Thread Burhan Khalid
牛坤 wrote:
> Dear php users,
> 
> I've been working on a project which needs to get the raw post content from 
> the http request.
> Unfortunately,I can't get the content with $HTTP_RAW_POST_DATA variable.
> My php version is 4.2.2. My OS is rh linux9.0. And I've turned the global 
> variable tag.
> Any hints would be appreciated.

Any reason that you haven't upgraded? Lots of improvement in PHP since 4.2.2

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




Re: [PHP] NEWBIE: Can't Get My Loop Going. . .

2005-03-29 Thread Colin Ross
i was thinkin in more general term too, what about:
$data =& readfile($file);   /// etc, etc, etc

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



[PHP] HTTP RAW CONETNE question

2005-03-29 Thread 牛坤

Dear php users,

I've been working on a project which needs to get the raw post content from the 
http request.
Unfortunately,I can't get the content with $HTTP_RAW_POST_DATA variable.
My php version is 4.2.2. My OS is rh linux9.0. And I've turned the global 
variable tag.
Any hints would be appreciated.

Regards,


Sincerely,
Kun

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



[PHP] Re: filtering uploaded files

2005-03-29 Thread Richard Lynch
On Tue, March 29, 2005 2:04 pm, A. S. Milnes said:
> On Tue, 2005-03-29 at 22:23, Richard Lynch wrote:
>> > //The mime type of the file, if the browser provided this information.
>> > $userfile_type=$_FILES['userfile']['type'];
>>
>> Nooo!
>
> Hmm  - some very senior people disagree with you!

Please reference their publications, if possible.

It's just plain BAD security to trust this value for any real-world usage.

And it's made meaningless by the browsers not standardizing what they send
anyway.

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

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



RE: [PHP] HTML meta tag and PHP

2005-03-29 Thread Richard Lynch
On Tue, March 29, 2005 2:51 pm, Pablo Gosse said:
> 
> How can I write something like that?
>  content="0;url=registration.php?step=4&userId="<%php echo
> trim($_POST["userid"]); ">
>
> This is obviously not working as the " is assumed as the closing " for
> the
> meta tag.
> 
>
> Sorry, I botched my previous reply and left the extra " after userId.
> It should be:
>
>  content="0; url=registration.php?step=4&userId=<%php echo
> trim($_POST["userid"]); %> ">

http://php.net/types.string

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

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



Re: [PHP] HELP , HELP ,HELP

2005-03-29 Thread Richard Lynch
On Tue, March 29, 2005 4:49 pm, wangchq said:
>  if(eregi("^\$[0-9]+\,[0-9]+\.[0-9]+",$set,$account)){

For starters:

PHP use \ as an escape character for $ inside of ""
Regex uses \ as an escape character for $ as a literal rather than
line-end character.

So your \$ should be \\\$, because PHP will "eat" the \\ and turn that
into \ and then PHP will "eat" the \$ and turn that into $, and then
you'll be passing \$ to Regex.

As it stands now, your Regular expression is:
^$[0-9+...
which is basically an invalid expression, as it has a bunch of crap
trailing after the new-line ($) symbol.

Disclaimer:  I'm *NOT* good at Regex.

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

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



[PHP] PHP 5 Strings are References?!

2005-03-29 Thread Richard Lynch
Aha!

Okay, here's the previous session question boiled down to its simplest:

\n";
?>

Now, hit this page, re-load it, and what do *YOU* expect $_SESSION['name']
to output?

A) 'Richard Lynch', because you never re-assigned $_SESSION['name']
B) 'Fooey' because $name is a reference, and you changed it, so that
changed your session data.

*I* expected A)
Alas, the reality is B)

G.  I do *NOT* want all my strings to suddenly turn into pointers.
 If I wanted that kind of headache, I'd be coding in C! :-)

I should have known this from the get-go, when I saw & in my session data
with var_dump($_SESSION);  *WHY* are strings suddenly turning into
references?  They're *NOT* objects!

I'm about to go re-read the PHP 5 sections of the manual with a fine-tooth
comb to see if I just missed this as an upgrade issue.

It's pretty much going to break a hell of a lot of scripts, that's for sure.

Somebody please tell me this is a Bug, not a "Feature"

PHP 5.0.3
FreeBSD 5.3-RELEASE

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

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



[PHP] URL restriction on XML file

2005-03-29 Thread Roger Thomas
I have a short script to parse my XML file. The parsing produces no error and 
all output looks good EXCEPT url-links were truncated IF it contain the '&' 
characters.

My XML file looks like this:
--- start of XML ---



Test News .Net - Newspapers on the Net
Small News Network.com
http://www.example.com/
Continuously updating Example News.
en-us
Tue, 29 Mar 2005 18:01:01 -0600
Tue, 29 Mar 2005 18:01:01 -0600
30

Group buys SunGard for US$10.4bil
http://feeds.example.com/?rid=318045f7e13e0b66&cat=48cba686fe041718&f=1
NEW YORK: A group of seven private equity investment firms agreed 
yesterday to buy financial technology company SunGard Data Systems Inc in a 
deal worth US$10.4bil plus debt, making it the biggest lev...
http://biz.theexample.com/";>The Paper


Strong quake hits Indonesia coast
http://feeds.example.com/news/world/quake.html
a "widely destructive tsunami" and the quake was felt as 
far away as Malaysia.
http://biz.theexample.com.net/";>The Paper


Final News
http://feeds.example.com/?id=abcdef&cat=somecat
We are going to expect something new this weekend ...
http://biz.theexample.com/";>The Paper



--- end of XML ---

For the sake of testing, my script only print out the url-link to those news 
above. I got these:
f=1
http://feeds.example.com/news/world/quake.html
cat=somecat

The output for line 1 is truncated to 'f=1' and the output of line 3 is 
truncated to 'cat=somecat'. ie, the script only took the last parameter of the 
url-link. The output for line 2 is correct since it has NO parameters.

I am not sure what I have done wrong in my script. Is it bcos the RSS spec says 
that you cannot have parameters in URL ? Please advise.

-- start of script --
$TITLE";
 print "$URL"."";
 break;
}
   $currentTag = "";
}

function characterData($parser, $data) {
global $currentTag, $TITLE, $URL, $start;

switch ($currentTag) {
case "ITEM":
$start = 1;
case "TITLE":
   $TITLE = $data;
   break;
case "LINK":
$URL = $data;
break;
}
}

$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");

if (!($fp = fopen($file, "r"))) {
die("Cannot locate XML data file: $file");
}

while ($data = fread($fp, 4096)) {
if (!xml_parse($xml_parser, $data, feof($fp))) {
die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
}

xml_parser_free($xml_parser);

?>
-- end of script --

TIA.
Roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

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



Re: [PHP] Include file

2005-03-29 Thread James Pancoast
Try it with double quotes instead:

include( "../includes/$include" );

That way works for me.

And I also hope you're cleansing or filtering $include in some way.


On Tue, 29 Mar 2005 19:41:15 -0600, Marquez Design
<[EMAIL PROTECTED]> wrote:
> Does anyone know how to include a variable page? The variable is a page
> name. Such as "inluded_file.html"
> 
> Include ('../includes/$include');
> 
> Does not seem to work.
> 
> Thanks!
> 
> --
> Steve
> 
> --
> 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] Include file

2005-03-29 Thread Richard Davey
Hello Marquez,

Wednesday, March 30, 2005, 2:41:15 AM, you wrote:

MD> Does anyone know how to include a variable page? The variable is a page
MD> name. Such as "inluded_file.html"

MD> Include ('../includes/$include');

MD> Does not seem to work.

You cannot use variables inside single quotes. Try this:

include "../includes/$include";

Same goes for anything in PHP, i.e.:

$test = "apple";
$word1 = "eat the $test";
$word2 = 'eat the $test';

Try this and see the difference the quotes make.

Best regards,

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

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



[PHP] çå: [PHP] HELP , HELP ,HELP

2005-03-29 Thread wangchq


-éäåä-
åää: Chris W. Parker [mailto:[EMAIL PROTECTED] 
åéæé: 2005å3æ30æ 9:36
æää: php-general@lists.php.net
äé: FW: [PHP] HELP , HELP ,HELP

Wangchq,

Please send all responses to the public mailing list.

What we need to know from you is what $set is and what data it contains. 
Otherwise there's no way to tell why it's not matching.



Chris.

-Original Message-
From: wangchq [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 29, 2005 5:23 PM
To: Chris W. Parker
Subject: ??: [PHP] HELP , HELP ,HELP




-éäåä-
åää: Chris W. Parker [mailto:[EMAIL PROTECTED] 
åéæé: 2005å3æ30æ 9:04
æää: wangchq; php-general@lists.php.net
äé: RE: [PHP] HELP , HELP ,HELP

wangchq 
on Tuesday, March 29, 2005 4:50 PM said:

> Hi;

Hello.

> I use this regulation expression to check account(money)type, but it
> does not work.

That's "regular" expression. You were close. :P

>  if(eregi("^\$[0-9]+\,[0-9]+\.[0-9]+",$set,$account)){
> 
> $reg_account=$account[1]; }
> 
>  else $reg_account=-1;

Give some examples of the data you are feeding your regex so we can see
where you are going wrong.



Chris.

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












Hi,
I would be grateful first.
There is nothing on the feedins.it does not work from this segment of the 
programme.
   if(eregi("^\$[0-9]+\,[0-9]+\.[0-9]+",$set,$account)){
$reg_account=$account[1]; }
 else $reg_account=-1;
 if($reg_account==-1){
 echo "not query account\n";}


 if($reg_account<=$row[balance_borderline]){

$mailfrom="[EMAIL PROTECTED]";
$mailto = trim(explode(",",$row[notify_mail]));
$message = 
"ÃÃÂÃÃÂÂÃÂÃÃÃÂÃÃÃÂÃÃÃÂÃÃÃÂÃÂÃÃÃ";
$date = date("YÃÃmÃÃdÃÃ");
$subject = "ÃÂÂÃÂÃÃÃÂÃÂÃÃÃ";



send_email($mailto, $mailfrom, $subject, $message);
  }
else exit();
}
 $row=ifx_fetch_row($result_id, "next");
 checkerr("file:".$prog_name." line:".__LINE__);
 }while(0)
?>



















Hi,
The $set is 
"  Available credit"
"  $62,845.75"
I am thankful for your impatient.

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



[PHP] Include file

2005-03-29 Thread Marquez Design
Does anyone know how to include a variable page? The variable is a page
name. Such as "inluded_file.html"

Include ('../includes/$include');

Does not seem to work.

Thanks!

--
Steve

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



FW: [PHP] HELP , HELP ,HELP

2005-03-29 Thread Chris W. Parker
Wangchq,

Please send all responses to the public mailing list.

What we need to know from you is what $set is and what data it contains. 
Otherwise there's no way to tell why it's not matching.



Chris.

-Original Message-
From: wangchq [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 29, 2005 5:23 PM
To: Chris W. Parker
Subject: ??: [PHP] HELP , HELP ,HELP




-éäåä-
åää: Chris W. Parker [mailto:[EMAIL PROTECTED] 
åéæé: 2005å3æ30æ 9:04
æää: wangchq; php-general@lists.php.net
äé: RE: [PHP] HELP , HELP ,HELP

wangchq 
on Tuesday, March 29, 2005 4:50 PM said:

> Hi;

Hello.

> I use this regulation expression to check account(money)type, but it
> does not work.

That's "regular" expression. You were close. :P

>  if(eregi("^\$[0-9]+\,[0-9]+\.[0-9]+",$set,$account)){
> 
> $reg_account=$account[1]; }
> 
>  else $reg_account=-1;

Give some examples of the data you are feeding your regex so we can see
where you are going wrong.



Chris.

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












Hi,
I would be grateful first.
There is nothing on the feedins.it does not work from this segment of the 
programme.
   if(eregi("^\$[0-9]+\,[0-9]+\.[0-9]+",$set,$account)){
$reg_account=$account[1]; }
 else $reg_account=-1;
 if($reg_account==-1){
 echo "not query account\n";}


 if($reg_account<=$row[balance_borderline]){

$mailfrom="[EMAIL PROTECTED]";
$mailto = trim(explode(",",$row[notify_mail]));
$message = 
"ÃÃÂÃÃÂÂÃÂÃÃÃÂÃÃÃÂÃÃÃÂÃÃÃÂÃÂÃÃÃ";
$date = date("YÃÃmÃÃdÃÃ");
$subject = "ÃÂÂÃÂÃÃÃÂÃÂÃÃÃ";



send_email($mailto, $mailfrom, $subject, $message);
  }
else exit();
}
 $row=ifx_fetch_row($result_id, "next");
 checkerr("file:".$prog_name." line:".__LINE__);
 }while(0)
?>



RE: [PHP] HELP , HELP ,HELP

2005-03-29 Thread Chris W. Parker
wangchq 
on Tuesday, March 29, 2005 4:50 PM said:

> Hi;

Hello.

> I use this regulation expression to check account(money)type, but it
> does not work.

That's "regular" expression. You were close. :P

>  if(eregi("^\$[0-9]+\,[0-9]+\.[0-9]+",$set,$account)){
> 
> $reg_account=$account[1]; }
> 
>  else $reg_account=-1;

Give some examples of the data you are feeding your regex so we can see
where you are going wrong.



Chris.

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



[PHP] HELP , HELP ,HELP

2005-03-29 Thread wangchq
 

Hi;

Would somebody  help me ? I would be appreciate.

I use this regulation expression to check account(money)type, but it does
not work.

 if(eregi("^\$[0-9]+\,[0-9]+\.[0-9]+",$set,$account)){

$reg_account=$account[1]; }

 else $reg_account=-1;

yours,

justin

 



[PHP] Re: Some help on using regex

2005-03-29 Thread Jamie Alessio
Im having a problem matcing some code using preg_match_all. The regex 
statement needs to be very flexiable. The code im using is:

(\n| |.)+
[snip]
-==- Output from socket -==-

http://climateprediction.net/
climateprediction.net
Bob
Why are you trying to parse this data with a regex? It looks like XML 
data to me so you should be able to easily break the data up using PHP's 
XML functions. If you're using PHP5 take a look at 
http://us3.php.net/simplexml and if you're using PHP4 there a number of 
other options but I'm not familiar enough with any of them to give a 
recommendation.

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


RE: [PHP] HTML meta tag and PHP

2005-03-29 Thread Chris W. Parker
david joffrin 
on Tuesday, March 29, 2005 3:51 PM said:

> I tried the following scenario and here is the outcome:
> .../registration.php?step=4&userId=<%php%20trim($_POST[
[snip /]
> Any idea?

 not <%php %> maybe?

0.02
Chris.

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



RE: [PHP] HTML meta tag and PHP

2005-03-29 Thread david joffrin
I tried the following scenario and here is the outcome:
.../registration.php?step=4&userId=<%php%20trim($_POST[
with that line:
 ">

Any idea?
From: "Pablo Gosse" <[EMAIL PROTECTED]>
To: "david joffrin" <[EMAIL PROTECTED]>,
Subject: RE: [PHP] HTML meta tag and PHP
Date: Tue, 29 Mar 2005 14:51:39 -0800

How can I write something like that?

This is obviously not working as the " is assumed as the closing " for
the
meta tag.

Sorry, I botched my previous reply and left the extra " after userId.
It should be:
 ">
Pablo.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: filtering uploaded files

2005-03-29 Thread Josip Dzolonga
You can check this function too : http://www.php.net/mime_content_type . 
It's not platform specific :). Btw, mime_magic extension has to be enabled.

Hope that this helped.
--
Josip Dzolonga
http://josip.dotgeek.org
jdzolonga[at]gmail.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] RE: Best Server OS

2005-03-29 Thread Rory Browne
I'd stick OSX in somewhere between fedora and windows. 

Where do you get these security ratings? How does sendmail, or bind
appear in these ratings?

Some ratings suggest that windows is more secure than Unix!!

You don't need a gui in a server.


On Tue, 29 Mar 2005 11:10:18 -0500, Gerald Artman <[EMAIL PROTECTED]> wrote:
> 
> I would recommend OSX
> 
> Top ratings on security compared to Linux or Windows
> Fast processors in many configurations, most include 1000T
> Starting at $500 to $3500 for up to +15MIPS performance
> Excellent GUI interface
> Supported by Apache, PHP, MySQL and comes pre-installed
> 
> Jerry Artman
> 
> --
> 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] HTML meta tag and PHP

2005-03-29 Thread Pablo Gosse

How can I write something like that?


This is obviously not working as the " is assumed as the closing " for
the 
meta tag.


Sorry, I botched my previous reply and left the extra " after userId.
It should be:

 ">

Pablo.

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



RE: [PHP] HTML meta tag and PHP

2005-03-29 Thread Pablo Gosse

How can I write something like that?


This is obviously not working as the " is assumed as the closing " for
the 
meta tag.


You haven't closed your opening php tag, which is why it's not working.

 ">

Is how it needs to be to work.

HTH,

Pablo

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



[PHP] HTML meta tag and PHP

2005-03-29 Thread david joffrin
Hi,
How can I write something like that?


This is obviously not working as the " is assumed as the closing " for the 
meta tag.

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


RE: [PHP] String format best practice

2005-03-29 Thread Jared Williams
> > I need to output a Hex value, e.g.:
> >
> > 686E8AF8
> >
> > In the following format:
> >
> > 68 6E 8A F8
> >
> > In other words, separated by spaces. Now I realize there 
> are a million 
> > ways to do this, but I would like a suggestion on which you 
> think is 
> > the most efficient? Incidentally, I'm starting with a decimal value 
> > (23602210718), so maybe sprintf would be a direct way?
> 
> sprintf and "most efficient" rarely belong in the same sentence. :-)
> 
> I believe this is going to "win" almost any efficiency test, 
> and is reasonably self-documenting/clear:
> 
> $dec = 23602210718;
> $hex = dechex($dec);
> echo implode(' ', chunk_split($hex, 2));

I presume you meant str_split()

And I think sprintf() is the way togo, it maybe slow, bit it'll be quicker than 
creating arrays, and rejoining.
Not that either method will make a huge difference unless your doing thousands 
of such operations.

echo sprintf('%02x %02x %02x %02x', ($dec >> 24) & 0xff, ($dec >> 16) & 
0xff, ($dec >> 8) & 0xff, $dec & 0xff);

Jared

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




[PHP] Re: filtering uploaded files

2005-03-29 Thread A. S. Milnes
On Tue, 2005-03-29 at 22:23, Richard Lynch wrote:
> > //The mime type of the file, if the browser provided this information.
> > $userfile_type=$_FILES['userfile']['type'];
> 
> Nooo!

Hmm  - some very senior people disagree with you!

> First of all, the browsers do *NOT* provide any kind of standardized MIME
> types.
> 
> One will call it text/x-csv, the other text/csv, the other text/plain, ...

Interesting.

> Now you're probably not gonna be silly enough to just go and exec() that
> script, 

No - of course not - you never trust anything coming from outside - the
above script is a first pass, no more than that.

> but what if they manage to find *another* user on your server who
> does just that?

I don't understand what you mean here - I can't control what scripts
other people write and I can't afford a dedicated server.

> Assume the file you are getting is hostile.

Absolutely.

> Use the Unix "file" command to analyze it.

I come from a Windows background so I've never heard of this command and
it's not featured in any of the (many) PHP books I have read. Probably
becasue it's platform specific.

> Then use your own script to analyze it, and be sure it contains suitable
> data.

Absolutely.

Alan

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



Re: [PHP] String format best practice

2005-03-29 Thread Richard Lynch
On Tue, March 29, 2005 1:27 pm, René Fournier said:
> I need to output a Hex value, e.g.:
>
> 686E8AF8
>
> In the following format:
>
> 68 6E 8A F8
>
> In other words, separated by spaces. Now I realize there are a million
> ways to do this, but I would like a suggestion on which you think is
> the most efficient? Incidentally, I'm starting with a decimal value
> (23602210718), so maybe sprintf would be a direct way?

sprintf and "most efficient" rarely belong in the same sentence. :-)

I believe this is going to "win" almost any efficiency test, and is
reasonably self-documenting/clear:

$dec = 23602210718;
$hex = dechex($dec);
echo implode(' ', chunk_split($hex, 2));

Note that dechex only supports numbers up to 0x

In older PHP versions, I believe the limit was lower than that. 0x7FFF
perhaps, based on the user notes.

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

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



[PHP] Sprintf?

2005-03-29 Thread René Fournier
I need to go from
1754210747 (decimal)
to
17 54 21 a7 47 (hex per character)
Basically, reformat the string for each character, converting it to 
Hex, and spacing after each two characters. Sprintf?

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


Re: [PHP] POST variables from a link...and popup new window

2005-03-29 Thread Richard Lynch
On Tue, March 29, 2005 1:09 pm, james tu said:
> I have a link that, when clicked on, pops up a new window.
> I want to use the POST method in order to pass information. Right now
> I'm appending the parameters to the URL of the link and using GET to
> retrieve the name/value pairs.



You may be able to use onSubmit or something similar to make the new
window be the size/look you want with JavaScript.

There's no PHP involved here, though, so maybe ask on an HTML and/or
JavaScript forum for better answers.

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

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



[PHP] String format best practice

2005-03-29 Thread René Fournier
I need to output a Hex value, e.g.:
686E8AF8
In the following format:
68 6E 8A F8
In other words, separated by spaces. Now I realize there are a million 
ways to do this, but I would like a suggestion on which you think is 
the most efficient? Incidentally, I'm starting with a decimal value 
(23602210718), so maybe sprintf would be a direct way?

...Rene

Best regards,
René Fournier
---
René Fournier
GPS Police.NET
31, 1339 - 40th Ave NE
Calgary, AB  T2E 8N6
Canada
Tel +1 (403) 250.
Fax +1 (403) 291-2997
www.gpspolice.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] filtering uploaded files

2005-03-29 Thread Richard Lynch
> //The mime type of the file, if the browser provided this information.
> $userfile_type=$_FILES['userfile']['type'];

Nooo!

First of all, the browsers do *NOT* provide any kind of standardized MIME
types.

One will call it text/x-csv, the other text/csv, the other text/plain, ...

Furthermore, you should *NOT* rely on this data coming from the browser.

Any body with HALF A CLUE can forge a POST with *any* kind of type they
want, shoving a trojan shell script into your script with a type of
plain/x-csv

Now you're probably not gonna be silly enough to just go and exec() that
script, but what if they manage to find *another* user on your server who
does just that?

Whammo!  You no longer own your server, they do.

Assume the file you are getting is hostile.

Use the Unix "file" command to analyze it.

Then use your own script to analyze it, and be sure it contains suitable
data.

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

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



Re: [PHP] Execute appliction and pass parameters to it!

2005-03-29 Thread Richard Lynch
On Tue, March 29, 2005 10:38 am, Dipesh  Khakhkhar said:
> --
>
> 1)  $output = shell_exec('..\phpunit.bat  C:\Run.php');
> echo $output;

Change shell_exec to exec, and use the extra parameters to get back ERROR
MESSAGES and ERROR CODE.

Print those out, and Windoze should tell you what's wrong.

Don't use '..\phpunit.bat' -- Use a full pathname.

Also don't use \ at all, I don't think...  I *think* PHP will convert / to
the right thing for your OS.  No promises on that part.

If you *DO* use \, you should use \\, even inside '', just case your
filename ever has a ' in it or you ever need to use variables, switch to
"", and suddenly it "doesn't work" because now \n isn't what it once was.

> 3) $firstArg = "C:\\..\\..\\Run.php";
> $output = exec("C:\\..\\..\\phpunit.bat  $firstArg");
>
> Result: Still nothing is happening.
>
> 4)$output = exec("C:\\..\\..\\phpunit.bat  $firstArg 2>&1", $myOut);
> echo "My out value is ".$myOut;
> Result: My out value is Array operable program or batch file.

echo "My out value is ", implode("", $myOut);

Also add $myError argument, and do:
if ($myError) echo "OS Error: $myError\n";


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

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



Re: [PHP] POST variables from a link...and popup new window

2005-03-29 Thread John Nichel
james tu wrote:
Hi:
I have a link that, when clicked on, pops up a new window.
I want to use the POST method in order to pass information. Right now 
I'm appending the parameters to the URL of the link and using GET to 
retrieve the name/value pairs.

Is there a way to do this?
Yes.
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] POST variables from a link...and popup new window

2005-03-29 Thread james tu
Hi:
I have a link that, when clicked on, pops up a new window.
I want to use the POST method in order to pass information. Right now 
I'm appending the parameters to the URL of the link and using GET to 
retrieve the name/value pairs.

Is there a way to do this?
--
-James
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] filesize() Returns a file size. What will return a directorysize()???

2005-03-29 Thread Dotan Cohen
On Tue, 29 Mar 2005 08:51:49 -0800, Lupita <[EMAIL PROTECTED]> wrote:
> Yes it is on a Linux system.
> I have done a little research and I am having a hard time finding info about
> executing shell commands with php.
> This seems like a very interesting possibility being able to use shell
> commands. Any info you could point me to would be very appreciated.
> I did find this piece of code that doesn't work for me. Maybe it is missing
> something?
>  $mstrng = shell_exec('du -sc home/joeuser/www/testdir/');
> print "$mstrng";
> ?>
> It produces "0 total" and I know there is more then 11 kb of file in the
> directory.
> I tried it pointed directly at the file in the directory and I also tried
> the "du -h".
> Thank you so much for your response.
> 
> "Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> [snip]
> I have been looking for a solution to get the disk size of a directory.
> I would like to be able to get the size of a directory with sub
> directories
> under it.
> Will I need to loop through file sizes to get the total directory size?
> [/snip]
> 
> If you are on a *nix system of some sort you could exec du -h
> 
> --

You would be much better off looping through the files. I avoid
shellwrapping for many reasons, not the least of which is security.

Dotan Cohen

http://English-Lyrics.com/
http://Song-Lirics.com/

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



Re: [PHP] xml question

2005-03-29 Thread Marek Kilimajer
Jeremy Reynolds wrote:
I'm new to XML.  I'm just now learning about XML tags and how an XML 
Style Sheet can be used to "filter" or "format" the data.  Something 
missing in my mind is how to "submit" the XML to the XSLT though.  If 
the XML page contained a path to the XSLT page, that would make sense.  
But I haven't run across anything like that so far.  How does that work?

Jeremy
Read the examples in http://www.php.net/xslt_process
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: ISO encoding of subject in mail?

2005-03-29 Thread Manuel Lemos
Hello,
on 03/29/2005 10:55 AM Kim Madsen said the following:
> I´d like to encode the subject in mails generated and sent by PHP, so 
Danish letters like æ,ø and å can be used too... like this:
>
> Subject: Problemer med =?ISO-8859-1?Q?f=E6llesdrev_m=2Em=2E?=

That is q-encoding. PHP has a function for encoding as quoted-printable 
but it is not exactly the same thing.

You may want to try this class that comes with support to encode headers 
 with q-encoding and it comes with an example to demonstrate that:

http://www.phpclasses.org/mimemessage
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] xml question

2005-03-29 Thread Jeremy Reynolds
I'm new to XML.  I'm just now learning about XML tags and how an XML 
Style Sheet can be used to "filter" or "format" the data.  Something 
missing in my mind is how to "submit" the XML to the XSLT though.  If 
the XML page contained a path to the XSLT page, that would make 
sense.  But I haven't run across anything like that so far.  How does 
that work?

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


[PHP] Execute appliction and pass parameters to it!

2005-03-29 Thread Dipesh Khakhkhar
  
Hi,

I am trying to execute one application (bat file) and need to pass parameter to 
it. I want to put this into wrapper file which i can call over http. Can i do 
this?

I tried the following:

--

1)  $output = shell_exec('..\phpunit.bat  C:\Run.php');
echo $output;

Result: No output. Nothing happened.

2)  $cmd = '..\..\phpunit.bat';

// Setup an array of arguments to be sent.
$arg[] = "..\..\Run.php";

// Pick a place for the temp_file to be placed.
$outputfile = '..\..\CMDOUT.txt';

// Setup the command to run from "run"
$cmdline = "cmd /C $cmd " . implode(' ', $arg) ;

try
{
echo "Came in try";
$WshShell = new COM("WScript.Shell");  
$oExec = $WshShell->Run($cmdline, 3, true);

echo $oExec; // This is not getting printed.
echo "Coming out of try";
}
 catch(Exception $e)
{
echo "came in catch";
print("Caught Exception in " .
$e->file() . " on line " .
$e->line() . "\n");
}
Result: Nothing is happening. It is printing both the statements in the try 
block.

3) $firstArg = "C:\\..\\..\\Run.php";
$output = exec("C:\\..\\..\\phpunit.bat  $firstArg"); 

Result: Still nothing is happening.

4)$output = exec("C:\\..\\..\\phpunit.bat  $firstArg 2>&1", $myOut);
echo "My out value is ".$myOut;
Result: My out value is Array operable program or batch file.

--

All the above approaches not working for me.
Can somebody inform me where i need to make changes.
Thanks in advance.
Regards,

Dipesh



Re: [PHP] Remove duplicate values in an array

2005-03-29 Thread Marek Kilimajer
Alexandru Martin wrote:
   How can I remove duplicate values from an array ?
array_unique()
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] filtering uploaded files

2005-03-29 Thread Marek Kilimajer
Cima wrote:
hi,
id like to know if there is a way to filter or specify what type of files id 
like uploaded to my server. for example, if i make a form to upload image 
files, when i click browse there are 2 fields one that'll store the file 
name(of the file selected) and the other filetype (usually say all types) what 
id like is to specify in file type : *.jpg,*gif etc. is this possible?
thanx.
Another reply :)
You can use javascript to find out the extension from 
form.elements['fileinput'].value, and check it against a list of allowed 
extensions.

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


[PHP] Remove duplicate values in an array

2005-03-29 Thread Alexandru Martin
   How can I remove duplicate values from an array ?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] filtering uploaded files

2005-03-29 Thread Marek Kilimajer
Cima wrote:
hi,
id like to know if there is a way to filter or specify what type of files id 
like uploaded to my server. for example, if i make a form to upload image 
files, when i click browse there are 2 fields one that'll store the file 
name(of the file selected) and the other filetype (usually say all types) what 
id like is to specify in file type : *.jpg,*gif etc. is this possible?
thanx.
You can use accept atribute of  element. I'm not sure why it's a 
form atribute, if it was part  would be better. But I 
don't know of any browser respecting this.

accept = content-type-list [CI]
This attribute specifies a comma-separated list of content types 
that a server processing this form will handle correctly. User agents 
may use this information to filter out non-conforming files when 
prompting a user to select files to be sent to the server (cf. the INPUT 
element when type="file").

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


Re: [PHP] Session data disappearing?

2005-03-29 Thread Richard Lynch
On Tue, March 29, 2005 2:52 am, Colin Ross said:
> a couple points on your code...
>
> if something makes it to the session scope, $_SESSION[], it should be
> valid/verified, so why copy them all to a global var? i.e.
> $name = $_SESSION['name'];

I don't want to litter my later code with $_SESSION['name'], basically.
[shrug]

I'm still used to the old register_globals being "ON" so I basically
import the variables I want to use from there they should come from, and
add scrubbing after the logic is right.

I'll be wiping the database and starting fresh from my SQL script after
that, so an SQL injection over the next couple days won't do much.

> why not just type true instead of a var that gets looked up everytime.
> $valid = true;
> secondly... any auth scheme using something like if
> ($_SESSION['valid_user']) is not very strong, and prolly has a big
> hole somewhere...  ie.
>
> // $_REQUEST, i.e anything a user can type in the url
> $username = $_REQUEST['username'];
> $password = $_REQUEST['password'];
> $query = "select client_id, password = password('$password'),
> name, access from client where username = '$username'";
> // this is beggin for a sql injection attack here (although you may
> have magic quotes on, which i don't suggest... do you own escaping...)

Magic quotes is on.

I'll add more scrubbing later.

> // check your SQL syntax, i'd be suprised if that runs like that... should
> be:
> $query = "SELECT client_id, password, name, access FROM `client` WHERE
> `username` = '$username' AND `password` = password($password)";

The SQL is correct, and works just fine.

> 
> -- just use an external style sheet with either an @import or 

No, thank you.

I don't trust browsers to cache or not cache style sheets correctly, nor
do I feel the need for the extra HTTP connection to get the style sheet.

> 
> -- avoid short open tags, and use a semicolon after every statement
> i.e.
> 

Again, I don't care about short open tags not being ON on your server. 
They're on for mine, and always will be, and this code is not intended to
ever be ported anywhere.

The semi-colon is optional -- That is a documented feature.

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

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



Re: [PHP] Any personal experience with MySQL/Calendar application

2005-03-29 Thread tg-php
Made one myself that I thought was pretty good at the time (one of my first PHP 
projects) but as I learned more about PHP, I see that I did things the hard 
way, so it's in bad need of updating.

If you wanted the source to play with as a starting point, I could probably 
through that together for ya.

A badly broken (the MySQL database isn't set up) copy is found here:
http://www.gryffyndevelopment.com/furry/calendar/

When there are events, it shows an icon on that day that you can click on 
that'll bring up a popup window with details for the event.

Again, it was one of my first PHP projects and is BADLY in need of updating, 
but it does basicly what you were looking for I think.

-TG


= = = Original message = = =

I am looking for an open source calendar program that uses MySQL to 
store the data and has an online Admin feature.  Rather than trying the 
many that are listed, I am hoping that someone may have some personal 
experience with a application of this type and make a recommendation.

Todd


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



Re: [PHP] calling stored procedures from php

2005-03-29 Thread Marek Kilimajer
Cima wrote:
hi ,
i have a stored procedure in postgresql and id like to call it or execute it from php. how do call this stored procedure with its variables or parameters?
Like any other query, using pg_query()
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] filtering uploaded files

2005-03-29 Thread A. S. Milnes
On Tue, 2005-03-29 at 21:59, Cima wrote:
> hi,
> 
> id like to know if there is a way to filter or specify what type of files id 
> like uploaded to my server. for example, if i make a form to upload image 
> files, when i click browse there are 2 fields one that'll store the file 
> name(of the file selected) and the other filetype (usually say all types) 
> what id like is to specify in file type : *.jpg,*gif etc. is this possible?

Here's an snippet that should help you on the way - although people can
fool about with filetypes so be careful.

//The mime type of the file, if the browser provided this information. 
$userfile_type=$_FILES['userfile']['type'];

switch ($userfile_type) 
{
case "text/x-csv" : 
echo "\nFile is in CSV format."; 
break;

default : // code to do something;
echo "\nProblem: file is not in correct format.";
exit;
}


Alan

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



Re: [PHP] Session data disappearing?

2005-03-29 Thread Richard Lynch
On Tue, March 29, 2005 3:06 am, Colin Ross said:
> In edit_schedule.phps:
>
> if (isset($_POST['add_available'])){
> $year = $_POST['year'];
> $year = $year['NULL'];
> $month = $_POST['month'];
> $month = $month['NULL'];
> $day = $_POST['day'];
> $day = $day['NULL'];
> $time = $_POST['time'];
> $time = $time['NULL'];
> ...
> }
> after this is done..
> $year, $month, $day, and $time should all be arrays with a single
> 'null' (not the keyword null though) item with no value. ie.
> array(NULL=>);

No.

> what ARE you trying to do, you are making the POST vars global:
> $day = $_POST['day'];
> OK. (why do you even need to do this? whatever, matter of taste i guess..)
> But then you over write their values, making them arrays with that
> single element 'NULL'
> $day = $day['NULL'];
> Not seeing the logic here...

All of those $_POST elements *ARE* arrays because the HTML has
NAME="year[...]"

For pre-existing slots, they have a valid slot_id in the array index.

For the one NEW item to be inserted, I used the key [NULL] which in HTTP
turns into 'NULL' as an index into the array.

In other words, if there were 3 pre-exsiting slots, and the user fills in
the "NEW" date to add, and I did:
var_dump($_POST['date']);
I'd get something not unlike:
array('1'=>'2005-04-01', '2'=>'2005-04-04', '3'=>'2005-04-05',
'NULL'=>'2005-04-06');

Thus, $year = $_POST['year']; gets me the whole array, and then $year =
$year['NULL'] gets me the NEW year they are asking me to insert.

I dunno why this seemed so confusing, but it makes perfect sense to me.
[shrug]

> Overall, and not to mean offence, but your code is kinda sloppy and
> has syntax and logic errors.
>
> TAKEN' : '')?>
> SHOULD be erroring up (if you have errors turned on, please say you do
> for development)
> try:
> TAKEN'; ?>
>
> and btw, the short conditional syntax is:
> (condition) ? true : false;
> // ie. (note the empty string... you gotta have SOMETHING there
> [right?i think so]
> echo ($taken) ? 'TAKEN' : '' ;

Yes, http://l-i-e.com/artists.htm

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



Re: [PHP] Any personal experience with MySQL/Calendar application

2005-03-29 Thread Joe Harman
Hey Todd... I have one that I created and posted at Zend.com ... it
can be easily adapted to store data n MySQL...

Joe


On Tue, 29 Mar 2005 12:33:12 -0500, Peter G. Brown
<[EMAIL PROTECTED]> wrote:
> I have used egroupware in a company setting and found it to be largely
> satisfactory. It might be overkill in your case but you can restrict
> module access.
> 
> www.egroupware.org
> 
> HTH
> Peter Brown
> 
> Todd Cary wrote:
> > I am looking for an open source calendar program that uses MySQL to
> > store the data and has an online Admin feature.  Rather than trying the
> > many that are listed, I am hoping that someone may have some personal
> > experience with a application of this type and make a recommendation.
> >
> > Todd
> >
> 
> --
> 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] Any personal experience with MySQL/Calendar application

2005-03-29 Thread Peter G. Brown
I have used egroupware in a company setting and found it to be largely 
satisfactory. It might be overkill in your case but you can restrict 
module access.

www.egroupware.org
HTH
Peter Brown
Todd Cary wrote:
I am looking for an open source calendar program that uses MySQL to 
store the data and has an online Admin feature.  Rather than trying the 
many that are listed, I am hoping that someone may have some personal 
experience with a application of this type and make a recommendation.

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


[PHP] filtering uploaded files

2005-03-29 Thread Cima
hi,

id like to know if there is a way to filter or specify what type of files id 
like uploaded to my server. for example, if i make a form to upload image 
files, when i click browse there are 2 fields one that'll store the file 
name(of the file selected) and the other filetype (usually say all types) what 
id like is to specify in file type : *.jpg,*gif etc. is this possible?

thanx.

Re: [PHP] Storing data structires in DB

2005-03-29 Thread GamblerZG
> You are looking for serialize here. I bet you'd be better off with an
> existing XML format for something like this though.
WDDX is an unusual extension for most of the hosting providers. And 
writing my own XML serialization mechanism is an overkill. Moreover, XML 
is not-compact, harder to edit and probably slower to parse.

Compare this:

3.1415926
AustinNovato
Seattle
(taken from php manual)
to this
a:2:{i:0;d:3.141592606840537025709636509418487548828125;i:1;a:3:{i:0;s:6:"Austin";i:1;s:6:"Novato";i:2;s:6:"Seattle";}}
(Number is given exactly as it was output by serialize. What a happy 
coincidence.)

and to this
array(3.1415926,array('Austin','Novato','Seattle'))
(which could be reduced even more by elliminating the outer array() 
statement)

I'm surprised that there is no way to safely serialize and unserialize 
things using the same syntax as PHP itself uses. I can, of course, write 
PHP data structure parser in PHP, but that's twisted way of doing  it, 
and it will be *slow*.

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


[PHP] calling stored procedures from php

2005-03-29 Thread Cima
hi ,

i have a stored procedure in postgresql and id like to call it or execute it 
from php. how do call this stored procedure with its variables or parameters?

thanx

Re: [PHP] filesize() Returns a file size. What will return a directorysize()???

2005-03-29 Thread Lupita
Yes it is on a Linux system.
I have done a little research and I am having a hard time finding info about 
executing shell commands with php.
This seems like a very interesting possibility being able to use shell 
commands. Any info you could point me to would be very appreciated.
I did find this piece of code that doesn't work for me. Maybe it is missing 
something?

It produces "0 total" and I know there is more then 11 kb of file in the 
directory.
I tried it pointed directly at the file in the directory and I also tried 
the "du -h".
Thank you so much for your response.

"Jay Blanchard" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
[snip]
I have been looking for a solution to get the disk size of a directory.
I would like to be able to get the size of a directory with sub
directories
under it.
Will I need to loop through file sizes to get the total directory size?
[/snip]

If you are on a *nix system of some sort you could exec du -h 

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



[PHP] Re: phpDocumentor usage (specifically changelog capability?)

2005-03-29 Thread Elizabeth Smith
[EMAIL PROTECTED] wrote:
I didn't see a specific mailing list for phpDocumentor and wanted to get a 
general feel for people's experiances with it.  I see that Zend Studio 4 
supports it internally and I'd really like to get our group over to a 
standardized documentation scheme (and in the process, make use of what looks 
like a great auto-documentor).
Our documentation needs aren't extensive, so I think I got enough of a feel for 
phpDocumentor to do what we want to do, but one thing I don't see that would be 
really nice is the ability to do some kind of changelog type thing on at least 
pages if not individual functions and such.
Our current documentation is structured like this:
  /
  ** File Name:   FileName.php
  ** Description: Some Desc
  **
  ** Written By:  Trevor Gryffyn
  **
  ** Modification Log:
  ** --
  ** Created: Trevor Gryffyn - 11/06/2004
  ** Modified:Trevor Gryffyn - 11/07/2004 - Added new function
  /
Under phpDocutmentor, that might become something like:
/**
* Some short description
*
* Some longer description that spans
* a couple of lines   
*
* @author Trevor Gryffyn <[EMAIL PROTECTED]>
*
* @category Miscellaneous Functions
*
* @example SomeFunction($somevar)
*
* Modification Log:
* --
* Created: Trevor Gryffyn - 11/06/2004
* Modified:Trevor Gryffyn - 11/07/2004 - Added new function
*
*/

In this case, I'm not sure what phpDocumentor would do with the 
Modification Log or if there's a way to do something like this with 
phpDocumentor.
Any thoughts on how I can do this the 'right' way and possibly do some kind of 
changelog for pages and/or individual functions would be greatly appreciated.
Thanks in advance!
-TG
___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
phpDocumentor is a seperate project from php and has serveral mailing 
lists http://sourceforge.net/mail/?group_id=11194 and even forums 
http://sourceforge.net/forum/?group_id=11194 where you can get answers 
to your questions - check out http://phpdoc.org for more information. 
php.general is not the place for questions about specific scripts

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


Re: [PHP] How to sort that array?

2005-03-29 Thread Merlin
hmm.. I am not sure if JS is the best sollution for that. I am pretty sure that 
there is a way with php for that.

The basic problem comes down to not be able to sort an array customized.
Lets take this array as an example:
$code[language]= array("1"=> "php", "2"=> "asp");
There must for sure be a way to pull the values out of that array by "first in 
first out".

I am stuck with this, but it seems logical that there is a way around it.
Thank you for any help on that problem,
Merlin
Colin Ross wrote:
What I did in a situation like this (much more complicated though,
with nested select boxes in a form) was use a database, and then
created a php-created javascript file.
The javascript file was buffered, and then cached (saved to a file)
with a timestamp...
So, I can limit the amount of times the WHOLE SCRIPT is run , say once
every 24 hours at most. Also, If i just updated it, I can delete the
cached version, and a new one is made.
Sure, the script is slow... but page loads are fast becuase (unless
its NEEDED) all thats to be processed is a file-read call and such...
not (potentially) hundreds of DB queries.
If you want I can post an example... let me know.
Colin
On Tue, 29 Mar 2005 11:59:23 +0200, Merlin <[EMAIL PROTECTED]> wrote:
Hi there,
I would like to save some db power by putting values into a file which are often
used. They basicly populate a select field.
So I placed those values into associative arrays:
$code[language]= array("1"=> "php", "2"=> "asp");
Now I would like to sort those for displaying after my preference, not by lets
say alphabet. The easiest thing I could think of, is just to move the entry:
$code[language]= array("2"=> "asp", "1"=> "php");
But this of course does not work. I would like to be able to place values later
on inbetween. So if somebody comes up with a language called ".net" :-) I would
like to place it in the middle, but I cant get it to work like that :-(
To build the select box I use following code:

---
';

# build the select field
for ($i=1; $i <= count($code[education]); $i++){
if ($education)
$isselected = ($i == $education) ? " selected" : ""; // select the
active row
else
$isselected = FALSE;
printf ("%s\n", $i, $isselected,
$code[education][$i]);
};

echo'

Has anybody an idea which could help me on that? Thank you for any help.
Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

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


[PHP] Any personal experience with MySQL/Calendar application

2005-03-29 Thread Todd Cary
I am looking for an open source calendar program that uses MySQL to 
store the data and has an online Admin feature.  Rather than trying the 
many that are listed, I am hoping that someone may have some personal 
experience with a application of this type and make a recommendation.

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


[PHP] RE: Best Server OS

2005-03-29 Thread Gerald Artman

I would recommend OSX

Top ratings on security compared to Linux or Windows
Fast processors in many configurations, most include 1000T
Starting at $500 to $3500 for up to +15MIPS performance
Excellent GUI interface
Supported by Apache, PHP, MySQL and comes pre-installed


Jerry Artman

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



[PHP] Re: ISO encoding of subject in mail?

2005-03-29 Thread M. Sokolewicz
convert it to quoted-printable using eg. imap_8bit()
L0t3k wrote:
Kim,
  i vaguely recall some new (aka 5.04) functions added to the mbstring 
extension to handle this.

BTW, are you _the_ Kim Madsen of TKBMMemtable fame ?
"Kim Madsen" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
Hi

I´d like to encode the subject in mails generated and sent by PHP, so Danish 
letters like æ,ø and å can be used too... like this:

Subject: Problemer med =?ISO-8859-1?Q?f=E6llesdrev_m=2Em=2E?=
I can´t seem to find a proper function for this? I´ve tried with encode(), 
htmlentities() and htmlspecialchars():

$subject = htmlentities($subject, ENT_QUOTES, "ISO-8859-1");
which gives:
Subject: ADVARSEL: Få IP adresser tilbage
And it´s not converted by the mailclients.
I´d like to solve this since the mailserver at work complaints if the 
subject is not encoded:

X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char E5 hex) in message 
header 'Subject': Subject: ADVARSEL: F\345 IP adresser ti...

Any tips/ideas?
--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/systemdeveloper 
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Limitation in preg_match ?

2005-03-29 Thread Cedric Fontaine
Hello,
I'm using a script to parse mail and extract attachments on-fly. But I 
think that this preg_match 
(preg_match("#([-]+|)$bound(.+?)([-]+?)$bound#is", $data, $strip)) 
doesn't work at all if content is too big (for ex 7Mo).
Is there any known limitation on it ?

I'm using php 4.3.10 and this script runs from command line, so no 
timeout...

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


Re: [PHP] Reading all headers sent

2005-03-29 Thread martin
Solved,
Just in case someone finds it usefull.
I could get the raw post with :
$send = $GLOBALS['HTTP_RAW_POST_DATA'];
And then the headers I need in the $_SERVER globals.
$header[] = "MessageType:$_SERVER[HTTP_MESSAGETYPE]";  // CALL
$header[] = "Content-Type:$_SERVER[CONTENT_TYPE]"; // text/xml
MARTIN
www.movil.be
Richard Lynch wrote:
Search php.net for "RAW HTTP"
Maybe.
On Fri, March 18, 2005 3:28 am, martin said:
Thanks for the answer,
what I'm trying to achieve is a php proxy that receives any GET/POST
request with correspoding headers and brings back the results to the
caller.
Let's say I do a google search request with curl:
// I would like all this to be sent by another page --- (header + xml)
 $data   ="soapreq.xml";
 $handle = fopen ($data, "r");
 $send   = fread ($handle, filesize($data) );
 fclose($handle);
$header[] ="MessageType:CALL";
$header[] ="Content-Type:text/xml";
// -- I don't know if what I want
can be achieved this way, but maybe this explains better the idea.
$ch  = curl_init();
curl_setopt($ch, CURLOPT_URL,
"http://api.google.com/search/beta2";);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$send);
curl_setopt ($ch, CURLOPT_HTTPHEADER, $header);
$data = curl_exec($ch);

Best regards,
MARTIN
Jesper Goos wrote:

The $SERVER variable is an array, so try this:
";
print_r($_SERVER);
echo "";
?>
regards Jesper
martin wrote:

Hi,
I wanted to know if there is some way to expose the full headers sent
to a php page.
I found in google that for windows there is  $_SERVER['ALL_HTTP'] to
read all the headers sent but I'm using php on linux/apache.
There is any way to get in a variable the full headers sent to a page ?
Best regards,
MARTIN

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



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


[PHP] Re: ISO encoding of subject in mail?

2005-03-29 Thread l0t3k
Kim,
  i vaguely recall some new (aka 5.04) functions added to the mbstring 
extension to handle this.

BTW, are you _the_ Kim Madsen of TKBMMemtable fame ?

"Kim Madsen" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
Hi

I´d like to encode the subject in mails generated and sent by PHP, so Danish 
letters like æ,ø and å can be used too... like this:

Subject: Problemer med =?ISO-8859-1?Q?f=E6llesdrev_m=2Em=2E?=

I can´t seem to find a proper function for this? I´ve tried with encode(), 
htmlentities() and htmlspecialchars():

$subject = htmlentities($subject, ENT_QUOTES, "ISO-8859-1");

which gives:

Subject: ADVARSEL: Få IP adresser tilbage

And it´s not converted by the mailclients.

I´d like to solve this since the mailserver at work complaints if the 
subject is not encoded:

X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char E5 hex) in message 
header 'Subject': Subject: ADVARSEL: F\345 IP adresser ti...

Any tips/ideas?

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

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



Re: [PHP] rawurldecode

2005-03-29 Thread Aaron Todd
I got it.  After you said I shouldn't need it I started playing around and 
found that you were right...I didnt need it for spaces and other 
punctuation.  But I was then having a problem with amperstands.  It was 
dropping everything after an amperstand off.  I ended up doing a 
rawurldecode of $_SERVER["QUERY_STRING"] and then a strrchr() on it to 
return everything past the "=" sign.  Then I had to do a substr() to get rid 
of the "=".  Its probably a long way of doing this and I know it probably 
wont work if I add a second variable to the url, but I have already taken 
precautions against that.  This should work unless anyone see's amore major 
security issue with it.

$end = strlen(strrchr(rawurldecode($_SERVER["QUERY_STRING"]),"="));
echo substr(strrchr(rawurldecode($_SERVER["QUERY_STRING"]),"="), 1, 
$end);

Thanks 

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



[PHP] Re: rawurldecode

2005-03-29 Thread Aaron Todd
I have been playing around with the varialbe that I am sending here and I 
have found that this function is actually working correctly.  Spaces an 
punctuation decode properly, but an amperstand seems to be where my ploblem 
is.  I know its a very weird character to be using, but it is a valid 
character in a filename so I must acount for it.  Has anyone previously 
dealt with this and might be able to give me a quick work around?

Thanks


"Aaron Todd" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>I am trying to use the rawurldecode() function to decode a variable that is 
>begin passed from a different page through the url.  The PHP manual doesnt 
>say much for this function, but it does have quite a bit on the urldecode() 
>function which says using urldecode on a $_GET variable wont produce the 
>desired results.  Is there another way to decode a url variable?  Or maybe 
>a better way to get a variable from one page to another so I can use it. 
>The variable may contain all types of characters, but mainly a space(%20) 
>is the biggest problem.
>
> If anyone has some kind of workaround for this please let me know.
>
> Thanks 

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



Re: [PHP] rawurldecode

2005-03-29 Thread Marek Kilimajer
Aaron Todd wrote:
All I am doing is adding a file name as a variable in the 
URL.http://www.mysite.com/mypage.php?variable=this is my image.jpg
You should write:
echo 'here';

Then $_GET['variable'] will be equal to 'this is my image.jpg'.
When I do a echo $_GET['variable'];  it only writes the first word.  Is 
there some setting that might be turned off in the php.ini file that would 
disable this functionality?

Thanks
"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

Aaron Todd wrote:
I am trying to use the rawurldecode() function to decode a variable that 
is begin passed from a different page through the url.  The PHP manual 
doesnt say much for this function, but it does have quite a bit on the 
urldecode() function which says using urldecode on a $_GET variable wont 
produce the desired results.  Is there another way to decode a url 
variable?  Or maybe a better way to get a variable from one page to 
another so I can use it.  The variable may contain all types of 
characters, but mainly a space(%20) is the biggest problem.

If anyone has some kind of workaround for this please let me know.
You should not need it, %20 is decoded to space and as such is already in 
$_GET variable. If it's still encoded then you encoded it where it was not 
necessary. 

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


[PHP] ISO encoding of subject in mail?

2005-03-29 Thread Kim Madsen
Hi

I´d like to encode the subject in mails generated and sent by PHP, so Danish 
letters like æ,ø and å can be used too... like this:

Subject: Problemer med =?ISO-8859-1?Q?f=E6llesdrev_m=2Em=2E?=

I can´t seem to find a proper function for this? I´ve tried with encode(), 
htmlentities() and htmlspecialchars(): 

$subject = htmlentities($subject, ENT_QUOTES, "ISO-8859-1"); 

which gives: 

Subject: ADVARSEL: Få IP adresser tilbage

And it´s not converted by the mailclients. 

I´d like to solve this since the mailserver at work complaints if the subject 
is not encoded: 

X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char E5 hex) in message 
header 'Subject': Subject: ADVARSEL: F\345 IP adresser ti...

Any tips/ideas?

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

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



Re: [PHP] rawurldecode

2005-03-29 Thread Aaron Todd
All I am doing is adding a file name as a variable in the 
URL.http://www.mysite.com/mypage.php?variable=this is my image.jpg

When I do a echo $_GET['variable'];  it only writes the first word.  Is 
there some setting that might be turned off in the php.ini file that would 
disable this functionality?

Thanks

"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Aaron Todd wrote:
>> I am trying to use the rawurldecode() function to decode a variable that 
>> is begin passed from a different page through the url.  The PHP manual 
>> doesnt say much for this function, but it does have quite a bit on the 
>> urldecode() function which says using urldecode on a $_GET variable wont 
>> produce the desired results.  Is there another way to decode a url 
>> variable?  Or maybe a better way to get a variable from one page to 
>> another so I can use it.  The variable may contain all types of 
>> characters, but mainly a space(%20) is the biggest problem.
>>
>> If anyone has some kind of workaround for this please let me know.
>
> You should not need it, %20 is decoded to space and as such is already in 
> $_GET variable. If it's still encoded then you encoded it where it was not 
> necessary. 

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



Re: [PHP] NEWBIE: Can't Get My Loop Going. . .

2005-03-29 Thread Jackson Linux
As usual, Jochem, thanks for all those useful tips. They are much 
appreciated.

Jack
On 29 Mar 2005, at 05:15, Jochem Maas wrote:
Jackson Linux wrote:
Hello all,
I am a newbie trying to build a set of links to content in a db. I am 
connecting with the db and seeing the proper number of rows. if I 
echo out the values of $id and $sidebar I see that they take on the 
id# and text of the last entry in the database. I'm trying to make 
the script get each of the rows, until there are no more, and echo 
out the info I need for each row. Please can someone tell me where 
I'm going wrong?
(the variables spelling out the db connection information are in a 
prepend file, and work.)
I read that you already figured it out... thought I add a couple of
general tips:
Thanks in advance,
Jack
if you don't intend to use the $conn var why initialize it?:
mysql_connect($dbserver, $dbusername, $dbpassword) or die("Unable to 
connect to DB: " . mysql_error());

  echo "Unable to connect to DB: " . mysql_error();
  exit;
}
if (!mysql_select_db("$dbname")) {
  echo "Unable to select mydbname: " . mysql_error();
  exit;
}
$sql = "
SELECT *
FROM sidebar
";
$sidebar = array();
$result = mysql_query($sql);
if (!empty($result)) {
again if you are using $sql only in one place then there
 is no reason to not to do the following instead (given that
the query itself is very short - i.e. legibility is not a problem):
if ($result = mysql_query("SELECT * FROM sidebar")) {

 while ($sidebar = mysql_fetch_assoc($result)) {
$id = $sidebar['sidebar_id'];
$linktext = $sidebar['headline'];
sometimes it handy to initialize vars like the 2 above for 
readability...
in this case you may consider that the expressions are very short and 
therefore
you might want to skip creating the vars:

$left_sidebar[] = "- {$sidebar['headline']}";
>
/* Build sidebar.*/
$left_sidebar[] = "- {$linktext}";
}
}
else {}
the preceding empty else statement if not required you can leave out
the 'else {}' completely.
have fun. :-)
mysql_free_result($result);
?>

 


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


[PHP] Re: php + mysql: binary arrays

2005-03-29 Thread Robert S
Hope I was helpful
Yaron Khazai

Thanks - will try that out soon.

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



Re: [PHP] Session data disappearing?

2005-03-29 Thread Jochem Maas
Colin Ross wrote:
In edit_schedule.phps:
if (isset($_POST['add_available'])){
$year = $_POST['year'];
$year = $year['NULL'];
$month = $_POST['month'];
$month = $month['NULL'];
$day = $_POST['day'];
$day = $day['NULL'];
$time = $_POST['time'];
$time = $time['NULL'];
...
}
after this is done.. 
$year, $month, $day, and $time should all be arrays with a single
'null' (not the keyword null though) item with no value. ie.
array(NULL=>);

what ARE you trying to do, you are making the POST vars global:
$day = $_POST['day'];
OK. (why do you even need to do this? whatever, matter of taste i guess..)
But then you over write their values, making them arrays with that
single element 'NULL'
$day = $day['NULL'];
Not seeing the logic here...
didn't spot this yet. will take another look - maybe this is the prob? hmm.
Overall, and not to mean offence, but your code is kinda sloppy and
has syntax and logic errors.
Richards style is just different to yours, me thinks.
TAKEN' : '')?>
SHOULD be erroring up (if you have errors turned on, please say you do
for development)
Richard aint no noob :-)
...the syntax you point out as being bad is completely legal.
try:
TAKEN'; ?>
and btw, the short conditional syntax is:
(condition) ? true : false;
// ie. (note the empty string... you gotta have SOMETHING there
[right?i think so]
echo ($taken) ? 'TAKEN' : '' ;
Colin
On Mon, 28 Mar 2005 20:27:00 -0800 (PST), Richard Lynch <[EMAIL PROTECTED]> 
wrote:
Can anybody 'splain under what conditions $_SESSION values would turn into
&NULL for no reason I can figure out?
It happens consistently on this one FORM submission, but works fine on
others.
PHP 5.0.3
FreeBSD 5.3-RELEASE
Tried with Cookies and with trans_sid
No difference.
Tried altering the session.name and no difference.
Naturally, I can't pare it down to a smaller example yet. :-(
I'm calling session_start(), for sure.
I'm dumping out session_id() and it has the same 32-character value as
before.
But one page has $_SESSION data, and the next, "poof" all the
&string(#)="#" values turn into &NULL
Actually only two out of three values was disappearing for awhile.
This worked fine under Windows XP on my laptop, so I'm reasonably certain
it's not my code at fault, at least not totally.  Working versions:
PHP 4.3.9
Windows XP Home Edition
I've searched bugs.php.net, and found nothing that matched up in any
obvious way to what I'm experiencing, though maybe I just missed it.
H.  Maybe I can blame the CSS somehow.  That always seems to screw me
up. :-v
Anybody willing to poke at it can email me off list for a
username/password and I'll set it up for you to see it in action.
Source code (kinda long, sorry):
http://acousticdemo.com/edit_schedule.phps
http://acousticdemo.com/globals.phps
http://acousticdemo.com/client_id.phps
http://acousticdemo.com/global.phps (CSS)
--
Like Music?
http://l-i-e.com/artists.htm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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


Re: [PHP] php + mysql: binary arrays

2005-03-29 Thread Colin Ross
oops.. how bout if i send it to the group too...

> http://us4.php.net/manual/en/function.preg-split.php
> 
> example for you:
> 
> $groups = '0101000100101010001110010100111';
> $groups_array = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY);
> print_r($groups_array);
> $groups_as_string = implode($groups_as_string);
> echo $groups_as_string;
> 
> Note:  As of PHP 4.3.0, the glue parameter of implode() is optional
> and defaults to the empty string(''). This is not the preferred usage
> of implode(). We recommend to always use two parameters for
> compatibility with older versions.
> 
> I know implode is binary-safe, not sure about preg_split()
> 
> you COULD also use spliti() instead of preg_split()
> http://us4.php.net/manual/en/function.spliti.php
> 
> Colin
> 
> On Tue, 29 Mar 2005 20:35:02 +1000, Robert S <[EMAIL PROTECTED]> wrote:
> > I am writing a contact manager in php/mysql.  I'd like to use a binary array
> > as an efficient way to store information for groups that each contact
> > belongs to eg:
> >
> > Field: 'group': 001010 means that the contact belongs to the second and
> > fourth group.
> >
> > If the array is of type Byte, it should be able to store information about
> > 255 groups.
> >
> > Is php/mysql able to handle this?  My specific questions are:
> >
> > What functions set/clear a bit in an array in php?
> > How do you query whether a bit is set in mysql?
> >
> > I hope I've made this clear enough to be followed - I'm not a pro!
> >
> > --
> > 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] PHP CODE TO DISPLAY ISP

2005-03-29 Thread Colin Ross
and least we forgot about all the users coming from behind a proxy
farm with a different ip for each request..  AOL 

C


On Mon, 28 Mar 2005 12:28:32 -0700, Leif Gregory <[EMAIL PROTECTED]> wrote:
> Hello jenny,
> 
> Monday, March 28, 2005, 9:36:07 AM, you wrote:
> j> i am making a website in php and i will appreciate if anybody can
> j> tell me the php code to :
> j> - (1)display isp name,
> 
> One problem you're going to run into is that by using
> $_SERVER['REMOTE_ADDR'] oftentimes, you'll end up with just the IP.
> 
> I wrote the below to give me the hostname, which generally gives you
> the ISP information too, to fix a problem on a project I was doing.
> 
> If it won't resolve to a name (which does happen sometimes for
> machines behind corporate firewalls), I just displayed "No Reverse DNS"
> 
>  $pingResults = shell_exec('ping -a ' . $_SERVER['REMOTE_ADDR']);
> $temp = explode("\r\n",$pingResults);
> preg_match("/^Pinging\s([a-zA-Z0-9.]+)/", $temp[1], $hostname);
> if ($temp[4] == "Request timed out.")
>   $latency = "Unknown";
> else
>   $latency = $temp[4];
> ?>
> 
> Hostname:  preg_match("/^[a-z.]+/i",$hostname[1])) echo "No Reverse DNS"; else echo 
> $hostname[1]; ?>
> Latency: 
> 
> Geez, it's amazing when you dig back through old code you realize how
> much your coding skills sucked back then! 
> 
> --
> Leif (TB lists moderator and fellow end user).
> 
> Using The Bat! 3.0.9.9 Return (pre-beta) under Windows XP 5.1
> Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

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



RE: [PHP] php + mysql: binary arrays

2005-03-29 Thread YaronKh
Hi

First of all you can use the Bitwise Operators to set/clear a bit
Let say $a is '00100' meaning group 2 is set and you want to set group 4 then 
write: $a = $a | (pow(2 ,4)); //using OR Operator
Now $a is '10100'
Let say that you want to unset group 2:
$a = $a ^ (pow(2,2)); //using XOR Operator


In Mysql:
Let say you want to select groups 2,4,5
In your select string you should write something like :

$mygroups = (pow(2,2) + pow (2,4) + pow(2,5));
$sql = 'select * from sometable where groups = ' || $mygroups


Hope I was helpful
Yaron Khazai


-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Robert S
Sent: Tuesday, March 29, 2005 12:35 PM
To: php-general@lists.php.net
Subject: [PHP] php + mysql: binary arrays

I am writing a contact manager in php/mysql.  I'd like to use a binary array
as an efficient way to store information for groups that each contact
belongs to eg:

Field: 'group': 001010 means that the contact belongs to the second and
fourth group.

If the array is of type Byte, it should be able to store information about
255 groups.

Is php/mysql able to handle this?  My specific questions are:

What functions set/clear a bit in an array in php?
How do you query whether a bit is set in mysql?

I hope I've made this clear enough to be followed - I'm not a pro!

-- 
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] Session data disappearing?

2005-03-29 Thread Colin Ross
In edit_schedule.phps:

if (isset($_POST['add_available'])){
$year = $_POST['year'];
$year = $year['NULL'];
$month = $_POST['month'];
$month = $month['NULL'];
$day = $_POST['day'];
$day = $day['NULL'];
$time = $_POST['time'];
$time = $time['NULL'];
...
}
after this is done.. 
$year, $month, $day, and $time should all be arrays with a single
'null' (not the keyword null though) item with no value. ie.
array(NULL=>);

what ARE you trying to do, you are making the POST vars global:
$day = $_POST['day'];
OK. (why do you even need to do this? whatever, matter of taste i guess..)
But then you over write their values, making them arrays with that
single element 'NULL'
$day = $day['NULL'];
Not seeing the logic here...

Overall, and not to mean offence, but your code is kinda sloppy and
has syntax and logic errors.

TAKEN' : '')?>
SHOULD be erroring up (if you have errors turned on, please say you do
for development)
try:
TAKEN'; ?>

and btw, the short conditional syntax is:
(condition) ? true : false;
// ie. (note the empty string... you gotta have SOMETHING there
[right?i think so]
echo ($taken) ? 'TAKEN' : '' ;

Colin

On Mon, 28 Mar 2005 20:27:00 -0800 (PST), Richard Lynch <[EMAIL PROTECTED]> 
wrote:
> Can anybody 'splain under what conditions $_SESSION values would turn into
> &NULL for no reason I can figure out?
> 
> It happens consistently on this one FORM submission, but works fine on
> others.
> 
> PHP 5.0.3
> FreeBSD 5.3-RELEASE
> 
> Tried with Cookies and with trans_sid
> 
> No difference.
> 
> Tried altering the session.name and no difference.
> 
> Naturally, I can't pare it down to a smaller example yet. :-(
> 
> I'm calling session_start(), for sure.
> 
> I'm dumping out session_id() and it has the same 32-character value as
> before.
> 
> But one page has $_SESSION data, and the next, "poof" all the
> &string(#)="#" values turn into &NULL
> 
> Actually only two out of three values was disappearing for awhile.
> 
> This worked fine under Windows XP on my laptop, so I'm reasonably certain
> it's not my code at fault, at least not totally.  Working versions:
> PHP 4.3.9
> Windows XP Home Edition
> 
> I've searched bugs.php.net, and found nothing that matched up in any
> obvious way to what I'm experiencing, though maybe I just missed it.
> 
> H.  Maybe I can blame the CSS somehow.  That always seems to screw me
> up. :-v
> 
> Anybody willing to poke at it can email me off list for a
> username/password and I'll set it up for you to see it in action.
> 
> Source code (kinda long, sorry):
> http://acousticdemo.com/edit_schedule.phps
> http://acousticdemo.com/globals.phps
> http://acousticdemo.com/client_id.phps
> http://acousticdemo.com/global.phps (CSS)
> 
> --
> Like Music?
> http://l-i-e.com/artists.htm
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

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



[PHP] php + mysql: binary arrays

2005-03-29 Thread Robert S
I am writing a contact manager in php/mysql.  I'd like to use a binary array
as an efficient way to store information for groups that each contact
belongs to eg:

Field: 'group': 001010 means that the contact belongs to the second and
fourth group.

If the array is of type Byte, it should be able to store information about
255 groups.

Is php/mysql able to handle this?  My specific questions are:

What functions set/clear a bit in an array in php?
How do you query whether a bit is set in mysql?

I hope I've made this clear enough to be followed - I'm not a pro!

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



Re: [PHP] How to sort that array?

2005-03-29 Thread Colin Ross
What I did in a situation like this (much more complicated though,
with nested select boxes in a form) was use a database, and then
created a php-created javascript file.
The javascript file was buffered, and then cached (saved to a file)
with a timestamp...
So, I can limit the amount of times the WHOLE SCRIPT is run , say once
every 24 hours at most. Also, If i just updated it, I can delete the
cached version, and a new one is made.

Sure, the script is slow... but page loads are fast becuase (unless
its NEEDED) all thats to be processed is a file-read call and such...
not (potentially) hundreds of DB queries.

If you want I can post an example... let me know.

Colin

On Tue, 29 Mar 2005 11:59:23 +0200, Merlin <[EMAIL PROTECTED]> wrote:
> Hi there,
> 
> I would like to save some db power by putting values into a file which are 
> often
> used. They basicly populate a select field.
> So I placed those values into associative arrays:
> $code[language]= array("1"=> "php", "2"=> "asp");
> 
> Now I would like to sort those for displaying after my preference, not by lets
> say alphabet. The easiest thing I could think of, is just to move the entry:
> $code[language]= array("2"=> "asp", "1"=> "php");
> 
> But this of course does not work. I would like to be able to place values 
> later
> on inbetween. So if somebody comes up with a language called ".net" :-) I 
> would
> like to place it in the middle, but I cant get it to work like that :-(
> 
> To build the select box I use following code:
> 
> 
>  ---
> ';
> 
> # build the select field
> for ($i=1; $i <= count($code[education]); $i++){
>  if ($education)
>  $isselected = ($i == $education) ? " selected" : ""; // select the
> active row
>  else
>  $isselected = FALSE;
>  printf ("%s\n", $i, $isselected,
> $code[education][$i]);
> };
> 
> echo'
> 
> 
> Has anybody an idea which could help me on that? Thank you for any help.
> 
> Merlin
> 
> --
> 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 My Loop Going. . .

2005-03-29 Thread Jochem Maas
Jackson Linux wrote:
Hello all,
I am a newbie trying to build a set of links to content in a db. I am 
connecting with the db and seeing the proper number of rows. if I echo 
out the values of $id and $sidebar I see that they take on the id# and 
text of the last entry in the database. I'm trying to make the script 
get each of the rows, until there are no more, and echo out the info I 
need for each row. Please can someone tell me where I'm going wrong?
(the variables spelling out the db connection information are in a 
prepend file, and work.)
I read that you already figured it out... thought I add a couple of
general tips:
Thanks in advance,
Jack


$conn = mysql_connect($dbserver, $dbusername, $dbpassword);
if (!$conn) {
if you don't intend to use the $conn var why initialize it?:
mysql_connect($dbserver, $dbusername, $dbpassword) or die("Unable to connect to DB: 
" . mysql_error());
  echo "Unable to connect to DB: " . mysql_error();
  exit;
}
if (!mysql_select_db("$dbname")) {
  echo "Unable to select mydbname: " . mysql_error();
  exit;
}
$sql = "
SELECT *
FROM sidebar
";
$sidebar = array();
$result = mysql_query($sql);
if (!empty($result)) {
again if you are using $sql only in one place then there
 is no reason to not to do the following instead (given that
the query itself is very short - i.e. legibility is not a problem):
if ($result = mysql_query("SELECT * FROM sidebar")) {

 while ($sidebar = mysql_fetch_assoc($result)) {
$id = $sidebar['sidebar_id'];
$linktext = $sidebar['headline'];
sometimes it handy to initialize vars like the 2 above for readability...
in this case you may consider that the expressions are very short and therefore
you might want to skip creating the vars:
$left_sidebar[] = "- {$sidebar['headline']}";
>
/* Build sidebar.*/
$left_sidebar[] = "- {$linktext}";

}
}
else {}
the preceding empty else statement if not required you can leave out
the 'else {}' completely.
have fun. :-)
mysql_free_result($result);
?>

 

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


[PHP] How to sort that array?

2005-03-29 Thread Merlin
Hi there,
I would like to save some db power by putting values into a file which are often 
used. They basicly populate a select field.
So I placed those values into associative arrays:
$code[language]= array("1"=> "php", "2"=> "asp");

Now I would like to sort those for displaying after my preference, not by lets 
say alphabet. The easiest thing I could think of, is just to move the entry:
$code[language]= array("2"=> "asp", "1"=> "php");

But this of course does not work. I would like to be able to place values later 
on inbetween. So if somebody comes up with a language called ".net" :-) I would 
like to place it in the middle, but I cant get it to work like that :-(

To build the select box I use following code:

---
';

# build the select field
for ($i=1; $i <= count($code[education]); $i++){
if ($education)
$isselected = ($i == $education) ? " selected" : ""; // select the 
active row
else
$isselected = FALSE;
printf ("%s\n", $i, $isselected, 
$code[education][$i]);
};

echo'


Has anybody an idea which could help me on that? Thank you for any help.
Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: collapse SELECT from multiple tables

2005-03-29 Thread Rolf Østvik
[EMAIL PROTECTED] (David Christensen) wrote in
news:[EMAIL PROTECTED]: 

> I'm trying to figure out the best way to handle a SELECT from multiple
> tables where a single ID in tableA relates to multiple ID's in tableB:
> 
> "SELECT tableA.ID, tableB.data FROM tableA, tableB WHERE tableA.ID=3
> AND tableA.ID=tableB.tableAID"
> 
> What I'm trying to product is an array output similar to:
> 
>| ID | data |
>| 3  | data1, data2, data3 |
> 
> if the table data is represented by this:
> 
> tableA
>| ID | something  |
>| 1  | something1 |
>| 2  | something2 |
>| 3  | something3 |
> 
> tableB
>| ID | tableAID | data  |
>| 1  | 3| data1 |
>| 2  | 3| data2 |
>| 3  | 3| data2 |

Suggestion 1 and 2 may depend of which database you use.
Suggestion 3 have been touched in other answers.

Suggestion 1:
Create a custom function which takes the tableA.ID as parameter and run
a query on tableB and creates an string as answer. I do this in an
application i use PostgreSQL. 

Suggestion 2:
Create an aggregate. I havent yet tried this in PostgreSQL.

Suggestion 3:
Order your sql result and loop over the data.

-- 
Rolf Østvik

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



Re: [PHP] Create MDB File

2005-03-29 Thread gustav
What's the reason reason converting from MySQL to Access? *curious*

/G
@varupiraten.se



> Thanks for your reply,
>
> but this only works on Windows. I need a program that will create an MDB
> file on the fly from a query on the MySQL database...
>
>
> "Johannes Findeisen" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> Sorry,
>>
>> i forgot that link:
>>
>> http://www.convert-in.com/sql2acc.htm
>>
>>
>> On Monday 28 March 2005 22:46, Johannes Findeisen wrote:
>>> Hello,
>>>
>>> i had the same problem some years ago. At this time i have set up all
>>> tables in Access and wrote a script which reads from MySQL and inserts
>>> into
>>> the MDB file via the ODBC connector. This works but is much work when
>>> your
>>> database is very big.
>>>
>>> 2 Years ago i had the same problem but it must go as fast as possible
>>> so
>>> i
>>> decided to buy a converteer since i didn't find anything free. They are
>>> working very good. I don't know where i have buyed them but i think
>>> there
>>> is only one company which delivers this software.
>>>
>>> Regards
>>> Johannes
>>>
>>> On Monday 28 March 2005 22:08, Shaun wrote:
>>> > Hi,
>>> >
>>> > Does anyone know if its possible to create an MDB file from a Mysql
>>> > database using a PHP script, I have only managed to find Access to
>>> > Mysql
>>> > conversion programs so far...
>>> >
>>> > Thanks for your help
>>>
>>> --
>>> # Johannes Findeisen
>>
>> --
>> # Johannes Findeisen
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



[PHP] report_zend_debug ini setting

2005-03-29 Thread Zac Barton
Hi,

Does anyone know what the "report_zend_debug" ini entry does. I have searched 
the php wesite (http://docs.php.net/en/ini.html) and cant find any info on it.


Thanks

Zac

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



RE: [PHP] More about problems reading COM ports

2005-03-29 Thread Kim Madsen
> -Original Message-
> From: John McCaskey [mailto:[EMAIL PROTECTED]
> Sent: Sunday, March 27, 2005 5:13 AM

> Others have reported problems reading COM ports using fopen and fgets or
> fread. They open the port and start reading but nothing ever arrives.

I had the "problem" and solved it, I believe I posted the answer here too? What 
kinda device are You listening to? I was listening to a switch and got nothing 
using the example from the fgetc manual until I restarted the switch, then all 
the boot info became visual... It reads each byte from the port, so use that as 
a "listen_wrapper", send try some [enter] commands, have a terminal ready to 
check if something goes wrong, try output the buffer, when $char is a "\n" and 
basically know exactly what the device shows and expects. Here´s a hint to get 
You started:

if($fp = fopen('com1', 'wb')) // b for windows
  // send [enter]
  fwrite($fp, "\r\n");

  // listen to device
  while (false !== ($char = fgetc($fp))) {
echo "$char\n";
$buffer .= $char;
if($char == "\n" || $char = "\r") {
  echo "\nBUFFER: $buffer\n\n";
  sleep(3);
  $buffer = "";
}
  }
}
else {
   echo 'can´t connect to com1, got a terminal open?';
} 

Play some more with the sleep and [enter]

> I have the same problem and discovered the following. There is an 8K
> input buffer. Only after 8K bytes have arrived does fgets or fread see the
> first.

Won´t be a problem with fgetc() since You read char by char.

> How does one get around this feature (or bug)?
> 
> This is with php 5.0.2.2 on Windows XP.

I´m using 4.3.10

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

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