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 coun
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 o
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 Ara
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:[EMA
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 Fail
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
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 s
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_P
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 G
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");
> >
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.
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($resu
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 fou
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
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
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" erro
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. Pra
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
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
>
>
>
> $mailBod
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
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 th
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
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 r
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'
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
> s
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 t
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
./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?
>
>
>
>
>
>
>
;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 Pra
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...
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
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.
>
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
>
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 p
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
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
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
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 n
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
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]
>
>
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 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
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); //
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, "")
remov
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 generical
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 th
.= '&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.
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] passi
-
> 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, d
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
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
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[$cu
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(urldeco
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_runways200
$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
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 documen
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
er)) );
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
>
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, ($lay
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 he
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
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:
>
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 a
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.
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.2
65 matches
Mail list logo