Re: [PHP] trim away x > 1 number of spaces from a strin

2002-07-24 Thread Andrey Hristov


 $new = preg_replace('/[ ]{2,}/',""$old);

HTH
Andrey

- Original Message -
From: "Victor Spång Arthursson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 24, 2002 12:05 PM
Subject: [PHP] trim away x > 1 number of spaces from a strin


Hi!

Could someone help me with a replace that takes all occurances of " ",
that is space more than one, and replaces them with ""…?

Sincerely

Victor


--
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] filling an array

2002-07-26 Thread Andrey Hristov

 for($m=1;$m<=5;$m++){
 $div_id[$m]=${'divid'.$m};
 }

Regards,
Andrey


- Original Message -
From: "Steve Buehler" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Friday, July 26, 2002 10:48 PM
Subject: [PHP] filling an array


> Can anyone tell me what I am doing wrong?
>
> I am essentially trying to do this:
> $divid[1] = $div_id1;
> $divid[2] = $div_id2;
> $divid[3] = $div_id3;
> $divid[4] = $div_id4;
> $divid[5] = $div_id5;
>
> But I was looking for a tighter way, like the following (which does not
work):
> for($m=1;$m<=5;$m++){
> $div_id[$m]=$divid$m;
> }
>
> Can anybody tell me how to do this in a "for" statement?
>
> Thanks In Advance
> Steve
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
> ow3
>
>
> --
> 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] Re: sessions

2002-07-26 Thread Andrey Hristov

unset($_SESSION['variavble']);
 

Andrey


- Original Message - 
From: "Tyler Durdin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 26, 2002 10:14 PM
Subject: Re: [PHP] Re: sessions


> So doing it the new way ($_SESSION['variable']) how do you close or 
> unregister a session?
> 
> 
> 
> 
> _
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
> 
> 
> -- 
> 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] Re: sessions

2002-07-26 Thread Andrey Hristov

do the following

function a(){
var_dump('',$GLOBALS,'');
}
a();


and see what variables you have and whether your variables are set
somewhere.

HTH

Andrey

- Original Message -
From: "Tyler Durdin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 26, 2002 9:28 PM
Subject: Re: [PHP] Re: sessions


> Still the same message. It has been actually logging me out all along, but
> it will not run through that if statement.
>
> >Could you trye
> >if (!empty($HTTP_SESSION_VARS['valid_user'])
> >use $HTTP_SESSION_VARS
>
>
>
>
>
> _
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>
> --
> 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] Dates and Date()

2002-07-29 Thread Andrey Hristov



- Original Message -
From: "Christopher J. Crane" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 29, 2002 5:51 PM
Subject: [PHP] Dates and Date()


> I believethisto be one way to find out yesterday's date:
> $tomorrow  = mktime (0,0,0,date("m")  ,date("d")-1,date("Y"));
>
> However, I would like to have a snippet of code to tell me how to get the
> date of today - 10 days ago.
>
> if today is jul 29, 2002, how do I get the date funtion to tell me 10 days
> ago. with jul 29, 2002 as the date it would be easy, just subtract 10 from
> 29, but what happens if the date was jul 2, 2002. How do I get the correct
> date returned

All date functions handle correctly this case
 so echo strftime('%m:%d:%Y', gmmktime(0,0,0,7,2-10,2002));
will be:
06:22:2002
You can add/substract what you wish and will get correct results in case the
the resulting timestamp is between 1.1.1970 and somewhere in year 2038.


Best regards,
Andrey Hristov


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




Re: [PHP] Dates and Date()

2002-07-29 Thread Andrey Hristov

Use while() with some counter that increments when you have bussiness day/
$counter = 0;
$bdays = 0;
while ($bdays<10){
  if
(in_array(gmstrftime('%u',gmmktime(0,0,0,7,2-($counter++),2002),array(1,2,3,
4,5)){
  $bdays++;
echo gmstrftime('%m/%d/%Y',gmmktime(0,0,0,7,2-($counter-1),2002);
}
}

HTH

Regards,
Andrey

- Original Message -
From: "Christopher J. Crane" <[EMAIL PROTECTED]>
To: "Andrey Hristov" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, July 29, 2002 7:00 PM
Subject: Re: [PHP] Dates and Date()


> Ok here is what I did.
>  $Hist_Time = gmstrftime('%m:%d:%Y', strtotime("-10 days"));
>
> Now I am wondering if there is a way to look for only the last day
business
> days and be returned in an array?
> - Original Message -
> From: "Andrey Hristov" <[EMAIL PROTECTED]>
> To: "Christopher J. Crane" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Monday, July 29, 2002 10:59 AM
> Subject: Re: [PHP] Dates and Date()
>
>
> >
> >
> > - Original Message -
> > From: "Christopher J. Crane" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, July 29, 2002 5:51 PM
> > Subject: [PHP] Dates and Date()
> >
> >
> > > I believethisto be one way to find out yesterday's date:
> > > $tomorrow  = mktime (0,0,0,date("m")  ,date("d")-1,date("Y"));
> > >
> > > However, I would like to have a snippet of code to tell me how to get
> the
> > > date of today - 10 days ago.
> > >
> > > if today is jul 29, 2002, how do I get the date funtion to tell me 10
> days
> > > ago. with jul 29, 2002 as the date it would be easy, just subtract 10
> from
> > > 29, but what happens if the date was jul 2, 2002. How do I get the
> correct
> > > date returned
> >
> > All date functions handle correctly this case
> >  so echo strftime('%m:%d:%Y', gmmktime(0,0,0,7,2-10,2002));
> > will be:
> > 06:22:2002
> > You can add/substract what you wish and will get correct results in case
> the
> > the resulting timestamp is between 1.1.1970 and somewhere in year 2038.
> >
> >
> > Best regards,
> > Andrey Hristov
> >
> >
> >
>
>
>
>


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




Re: [PHP] Dates and Date()

2002-07-29 Thread Andrey Hristov

No problema.
If you have access to icq you can use irc.php.net or capek.openprojects.net
(or any other openproject's irc server)
on #php channel.

Andrey

- Original Message -
From: "Christopher J. Crane" <[EMAIL PROTECTED]>
To: "Andrey Hristov" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, July 29, 2002 7:08 PM
Subject: Re: [PHP] Dates and Date()


> very nice... thank you!
> ----- Original Message -
> From: "Andrey Hristov" <[EMAIL PROTECTED]>
> To: "Christopher J. Crane" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Monday, July 29, 2002 12:04 PM
> Subject: Re: [PHP] Dates and Date()
>
>
> > Use while() with some counter that increments when you have bussiness
day/
> > $counter = 0;
> > $bdays = 0;
> > while ($bdays<10){
> >   if
> >
>
(in_array(gmstrftime('%u',gmmktime(0,0,0,7,2-($counter++),2002),array(1,2,3,
> > 4,5)){
> >   $bdays++;
> > echo gmstrftime('%m/%d/%Y',gmmktime(0,0,0,7,2-($counter-1),2002);
> > }
> > }
> >
> > HTH
> >
> > Regards,
> > Andrey
> >
> > - Original Message -
> > From: "Christopher J. Crane" <[EMAIL PROTECTED]>
> > To: "Andrey Hristov" <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>
> > Sent: Monday, July 29, 2002 7:00 PM
> > Subject: Re: [PHP] Dates and Date()
> >
> >
> > > Ok here is what I did.
> > >  $Hist_Time = gmstrftime('%m:%d:%Y', strtotime("-10 days"));
> > >
> > > Now I am wondering if there is a way to look for only the last day
> > business
> > > days and be returned in an array?
> > > - Original Message -
> > > From: "Andrey Hristov" <[EMAIL PROTECTED]>
> > > To: "Christopher J. Crane" <[EMAIL PROTECTED]>
> > > Cc: <[EMAIL PROTECTED]>
> > > Sent: Monday, July 29, 2002 10:59 AM
> > > Subject: Re: [PHP] Dates and Date()
> > >
> > >
> > > >
> > > >
> > > > - Original Message -
> > > > From: "Christopher J. Crane" <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Monday, July 29, 2002 5:51 PM
> > > > Subject: [PHP] Dates and Date()
> > > >
> > > >
> > > > > I believethisto be one way to find out yesterday's date:
> > > > > $tomorrow  = mktime (0,0,0,date("m")  ,date("d")-1,date("Y"));
> > > > >
> > > > > However, I would like to have a snippet of code to tell me how to
> get
> > > the
> > > > > date of today - 10 days ago.
> > > > >
> > > > > if today is jul 29, 2002, how do I get the date funtion to tell me
> 10
> > > days
> > > > > ago. with jul 29, 2002 as the date it would be easy, just subtract
> 10
> > > from
> > > > > 29, but what happens if the date was jul 2, 2002. How do I get the
> > > correct
> > > > > date returned
> > > >
> > > > All date functions handle correctly this case
> > > >  so echo strftime('%m:%d:%Y', gmmktime(0,0,0,7,2-10,2002));
> > > > will be:
> > > > 06:22:2002
> > > > You can add/substract what you wish and will get correct results in
> case
> > > the
> > > > the resulting timestamp is between 1.1.1970 and somewhere in year
> 2038.
> > > >
> > > >
> > > > Best regards,
> > > > Andrey Hristov
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> >
> >
> >
>
>
>
>
> --
> 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] Dates and Date()

2002-07-29 Thread Andrey Hristov

 The guy just wanted fast help. It is obvious that he is not advanced it
time transformations and functions. I think that he didn't ask bad question.
WHich are bad - his questions or "What the  is php?".
When he has more time he will take better look at the docs :)) Some people
always experiment some not.

Kind regards,
Andrey Hristov


- Original Message -
From: "1LT John W. Holmes" <[EMAIL PROTECTED]>
To: "Christopher J. Crane" <[EMAIL PROTECTED]>; "Andrey Hristov"
<[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, July 29, 2002 7:12 PM
Subject: Re: [PHP] Dates and Date()


> > Ok here is what I did.
> >  $Hist_Time = gmstrftime('%m:%d:%Y', strtotime("-10 days"));
> >
> > Now I am wondering if there is a way to look for only the last day
> business
> > days and be returned in an array?
>
> What have you tried? How much longer do we have to hold your hand?
>
> Not to be too rude or anything, but at least give it a few tries on your
> own, then post your code, what you thought would happen, what actually
> happened, and what help you need. That's how these things are supposed to
> work...
>
> ---John Holmes...
>
>
> --
> 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.exe from command line

2002-07-29 Thread Andrey Hristov

Inspect $argc & $argv arrays (var_dump() them).


Andrey

- Original Message -
From: "Evan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 29, 2002 8:06 PM
Subject: [PHP] php.exe from command line


> I've made a simple php file that creates a file named 'agent_1.txt' where
> the number is taken from $_GET["num"].
>
> I've tried to run it in this way:
> http://localhost/agent.php?num=1
> And it works perfectly
>
> I thought that from from command line it would work so i tried this (WinXP
+
> PHP 4.1.2):
>
> c:\php\php.exe c:\Inetpub\webpub\PHP\agent.php?num=1
>
> BUT IT DOESN'T WORK! ?
>
> Can someone help, please?
> Thenks in advance,
> Evan
>
>
>
> --
> 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] web services and PHP

2002-07-31 Thread Andrey Hristov


 There are two ways (SOAP) to use SOAP library written in PHP such as NuSOAP
by Dietrich Ayala or to use
PHP-SOAP toolkit (module for PHP written in C)by Brad Lafountain(coding) and
Shane Caraveo(testing) (available at sourceforge.net).

Regards,
Andrey

> "Bob Lockie" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> >
> > >I'd like to know if it's possible to use PHP to develop and implement
> > >Web Services. If so, please point me to sites, articles, or tutorials
> > >that discuss this topic in more detail. Thanks.
> >
> > How do you define web services?
> >
> >
> >



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




Re: [PHP] include()

2002-08-01 Thread Andrey Hristov

> > I suppose include() can be used to include files from remote
> > systems(not on
> > WINDOWS).
>
> Only if the sysadmin running your web server allows it, which they should
> not.
>
>
> > A webmaster on the same server can always use a path like
> > "/home/htdocs/.../config.php" and include my config .php which contains
my
> > database password !!
>
> Not quite, but if you are on a shared server hosted by somebody else,
there
> is a potential problem.  If somebody can figure out the name of the
function
> that opens the database, they could call it, potemtially giving access to
> the data.  You could use the solution posted by Justin French to make sure
> that the function does nothing for them when they call it.
But probably the password is in variable so if you can include() the file
with the password and cored dump
the php you can view it. I've found a bug or two that core dump PHP and saw
my secrets there. Even
function or variables with mangled names will not help you.

> If you run your own server, you can set it up so that each webmaster is
> locked into a private environment, but it's messy.  According to me, you
> would need a separate copy of apache for each site, each running under a
> different user, and they would need to run on separate ports, which is a
> nuisance.
>
This is called SAFE mode (easy to be done) and the other restriction is
open_basedir directive in php.ini

Andrey


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




Re: [PHP] Reg- array_unique

2002-08-02 Thread Andrey Hristov

Post that on [EMAIL PROTECTED]

Andrey

- Original Message -
From: "SenthilVelavan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 02, 2002 10:54 AM
Subject: [PHP] Reg- array_unique


Hello All,

I tried a program using array_unique.It shows different outputs
in PHP4.06 and PHP4.22

Program:



Output:

PHP4.06
Index 0 Content snp
PHP4.22
Index 2 Content snp

Why the index is differed in two version?
Whether the function array_unique is handled in a different way in PHP4.22.
Any help is appreciated.

Advance thanks and regards,
SenthilVelavan.P




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




Re: [PHP] Re: Need help to choose hosting!

2002-08-02 Thread Andrey Hristov

http://ispcheck.com is the place. Listing of many webhostings. Go and see.

Regards,
Andrey

> > Hey php-general,
> >
> >   i want to buy hosting. but i can't find good one for me. maybe
> >   someone could point some links. but this is what i need!
> >
> >   Storage up to 100MB
> >   normal transfer limit(best would be without)
> >   CGI/Perl/PHP/ASP/SSI/SSL
> >   MySQL database (can be only 1)
> >   some pop3 mailboxes
> >   free domain transfer (maybe free domain if i pay for 1 year ahead)
> >   FTP access
> >   SSH access
> >   Shell capability
> >   up to 3 background processes
> >
> >   if anyone know combination like that i would appreaciate your help!
> >   thanks
> >
> > --
> > Best regards,
> >  Mantas
> >
> > Contacts:
> > [EMAIL PROTECTED]
> >
> 
> 
> 
> -- 
> 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] .htaccess

2002-08-02 Thread Andrey Hristov

The password that user used is available in some var
var_dump($HTTP_SERVER_VARS); or var_dump($GLOBALS);

Andrey
 
- Original Message - 
From: "Oliver Witt" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 02, 2002 5:21 PM
Subject: [PHP] .htaccess


> Hi!
> Using an .htaccess file to limit access to some web files, is there a
> way to get the name and password into a variable used by a user to log
> on?
> Kind regards,
> Oliver
> 
> 
> -- 
> 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] Re: Protect PHP coding

2002-08-03 Thread Andrey Hristov

> >>>So...
> >>>Is this equivalent to Zend Encoder?
> >>
> >>Not exactly, but in some aspects it is/will be better like the ability
> >>to generate executable standalone PHP programs that you can distribute
> >>independently. There is also the question of the price that for Zend
> >>Encoder is ridiculously expensive.
> >>
 The people for Zend have to eat to live.
People, if there is no Zend there is no core for PHP. This is the same as
with MySQL. MySQL is free under GPL
but has no subselects because the companies that has commercial licenses
didn't wanted that - Monty has
to eat and he codes other features.
IMO Zend must exist and this is only possible by selling its products.
If the company we work for has the money to buy Zend Accelerator licenses
why not do that instead of using
other Open Source accelerators. I just want the people from Zend to continue
their tremendous work and
we will have PHP5 and PHP6 and so on otherwise start learning ASP or JSP.


My 2 cents.

Regards,
Andrey


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




Re: [PHP] Linux PHP editor

2002-08-09 Thread Andrey Hristov

gedit - for gnome. nedit. - for X
joe - for console. use joe if you had used Borland's editors. The key
combinations are almost the same.

Regards,
Andrey

- Original Message -
From: "JJ Harrison\" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 09, 2002 1:40 PM
Subject: [PHP] Linux PHP editor


> I just switched over to Red Hat Linux from Win2k...
>
> Only to find my fav editor only works on windows systems...
>
> could someone suggest a good replacement?
>
>
> --
> JJ Harrison
> [EMAIL PROTECTED]
> www.tececo.com
>
>
>
> --
> 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 lib?

2002-08-13 Thread Andrey Hristov

Hi,
sets the value of the var to be parsed later.

HTH

Andrey

- Original Message -
From: "John Wards" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 13, 2002 12:58 PM
Subject: Re: [PHP] Php lib?


> Thanks for that rather handy!
>
> Does anyone know what the function set_var() does in template.inc in
phplib?
> I persume it has something to do with the template system.but thats as
> much as I have figured out!!
>
> I am going to replace the phplib template system with Smarty there is not
a
> converter for this(wishful thinking! anything for an easy life)
>
> My boss set me this task before he went on holiday...I am sure he is
bloody
> laghing his socks off right now! I wondered why he never bothered porting
> this for PHP4!
>
> Arrgh!
>
> John
> > > Anyone got any handy hints on how to convert scripts running
> > > on PHP3 and
> > > PHPlib?
> >
> > 1. Roughly speaking, page_open() goes to session_start():
> >
> > Old:
> > page_open(array("sess" => "my_web_Session"));
> >
> > New:
> > session_start();
> >
> > 2. page_close() goes away; if you don't have time to remove all those
> calls,
> > write your own page_close() function that simply returns true.
> >
> > 3. Use functions instead of methods for managing the session variables.
> For
> > example, for the object $sess created in step 1 above:
> >
> > Old:
> > $sess->register('firstName');
> >
> > New:
> > session_register('firstName');
> >
> > Brings back fond memories - not! ;)
> >
> > Kirk
> >
> > --
> > 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] read a text file

2002-07-16 Thread Andrey Hristov

$contents = implode('',file($filename));

Regards,
Andrey


"Edgar" <[EMAIL PROTECTED]> wrote in message
news:<[EMAIL PROTECTED]>...
> I was looking for in the news, but i did not encounter any thing.
>
> Where can I get an example or the way to read a text file into a variable
> and how identify the carriage return and special characters.
>
>
> Thank you
>
>
> Edgar
>
>
>
> --
> 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] Purpose of $$var ?????

2002-07-16 Thread Andrey Hristov

Variable variable. Read the docs.

$v = 'foo';
$foo = 'bar';
echo $$v;

Regards,
Andrey

P.S.
Sometimes {} are used : ${$v}




"Scott Fletcher" <[EMAIL PROTECTED]> wrote in message
news:<[EMAIL PROTECTED]>...
> The script was working great before PHP 4.2.x and not after that.  So, I
> looked through the code and came upon this variable, "$$var".  I have no
> idea what the purpose of the double "$" is for a variable.  Anyone know?
>
> --clip--
> $var = "v".$counter."_high_indiv";
> $val3 = $$var;
> --clip
>
> Thanks,
>  FletchSOD
>
>
>
> --
> 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] Require some help about the date comparison

2002-07-17 Thread Andrey Hristov

I think that it is better to use unixtimestamps and if you save them to a
RDBMS then save according to GMT. When retrieving use timezone to convert to
your local time -
ex

define('MY_TIMEZONE',-2);
list($time) = mysql_fetch_array(mysql_query('select tstamp from table where
user='.$user_id.';'));
$tt_ar = explode(':',gmstrftime('%H:%M:%S:%m:%d:%Y',$time));
$local_time = gmmktime($tt_ar[0]+MY_TIMEZONE, $tt_ar[1],
$tt_ar[2],$tt_ar[3],$tt_ar[4],$tt_ar[5]);

Regards,
Andrey

- Original Message -
From: "Manisha" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 17, 2002 9:55 AM
Subject: [PHP] Require some help about the date comparison


> I am writing one program -
>
> I want to display some text on web. This text should appear for limited
> period e.g from 20th July 12pm till 25th July 3pm. After 25th July 3pm the
> text should disappear from screen.
>
> I tried to look for date comparison / string conversion to date etc, I got
> lot info but could not figure out which would be best for above (rather
how
> can I do it).
>
> Anybody can share some expert comments please ?
>
> Thanking in advance,
> Manisha
>
>
> --
> 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] To fill an Array

2002-07-17 Thread Andrey Hristov


 $xy = array_values($_POST);


HTH

Regards,
Andrey Hristov

- Original Message - 
From: "Gabor Niederlaender" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 17, 2002 1:19 PM
Subject: [PHP] To fill an Array


> Hi all!
> 
> I would like to fill the values from my $_POST array to another array
> called xy which is not an associative array.
> 
> F.Ex:
> 
> $_POST['smthing'] should be $xy[0]  etc...
> 
> How do I do this?
> 
> Best regards,
> Gabor
> 
> -- 
> 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] Regular expression

2002-07-17 Thread Andrey Hristov

Something like this.
$your_string = preg_replace('/[\d\w]+@([\w\d]{3,}\.)+([\w]{2,4})/','',
$your_string);

HTH

Best regards,
Andrey Hristov

- Original Message -
From: "Michal Albrecht" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 17, 2002 1:08 PM
Subject: [PHP] Regular expression


> Hi,
>
> Could anyone help me with the following:
>
> I have to strip the domain from string only if it is not preceded with @
> which means - when it is not an e-mail address.
>
> Examples:
>
> 1. blah blah blah [EMAIL PROTECTED] blah blah
>
> should result in:
>
> blah blah blah [EMAIL PROTECTED] blah blah
>
> 2. blah blah blah something.org blah blah
>
> should result in:
>
> blah blah blah  blah blah
>
> Thanks a lot,
>
>
> Michal
>
>
> --
> 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 - autostart, or session_start() ?

2002-07-17 Thread Andrey Hristov

Try with output buffering.

Regards,
Andrey Hristov
 
- Original Message - 
From: "Matt Babineau" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 17, 2002 6:20 PM
Subject: [PHP] $_SESSION - autostart, or session_start() ?


> If I set the SESSION autostart = 1 in the PHP config, would that
> eliminate my need to use session_start() in my code? I have some PHP
> inline with some HTML, and the PHP is telling me:
>  
> Warning: Cannot send session cookie - headers already sent
>  
> Any ideas how to remedy this?
>  
> Matt Babineau
> MCWD / CCFD
> -
> e:  <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
> p: 603.943.4237
> w:  <http://www.criticalcode.com/> http://www.criticalcode.com
> PO BOX 601
> Manchester, NH 03105
>  
> 


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




Re: [PHP] is php.net down ?

2002-07-22 Thread Andrey Hristov

 They are moving to another machine. The intention is to move the download
resource to another resource to free the resources ot the current machine
because there are too many working apache processes. And this is a problem
for other applications. It will be fine soon.

Regards,
Andrey

- Original Message -
From: "R'twick Niceorgaw" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 22, 2002 6:51 PM
Subject: [PHP] is php.net down ?


> Hi guys,
> any one else able to get into www.php.net ?
>
> I'm getting this
>
> Warning: main("geoip.inc") - No such file or directory in
> /local/Web/sites/phpweb/include/prepend.inc on line 6
>
> Fatal error: Failed opening required 'geoip.inc'
> (include_path='.:/local/Web/sites/phpweb/include') in
> /local/Web/sites/phpweb/include/prepend.inc on line 6
>
>
>
>
>
> --
> 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] This makes NO SENSE!!!!!

2001-12-27 Thread Andrey Hristov

What PHP version do you use(4.1.0?)

Regards,
Andrey Hristov
- Original Message - 
From: "Bogdan Stancescu" <[EMAIL PROTECTED]>
To: "Chris Cocuzzo" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, December 27, 2001 2:18 PM
Subject: Re: [PHP] This makes NO SENSE!


> Most probably you have some kind of slashing in there. Check it out by also
> echoing $date from php and if nothing looks wrong, take a look at the source
> code.
> 
> HTH
> 
> Bogdan
> 
> Chris Cocuzzo wrote:
> 
> > hey-
> >
> > ok. I have the following code.
> >  >
> > if($submit) {
> 
>   echo("Input date: $date\n");
> 
> >
> > $arradate = explode("/",$date);
> > $uxdate = mktime(0,0,0,$arradate[0],$arradate[1],$arradate[2]);
> > print $uxdate;
> > }
> > else {
> > ?>
> >   file://name of file is
> > strtotime.php
> >  
> >  
> >  > }
> > ?>
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] This makes NO SENSE!!!!!

2001-12-27 Thread Andrey Hristov

It is for the author of "This makes NO SENSE!"

Regards,
Andrey Hristov


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] is_uploaded_file

2001-12-28 Thread Andrey Hristov

Read the docs about copy_uploaded_file() (this is the function with some more docs, as 
I remember).


HTH

Andrey Hristov
- Original Message - 
From: "Paul Roberts" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, December 28, 2001 2:41 PM
Subject: [PHP] is_uploaded_file


> I'm on PHP/4.0.2
> 
> i'm getting 
> Fatal error: Call to undefined function: is_uploaded_file() 
> 
> how can i emulate the function 
> 
> will also nag my host but...
> 
> 
> Paul Roberts
> [EMAIL PROTECTED]
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Only one instance of a script at a time !

2001-12-28 Thread Andrey Hristov

Under *nix - SysV semaphores

HTH

Regards,
Andrey Hristov
- Original Message - 
From: "Nicolas Guilhot" <[EMAIL PROTECTED]>
To: "Php General MailingList" <[EMAIL PROTECTED]>
Sent: Friday, December 28, 2001 4:31 PM
Subject: [PHP] Only one instance of a script at a time !


> Running a php script with a cron job, how can I do to have only one instance
> of the script running ?
> 
> Thanks for any answer.
> 
> 
> Nicolas
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] is_uploaded_file

2001-12-28 Thread Andrey Hristov

>From : http://www.php.net/manual/en/features.file-upload.php


HTH

Regards,
Andrey Hristov

- Original Message - 
From: "Paul Roberts" <[EMAIL PROTECTED]>
To: "Andrey Hristov" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, December 28, 2001 5:13 PM
Subject: Re: [PHP] is_uploaded_file


> no it's move_uploaded_file and it's 4.03 or greater as well.
> 
> i'm using empty() as i just want to see if i uploaded a file or not
> 
> 
> Paul Roberts
> [EMAIL PROTECTED]
> 
> - Original Message -
> From: "Andrey Hristov" <[EMAIL PROTECTED]>
> To: "Paul Roberts" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Friday, December 28, 2001 12:48 PM
> Subject: Re: [PHP] is_uploaded_file
> 
> 
> > Read the docs about copy_uploaded_file() (this is the function with some
> more docs, as I remember).
> >
> >
> > HTH
> >
> > Andrey Hristov
> > - Original Message -
> > From: "Paul Roberts" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, December 28, 2001 2:41 PM
> > Subject: [PHP] is_uploaded_file
> >
> >
> > > I'm on PHP/4.0.2
> > >
> > > i'm getting
> > > Fatal error: Call to undefined function: is_uploaded_file()
> > >
> > > how can i emulate the function
> > >
> > > will also nag my host but...
> > >
> > >
> > > Paul Roberts
> > > [EMAIL PROTECTED]
> > > 
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] is_uploaded_file

2001-12-28 Thread Andrey Hristov

I had 4.0.0 for a year or more and used that stuff quite well.
And the docs says :
"For earlier versions of PHP, you'll need to do something like
  the following.

Note: This will not work in versions of PHP 4
after 4.0.2. It depends on internal functionality of PHP which
changed after that version."


If one of your boxes is 4.0.2 and the other 4.0.3 use the output of phpinfo() with 
some kind of hack to determine wich one of the
function to use, or just write a wrapper which decides pipe to which function to make.


Regards,
Andrey Hristov


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP certification

2001-12-28 Thread Andrey Hristov

Brainbench?

Regards,
Andrey Hristov
- Original Message - 
From: "clint " <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Friday, December 28, 2001 11:13 PM
Subject: [PHP] PHP certification


> Does anyone know if there are plans to offer a PHP certification in the future?
> 
> I know this can be a mute point, I am just curious.
> 
> Thanks!
> Clint
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] easy quickie..

2002-01-02 Thread Andrey Hristov

I think it is $HTTP_SERVER_VARS['HTTP_REFERER']

Regards,
Andrey Hristov

- Original Message -
From: "Kelly Meeks" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 02, 2002 8:15 PM
Subject: [PHP] easy quickie..


Happy New Year,

Does php set a variable that tells you the url of the page that a user has just come 
from?  So if I wanted to create my own 'Back'
button in a pop up window, for instance?

Thanks in advance,

Kelly

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] distinct element from array

2002-01-06 Thread Andrey Hristov

Try array_unique()

Regards,
Andrey Hristov


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: [PHP-DB] PHP/MySql - address book

2002-01-06 Thread Andrey Hristov

The answer to your question is the relational model of databases.
So instead of one big table, you have to use 2. Say first table is employee and the 
second - companies.
in the employee we have some fields and one of them is company_id,
this id corresponds to a single row in the companies table. companies table contains 
several fields nut one of them is company_id.
company_id is a foreign key (the link you ask).

How to get all employees from single company:
select employee.* from employee,companies where 
employee.company_id=companies.company_id and companies.company_name='Some Ltd.
Inc.';
or better
select employee.* from employee left join companies using(company_id) where 
company_name='Some Ltd Inc.';

I do not have links to literature about relational model but I remember that on 
www.phpbuilder.com there is/are some info on it.I
think from y.2000.

Regards,
Andrey Hristov

Andrey Hristov
Web Developer
- Original Message -
From: "sg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, January 06, 2002 7:26 PM
Subject: [PHP-DB] PHP/MySql - address book


> Hi,
>
> I'm trying to do a sort of address book where I'd put all information about
> anybody or any company from which I receive informtation (friend, people
> from work, hotels, places...)
>
> An entry starts with a name, then I can have any type of information. The
> table I'm using has a lot of fields, but I display via PHP only those that
> are not empty.
>
> I'm now facing a problem many must have already faced. A lot of people work
> for the same company, and I'd like to have a separate table or storage area
> to put that data, so that I don't have to write the same company addresse
> twice, and if that information changes, I won't have to go through ten or
> twenty people's entries to modify it.
>
> So how would I link a company's information to a person's entry?
>
> I know it may sound easy or ridiculous a question, but though I know HTML
> very well I'm still a beginner (learning on my own) et PHP and MySql.
>
> So far I have a neat rendering of the database I've created, but I feel I
> should look further into DB use.
>
> Software I'm using:
>
> EasyPHP (latest version)
> PHP 4
> MySql
> PhpMyAdmin
>
> on Windows Me
>
> Main question, I repeat is : how would I link a company's information to a
> person's entry?
>
> Cheers
>
> Sébastien
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: [PHP-DB] mysql_num_rows

2002-01-06 Thread Andrey Hristov

That means the sql is not correct and the mysql_query()(mysql at all) didn't succeded 
to execute it
Check you sql statement.


Regards,
Andrey Hristov
- Original Message - 
From: "Gurhan Ozen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, January 06, 2002 9:52 PM
Subject: [PHP-DB] mysql_num_rows


>   Hi everyone,
>  I have a problem with mysql connectivety which is making me nuts. If the
> query is "select blah, blah from table" (i.e. without where clause)
> mysql_num_rows returns the right number, but when i put in a query with
> where clause, although there are rows returned, PHP is giving:
> "Warning: Supplied argument is not a valid MySQL result resource" error..
> Can anyone point me to any direction about this?
>   Thanks.
> 
> Gurhan
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] global generation

2002-01-07 Thread Andrey Hristov

try :
for ($i=0; $i < $num_results; $i++)
{ 
$some= $$GLOBALS["variable"];
  // $some[$i] is what you need.
}

Regards,

Andrey Hristov
- Original Message - 
From: "Rodney Davis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 07, 2002 6:11 PM
Subject: [PHP] global generation


> I need to call a generated variable global w/i a function but the
> following doesn't work:
> 
> for ($i=0; $i < $num_results; $i++)
> {
> global $variable[$i];
> }
> 
> I am trying to pass a similarly created form element to a function.  I
> have two questions.  Why doesn't this work? And, what else can I do to
> get the same results.
> 
> Thanks,
> 
> rodney
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] global generation

2002-01-07 Thread Andrey Hristov

Ooops, no $$ before GLOBALS, single $
for ($i=0; $i < $num_results; $i++)
{ 
 $some= $GLOBALS["variable"];
   // $some[$i] is what you need.
 }

Regards,
Andrey Hristov
- Original Message - 
From: "Andrey Hristov" <[EMAIL PROTECTED]>
To: "Rodney Davis" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, January 07, 2002 6:15 PM
Subject: Re: [PHP] global generation


> try :
> for ($i=0; $i < $num_results; $i++)
> { 
> $some= $$GLOBALS["variable"];
>   // $some[$i] is what you need.
> }
> 
> Regards,
> 
> Andrey Hristov
> - Original Message - 
> From: "Rodney Davis" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, January 07, 2002 6:11 PM
> Subject: [PHP] global generation
> 
> 
> > I need to call a generated variable global w/i a function but the
> > following doesn't work:
> > 
> > for ($i=0; $i < $num_results; $i++)
> > {
> > global $variable[$i];
> > }
> > 
> > I am trying to pass a similarly created form element to a function.  I
> > have two questions.  Why doesn't this work? And, what else can I do to
> > get the same results.
> > 
> > Thanks,
> > 
> > rodney
> > 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Supplied argument is not a valid MySQL result resource

2002-01-08 Thread Andrey Hristov

Possibilities:
1)There was an error when mysql_query(). Possibly the SQL statement is not correct. 
Trace with var_dump()/mysql_errno().
2)You give as parameter to some of mysql_* functions a variable not returned from 
mysql_query().

HTH

Regards,
Andrey Hristov

- Original Message - 
From: "Dan McCullough" <[EMAIL PROTECTED]>
To: "PHP General List" <[EMAIL PROTECTED]>
Sent: Tuesday, January 08, 2002 6:47 PM
Subject: [PHP] Supplied argument is not a valid MySQL result resource


> I know this is a common error, but what does it mean.  This snippet of code is 
>something I use all
> the time.
> 
> help please.
> 
> dan
> 
> __
> Do You Yahoo!?
> Send FREE video emails in Yahoo! Mail!
> http://promo.yahoo.com/videomail/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Supplied argument is not a valid MySQL result resource

2002-01-08 Thread Andrey Hristov

Try this:
$parent_sql = "SELECT * FROM categories ORDER BY sort_order ASC";
$parent_result = mysql_query($parent_sql);
var_dump($parent_result);
while ($parent = mysql_fetch_array($parent_result) ) { <-- problem here
$parent_select .= "".$parent['cat_name']."";
}

Regards,
Andrey
- Original Message - 
From: "Dan McCullough" <[EMAIL PROTECTED]>
To: "Andrey Hristov" <[EMAIL PROTECTED]>
Sent: Tuesday, January 08, 2002 7:00 PM
Subject: Re: [PHP] Supplied argument is not a valid MySQL result resource


> here is the sql
> 
> $parent_sql = "SELECT * FROM categories ORDER BY sort_order ASC";
> $parent_result = mysql_query($parent_sql);
> while ($parent = mysql_fetch_array($parent_result) ) { <-- problem here
> $parent_select .= "value=\"".$parent['id']."\">".$parent['cat_name']."";
> }
> --- Andrey Hristov <[EMAIL PROTECTED]> wrote:
> > Possibilities:
> > 1)There was an error when mysql_query(). Possibly the SQL statement is not 
>correct. Trace with
> > var_dump()/mysql_errno().
> > 2)You give as parameter to some of mysql_* functions a variable not returned from 
>mysql_query().
> > 
> > HTH
> > 
> > Regards,
> > Andrey Hristov
> > 
> > - Original Message - 
> > From: "Dan McCullough" <[EMAIL PROTECTED]>
> > To: "PHP General List" <[EMAIL PROTECTED]>
> > Sent: Tuesday, January 08, 2002 6:47 PM
> > Subject: [PHP] Supplied argument is not a valid MySQL result resource
> > 
> > 
> > > I know this is a common error, but what does it mean.  This snippet of code is 
>something I use
> > all
> > > the time.
> > > 
> > > help please.
> > > 
> > > dan
> > > 
> > > __
> > > Do You Yahoo!?
> > > Send FREE video emails in Yahoo! Mail!
> > > http://promo.yahoo.com/videomail/
> > > 
> > > -- 
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> > > 
> > > 
> > 
> 
> 
> =
> dan mccullough
> 
> "Theres no such thing as a problem unless the servers are on fire!"
> 
> 
> __
> Do You Yahoo!?
> Send FREE video emails in Yahoo! Mail!
> http://promo.yahoo.com/videomail/
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] unshift a key value pair

2002-01-09 Thread Andrey Hristov

Try array_merge() 


Regards,
Andrey Hristov
- Original Message - 
From: "Marc Logghe" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 09, 2002 10:55 AM
Subject: [PHP] unshift a key value pair


> Hi,
> I was wondering how you could unshift a key value pair onto an array.
> In the manual one suggested using a function like this:
> function array_unshift_assoc(&$arr, $key, $val)
> {
> $arr = array_reverse($arr, true);
> $arr[$key] = $val;
> $arr = array_reverse($arr, true);
> return count($arr);
> }
> it is a nice trick but this did not really convince me.
> When you have eg an array like this: $a = array("foo"=>"bar",
> "foo2"=>"bar2") and you do an array_shift operation,
> you end up with ("foo2"=>"bar2"). So it is really easy to *remove* a
> key-value
> pair, but how do you put one in ?
> Marc
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Sessions don't load

2002-01-09 Thread Andrey Hristov

when session_start() is called for a first time, it generates session_id and set a 
cookie for the browser. The common name for the
cookie is PHPSESSID. You receive it on the refresh, because after the first load this 
cookie is known by the browser. When you hit
the page for a first time, there is no set PHPSESSID cookie, so PHP WILL NOT have 
$GLOBALS['PHPSESSID'] variable (assuming
register_globals is on in php.ini).
If you want the id. Get it from session_id().

HTH

Regards,
Andrey Hristov
- Original Message -
From: "Ryan Kelley" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 09, 2002 4:02 PM
Subject: [PHP] Sessions don't load


> I have got a page that i am loading sessions on with the following code:
>
> session_start();
> $HTTP_SESSION_VARS['sess_id']=$PHPSESSID;
>
> Except that it will not assign an actual value until i hit refresh on my
> browser. Any ideas for a fix?
>
> Thanks in advance,
>
> Ryan Kelley
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] php,sockets-help!

2002-01-09 Thread Andrey Hristov

Probably here :
$header .= "User-Agent: PHP/4.0.6 (Apache/1.3.20)\r\n\r\n";
you have two new lines instead of one.

HTH

Regards,
Andrey Hristov
- Original Message - 
From: "Sandeep Murphy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 09, 2002 6:23 PM
Subject: [PHP] php,sockets-help!


> 
> Hi,
> 
> I am opening a socket on a remote server(weblogic) and sending my username
> and psswd to authentify them...
> 
> I figure my php is opening the socket as no errors r being trapped.. However
> the response is a blank page instead of an xml formatted response...why???
> how can i rectify this??
> 
> Please helpp!!!
> 
> TIA,
> sands
> my code is as below:
> 
> 
>  
> $uname = "username";
> $password = "password";
> 
> ?>
> 
> 
> 
>  
> $Destination = "http://srv157:7001/communicatorServlet";;
> $Request = "username=$uname&password=$password";
> $cfgTimeOut= 20;
> 
> $theURL = parse_url($Destination);
> $host = $theURL["host"];
> $path = $theURL["path"];
> $port = $theURL["port"]; if ($port=="") $port=80;
> $header  = "GET ".$path." HTTP/1.0\r\n";
> $header .= "Host: ".$host."\r\n";
> $header .= "Accept: */*\r\n";
> $header .= "Accept-Language: en\r\n";
> $header .= "User-Agent: PHP/4.0.6 (Apache/1.3.20)\r\n\r\n";
> $header .= "Content-Type: text/xml\r\n";
> $header .= "Content-Length: ".strlen($Request)."\r\n";
> $header .= "Content: \r\n\r\n";
> $msg = $header . $Request;
> $Response = "";
> 
> 
> 
> // open a socket
> if(!$cfgTimeOut)
> // without timeout
> $fp = fsockopen($host,$port);
> else
> // with timeout
> $fp = fsockopen($host,$port, &$errno, &$errstr, $cfgTimeOut);
> 
> 
> if ($fp) {
>   if (!fputs($fp,$msg,strlen($msg))) { return false; }  // S
> E N D
>   
>   while (!feof($fp)) {$Response .= fgets($fp,32768);} 
>   
> fclose($fp); // R E C E I V E
> 
>   } else 
>   {
>   echo "Unable to access servlet (".$Destination.").";
>   
>   echo " href=\"javascript:history.go(-1)\">Try another";}
> 
>   print "$response\n";
>   
>   print "hello";
> ?>
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] session related

2002-01-11 Thread Andrey Hristov

Probably
1)You do echo before session_start()
2)You have white space before the opening 
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 10, 2002 11:00 PM
Subject: [PHP] session related


> i can't use session, give me an error when use ie 6.
>
> Warning: Cannot send session cookie - headers already sent by (output
> started at /home/www.apollodisplays.com/public_html/mainpage.php:10) in
> /home/www.apollodisplays.com/public_html/mainpage.php on line 29
>
> Warning: Cannot send session cache limiter - headers already sent
> (output started t
> /home/www.apollodisplays.com/public_html/mainpage.php:10) in
> /home/www.apollodisplays.com/public_html/mainpage.php on line 29
>
>
> my code is very simple. see below >
>
> session_start();
> session_register("userright");
> $HTTP_SESSION_VARS["userright"]=$right;
>
> anyone have any idea ?  thankx
>
>
>
>
>   _
>
> Mark Chin 
> Apollo Display Technologies, LLC
> 85 Remington Blvd. Ronkonkoma, NY 11779
> Ph. (631) 580-4360 EXT 19
> Fax (631) 580-4370
> http://www.apollodisplays.com
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] RTFM code snippet

2002-01-11 Thread Andrey Hristov

I'm not sure if a resource casted to numeric to be 0 - var_dump() to say :(0) resource 
of type 
!==flase assures that it is FALSE, not 0.
!== is like != but makes type checking. Frequently used with strpos(). See the memos 
there.
There is also available === operator. It is like == but also makes type comparison.

Regards,
Andrey Hristov

- Original Message - 
From: "mike cullerton" <[EMAIL PROTECTED]>
To: "php-general" <[EMAIL PROTECTED]>
Sent: Friday, January 11, 2002 5:01 PM
Subject: [PHP] RTFM code snippet


> hey folks, hope the new year is treating everyone well.
> 
> i was RTFMing yesterday and ran across this piece of code
> 
>   while (false !== ($file = readdir($handle))) {
> 
> which is similar to stuff i've done
> 
>   while ($file = readdir($dir)) {
> 
> so, what am i not catching with my code, and what is really going on in the
> RTFM code with the "false !==" part?
> 
> thanks y'all,
> mike
> 
>  -- mike cullerton
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] RTFM code snippet

2002-01-11 Thread Andrey Hristov

If you have file with name "0" , with 
  while ($file = readdir($dir)) {
it will be casted to false, but this is regular file. Thus !== is used.

Regards,
Andrey Hristov
- Original Message - 
From: "mike cullerton" <[EMAIL PROTECTED]>
To: "php-general" <[EMAIL PROTECTED]>
Sent: Friday, January 11, 2002 5:01 PM
Subject: [PHP] RTFM code snippet


> hey folks, hope the new year is treating everyone well.
> 
> i was RTFMing yesterday and ran across this piece of code
> 
>   while (false !== ($file = readdir($handle))) {
> 
> which is similar to stuff i've done
> 
>   while ($file = readdir($dir)) {
> 
> so, what am i not catching with my code, and what is really going on in the
> RTFM code with the "false !==" part?
> 
> thanks y'all,
> mike
> 
>  -- mike cullerton
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Compiled PHP

2002-01-11 Thread Andrey Hristov

Several months ago there were notes on few websites about "phpcompiler".
AFAIK it is not so good but it is something.
Last week a man on php-dev said that he starts working on new php compiler but with 
different approach - to connect in one thing -
php4ts.dll, php.exe, and the source code untouched(no compiling on it).
It is interesting if one can make compiler for php to Java bytecode. I saw that there 
is a such compiler for Ada.


Regards,
Andrey Hristov

- Original Message -
From: "charlesk " <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, January 11, 2002 5:57 PM
Subject: [PHP] Compiled PHP


> Are there any php compilers available for win32?
> Can they compile to byte code that the processor like C uses, instead of an 
>interpreter?
>
> Charles Killmer
> IIS 5.0, Windows 2000 Server, PHP 4.1.0
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Compiled PHP

2002-01-11 Thread Andrey Hristov

I think that he uses "bytecode" wrongly.
C is not generating a bytecode but asm instead, then translated to machine code.
Bytecode is another thing. Java is bytecoded. 
IMO that the question is : "Is there any tool which generates machine code as the C 
compiler does? "
AFAIK the encoder first optimizes somehow the code and then encode it to make a 
bruteforce attack harder to do.
 
Regards,
Andrey Hristov
- Original Message - 
From: "Henning Sprang" <[EMAIL PROTECTED]>
To: "Andrey Hristov" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, January 11, 2002 6:31 PM
Subject: Re: [PHP] Compiled PHP


> Andrey Hristov wrote:
> 
>  > Several months ago there were notes on few websites about "phpcompiler".
>  > AFAIK it is not so good but it is something.
>  > Last week a man on php-dev said that he starts working on new php 
> compiler but with different approach - to connect in one thing -
>  > php4ts.dll, php.exe, and the source code untouched(no compiling on it).
>  > It is interesting if one can make compiler for php to Java bytecode. 
> I saw that there is a such compiler for Ada.
> 
> 
> But, as i understood the question, he ist looking for something that
> generates code which makes the php interpreter obsolete.
> 
> I think something like this doesn't exist. There are several ways to
> generate bytecode, but this is still to be run with a special interpreter.
> 
> There are several approaches, whereof some have the goal to make
> execution of code quicker and some others have the goal to give you
> possibility to distribute your software without giving away the code in
> readable form. I think there is an encoder from zend, too, to be found
> at www.zend.com
> 
> 
> my 2 cents
> 
> henning
> 
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] session problem

2002-02-14 Thread Andrey Hristov

What do you mean : "session persist"?
Whe you close the browser the file(the most common case) is not deleted till the 
session expires.
So if the expire time is 30 min it will stay in the /tmp for minimum 30 mins(the 
session garbage collector is not started on
every request). The cookie which is the session_id(PHPSESSID) is set to be valid till 
the browser is closed. After browser closing
it is no valid for the browser.


Best regards,
Andre Hristov

P.S.
Back from the exams hell...Ready for helping again.
- Original Message - 
From: "Rodrigo Peres" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Thursday, February 14, 2002 7:25 PM
Subject: [PHP] session problem


> Hi list,
> 
> I've made this script in order to solve the problem with reload button that
> I've posted. My idea is to register in a session the id, them check if it
> exists, if so don't insert again. But even if I quit the browser the session
> persists. Why?? ps: this is an include in the main page where I use
> session_start();
> 
> if(!$visita) {
> $visita = array();
> }
> if(!in_array($celebID,$visita)) {
> $sql_log = "INSERT INTO log_hits
> (logID,log_date,log_ip,log_referrer,log_celeb,log_url)
> VALUES('',now(),'$REMOTE_ADDR','$HTTP_REFERER','$celebID','$REQUEST_URI')";
> $query_log = new Query($conexao);
> $query_log->executa($sql_log);
> array_push($visita,$celebID);
> session_register('visita');
> }
> 
> Thank's
> 
> Rodrigo
> -- 
> 
> 
> 
> -- 
> 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] Store array into mysql?

2002-02-14 Thread Andrey Hristov

Hi,
if you want to save an array and the structure is not known when you make the database 
schema definition, 
you have to serialize(), put the string in the DB, and when you restore it from the DB 
do unserialize().

Best regards,
Andrey Hristov

"Back from the exams hellReady to help again."


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




Re: [PHP] VERY novice question!

2002-02-14 Thread Andrey Hristov

They are && and ||, also there are "AND" and "OR" case insesitive. But you have to 
know taht && and "and" have different place in
the precedence table. The same is for || and "or". But This is very rare case to rely 
on the precedence.

if((($m[0]=="-")&&($count<2))||($count++"0"))
this seems ok but
$count++"0"
 is not OK. What you want to do?

Best regards,
Andrey Hristov

"Back from the exams hell"

- Original Message -
From: "brendan conroy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 14, 2002 7:46 PM
Subject: [PHP] VERY novice question!


> Thanks for reading this! This is a really novice question but I cant find
> any info about this in the online manual. I would be grateful if someone
> could email me the PHP equivalent of the "&&"(AND) and "||"(OR) operators
> which are used in C.
> I'am trying to write if statements like
>
> if((($m[0]=="-")&&($count<2))||($count++"0"))
> {
> }
>
>
> I be grateful for any replies!!
>
> Thanks,
>
>
> Bren
>
> _
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
>
>
> --
> 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: [PHP-DEV] Newbie help w/ dynamic variables

2002-02-14 Thread Andrey Hristov

you can create variables dinamically like that
$counter=0;
foreach ($some_arr as $key=>$value){
$("your_dyn_var".$counter}="some html code";
$counter++;
}

So if you have 5 iterations you will have in the namespace new 5 variables : from 
$your_dyn_var0 to $your_dyn_var4


When you want to show them in the parsed html do:
$counter=0;
while(isset(${"your_dyn_var".$counter++})) echo ${"your_dyn_var".($counter-1);}
or
for ($tmp_count=0;$tmp_count<$counter;$counter++){ echo ${"your_dyn_var".$counter"};}


Best regards
Andrey Hristov



- Original Message -
From: Honey House Designs
To: [EMAIL PROTECTED]
Sent: Thursday, February 14, 2002 7:56 PM
Subject: [PHP-DEV] Newbie help w/ dynamic variables


I would like to dynamically create variables in my WHILE loop that then can actually 
have php parsed html code stored inside them
and then have the value of that variable run when after php is run and as the html is 
evaluated at page loading...

Any suggestions? And be gentle... I am a newbie!
Tx, tb


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




Re: [PHP] character replace function

2002-02-14 Thread Andrey Hristov

you want to remove a char at position $x.
so
$the_string = 
substr($the_string,0,$x).substr($the_string,$x+1,strlen($the_string)-1-$x);

you can do some juggling in the second substr() with negative values for the 
parameters but they will not be more fast than this.

Best regards,
Andrey Hristov
- Original Message - 
From: "Phil Schwarzmann" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 14, 2002 8:38 PM
Subject: [PHP] character replace function


> I need a function that will erase a particular character in a string.
>  
> Any ideas?!?
>  
>  
> THANKS
> 


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




Re: [PHP] Sessions

2002-02-14 Thread Andrey Hristov

This means that you do some output before calling session_start() or 
session_register();
check for echo()s or blanks before 
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 14, 2002 8:56 PM
Subject: [PHP] Sessions


> Hi,
> I try to use sessions to keep track if a user is logged in. I keep getting
> the following error:
> 
> Warning: Cannot send session cache limiter - headers already sent (output
> started at f:\inetpub\wwwroot\2\admin\authuser.php:30) in
> f:\inetpub\wwwroot\2\auth.php on line 28
> 
> I use the session_start() and then session_register("session").
> What does the error message mean?
> 
> Thanks,
> Morten
> 
> 
> 
> -- 
> 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] Sessions

2002-02-14 Thread Andrey Hristov

Maybe you can put a small iframe in the HTML which will refresh on some basis (3secs 
for example), and in the HTML of this
html you do the popup - window() or alert(). what you choose. the message which is 
sent(from the peer1 to server) is stored in db
(or file) but have to stored somewhere till it is sent to the end user.

Best regards,
Andrey Hristov
- Original Message -
From: "James Taylor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 14, 2002 9:02 PM
Subject: [PHP] Sessions


> Speaking of sessions, I was wondering if something like this is even
> possible:  Users log on, each has their own unique session..  Is it possible
> to do some sort of instant messaging deal with this?  Like, on the main page
> is displays everyone that's logged on, then you maybe choose their name from
> a form, type in a message, then a pop-up box appears with the message to the
> user?
>
> I only know how to use sessions for authentication, something like this I'd
> have no idea where to start.  If it is possible, could someone point me in
> the right direction?
>
> --
> 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] My Session don't expire

2002-02-16 Thread Andrey Hristov

Maybe the content of the page is cached. Try to reload/to clear the cache of the 
browser.



Best regards,
Andrey Hristov
- Original Message - 
From: "Rodrigo Peres" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Saturday, February 16, 2002 4:50 PM
Subject: [PHP] My Session don't expire


> Hi list,
> 
> I'm using IE5 on Mac with MacOS 9.2.2.
> I've made a script that use session_register(), but even when I quit the
> browser the values registered with session still there.
> Ex: I run the script, quit the browser, reopen it and do an echo($myvar)
> and, the value is there, didn't expire.
> How can I correct this???
> 
> Thank's in advance
> 
> Rodrigo Peres
> -- 
> 
> 
> 
> -- 
> 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] Difference between two dates

2002-02-19 Thread Andrey Hristov

Try this :
$d1=strtotime('d-m-Y',$str);
$d2=strtotime('d-m-Y',$str1);
var_dump($d2-$d1);


Best regards,
Andrey Hristov

- Original Message - 
From: "Uma Shankari T." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 19, 2002 10:50 AM
Subject: [PHP] Difference between two dates


> 
> 
>  Hello,
> 
>  How can i find out the difference between two dates.
> 
> I am having the date like this
> 
> $str="10-01-2001";
> $str1="01-02-2002";
> 
> I need to find out the difference between the date,month and year.
> 
> If anyone know the solution for this problem plz tell me
> 
> 
> -Uma 
> 
> 
> -- 
> 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: [PHP-DEV] Get an application/octet-stream from a java applet

2002-02-20 Thread Andrey Hristov

AFAIK 4.0.6 is weird in the process of HTTP_RAW_POST_DATA generation.
I used this var successfully on 4.0.0, when tried to upgrade to 4.0.6 there was a 
problem. After an investigation I found that if
the submited POST has known by Apache Content header then the var is empty. I think it 
is fixed in 4.1.0 at least in a CVS 4.1.0-pre
version. Try with 4.1.x

Best regards,
Andrey Hristov

- Original Message -
From: "Nicolas BOUTET" <[EMAIL PROTECTED]>
To: "Andrey Hristov" <[EMAIL PROTECTED]>
Sent: Wednesday, February 20, 2002 3:57 PM
Subject: RE: [PHP-DEV] Get an application/octet-stream from a java applet


> I'm using php4.06. Thanks.
> I ask it on php-general.
>
> > -Message d'origine-
> > De : Andrey Hristov [mailto:[EMAIL PROTECTED]]
> > Envoye : mercredi 20 fevrier 2002 14:33
> > A : Nicolas Boutet; [EMAIL PROTECTED]
> > Objet : Re: [PHP-DEV] Get an application/octet-stream from a java applet
> >
> >
> > Which version of PHP?
> >
> > Ask this on php-general. php-dev is for coders of core functionality.
> >
> > Best regards,
> > Andrey Hristov
> >
> >
> > - Original Message -
> > From: "Nicolas Boutet" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, February 20, 2002 3:24 PM
> > Subject: [PHP-DEV] Get an application/octet-stream from a java applet
> >
> >
> > > Hi all,
> > > I'm trying to make a script to get "application/octet-stream"
> > datas from a
> > > java applet. The method used by the applet is POST and I tried to use
> > > $HTTP_RAW_POST_DATA like this
> > >
> > >  > > if (isset($HTTP_RAW_POST_DATA)) {
> > > $contentlength = strlen($HTTP_RAW_POST_DATA);
> > > $buffer = $HTTP_RAW_POST_DATA;
> > > }
> > > ...?>
> > >
> > > but $HTTP_RAW_POST_DATA is not set and $buffer stills empty.
> > The size of the
> > > data sent by the applet is 860bytes and the applet works fine
> > if I use a C++
> > > CGI instead of PHP.
> > > Does someone have an idea ?
> > > Thanks a lot ;-)
> > >
> > >
> > >
> > > --
> > > PHP Development Mailing List <http://www.php.net/>
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> >
>


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




Re: [PHP] How works the garbage collector

2002-04-15 Thread Andrey Hristov

There is another php option about the lifetime. If a session is not used for some 
amount of time it will be deleted when the GC
starts. GC starts wih some probability. For example GC can be started 1 time on every 
100 request, then it checks if there are
expired sessions( not sure but maybe based on atime of the file - for files) they are 
deleted.

Regards,

Andrey


- Original Message -
From: "oje" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 15, 2002 11:51 AM
Subject: [PHP] How works the garbage collector


> Hi,
>
> I cannot figure out how the garbage collector works. If we set
> session.cookie_lifetime to 0, the session remains valid until the
> browser is closed. That's OK and it works. My question is : how the
> garbage collector knows that the browser is closed and that the session
> can be destroyed ?
> I found nothing in the session.c file. I am not an expert in C, however.
>
> Thanks
>
> Olivier
>
>
> --
> 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] str_replace question

2002-04-16 Thread Andrey Hristov

preg_replace('/\d+/','',$the_string);

Hope this helps.

Andrey

- Original Message - 
From: "Andras Kende" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 16, 2002 4:29 AM
Subject: [PHP] str_replace question


> Is a nicer way to remove any number 1-0 from a string???
> 
> Currently:
> $metakeywords=str_replace("1",'',strtolower($metakeywords));
> $metakeywords=str_replace("2",'',strtolower($metakeywords));
> $metakeywords=str_replace("3",'',strtolower($metakeywords));
> $metakeywords=str_replace("4",'',strtolower($metakeywords));
> $metakeywords=str_replace("5",'',strtolower($metakeywords));
> $metakeywords=str_replace("6",'',strtolower($metakeywords));
> ..
> 
> Thanks :)
> 
> Andras Kende
> 
> 
> 
> -- 
> 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: [PHP-DB] Re: Cross DB application

2002-04-16 Thread Andrey Hristov


> "Arcadius A." wrote:
> 
 > Hello !
 > I'm planning to write a database application for  MySQL, and then port it to
 > PostrgeSQL.
 > Is there any library or class that could help me to write/maintain just one
 > source code for both MySQL and PostgreSQL ?
 
Try the dbx extension.

Andrey


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




Re: [PHP] Seeing if a value matches anything in an array

2002-04-16 Thread Andrey Hristov

$pharray = array("php","the best language ever");
preg_match("/(?<=What is )(\w+)(?:\?)/",$question,$matches);
if (in_array($matches[0],$phparray)){
// your stuff here
}

Regards,
Andrey

- Original Message - 
From: "Leif K-Brooks" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 16, 2002 12:54 AM
Subject: [PHP] Seeing if a value matches anything in an array


> I'm trying to build some sort of AI chat bot in php (yes, I know I'm crazy).
> To do this, I need some way to check for the presence of any value from an
> array.  Example:
> 
> $pharray = array("php","the best language ever");
> if($question == "What is ".anything_in_array_function($phparray)."?"){
> print "Php is a programming language used mostly as a web scripting
> language.  (put some more stuff about php here)";
> }
> 
> What is the best way to do something like this? 
> 
> -- 
> 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] Extracting hyperlinks from file

2002-02-21 Thread Andrey Hristov

Use preg_match_all('|
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 20, 2002 10:45 PM
Subject: [PHP] Extracting hyperlinks from file


> I need to produce an array of all the links(hrefs) in a remote file
> (actually those that refer to files in the same remote server, but thats
> 
> another matter).
> I'm pretty new to php, i was thinking of doing it with ereg, something
> like eregi("a href[\"]?=(.*)>", $file, $link);
> but i cannot think of a way to make it walk through the whole string, so
> 
> it would find all the links, not just the first one.
> Any ideas?
> 
> Ando
> 
> 
> -- 
> 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] Extracting hyperlinks from file

2002-02-21 Thread Andrey Hristov

ooops
sorry
The correct is :
preg_match_all('/
To: "Ando Saabas" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, February 21, 2002 1:35 PM
Subject: Re: [PHP] Extracting hyperlinks from file


> Use preg_match_all('| var_dump($the_matches);
> 
> Regards,
> Andrey Hristov
> 
> - Original Message - 
> From: "Ando Saabas" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, February 20, 2002 10:45 PM
> Subject: [PHP] Extracting hyperlinks from file
> 
> 
> > I need to produce an array of all the links(hrefs) in a remote file
> > (actually those that refer to files in the same remote server, but thats
> > 
> > another matter).
> > I'm pretty new to php, i was thinking of doing it with ereg, something
> > like eregi("a href[\"]?=(.*)>", $file, $link);
> > but i cannot think of a way to make it walk through the whole string, so
> > 
> > it would find all the links, not just the first one.
> > Any ideas?
> > 
> > Ando
> > 
> > 
> > -- 
> > 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Date calculations

2002-02-21 Thread Andrey Hristov

look at the mysql docs
at www.mysql.com/doc/
there are some functions about times. it is easy to work with time intervals.

Best regards,
Andrey Hristov

- Original Message - 
From: "Sven Jacobs" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 21, 2002 5:56 PM
Subject: [PHP] Date calculations


> Hey 
> 
> I need to calculate the amount of days between 2 point
> point 1 is now the second point is in the past 
> the format I have is in 2002-02-25 10:02:23 ( that is the format i have in
> my db )
> now if I have today 2002-02-25 10:02:04 and the other day is 2002-02-24
> 09:02:04
> That means that the delta in days is 1 day ( the hours do not mather )
> 
> Somebody an idea ?
> 
> -- 
> 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] Re: NULL value for variable

2002-02-21 Thread Andrey Hristov

It seems that you use global where it is not needed- outside of any function
First error because error_reporting is not set to 0 in php.ini so error_reporting 
valus includes E_WARNING.
if you set error_reporting=0 in php.ini or error_reporting(0); in the script you will 
not receive the first warning but probably
lose the second which is useful.

Best regards,
Andrey Hristov
- Original Message -
From: "Narvaez, Teresa" <[EMAIL PROTECTED]>
To: "'Sanduhr'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, February 21, 2002 6:05 PM
Subject: RE: [PHP] Re: NULL value for variable


> I comment it out but I got this error:
>
> Warning: Undefined variable: fileId in
> /home/narvaez/public_html/ddownloadfile.php on line 22
> Could not get file list: You have an error in your SQL syntax near '' at
> line 1
>
> Thanks for any help!.
>
> -Original Message-
> From: Sanduhr [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 20, 2002 6:58 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: NULL value for variable
>
>
> that "global $fileId;" shouldn't be there in  downloadfile.php
> "Teresa Narvaez" <[EMAIL PROTECTED]> schreef in bericht
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> : Hello,
> : I am runnig php 4.1.1.  In the configuration, register_globals is
> : ON.
> : I have two programs and I want to pass the value from fileId from one.php
> to
> : downloadfile.php.  However, in downloadfile.php $fileId is NULL.  What am
> I
> : missing?  Thanks, -Teresa
> :
> :
> : one.php
> :   
> :   
> :   
> :   " >
> :  Download Now
> :   
> :   
> :   
> :
> : downloadfile.php
> ::   global $fileId;
> :
> :   if ( ! is_numeric($fileId) )
> :   die ("Invalid PictureNumber specified: ($fileId)");
> :
> :   ?>
> :
> :
>
>
>
> --
> 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] function that extracts numbers from a string

2002-02-22 Thread Andrey Hristov

Try with preg_match_all()
PCRE functions are up to 25% faster than POSIX(ereg).

Best regards,
Andrey Hristov

- Original Message - 
From: "DigitalKoala" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 22, 2002 1:44 PM
Subject: [PHP] function that extracts numbers from a string


> Hi folks,
> 
> Is there a function that extracts numbers from a string?
> 
> I can do this with ereg but it's quite slow when you have a long list of
> variables to get through...
> 
> thanks!
> 
> dk
> 
> 
> 
> 
> -- 
> 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] Getting the data for MySQL and then putting it back withPHP - at a loss!

2002-02-22 Thread Andrey Hristov

Better is:
 $index=0;
 for (index=0; $index < $rowcount; $index++){
 $formvar=${'formvar'.$index};
}
 
- Original Message - 
From: "george Pitcher" <[EMAIL PROTECTED]>
To: "Michael Romagnoli" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, February 22, 2002 2:40 PM
Subject: Re: [PHP] Getting the data for MySQL and then putting it back withPHP - at a 
loss!


> Michael,
> 
> Been there recently!
> 
> You want to use variable variables:
> 
> $index=0;
> for (index=0; $index < $rowcount; $index++){
> $formvar='formvar'.$index;
> $formvar=$$formvar;
> 
> Do the last two lines for each piece of data you want to handle.
> 
> Think about how you are isolating the formvars on the submitted page to
> make sure that you are sure you are reading the right stuff.
> 
> Hope this helps.
> 
> George in Edinburgh
> 
> 
> 
> On Fri, 2002-02-22 at 12:24, Michael Romagnoli wrote:
> > 
> > I have a special set of information retrieved from a while loop that I would
> > like a person to be able to edit and send back into a MySQL table.
> > 
> > I know all of the basic MySQL commands for doing such, but the PHP side to
> > get the input from the form to go in is really stumping me.
> > 
> > This is what I have:
> > 
> > -
> > 
> > $or = 0;
> > 
> > while($or < $orderidrows) {
> > 
> > $orderinfo = mysql_fetch_row($orderidinfo);
> > $domain[$or] = $orderinfo[2];
> > $cancel[$or] = $orderinfo[3];
> > 
> > print " $domain[$or] > size=2 face=Arial>Cancel This Domain? > face=Arial> > size=3>";
> > 
> > $or++;
> > }
> > 
> > --
> > 
> > The values/data I would normally insert into the MySQL from the form would be
> > $confirm, based on $domain - however, in this case, I have a number of rows
> > with the same
> > name. I've received help as far as distinguishing one row from another -
> > thanks.  :)
> > 
> > The problem I am really having is trying to insert the data back into one
> > particular table.  You see, when I select the data, I get multiple
> > orderid's with multiple domains attached to them.  When I try to UPDATE the
> > MySQL with the data, only the last orderid seems to be the one getting
> > updated.  And, to boot, I want to update based on the domain name (since
> > that is unique) and ignore the orderids.  I only used the orderids to pull
> > the data out.
> > 
> > So, I've been using a query like this in a loop;
> > 
> > $update = "UPDATE table2 SET cancel='$cancel[$a]' WHERE domain = $domain[$a]
> > 
> > Any suggestions?  I'm getting pretty desparate here!  :\
> > 
> > Thanks,
> > 
> > -Mike
> > 
> > 
> 
> 
> 
> _
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
> 
> 
> -- 
> 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] Next and Preview Row

2002-02-22 Thread Andrey Hristov

My dump:
# phpMyAdmin MySQL-Dump
# http://phpwizard.net/phpMyAdmin/
#
# Host: 192.168.1.11:3306 Database : test
# 

#
# Table structure for table 'some'
#

CREATE TABLE some (
   id varchar(6) NOT NULL,
   descr varchar(250) NOT NULL
);

#
# Dumping data for table 'some'
#

INSERT INTO some VALUES ( 'ID0001', 'first line');
INSERT INTO some VALUES ( 'ID0002', 'Second line');
INSERT INTO some VALUES ( 'ID0010', 'Third row');
INSERT INTO some VALUES ( 'ID0015', 'Fourth row');
INSERT INTO some VALUES ( 'ID0023', 'Fifth row');
INSERT INTO some VALUES ( 'ID0026', 'Sixth row');

Try this sql on this table:
select * from some where id<'ID0015' order by id desc limit 0,1;
select * from some where id>'ID0015' order by id limit 0,1;
Best regards,
Andrey Hristov

- Original Message - 
From: "Mark Lo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, February 22, 2002 5:15 PM
Subject: [PHP] Next and Preview Row


> Dear All,
> 
>   I am using PHP + MYSQL.  I have a question that I need some expert
> to help.  That is:
> 
> How do I find out a next and preview row values by using PHP and MYSQL.  For
> examples,
> 
> Row 10ID00010need this value
> Row 11ID00025have this value on hand
> Row 12ID00063need this value
> 
> The questions is how do I find out the values in Row 10 and Row 12, if and
> only if I only have one data that is "ID00025" (select * from table where
> field="ID00025") .  But, the questions is How do I find out the data in Row
> 10 and Row 12 which is "ID00010" and "ID00063" assume I don't know the
> values of "ID00025" is in Row 11.
> 
>   Thank you so much for your help.
> 
> 
> Mark Lo
> 
> 
> 
> 
> -- 
> 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] Re: difference between php3 and php4

2002-02-22 Thread Andrey Hristov

This error comes when trying to fetch data from a result set but there is no such 
because there was a problem with the query.
Try var_dump($res) and you will see - 0. 0 is not a valid number for resource of type 
mysql or any other resource. To prevent this
every time when using a resource identificator do :
if ($res){
...
}else{ echo "something went wrong;";}
I think the problem is etiher the sql query is not successful or php cannot connect to 
the mysql.
$db = mysql_connect("localhost", "", "");
the username is empty??

Regards,
Andrey Hristov
- Original Message -
From: "Todor Stoyanov" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 22, 2002 6:12 PM
Subject: [PHP] Re: difference between php3 and php4


> You must first get the number of record set rows.
>
> The warning is because you trying to fetch a non existing row.
>
> "Toni Baker" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Warning: Supplied argument is not a valid MySQL result
> > resource in c:\program files\apache
> > group\apache\cgi-bin\emp.php3 on line 10
> >
> > $db = mysql_connect("localhost", "", "");
> > mysql_select_db("employee",$db);
> > $result = mysql_query("SELECT * FROM employees",$db);
> > echo "";
> > echo "";
> > echo "Name";
> > echo "Address";
> > echo "Position";
> > echo "";
> > while($row = mysql_fetch_row($result))
> > {
> >   $fname = $row[1];
> >   $lname = $row[2];
> >   $address = $row[3];
> >   $position = $row[4];
> >   echo "";
> >   echo "$fname";
> >   echo "$lname";
> >   echo "$address";
> >   echo "$position";
> >   echo "";
> > }
> >
> > This script works in php3 but not in windows php4.
> > The error message above points to the mysql_fetch_row
> > function.  Does this function work differently in
> > php4?  If not, what else might cause this script to
> > work in php3 and not in php4?
> >
> > __
> > Do You Yahoo!?
> > Yahoo! Sports - Coverage of the 2002 Olympic Games
> > http://sports.yahoo.com
>
>
>
> --
> 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] imagecreate with Windows .exe installer

2002-02-22 Thread Andrey Hristov

Did you restarted the Apache service?

Regards,
Andrey Hristov

- Original Message - 
From: "Mike Brackenridge" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 22, 2002 7:00 PM
Subject: [PHP] imagecreate with Windows .exe installer


> php4 installed with Apache on Windows ME, using as localhost.
> 
> I am trying to use imagecreate with a version of php4 that was installed
> with the binary .exe installer, php seems to be installed OK.
> 
> I have changed the .ini file line:
> 
> ;extension=php_gd.dll
> 
> To
> 
> extension=php_gd.dll
> 
> But I get an error of:
> 
> Fatal error: call to undefined function: imagecreate() in c:directory
> 
> Has anyone any idea what the problem is here?
> 
> Thanks
> Mike 
> 


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




Re: [PHP] resolving php tags in a string

2002-02-22 Thread Andrey Hristov

get all from the string which is between the tags and use the substring with eval();

Best regards,
Andrey Hristov

- Original Message - 
From: "neko" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 22, 2002 5:42 AM
Subject: [PHP] resolving php tags in a string


> I have a question: I normally use include to include a file, which often has
> php tags that are then interpreted and resolved.
> 
> However, in one case I am reading a text file into a string (fread), then
> running nl2br() on it to present it (with an echo command).
> 
> However, I wish to also resolve any php tags, which obviously aren't in this
> case and are just presented in the browser as plain text.
> 
> What's the best way to solve this one? First thought was to write it to a
> temporary file and then call an include on that, but that sounds plain bad.
> 
> neko
> 
> --
> "The secret of genius is to carry the spirit of the child into old age,
> which means never losing your enthusiasm."
>-- Aldous Leonard Huxley
> 
> 
> 
> -- 
> 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] fork?

2002-02-23 Thread Andrey Hristov

Vulcan Logic SRM
www.vl-srm.net

Every your task is a banana.

Regards,
Andrey Hristov

- Original Message - 
From: "Paul Roberts" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 23, 2002 1:05 PM
Subject: [PHP] fork?


how do i do two things at the same time, i'm thinking of the equivalent of fork in perl


Paul Roberts
[EMAIL PROTECTED]



-- 
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] Associative array key as a variable

2002-02-23 Thread Andrey Hristov

Use global. Read the docs about variable scoping.
If you use php >=4.1.0 then use $_POST, $_GET,... they not need to use global. Global 
scope.
";
}
show("countries");
show("cities");
?>

Regards,
Andrey Hristov

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 23, 2002 7:31 PM
Subject: [PHP] Associative array key as a variable


> Hi.
> 
> I have the following PHP program executed from an HTML form where I pass
> the associative array key name as a variable:
> 
>  function show($name)
> {
>   $cnt = count($HTTP_POST_VARS[$name]);
>   echo "Count for $name is $cnt";
>   echo "";
> }
> show("countries");
> show("cities");
> ?>
> 
> The result is always 0. The form fields do have name=countries[] and
> name=cities[] to indicate an array.
> When I hardcode the count line in the function as follows just to test
> to make sure the transfer from the browser works, it displays a correct
> non-zero result:
> 
>   $cnt = count($HTTP_POST_VARS["cities"]);
> 
> I even tried these statements in the function but all give a 0 result:
> 
>   $cnt = count($HTTP_POST_VARS["".$name.""]);
> 
> How do I get the count line to work with a variable in the function?
> Thanks,
> 
> Eurico
> 
> 
> -- 
> 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] Re: php 4.1.1 vs 4.0.6

2002-02-23 Thread Andrey Hristov

In 4.1.x series there are new vars (global scope) 
$_GET,$_POST,$_COOKIE,$_FILES,$_SESSION
not available in 4.0.x versions. For old scripts could be problem that 
register_globals is off in the 4.1.x tree(for new
installations, not upgrades). But this is for good.

Regards,
Andrey Hristov


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




Re: [PHP] Entering data into MySQL

2002-02-24 Thread Andrey Hristov

Try doing it by yourself.
$the_str = str_replace('"','\"',$the_str);
$the_str = str_replace("'","\\'",$the_str);

This is a little hack until you find what is the problem with addslashes();

Best regards,
Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
BALANCED SOLUTIONS

- Original Message - 
From: "Tim Thorburn" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 25, 2002 9:39 AM
Subject: [PHP] Entering data into MySQL


> Hi,
> 
> I'm having troubles entering information from a form into a MySQL 
> database.  Specifically if the user enters an apostrophe anywhere in the 
> form, all the information is rejected and nothing is entered into the database.
> 
> After researching a little on php.net I found the addslashes() command - 
> this did help briefly and I was able to use apostrophe's in the form ... 
> but it seems as the problem has resurfaced.
> 
> To make matters more frustrating, the addslashes() command works perfectly 
> well on my local test machine (Win2k Pro, PHP 4.1.1, MySQL 3.23.44, Apache 
> 1.3.23) but not at all on the server which is hosted by another company 
> (Sun Solaris, PHP 3.0.16, MySQL 3.22.32, Apache 1.3.12).
> 
> Does anyone have any suggestions as to why the addslashes() command worked 
> for a short time on the webserver and why it stopped?  Or better yet, is 
> there a variation of addslashes() that will work on an older version of PHP 
> such as 3.0.16?
> 
> I'd be eternally grateful for any prompt replies as its already 2.38am and 
> my deadline is 9am :P
> 
> Thank you
> -Tim Thorburn
> 
> 
> 
> -- 
> 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] unsetting global variables from an function

2002-02-27 Thread Andrey Hristov

Try unset($GLOBALS["var"]);

Best regards,
Andrey Hristov

- Original Message - 
From: "Enrico Weigelt" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 28, 2002 9:44 AM
Subject: [PHP] unsetting global variables from an function


> 
> hi folks,
> 
> is there a way for unsetting an global variable from an function ?
> 
> global $var; unset ( $var );
> 
> does not work since, unset only removes the reference in from 
> local namespace. but i need to remove it from the global one.
> 
> any chance to do it ?
> 
> ~-n
> 
> --
>  Enrico Weigelt==   meTUX IT services 
>  software development, IT service, internet security solutions
>  www: http://www.metux.de/phone: +49 36207 519931
>  email:   [EMAIL PROTECTED]cellphone: +49 174 7066481
> 
> -- 
> 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] Inserting leading 0 infront of a variable

2002-02-27 Thread Andrey Hristov

This seems an endless loop for me. You do not alter the $myrowp[topic_id] so its 
length is untouched => if it is <6 you will never
get away from the loop. May be you want this.

   # create topic number  6 digit
$count=strlen($myrow[topic_id]) ;
   while ($count-- < 6){
$leading_digits .= '0';
   }
   $topic_id = $leading_digits.$myrow[topic_id] ;

Best regards,
Andrey Hristov

- Original Message -
From: "Andy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 28, 2002 9:56 AM
Subject: [PHP] Inserting leading 0 infront of a variable


> Hi guys,
>
> is there a possibility to add a string in front of a veriable like the .=
> commands adds it to the end? I would like to create a 6 digit number out of
> a e.g. 2 digit one. Underneath is my not working code. Maybe someone knows
> how to solve that.
>
> Thanx Andy
>
>   # create topic number  6 digit
>   while (strlen($myrow[topic_id]) < 6){
>$leading_digits .= '0';
>   }
>   $topic_id = $leading_digits.$myrow[topic_id] ;
>
>
>
>
> --
> 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] Web Services

2002-02-28 Thread Andrey Hristov

 Hi,
Is there someone who knows good places with information about Web Services? Such as 
SOAP, XML-RPC, WSDL etc.
TIA
 
Andrey Hristov



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




Re: [PHP] ImageMagick and Convert In PHP

2002-03-01 Thread Andrey Hristov

Hi,
I had problem with ImageMagick's identify. When trying to use with a shell command in 
PHP big problems!
Why. Trace of identify showed that it wants to create a temporary file in the 
directory where the scripts is but the apache/php runs
under nobody:nobody but the web directories are owned by andy:web . so identify fails. 
Maybe my problem and yours have something in
commong.
try :
strace your_command_here
and see the output.

Best regards,
Andrey Hristov

- Original Message -
From: "Nicke" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, March 01, 2002 12:06 PM
Subject: [PHP] ImageMagick and Convert In PHP


> I have exactly the same problem! Anyone who can help?
>
> /nicke
>
> "Rick" <[EMAIL PROTECTED]> wrote in message
> news:003701c1bb50$bda0e2e0$[EMAIL PROTECTED].;
> Hello All,
>
> Ok , I am about to loose my mind... this list is my last option i think  :)
>
> this is what i have tried :
> system("convert -pen black -draw 'text 120,60 YourText Here'  imageA.jpg
> imageB.jpg");
> The above does not work , the most i can get it imageA.jpg Becomes
> imageB.jpg but the text does not get drawn
>
> I striped the slashes, this does not work either, i su - to what my
> webserver runs on to see if i can run the system command
> via console, it works just fine , so i tried :
>
> $a = escapeshellcmd('-pen black -draw');
> $b = escapeshellarg('text 120,20  YourTextHere);
> $c = escapeshellcmd("test.jpg doggy.jpg");
> system("convert $a $b $c");
>
> Same as the above, imageA becomes imageB and thats it. Permissions for
> testing are -rwxrwxrwx
>
> a basic test with system("convert -scale 500x600" imageA.jpg imageB.jpg"); =
> Works Perfect
>
> I am sorry for coming to the list for help , but i am at a final loss, i
> have also tried shell_exec and exec to clear anything up. I have hit the
> imagemagick mail list and i got  "Php Might have some issues" so if anyone
> can lend a hand to get that system command to work , i would be most
> appreciative.
>
> Best Wishes
> Rick Wilson
>
>
>
>
>
>
> --
> 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] empty() & texarea

2002-03-01 Thread Andrey Hristov

When register_globals is on try this:

if ($open_why_good_consult){

}

Regards,
Andrey
- Original Message - 
From: "John Fulton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 01, 2002 6:45 PM
Subject: [PHP] empty() & texarea


> 
> I can't seem to get empty() to check if someone has left
> a textarea unanswered in an online form with code like
> the following:
> 
> 
> 
>  
> 
> if(empty($open_why_good_consult)) {
> print "Please fill in why you would be a good consultant";
> }
> 
> 
> Any ideas?  It seems to work for things like this:
> 
> 
> 
> if empty($user_name) {
> print "Please fill in a username";
> }
> 
> I suppose it is because the variable is not getting posted.  Is
> there a way to post the variable?   
> 
> Thanks.  
> 
>   John
> 
> 
> -- 
> 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] passing array of variables in a query string

2002-03-01 Thread Andrey Hristov

It is in the TODO list of PHP. The behaviour will be changed in such a case.
You can get the string from $QUERY_STRING
explode it with $ar=explode('&',$QUERY_STRING);
and some other small things to get all stuff with same name in an array

Regards,
Andrey
- Original Message - 
From: "Diana Castillo" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 01, 2002 6:42 PM
Subject: [PHP] passing array of variables in a query string


> I was wondering if someone could help me
> with this:
>  what I need to know is how to pick up an array of variables from
>  a query string such as:
>  http://www.archipro.com/test.php?state=AB&state=BC
>  If I use $state, I get only the last one.
> 
> 
> 
> 
> -- 
> 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] empty() & texarea

2002-03-01 Thread Andrey Hristov

Hi Erik,
I think that you look for array_count_values().

Regards,
Andrey
- Original Message - 
From: "Erik Price" <[EMAIL PROTECTED]>
To: "John Fulton" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, March 01, 2002 6:58 PM
Subject: Re: [PHP] empty() & texarea


> 
> On Friday, March 1, 2002, at 11:45  AM, John Fulton wrote:
> 
> >
> > I can't seem to get empty() to check if someone has left
> > a textarea unanswered in an online form with code like
> > the following:
> >
> > 
> > 
> > 
> 
> In cases where you have provided a default value to fill in the form, 
> you can't use empty() to test the value of the result.  What I would 
> recommend that you do is you test to see if the value is the same as 
> what it was filled in by default, and if so, you know the user hasn't 
> changed anything.
> 
>  $original_good_consult = $_POST['openWhyGoodConsult'];
> ?>
> 
> 
> 
> 
> 
> ...later in the script
> 
> if ($_POST['openWhyGoodConsult'] == $_POST['originalGoodConsult']) {
> // then you know nothing has changed, the values are the same,
> // so take some action to remind them such as echoing "Please
> // fill in the Good Consult field" or whatever
> } else {
> // then you know they have entered a new value, so you can
> // perform whatever code you need to on that
> }
> 
> 
> 
> HTH
> 
> Erik
> 
> 
> 
> 
> Erik Price
> Web Developer Temp
> Media Lab, H.H. Brown
> [EMAIL PROTECTED]
> 
> 
> -- 
> 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] trouble with telnet.

2002-03-01 Thread Andrey Hristov

locate mysqld
whereis mysql

Regards,
Andrey

- Original Message -
From: "Sean Kennedy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 01, 2002 7:05 PM
Subject: [PHP] trouble with telnet.


Hello,

I telneted to my web server and I would like to see if they have MySQL. Is there a 
certain sentence I type to see if they have
MySQL? Thank you,

-Sean



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




Re: [PHP] hmm.. more trouble with telnet.

2002-03-01 Thread Andrey Hristov

I think - " no mysql is available"
what did "locate mysql" returned?

Regards,
Andrey
- Original Message - 
From: "Sean Kennedy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 01, 2002 7:27 PM
Subject: [PHP] hmm.. more trouble with telnet.


Hello,

When I type in 'whereis mysql' it says 'mysql:' so what does that mean?

-Sean



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




Re: [PHP] mysql and telnet.

2002-03-01 Thread Andrey Hristov

.cfm are ColdFusion files(like .php or .pl)

Regards,
Andrey
- Original Message - 
From: "Sean Kennedy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 01, 2002 7:36 PM
Subject: [PHP] mysql and telnet.


Hello,

Thanks for the advice... But now I need to know what all this means:

/home/chiliasp/odbc/direct/locale/en_US/LC_MESSAGES/ivmysql15.po
/home/sites/home/web/CFIDE/administrator/datasources/drivers/myodbc_mysql.cfm
/home/sites/home/web/CFIDE/administrator/datasources/drivers/mysql.cfm
/home/sites/home/web/CFIDE/administrator/server_settings/drivers/mysql.cfm
/home/coldfusion/lib/locale/en_US/LC_MESSAGES/CFmysql15.mo
/home/coldfusion/lib/CFmysql15.so
/home/coldfusion/scripts/mysql_expire.cfm

Thanks,

-Sean



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




Re: [PHP] Bizarre mail() problem

2002-03-02 Thread Andrey Hristov

check you php.ini if you need to change sendmail -t -i to something other.

Regards,
Andrey

- Original Message - 
From: "andy thomas" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 02, 2002 11:04 AM
Subject: [PHP] Bizarre mail() problem


> I have written a script to do some massmailing - it extracts an email
> address from a MySQL database and uses it to send a text file as a mail
> message. It works but there is a 75 second delay between each message
> being sent out!
> 
> This is baffling - there are no delays built into the script and nothing
> obvious in our sendmail configuration. As I've got over 38000 addresses to
> mail out to, this is a problem - I've got round it for now by running 10
> scripts simultaneously, each handling 1000 addresses and this has got mail
> moving.
> 
> The mail() function seems to call sendmail -t -i. This just sits there for
> 75 seconds, then sends a message and then waits for another 75 seconds.
> Surely this should not happen?
> 
> Here's the relevant parts of the script - the email address is in column
> 15 of the MySQL table, so it just extracts field 14 for the email address
> data:
> 
> $msg_txt="message.txt";
> 
> mysql_connect("localhost",$mysql_user,$mysql_pwd);
> $query="select * from $table";
> $result=mysql($dbname, $query);
> $rows=mysql_numrows($result);
> 
> $r=0;
> $f=14;
> while ($r < $rows ) {
> $address=mysql_result($result,$r,$f);
> mail("$address","$subject","$message","From:$MailFromAddress");
> $r++;
> }
> 
> 
> Any suggestions or pointers to where I'm going wrong will be warmly
> received.
> 
> Andy
> 
> 
> -- 
> 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] Threads and PHP

2002-03-02 Thread Andrey Hristov

pcntl extension. But only *nix.

Best regards,
Andrye Hristov

- Original Message - 
From: "Gaylen Fraley" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 02, 2002 6:33 PM
Subject: [PHP] Threads and PHP


> Is it possible to use threads to perform an operation while another takes
> place with PHP?  I have a situation where a process calls the mail()
> function and then must wait until that completes before going on to the next
> step.  What I would like to happen is that the mail() function is handled by
> its own thread and the next screen refreshes immediately as the next screen
> is not dependent on the success/failure of the mail() call.  Possible?
> 
> --
> Gaylen
> PHP KISGB v4.0.1 Guest Book http://www.gaylenandmargie.com/phpwebsite/
> 
> 
> 
> 
> -- 
> 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] Cannot compile PHP with APXS

2002-03-02 Thread Andrey Hristov

Untared php 4.1.1 into /usr/local/src/php4.1.1
Untared apache 1.3.22 into /usr/local/src/apache-1.3.22
ran ./configure in apache
there is /var/www/bin/apxs
When configuring php : ./configure --with-mysql --with-apxs=/var/www/bin/apxs 
--with-xml
error occurs that says either perl is not installed(but it is) or Apache was not 
compiled with DSO support(I built one with DSO) or
apxs is not in the path but an output from "apxs" is shown.
What to do?

BTW I don't know how but succeeded to compile Apache with mod_php4.c(static module). 
Added AddType in /etc/httpd/conf/httpd.conf but
apache do not recognize .php files.

TIA

Andrey


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




Re: [PHP] How to validate this date: 2002-02-31

2002-03-05 Thread Andrey Hristov

First but may be not probably the best decision is to use (gm)strftime() and 
(gm)mktime().
So parse your string put the data into mktime() with hour/minute/second for exmaple 
12,0,0 . Strftime() will return a unix
timestamp.
Use that timestamp with strftime() to get the year,month and date. If they are the 
same as the parsed the date is valid, otherwise
not.

Best regards,
Andrey Hristov

- Original Message -
From: "Andy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 05, 2002 11:27 AM
Subject: [PHP] How to validate this date: 2002-02-31


> Hi there,
>
> I am still lacking of one error the user can provide:
>
> Desired format: .mm.dd
>
> Asuming he enters a date: 2002-02-31 (There is no Feb 31)
>
> Is there a function which check is the date is ok?
>
> Thanx guys,
>
> Andy
>
> PS: I wrote this function which has the whole:
> /*
>  * Validates the format of date
>  * requested format: -mm-dd.
>  * Return false if not valid
> */
> function validate_date($date){
>  return ereg ("([0-9]{4})-([0-1]{1})([0-2]{1})-([0-3]{1})([0-9]{1})",$date);
> }
>
>
>
>
>
> --
> 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] emulation of foreach with reference

2002-03-07 Thread Andrey Hristov

The code below is too weird. I spent 15 min writing it but now works:

for(reset($ar),list($k,)=each($ar),$v=&$ar[$k];$k;list($k,)=each($ar),$v=&$ar[$k]){
var_dump($k,$v);
$v='ather'.($j+++0);
var_dump($k,$v);
}

The $ar array is generated in this way :

for ($i=0;$i<10;$i++){
$ar['foo'.$i] = 'bar'.$i;   
}



Best regards,
Andrey Hristov

P.S.
There is in PHP's ToDo list such feature.

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




Re: [PHP] Why session is not deleted ???

2002-03-07 Thread Andrey Hristov

Yes.
If you know what is garbage collector then you will understand why it is 
there. The GC is started from time to time and cleans expired session data.

Best regards,
Andrey Hristov
IcyGEN Corporation
http://www.icygen.com

On Thursday 07 March 2002 07:54 pm, you wrote:
> Firstly i create a session, After that when i close the browser the sesion
> can still be seen in tmp directory in apache webserver.
> I just wanted to know that If i close the browser, Does the session
> terminates ?
>
> Beta

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




Re: [PHP] require v. includes

2002-03-07 Thread Andrey Hristov

require includes code only once(on the parse), include includes code 
everytime it is called. if you have some libs and in two or more you do 
require or include of some core lib you have to use require_once or to define 
some constant and use it to check. I am sure when but require changed its 
behaviour. Before it leaded to fatal error if some the file that has to be 
required is not found. Now it works just like include (just notice or warning 
- not sure).

For more info read the docs ar : http://www.php.net/

Best regards,
Andrey Hristov
On Thursday 07 March 2002 07:25 pm, you wrote:
> I was just wondering if anyone could tell me when would be the time to
> choose require(), require_once(), or include().  I know a little bit about
> using each one, but I am just not sure if there is one that is better than
> the other in certain situations.

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




Re: [PHP] php, text file, and mysql

2002-03-07 Thread Andrey Hristov

You can use a string to keep the file content. And then put it the 
mysql(probably a BLOB field)

Best regards,
Andrey Hristov
IcyGEN Corporation


On Thursday 07 March 2002 11:30 pm, you wrote:
> hello everyone.
>
> i'm wondering if i can do the following:
>
> FIRST,
> using php, can i create/generate a text file  on-the-fly (not saved to a
> server)
>
> THEN,
> insert the actual text file (and not its contents) into a mysql database.
>
>
>
> many thanks in advance,
>
>
> gregory hernandez
> [EMAIL PROTECTED]

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




Re: [PHP] emulation of foreach with reference

2002-03-07 Thread Andrey Hristov

try this:

Thanks for showing that I add new element to the array. This is because on last 
iteration $k is null and I access $ar[$k] which automatically adds the new element. 
Why? I don't know? Maybe because I refer it by reference!
The fixed code is




This will not add new element to the array.
You ask why I did that.
First to say that I wanted to make something really weird to happy my day :))
Second I wanted to implement a feature from PHP's(Zend's) ToDo list.
Third think about if the array is so big (some megabytes) since I hold really big 
strings in every $v. Then if I use the standart foreach() statement PHP will have to 
copy $ar[$k] to $v :)))

Best regards and fun with PHP,
Andrey Hristov

On Thursday 07 March 2002 08:48 pm, you wrote:
> On Thu, 2002-03-07 at 09:53, Andrey Hristov wrote:
> > The code below is too weird. I spent 15 min writing it but now works:
> >
> > for(reset($ar),list($k,)=each($ar),$v=&$ar[$k];$k;list($k,)=each($ar),$v=
> >&$ar[$k]){ var_dump($k,$v);
> > $v='ather'.($j+++0);
> > var_dump($k,$v);
> > }
> >
> > The $ar array is generated in this way :
> >
> > for ($i=0;$i<10;$i++){
> > $ar['foo'.$i] = 'bar'.$i;
> > }
>
> Hi there,
>
> I'm not sure exactly what the above code is for--but it seems to be
> going to an awful lot of trouble to do it. :) If I start with the array:
>
> Array
> (
> [foo0] => bar0
> [foo1] => bar1
> [foo2] => bar2
> [foo3] => bar3
> [foo4] => bar4
> [foo5] => bar5
> [foo6] => bar6
> [foo7] => bar7
> [foo8] => bar8
> [foo9] => bar9
> )
>
> ...and run the first for() loop above over it, I get this:
>
> Array
> (
> [foo0] => ather0
> [foo1] => ather1
> [foo2] => ather2
> [foo3] => ather3
> [foo4] => ather4
> [foo5] => ather5
> [foo6] => ather6
> [foo7] => ather7
> [foo8] => ather8
> [foo9] => ather9
> [] =>
> )
>
> Note the extra null element at the end.
>
> Why not just do this?
>
> $j = 0;
> foreach ($ar as $key => $val) {
> $ar[$key] = 'ather' . $j++;
> }
>
> ...which results in:
>
> Array
> (
> [foo0] => ather0
> [foo1] => ather1
> [foo2] => ather2
> [foo3] => ather3
> [foo4] => ather4
> [foo5] => ather5
> [foo6] => ather6
> [foo7] => ather7
> [foo8] => ather8
> [foo9] => ather9
> )
>
> Also, I'm unsure what you're going for with the ($j+++0). It just
> increments $j and adds 0, which doesn't seem to do anything.
>
> Please forgive me if I have misunderstood.
>
>
> Cheers,
>
> Torben
>
> > Best regards,
> > Andrey Hristov
> >
> > P.S.
> > There is in PHP's ToDo list such feature.

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




Re: [PHP] emulation of foreach with reference

2002-03-07 Thread Andrey Hristov

ooops
 
On Thursday 07 March 2002 09:09 pm, Andrey Hristov wrote:
> try this:
>   echo "foo".$i++;
>   echo "\n";
>   echo "bar".($+++0);
> ?>


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




Re: [PHP] how to calculate frequency of words in array?

2002-03-08 Thread Andrey Hristov

array_count_values()

Best regards,
Andrey Hristov

On Friday 08 March 2002 04:45 pm, you wrote:
> Does anybody has a clever way to summarize the
> number of different words (with multiple occurences)
> from an array into an  array with all the different words
> and the times they occured?
>
> Thanks a lot!
> Simon

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




Re: [PHP] Replacing words

2002-03-08 Thread Andrey Hristov

Read the docs. Look at the assertion part. ?= and the opposite of it.

Best regards,
Andrey Hristov

On Friday 08 March 2002 05:51 pm, you wrote:
> Hello!
>
> I use
>
> $txt = preg_replace("#(()|$search)#se", '"\2"=="\1"?
> "\1":"$replace"', $txt);
>
> to replace some text in $txt. The problem: Parts of words are replaced,
> too. How can I make preg_replace replace only words, which  means, that
> the word is followed by space . , -, but not by other letters/numbers?
>
> Martin

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




Re: [PHP] SOAP

2002-03-10 Thread Andrey Hristov

Hi
I've tried the SOAPx4 by Dietriech. Looks good ('m not very profocent in SOAP).
Firstly I tried to use XMLRPC for my stuff but found the UsefulInc implementation by 
Edd Dumbill is so slow -
For array with 100 elements I 've to wait 4 seconds to transfer for the server to the 
client(in my case on one machine).
Then looked for alternative and found SOAP. After a little big search on the net I 
found SOAPx4. As far as I can remember
there are one or two more implementations but I cannot find them (phpclasses changed 
their adress to www.phpclasses.org).
At last I found that 4.1.x versions are shipped with extension for XMLRPC and I 
started to use it. Interesting is that this extension
supports SOAP 1.1 specification(by the words of his author). I've not tried the SOAP 
part but after looking at the source I found that
when receiving a packet the extension tries to distinguish whether this is xmlrpc 
packet or soap envelope.It is bad that the extension
is compilable only under Linux. There is no version for windows. I was forced to 
switch to Linux to use it.
Hope that helps.

Best regards,
Andrey Hristov

On Monday 11 March 2002 06:52 am, you wrote:
> Who has had a crack at using SOAP with PHP (both client and server)?
>
> What have you learned that you would recommend to someone just starting out
> with soap?
>
> I've noticed that there are a few options on the horizon, I'm busy checking
> out the scripts written by Manuel Lemos.
>
> For all those who don't know WTF I am talking about
> http://www.w3.org/TR/2001/WD-soap12-20010709/
> http://www.soapware.org/directory/4/implementations

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




[PHP] Re: [PHP-DEV] PHP 4.1.2 for windows

2002-03-10 Thread Andrey Hristov

AFAIK the problem is not afecting windows users. Because of that there is no windows 
binary.

Best regards,
Andrey Hristov

- Original Message - 
From: "Gabor Hojtsy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 11, 2002 9:42 AM
Subject: [PHP-DEV] PHP 4.1.2 for windows


> Hi!
> 
> From hour to hour we receive questions at [EMAIL PROTECTED]
> about the availability of PHP 4.1.2 for Windows. First I
> tried to give an estimate, but now I don't know what to say.
> Will there ever be a PHP 4.1.2 for windows, or a 4.1.3???
> 
> Guys are waiting for the security fix... Why to kick out
> windows users from installing a more secure version of PHP?
> 
> Goba
> 
> 
> 
> -- 
> PHP Development 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] Installing PHP 4.1.2

2002-03-11 Thread Andrey Hristov

There was a discussion on PHP-DEV. Win32 binaries will be available soon.

Best regards,
Andrey Hristov

- Original Message - 
From: "Marcel Besancon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 11, 2002 6:43 PM
Subject: [PHP] Installing PHP 4.1.2


> Hi everybody,
> 
> i've got a problem again. I want to install PHP 4.1.2. Now my problem:
> There's only a source code distribution on php.net. How do I install it on
> Windows XP? I read the documentation, but I all I understood was "bla". So,
> you see I understood nothing. Is there anyone who can explain it an easy way
> ???
> 
> Thanks.
> 
> Marcel
> 
> --
> registered Fli4l-User #0388
> 
> 
> 
> -- 
> 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




  1   2   3   4   >