Re: [PHP] sessions

2002-07-26 Thread Pushkar Pradhan

Try removing the quotes in sessio_register ie. (valid_user2)
> Here is the code that starts and registers the session. It is  login page
> that logs in to itself so the form that produces $_POST["username"] is
> actually on the same page, but nothing happens until the user logs in. It
> there is something in this code that is not correct or making the other code
> from the previous mssages not work please let me know. Thanks again for all
> of the help.
>
>
>
>session_start();
>   $username = $_POST["username"];
>   $password = $_POST["password"];
>
>   if ($username && $password)
>   {
>   //user has just tried to login
>
>   $db_conn = mysql_connect("server", "user", "pass");
>   mysql_select_db("DB_name", $db_conn);
>   $query = "SELECT * FROM members WHERE username='$username'and
> password='$password'";
>   $result = mysql_query($query, $db_conn);
>   if (mysql_num_rows($result) >0 )
>   {
>   //if they are in the db register the username
>   $valid_user2 = $username;
>   session_register("valid_user2");
>   }
>   }
> ?>
>
>
>
> _
> MSN Photos is the easiest way to share and print your photos:
> http://photos.msn.com/support/worldwide.aspx
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] help with crash on make

2002-07-30 Thread Pushkar Pradhan

You chose to compile PHP as a DSO this requires apache to have the mod_so
module, you can check this by doing a
httpd -l in your apache's bin directory.
> I'm attempting to compile php 4.2.2 and apache 2.0.39 (both of which I
> downloaded today) on mandrake 8.1, mainly as part of a process to help me
> learn more about linux and installing programs.  I've followed the generic
> unix directions on php.net and at these steps
>
> >./configure --with-mysql --with-apxs2=/www/bin/apxs
>
> followed by
>
> >make
>
> crashes with errors at the end of the make:
>
>  -DTHREAD=1 -g -O2 -pthread -DZTS -prefer-pic  -c php_functions.c
> php_functions.c:93:27: missing binary operator before '!'
> make[3]: *** [php_functions.lo] Error 1
> make[3]: Leaving directory `/usr/local/php-4.2.2/sapi/apache2filter'
> make[2]: *** [all-recursive] Error 1
> make[2]: Leaving directory `/usr/local/php-4.2.2/sapi/apache2filter'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/usr/local/php-4.2.2/sapi'
> make: *** [all-recursive] Error 1
>
> Can somebody point out what I need to do to correct this?  It doesn't make
> sense that the code I downloaded from php.net would have a problem since
> that's a stable release.
>
> TIA!
>
> -Kirk
>
> --
> K.B. BABB
> email: [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] First Attempt to use DB failed.

2002-08-09 Thread Pushkar Pradhan

Jim,
Are you using a port other than the default (3306)? If so you can specify
it by localhost:3306
Is the server really running?
> I ran the following PHP script:
>
>   $die_msg = "Connection to Database Failed"
>  $connect = mysql_connect("localhost","UserName","UserPW")
>   or die("Connect Failed" ):
>  echo $connect;
>  $db = mysql_select_db("db_cap",$connect)
>   or Die("db Select Failed");
> ?>
>
> I received the following error message
> Parse error: parse error, unexpected T_VARIABLE in
> C:\FREEDEV\XITAMI\webpages\private\test.php on line 3
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




RE: [PHP] need help

2002-08-09 Thread Pushkar Pradhan

And that is good actually since malicious users can't see your source
code, variables it is difficult to hack the site.
> that's the nature of php.  it is executed server side then disappears
> showing only it's results.  :)
>
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, August 09, 2002 2:21 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] need help
> >
> >
> > Hi, how come on the "view source" link on the bottom of the
> > php.net homepage shows a whole mess of php code but when I select
> > "view page source" in Internet explorer or netscape in shows
> > everything as html on the home. This is kinda hard for me to
> > explain, here is an example below:
> >
> >
> > 
> > Ever wondered how popular PHP is? see the ' .
> > make_link("/usage.php", "Netcraft Survey") . '.
> > 
> >
> > (how come they use that "make_link" tag?)
> >
> > 
> > Ever wondered how popular PHP is? see the  > href="/usage.php">Netcraft Survey.
> > 
> >
> > (how come when you view the source from the browser like IE or
> > netscape it shows it as regular HTML?)
> >
> >
> > I'm totaly confused can someone please help me?!!!
> >
> >
> > __
> > Pre-order the NEW Netscape 7.0 browser. Reserve your FREE CD and
> > pay only $2.99 shipping and handling. http://cd.netscape.com/promo_one/
> >
> > Get your own FREE, personal Netscape Mail account today at
> http://webmail.netscape.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
>

-Pushkar S. Pradhan


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




RE: [PHP] Best way to read file

2002-08-11 Thread Pushkar Pradhan

How about file() since it returns each line in the file as an array?
It seems like he wants to do some processing on each line of the file.

> readfile() is good enough
>
>
> Sincerely,
>
> Maxim Maletsky
>
> PHP Beginner
> www.phpbeginner.com
>
>
> > -Original Message-
> > From: César Aracena [mailto:[EMAIL PROTECTED]]
> > Sent: Sunday, August 11, 2002 6:36 PM
> > To: PHP General List
> > Subject: [PHP] Best way to read file
> >
> > Hi all.
> >
> > I am using readfile() to read and print the entire content of a .txt
> > file into a site, but need to use  tags to break down the lines.
> I
> > intend to be able, as an Administrator, to edit these text files
> later.
> > What is the best way to accomplish this? Should I keep using
> readfile()
> > or should I use any ther better way of doing this?
> >
> > Thanks in advance,
> >
> > Cesar Aracena
> > CE / MCSE+I
> > Neuquen, Argentina
> > +54.299.6356688
> > +54.299.4466621
> >
> >
> >
> >
> > --
> > 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
>

-Pushkar S. Pradhan


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




Re: [PHP] Free 'search engine' code

2002-08-11 Thread Pushkar Pradhan

I just got a decent search engine from phpclasses.org ( I downloaded the
one by BasicA).
I modified it a little to add different page types to be returned and
other directories.
> That would depend on what you want.
>
> What sort of counter?
> Hidden? Text file or database based?  Images or text on screen?  Per page?
> Per site?
>
>
> What sort of search engine?
> Are you searching and indexing text files or text in a databases?  Are there
> categories and search methods, or just something simple?
>
>
> Really, if you ask an open question, you get an open answer.
>
> There are hundreds of sources for free PHP scripts... there's no way we can
> recommend something until we know what you want.  Perhaps you should search
> them to try and find something that suits your needs, or to build up a
> wish-list.
>
>
> Justin
>
>
>
>
> on 12/08/02 9:43 AM, Edgard Berendsen ([EMAIL PROTECTED]) wrote:
>
> > Hello,
> >
> > where can I find the best source for a search engine and
> > a counter in PHP ?
> >
> > thanks.
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] Variable naming standards???

2002-08-13 Thread Pushkar Pradhan

Samuel this is what you can use as a standard (at least for yourself):
http://www.cs.msstate.edu/~cs1314/global/guide

It describes how to name variables, functions, scripts etc. In short the
variable names must tell the programmer what it is being used for,
e.g. $countHits = 0; // initialize counter to count no. of hits on the
page
or use _ to separate words - $count_hits = 0;
On Tue, 13 Aug 2002, Nicholas Mercier wrote:

> My two cents,
>
> I think if you are working on a personal product you use what works for
> you.  If working in a group find out or decide as a group what standards to
> use.  The hungarian standards are well designed, but I've seen others that
> work as well.
>
> When posting data from a from to another script I've see F used... as in
> $f_username $f_userpass.
> As well as many others.
>
> The best advise I could give with my (VERY) limited experience, chose a
> constant method for yourself and stick to it.  That way it will become
> second nature to you.
>
> Nick
>
> At 09:52 AM 8/13/2002 -0400, Gerard Samuel wrote:
> >A philosophical question
> >Are there any standards to naming variables??
> >I was told that one should include a letter or combination of letters to
> >describe a variable
> >i.e.
> >$sfoo = 'string';  // string
> >$bfoo = true;  // bool
> >$nfoo = 10;  // interger
> >
> >etc
> >
> >Thanks
> >
> >--
> >Gerard Samuel
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] install php as CGI?

2002-06-04 Thread Pushkar Pradhan

./configure  --prefix=/rstc/user1/erc/pushkar/php-4.0.6
--with-regex=system --enable-discard-path --enable-dbase
Actually you just need one " --enable-discard-path " for security reasons,
others are customized for my use and yes prefix is also a must.
> how can i install php as CGI?
>
>
>
>
>
>
> 
> Brian Feliciano
> EMC-Tech
>
>
> "I know that there are people in this world who do not love
> their fellow man, and I hate people like that."
>   -
> Tom Lehrer
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] PHP as HTML

2002-06-04 Thread Pushkar Pradhan

If you do a phpinfo() you get a columen Server API, mine lists CGI as it
is what I installed php as.
> you know, that's a good question. How would I determine that on the server?
>
> Peter wrote:
>
> >Tom, this does work fine... doing what Kevin says...
> >ie the
> >
> >AddType application/x-httpd-php .html
> >AddType application/x-httpd-php .htm
> >
> >is PHP installed as a module or cgi ver?
> >
> >Cheers
> >
> >-Original Message-
> >From: Tom Ray [mailto:[EMAIL PROTECTED]]
> >Sent: Wednesday, 5 June 2002 9:49 AM
> >To: Kevin Stone; [EMAIL PROTECTED]
> >Subject: Re: [PHP] PHP as HTML
> >
> >
> >I tried this, and it just prompts me to download the file from the server. I
> >can't see what the issue is.
> >
> >
> >- Original Message -
> >From: "Kevin Stone" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Sent: Tuesday, June 04, 2002 5:35 PM
> >Subject: Re: [PHP] PHP as HTML
> >
> >
> >
> >
> >>AddType application/x-httpd-php .html
> >>AddType application/x-httpd-php .htm
> >>
> >>- Original Message -
> >>From: "Tom Ray" <[EMAIL PROTECTED]>
> >>To: <[EMAIL PROTECTED]>
> >>Sent: Tuesday, June 04, 2002 2:41 PM
> >>Subject: [PHP] PHP as HTML
> >>
> >>
> >>
> >>
> >>>Hey there-
> >>>
> >>>I'm trying to use an .htaccess file to parse .php files as .html does
> >>>
> >>>
> >>anyone
> >>
> >>
> >>>know how to do this? It doesn't work with the same structure as parsing
> >>>
> >>>
> >>the
> >>
> >>
> >>>.shtml files.
> >>>
> >>>any suggestions would be great.
> >>>
> >>>
> >>>
> >>>
> >>>--
> >>>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
> >
> >
> >
> >
> >
>
>

-Pushkar S. Pradhan


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




Re: [PHP] Passing variable to the next page

2002-06-04 Thread Pushkar Pradhan

Tag the variables onto the url:
http://mysite.com/newpage.php?firstvar=somevalue&secondvar=othervalue&;.
for arrays
?layer[]=a&layer[]=b&layer[]=c.
or use sessions.
> Here is scenario that I am working on but  have a
problem.  I have 10
> thumbnail images on the page with information for them created from
> database.
>
> For example:
>
>
>
> 
>
> +   +
>
> + Some  Image  +
>
> +   +
>
> 
>
> Name of Image: Blah
>
> Author of Image: Blah
>
>
>
> (I am pulling more info about that image from database, but on this page
> I only display "Name of Image" and  "Author of image," the rest of the
> info is stored in variables.)
>
>
>
> I want my users to click on the thumbnail. When they do I want a new
> window to open and I want information for that particular image that
> they clicked (along with other info that stored in variables for the
> same image) to be passed to that new opened page.  How can I pass
> information about that particular image to the new page?  Any ideas?
>
>
>
> Please Help.
>
>

-Pushkar S. Pradhan


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




Re: [PHP] Comparing array elements

2002-06-05 Thread Pushkar Pradhan

Never used those before, that's the way to do it! I think array_search and
in_array are suited for looking up one or two values.
> Well, it sounds like something that could be done through the db
> query, but if you want to use arrays, it'd be something like this...
>
> $servers = arrray('s1','s2','s3','s4','s5');
> $group1 = array('s1','s4','s5');
>
> $in_group = array_intersect($servers, $group1);
> $not_in_group = array_diff($servers, $group1);
>
>
> mh.
>
>
> On Wed, 5 Jun 2002, Chris Knipe wrote:
>
> > hey everyone,
> >
> > Does anyone have and ideas of wisdom on how to compare arrays (mysql result
> > sets) and group items based on if they exist in two or more arrays?
> >
> > For example:
> >
> > I have a table, with a list of servers:
> > server1
> > server2
> > server3
> > server4
> > server5
> > ...
> > serverX
> >
> > I have a table that specifies which of the servers are grouped:
> > group1
> >   server1
> >   server4
> >   server5
> >
> > Now, I want to compare group1 against the server list, and do something like
> > the following:
> > In group:
> >   server1
> >   server4
> >   server5
> >
> > Not in group:
> >   server2
> >   server3
> >   serverX
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] Comparing array elements

2002-06-05 Thread Pushkar Pradhan

You can use in_array or array_search.
> hey everyone,
>
> Does anyone have and ideas of wisdom on how to compare arrays (mysql result
> sets) and group items based on if they exist in two or more arrays?
>
> For example:
>
> I have a table, with a list of servers:
> server1
> server2
> server3
> server4
> server5
> ...
> serverX
>
> I have a table that specifies which of the servers are grouped:
> group1
>   server1
>   server4
>   server5
>
> Now, I want to compare group1 against the server list, and do something like
> the following:
> In group:
>   server1
>   server4
>   server5
>
> Not in group:
>   server2
>   server3
>   serverX
>
>
> 
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] Returnpath for mail

2002-06-06 Thread Pushkar Pradhan

I think you have to use a "Reply-To" header when sending your mail. The
recipient's mail program will prompt him to use the reply to address
rather than the from address.
> Hi there,
>
> I am wondering if it is possible to send email via the mail function with
> lets say adress_1 and then if the recipient clicks on return he will adress
> his email automaticly to adress_2.
>
> I found this in my docs, but does not work though:
>
> $mailHeaders .= "Return-Path: <".$adress_return.">\n";  // Return path for
> errors
>
> does anybody have an idea how to do that?
>
> Thanx,
>
> Andy
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] matrix functions

2002-06-10 Thread Pushkar Pradhan

If there isn't one, (have you tried phpclasses.org etc.), I think the
string functions are powerful enough.
What kind of manipulations you need? Is it simple column/row transforms or
doing all kinds of maptrix operations?
> hi list,
>
> i have a question regarding a class for matrix modifications so i dont
> have to re-invent the wheel ;)
>
> i would like to do things like this:
>
> matrix with 5*5 colums/rows
>
> x x x x x
> 0 0 0 0 0
> x x x x x
> x x x x x
> x x x x x
>
>
> x x x x x
> x x x x x
> 0 0 0 0 0
> x x x x x
> x x x x x
>
>
> maybe that is incredebly stupid and simple but
> my brain doesnt tell me anything right now -
> how can i transform colums/rows quickly and efficient?
>
> Any help appreciated!
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] Email with PHP.

2002-06-11 Thread Pushkar Pradhan

There's no special flag to compile the mail function.
If you've installed it and it still doesn't work, try giving the path to
sendmail in the line
sendmail_path in php.ini
In my file this line is commented out, seems like php detected the
sendmail exec. at configure time.
> Well I have install the second version from the end :) .. in a slack box
> with the latest apache server..
>
> I tried to use the mail() function and it says that:
>
>  Warning: mail() is not supported in this PHP build in . . . . .
>
> Well I notice that I haven't got sendmail installed, and so I installed it.
>
> I also configures the php.ini file to use sendmail.
>
> DO I NEED 2:
>
> 1. reinstall php with any special flag to use mail() function ??
> 2. or do I need to do anything else.??
>
>
> Thanks in advance..
>
> --
> 
>
> Sapilas@/dev/pinkeye
>
> 
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] beginner in PHP

2002-06-12 Thread Pushkar Pradhan

Is itemcd a variable then it should be used as $itemcd?
> Try this:
>
> echo "$catalog[unitprice]";
>
>
> in my experience I've only been able to use the echo() without the
> quotation marks if I'm calling a function, for variables you need the
> quotation marks.
>
> Hope this helps.
>
>
> Phillip Perry wrote:
>
> >Can someone tell me why this doesn't work?
> >The $mycart array is fine and the $catalog array is also fine but nothing
> >inside the if statement prints. I've tried other echo statements but nothing
> >prints at all.
> >
> >while (list($key,$value) = each($mycart))
> > {
> >  if ($value == $catalog[itemcd])
> > {
> >
> > echo $catalog[unitprice];
> >
> > }
> > }
> >
> >
> >Thanks
> >
> >Phil
> >
> >
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] Email not getting

2002-06-12 Thread Pushkar Pradhan

Yes what are your settings in php.ini, generally the default settings are
sufficient?
> I am trying to send mail from Linux Redhat server through PHP. It is not
> giving me any error but I am not getting any mail too.
>
> Following is the code
>
> 
>
>  $mailBody = "This is one line \ n This is a second line \n\n this is a
> third line";
>
> $boolMail = mail ("[EMAIL PROTECTED]", "Test mail subj from local linux
> server - PHP", $mailBody);
> print ("Email has been send ");
> ?>
>
> -
>
> Even I checked the email files at /var/spool/mqueue - There are 2 files,
> one with message and one with lots of other info. But then why I am not
> getting the emails ? Why they are remaining in the queue ? Is there any
> setting required in php.ini ?
>
>
> Thanks and regards
> Manisha
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




RE: [PHP] Varible Varibles

2002-06-13 Thread Pushkar Pradhan

I'm trying to use variable variables to work on arrays:
$forest = array("a", "b", "c", ...);

$layer[$l]= "forest";

Now I want to access all array members of $forest using $$layer:
e.g.
for($c = 0; $c < $$layer[$l]; $l++) {
   echo $$layer[$l][$c];
}
But this doesn't work, gives syntax error,
So my workaround is:
$new = $$layer[$l];
$new[$c] refers all elements of array $forest
Is this the best workaround or am I missing something?

> I think you're missing the point of variable variables.
>
>  $a = 'foo';
> $$a = 'bar';
>
> echo "$a $$a";
> ?>
>
> After the first use of $$a, you now have a variable called $foo with a
> value of 'bar'.
>
> So your echo would be echo "$a $foo";
>
> I kind of consider variable variables the poor mans array. Most any
> solution you think of with variable variables could be better solved by
> using arrays.
>
> ---John Holmes...
>
> > -Original Message-
> > From: Peter [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, June 12, 2002 10:42 PM
> > To: Php
> > Subject: [PHP] Varible Varibles
> >
> > howdy,
> > I'm just curious here about varible varibles ... I know that you can,
> well
> > it's documented that you can, do the following
> >
> >  > $a = foo;
> > $$a = bar;
> >
> > echo "$a $$a";
> > ?>
> >
> > which will produce  foo bar
> >
> > now what I am curious about is, how much of a difference does that
> really
> > make when you compare it to..
> >
> >  > $a = foo;
> > $a .= bar;
> >
> > echo "$a";
> > ?>
> >
> >
> >
> >
> > Cheers
> >
> > Peter
> > "the only dumb question is the one that wasn't asked"
> >
> >
> >
> > --
> > 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
>

-Pushkar S. Pradhan


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




[PHP] integer to string

2002-06-14 Thread Pushkar Pradhan

I generate nos. using range function, e.g. I get 0 to 40.
I want to convert these nos. to string, I tried sprintf()
syntax:

$soils[$i] = sprintf("%d", $soils[$i]);

But doesn't seem to work, my program returned an error.
P.S. : I'm using 4.0.6 otherwise wouldn't have this problem.
-Pushkar S. Pradhan


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




Re: [PHP] Code Structure/Errors

2002-06-15 Thread Pushkar Pradhan

Quick soln. is to put a "@" symbol in front of the error generating line.
E.g.@$i++;
actual soln. would be to do some initialization like
$i = 0; outside your while loop and $last_name="";
> I'm just curious if there's a way to restructure my code so as to avoid
> getting "Undefined Variable" errors. I keep getting them and I know they're
> nothing to worry about for the most part, I'd like to get rid of them
> without turning off error reporting if possible. In the following code, I
> get an undefined variable error for $i and for $last_name, is there anything
> I can do to actually define them? $last_name is a variable produced by my
> MySQL query, $i is just a counter:
>
> while ($row = mysql_fetch_array($result)) {
>   extract($row);
>   $i++;
>   if($i=="1") {
>   print "\n";
>   }
>
>   if($last_name) {
>   
>   } else {
>   
>   }
> ...
>   if ($i=="5") {
>print "\n";
>$i=0;
>}
>   }
>
> Thanks!
>
> Jason Soza
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




php-general@lists.php.net

2002-06-18 Thread Pushkar Pradhan

http://www.php.net/manual/en/function.gmdate.php

You may have to look at other functions also related to this.
> Thanks!
>
> "Fargo Lee" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]...
> > Hi, if I have a variable containing a number of seconds what function
> would
> > I use to output something like ...
> >
> > 13 Hours, 12 Minutes, 3 Seconds
> >
> > or
> >
> > 23 Days, 13 Hours, 12 Minutes, 3 Seconds
> >
> > Any examples appreciated, thanks!
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] run commands on multiple machines

2002-06-18 Thread Pushkar Pradhan

exec() is used to run unix commands and pass results back to php.
But this runs the commands on the m/c the web server is on, don't know how
you can log onto other m/cs though.
> Hi,
> I want to run some unix commands on multiple machines(in
> a network)  from my web server and display results in the
> browser .
>
> eg.
>  I want to run "pkginfo" or "showrev -p" kind of commands on
> multiple machines and gather the result on the web server
> and display in the browser .
>
> Can anyboby give me a clue of how should I proceed ??
>
> thanks in advance
>
> ~R
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




[PHP] setcookie(), logout

2002-06-21 Thread Pushkar Pradhan

I'm going over some code handed to me, a logout function:
function user_logout()
{
setcookie( 'user_name', '',(time()+28800), '/', '',0);
setcookie( 'id_hash', '',(time()+28800), '/', '',0);
}
Doesn't this mean the cookie will expire after 8 hrs? So what's this
really doing?
Moreover I found this contrib. note on the setcookie reference pg.:
Then why have I not seen anybody using the client's time?
Note:
Just as a note, You might want to use the client browers time to set your
expires, using your local time might mean your cookie wont expire for 24
hours.



-Pushkar S. Pradhan


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




Re: [PHP] Limiting number of decimal places reported

2002-06-29 Thread Pushkar Pradhan

round($order_total), floor("), ceil(") are some options.
> How do I limit the number of decimal places returned in this query?
>
> 
> $result2 = mysql_query("SELECT sum(purchase_price) as total FROM assets
> where order_number='$order_number'");
>
> while(list($order_total) = mysql_fetch_row($result2))
>
> {
>
> print ("$order_total");
>
> }
>
> ?>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] Javascript to PHP?

2002-06-29 Thread Pushkar Pradhan

I've done this stuff recently. I need to pass whole arrays betn. php and
Javascript (2-way), here is some code:

// PHP var. to JS
function arrFromStr (str2convert) {  // make an array from string
   arr = new Array();
   var posOfQt1   = str2convert.indexOf('\"');
   var posOfQt2   = str2convert.indexOf('\"', posOfQt1+1);
   i = 0;
   while(posOfQt1 != -1) {
  arr[i] = str2convert.substring(posOfQt1+1, posOfQt2);
  i++;
  posOfQt1 = posOfQt2;
  posOfQt1   = str2convert.indexOf('\"', posOfQt1+1);
  posOfQt2   = str2convert.indexOf('\"', posOfQt1+1);
   }
   return arr;
}
Call this function like this:
layerDesStr  = '';
layerDes[0]  = arrFromStr(layerDesStr);

In case you have a variable don't serialize, just do
myJSvar = ;
JS variables can be sent to PHP by including them in html forms, nothing
special about it.
> Hello, Folks,
>
> My apologies if this has been asked a thousand times. I've just joined the
> list.
>
> I can't find any information on passing JavaScript variables to PHP on the
> same page (i.e. not through the POST information of a submitted form). Is
> this because it's not possible?
>
> To take the load off the server, I'm trying to do a bunch of string
> manipulations and loops in JavaScript and then hand that info off to PHP
> once it's done.
>
> Any insight is appreciated! Thanks,
> Jed
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] extracting data from text file

2002-07-01 Thread Pushkar Pradhan

Just use file(), this is most appropriate for reading file line by line.
http://www.php.net/manual/en/function.file.php
>
> On Monday, July 1, 2002, at 05:17  PM, [EMAIL PROTECTED] wrote:
>
> > I have trend this but it does not work properly
> >
> > $fp = @fopen(file.txt,"r");
> >   $line = explode("\n",$fp);
> >   $valueC = "$line[0]";
> >   $valueST = "$line[1]";
> >   @fclose($fp);
>
> What error messages are you getting?  I imagine that since you've
> suppressed the errors with the "@", you will need to remove this to give
> us any useful information.
>
> One other thing, has your file been saved with the appropriate line
> breaks for your server?  In some cases, a file may have DOS/Windows or
> Macintosh line breaks which are not \n but rather \r\n and \r
> respectively IIRC.
>
>
> 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
>

-Pushkar S. Pradhan


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




Re: [PHP] Function source?

2002-07-09 Thread Pushkar Pradhan

When you compile from the source (which is in c) the functions that are
available are actually c executables.
> If I understand correctly, all php functions are written in php.  If
> this is true, is it possible to view function source code?  Thanks for
> any insight into this :-)
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] Creating Dynamic Variables

2002-07-17 Thread Pushkar Pradhan

Try putting "" around name in session_register?
> Hello, I have captured variables from any HTML that is POSTed to me from a
> 'foreach' clause. Now, possibly in this foreach clause I want to register
> these name/value pairs into a session var. I have tried :
> session_start();
> foreach ($HTTP_POST_VARS as $name=>$value) {
> $name=$value;
> session_register(name); //without the $
> }
> and get nothing.
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




[PHP] php 4.0.6, apache problem

2002-02-15 Thread Pushkar Pradhan

Hi,
I've installed php 4.0.6 since I am working with mapserver which works
with 4.0.6 only.
This is my configuration:
./configure  --prefix=/rstc/user1/erc/pushkar/php-4.0.6
--with-apxs=/rstc/user1/erc/pushkar/apache_1.3.22/bin/apxs
After this I add the foll. to my httpd.conf file of apache (1.3.22),
solaris, sparc.
LoadModule php4_module libexec/libphp4.so
AddModule /rstc/user1/erc/pushkar/php-4.0.6/sapi/apache/mod_php4.c
During php install. libphp4.so got copied to the libexec dir. of apache
correctly, however mod_php4.c is in php dir. to where I have given the
path.
My apache config is:
./configure --with-layout=Apache
--prefix=/rstc/user1/erc/pushkar/apache_1.3.22 --enable-module=so
However when I try to start up apache I get the foll. error:
Banshee[540] pushkar$ apachectl start
Syntax error on line 205 of
/rstc/user1/erc/pushkar/apache_1.3.22/conf/httpd.conf:
Cannot load /rstc/user1/erc/pushkar/apache_1.3.22/libexec/libphp4.so into
server: ld.so.1: /rstc/user1/erc/pushkar/apache_1.3.22/bin/httpd: fatal:
relocation error: file
/rstc/user1/erc/pushkar/apache_1.3.22/libexec/libphp4.so: symbol
ap_block_alarms: referenced symbol not found
./apachectl start: httpd could not be started
Can anybody suggest what is wrong, I tried the mailing list but the solns.
didn't work.
Thanks,

--
PUSHKAR S. PRADHAN
Research Assistant
MISSISSIPPI STATE UNIVERSITY,
STARKVILLE, MS 39759.

Engineering Research Center
Box 9627
Mississippi State, MS 39762-9627
--



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




[PHP] how to avoid executing whole script

2002-04-20 Thread Pushkar Pradhan

Hi,
I'm new to php, I want to do the foll: in my code:
display an array of names to the user,
up, down, top and bottom buttons are provided so that the user can change
the order of the names (e.g. if original array: "a, b, c, d, e and user
selects e and presses top array should become e, a, b.

I am able to achieve this functionality however since the whole script is
executed each time the array gets redefined after each button press thus
it remains a, b, c,d ...

Finally I've a submit button, if this is pressed user should be able to go
back and do whatever he was doing with the names.

my code looks like this:
define array
html for presentation (form which goes to function changelayerorder())
function changelayerorder (this func. detects which button and name was
selected and changes order)

I tried a while loop (while submit button not pressed) {do ...}
but it results in the page never being able to load.
CAN ANYONE ADVISE ME HOW TO AVOID REDEFINING THE ARRAY. THANKS,


-Pushkar S. Pradhan


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




[PHP] passing array as hidden field

2002-04-24 Thread Pushkar Pradhan

I want to pass a 1 dim. array through a form, I use the hidden field and
do as follows:


This generates the foll. source:



where actually it should be $layer[] = "a", "b", "c", 
i.e. it doesn't remain an array anymore and thus I cannot do array
operations (eg. array_slice etc.) on it.
Can anyone tell how I can pass it to my forms as an array? Thanks


-Pushkar S. Pradhan


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




Re: [PHP] newbie: string manipulation

2002-04-24 Thread Pushkar Pradhan

Try this, not the most efficient way.
$names = explode("/", /usr/blah/);
last_element = sizeof($names)-1;
$name[last_element] = abigfile
> I need code that grabs the file at the end of a file path.
> I have this:
>
> /usr/blah/doh/yuck/wow/abigfile.html
>
> And would like to return this:
>
> abigfile.html
>
> Could somebody show me how to do this?
>
> Thank you!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




[PHP] redirect to new page and pass variables too?

2002-04-24 Thread Pushkar Pradhan

I am collecting some data on a page - test.php, ($layer which is an array
of names).
If checkbox is checked that user wants to change drawing order, I should
redirect the browser to page - "updateHTML.php" which has necessary script
to do that.
I achieved redirection using header(), but can't pass the $layer array
with it.
I tried something like:
form..
input type hidden layer...
header()
but then the page isn't redirected since I get a warning that headers have
been sent before the execu. of this line.
What is the way to do this? I don't want to do include since it will put
the contents of both the scripts on the same page.
Thanks,

-Pushkar S. Pradhan


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




[PHP] redirect to new page and pass variables too? (fwd)

2002-04-24 Thread Pushkar Pradhan

My previous question:
I am collecting some data on a page - test.php, ($layer which is an array
of names).
If checkbox is checked that user wants to change drawing order, I should
redirect the browser to page - "updateHTML.php" which has necessary script
to do that.
I achieved redirection using header(), but can't pass the $layer array
with it.
I tried something like:
form..
input type hidden layer...
header()
but then the page isn't redirected since I get a warning that headers have
been sent before the execu. of this line.
What is the way to do this? I don't want to do include since it will put
the contents of both the scripts on the same page.

from the archives I understand I can't pop up a new window, fine if the
page is displayed in the same window it's okay, but how to pass the
variables?

Thanks,

-Pushkar S. Pradhan



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




Re: [PHP] redirect to new page and pass variables too? (fwd)

2002-04-24 Thread Pushkar Pradhan

Thanks Miguel,
I was just reading urlencode.php, shouldn't the complementary function be
urldecode() like the document. says,
well unserialize must be working too, I believe you.
> On Wed, 24 Apr 2002, Pushkar Pradhan wrote:
> > I am collecting some data on a page - test.php, ($layer which is an array
> > of names).
> > If checkbox is checked that user wants to change drawing order, I should
> > redirect the browser to page - "updateHTML.php" which has necessary script
> > to do that.
> > I achieved redirection using header(), but can't pass the $layer array
> > with it.
> > I tried something like:
> > form..
> > input type hidden layer...
> > header()
> > but then the page isn't redirected since I get a warning that headers have
> > been sent before the execu. of this line.
> > What is the way to do this? I don't want to do include since it will put
> > the contents of both the scripts on the same page.
>
>   header('Location: updateHTML.php?layer='
> . urlencode(serialize($layer)));
>
> and then inside updateHTML.php
>
>   $layer = unserialize($_REQUEST('layer'));
>
> miguel
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] redirect to new page and pass variables too? (fwd)

2002-04-24 Thread Pushkar Pradhan

As I am using php 4.0.6 I don't have $_REQUEST available, and there is no
equivalent in earlier vers.
The foll. doesn't work:
updateHTML.php:
$layer = urldecode(unserialize($layer));
I get this:
Warning: Invalid argument supplied for foreach() in
/rstc/user1/erc/pushkar/gis/mcrgdl//updateHTML.php on line 68
i.e. the array is not available.

test.php:
header("Location: 
http://".$HTTP_SERVER_VARS['HTTP_HOST'].dirname($HTTP_SERVER_VARS['PHP_SELF'])."/".$relative_url."/"."updateHTML.php?layer="
. urlencode(serialize($layer)) );

Actually after doing a unserialize I see $layer as size 1 but when I try
to echo the contents it's blank.

On Wed, 24 Apr 2002, Miguel Cruz wrote:

> On Wed, 24 Apr 2002, Pushkar Pradhan wrote:
> > I was just reading urlencode.php, shouldn't the complementary function be
> > urldecode() like the document. says,
> > well unserialize must be working too, I believe you.
>
> I'm pretty sure the urldecoding happens automatically. If you get funny
> results then it's worth sticking it in to see what happens.
>
> miguel
>

-Pushkar S. Pradhan


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




Re: [PHP] Array function to delete

2002-04-25 Thread Pushkar Pradhan

As far as I know there isn't such a function, what I do to achieve this:
1. find the position of the element you want to remove
2. slice the array into 2 arrays one contains all elements before this and
one contains all elements below this,
3. use shift to remove appropriate element
4. merge both arrays back.
Do you want the code?
> I've been checking the PHP documentation, but can't
> find a function that will delete a member of an array,
> like such:
>
> $a = array(1, 2, 3, 4, 5);
>
> Use the function, say array_delete($a, 3); and that
> will delete the third member in the array (which would
> be 4 above), so that the array would contain 1, 2, 3,
> 5.
>
> Is there such a function?
>
> __
> Do You Yahoo!?
> Yahoo! Games - play chess, backgammon, pool and more
> http://games.yahoo.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] Array function to delete

2002-04-25 Thread Pushkar Pradhan

That's neat but I just read the docs. it says unset() won't work inside a
function, even if you pass by reference!
Anyways as far as you don't use functions to do the delete it will work
fine.
>
> On Thursday, April 25, 2002, at 03:22  PM, Liam Gibbs wrote:
>
> > I've been checking the PHP documentation, but can't
> > find a function that will delete a member of an array,
> > like such:
> >
> > $a = array(1, 2, 3, 4, 5);
> >
> > Use the function, say array_delete($a, 3); and that
> > will delete the third member in the array (which would
> > be 4 above), so that the array would contain 1, 2, 3,
> > 5.
> >
> > Is there such a function?
>
> It's a secret.  Sshh!
>
> unset($a[0]);  // removes the first element
>
>
>
> 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
>

-Pushkar S. Pradhan


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




Re: [PHP] Array function to delete

2002-04-25 Thread Pushkar Pradhan


$layer is my array -
 $currPos = array_search($HTTP_POST_VARS["selLayer"], $layer);
 $arrB = array_slice($layer, $currPos);
 $val  = array_shift($arrB);
 $arrA = array_slice($layer, 0, $currPos);
 $layer = array_merge($arrA, $arrB);
 // I do this to change the position of the element actually
 // so you can comment this out
 // array_unshift($layer, $val);
It's little memory expensive since it will create two more arrays but you
can use unset or something to delete them, will work inside a function.


> No. :-)
>
> What I've had to do is add a dummy value, unset($array[4]) and then array_pop the 
>dummy value off
> the array to get it out of there completely. The reason: unset will only remove 
>$array[4]'s value,
> not the key.
>
> There are plenty of other ways I'm sure, but simply unsetting has really messed me 
>up on occasion.
> I'll unset a value and then implode my array (say a list of numbers), and end up 
>with a string like
> so:
>
> 1,233,642,,234,5632,
>
> Where I've unset the 4th and last keys. Which of course really messes up and explode.
>
> # Nathan
>
> - Original Message -
> From: "Liam Gibbs" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, April 25, 2002 1:22 PM
> Subject: [PHP] Array function to delete
>
>
> I've been checking the PHP documentation, but can't
> find a function that will delete a member of an array,
> like such:
>
> $a = array(1, 2, 3, 4, 5);
>
> Use the function, say array_delete($a, 3); and that
> will delete the third member in the array (which would
> be 4 above), so that the array would contain 1, 2, 3,
> 5.
>
> Is there such a function?
>
> __
> Do You Yahoo!?
> Yahoo! Games - play chess, backgammon, pool and more
> http://games.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
>

-Pushkar S. Pradhan


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




Re: [PHP] redirect to new page and pass variables too? (fwd)

2002-04-25 Thread Pushkar Pradhan

I'm trying to do urlencode/urldecode:
my $layer[] contains: aban_railroads, airport_runways2001, blk_grps
this is what IE shows in my address window when I do the redirection:
http:///updateHTML.php?layer=a%3A3%3A%7Bi%3A0%3Bs%3A14%3A%22aban_railroads%22%3Bi%3A1%3Bs%3A19%3A%22airport_runways2001%22%3Bi%3A2%3Bs%3A8%3A%22blk_grps%22%3B%7D
It means that these 3 elements are there, however I tried both
1. unserialize($layer)
2. urldecode(unserial...)
inside updateHTML.php but still I get:
Warning: Invalid argument supplied for foreach() in
/rstc/user1/erc/pushkar/gis/mcrgdl/updateHTML.php on line 68

This is how I do redirect:
   header("Location:
http://".$HTTP_SERVER_VARS['HTTP_HOST'].dirname($HTTP_SERVER_VARS['PHP_SELF'])."/".$relative_url
."updateHTML.php?layer=" . urlencode(serialize($layer)) );

What could be wrong?
> > I was just reading urlencode.php, shouldn't the complementary function be
> > urldecode() like the document. says,
> > well unserialize must be working too, I believe you.
>
> I'm pretty sure the urldecoding happens automatically. If you get funny
> results then it's worth sticking it in to see what happens.
>
> miguel
>

-Pushkar S. Pradhan



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




Re: [PHP] redirect to new page and pass variables too? (fwd)

2002-04-25 Thread Pushkar Pradhan

Regarding my previous post:
I found out that $QUERY_STRING contains the query:
layer=a%3A3%3A%7Bi%3A0%3Bs%3A14%3A%22aban_railroads%22%3Bi%3A1%3Bs%3A19%3A%22airport_runways2001%22%3Bi%3A2%3Bs%3A8%3A%22blk_grps%22%3B%7D
Now I am doing:
$layer = unserialize($QUERY_STRING);
or even unserialize(urldecode($QUERY_..))
But still the array is undefined in the script? Any ideas?
Thanks,
> I'm trying to do urlencode/urldecode:
> my $layer[] contains: aban_railroads, airport_runways2001, blk_grps
> this is what IE shows in my address window when I do the redirection:
> 
>http:///updateHTML.php?layer=a%3A3%3A%7Bi%3A0%3Bs%3A14%3A%22aban_railroads%22%3Bi%3A1%3Bs%3A19%3A%22airport_runways2001%22%3Bi%3A2%3Bs%3A8%3A%22blk_grps%22%3B%7D
> It means that these 3 elements are there, however I tried both
> 1. unserialize($layer)
> 2. urldecode(unserial...)
> inside updateHTML.php but still I get:
> Warning: Invalid argument supplied for foreach() in
> /rstc/user1/erc/pushkar/gis/mcrgdl/updateHTML.php on line 68
>
> This is how I do redirect:
>header("Location:
> 
>http://".$HTTP_SERVER_VARS['HTTP_HOST'].dirname($HTTP_SERVER_VARS['PHP_SELF'])."/".$relative_url
> ."updateHTML.php?layer=" . urlencode(serialize($layer)) );
>
> What could be wrong?
> > > I was just reading urlencode.php, shouldn't the complementary function be
> > > urldecode() like the document. says,
> > > well unserialize must be working too, I believe you.
> >
> > I'm pretty sure the urldecoding happens automatically. If you get funny
> > results then it's worth sticking it in to see what happens.
> >
> > miguel
> >
>
> -Pushkar S. Pradhan
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] Re: array - change elements position

2002-04-25 Thread Pushkar Pradhan

Have you thought about swapping the elements, it's quite simple, I don't
know about more complicated methods using pointers
here's the code:
$layer is the array -
  $currPos = array_search($HTTP_POST_VARS["selLayer"], $layer);
  $temp = $layer[$currPos];
  $layer[$currPos] = $layer[$currPos-1];
  $layer[$currPos-1] = $temp;

> My example wasn't good.
>
> I have a array of objects and want change its positions.
>
> $array = (obj2, obj1, obj3)  --> $array = (obj1, obj2, obj3).
>
> Like TStringList.Exchange in Delphi.
>
> Sort() don't work in this case, because I want sort based in a attribute of
> the object.
>
> Evandro
>
>
> "Evandro Sestrem" <[EMAIL PROTECTED]> escreveu na mensagem
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hello,
> >
> > Has a automatic way to change the position from 2 elements of a array
> > without use a aux variable?
> > Like that:
> > A = (1,3,2)  --> A = (1, 2, 3)
> >
> > Thanks,
> >
> > Evandro
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




[PHP] passing vars. betn. php and javascript

2002-04-26 Thread Pushkar Pradhan

I need to pass an array from php to javascript,
change the ordering of the elements in javasc..
pass this reordered array back to php script?
Is it possible to do this and if so can anyone send me the basic code,
I've never written javascript? Thanks,

-Pushkar S. Pradhan


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




Re: [PHP] passing vars. betn. php and javascript

2002-04-26 Thread Pushkar Pradhan

In my php I had 4 buttons, up, down, top and bottom:
After detecting which element and which button was clicked I changed the
element position by
using array_slice, shift, unshift, array_merge etc..
I'm not sure what I'll do it JS
> On Saturday 27 April 2002 00:56, Pushkar Pradhan wrote:
> > I need to pass an array from php to javascript,
> > change the ordering of the elements in javasc..
> > pass this reordered array back to php script?
> > Is it possible to do this and if so can anyone send me the basic code,
> > I've never written javascript? Thanks,
>
> How is the array reordered?
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> Maturity is only a short break in adolescence.
>   -- Jules Feiffer
> */
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




RE: [PHP] passing vars. betn. php and javascript

2002-04-26 Thread Pushkar Pradhan

Actually I was frustrated trying to redirect to a new page and not being
able to pass the array along to the new page usign header(), I won't get
the array in my new page. Also I thought JS would be faster since the
client can submit after doing as many reorderings as he/she wants.

> Is there any reason that you have to use JS to redo the array?  I did
> something like this once and had the buttons monitored by JS, then when you
> click it set a hidden var (with a name like sort) and submitted the page.
> Then my PHP read in everything and redrew the graph based on what we were
> sorting by.  It wasn't as difficult as it sounds - the only problem was they
> decided that it wasn't pertinent to that graph, so we aren't using it
> anymore.  I don't know if I have any of the code left.
>
> -Natalie
>
> -Original Message-
> From: Jason Wong [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 26, 2002 1:46 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] passing vars. betn. php and javascript
>
>
> On Saturday 27 April 2002 01:23, Pushkar Pradhan wrote:
> > In my php I had 4 buttons, up, down, top and bottom:
> > After detecting which element and which button was clicked I changed
> > the element position by using array_slice, shift, unshift, array_merge
> > etc.. I'm not sure what I'll do it JS
>
> Well, depending on how you were reordering the array I was going to suggest
> you use php. Since you already have a version in php and you want to do it
> in
> javascript then ...
>
> > > > I've never written javascript? Thanks,
>
> I suggest you learn some javascript then think about how to "pass an array"
> to it from php :)
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> The profession of book writing makes horse racing seem like a solid, stable
> business.
>   -- John Steinbeck
>   [Horse racing *is* a stable business ...]
> */
>
> --
> 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
>

-Pushkar S. Pradhan


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




Re: [PHP] passing vars. betn. php and javascript

2002-04-26 Thread Pushkar Pradhan

Believe me I certainly don't want to ask a JS ques. here, I am reading
tutorials on the web!
I already accomplished reordering using PHP, I gave up on php since I
wasn't able to pass arrays betn. pages using header().
In PHP when user moves each element and submits up, down, top or bottom
there is server-client communication while in JS there will be
server-client comm. only at the end when a Done button is pressed.
i.e. SPEED :-)

> This sounds susspiciously like a Javascript question to me.  :)
>
> I wrote a PHP/Javascript system a while back that prints out an event
> calendar on a client page.  The Javascript is copy&paste so you can have the
> calendar show up on any web page anywhere in the world.  It works like
> this..
>
> The Javascript on the client's page redirects to the PHP script on my server
> with display_dates and clientid in the URL string.  Then the PHP script
> parses $_GET and extracts the requested data from the database.  Then the
> PHP script does a redirect back to the originating Javascript (known by
> $HTTP_REFERER) with the compressed data (again in the URL string).  The
> Javascript does some simple parsing and generates the calendar table based
> on the extracted values.
>
> This sounds a lot like what you want to do.  But how you parse the data in
> Javascript is obviously not a PHP question.  Are you're certain this
> reordering isn't something that can be done in PHP?  I guess my real
> question is what is the Javascript for?
>
> -Kevin
>
> - Original Message -
> From: "Pushkar Pradhan" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, April 26, 2002 11:23 AM
> Subject: Re: [PHP] passing vars. betn. php and javascript
>
>
> > In my php I had 4 buttons, up, down, top and bottom:
> > After detecting which element and which button was clicked I changed the
> > element position by
> > using array_slice, shift, unshift, array_merge etc..
> > I'm not sure what I'll do it JS
>
> > > On Saturday 27 April 2002 00:56, Pushkar Pradhan wrote:
> > > > I need to pass an array from php to javascript,
> > > > change the ordering of the elements in javasc..
> > > > pass this reordered array back to php script?
> > > > Is it possible to do this and if so can anyone send me the basic code,
> > > > I've never written javascript? Thanks,
> > >
> > > How is the array reordered?
> > >
> > > --
> > > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> > > Open Source Software Systems Integrators
> > > * Web Design & Hosting * Internet & Intranet Applications Development *
> > >
> > > /*
> > > Maturity is only a short break in adolescence.
> > > -- Jules Feiffer
> > > */
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> > -Pushkar S. Pradhan
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>

-Pushkar S. Pradhan


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




Re: [PHP] passing vars. betn. php and javascript

2002-04-26 Thread Pushkar Pradhan

Great! It works fine. Thanks to Kevin, Erik, Miguel and all others who
responded to this query since yesterday.
I have $QUERY_STRING in my php 4.0.6.



On Fri, 26 Apr 2002, Kevin Stone wrote:

> Okay I'm beginning to understand.  I don't think you have to use Javascript
> in this situation you jsut have to be a little clever about how you build
> your URL string.  You can send an array through the URL by splitting up each
> value like this..
>
> $url = 'http://www.domain.com/index.php?myarray[]='.$myarray[0];
> for ($i=1; $i {
> $url  .= '&myarray[]='.$myarray[$i];
> }
> header("Location: $url");
>
> You will get $_GET[myarray] on the other side.  OR you can do a single comma
> or semicolon delimited string and then explode(',' $myarray) on the other
> end to reconstitue the array.  Hope that helps.
>
> -Kevin
>
> - Original Message -
> From: "Pushkar Pradhan" <[EMAIL PROTECTED]>
> To: "Leotta, Natalie (NCI/IMS)" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Friday, April 26, 2002 12:10 PM
> Subject: RE: [PHP] passing vars. betn. php and javascript
>
>
> > Actually I was frustrated trying to redirect to a new page and not being
> > able to pass the array along to the new page usign header(), I won't get
> > the array in my new page. Also I thought JS would be faster since the
> > client can submit after doing as many reorderings as he/she wants.
> >
> > > Is there any reason that you have to use JS to redo the array?  I did
> > > something like this once and had the buttons monitored by JS, then when
> you
> > > click it set a hidden var (with a name like sort) and submitted the
> page.
> > > Then my PHP read in everything and redrew the graph based on what we
> were
> > > sorting by.  It wasn't as difficult as it sounds - the only problem was
> they
> > > decided that it wasn't pertinent to that graph, so we aren't using it
> > > anymore.  I don't know if I have any of the code left.
> > >
> > > -Natalie
> > >
> > > -Original Message-
> > > From: Jason Wong [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, April 26, 2002 1:46 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: [PHP] passing vars. betn. php and javascript
> > >
> > >
> > > On Saturday 27 April 2002 01:23, Pushkar Pradhan wrote:
> > > > In my php I had 4 buttons, up, down, top and bottom:
> > > > After detecting which element and which button was clicked I changed
> > > > the element position by using array_slice, shift, unshift, array_merge
> > > > etc.. I'm not sure what I'll do it JS
> > >
> > > Well, depending on how you were reordering the array I was going to
> suggest
> > > you use php. Since you already have a version in php and you want to do
> it
> > > in
> > > javascript then ...
> > >
> > > > > > I've never written javascript? Thanks,
> > >
> > > I suggest you learn some javascript then think about how to "pass an
> array"
> > > to it from php :)
> > >
> > > --
> > > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> > > Open Source Software Systems Integrators
> > > * Web Design & Hosting * Internet & Intranet Applications Development *
> > >
> > > /*
> > > The profession of book writing makes horse racing seem like a solid,
> stable
> > > business.
> > > -- John Steinbeck
> > > [Horse racing *is* a stable business ...]
> > > */
> > >
> > > --
> > > 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
> > >
> >
> > -Pushkar S. Pradhan
> >
> >
> > --
> > 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
>

-Pushkar S. Pradhan


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




Re: [PHP] Variables not set

2002-04-26 Thread Pushkar Pradhan

On Fri, 26 Apr 2002, Liam Gibbs wrote:
Shouldn't you be using GLOBAL to access $this, $that inside functions?
> I have a problem with my variables not being set. I
> have a file I use for constants and functions,
> structured like so:
>
> $this = "this";
> $that = "that";
> .
> .
> .
> function this() {
  GLOBAL $this;
  GLOBAL $that;
> $h = $this;
> $i = $that;
> }
>
> function that() {
> }
>
> Now, when I run this(), $this isn't set (even though
> it's above it in the same file). I can pretty much
> guess (when running a function, it won't parse through
> the whole file, just skips to that function), but I
> was wondering if there is another solution. I'd hate
> to separate the variable settings and the functions,
> but will if I have to.
>
> __
> Do You Yahoo!?
> Yahoo! Games - play chess, backgammon, pool and more
> http://games.yahoo.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] File uploading fails

2002-05-01 Thread Pushkar Pradhan

You haven't defined $file_name before trying to echo it, I think you'll
have to create it using $HTTP_POST_...['file'] and HTT...['name']
Also check your php.ini to see if file uploads are allowed and if yes the
max. limit.
> I have searched high and low and done everything
> recommended generically and yet am still having
> problems uploading files. My script is as follows:
> 
>  error_reporting(E_ALL);
> echo phpinfo();
> echo $file_name;
> echo $HTTP_POST_FILES['file']['name'];
> if (isset($file)){
> echo "Successfully uploaded ", $file_name, "\n";
> }
> ?>
>  enctype="multipart/form-data">
> 
> 
> 
> 
>
> Output is as follows:
>
> Warning: Undefined variable: file_name in addimage.php
> on line 5
>
> Warning: Undefined index: file in addimage.php on line
> 6
>
> I get this message with all the variations of file
> upload testing.
>
> FYI I'm trying to upload a 160K jpg file for testing.
>
> Using Apache and Linux server. WIN IE Client.
>
> Help would be greatly appreciated.
>
> TIA,
> Tim
> unka_timmyATyahoo.com
>
>
> __
> Do You Yahoo!?
> Yahoo! Health - your guide to health and wellness
> http://health.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] Get Pagetitle with PHP

2002-05-02 Thread Pushkar Pradhan

Sine PHP has so many string parsing functions, you can grab the text
betn.
...

e.g. HTML code:



..

Read the whole file by line into an array -
http://www.php.net/manual/en/function.file.php

search for line containing 
for($lines as $onelineatatime) {
strpos($onelineatatime, "")

remove  and 
substr()
> Hi,
>
> is it possible to get the HTML-Pagetitle with PHP?
>
> Thanks for help.
> Ivo
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




RE: [PHP] Stupid question

2002-05-02 Thread Pushkar Pradhan

Since round() is a maths routine, it will return the most approx. value of
your 0.02388.. in 3 decimal digits.
If you just want to return the first 3 digits after the decimal use the
string routines suggested by Rober Zwink or :
$number = $number*1000;   // 23.884
$number = floor($number); // 23
You can also see http://www.php.net/manual/en/function.floor.php and
http://www.php.net/manual/en/function.ceil.php for what they do.

for a more general routine which will return any no of digits after
decimal:
$multiplier = pow(10, $noOfDigitsAfterDecimal); // 10^3
$number = $number*$multiplier;
$number = floor($number);


> When I run:
>
> $number = 0.023884057998657;
> echo round($number, 3);
> echo number_format($number, 3);
>
> Both function output "0.024", both functions round the last digit.  This is
> contrary to the example in the manual which shows this:
>
> $number = 1234.5678;
>
> // english notation without thousands seperator
> $english_format_number = number_format($number, 2, '.', '');
> // 1234.56
>
> http://www.php.net/manual/en/function.number-format.php
>
> My output for the above is:
> 1234.57 not 1234.56
>
> I'm using PHP Version 4.0.6
>
> I would consider using the following to truncate a number if you do not want
> to round.  There may be a better way, but this seems to work fine.
>
> substr($number, 0,strpos($number, ".")+4);
>
>
> Robert V. Zwink
> http://www.zwink.net
>
>
> -Original Message-
> From: Craig Vincent [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 02, 2002 5:54 AM
> To: Liam MacKenzie; [EMAIL PROTECTED]
> Subject: RE: [PHP] Stupid question
>
>
>
> > I have a script that outputs this:
> > 0.023884057998657
> >
> > What's the command to make it shrink down to this:
> > 0.023
> >
> >
> > I thought it was eregi() something, but I forgot.  sorry
>
> It depends on what you need.
>
> If you want to round the number off to 3 decimal points use the round()
> function.  However if you don't want to round and instead just want to
> truncate the number, the number_format() function would be what you need.
>
> Sincerely,
>
> Craig Vincent
>
>
>
> --
> 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
>

-Pushkar S. Pradhan


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




[PHP] pass. vars. betn. javascript and php

2002-05-06 Thread Pushkar Pradhan

Is it possible to pass variables from a php page to a page using
javascript, and vice versa,
I've the variable - an array passed in the url of the page.

-Pushkar S. Pradhan


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




[PHP] array_search in 2-d arrays

2002-05-14 Thread Pushkar Pradhan

I've a 2 D array and would like to search for vals. in the first dimension
only i.e.
myArray[0][0]
myArray[1][0]
myArray[2][0]
myArray[3][0]
.
.
.
and not in the elements myArray[0][1]

CODE:
for($l = 0; $l < count($layer); $l++) {
   $key = array_search($layer[$l], $layerDes);   // $layerDes is 2-D
   $layer[$l] = $layerNames[$key];
}
My $key is undefined after execution, is it because the elements are in
$layerDes[i][0]?
Using $key === also didn't help? Any ideas, thanks.

-Pushkar S. Pradhan



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




Re: [PHP] array_search in 2-d arrays

2002-05-14 Thread Pushkar Pradhan

Regarding my recent post, I am sorry $key is not undefined it is just "0"
or "FALSE".
> I've a 2 D array and would like to search for vals. in the first dimension
> only i.e.
> myArray[0][0]
> myArray[1][0]
> myArray[2][0]
> myArray[3][0]
> .
> .
> .
> and not in the elements myArray[0][1]
>
> CODE:
> for($l = 0; $l < count($layer); $l++) {
>$key = array_search($layer[$l], $layerDes);   // $layerDes is 2-D
>$layer[$l] = $layerNames[$key];
> }
> My $key is undefined after execution, is it because the elements are in
> $layerDes[i][0]?
> Using $key === also didn't help? Any ideas, thanks.
>
> -Pushkar S. Pradhan
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




[PHP] array search in 2-D arrays

2002-05-15 Thread Pushkar Pradhan

I've a 2 D array and would like to search for vals. in the first dimension
only i.e.
myArray[0][0]
myArray[1][0]
myArray[2][0]
myArray[3][0]
.
.
.
and not in the elements myArray[0][1]

CODE:
for($l = 0; $l < count($layer); $l++) {
   $key = array_search($layer[$l], $layerDes);   // $layerDes is 2-D
   $layer[$l] = $layerNames[$key];
}
My $key is FALSE/0 after execution, is it because the elements are in
$layerDes[i][0]?
Using $key === also didn't help? Any ideas, thanks.


-Pushkar S. Pradhan


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




Re: [PHP] array search in 2-D arrays

2002-05-15 Thread Pushkar Pradhan

Oops! Sorry I got a reply for this but didn't read my mail carefully
enough. Thanks to Tim Ward for pointing out the problem.
> I've a 2 D array and would like to search for vals. in the first dimension
> only i.e.
> myArray[0][0]
> myArray[1][0]
> myArray[2][0]
> myArray[3][0]
> .
> .
> .
> and not in the elements myArray[0][1]
>
> CODE:
> for($l = 0; $l < count($layer); $l++) {
>$key = array_search($layer[$l], $layerDes);   // $layerDes is 2-D
>$layer[$l] = $layerNames[$key];
> }
> My $key is FALSE/0 after execution, is it because the elements are in
> $layerDes[i][0]?
> Using $key === also didn't help? Any ideas, thanks.
>
>
> -Pushkar S. Pradhan
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan



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




Re: [PHP] PHP Tag question

2002-05-15 Thread Pushkar Pradhan

You can tell that from the php.ini file look for:

; Allow the  tags are
recognized.
short_open_tag = On

So basically you can switch them on/off.

On Wed, 15 May 2002, Matthew Walker wrote:

> I'm writing a coding standards document for our programmers, and I need
> to know if the 'echo' shortcut PHP tags are always on, or if we need to
> assume they might not be on.
>
> (By echo shortcut, I mean this syntax: )
>
> Matthew Walker
> Senior Software Engineer
> ePliant Marketing
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] PHP Tag question

2002-05-15 Thread Pushkar Pradhan

Yes  I believe he was talking about
>
>  vs. 
>
> not 
> I don't know of any way to disable  being on. Does 
> ---John Holmes...
> - Original Message -
> From: "Pushkar Pradhan" <[EMAIL PROTECTED]>
> To: "Matthew Walker" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Wednesday, May 15, 2002 4:49 PM
> Subject: Re: [PHP] PHP Tag question
>
>
> > You can tell that from the php.ini file look for:
> >
> > ; Allow the  tags are
> > recognized.
> > short_open_tag = On
> >
> > So basically you can switch them on/off.
> >
> > On Wed, 15 May 2002, Matthew Walker wrote:
> >
> > > I'm writing a coding standards document for our programmers, and I need
> > > to know if the 'echo' shortcut PHP tags are always on, or if we need to
> > > assume they might not be on.
> > >
> > > (By echo shortcut, I mean this syntax: )
> > >
> > > Matthew Walker
> > > Senior Software Engineer
> > > ePliant Marketing
> > >
> > >
> > >
> > > ---
> > > Outgoing mail is certified Virus Free.
> > > Checked by AVG anti-virus system (http://www.grisoft.com).
> > > Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> > -Pushkar S. Pradhan
> >
> >
> > --
> > 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
>

-Pushkar S. Pradhan


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




[PHP] do I need sessions?

2002-05-21 Thread Pushkar Pradhan

I've an array $layer in php, I pass this to javascript, JS can then
add/remove elements and I get it back in php. I do this using:

layerDesStr = '';  // php to JS

// JS to php
   for(var i = 1; i < layer.length; i++) {
  goURL = goURL + "&layer[]=" + layer[i];
   }
   document.location.href = goURL;
I retrieve them in my php code using $HTTP_GET_VARS["layer"]

This is fine when the user uses JS to modify the array, but if the user
uses JS to modify it and then wants to do some operation on it in php,
this variable ($layer) doesn't show up, because now
$HTTP_GET_VARS["layer"] is not defined.
My ques. is how do I save the variable betn. successive clicks by the
user, do I need sessions? I tried the foll. without success:
http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] unable to register session variables

2002-05-22 Thread Pushkar Pradhan

I am following example 4 on http://www.php.net/manual/en/ref.session.php
code:
if(!session_is_registered("layer") ) {
   session_register("layer");
}
I tried both "" and ''s.
Doing a phpinfo() on the pg. doesn't show any $HTTP_SESSION_VARS

I've both track_vars and register_globals enabled in my php.ini
Any idea what's wrong? Thanks,

-Pushkar S. Pradhan


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




Re: [PHP] unable to register session variables

2002-05-22 Thread Pushkar Pradhan

Aren't there two method to register variables:
1. session_start() as you suggested with track_vars enabled
2. !session_is_registered() with register_globals enabled

I tried session_start also but didn't work, phpinfo() doesn't show any
$HTTP_SESSION_VARS
> Are you starting the session first?
>
>  session_start();
> session_register('variable');
> ?>
>
> Jim Lucas
> - Original Message -
> From: "Pushkar Pradhan" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, May 22, 2002 10:19 AM
> Subject: [PHP] unable to register session variables
>
>
> > I am following example 4 on http://www.php.net/manual/en/ref.session.php
> > code:
> > if(!session_is_registered("layer") ) {
> >session_register("layer");
> > }
> > I tried both "" and ''s.
> > Doing a phpinfo() on the pg. doesn't show any $HTTP_SESSION_VARS
> >
> > I've both track_vars and register_globals enabled in my php.ini
> > Any idea what's wrong? Thanks,
> >
> > -Pushkar S. Pradhan
> >
> >
> > --
> > 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
>

-Pushkar S. Pradhan


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




Re: [PHP] fputs() pblm how write on a new line each time ?

2002-05-22 Thread Pushkar Pradhan

How about this:
fputs($fic,"on a new line\n");
This works in c.
> Hi all,
> I' m searching how to write in a file on a new line each times whith
> fputs().
> Because i want read the file whith file() and so ,have one line per indice
> in a table.
> So i need to write  on a new line each time.
>$fic = fopen("toto.txt","a+");
>   fputs($fic,"on a new line");
>   fclose($fic);
>
> ?>
>$tab = file("toto.txt");
>   for($i=0;$i   echo "$tab[$i]";
>   }
>
> ?>
>
> TIA.
>   arnaud.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] passing arrays

2002-05-23 Thread Pushkar Pradhan

Yes,
You have to append the array name and values to the end of the url.
You've to pass each element from html to php and vice versa, another
method is using
input hidden
http://yoururl.com/index.php&myarray[]=one&myarray[]=two&myarray[]=three
> hi,
>
> is there a way to pass arrays in forms or in the url?
>
> if i have $myarray=array("one","two","three");
>
> can i pass the whole array at once as opposed to having to pass each
> individual element?
>
> thanks.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] mail() function

2002-05-27 Thread Pushkar Pradhan

There is also a user note at the bottom of the documentation:
I tried to put "\r\n" at the end of each header line and Netscape
4.7 didn't work properly. I changed to "\n" and it worked well.
So, I tried it on Outlook Express 5.5 and Eudora 5.1 and it worked too
with "\n" only.

I hope it helps...

If this doesn't help, then maybe this is due to apache 2.0 since many php
scripts are not working on apache 2.0
> Dear fellars at php.net
>
> It appears to me that there is something wrong with the mail() function,
>
> I've got an Apache 2.0.36 webserver in an Windows XP environment,
> now everythin seems to work just fine until I try to execute this:
>
> mail("[EMAIL PROTECTED]", "My Subject", "Line 1\r\nLine 2\r\nLine3");
>
> it's almost the same code as on your web site but I changed the
> [EMAIL PROTECTED] to my own e-mail adress so I would be able to see if
> I've got the mail. I tried severeal ways (somethin with IMAP or such?) but
> since I'm a php newbie it is quite hard to find understandable
> documentation.
>
> I hope you are well informed by now and you can come up with some sort of an
> answer.
>
> Greetings,
>
> Jochem Kempe
>
>
>
>
> _
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-Pushkar S. Pradhan


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




Re: [PHP] mail() function

2002-05-27 Thread Pushkar Pradhan

I think you meant changing \r\n doesn't work?
Did you make necessary changes to the php.ini file:
[mail function]
; For Win32 only.
SMTP = localhost

; For Win32 only.
sendmail_from = [EMAIL PROTECTED]

; For Unix only.  You may supply arguments as well (default: 'sendmail -t
-i').
;sendmail_path =
Give the path of your sendmail, finally if nothing works it means apache
2.0 is the problem, it means many things in php won't work with it.
> Alright, so it doesn't work with my version of php. How can I make it work?
>
> Jochem
>
>
> From: Pushkar Pradhan <[EMAIL PROTECTED]>
> To: Jochem Kempe <[EMAIL PROTECTED]>
> CC: [EMAIL PROTECTED]
> Subject: Re: [PHP] mail() function
> Date: Mon, 27 May 2002 14:58:37 -0500 (CDT)
>
> There is also a user note at the bottom of the documentation:
> I tried to put "\r\n" at the end of each header line and Netscape
> 4.7 didn't work properly. I changed to "\n" and it worked well.
> So, I tried it on Outlook Express 5.5 and Eudora 5.1 and it worked too
> with "\n" only.
>
> I hope it helps...
>
> If this doesn't help, then maybe this is due to apache 2.0 since many php
> scripts are not working on apache 2.0
>  > Dear fellars at php.net
>  >
>  > It appears to me that there is something wrong with the mail() function,
>  >
>  > I've got an Apache 2.0.36 webserver in an Windows XP environment,
>  > now everythin seems to work just fine until I try to execute this:
>  >
>  > mail("[EMAIL PROTECTED]", "My Subject", "Line 1\r\nLine 2\r\nLine3");
>  >
>  > it's almost the same code as on your web site but I changed the
>  > [EMAIL PROTECTED] to my own e-mail adress so I would be able to see if
>  > I've got the mail. I tried severeal ways (somethin with IMAP or such?)
> but
>  > since I'm a php newbie it is quite hard to find understandable
>  > documentation.
>  >
>  > I hope you are well informed by now and you can come up with some sort of
> an
>  > answer.
>  >
>  > Greetings,
>  >
>  > Jochem Kempe
>  >
>  >
>  >
>  >
>  > _
>  > Send and receive Hotmail on your mobile device: http://mobile.msn.com
>  >
>  >
>  > --
>  > PHP General Mailing List (http://www.php.net/)
>  > To unsubscribe, visit: http://www.php.net/unsub.php
>  >
>
> -Pushkar S. Pradhan
>
>
>
>
>
> _
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>

-Pushkar S. Pradhan


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