[PHP] oracle again!!!!

2002-06-05 Thread Michael P. Carel


Hi,

I've tried installing php with oracle support to my RedHat Linux server. Im
recieving this error when executing a sample Ora fucntion to connect to the
oracle database.My oracle database works fine but my script canot connect.
I've tried this sample script with my AIX server but it works fine.  I
really dont know why ...
Please help. heres my sample connect script:

PutEnv("ORACLE_SID=oracle");
PutEnv("ORACLE_HOME=/home/oracle/OraHome1");

$connection = Ora_Logon("system","manager");


if($connection==false){
echo Ora_ErrorCode($connection).":". Ora_error($connection)."";
exit;
}



And heres my warning error:

Warning: Oracle: Connection Failed: Error while trying to retrieve text for
error ORA-12546 in /home/www/htdocs/selecting.php on line 9

Warning: ora_errorcode(): supplied argument is not a valid
Oracle-Connection/Cursor resource in /home/www/htdocs/selecting.php on line
13

Warning: ora_error(): supplied argument is not a valid
Oracle-Connection/Cursor resource in /home/www/htdocs/selecting.php on line
13
:



I can connect to oracle remotely with my sqlplus using this account. Is
thereanything that i didnt know when settingup php with oracle in redhat
linux?



Thanks in advance.



Regards,
Mike


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




[PHP] Using checkboxes

2002-06-05 Thread Dirk Beijaard

Hey all,

I have a form, generated in php, with a lot of checkboxes on it. They
are initialized from the db. All checkboxes are in a 2d array and they
come through to my processing script fine. The only problem is that
the ones that are unchecked do not come through. I know that the post
command only sends the checked boxes. What I would like to know is which
ones were changed, ie checked or unchecked by the user. Right now I do
it by putting a string with the old values in a hidden textbox and 
comparing those to what I get back in the array. I have been thinking
about writing some client side script to produce the differences.

Does anyone know if there is a better way to do this? 

Thanks,
Dirk.


Re: [PHP] phpSearch

2002-06-05 Thread Ali Reza Sajedi

Hello,

try this:

http://www.digitalgenesis.com/software/dgssearch.html

---
Ali Reza Sajedi
Webentwicklung und -betreuung
BUP Goettingen
0551/54707-41
[EMAIL PROTECTED]
http://www.bupnet.de
---


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




RE: [PHP] PHP version 4.2 and above

2002-06-05 Thread Opere, James

I'm working on a windows2000 platform and i need to use php version >=4.2
for my graphics.How do i go about solving the problem of gd that can be
supported by the above php version? The gd in phpdev 4(php version 4.06)
cannot be supported by the bove php version.

-Original Message-
From: Miguel Cruz [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 23, 2002 10:20 AM
To: Opere, James
Cc: PHP Windows Discussion List; PHP General Discussion List
Subject: Re: [PHP] PHP version 4.2 and above


On Wed, 22 May 2002, Opere, James wrote:
> I have aproblem with php >= 4.2.I'm working on graphics but when i install
> php4.2, i get an error that it doesn't support GD library.
> Is there anybody who has any idea as to how it can be possible to use the
> above versions and still run my scripts successfully?
> 
> Currently i'm using phpdev4 which with php 4.06 which does not support
> global variables but support the GD library for Graphics.

Any version supports the GD library if you install it that way. But 
without knowing your platform it's hard to guess what you might have to do 
in order to get things going.

miguel

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




[PHP] PHP CGI cannot be accessed directly

2002-06-05 Thread MindHunter

Yes I have set cgi.force_redirect=0 in my php.ini file.  I have trippled
checked this!  I am running PHP 4.2.0 on Win2K IIS5 as CGI.  What am I
missing?  Any known bugs?

Tx
MH



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




Re: [PHP] dumb guy needs smart answer

2002-06-05 Thread Justin French

It can't find the file you asked to include on line 12 of test.php.

Post the code and we may be able to pin-point it.  The first half of the
error is to do with the default include path... in addition to the include
path you set with include(), there is a default that PHP also checks (in
your case, c:\php4\pear), which is set in php.ini.

Justin French


on 06/06/02 4:22 PM, Doug ([EMAIL PROTECTED]) wrote:

> I get the following error statement from a PHP insert I am trying at
> http://www.solomonsporch.org/test.php
> 
> Warning: Failed opening
> 'http://www.gospelcom.net/mnn/includes/pubNewsTease.php?li=yes&limit=4' for
> inclusion (include_path='c:\php4\pear') in e:\solomonsporch.org\test.php on
> line 12
> 
> I really don't know what I am doing -- but would sure appreciate getting
> this working. My host seems to be all set up.
> 
> Thanks for your time!
> 
> -Doug
> 


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




[PHP] dumb guy needs smart answer

2002-06-05 Thread Doug

I get the following error statement from a PHP insert I am trying at
http://www.solomonsporch.org/test.php

Warning: Failed opening
'http://www.gospelcom.net/mnn/includes/pubNewsTease.php?li=yes&limit=4' for
inclusion (include_path='c:\php4\pear') in e:\solomonsporch.org\test.php on
line 12

I really don't know what I am doing -- but would sure appreciate getting
this working. My host seems to be all set up.

Thanks for your time!

-Doug



Re: [PHP] phpSearch

2002-06-05 Thread Miguel Cruz

On Thu, 6 Jun 2002, millw0rm wrote:
> Hi, I m looking for a Search Engine kinda application which can search
> content inside my own website, which includes files like php, text, html &
> as well as mySQL db... do u guys hav ne idea where i can find the
> application or r there ne1 who can develop it for me pls... i tried few
> applications like phpdig, Site Search, phpMySearch but unfortunately now of
> them got what I need... neways can u help me out. pls

We do all that with mnogosearch (http://www.mnogosearch.ru/).

miguel


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




RE: [PHP] phpSearch

2002-06-05 Thread Niklas Lampén

Yeah, we'd be happy to develope such program for you. Is there something
else you need, cash? :


Niklas


-Original Message-
From: millw0rm [mailto:[EMAIL PROTECTED]] 
Sent: 6. kesäkuuta 2002 9:05
To: [EMAIL PROTECTED]
Subject: [PHP] phpSearch


Hi, I m looking for a Search Engine kinda application which can search
content inside my own website, which includes files like php, text, html
& as well as mySQL db... do u guys hav ne idea where i can find the
application or r there ne1 who can develop it for me pls... i tried few
applications like phpdig, Site Search, phpMySearch but unfortunately now
of them got what I need... neways can u help me out. pls






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

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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




[PHP] phpSearch

2002-06-05 Thread millw0rm

Hi, I m looking for a Search Engine kinda application which can search
content inside my own website, which includes files like php, text, html &
as well as mySQL db... do u guys hav ne idea where i can find the
application or r there ne1 who can develop it for me pls... i tried few
applications like phpdig, Site Search, phpMySearch but unfortunately now of
them got what I need... neways can u help me out. pls






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




Re: [PHP] date problem

2002-06-05 Thread Miguel Cruz

On Thu, 6 Jun 2002, andy wrote:
> I would like to count the users out of a mysql db who registered after a
> certain date.
> 
> The column I have in the db is a char and I do not want to change this
> anymore.
> This is how a typical entry looks like: May 29, 2002
> 
> This is how I tryed it:
> 
> // while '10...' is unix timestamp june 1, 02
> SELECT COUNT(*) AS c
> FROM users_table
> WHERE UNIX_TIMESTAMP( user_regdate ) > '1022882400'

You can only call UNIX_TIMESTAMP on a DATE or DATETIME field, not on just
any generic CHAR/VARCHAR/TEXT/whatever. "May 29, 2002" isn't a MySQL
timestamp, so I'm guessing you have a textual field type.

The lesson of all this is: Convert dates to either unix or database-native 
date format before storing them in the database. Things like "May 29, 
2002" are useless in a database.

At this point I'd recommend running a quick script to strtotime() all your
dates and then re-write them to a new field that's in a proper format.

miguel


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




[PHP] date problem

2002-06-05 Thread andy

Hi there,

I would like to count the users out of a mysql db who registered after a
certain date.

The column I have in the db is a char and I do not want to change this
anymore.
This is how a typical entry looks like: May 29, 2002

This is how I tryed it:

// while '10...' is unix timestamp june 1, 02
SELECT COUNT(*) AS c
FROM users_table
WHERE UNIX_TIMESTAMP( user_regdate ) > '1022882400'

Thanx for any help on that,

andy





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




Re: [PHP] Search Engine Friend Dynamic Pages

2002-06-05 Thread Scott Reismanis

Thanks for the feedback, once again timly and right on the money :)

What you mention is what I thought, I just had doubts which I wished to 
clarify.

- Original Message -
From: "Ashley M. Kirchner" <[EMAIL PROTECTED]>
Date: Thursday, June 6, 2002 2:46 pm
Subject: Re: [PHP] Search Engine Friend Dynamic Pages

> Scott Reismanis wrote:
> 
> > Just a quick question regarding developing search engine friendly
> > pages. Basically I am re-writing my site so that say mysite.com?
> > page=support&action=help becomes mysite.com/support/help/ Reason 
> why is
> > it looks nicer and is search engine friendly, as some search engines
> > cannot spider URLS with query strings.
> 
>Ye might want to read:
> 
>Building Dynamic Pages With Search Engines in Mind
>http://www.phpbuilder.net/columns/tim19990117.php3
> 
>and:
> 
>Revisited: Build Dynamic Pages With Search Engines in Mind
>http://www.phpbuilder.net/columns/tim2526.php3
> 
> 
> --
> H | "Life is the art of drawing without an eraser." - John Gardner
>  +
> 
>  Ashley M. Kirchner    .   303.442.6410 
> x130  Director of Internet Operations / SysAdmin. 
> 800.441.3873 x130
>  Photo Craft Laboratories, Inc.. 3550 Arapahoe 
> Ave, #6
>  http://www.pcraft.com . .  ..   Boulder, CO 80303, 
> U.S.A.
> 
> 
> 
 


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




[PHP] Is this possible

2002-06-05 Thread James Edgar

I am trying to run a class inside a class, it says that the object is there but when I 
go to get the info, it is not there. I have attached the code below and attache the 
xml.inc file. Any help would be greatly appreciated.

class myClass
{
function myFunc($var)
{
include("xml.inc");
$obj = new xml($data,"xml");  
if (is_object($obj)) 
{
print("Yes"); // It will print this
}
else
{
print("No");
}

/ below we will see the status of the result   
for($i=0;$iWhatever[0] . "\n"; 
}

echo($varvalue); // Does not echo anything.

} // end func

} // end class








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


[PHP] Re: Wierd problem.... Perhaps is the while ()

2002-06-05 Thread Gonzalo Daniel Vivanco Mocorrea

Proba lo siguiente (try the following):

$SQL = "SELECT... ...".$cliptoshow.")";

aca el ". significa terminar cadena de texto y concatenar lo que sigue a la
cadena y ." significa concatenar una nueva cadena (es lo ideal aunque ocupe
mas espacio y tiempo, pues separa variables del texto)
(here the ". is end the text string and append the following to the string,
and ." is append a new text string (is the ideal, because divide from
strings and variables, but take more space and time)

o quizas (or maybe)

$SQL = "SELECT... ...$cliptoshow\)";

el caracter de escape puede solucionar tu problema (the escape char can help
you)

Espero que estas soluciones funcionen

Gonzalo Daniel Vivanco Mocorrea
---
"Fernando Gonzalez" <[EMAIL PROTECTED]> escribió en el mensaje
000e01c0e031$29bf0de0$90fd30c8@servidor">news:000e01c0e031$29bf0de0$90fd30c8@servidor...
I have to php pages that call the same mysql query

The first page would be:


The query in this page works well with an $art variable that is being
passed.

The problem comes on another page where I have a an array being passed and I
dont know which would be the first value, so I have this:




I would have this error Not a valid MySQL result argument at line xxx  (line
xxx will be the one of  "$rows=mysql_fetch_array($results);")
The wierd thing will be that when I put an  echo $sql; line The Browser will
show me this:

SELECT mae_articulos.fecha_pub, mae_medios.des_medio,mae_articulos.pagina,
mae_periodistas.nom_periodista,
mae_periodistas.ap_periodista, mae_articulos.alto, mae_articulos.ancho,
mae_articulos.cod_articulo,
mae_articulos.ruta_imagen FROM mae_articulos, mae_medios, mae_periodistas
WHERE mae_articulos.cod_medio = mae_medios.cod_medio AND
mae_articulos.cod_periodista = mae_periodistas.cod_periodista AND
(mae_articulos.cod_articulo = 1026   // yes without the closing
parentesis


Anyone have the slightest Idea why is this ocurring.

I am new at this php, and I think my while() code is bothering


Thanks in advance


Fernando






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




RE: [PHP] carrying a query string

2002-06-05 Thread Martin Towell

try it and see
if it doesn't work, try using base64_encode() and base64_decode()
after all, you're not encrypting the string, just making sure the script
handles it okay, ay?

-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 06, 2002 3:21 PM
To: php
Subject: [PHP] carrying a query string


hi all,

will urlencode($QUERY_STRING) be sufficient enough conversion of the query
string to enable me to pass the query string around as a var in the url?

eg

current script: page.php?var1=foo&var2=bah

email this page to a friend
?>

Then on email_a_friend.php I can urldecode() the $ref, so that I now the
file and query string of the referring page.

I guess I'm worried that urlencode may not sufficiently obscure the old
query string, which may cause confusion on the second script.


Any suggestions?  This is basically a way of me ensuring I have a referring
url, since HTTP_REFERER isn't always set my the browser.


Thanks,

Justin French


-- 
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] carrying a query string

2002-06-05 Thread Justin French

hi all,

will urlencode($QUERY_STRING) be sufficient enough conversion of the query
string to enable me to pass the query string around as a var in the url?

eg

current script: page.php?var1=foo&var2=bah

email this page to a friend
?>

Then on email_a_friend.php I can urldecode() the $ref, so that I now the
file and query string of the referring page.

I guess I'm worried that urlencode may not sufficiently obscure the old
query string, which may cause confusion on the second script.


Any suggestions?  This is basically a way of me ensuring I have a referring
url, since HTTP_REFERER isn't always set my the browser.


Thanks,

Justin French


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




[PHP] asset tracking..

2002-06-05 Thread Peter

Hey

does any one know where i get grab an asset tracking script from? so I don't
have to reinvent the wheel?



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] Sessions on clustered machines

2002-06-05 Thread Cameron Just

Hi,

Just wondering if sessions can be shared on clustered webservers?

ie one location for session.save_path which is shared amongst many machines.

Thanks



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




Re: [PHP] Search Engine Friend Dynamic Pages

2002-06-05 Thread Ashley M. Kirchner

Scott Reismanis wrote:

> Just a quick question regarding developing search engine friendly
> pages. Basically I am re-writing my site so that say mysite.com?
> page=support&action=help becomes mysite.com/support/help/ Reason why is
> it looks nicer and is search engine friendly, as some search engines
> cannot spider URLS with query strings.

Ye might want to read:

Building Dynamic Pages With Search Engines in Mind
http://www.phpbuilder.net/columns/tim19990117.php3

and:

Revisited: Build Dynamic Pages With Search Engines in Mind
http://www.phpbuilder.net/columns/tim2526.php3


--
H | "Life is the art of drawing without an eraser." - John Gardner
  +
  Ashley M. Kirchner    .   303.442.6410 x130
  Director of Internet Operations / SysAdmin. 800.441.3873 x130
  Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave, #6
  http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A.




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




Re: [PHP] long PHP array and HTML forms question

2002-06-05 Thread Jason Wong

On Thursday 06 June 2002 12:03, Steven Jarvis wrote:
> I'm trying to store an array in a mysql db. I'm creating the array
> variable through an html form and passing it to the page where I store
> it in the db. I want to create the array with a form, store it in the
> db, then display it in another form with a  statement. However,
> I'm getting extra array elements, including another array in the final
> element. I can't figure out how to deal with this extraneous data.
>
> Page 1:
> The insertion form looks like this:
> 
> COLORS:
> 
> 
> 
> 
> 
> 
> 
> 
>
> That's five input fields.
>
> Page 2:
> I want the user to be able to use none, some, or all of the fields, so I
> don't know how many elements will be in the array.
>
> $color[] = $_POST["color"];

That should be:

  $color = $_POST["color"];

Actually from your results below it seems like you've enabled register_globals 
and it's not necessary to explicit (re)assign $color.

> I'm testing the incoming array with:
>
> while ($element = each($color))
>   {
>   echo $element["key"];
>   echo ": ";
>   echo $element["value"];
>   echo "\n";
>   }
>
> And I get results like this printed to the browser (I always get seven
> entries, including the last array entry):
>
> 0: green
> 1: black
> 2: blue
> 3:
> 4:
> 5:
> 6: Array
>
> First question: is there something I can do at this point to cut the
> empty entries 

foreach ($color as $key => $val) {
  if ($val) {
$tmp[] = $val;
  }
}
$color = $tmp;

That will remove empty values from $color.

> (and that extra seventh array entry) out of the array so
> that it's clean going into the db?

See above about assigning $color from $_POST.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
You're always thinking you're gonna be the one that makes 'em act different.
-- Woody Allen, "Manhattan"
*/


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




Re: [PHP] Search Engine Friend Dynamic Pages

2002-06-05 Thread Miguel Cruz

On Thu, 6 Jun 2002, Scott Reismanis wrote:
> Just a quick question regarding developing search engine friendly 
> pages. Basically I am re-writing my site so that say mysite.com?
> page=support&action=help becomes mysite.com/support/help/ Reason why is 
> it looks nicer and is search engine friendly, as some search engines 
> cannot spider URLS with query strings.
> 
> Anyhow my preferable method of achiving this is having all pages raise 
> a 404 error, which then loads my custom 404 page which shall output 
> a "200 ok header" and load the appropiate content. I have heard 
> somewhere though, that despite overwriting the 404 header, search 
> engines wont index the page because they think it does not exist... is 
> this the case? If so I shall use another method, such as one where I 
> crop the *.php extension off my files and force apache to interpret 
> them as mime type php.

Look at the headers you're sending out. If there's no 404, then the search 
engine has no possible way of knowing how you handled it on the back end.

miguel


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




[PHP] Search Engine Friend Dynamic Pages

2002-06-05 Thread Scott Reismanis

Hey all,

Just a quick question regarding developing search engine friendly 
pages. Basically I am re-writing my site so that say mysite.com?
page=support&action=help becomes mysite.com/support/help/ Reason why is 
it looks nicer and is search engine friendly, as some search engines 
cannot spider URLS with query strings.

Anyhow my preferable method of achiving this is having all pages raise 
a 404 error, which then loads my custom 404 page which shall output 
a "200 ok header" and load the appropiate content. I have heard 
somewhere though, that despite overwriting the 404 header, search 
engines wont index the page because they think it does not exist... is 
this the case? If so I shall use another method, such as one where I 
crop the *.php extension off my files and force apache to interpret 
them as mime type php.

Thanks for your time everyone
 


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




[PHP] Re: Regular Expressions Help

2002-06-05 Thread CC Zona

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (J. Younker) 
wrote:

> Hi,
> I'm trying to use eregi_replace to check a user-submitted URL, but I
> keep getting the following error message:
> Warning: Invalid range end in /var/www/html/_db_db/db_input.php
> This what I'm using:
> $pattern = "(http://)?([^[:space:]]+)([[:alnum:]\.-_?/&=])";

You've already gotten a working substitute using the superior preg_replace 
function, but FWIW: the "invalid range" was caused by a misplaced hyphen.  
In the middle of a character class, it delimits a range; to use it as a 
literal, make it the last character in the character class.

-- 
CC

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




Re: [PHP] Passing Values to an image script

2002-06-05 Thread Anzak Wolf

>On Thu, 6 Jun 2002, Anzak Wolf wrote:
> > $h=20;
> > $w=80;
> > print "";
> >
> > Now this is a much watered down version of what I'm doing, but the idea 
>is
> > the same.  I don't want to put the values I'm passing to the image in 
>the
> > html code to be passed with a get.  I'd like to be able to maybe pass 
>then
> > in a POST format though I'm not sure how I can do that or if I can.  The
> > other idea I had was to start a session and register $h and $w then when 
>I
> > start the images script I can connect to the session and get the values 
>form
> > there though I would have to use Arrays so that I could keep data on 
>many
> > diff. images.  I could pass the array index to the image script which 
>would
> > index all the array elements needed.  The only down side I can see to 
>that
> > is that I would have to serialize the array vars in order to maintain 
>them
> > between sessions (index.php and image.php) and I would have a higher 
>over
> > head on my session code which may impact preformance greatly.  Anyone 
>have
> > any ideas about this as in good idea bad idea, or other suggestions on 
>how
> > to pass this data without letting the user see it.
>
>You don't want them to see it for which reason?
>
>1) It's highly confidential; or
>2) It looks ugly; or
>3) You don't want casual users messing with it...?
>
>If 3, just base64 encode the serialized array of data and most people will
>leave it alone (it'll just look like a string of random letters and
>numbers)
>
>Posting isn't that useful unless the image is going to show up on its own
>in the web browser window.
>
>Sessions are okay, but once people start using the back button you are
>going to have some weird side effects.
>
>miguel
>
>
It's not confidental, but I don't want users figuring out my backend image 
code from it.  While I'm not sure what they could do with it other than make 
images the way they want and display then for themselves I don't see any 
danger in it.  I just don't like messy long URL lines.  I'm already going to 
be giving the users a way to customize the site so they don't need to me 
messing with varibles passed to the image script.  As for your comment about 
the back button I have come up with a section of code for my site that stops 
user for doing much with the back or reload button.  I keep track of a link 
counter in a session var and then if they hit back or reload the link 
counter that gets sent in the post data is not equal to counter++ and so I 
redirect them to an error page that explains that the site does not allow 
the use of the back button or reload buttons.

-Jim

_
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


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




Re: [PHP] run from telnet...like PERL?

2002-06-05 Thread Jason Morehouse

Also be sure and up the execution time of the script.




On Thu, 06 Jun 2002 13:57:52 +1200, Miguel Cruz wrote:

> On Wed, 5 Jun 2002, Robert Packer wrote:
>> I wrote a script to strip the domain from an e-mail address with PHP.
>> But it will max out my lousy computer at work. The lists have about 1
>> million plus addresses on them... However, a colleague wrote a very
>> similar program with PERL and ran it from telnet and it went just fine.
>> Can PHP be run in this fashion?
> 
> Build or download the standalone binary, and then it works just like
> Perl (except that you'll want to add -q to the bangpath invocation).
> 
> miguel
 

-- 
 Jason Morehouse ([EMAIL PROTECTED])
 Netconcepts LTD - Auckland, New Zealand
 * Linux: Because rebooting is for adding hardware.

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




[PHP] long PHP array and HTML forms question

2002-06-05 Thread Steven Jarvis

I'm trying to store an array in a mysql db. I'm creating the array 
variable through an html form and passing it to the page where I store 
it in the db. I want to create the array with a form, store it in the 
db, then display it in another form with a  statement. However, 
I'm getting extra array elements, including another array in the final 
element. I can't figure out how to deal with this extraneous data.

Page 1:
The insertion form looks like this:

COLORS:









That's five input fields.

Page 2:
I want the user to be able to use none, some, or all of the fields, so I 
don't know how many elements will be in the array.

$color[] = $_POST["color"];

I'm testing the incoming array with:

while ($element = each($color))
{
echo $element["key"];
echo ": ";
echo $element["value"];
echo "\n";
}

And I get results like this printed to the browser (I always get seven 
entries, including the last array entry):

0: green
1: black
2: blue
3:
4:
5:
6: Array

First question: is there something I can do at this point to cut the 
empty entries (and that extra seventh array entry) out of the array so 
that it's clean going into the db?


So, I insert that array into the db like so:
// db connectivity stuff
INSERT INTO items (color) VALUES ( '$color')";
// there are other variables, but I'm trying to keep this as clean as 
possible.



Then, I have this on the page that pulls the data from the db:
...
$num_results = mysql_num_rows($results);

for ($i=0; $i < $num_results; $i++)
{
$row = mysql_fetch_array($results);
$color[] = $row["color"];
echo "";
echo "";
$colorcount = count($color);
echo "";
for($x = 0; $x < $colorcount - 1; $x++)
{
echo "$color[$x]\n";
}
echo "";
}   

However, I'm putting that bad array in the database, and I still get 
extra option entries, because I have no idea how many extras to remove. 
So, I feel like I should be doing something BEFORE I do the db insert. 
Other than that, the db insert and select work just fine (say, if I set 
the values of that array manually in the php code).

Any suggestions would be very helpful!

Thanks,

Steven

--
Steven Jarvis
Web Developer
Arkansas Democrat-Gazette
Northwest Edition


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




[PHP] Re: Automatic color coded HTML

2002-06-05 Thread Jason Morehouse

http://www.php.net/manual/en/function.show-source.php

Cheers,
-J

On Thu, 06 Jun 2002 13:55:26 +1200, Jarrad Kabral wrote:

> Hi All,
> 
> Is a command in PHP to format source code as color coded HTML?
> 
> 
> 
> Regards
> Jarrad
 

-- 
 Jason Morehouse ([EMAIL PROTECTED])
 Netconcepts LTD - Auckland, New Zealand
 * Linux: Because rebooting is for adding hardware.

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




Re: [PHP] Modifying the sort order of a query

2002-06-05 Thread Andre Dubuc

Hi Peter,

I've just tried the sub-select approach. Works great on the first page - 
shows names listed alphabetically sorted by country. However, once I click on 
'Next 20' both sorts go bye-bye (neither by name nor country).

Going to try what you suggest tomorrow. I think it'll work.
Thanks for the advice,

Regards,
Andre

On Wednesday 05 June 2002 11:37 pm, you wrote:
> Andre
>
> Don't know how useful this will be to you .. but was following thru this
> and thought why wouldn't you include a page with a switch statement or the
> like into all the pages... so that all pages know about but not always use
> the queries ... so that you can have it sorted by any and everything you
> want...
>
>
> any way just a thought
>
>
> cheers
> Peter
>
> -Original Message-
> From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, 6 June 2002 1:27 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Modifying the sort order of a query
>
>
> Hi John,
>
> Oh, my apologies again. I haven't thought this through enough. I'm sorry
> that
> I've wasted your time.
>
> >"Is it messing up when you click Next 20? Does it go
> > back to the old sorting, or what? If you're looking at page 4 sorted by
> > name, then you want to sort by country, you can't go back to page 4 . .
> > ."
>
> Yes, that's what I was attempting to do. Perhaps I was too close to the
> code to really visualize the basic flow. It went back to the first
> page, and froze -- that's because the first page had no reference to the
> "new" query -- it had no reference to a new query being made since "Page
> 1" has it's own code/query set that did not include the restructuring of
> the query that Page 4 attemped to do. So, I don't think it's possible to
> accomplish an "in-process" sort without re-paginating the whole thing. I'll
> probably have to do it ONLY on the first page, and not offer a continuous
> option on every page.
>
> [Btw, nothing is public yet . . . I'm still putting the pieces together --
> hopefully sometime in September.] Further, I've changed most of the code
> that I first wrote, attempting to tryout the concepts.
>
> Regards,
> Andre
>
> On Wednesday 05 June 2002 11:01 pm, you wrote:
> > I still really don't understand. You have a list of documents, 20 per
> > page. You want to be able to sort it by country or another column, yet
> > still display them in alphabetical order?
> >
> > Maybe an example page would help...is this page public anywhere?
> >
> > Like I said before, if you sort by new columns, then your paging has to
> > start over back at the beginning. You said it already did this, but it
> > still is messing up. Is it messing up when you click Next 20? Does it go
> > back to the old sorting, or what? If you're looking at page 4 sorted by
> > name, then you want to sort by country, you can't go back to page 4
> > (well, you can, but it's going to be a whole new page four because of
> > the new sort order).
> >
> > Example page will really help here; maybe I'm just slow in visualizing
> > this. We can take this off the list if necessary, too.
> >
> > ---John Holmes...
> >
> > > -Original Message-
> > > From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, June 05, 2002 10:49 PM
> > > To: [EMAIL PROTECTED]
> > > Cc: [EMAIL PROTECTED]
> > > Subject: Re: [PHP] Modifying the sort order of a query
> > >
> > > Hi John,
> > >
> > > Sorry about that. I should have explained what I meant. The basic
> >
> > problem
> >
> > > that I'm trying (desparately) to skirt around is a troublesome paging
> > > problem.
> > >
> > > The basic query loads all files in the db sorted by name. The first
> >
> > page
> >
> > > that
> > > displays has a "Next 20" button that loads the next page, and so on
> >
> > until
> >
> > > the
> > > last page which has no "Next 20" button, but deadends.
> > >
> > > The problem I've faced today, is that I originally allowed a "Sort by
> > > Country" button to appear on each page -- thereby messing up the
> >
> > original
> >
> > > paging. It, of course, returned to the first page (which didn't know
> >
> > squat
> >
> > > about whatever the calling page asked for). Thus, the whole thing
> >
> > froze --
> >
> > > which is to be expected.
> > >
> > > The resolution, in my mind, is simple: do not have that button
> >
> > anywhere
> >
> > > but
> > > on the first page (it took me a long time to figure that one out, duhh
> > >
> > > :>).
> > >
> > > The second solution, is somewhat better: using a sub-query, which will
> > > re-paginate all right, but I still need to retain the alpahbetical
> >
> > order
> >
> > > of
> > > names as well. Perhaps I can't have both. (I think I'll have to try
> >
> > both -
> >
> > > -
> > > my mind's a bit blitzed from the problems I've resolved today!)
> > >
> > > So, that's what I'm trying to do. The page I'm working on is a protype
> >
> > for
> >
> > > about three other similar ones.
> > >
> > > Regards,
> > > Andre
> > >
> > > On Wednesday 05 June 2002 10:22 pm,

Re: [PHP] Re: currency rounding issues

2002-06-05 Thread Bogdan Stancescu

As a side note, your final question does make sense - I was surprised 
(dunno why, but I was) to find there are things which cost less then 1c, 
some even less than 1/10 c, so...

Bogdan

Michael Davey wrote:

>I have found that the best way to work with currencies is to avoid using any
>type of floating point math.
>
>If you multiply your start amount by 100, then perform your calculations as
>integers and then divide by 100 again at the end, it should work out OK...
>
>(Heh, at least it has worked for me when doing tax calcs and stuff - who
>know what you are doing?!?!?!?)
>
>Mikey
>
>"Paul Berg" <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>  
>
>>Hi,
>>
>>I am putting together an app that involves the adding together of rounded
>>numbers and displaying in a currency format.
>>The round() function is causing errors of 1 cent to appear after addition.
>>Does anyone know of any routines that might assist?
>>
>>Thanks in advance...
>>Paul
>>
>>
>>
>>
>
>
>
>  
>




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




Re: [PHP] mail() problem

2002-06-05 Thread Manuel Lemos

Hello,

On 06/06/2002 12:42 AM, César l . aracena wrote:
> Ok. I've done everything that all of you told me to do, but still can't
> get to send e-mails to my ISP's mail address. I did all of the
> following:
>  
> a) Append a Reply-To: [EMAIL PROTECTED] (Actually, it?s
> [EMAIL PROTECTED] )
> b) Send the e-mail to my Hotmail account, but everything seems fine. The
> address shown at the From: line is even the one I used in the Script.
> c) Because I have placed the Script into a server and not a local
> machine, asked the sysadmin to check the php.ini file and so but
> nothing.
>  
> This step is crucial for my scripting and because all of my clients live
> here, most of them use the same ISP and have to get their e-mails.
>  
> Actually, I didn't know how to change the content-type for my e-mail in
> order to do some testing. Can anyone help me with this? Might be my last
> chance...

You may want to try these classes:

SMTP Client class - enable debug to see dialog with SMTP server
http://www.phpclasses.org/smtpclass

MIME message sending and composing
http://www.phpclasses.org/mimemessage



-- 

Regards,
Manuel Lemos


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




RE: [PHP] mail() problem

2002-06-05 Thread César L . Aracena

Ok. I've done everything that all of you told me to do, but still can't
get to send e-mails to my ISP's mail address. I did all of the
following:
 
a) Append a Reply-To: [EMAIL PROTECTED] (Actually, it’s
[EMAIL PROTECTED] )
b) Send the e-mail to my Hotmail account, but everything seems fine. The
address shown at the From: line is even the one I used in the Script.
c) Because I have placed the Script into a server and not a local
machine, asked the sysadmin to check the php.ini file and so but
nothing.
 
This step is crucial for my scripting and because all of my clients live
here, most of them use the same ISP and have to get their e-mails.
 
Actually, I didn't know how to change the content-type for my e-mail in
order to do some testing. Can anyone help me with this? Might be my last
chance...
 
Thanks in advance,
 
  César Aracena
IS / MCSE+I
Neuquén, NQN
(0299) 156-356688
(0299) 446-6621
 



RE: [PHP] Modifying the sort order of a query

2002-06-05 Thread Peter

Andre

Don't know how useful this will be to you .. but was following thru this and
thought why wouldn't you include a page with a switch statement or the like
into all the pages... so that all pages know about but not always use the
queries ... so that you can have it sorted by any and everything you want...


any way just a thought


cheers
Peter

-Original Message-
From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 6 June 2002 1:27 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Modifying the sort order of a query


Hi John,

Oh, my apologies again. I haven't thought this through enough. I'm sorry
that
I've wasted your time.

>"Is it messing up when you click Next 20? Does it go
> back to the old sorting, or what? If you're looking at page 4 sorted by
> name, then you want to sort by country, you can't go back to page 4 . . ."

Yes, that's what I was attempting to do. Perhaps I was too close to the code
to really visualize the basic flow. It went back to the first
page, and froze -- that's because the first page had no reference to the
"new" query -- it had no reference to a new query being made since "Page
1" has it's own code/query set that did not include the restructuring of the
query that Page 4 attemped to do. So, I don't think it's possible to
accomplish an "in-process" sort without re-paginating the whole thing. I'll
probably have to do it ONLY on the first page, and not offer a continuous
option on every page.

[Btw, nothing is public yet . . . I'm still putting the pieces together --
hopefully sometime in September.] Further, I've changed most of the code
that I first wrote, attempting to tryout the concepts.

Regards,
Andre

On Wednesday 05 June 2002 11:01 pm, you wrote:
> I still really don't understand. You have a list of documents, 20 per
> page. You want to be able to sort it by country or another column, yet
> still display them in alphabetical order?
>
> Maybe an example page would help...is this page public anywhere?
>
> Like I said before, if you sort by new columns, then your paging has to
> start over back at the beginning. You said it already did this, but it
> still is messing up. Is it messing up when you click Next 20? Does it go
> back to the old sorting, or what? If you're looking at page 4 sorted by
> name, then you want to sort by country, you can't go back to page 4
> (well, you can, but it's going to be a whole new page four because of
> the new sort order).
>
> Example page will really help here; maybe I'm just slow in visualizing
> this. We can take this off the list if necessary, too.
>
> ---John Holmes...
>
> > -Original Message-
> > From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, June 05, 2002 10:49 PM
> > To: [EMAIL PROTECTED]
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP] Modifying the sort order of a query
> >
> > Hi John,
> >
> > Sorry about that. I should have explained what I meant. The basic
>
> problem
>
> > that I'm trying (desparately) to skirt around is a troublesome paging
> > problem.
> >
> > The basic query loads all files in the db sorted by name. The first
>
> page
>
> > that
> > displays has a "Next 20" button that loads the next page, and so on
>
> until
>
> > the
> > last page which has no "Next 20" button, but deadends.
> >
> > The problem I've faced today, is that I originally allowed a "Sort by
> > Country" button to appear on each page -- thereby messing up the
>
> original
>
> > paging. It, of course, returned to the first page (which didn't know
>
> squat
>
> > about whatever the calling page asked for). Thus, the whole thing
>
> froze --
>
> > which is to be expected.
> >
> > The resolution, in my mind, is simple: do not have that button
>
> anywhere
>
> > but
> > on the first page (it took me a long time to figure that one out, duhh
> >
> > :>).
> >
> > The second solution, is somewhat better: using a sub-query, which will
> > re-paginate all right, but I still need to retain the alpahbetical
>
> order
>
> > of
> > names as well. Perhaps I can't have both. (I think I'll have to try
>
> both -
>
> > -
> > my mind's a bit blitzed from the problems I've resolved today!)
> >
> > So, that's what I'm trying to do. The page I'm working on is a protype
>
> for
>
> > about three other similar ones.
> >
> > Regards,
> > Andre
> >
> > On Wednesday 05 June 2002 10:22 pm, you wrote:
> > > What do you mean it'll "trash the current paging" ?? Can you give a
>
> more
>
> > > detailed explanation?
> > >
> > > Results 30-60 of one result set sorted by a certain column will be
> > > totally different than results 30-60 of a result set sorted by a
> > > different column.
> > >
> > > So the paging would have to start over, anyhow. Unless you're
>
> looking to
>
> > > maintain the same 30 results in the new result set, like my previous
> > > email mentioned...
> > >
> > > ---John Holmes...
> > >
> > > > -Original Message-
> > > > From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
> > > > Sent: Wednesday, June 05, 2002 

Re: [PHP] Modifying the sort order of a query

2002-06-05 Thread Andre Dubuc

Hi John,

Oh, my apologies again. I haven't thought this through enough. I'm sorry that 
I've wasted your time.

>"Is it messing up when you click Next 20? Does it go
> back to the old sorting, or what? If you're looking at page 4 sorted by
> name, then you want to sort by country, you can't go back to page 4 . . ." 

Yes, that's what I was attempting to do. Perhaps I was too close to the code 
to really visualize the basic flow. It went back to the first 
page, and froze -- that's because the first page had no reference to the 
"new" query -- it had no reference to a new query being made since "Page 
1" has it's own code/query set that did not include the restructuring of the 
query that Page 4 attemped to do. So, I don't think it's possible to 
accomplish an "in-process" sort without re-paginating the whole thing. I'll 
probably have to do it ONLY on the first page, and not offer a continuous 
option on every page.

[Btw, nothing is public yet . . . I'm still putting the pieces together -- 
hopefully sometime in September.] Further, I've changed most of the code 
that I first wrote, attempting to tryout the concepts. 

Regards,
Andre

On Wednesday 05 June 2002 11:01 pm, you wrote:
> I still really don't understand. You have a list of documents, 20 per
> page. You want to be able to sort it by country or another column, yet
> still display them in alphabetical order?
>
> Maybe an example page would help...is this page public anywhere?
>
> Like I said before, if you sort by new columns, then your paging has to
> start over back at the beginning. You said it already did this, but it
> still is messing up. Is it messing up when you click Next 20? Does it go
> back to the old sorting, or what? If you're looking at page 4 sorted by
> name, then you want to sort by country, you can't go back to page 4
> (well, you can, but it's going to be a whole new page four because of
> the new sort order).
>
> Example page will really help here; maybe I'm just slow in visualizing
> this. We can take this off the list if necessary, too.
>
> ---John Holmes...
>
> > -Original Message-
> > From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, June 05, 2002 10:49 PM
> > To: [EMAIL PROTECTED]
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP] Modifying the sort order of a query
> >
> > Hi John,
> >
> > Sorry about that. I should have explained what I meant. The basic
>
> problem
>
> > that I'm trying (desparately) to skirt around is a troublesome paging
> > problem.
> >
> > The basic query loads all files in the db sorted by name. The first
>
> page
>
> > that
> > displays has a "Next 20" button that loads the next page, and so on
>
> until
>
> > the
> > last page which has no "Next 20" button, but deadends.
> >
> > The problem I've faced today, is that I originally allowed a "Sort by
> > Country" button to appear on each page -- thereby messing up the
>
> original
>
> > paging. It, of course, returned to the first page (which didn't know
>
> squat
>
> > about whatever the calling page asked for). Thus, the whole thing
>
> froze --
>
> > which is to be expected.
> >
> > The resolution, in my mind, is simple: do not have that button
>
> anywhere
>
> > but
> > on the first page (it took me a long time to figure that one out, duhh
> >
> > :>).
> >
> > The second solution, is somewhat better: using a sub-query, which will
> > re-paginate all right, but I still need to retain the alpahbetical
>
> order
>
> > of
> > names as well. Perhaps I can't have both. (I think I'll have to try
>
> both -
>
> > -
> > my mind's a bit blitzed from the problems I've resolved today!)
> >
> > So, that's what I'm trying to do. The page I'm working on is a protype
>
> for
>
> > about three other similar ones.
> >
> > Regards,
> > Andre
> >
> > On Wednesday 05 June 2002 10:22 pm, you wrote:
> > > What do you mean it'll "trash the current paging" ?? Can you give a
>
> more
>
> > > detailed explanation?
> > >
> > > Results 30-60 of one result set sorted by a certain column will be
> > > totally different than results 30-60 of a result set sorted by a
> > > different column.
> > >
> > > So the paging would have to start over, anyhow. Unless you're
>
> looking to
>
> > > maintain the same 30 results in the new result set, like my previous
> > > email mentioned...
> > >
> > > ---John Holmes...
> > >
> > > > -Original Message-
> > > > From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
> > > > Sent: Wednesday, June 05, 2002 10:19 PM
> > > > To: Miguel Cruz
> > > > Cc: [EMAIL PROTECTED]
> > > > Subject: Re: [PHP] Modifying the sort order of a query
> > > >
> > > > Thanks Miguel,
> > > >
> > > > I haven't tried the sub-query approach yet, but that does seem to
>
> be
>
> > > the
> > >
> > > > way
> > > > to do this. My fear is that it will trash the current paging
>
> (which
>
> > > took
> > >
> > > > forever to get working with the current setup). Actually, after
>
> trying
>
> > > my
> > >
> > > > original code again in another smaller sele

Re: [PHP] global variables without sessions on apache

2002-06-05 Thread Jason Wong

On Thursday 06 June 2002 06:05, Zac Hillier wrote:
> Miguel,
>
> I mean that the variables will never change per Virtual host but that the
> site is a template for many sites and these vars are part of the
> distinction for each site / Virtual Host.
>
> So far the suggestions of using the  auto-prepend  in the php.ini have not
> seemed to cater for this. Can you help further?

The auto-prepend thing can be set per-site if you put it in the apache.conf 
file, and possibly per-directory as well (haven't tried it) if put in 
.htaccess files.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
You will have a head crash on your private pack.
*/


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




RE: [PHP] Modifying the sort order of a query

2002-06-05 Thread Martin Towell

isn't this just a matter of doing
order by country, whatever
??

-Original Message-
From: John Holmes [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 06, 2002 1:02 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Modifying the sort order of a query


I still really don't understand. You have a list of documents, 20 per
page. You want to be able to sort it by country or another column, yet
still display them in alphabetical order?

Maybe an example page would help...is this page public anywhere?

Like I said before, if you sort by new columns, then your paging has to
start over back at the beginning. You said it already did this, but it
still is messing up. Is it messing up when you click Next 20? Does it go
back to the old sorting, or what? If you're looking at page 4 sorted by
name, then you want to sort by country, you can't go back to page 4
(well, you can, but it's going to be a whole new page four because of
the new sort order).

Example page will really help here; maybe I'm just slow in visualizing
this. We can take this off the list if necessary, too.

---John Holmes...

> -Original Message-
> From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 05, 2002 10:49 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Modifying the sort order of a query
> 
> Hi John,
> 
> Sorry about that. I should have explained what I meant. The basic
problem
> that I'm trying (desparately) to skirt around is a troublesome paging
> problem.
> 
> The basic query loads all files in the db sorted by name. The first
page
> that
> displays has a "Next 20" button that loads the next page, and so on
until
> the
> last page which has no "Next 20" button, but deadends.
> 
> The problem I've faced today, is that I originally allowed a "Sort by
> Country" button to appear on each page -- thereby messing up the
original
> paging. It, of course, returned to the first page (which didn't know
squat
> about whatever the calling page asked for). Thus, the whole thing
froze --
> which is to be expected.
> 
> The resolution, in my mind, is simple: do not have that button
anywhere
> but
> on the first page (it took me a long time to figure that one out, duhh
> :>).
> The second solution, is somewhat better: using a sub-query, which will
> re-paginate all right, but I still need to retain the alpahbetical
order
> of
> names as well. Perhaps I can't have both. (I think I'll have to try
both -
> -
> my mind's a bit blitzed from the problems I've resolved today!)
> 
> So, that's what I'm trying to do. The page I'm working on is a protype
for
> about three other similar ones.
> 
> Regards,
> Andre
> 
> 
> 
> On Wednesday 05 June 2002 10:22 pm, you wrote:
> > What do you mean it'll "trash the current paging" ?? Can you give a
more
> > detailed explanation?
> >
> > Results 30-60 of one result set sorted by a certain column will be
> > totally different than results 30-60 of a result set sorted by a
> > different column.
> >
> > So the paging would have to start over, anyhow. Unless you're
looking to
> > maintain the same 30 results in the new result set, like my previous
> > email mentioned...
> >
> > ---John Holmes...
> >
> > > -Original Message-
> > > From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, June 05, 2002 10:19 PM
> > > To: Miguel Cruz
> > > Cc: [EMAIL PROTECTED]
> > > Subject: Re: [PHP] Modifying the sort order of a query
> > >
> > > Thanks Miguel,
> > >
> > > I haven't tried the sub-query approach yet, but that does seem to
be
> >
> > the
> >
> > > way
> > > to do this. My fear is that it will trash the current paging
(which
> >
> > took
> >
> > > forever to get working with the current setup). Actually, after
trying
> >
> > my
> >
> > > original code again in another smaller select function, I'm
wondering
> > > whether
> > > I even need this refined search option -- it might be a case of
> > > 'overkill'.
> > > Still, it's got my curiosity going.
> > >
> > > The problem seems to be centered on how I wrote the original code
> >
> > (it's
> >
> > > amzing how it's changed!). I think I'll have to re-write using
switch
> > > functions to clarify exactly what I want it to do.
> > >
> > > Regards,
> > > Andre
> > >
> > > On Wednesday 05 June 2002 09:43 pm, you wrote:
> > > > My understanding was that he wanted to see the same 30 rows, but
> >
> > sorted
> >
> > > in
> > >
> > > > a different way.
> > > >
> > > > For instance, he wanted to see entries 30-60 as sorted by age,
but
> >
> > to
> >
> > > have
> > >
> > > > those sorted by height when displayed.
> > > >
> > > > miguel
> > > >
> > > > On Thu, 6 Jun 2002, Bogdan Stancescu wrote:
> > > > > That's at least curious - limiting and offsetting will most
> >
> > certainly
> >
> > > > > affect the results which are then sorted... I don't think
that's
> >
> > what
> >
> > > he
> > >
> > > > > was after. Just my 2c.
> > > > >
> > > > > Bogdan
> > > > >
> > > > > Miguel Cruz wrote:
> > > > > >Try a

RE: [PHP] Modifying the sort order of a query

2002-06-05 Thread John Holmes

I still really don't understand. You have a list of documents, 20 per
page. You want to be able to sort it by country or another column, yet
still display them in alphabetical order?

Maybe an example page would help...is this page public anywhere?

Like I said before, if you sort by new columns, then your paging has to
start over back at the beginning. You said it already did this, but it
still is messing up. Is it messing up when you click Next 20? Does it go
back to the old sorting, or what? If you're looking at page 4 sorted by
name, then you want to sort by country, you can't go back to page 4
(well, you can, but it's going to be a whole new page four because of
the new sort order).

Example page will really help here; maybe I'm just slow in visualizing
this. We can take this off the list if necessary, too.

---John Holmes...

> -Original Message-
> From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 05, 2002 10:49 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Modifying the sort order of a query
> 
> Hi John,
> 
> Sorry about that. I should have explained what I meant. The basic
problem
> that I'm trying (desparately) to skirt around is a troublesome paging
> problem.
> 
> The basic query loads all files in the db sorted by name. The first
page
> that
> displays has a "Next 20" button that loads the next page, and so on
until
> the
> last page which has no "Next 20" button, but deadends.
> 
> The problem I've faced today, is that I originally allowed a "Sort by
> Country" button to appear on each page -- thereby messing up the
original
> paging. It, of course, returned to the first page (which didn't know
squat
> about whatever the calling page asked for). Thus, the whole thing
froze --
> which is to be expected.
> 
> The resolution, in my mind, is simple: do not have that button
anywhere
> but
> on the first page (it took me a long time to figure that one out, duhh
> :>).
> The second solution, is somewhat better: using a sub-query, which will
> re-paginate all right, but I still need to retain the alpahbetical
order
> of
> names as well. Perhaps I can't have both. (I think I'll have to try
both -
> -
> my mind's a bit blitzed from the problems I've resolved today!)
> 
> So, that's what I'm trying to do. The page I'm working on is a protype
for
> about three other similar ones.
> 
> Regards,
> Andre
> 
> 
> 
> On Wednesday 05 June 2002 10:22 pm, you wrote:
> > What do you mean it'll "trash the current paging" ?? Can you give a
more
> > detailed explanation?
> >
> > Results 30-60 of one result set sorted by a certain column will be
> > totally different than results 30-60 of a result set sorted by a
> > different column.
> >
> > So the paging would have to start over, anyhow. Unless you're
looking to
> > maintain the same 30 results in the new result set, like my previous
> > email mentioned...
> >
> > ---John Holmes...
> >
> > > -Original Message-
> > > From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, June 05, 2002 10:19 PM
> > > To: Miguel Cruz
> > > Cc: [EMAIL PROTECTED]
> > > Subject: Re: [PHP] Modifying the sort order of a query
> > >
> > > Thanks Miguel,
> > >
> > > I haven't tried the sub-query approach yet, but that does seem to
be
> >
> > the
> >
> > > way
> > > to do this. My fear is that it will trash the current paging
(which
> >
> > took
> >
> > > forever to get working with the current setup). Actually, after
trying
> >
> > my
> >
> > > original code again in another smaller select function, I'm
wondering
> > > whether
> > > I even need this refined search option -- it might be a case of
> > > 'overkill'.
> > > Still, it's got my curiosity going.
> > >
> > > The problem seems to be centered on how I wrote the original code
> >
> > (it's
> >
> > > amzing how it's changed!). I think I'll have to re-write using
switch
> > > functions to clarify exactly what I want it to do.
> > >
> > > Regards,
> > > Andre
> > >
> > > On Wednesday 05 June 2002 09:43 pm, you wrote:
> > > > My understanding was that he wanted to see the same 30 rows, but
> >
> > sorted
> >
> > > in
> > >
> > > > a different way.
> > > >
> > > > For instance, he wanted to see entries 30-60 as sorted by age,
but
> >
> > to
> >
> > > have
> > >
> > > > those sorted by height when displayed.
> > > >
> > > > miguel
> > > >
> > > > On Thu, 6 Jun 2002, Bogdan Stancescu wrote:
> > > > > That's at least curious - limiting and offsetting will most
> >
> > certainly
> >
> > > > > affect the results which are then sorted... I don't think
that's
> >
> > what
> >
> > > he
> > >
> > > > > was after. Just my 2c.
> > > > >
> > > > > Bogdan
> > > > >
> > > > > Miguel Cruz wrote:
> > > > > >Try a sub-select:
> > > > > >
> > > > > >SELECT * FROM (SELECT * FROM rap ORDER BY
> > >
> > > rcountry,rcity,rsname,rfname
> > >
> > > > > >DESC LIMIT 30 OFFSET 30) ORDER BY whatever;
> > > > > >
> > > > > >miguel
> > > > > >
> > > > > >On Wed, 5 Jun 2002, Andre Dubuc wrote:
> > 

Re: [PHP] Modifying the sort order of a query

2002-06-05 Thread Andre Dubuc

Hi John,

Sorry about that. I should have explained what I meant. The basic problem 
that I'm trying (desparately) to skirt around is a troublesome paging 
problem. 

The basic query loads all files in the db sorted by name. The first page that 
displays has a "Next 20" button that loads the next page, and so on until the 
last page which has no "Next 20" button, but deadends. 

The problem I've faced today, is that I originally allowed a "Sort by 
Country" button to appear on each page -- thereby messing up the original 
paging. It, of course, returned to the first page (which didn't know squat 
about whatever the calling page asked for). Thus, the whole thing froze -- 
which is to be expected.

The resolution, in my mind, is simple: do not have that button anywhere but 
on the first page (it took me a long time to figure that one out, duhh :>). 
The second solution, is somewhat better: using a sub-query, which will 
re-paginate all right, but I still need to retain the alpahbetical order of 
names as well. Perhaps I can't have both. (I think I'll have to try both -- 
my mind's a bit blitzed from the problems I've resolved today!)

So, that's what I'm trying to do. The page I'm working on is a protype for 
about three other similar ones.

Regards,
Andre



On Wednesday 05 June 2002 10:22 pm, you wrote:
> What do you mean it'll "trash the current paging" ?? Can you give a more
> detailed explanation?
>
> Results 30-60 of one result set sorted by a certain column will be
> totally different than results 30-60 of a result set sorted by a
> different column.
>
> So the paging would have to start over, anyhow. Unless you're looking to
> maintain the same 30 results in the new result set, like my previous
> email mentioned...
>
> ---John Holmes...
>
> > -Original Message-
> > From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, June 05, 2002 10:19 PM
> > To: Miguel Cruz
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP] Modifying the sort order of a query
> >
> > Thanks Miguel,
> >
> > I haven't tried the sub-query approach yet, but that does seem to be
>
> the
>
> > way
> > to do this. My fear is that it will trash the current paging (which
>
> took
>
> > forever to get working with the current setup). Actually, after trying
>
> my
>
> > original code again in another smaller select function, I'm wondering
> > whether
> > I even need this refined search option -- it might be a case of
> > 'overkill'.
> > Still, it's got my curiosity going.
> >
> > The problem seems to be centered on how I wrote the original code
>
> (it's
>
> > amzing how it's changed!). I think I'll have to re-write using switch
> > functions to clarify exactly what I want it to do.
> >
> > Regards,
> > Andre
> >
> > On Wednesday 05 June 2002 09:43 pm, you wrote:
> > > My understanding was that he wanted to see the same 30 rows, but
>
> sorted
>
> > in
> >
> > > a different way.
> > >
> > > For instance, he wanted to see entries 30-60 as sorted by age, but
>
> to
>
> > have
> >
> > > those sorted by height when displayed.
> > >
> > > miguel
> > >
> > > On Thu, 6 Jun 2002, Bogdan Stancescu wrote:
> > > > That's at least curious - limiting and offsetting will most
>
> certainly
>
> > > > affect the results which are then sorted... I don't think that's
>
> what
>
> > he
> >
> > > > was after. Just my 2c.
> > > >
> > > > Bogdan
> > > >
> > > > Miguel Cruz wrote:
> > > > >Try a sub-select:
> > > > >
> > > > >SELECT * FROM (SELECT * FROM rap ORDER BY
> >
> > rcountry,rcity,rsname,rfname
> >
> > > > >DESC LIMIT 30 OFFSET 30) ORDER BY whatever;
> > > > >
> > > > >miguel
> > > > >
> > > > >On Wed, 5 Jun 2002, Andre Dubuc wrote:
> > > > >>Apache 1.3.23 + PHP 4.1.2 + PostgreSQL 7.2
> > > > >>
> > > > >>I have a query that sorts by name, country, and city, then pages
>
> in
>
> > > > >> groups of 30 records. Originally, I had also coded two buttons:
> >
> > "Sort
> >
> > > > >> by Country', 'Sort by City' since I wanted to offer users the
> >
> > options
> >
> > > > >> of these choices.
> > > > >>
> > > > >>Unfortunately, these buttons work well, but re-select the whole
> >
> > shebang
> >
> > > > >>(which I guess is to be expected), destroying any paging that
>
> had
>
> > > > >> already started. I've tried all sorts of ways, tried
>
> re-arranging
>
> > the
> >
> > > > >> order of execution, but the result is the same.
> > > > >>
> > > > >>I'm at a loss on how to proceed. I've deleted the choice (for
>
> now)
>
> > and
> >
> > > > >> run it as a simple select order by name query.The problem seems
>
> to
>
> > be:
> > > > >> I need a sub-query select function that retains the original
>
> query,
>
> > > > >> simply re-organizing it according to the new criteria, and
>
> retains
>
> > the
> >
> > > > >> original paging. (Perhaps I shouldn't care whether the paging
>
> is
>
> > > > >> messed up as long as the results are the same.)
> > > > >>
> > > > >>I realize that the way it's set up below, it will automatically
>
> send
>
> > a
> >

RE: [PHP] Automatic color coded HTML

2002-06-05 Thread Martin Towell

I suppose you could do a _dodgy_ reg.ex. to do your own colour coding
um - ereg_replace("(<[^>]*>)", "\\1", $str);
I haven't tested it, but if you just want to highlight all the tags, then
that should work. If you want to have a different colour for the tag name,
the attributes names, and the attribute values, then you'll have to find
some other way :d

-Original Message-
From: John Holmes [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 06, 2002 12:27 PM
To: 'Jarrad Kabral'; 'Php-General (E-mail)'
Subject: RE: [PHP] Automatic color coded HTML


Not really. Only settings are in PHP.ini for:

highlight.string=   #DD
highlight.comment   =   #FF8000
highlight.keyword   =   #007700
highlight.bg=   #FF
highlight.default   =   #BB
highlight.html  =   #00

That's the defaults. It would be nice if you could break down this just
a little more to apply to HTML tags, strings, etc. 

Search google and sourceforge, maybe something is written already.

---John Holmes...

> -Original Message-
> From: Jarrad Kabral [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 05, 2002 10:14 PM
> To: Php-General (E-mail)
> Subject: RE: [PHP] Automatic color coded HTML
> 
> yeah that would be niceis it configurable at all?
> 
> 
> 
> -Original Message-
> From: John Holmes [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, 6 June 2002 12:19 PM
> To: 'Martin Towell'; 'Jarrad Kabral'; 'Php-General (E-mail)'
> Subject: RE: [PHP] Automatic color coded HTML
> 
> 
> Actually that only highlights PHP code, not HTML, if I remember right.
> It would be nice if this did highlighting for HTML, too, but I think
it
> just comes out all gray.
> 
> ---John Holmes...
> 
> > -Original Message-
> > From: Martin Towell [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, June 05, 2002 10:00 PM
> > To: 'Jarrad Kabral'; Php-General (E-mail)
> > Subject: RE: [PHP] Automatic color coded HTML
> >
> > highlight_file() or something like that
> >
> > -Original Message-
> > From: Jarrad Kabral [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, June 06, 2002 11:55 AM
> > To: Php-General (E-mail)
> > Subject: [PHP] Automatic color coded HTML
> >
> >
> > Hi All,
> >
> > Is a command in PHP to format source code as color coded HTML?
> >
> >
> >
> > Regards
> > Jarrad
> >
> > --
> > 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



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

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




Re: [PHP] Modifying the sort order of a query

2002-06-05 Thread Andre Dubuc

Thanks John,

That looks promising, but the question remains -- would it affect the current 
paging? I really don't wnat to spend another day getting that going again! :>

Further, the actual ID numbers that would populate 'display_ids'  . . . 
'would be generated from your result set' -- I'm not clear how to achieve 
this. From the query results, how would I extract that info, for the current 
page, if my id column is 'rid', and I'm using $_SESSION['rid']?

Regards,
Andre



On Wednesday 05 June 2002 10:15 pm, you wrote:
> > My understanding was that he wanted to see the same 30 rows, but
>
> sorted in
>
> > a different way.
> >
> > For instance, he wanted to see entries 30-60 as sorted by age, but to
>
> have
>
> > those sorted by height when displayed.
> >
> > miguel
>
> Maybe you could have a hidden field that lists the 30 IDs that are
> displayed on the page, as a comma separated list. Then, if the user
> chooses to resort those 30 results, based on another column, you can use
> that hidden field in your query to limit the IDs.
>
> i.e.
>
> 
>
> Where the actual numbers would be generated from your result set.
>
> Then, use those numbers in your query.
>
> SELECT * FROM table WHERE ... AND ID IN($display_ids) ORDER BY
> <>
>
> Hopefully PG supports IN().
>
> My $0.02, I'm sure there are other ways...or maybe this isn't even what
> you're looking for. :)
>
> ---John Holmes...
>
> > On Thu, 6 Jun 2002, Bogdan Stancescu wrote:
> > > That's at least curious - limiting and offsetting will most
>
> certainly
>
> > > affect the results which are then sorted... I don't think that's
>
> what he
>
> > > was after. Just my 2c.
> > >
> > > Bogdan
> > >
> > > Miguel Cruz wrote:
> > > >Try a sub-select:
> > > >
> > > >SELECT * FROM (SELECT * FROM rap ORDER BY
>
> rcountry,rcity,rsname,rfname
>
> > > >DESC LIMIT 30 OFFSET 30) ORDER BY whatever;
> > > >
> > > >miguel
> > > >
> > > >On Wed, 5 Jun 2002, Andre Dubuc wrote:
> > > >>Apache 1.3.23 + PHP 4.1.2 + PostgreSQL 7.2
> > > >>
> > > >>I have a query that sorts by name, country, and city, then pages
>
> in
>
> > groups of
> >
> > > >>30 records. Originally, I had also coded two buttons: "Sort by
> >
> > Country',
> >
> > > >>'Sort by City' since I wanted to offer users the options of these
> >
> > choices.
> >
> > > >>Unfortunately, these buttons work well, but re-select the whole
> >
> > shebang
> >
> > > >>(which I guess is to be expected), destroying any paging that had
> >
> > already
> >
> > > >>started. I've tried all sorts of ways, tried re-arranging the
>
> order of
>
> > > >>execution, but the result is the same.
> > > >>
> > > >>I'm at a loss on how to proceed. I've deleted the choice (for now)
>
> and
>
> > run it
> >
> > > >>as a simple select order by name query.The problem seems to be: I
>
> need
>
> > a
> >
> > > >>sub-query select function that retains the original query, simply
> > > >>re-organizing it according to the new criteria, and retains the
> >
> > original
> >
> > > >>paging. (Perhaps I shouldn't care whether the paging is messed up
>
> as
>
> > long as
> >
> > > >>the results are the same.)
> > > >>
> > > >>I realize that the way it's set up below, it will automatically
>
> send a
>
> > NEW
> >
> > > >>query, which is not what I want. I'd like to work with the results
>
> of
>
> > the
> >
> > > >>original query and modify it with the new criteria
> > > >>
> > > >>Any suggestions how I can achieve this, or whether it's even
>
> possible?
>
> > I
> >
> > > >>would greatly appreciate any assistance or comments.
> >>
> >>**
>
> **
>
> > **
> >
> > > >>Snippet of offending code:
> > > >>
> > > >> > > >>
> > > >>//snippet follows:
> > > >>
> > > >>print "";
> > > >>print " ";
> > > >>print "";
>
> > > >>// more code
> > > >>
> > > >>if($_POST['submit'] == "Sort by Name"){
> > > >>$query = "SELECT * FROM rap ORDER BY
> > > >>rsname,rfname,rcountry,rcity,DESC LIMIT 30 OFFSET 30";
> > > >>}
> > > >>elseif($_POST['submit'] == "Sort by Country"){
> > > >>$query = "SELECT * FROM rap ORDER BY
> > > >>rcountry,rcity,rsname,rfname DESC LIMIT 30 OFFSET 30";
> > > >>}
> > > >>
> > > >>//more code, including paging functions
> > > >>?>
> >>
> >>**
>
> **
>
> > 
> >
> > > >>Tia,
> > > >>Andre
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php

-- 
Please pray the Holy Rosary to end the holocaust of abortion.
Remember in your prayers the Holy Souls in Purgatory.

May God bless you abundantly in His love!
For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/

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




RE: [PHP] Automatic color coded HTML

2002-06-05 Thread John Holmes

Not really. Only settings are in PHP.ini for:

highlight.string=   #DD
highlight.comment   =   #FF8000
highlight.keyword   =   #007700
highlight.bg=   #FF
highlight.default   =   #BB
highlight.html  =   #00

That's the defaults. It would be nice if you could break down this just
a little more to apply to HTML tags, strings, etc. 

Search google and sourceforge, maybe something is written already.

---John Holmes...

> -Original Message-
> From: Jarrad Kabral [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 05, 2002 10:14 PM
> To: Php-General (E-mail)
> Subject: RE: [PHP] Automatic color coded HTML
> 
> yeah that would be niceis it configurable at all?
> 
> 
> 
> -Original Message-
> From: John Holmes [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, 6 June 2002 12:19 PM
> To: 'Martin Towell'; 'Jarrad Kabral'; 'Php-General (E-mail)'
> Subject: RE: [PHP] Automatic color coded HTML
> 
> 
> Actually that only highlights PHP code, not HTML, if I remember right.
> It would be nice if this did highlighting for HTML, too, but I think
it
> just comes out all gray.
> 
> ---John Holmes...
> 
> > -Original Message-
> > From: Martin Towell [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, June 05, 2002 10:00 PM
> > To: 'Jarrad Kabral'; Php-General (E-mail)
> > Subject: RE: [PHP] Automatic color coded HTML
> >
> > highlight_file() or something like that
> >
> > -Original Message-
> > From: Jarrad Kabral [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, June 06, 2002 11:55 AM
> > To: Php-General (E-mail)
> > Subject: [PHP] Automatic color coded HTML
> >
> >
> > Hi All,
> >
> > Is a command in PHP to format source code as color coded HTML?
> >
> >
> >
> > Regards
> > Jarrad
> >
> > --
> > 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



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




RE: [PHP] Modifying the sort order of a query

2002-06-05 Thread John Holmes

What do you mean it'll "trash the current paging" ?? Can you give a more
detailed explanation?

Results 30-60 of one result set sorted by a certain column will be
totally different than results 30-60 of a result set sorted by a
different column. 

So the paging would have to start over, anyhow. Unless you're looking to
maintain the same 30 results in the new result set, like my previous
email mentioned...

---John Holmes...

> -Original Message-
> From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 05, 2002 10:19 PM
> To: Miguel Cruz
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Modifying the sort order of a query
> 
> Thanks Miguel,
> 
> I haven't tried the sub-query approach yet, but that does seem to be
the
> way
> to do this. My fear is that it will trash the current paging (which
took
> forever to get working with the current setup). Actually, after trying
my
> original code again in another smaller select function, I'm wondering
> whether
> I even need this refined search option -- it might be a case of
> 'overkill'.
> Still, it's got my curiosity going.
> 
> The problem seems to be centered on how I wrote the original code
(it's
> amzing how it's changed!). I think I'll have to re-write using switch
> functions to clarify exactly what I want it to do.
> 
> Regards,
> Andre
> 
> On Wednesday 05 June 2002 09:43 pm, you wrote:
> > My understanding was that he wanted to see the same 30 rows, but
sorted
> in
> > a different way.
> >
> > For instance, he wanted to see entries 30-60 as sorted by age, but
to
> have
> > those sorted by height when displayed.
> >
> > miguel
> >
> > On Thu, 6 Jun 2002, Bogdan Stancescu wrote:
> > > That's at least curious - limiting and offsetting will most
certainly
> > > affect the results which are then sorted... I don't think that's
what
> he
> > > was after. Just my 2c.
> > >
> > > Bogdan
> > >
> > > Miguel Cruz wrote:
> > > >Try a sub-select:
> > > >
> > > >SELECT * FROM (SELECT * FROM rap ORDER BY
> rcountry,rcity,rsname,rfname
> > > >DESC LIMIT 30 OFFSET 30) ORDER BY whatever;
> > > >
> > > >miguel
> > > >
> > > >On Wed, 5 Jun 2002, Andre Dubuc wrote:
> > > >>Apache 1.3.23 + PHP 4.1.2 + PostgreSQL 7.2
> > > >>
> > > >>I have a query that sorts by name, country, and city, then pages
in
> > > >> groups of 30 records. Originally, I had also coded two buttons:
> "Sort
> > > >> by Country', 'Sort by City' since I wanted to offer users the
> options
> > > >> of these choices.
> > > >>
> > > >>Unfortunately, these buttons work well, but re-select the whole
> shebang
> > > >>(which I guess is to be expected), destroying any paging that
had
> > > >> already started. I've tried all sorts of ways, tried
re-arranging
> the
> > > >> order of execution, but the result is the same.
> > > >>
> > > >>I'm at a loss on how to proceed. I've deleted the choice (for
now)
> and
> > > >> run it as a simple select order by name query.The problem seems
to
> be:
> > > >> I need a sub-query select function that retains the original
query,
> > > >> simply re-organizing it according to the new criteria, and
retains
> the
> > > >> original paging. (Perhaps I shouldn't care whether the paging
is
> > > >> messed up as long as the results are the same.)
> > > >>
> > > >>I realize that the way it's set up below, it will automatically
send
> a
> > > >> NEW query, which is not what I want. I'd like to work with the
> results
> > > >> of the original query and modify it with the new criteria
> > > >>
> > > >>Any suggestions how I can achieve this, or whether it's even
> possible?
> > > >> I would greatly appreciate any assistance or comments.
> > > >>
> > >
>
>>**
*
> > > >>***
> > > >>
> > > >>Snippet of offending code:
> > > >>
> > > >> > > >>
> > > >>//snippet follows:
> > > >>
> > > >>print "";
> > > >>print " ";
> > > >>print "";
> > > >>
> > > >>// more code
> > > >>
> > > >>if($_POST['submit'] == "Sort by Name"){
> > > >>$query = "SELECT * FROM rap ORDER BY
> > > >>rsname,rfname,rcountry,rcity,DESC LIMIT 30 OFFSET 30";
> > > >>}
> > > >>elseif($_POST['submit'] == "Sort by Country"){
> > > >>$query = "SELECT * FROM rap ORDER BY
> > > >>rcountry,rcity,rsname,rfname DESC LIMIT 30 OFFSET 30";
> > > >>}
> > > >>
> > > >>//more code, including paging functions
> > > >>?>
> > > >>
> > >
>
>>**
*
> > > >>*
> > > >>
> > > >>Tia,
> > > >>Andre
> 
> --
> Please pray the Holy Rosary to end the holocaust of abortion.
> Remember in your prayers the Holy Souls in Purgatory.
> 
> May God bless you abundantly in His love!
> For a free Cenacle Scriptural Rosary Booklet:
http://www.webhart.net/csrb/
> 
> --
> 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.ph

RE: [PHP] Automatic color coded HTML

2002-06-05 Thread Jarrad Kabral

yeah that would be niceis it configurable at all?



-Original Message-
From: John Holmes [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 6 June 2002 12:19 PM
To: 'Martin Towell'; 'Jarrad Kabral'; 'Php-General (E-mail)'
Subject: RE: [PHP] Automatic color coded HTML


Actually that only highlights PHP code, not HTML, if I remember right.
It would be nice if this did highlighting for HTML, too, but I think it
just comes out all gray. 

---John Holmes...

> -Original Message-
> From: Martin Towell [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 05, 2002 10:00 PM
> To: 'Jarrad Kabral'; Php-General (E-mail)
> Subject: RE: [PHP] Automatic color coded HTML
> 
> highlight_file() or something like that
> 
> -Original Message-
> From: Jarrad Kabral [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 06, 2002 11:55 AM
> To: Php-General (E-mail)
> Subject: [PHP] Automatic color coded HTML
> 
> 
> Hi All,
> 
> Is a command in PHP to format source code as color coded HTML?
> 
> 
> 
> Regards
> Jarrad
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


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




RE: [PHP] Automatic color coded HTML

2002-06-05 Thread John Holmes

Actually that only highlights PHP code, not HTML, if I remember right.
It would be nice if this did highlighting for HTML, too, but I think it
just comes out all gray. 

---John Holmes...

> -Original Message-
> From: Martin Towell [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 05, 2002 10:00 PM
> To: 'Jarrad Kabral'; Php-General (E-mail)
> Subject: RE: [PHP] Automatic color coded HTML
> 
> highlight_file() or something like that
> 
> -Original Message-
> From: Jarrad Kabral [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 06, 2002 11:55 AM
> To: Php-General (E-mail)
> Subject: [PHP] Automatic color coded HTML
> 
> 
> Hi All,
> 
> Is a command in PHP to format source code as color coded HTML?
> 
> 
> 
> Regards
> Jarrad
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



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




Re: [PHP] Modifying the sort order of a query

2002-06-05 Thread Andre Dubuc

Thanks Miguel,

I haven't tried the sub-query approach yet, but that does seem to be the way 
to do this. My fear is that it will trash the current paging (which took 
forever to get working with the current setup). Actually, after trying my 
original code again in another smaller select function, I'm wondering whether 
I even need this refined search option -- it might be a case of  'overkill'. 
Still, it's got my curiosity going.

The problem seems to be centered on how I wrote the original code (it's 
amzing how it's changed!). I think I'll have to re-write using switch 
functions to clarify exactly what I want it to do.

Regards,
Andre

On Wednesday 05 June 2002 09:43 pm, you wrote:
> My understanding was that he wanted to see the same 30 rows, but sorted in
> a different way.
>
> For instance, he wanted to see entries 30-60 as sorted by age, but to have
> those sorted by height when displayed.
>
> miguel
>
> On Thu, 6 Jun 2002, Bogdan Stancescu wrote:
> > That's at least curious - limiting and offsetting will most certainly
> > affect the results which are then sorted... I don't think that's what he
> > was after. Just my 2c.
> >
> > Bogdan
> >
> > Miguel Cruz wrote:
> > >Try a sub-select:
> > >
> > >SELECT * FROM (SELECT * FROM rap ORDER BY rcountry,rcity,rsname,rfname
> > >DESC LIMIT 30 OFFSET 30) ORDER BY whatever;
> > >
> > >miguel
> > >
> > >On Wed, 5 Jun 2002, Andre Dubuc wrote:
> > >>Apache 1.3.23 + PHP 4.1.2 + PostgreSQL 7.2
> > >>
> > >>I have a query that sorts by name, country, and city, then pages in
> > >> groups of 30 records. Originally, I had also coded two buttons: "Sort
> > >> by Country', 'Sort by City' since I wanted to offer users the options
> > >> of these choices.
> > >>
> > >>Unfortunately, these buttons work well, but re-select the whole shebang
> > >>(which I guess is to be expected), destroying any paging that had
> > >> already started. I've tried all sorts of ways, tried re-arranging the
> > >> order of execution, but the result is the same.
> > >>
> > >>I'm at a loss on how to proceed. I've deleted the choice (for now) and
> > >> run it as a simple select order by name query.The problem seems to be:
> > >> I need a sub-query select function that retains the original query,
> > >> simply re-organizing it according to the new criteria, and retains the
> > >> original paging. (Perhaps I shouldn't care whether the paging is
> > >> messed up as long as the results are the same.)
> > >>
> > >>I realize that the way it's set up below, it will automatically send a
> > >> NEW query, which is not what I want. I'd like to work with the results
> > >> of the original query and modify it with the new criteria
> > >>
> > >>Any suggestions how I can achieve this, or whether it's even possible?
> > >> I would greatly appreciate any assistance or comments.
> > >>
> > >>***
> > >>***
> > >>
> > >>Snippet of offending code:
> > >>
> > >> > >>
> > >>//snippet follows:
> > >>
> > >>print "";
> > >>print " ";
> > >>print "";
> > >>
> > >>// more code
> > >>
> > >>if($_POST['submit'] == "Sort by Name"){
> > >>  $query = "SELECT * FROM rap ORDER BY
> > >>  rsname,rfname,rcountry,rcity,DESC LIMIT 30 OFFSET 30";
> > >>}
> > >>elseif($_POST['submit'] == "Sort by Country"){
> > >>  $query = "SELECT * FROM rap ORDER BY
> > >>  rcountry,rcity,rsname,rfname DESC LIMIT 30 OFFSET 30";
> > >>}
> > >>
> > >>//more code, including paging functions
> > >>?>
> > >>
> > >>***
> > >>*
> > >>
> > >>Tia,
> > >>Andre

-- 
Please pray the Holy Rosary to end the holocaust of abortion.
Remember in your prayers the Holy Souls in Purgatory.

May God bless you abundantly in His love!
For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/

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




RE: [PHP] Modifying the sort order of a query

2002-06-05 Thread John Holmes

> My understanding was that he wanted to see the same 30 rows, but
sorted in
> a different way.
> 
> For instance, he wanted to see entries 30-60 as sorted by age, but to
have
> those sorted by height when displayed.
> 
> miguel


Maybe you could have a hidden field that lists the 30 IDs that are
displayed on the page, as a comma separated list. Then, if the user
chooses to resort those 30 results, based on another column, you can use
that hidden field in your query to limit the IDs.

i.e.



Where the actual numbers would be generated from your result set.

Then, use those numbers in your query.

SELECT * FROM table WHERE ... AND ID IN($display_ids) ORDER BY
<>

Hopefully PG supports IN(). 

My $0.02, I'm sure there are other ways...or maybe this isn't even what
you're looking for. :)

---John Holmes...

> On Thu, 6 Jun 2002, Bogdan Stancescu wrote:
> > That's at least curious - limiting and offsetting will most
certainly
> > affect the results which are then sorted... I don't think that's
what he
> > was after. Just my 2c.
> >
> > Bogdan
> >
> > Miguel Cruz wrote:
> >
> > >Try a sub-select:
> > >
> > >SELECT * FROM (SELECT * FROM rap ORDER BY
rcountry,rcity,rsname,rfname
> > >DESC LIMIT 30 OFFSET 30) ORDER BY whatever;
> > >
> > >miguel
> > >
> > >On Wed, 5 Jun 2002, Andre Dubuc wrote:
> > >
> > >
> > >>Apache 1.3.23 + PHP 4.1.2 + PostgreSQL 7.2
> > >>
> > >>I have a query that sorts by name, country, and city, then pages
in
> groups of
> > >>30 records. Originally, I had also coded two buttons: "Sort by
> Country',
> > >>'Sort by City' since I wanted to offer users the options of these
> choices.
> > >>
> > >>Unfortunately, these buttons work well, but re-select the whole
> shebang
> > >>(which I guess is to be expected), destroying any paging that had
> already
> > >>started. I've tried all sorts of ways, tried re-arranging the
order of
> > >>execution, but the result is the same.
> > >>
> > >>I'm at a loss on how to proceed. I've deleted the choice (for now)
and
> run it
> > >>as a simple select order by name query.The problem seems to be: I
need
> a
> > >>sub-query select function that retains the original query, simply
> > >>re-organizing it according to the new criteria, and retains the
> original
> > >>paging. (Perhaps I shouldn't care whether the paging is messed up
as
> long as
> > >>the results are the same.)
> > >>
> > >>I realize that the way it's set up below, it will automatically
send a
> NEW
> > >>query, which is not what I want. I'd like to work with the results
of
> the
> > >>original query and modify it with the new criteria
> > >>
> > >>Any suggestions how I can achieve this, or whether it's even
possible?
> I
> > >>would greatly appreciate any assistance or comments.
> > >>
> >
>
>>**
**
> **
> > >>
> > >>Snippet of offending code:
> > >>
> > >> > >>
> > >>//snippet follows:
> > >>
> > >>print "";
> > >>print " ";
> > >>print "";
> > >>
> > >>// more code
> > >>
> > >>if($_POST['submit'] == "Sort by Name"){
> > >>  $query = "SELECT * FROM rap ORDER BY
> > >>  rsname,rfname,rcountry,rcity,DESC LIMIT 30 OFFSET 30";
> > >>}
> > >>elseif($_POST['submit'] == "Sort by Country"){
> > >>  $query = "SELECT * FROM rap ORDER BY
> > >>  rcountry,rcity,rsname,rfname DESC LIMIT 30 OFFSET 30";
> > >>}
> > >>
> > >>//more code, including paging functions
> > >>?>
> > >>
> >
>
>>**
**
> 
> > >>
> > >>Tia,
> > >>Andre
> > >>
> > >>
> > >>
> > >>
> > >>
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


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




Re: [PHP] simple email validation ereg

2002-06-05 Thread Miguel Cruz

On Mon, 3 Jun 2002, Alexander Skwar wrote:
> So sprach Jason Wong am 2002-06-03 um 12:10:29 +0800 :
>> The lack of an MX record doesn't necessarily mean mail will not get
>> through, so you cannot use that as a test for whether the address is
>> valid.
> 
> It will not?  Do you have an example?  How is a mail server supposed to
> know where the mail should be delivered if there's no MX?

By looking up the A record.

miguel


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




Re: [PHP] Compiling PHP as static mod

2002-06-05 Thread Tom Rogers

Hi
In your php config give it the path to the apache source files not the 
install directory.
Tom


At 11:55 AM 6/06/2002, Ray Hunter wrote:
>When I try to compile php as a static module in php I get errors that the
>mod_php4.c cannot find the header file.
>
>Here is my php configuration:
>
>./configure --build=i386-redhat-linux-gnu --prefix=/usr/local/php
>--with-apache=/usr/local/apache --with-sybase-ct=/sybase --with-mysql=/usr
>--enable-exif --with-gd --with-jpeg-dir=/usr/lib
>--with-png-dir=/usr/local/lib --with-zlib --with-config-file-path=/etc
>--with-freetype-dir=/usr/local/lib --with-regex=system --enable-xml
>--enable-dbx --enable-bcmath --enable-calendar --enable-magic-quotes
>--enable-inline-optimization --enable-trans-sid --oldincludedir=/usr/include
>--libdir=/usr/lib
>
>
>Here is my apache configuration:
>./configure --prefix=/usr/local/apache
>--activate-module=src/modules/php4/libphp4.a
>
>
>Basically, apache cannot find PHP's header files.
>
>
>Any help would be much appreciated.
>
>Thank you,
>
>RAY HUNTER


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




RE: [PHP] Automatic color coded HTML

2002-06-05 Thread Martin Towell

highlight_file() or something like that

-Original Message-
From: Jarrad Kabral [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 06, 2002 11:55 AM
To: Php-General (E-mail)
Subject: [PHP] Automatic color coded HTML


Hi All,

Is a command in PHP to format source code as color coded HTML?



Regards
Jarrad

-- 
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] Automatic color coded HTML

2002-06-05 Thread Jarrad Kabral

Hi All,

Is a command in PHP to format source code as color coded HTML?



Regards
Jarrad

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




Re: [PHP] run from telnet...like PERL?

2002-06-05 Thread Miguel Cruz

On Wed, 5 Jun 2002, Robert Packer wrote:
> I wrote a script to strip the domain from an e-mail address with PHP. But it
> will max out my lousy computer at work. The lists have about 1 million plus
> addresses on them... However, a colleague wrote a very similar program with
> PERL and ran it from telnet and it went just fine. Can PHP be run in this
> fashion?

Build or download the standalone binary, and then it works just like Perl 
(except that you'll want to add -q to the bangpath invocation).

miguel


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




[PHP] Compiling PHP as static mod

2002-06-05 Thread Ray Hunter

When I try to compile php as a static module in php I get errors that the
mod_php4.c cannot find the header file.

Here is my php configuration:

./configure --build=i386-redhat-linux-gnu --prefix=/usr/local/php
--with-apache=/usr/local/apache --with-sybase-ct=/sybase --with-mysql=/usr
--enable-exif --with-gd --with-jpeg-dir=/usr/lib
--with-png-dir=/usr/local/lib --with-zlib --with-config-file-path=/etc
--with-freetype-dir=/usr/local/lib --with-regex=system --enable-xml
--enable-dbx --enable-bcmath --enable-calendar --enable-magic-quotes
--enable-inline-optimization --enable-trans-sid --oldincludedir=/usr/include
--libdir=/usr/lib


Here is my apache configuration:
./configure --prefix=/usr/local/apache
--activate-module=src/modules/php4/libphp4.a


Basically, apache cannot find PHP's header files.


Any help would be much appreciated.

Thank you,

RAY HUNTER





[PHP] run from telnet...like PERL?

2002-06-05 Thread Robert Packer

I wrote a script to strip the domain from an e-mail address with PHP. But it
will max out my lousy computer at work. The lists have about 1 million plus
addresses on them... However, a colleague wrote a very similar program with
PERL and ran it from telnet and it went just fine. Can PHP be run in this
fashion?

Thanks for any advice..

Robert Packer



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




[PHP] Re: currency rounding issues

2002-06-05 Thread Michael Davey

I have found that the best way to work with currencies is to avoid using any
type of floating point math.

If you multiply your start amount by 100, then perform your calculations as
integers and then divide by 100 again at the end, it should work out OK...

(Heh, at least it has worked for me when doing tax calcs and stuff - who
know what you are doing?!?!?!?)

Mikey

"Paul Berg" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> I am putting together an app that involves the adding together of rounded
> numbers and displaying in a currency format.
> The round() function is causing errors of 1 cent to appear after addition.
> Does anyone know of any routines that might assist?
>
> Thanks in advance...
> Paul
>
>



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




Re: [PHP] Modifying the sort order of a query

2002-06-05 Thread Miguel Cruz

My understanding was that he wanted to see the same 30 rows, but sorted in 
a different way.

For instance, he wanted to see entries 30-60 as sorted by age, but to have 
those sorted by height when displayed.

miguel

On Thu, 6 Jun 2002, Bogdan Stancescu wrote:
> That's at least curious - limiting and offsetting will most certainly 
> affect the results which are then sorted... I don't think that's what he 
> was after. Just my 2c.
> 
> Bogdan
> 
> Miguel Cruz wrote:
> 
> >Try a sub-select:
> >
> >SELECT * FROM (SELECT * FROM rap ORDER BY rcountry,rcity,rsname,rfname 
> >DESC LIMIT 30 OFFSET 30) ORDER BY whatever;
> >
> >miguel
> >
> >On Wed, 5 Jun 2002, Andre Dubuc wrote:
> >  
> >
> >>Apache 1.3.23 + PHP 4.1.2 + PostgreSQL 7.2
> >>
> >>I have a query that sorts by name, country, and city, then pages in groups of 
> >>30 records. Originally, I had also coded two buttons: "Sort by Country', 
> >>'Sort by City' since I wanted to offer users the options of these choices.
> >>
> >>Unfortunately, these buttons work well, but re-select the whole shebang 
> >>(which I guess is to be expected), destroying any paging that had already 
> >>started. I've tried all sorts of ways, tried re-arranging the order of 
> >>execution, but the result is the same. 
> >>
> >>I'm at a loss on how to proceed. I've deleted the choice (for now) and run it 
> >>as a simple select order by name query.The problem seems to be: I need a 
> >>sub-query select function that retains the original query, simply 
> >>re-organizing it according to the new criteria, and retains the original 
> >>paging. (Perhaps I shouldn't care whether the paging is messed up as long as 
> >>the results are the same.)
> >>
> >>I realize that the way it's set up below, it will automatically send a NEW 
> >>query, which is not what I want. I'd like to work with the results of the 
> >>original query and modify it with the new criteria 
> >>
> >>Any suggestions how I can achieve this, or whether it's even possible? I 
> >>would greatly appreciate any assistance or comments.
> >>
> 
>>>**
> >>
> >>Snippet of offending code:
> >>
> >> >>
> >>//snippet follows:
> >>
> >>print "";
> >>print " ";
> >>print "";
> >>
> >>// more code
> >>
> >>if($_POST['submit'] == "Sort by Name"){
> >>$query = "SELECT * FROM rap ORDER BY
> >>rsname,rfname,rcountry,rcity,DESC LIMIT 30 OFFSET 30";
> >>}
> >>elseif($_POST['submit'] == "Sort by Country"){
> >>$query = "SELECT * FROM rap ORDER BY
> >>rcountry,rcity,rsname,rfname DESC LIMIT 30 OFFSET 30";
> >>}
> >>
> >>//more code, including paging functions
> >>?>
> >>
> 
>>>
> >>
> >>Tia,
> >>Andre
> >>
> >>
> >>
> >>
> >>
> >
> >
> >  
> >
> 
> 
> 
> 
> 


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




Re: [PHP] Bug in ob_end_flush/xslt_process... Confirm?

2002-06-05 Thread Tom Rogers

Hi
It seems that it loses path information, it will work if you use an 
absolute path like this:

function my_output_handler($string) {
 $arguments = array('/_xml' => $string,'/_xsl'=>$xsl);
 $xsltproc = xslt_create();
 $html = xslt_process($xsltproc, 'arg:/_xml', 
"/usr/local/apache/htdocs/mysheet.xsl", NULL, $arguments);
 if (!$html)
 $html = 'XSLT processing error: '.xslt_error($xsltproc)."\n";
 xslt_free($xsltproc);
 return $html;
}

If this is a bug I am not qualified to say :) but it seems that it is not 
only the xslt that is affexted as I could not load the xsl file using fread 
either unless I gave the full path.
Tom





At 05:02 AM 6/06/2002, Bret Mogilefsky wrote:
>Hello php-gen'ers,
>
>
>I've been whacking my head against this for a day or so and I'm fairly
>certain I've discovered a bug in the way user-defined output buffering
>handlers work when not explicitly triggered by a call to ob_end_flush().
>
>See the attached sample2.php and mysheet.xsl, both of which should be
>located in the same directory.  Calling sample2.php by itself I get:
>
> XSLT processing error: cannot open file '/mysheet.xsl'
>
>Calling sample2.php with "sample2.php?explicit_ob_flush=1" properly
>finds the .xsl file and does the transformation.
>
>My take: The handler is obviously being called whether I explicitly call
>ob_end_flush() or not once the end of the script is reached, which is
>what I expect and want.  However, the behavior is buggy when the call is
>not done explicitly.
>
>I'll file a bug if someone else can confirm that I should be getting the
>same behavior in both cases...  Otherwise please point out what I'm
>doing wrong.  I'm using php 4.2.1 with apache 1.3.23 under Red Hat 7.3,
>and had the same problem with 4.1.2.
>
>Please cc my address as I'm not subscribed to the list.
>
>
>Thanks in advance,
>Bret
>--
>Bret Mogilefsky * Mgr SCEA Developer Support * [EMAIL PROTECTED]
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


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




[PHP] Re: currency rounding issues

2002-06-05 Thread Manuel Lemos

Hello,

On 06/05/2002 09:55 PM, Paul Berg wrote:
> Hi,
> 
> I am putting together an app that involves the adding together of rounded
> numbers and displaying in a currency format.
> The round() function is causing errors of 1 cent to appear after addition.
> Does anyone know of any routines that might assist?

You should not be using floating point math for precise value. Use fixed 
point math or arbitrary precision math so you do not loose precision:

http://www.php.net/bcadd



-- 

Regards,
Manuel Lemos


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




Re: [PHP] Modifying the sort order of a query

2002-06-05 Thread Bogdan Stancescu

That's at least curious - limiting and offsetting will most certainly 
affect the results which are then sorted... I don't think that's what he 
was after. Just my 2c.

Bogdan

Miguel Cruz wrote:

>Try a sub-select:
>
>SELECT * FROM (SELECT * FROM rap ORDER BY rcountry,rcity,rsname,rfname 
>DESC LIMIT 30 OFFSET 30) ORDER BY whatever;
>
>miguel
>
>On Wed, 5 Jun 2002, Andre Dubuc wrote:
>  
>
>>Apache 1.3.23 + PHP 4.1.2 + PostgreSQL 7.2
>>
>>I have a query that sorts by name, country, and city, then pages in groups of 
>>30 records. Originally, I had also coded two buttons: "Sort by Country', 
>>'Sort by City' since I wanted to offer users the options of these choices.
>>
>>Unfortunately, these buttons work well, but re-select the whole shebang 
>>(which I guess is to be expected), destroying any paging that had already 
>>started. I've tried all sorts of ways, tried re-arranging the order of 
>>execution, but the result is the same. 
>>
>>I'm at a loss on how to proceed. I've deleted the choice (for now) and run it 
>>as a simple select order by name query.The problem seems to be: I need a 
>>sub-query select function that retains the original query, simply 
>>re-organizing it according to the new criteria, and retains the original 
>>paging. (Perhaps I shouldn't care whether the paging is messed up as long as 
>>the results are the same.)
>>
>>I realize that the way it's set up below, it will automatically send a NEW 
>>query, which is not what I want. I'd like to work with the results of the 
>>original query and modify it with the new criteria 
>>
>>Any suggestions how I can achieve this, or whether it's even possible? I 
>>would greatly appreciate any assistance or comments.
>>
>>**
>>
>>Snippet of offending code:
>>
>>>
>>//snippet follows:
>>
>>print "";
>>print " ";
>>print "";
>>
>>// more code
>>
>>if($_POST['submit'] == "Sort by Name"){
>>  $query = "SELECT * FROM rap ORDER BY
>>  rsname,rfname,rcountry,rcity,DESC LIMIT 30 OFFSET 30";
>>}
>>elseif($_POST['submit'] == "Sort by Country"){
>>  $query = "SELECT * FROM rap ORDER BY
>>  rcountry,rcity,rsname,rfname DESC LIMIT 30 OFFSET 30";
>>}
>>
>>//more code, including paging functions
>>?>
>>
>>
>>
>>Tia,
>>Andre
>>
>>
>>
>>
>>
>
>
>  
>




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




Re: [PHP] Re: Finding out how a variable was registered

2002-06-05 Thread Miguel Cruz

On Wed, 5 Jun 2002, John Taylor-Johnston wrote:
> If you change your header to pragma-nocache, he should not be able
> to see the source to know what elements he needs for a .

There are plenty of browsers (lynx being the obvious example) that will 
let you see the source regardless of any headers.

And when all else fails, there's telnet www.example.com 80.

miguel


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




Re: [PHP] Re: sorting a list using regex

2002-06-05 Thread Miguel Cruz

I completely don't understand what you're trying to say, but I have a 
sneaking suspicion the usort() functions might be helpful here.

miguel

On Wed, 5 Jun 2002, Joshua E Minnie wrote:
> I am trying to sort a list by their first character, my problem comes when
> that first character is a number.  When the character is a number I should
> be able to display just the values which begin with a number.  When the
> value is a letter, I have no problem sorting this out.  Here is the code
> that I am using to determine that, any help will be greatly appreciated.
> 
>  [snip]
> while(!feof($fp)) {
>   $artist = fgetcsv($fp,1024,":");
>   if(isset($_GET["sort"])) {
> if(($_GET["sort"] != substr(strtoupper($artist[0]),0,1)) &&
> !($_GET["sort"] == "#" && ereg("^[0-9]",$artist[0]))) continue;
>   }
> }
> [snip]
> ?>
> 
> Running PHP 4.2.1 on IIS 5 W2K
> 
> Thanks
> 
> -josh
> 
> 
> 
> 
> 
> 


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




Re: [PHP] php and javascript question

2002-06-05 Thread Miguel Cruz

On Wed, 5 Jun 2002, Martin Clifford wrote:
> As far as I'm aware you can't create a javascript variable and use it
> within PHP on the same page.  You can add that variable's value to a
> hidden form element to be passed to the next page, but I don't think so
> with the same page.

You're quite right; the PHP executes and terminates before the JavaScript
ever starts.

If you want to get JavaScript-calculated values back into PHP, you have to 
pass them back through new requests to the server.

miguel


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




Re: [PHP] Displaying images with php?

2002-06-05 Thread Miguel Cruz

On Wed, 5 Jun 2002, Ragnar wrote:
> no, you did not misunderstand. Thats the way im building the html code for
> displaying images now, but in the manual there is a lot of image-functions.
> I thought that there maybe was some better way of displaying the images..

The image functions are for building new images or for modifying existing 
images. If you already have them ready to go sitting in a directory, 
there's no point messing with anything more complicated than 

miguel


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




Re: [PHP] Passing Values to an image script

2002-06-05 Thread Miguel Cruz

On Thu, 6 Jun 2002, Anzak Wolf wrote:
> $h=20;
> $w=80;
> print "";
> 
> Now this is a much watered down version of what I'm doing, but the idea is 
> the same.  I don't want to put the values I'm passing to the image in the 
> html code to be passed with a get.  I'd like to be able to maybe pass then 
> in a POST format though I'm not sure how I can do that or if I can.  The 
> other idea I had was to start a session and register $h and $w then when I 
> start the images script I can connect to the session and get the values form 
> there though I would have to use Arrays so that I could keep data on many 
> diff. images.  I could pass the array index to the image script which would 
> index all the array elements needed.  The only down side I can see to that 
> is that I would have to serialize the array vars in order to maintain them 
> between sessions (index.php and image.php) and I would have a higher over 
> head on my session code which may impact preformance greatly.  Anyone have 
> any ideas about this as in good idea bad idea, or other suggestions on how 
> to pass this data without letting the user see it.

You don't want them to see it for which reason?

1) It's highly confidential; or
2) It looks ugly; or
3) You don't want casual users messing with it...?

If 3, just base64 encode the serialized array of data and most people will
leave it alone (it'll just look like a string of random letters and
numbers)

Posting isn't that useful unless the image is going to show up on its own 
in the web browser window.

Sessions are okay, but once people start using the back button you are 
going to have some weird side effects.

miguel


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




Re: [PHP] Modifying the sort order of a query

2002-06-05 Thread Miguel Cruz

Try a sub-select:

SELECT * FROM (SELECT * FROM rap ORDER BY rcountry,rcity,rsname,rfname 
DESC LIMIT 30 OFFSET 30) ORDER BY whatever;

miguel

On Wed, 5 Jun 2002, Andre Dubuc wrote:
> Apache 1.3.23 + PHP 4.1.2 + PostgreSQL 7.2
> 
> I have a query that sorts by name, country, and city, then pages in groups of 
> 30 records. Originally, I had also coded two buttons: "Sort by Country', 
> 'Sort by City' since I wanted to offer users the options of these choices.
> 
> Unfortunately, these buttons work well, but re-select the whole shebang 
> (which I guess is to be expected), destroying any paging that had already 
> started. I've tried all sorts of ways, tried re-arranging the order of 
> execution, but the result is the same. 
> 
> I'm at a loss on how to proceed. I've deleted the choice (for now) and run it 
> as a simple select order by name query.The problem seems to be: I need a 
> sub-query select function that retains the original query, simply 
> re-organizing it according to the new criteria, and retains the original 
> paging. (Perhaps I shouldn't care whether the paging is messed up as long as 
> the results are the same.)
> 
> I realize that the way it's set up below, it will automatically send a NEW 
> query, which is not what I want. I'd like to work with the results of the 
> original query and modify it with the new criteria 
> 
> Any suggestions how I can achieve this, or whether it's even possible? I 
> would greatly appreciate any assistance or comments.
> 
> 
>**
> 
> Snippet of offending code:
> 
>  
> //snippet follows:
> 
> print "";
> print " ";
> print "";
> 
> // more code
> 
> if($_POST['submit'] == "Sort by Name"){
>   $query = "SELECT * FROM rap ORDER BY
>   rsname,rfname,rcountry,rcity,DESC LIMIT 30 OFFSET 30";
> }
> elseif($_POST['submit'] == "Sort by Country"){
>   $query = "SELECT * FROM rap ORDER BY
>   rcountry,rcity,rsname,rfname DESC LIMIT 30 OFFSET 30";
> }
> 
> //more code, including paging functions
> ?>
> 
> 
>
> 
> Tia,
> Andre
> 
> 
> 


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




[PHP] Passing Values to an image script

2002-06-05 Thread Anzak Wolf

I'm stuck on an odd problem with sending values between scripts.  Take the 
following example.

$h=20;
$w=80;
print "";

Now this is a much watered down version of what I'm doing, but the idea is 
the same.  I don't want to put the values I'm passing to the image in the 
html code to be passed with a get.  I'd like to be able to maybe pass then 
in a POST format though I'm not sure how I can do that or if I can.  The 
other idea I had was to start a session and register $h and $w then when I 
start the images script I can connect to the session and get the values form 
there though I would have to use Arrays so that I could keep data on many 
diff. images.  I could pass the array index to the image script which would 
index all the array elements needed.  The only down side I can see to that 
is that I would have to serialize the array vars in order to maintain them 
between sessions (index.php and image.php) and I would have a higher over 
head on my session code which may impact preformance greatly.  Anyone have 
any ideas about this as in good idea bad idea, or other suggestions on how 
to pass this data without letting the user see it.

-Jim

_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


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




Re: [PHP] Remote file information (PHP 4.0)

2002-06-05 Thread Miguel Cruz

On Wed, 5 Jun 2002, Erik Fears wrote:
> Is there a way, when requesting remote files (using fopen() or file()) to
> determine the base directory of the file retrieved? For instance, if I did:
> 
> $file = file("http://www.host.com/directory/php";);
> 
> Several things can happen. One is that theres an actual file named php that
> is retrieved. Secondly, php could be a directory and the file index.html is
> retrieved from that directory. Or php could be a directory without an index,
> in which case a directory listing is generated or something to that effect.
> 
> But what I want to be able to do is to determine what the base directory is
> in any case. For instance if php was a file, the base would be
> http://www.host.com/directory/, if it was a directory with an index the base
> would be http://www.host.com/directory/php.
> 
> Anyone know if this information is available?

Not definitively. Sometimes (quite often), if you request something that's
a directory, you'll get a 301 redirecting you to the same URL with the
slash properly appended. Other than that, you're out of luck. Servers can
hand back anything they want in response to any request and there's no
need for them to even have a CONCEPT of file vs. directory, let alone tell
you about it.

miguel


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




Re: [PHP] Need some suggestions about "community" :)

2002-06-05 Thread Miguel Cruz

On Thu, 6 Jun 2002, Hawk wrote:
> Just for fun I, and a few friends were going to make a community, started
> about an hour ago :)
> Haven't started with the design or anything yet, but I was thinking how the
> best way to handle users would be, or atleast what you can recommend, first
> I thought about having a database with users, and one with messages and
> stuff, and then I thought it might be smoother to create a database for each
> user, and store all his/her things in it, what do you think?

A database for each user doesn't make a lot of sense.

A table of users, a table of messages, a table of groups, a table of 
whatever else...

miguel


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




Re: [PHP] currency rounding issues

2002-06-05 Thread Miguel Cruz

On Thu, 6 Jun 2002, Paul Berg wrote:
> I am putting together an app that involves the adding together of rounded
> numbers and displaying in a currency format.
> The round() function is causing errors of 1 cent to appear after addition.
> Does anyone know of any routines that might assist?

It would help if you'd provide an example including the numbers you're 
adding, the result you get, and the desired result.

Nevertheless, check out:

  ceil()
  floor()
  number_format()

I'm sure you'll find something good in there.

miguel


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




[PHP] Modifying the sort order of a query

2002-06-05 Thread Andre Dubuc

Apache 1.3.23 + PHP 4.1.2 + PostgreSQL 7.2

I have a query that sorts by name, country, and city, then pages in groups of 
30 records. Originally, I had also coded two buttons: "Sort by Country', 
'Sort by City' since I wanted to offer users the options of these choices.

Unfortunately, these buttons work well, but re-select the whole shebang 
(which I guess is to be expected), destroying any paging that had already 
started. I've tried all sorts of ways, tried re-arranging the order of 
execution, but the result is the same. 

I'm at a loss on how to proceed. I've deleted the choice (for now) and run it 
as a simple select order by name query.The problem seems to be: I need a 
sub-query select function that retains the original query, simply 
re-organizing it according to the new criteria, and retains the original 
paging. (Perhaps I shouldn't care whether the paging is messed up as long as 
the results are the same.)

I realize that the way it's set up below, it will automatically send a NEW 
query, which is not what I want. I'd like to work with the results of the 
original query and modify it with the new criteria 

Any suggestions how I can achieve this, or whether it's even possible? I 
would greatly appreciate any assistance or comments.

**

Snippet of offending code:

";
print " ";
print "";

// more code

if($_POST['submit'] == "Sort by Name"){
$query = "SELECT * FROM rap ORDER BY
rsname,rfname,rcountry,rcity,DESC LIMIT 30 OFFSET 30";
}
elseif($_POST['submit'] == "Sort by Country"){
$query = "SELECT * FROM rap ORDER BY
rcountry,rcity,rsname,rfname DESC LIMIT 30 OFFSET 30";
}

//more code, including paging functions
?>



Tia,
Andre


-- 
Please pray the Holy Rosary to end the holocaust of abortion.
Remember in your prayers the Holy Souls in Purgatory.

May God bless you abundantly in His love!
For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/

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




[PHP] currency rounding issues

2002-06-05 Thread Paul Berg

Hi,

I am putting together an app that involves the adding together of rounded
numbers and displaying in a currency format.
The round() function is causing errors of 1 cent to appear after addition.
Does anyone know of any routines that might assist?

Thanks in advance...
Paul



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




Re: [PHP] OOP Question in PHP

2002-06-05 Thread Daniel Tryba

On Wed, Jun 05, 2002 at 10:32:39PM +0100, Henry Blackman wrote:
> Do I create a new document and pass the primary key as it's a variable in
> the
> 
> $document = new Document(number);
> 
> and have the constructor retrieve the appropriate data from MySQL and fill
> the attribute variables.
> 
> Or do I do something like:
> 
> $document = new Document;
> $document ->retrieve(number);
> 
> Which is the best and most "valid" way of doing things.

You could do both, and use whatever you find more appropriate at that
moment:

class Document
{
   function Document($id='')
   {
   if($id)
{
   $this->retrieve($id);
}
   }

function retrieve($id)
{
   //do something
}
}

BTW I get the feeling that you want retrieve() to output directly to the
browser (echo/print...), IMHO you shouldn't do that at all but let
retrieve() return a string/array/whatever. But that's up to you :)

-- 

  Daniel Tryba


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




[PHP] Bug in ob_end_flush/xslt_process... Confirm?

2002-06-05 Thread Bret Mogilefsky

Hello php-gen'ers,


I've been whacking my head against this for a day or so and I'm fairly
certain I've discovered a bug in the way user-defined output buffering
handlers work when not explicitly triggered by a call to ob_end_flush().

See the attached sample2.php and mysheet.xsl, both of which should be
located in the same directory.  Calling sample2.php by itself I get:

XSLT processing error: cannot open file '/mysheet.xsl'

Calling sample2.php with "sample2.php?explicit_ob_flush=1" properly
finds the .xsl file and does the transformation.

My take: The handler is obviously being called whether I explicitly call
ob_end_flush() or not once the end of the script is reached, which is
what I expect and want.  However, the behavior is buggy when the call is
not done explicitly.

I'll file a bug if someone else can confirm that I should be getting the
same behavior in both cases...  Otherwise please point out what I'm
doing wrong.  I'm using php 4.2.1 with apache 1.3.23 under Red Hat 7.3,
and had the same problem with 4.1.2.

Please cc my address as I'm not subscribed to the list.


Thanks in advance,
Bret
--
Bret Mogilefsky * Mgr SCEA Developer Support * [EMAIL PROTECTED]




sample2.php
Description: application/php


http://www.w3.org/1999/XSL/Transform";>








































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


[PHP] Re: text file

2002-06-05 Thread Philip Hallstrom

Take a look at following functions:

http://www.php.net/manual/en/function.file.php
http://www.php.net/manual/en/function.array-unshift.php

-philip

On Wed, 5 Jun 2002, John Taylor-Johnston wrote:

> I want to open a text file which has 12 lines and
> (1) insert a new line at line[0]
> (2) re-save the text file only with 12 lines (Therefore line[12] gets
> chopped out.
>
> I had some code to do this with Perl.
>
>   open (NEW, ">$filepath\\$file");
>print NEW "$something";
>   for ($i = 2; $i < 12; $i++)
>{
>print NEW "$lines[$i]";
>print "$lines[$i]";
>}
>
> How can I do it now with PHP?
> Open the file (http://www.php.net/manual/en/function.fopen.php)
> Suck a text file into an array. <---??
> Insert at line[0]  <---??
> and rewrite the file.
> (http://www.php.net/manual/en/function.fopen.php)
>
>
> John
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




[PHP] text file

2002-06-05 Thread John Taylor-Johnston

I want to open a text file which has 12 lines and
(1) insert a new line at line[0]
(2) re-save the text file only with 12 lines (Therefore line[12] gets
chopped out.

I had some code to do this with Perl.

  open (NEW, ">$filepath\\$file");
   print NEW "$something";
  for ($i = 2; $i < 12; $i++)
   {
   print NEW "$lines[$i]";
   print "$lines[$i]";
   }

How can I do it now with PHP?
Open the file (http://www.php.net/manual/en/function.fopen.php)
Suck a text file into an array. <---??
Insert at line[0]  <---??
and rewrite the file.
(http://www.php.net/manual/en/function.fopen.php)


John


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




RE: [PHP] Re: Finding out how a variable was registered

2002-06-05 Thread Dan Vande More

It may not work for you but this seems to work for us:



-Original Message-
From: Scott Hurring [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 05, 2002 4:18 PM
To: Php-General (E-mail)
Subject: RE: [PHP] Re: Finding out how a variable was registered


If you want to stop most people, try posting an MD5() hash
of the field contents to the form, and then verifying it
upon form submittal.

For example:




However, if you get a smart user, he can simply change
the value and the MD5 hash to be the correct hash of
the new value and circumvent all your work. 

(But then again, if you get anyone that's smart and
committed, it's just a matter of time before he will
figure out *some* loophole to subvert your forms)

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

> -Original Message-
> From: John Taylor-Johnston [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 05, 2002 5:24 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: Finding out how a variable was registered
> 
> 
> If you change your header to pragma-nocache, he should not be able
> to see the source to know what elements he needs for a .
> Or you could also use a session to hide the variables?
> 
> Joe Pemberton wrote:
> 
> > Is there a function call to figure out how a variable was 
> registered?  I am writing a page that handles a form and I 
> need to know whether or not a variable was created using the 
> GET or POST method (I don't want the user to be able to to 
> 'foo.php?var=value' and mess with the results)
> > - - Joe
> >
> > [EMAIL PROTECTED]
> 
> --
> John Taylor-Johnston
> --
> ---
>   ' ' '   Collège de Sherbrooke:
>  ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
>- Université de Sherbrooke:
>   http://compcanlit.ca/
>   819-569-2064
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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


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




RE: [PHP] Re: PHP Apache Module AND command Line

2002-06-05 Thread Scott Hurring

Grab the PHP ZIP, unzip it, add it to your PATH.  done.  :-)

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

> -Original Message-
> From: John Taylor-Johnston [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 05, 2002 5:13 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: PHP Apache Module AND command Line
> 
> 
> I can. I did it once in windows on a dos command line.
> I believe I used print ""; instead of echo "aaa";
> 
> 
> Steve Buehler wrote:
> 
> > Is there doc somewhere to would tell how to install PHP as 
> a command line
> > interpreter (like perl) without messing up the installation 
> of PHP that is
> > installed as a module in/for Apache?  Basically, I want to 
> have both on the
> > same server.  Or can this even be done?
> >
> > Thank You
> > Steve
> 
> --
> John Taylor-Johnston
> --
> ---
>   ' ' '   Collège de Sherbrooke:
>  ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
>- Université de Sherbrooke:
>   http://compcanlit.ca/
>   819-569-2064
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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




RE: [PHP] Re: Finding out how a variable was registered

2002-06-05 Thread Scott Hurring

If you want to stop most people, try posting an MD5() hash
of the field contents to the form, and then verifying it
upon form submittal.

For example:




However, if you get a smart user, he can simply change
the value and the MD5 hash to be the correct hash of
the new value and circumvent all your work. 

(But then again, if you get anyone that's smart and
committed, it's just a matter of time before he will
figure out *some* loophole to subvert your forms)

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

> -Original Message-
> From: John Taylor-Johnston [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 05, 2002 5:24 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: Finding out how a variable was registered
> 
> 
> If you change your header to pragma-nocache, he should not be able
> to see the source to know what elements he needs for a .
> Or you could also use a session to hide the variables?
> 
> Joe Pemberton wrote:
> 
> > Is there a function call to figure out how a variable was 
> registered?  I am writing a page that handles a form and I 
> need to know whether or not a variable was created using the 
> GET or POST method (I don't want the user to be able to to 
> 'foo.php?var=value' and mess with the results)
> > - - Joe
> >
> > [EMAIL PROTECTED]
> 
> --
> John Taylor-Johnston
> --
> ---
>   ' ' '   Collège de Sherbrooke:
>  ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
>- Université de Sherbrooke:
>   http://compcanlit.ca/
>   819-569-2064
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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




Re: [PHP] Sessions question (-enable-trans-sid)

2002-06-05 Thread Nick Wilson

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


* and then 1LT John W. Holmes declared
> I guess PHP just can't tell that cookies are enabled. I'm sure the method
> isn't full proof. Your sessions get through either way, so what's the big
> deal?

Mainly in SEO stuff. If an SE like google as a good example picks up the
PHPSESSID=slkfjdsjfsdlkf and then comes back and gets a different id
next time you can lose page rank for duplicate content.

Big deal indeed i'd say.

- -- 
Nick Wilson //  www.explodingnet.com



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE8/o7FHpvrrTa6L5oRAkYuAKCD/9s4L2X7DK9oVsWZmI0Hq6mk2QCgnIZk
4uJyIEUuzPEnPdwmIFWDqLk=
=fm70
-END PGP SIGNATURE-

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




RE: [PHP] Finding out how a variable was registered

2002-06-05 Thread Scott Hurring

Yes, but you really must realize how utterly easy it is to 
POST bogus variables to a form  (Save the page as HTML, edit,
load in browser, submit -- bingo).If you're using the
assumption "these vars were POSTed, so they're safe", you're
begging for trouble.

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

> -Original Message-
> From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 05, 2002 4:30 PM
> To: Joe Pemberton; php list
> Subject: Re: [PHP] Finding out how a variable was registered
> 
> 
> Use $HTTP_POST_VARS['var'] instead of $var and you will know 
> it comes from
> post. Or $HTTP_GET_VARS['var'] if you want it from GET (the URL).
> 
> Or use the superglobals like someone else mentioned if you 
> have the latest
> PHP version.
> 
> ---John Holmes...
> 
> - Original Message -
> From: "Joe Pemberton" <[EMAIL PROTECTED]>
> To: "php list" <[EMAIL PROTECTED]>
> Sent: Wednesday, June 05, 2002 2:45 PM
> Subject: [PHP] Finding out how a variable was registered
> 
> 
> Is there a function call to figure out how a variable was 
> registered?  I am
> writing a page that handles a form and I need to know whether or not a
> variable was created using the GET or POST method (I don't 
> want the user to
> be able to to 'foo.php?var=value' and mess with the results)
> - - Joe
> 
> [EMAIL PROTECTED]
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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




Re: [PHP] global variables without sessions on apache

2002-06-05 Thread Zac Hillier

Miguel,

I mean that the variables will never change per Virtual host but that the
site is a template for many sites and these vars are part of the distinction
for each site / Virtual Host.

So far the suggestions of using the  auto-prepend  in the php.ini have not
seemed to cater for this. Can you help further?

-- ORIGINAL MESSAGE --

Is it possible using php on our own apache server to create global variables
for virtual host without having to use session variables.

We would like to have three variables that are constant for each virtual
host and that are available from every page, I thought it would be possible
with htaccess or http.conf but am struggling to find documentation for it.

Thanks,

Zac

- Original Message -
From: "Miguel Cruz" <[EMAIL PROTECTED]>
To: "Zac Hillier" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, June 05, 2002 7:12 PM
Subject: Re: [PHP] global variables without sessions on apache


> On Wed, 5 Jun 2002, Zac Hillier wrote:
> > Is it possible using php on our own apache server to create global
> > variables for virtual host without having to use session variables.
> >
> > We would like to have three variables that are constant for each virtual
> > host and that are available from every page, I thought it would be
possible
> > with htaccess or http.conf but am struggling to find documentation for
it.
>
> When you say "that are constant" do you mean that they never change or
> just that they are the same for each page at any given time?
>
> If you need dynamic variables shared between all your pages, you're going
> to have to either use a database or shared memory as documented at:
>
>http://www.php.net/manual/en/ref.sem.php
>
> miguel
>
>
>


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




RE: [PHP] Need some suggestions about "community" :)

2002-06-05 Thread Scott Hurring

Oh my.  There are many ways go about creating a community,
but a database for Each User?  That's pure insanity.

Try making perhaps a table for each user, or maybe 
(depending on what kind and how much user data
you're keeping) use one single table for all users.

Read up on Database Normalization for some good
design pointers:
http://home.earthlink.net/~billkent/Doc/simple5.htm

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

> -Original Message-
> From: Hawk [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 05, 2002 6:04 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Need some suggestions about "community" :)
> 
> 
> Just for fun I, and a few friends were going to make a 
> community, started
> about an hour ago :)
> Haven't started with the design or anything yet, but I was 
> thinking how the
> best way to handle users would be, or atleast what you can 
> recommend, first
> I thought about having a database with users, and one with 
> messages and
> stuff, and then I thought it might be smoother to create a 
> database for each
> user, and store all his/her things in it, what do you think?
> If there is any other good way, I'm also open for suggestions :)
> 
> Håkan
> 
> 
> 
> -- 
> 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] Need some suggestions about "community" :)

2002-06-05 Thread Hawk

Just for fun I, and a few friends were going to make a community, started
about an hour ago :)
Haven't started with the design or anything yet, but I was thinking how the
best way to handle users would be, or atleast what you can recommend, first
I thought about having a database with users, and one with messages and
stuff, and then I thought it might be smoother to create a database for each
user, and store all his/her things in it, what do you think?
If there is any other good way, I'm also open for suggestions :)

Håkan



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




[PHP] [PHP]: Function strtoupper () does not convert the characterñ to Ñ

2002-06-05 Thread ignacio . estrada

I have a capture form using text fields.   This form receives data from the
user and then through a php module the data will be stored on an Oracle
database via ODBC.   All the data is converted to caps so I am using the
strtoupper() function.  However when the user writes characters like
 ñ the strtoupper function changes the character (to another character but
not to Ñ), so the ODBC manager report an error message becouse he does not
accept the converted character.

What can I do to get the correct upper case character ?

Thanks in advanced !!

Atte. Ignacio Estrada F.
Centro Nacional de Control de Energia
Area de Control Occidental
025+6463, 025+6464, 025+6469


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




RE: [PHP] php and javascript question

2002-06-05 Thread Scott Hurring

As someone else suggested a few days ago: try using an IFRAME,
and refreshing it from javascript with the values you need.

The whole browser will not refresh, just the IFRAME, which
will give the illusion of jscript and php talking to each
other in realtime.

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

> -Original Message-
> From: Martin Clifford [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 05, 2002 4:24 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: [PHP] php and javascript question
> 
> 
> As far as I'm aware you can't create a javascript variable 
> and use it within PHP on the same page.  You can add that 
> variable's value to a hidden form element to be passed to the 
> next page, but I don't think so with the same page.
> 
> martin
> 
> >>> "kemu" <[EMAIL PROTECTED]> 06/05/02 02:30PM >>>
> I have a page first he generates a var in javascript
> my next question is
> is it possible to use that var in php on the same page
> first he does the javascript then the 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
> 

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




RE: [PHP] htaccess

2002-06-05 Thread Ray Hunter

Try checking the apache environment...however that password will not be
there...


Thank you,

RAY HUNTER



-Original Message-
From: Steve Buehler [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 05, 2002 3:39 PM
To: PHP
Subject: [PHP] htaccess


I have a php script in an .htaccess protected directory.  Is there a way 
that PHP could find out what login was used?

Steve


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



RE: [PHP] htaccess

2002-06-05 Thread Scott Hurring

Try creating an .htaccess protected script, and do a 
var_dump($GLOBALS) to see what vars are set, and if
any of them contain the name you logged in with.

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

> -Original Message-
> From: Steve Buehler [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 05, 2002 5:39 PM
> To: PHP
> Subject: [PHP] htaccess
> 
> 
> I have a php script in an .htaccess protected directory.  Is 
> there a way 
> that PHP could find out what login was used?
> 
> Steve
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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




RE: [PHP] Is this possible

2002-06-05 Thread Scott Hurring

Since you didnt include the code for InsideClass, i can only
assume that you're probably getting errors becuase "$bob"
is not initialized anywhere.

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

> -Original Message-
> From: James Edgar [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 05, 2002 5:27 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Is this possible
> 
> 
> I am trying to run a class inside a class, it says that the 
> object is there but when I go to get the info, it is not 
> there. I have attached the code below. Any help would be 
> greatly appreciated.
> 
> class myfirstClass
>   {
> 
>   
>   function Track($tracknum)
>   {
>   include("insideclass.inc");
>   
>   $obj = new InsideClass($data,"bob");  
>   
>   if (is_object($obj)) 
>   {
>   print("Yes"); // It will print this
>   }
>   else
>   {
>   print("No");
>   }
>   
>   / below we will see the status of the 
> result   
>   for($i=0;$i   { 
>   $nine = 
> $bob["Whatever_whaterver"][$i]->Whatever[0] . "\n"; 
>   }
> 
>   echo($nine); // Does not echo anything.
> 
>   } // end func
> 
>   } // end class
> 
> 
> 
> -- 
> 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] htaccess

2002-06-05 Thread Steve Buehler

I have a php script in an .htaccess protected directory.  Is there a way 
that PHP could find out what login was used?

Steve


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




RE: [PHP] OOP Question in PHP

2002-06-05 Thread Scott Hurring

Depends ;-)

I'd say that the second way is probably "best", becuase
it avoids implied behaviour, which sometimes can cause
problems (lets say you want to init. a document object,
but not get anything from the DB).  If you want to create
a brand new Document, obviously it won't be in the DB
already, so you might not want to have the constructor
go and try to fetch it.

instead (with option #2), you could do something like:

// Create new document
$d = new Document();
// populate document
$d->save();

and

// Get existing doc
$d = new Document();
$d->get(ID);

But that's just my view... there are as many different
views on OO as there are programmers :)

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

> -Original Message-
> From: Henry Blackman [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 05, 2002 5:33 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] OOP Question in PHP
> 
> 
> Hello.
> 
> I have, what is probably a silly, question.
> 
> I want to convert my existing scripts to OO - because it's 
> the "way to go"
> in terms of the huge amount of functionality that they now 
> have (and since
> I've never done it before it would be interesting).  However 
> I have one
> thing that I don't understand.
> 
> My scripts manipulate documents and these documents are 
> stored in a MySQL
> database.
> 
> To create a new object is really easy.  However, since I have lots of
> documents already, how do I alter one?
> 
> Do I create a new document and pass the primary key as it's a 
> variable in
> the
> 
> $document = new Document(number);
> 
> and have the constructor retrieve the appropriate data from 
> MySQL and fill
> the attribute variables.
> 
> Or do I do something like:
> 
> $document = new Document;
> $document ->retrieve(number);
> 
> Which is the best and most "valid" way of doing things.
> 
> Cheers,
> Henry
> 
> 
> 
> 
> 
> -- 
> 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] OOP Question in PHP

2002-06-05 Thread Henry Blackman

Hello.

I have, what is probably a silly, question.

I want to convert my existing scripts to OO - because it's the "way to go"
in terms of the huge amount of functionality that they now have (and since
I've never done it before it would be interesting).  However I have one
thing that I don't understand.

My scripts manipulate documents and these documents are stored in a MySQL
database.

To create a new object is really easy.  However, since I have lots of
documents already, how do I alter one?

Do I create a new document and pass the primary key as it's a variable in
the

$document = new Document(number);

and have the constructor retrieve the appropriate data from MySQL and fill
the attribute variables.

Or do I do something like:

$document = new Document;
$document ->retrieve(number);

Which is the best and most "valid" way of doing things.

Cheers,
Henry





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




RE: [PHP] Passing variable to new page and pulling the rest of info from database

2002-06-05 Thread Scott Hurring

Sorry, i meant: mysql_escape_string( $value )

I use a class to handle accessing the database, and i
named the function $db->quote(...);  i keep forgetting
that the actual function call that the class is making ;-)

And yes, validating that it's an integer works also,
but even after pregging vars to all hell and back to
verify contents, i still quote.  i'm paranoid. :)

---
Scott Hurring
Systems Programmer
EAC Corporation
[EMAIL PROTECTED]
Voice: 201-462-2149
Fax: 201-288-1515

> -Original Message-
> From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 05, 2002 5:10 PM
> To: Scott Hurring; Php-General (E-mail)
> Subject: Re: [PHP] Passing variable to new page and pulling 
> the rest of
> info from database
> 
> 
> Or simply just validate it's an integer, like it should be, 
> like you would
> do with any user input...
> 
> There is no mysql_quote() function...or am I missing something?
> 
> ---John Holmes...
> 
> - Original Message -
> From: "Scott Hurring" <[EMAIL PROTECTED]>
> To: "Php-General (E-mail)" <[EMAIL PROTECTED]>
> Sent: Wednesday, June 05, 2002 4:30 PM
> Subject: RE: [PHP] Passing variable to new page and pulling 
> the rest of info
> from database
> 
> 
> > Ahhh! quote that ID number before using it in a query!  :)
> >
> > // for mysql
> > mysql_quote($_GET['ID']);
> >
> > ---
> > Scott Hurring
> > Systems Programmer
> > EAC Corporation
> > [EMAIL PROTECTED]
> > Voice: 201-462-2149
> > Fax: 201-288-1515
> >
> > > -Original Message-
> > > From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, June 05, 2002 4:29 PM
> > > To: Igor Portnoy; [EMAIL PROTECTED]
> > > Subject: Re: [PHP] Passing variable to new page and pulling
> > > the rest of
> > > info from database
> > >
> > >
> > > SELECT * FROM table WHERE ID = $_GET['ID']
> > >
> > > Then create a page to display all of that information. Look
> > > at the mysql
> > > functions and learn some PHP. We can't help you without
> > > knowing what's in
> > > your table and how you want it displayed, etc...
> > >
> > > So keep learning and reading and you'll figure out how to 
> do it. Your
> > > question is way to broad for any help...
> > >
> > > ---John Holmes...
> > >
> > > - Original Message -
> > > From: "Igor Portnoy" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Wednesday, June 05, 2002 2:40 PM
> > > Subject: [PHP] Passing variable to new page and pulling the
> > > rest of info
> > > from database
> > >
> > >
> > > Hello,
> > >
> > >
> > >
> > > I am passing a variable to the new page, when user clicks 
> on the link.
> > > Something like that:
> > >
> > > 
> > >
> > >
> > >
> > > How can I extract all other information out of my 
> database for that ID
> > > in the next page (showimage.php)?
> > >
> > >
> > >
> > > Thanks
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > 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




[PHP] Is this possible

2002-06-05 Thread James Edgar

I am trying to run a class inside a class, it says that the object is there but when I 
go to get the info, it is not there. I have attached the code below. Any help would be 
greatly appreciated.

class myfirstClass
{


function Track($tracknum)
{
include("insideclass.inc");

$obj = new InsideClass($data,"bob");  

if (is_object($obj)) 
{
print("Yes"); // It will print this
}
else
{
print("No");
}

/ below we will see the status of the result   
for($i=0;$iWhatever[0] . "\n"; 
}

echo($nine); // Does not echo anything.

} // end func

} // end class



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




[PHP] Re: Finding out how a variable was registered

2002-06-05 Thread John Taylor-Johnston

If you change your header to pragma-nocache, he should not be able
to see the source to know what elements he needs for a .
Or you could also use a session to hide the variables?

Joe Pemberton wrote:

> Is there a function call to figure out how a variable was registered?  I am writing 
>a page that handles a form and I need to know whether or not a variable was created 
>using the GET or POST method (I don't want the user to be able to to 
>'foo.php?var=value' and mess with the results)
> - - Joe
>
> [EMAIL PROTECTED]

--
John Taylor-Johnston
-
  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




[PHP] secure?

2002-06-05 Thread Jas

Ok, I am not a security expert so I would like to know if my security
measures I have implimented is adequate enough to keep people out.  Any
pointers on this would be very helpful as I am trying to impliment a secure
way for people to update a website through the use of a content management
application.  Example of code is as follows

// Login form - index.php

  
  
Select an image to identify yourself as an administrator.
   
 image01
 image02
 image03
 image04
 image05
   
  
  


// Authentication checker - auth_done.php
  #check fields for valid entries in form
if ((!$u_name) || (!$p_word) || (!$image)){
 header("Location: index.php");
 exit;
}
  connects to database
require '/path/to/database/connection/script/dbcon.php';
  #selects database table containing users that are allowed to
use application
$db_table = 'users';
$sql = "SELECT * from $db_table WHERE un = \"$user\" AND pw =
password(\"$pw\")";
$result = @mysql_query($sql,$dbh) or die("Couldn't execute query");
  #loops through all records to find a match
$num = mysql_numrows($result);
 if ($num !=0) {
  #creates variables for sessions
  $p_hash = "$p_word";
  $to_hash = "$image";
  #creates md5 hash of image user selected
  $pstring = md5($to_hash);
  #creates md5 hash of password user entered
  $image_sel = md5(uniqid(microtime($p_word),1));
  #starts session for user
   session_start();
  #registers variables created (md5 of password, username, &
image) in session
   session_register('user');
   session_register('$pstring');
   session_register('$image_sel');
  #captures users ip address (logging stuff, not listed in this
code for security reasons)
  $ipaddy = $REMOTE_ADDR;
  #echoes success message to authenticated user
  $msg_success = "You have been authorized to make changes to the
website! Your IP address has been recorded and sent to the administrator:
$ipaddy";
  } else {
  #this prints if user name and password combination is not
found in database
  print "You are not authorized to use this application!";
  exit;
  }

Now on each page in the content management app I have these lines of code:
#Start the session#
session_start();
#check session variables#
if (isset($HTTP_SESSION_VARS['user']) ||
isset($HTTP_SESSION_VARS['$image_sel']) ||
isset($HTTP_SESSION_VARS['$pstring'])) {
 $main = "Some kinda message for page in question";
#connects to database#
require '/path/to/database/connection/script/dbcon.php';
 #if session variables not registered kick the user back to
login form#
 } else {
 header ("Location: index.php");
 }

Now just so you know I have changed all the variables to something other
than what I am currently using, however I have made sure that this is a
working example so everything should work as is.  Also I have tested this a
few different ways, including:  creating a page that tries to include one of
the pages I have my security checks on from another website, linking
directly to a script within the application etc.  In any event, I also have
logging setup on each and every script which I have not included here
(different topic), just in case someone does get in I can at least "try" to
find them.  Any help, pointers, tutorials, examples, etc. would be
appreciated!!!
TIA
Jas



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




[PHP] Re: Passing variable to new page and pulling the rest of info from database

2002-06-05 Thread John Taylor-Johnston

Should find enough code for displaying graphics (and sending by smtp) in
this code.
You'll find some session stuff too.

HTH
J

http://www.collegeSherbrooke.qc.ca/languesmodernes/postcard/index.html.phps

http://www.collegeSherbrooke.qc.ca/languesmodernes/postcard/display_image.phps

http://www.collegeSherbrooke.qc.ca/languesmodernes/postcard/display_postcard.phps

http://www.collegeSherbrooke.qc.ca/languesmodernes/postcard/postcard.phps
http://www.collegeSherbrooke.qc.ca/languesmodernes/postcard/send_mail.phps

http://www.collegeSherbrooke.qc.ca/languesmodernes/postcard/include_images.inc.phps



Igor Portnoy wrote:

> I am passing a variable to the new page, when user clicks on the link.
> Something like that:
> 
>


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




Re: [PHP] use of fsockopen

2002-06-05 Thread Gerard Samuel

Oh I forgot to mention that its not writing any content to the cache file...

Gerard Samuel wrote:

> Im trying to modify a script that fetches rss newfeeds.
> I was using fopen, but I decided to use fsockopen() for the timeout 
> value.
> --
>  $data = '';
> $filehandle = fsockopen ($sourceurl, 80, $errno, $errstr, 5);
> if (!$filehandle)
> {
>$data = $errstr;
> }
> else
> {
>while (!feof($filehandle))
>{
>   $data .= fgets($filehandle, 1024);
>}
> }
>
> $cacheFile = fopen( _CACHEDIR. $cacheFile, "w");
> fwrite($cacheFile, $data);
> fclose($cacheFile);
> fclose($filehandle);
> ?>
> ---
>
> Does anyone see anything wrong with this code??
> Thanks
>

-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/




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




[PHP] Re: PHP Apache Module AND command Line

2002-06-05 Thread John Taylor-Johnston

I can. I did it once in windows on a dos command line.
I believe I used print ""; instead of echo "aaa";


Steve Buehler wrote:

> Is there doc somewhere to would tell how to install PHP as a command line
> interpreter (like perl) without messing up the installation of PHP that is
> installed as a module in/for Apache?  Basically, I want to have both on the
> same server.  Or can this even be done?
>
> Thank You
> Steve

--
John Taylor-Johnston
-
  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



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




Re: [PHP] php and javascript question

2002-06-05 Thread Martin Clifford

As far as I'm aware you can't create a javascript variable and use it within PHP on 
the same page.  You can add that variable's value to a hidden form element to be 
passed to the next page, but I don't think so with the same page.

martin

>>> "kemu" <[EMAIL PROTECTED]> 06/05/02 02:30PM >>>
I have a page first he generates a var in javascript
my next question is
is it possible to use that var in php on the same page
first he does the javascript then the 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




[PHP] use of fsockopen

2002-06-05 Thread Gerard Samuel

Im trying to modify a script that fetches rss newfeeds.
I was using fopen, but I decided to use fsockopen() for the timeout value.
--

---

Does anyone see anything wrong with this code??
Thanks

-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/



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




Re: [PHP] Sessions question (-enable-trans-sid)

2002-06-05 Thread 1LT John W. Holmes

I guess PHP just can't tell that cookies are enabled. I'm sure the method
isn't full proof. Your sessions get through either way, so what's the big
deal?

---John Holmes...
- Original Message -
From: "Dan Hardiker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 05, 2002 4:50 PM
Subject: Re: [PHP] Sessions question (-enable-trans-sid)


> > Hmmm I've had a problem with this: I have --enable-trans-sid but I
> > see url appends on my browser when I *know* cookies are working.
>
>
> Personally I cant say this is a bad thing... not all browsers enable
> cookies and they can be messy and insecure at times (eg: cross domain
> issues). Placing in the URL may make it look a bit messier (the URL that
> is) but its much more compatable.
>
> Just my 2 cents.
>
>
> --
> Dan Hardiker [[EMAIL PROTECTED]]
> ADAM Software & Systems Engineer
> First Creative Ltd
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




  1   2   3   >