php-general Digest 27 Feb 2001 05:04:25 -0000 Issue 536
Topics (messages 41705 through 41794):
Re: isset()
41705 by: Johnson, Kirk
41727 by: Christian Reiniger
Help, Perl can, Php can't !
41706 by: Chris
41710 by: David Raufeisen
41748 by: Chris
41750 by: Chris
Re: Browser?
41707 by: Brian V Bonini
Re: mysql.sock
41708 by: Phillip Bow
Re: DNS Lookups Fail
41709 by: php3.developersdesk.com
41754 by: php3.developersdesk.com
Re: Making a variable -Trim output
41711 by: Clayton Dukes
Re: header() and require()
41712 by: php3.developersdesk.com
PHP trace route?
41713 by: Brandon Orther
41724 by: Julian Wood
Sessions question
41714 by: Evelio Martinez
Re: Logging out a user
41715 by: Douglas Winslow
[PHP-DB] To use paradox??..
41716 by: Rene Maldonado
41717 by: Andrew Hill
Re: Newbie: why do I get this error?
41718 by: Steve Edberg
Screen Size?
41719 by: Jason Bryner :: Focus Design Group, Inc.
41720 by: Todd Kerpelman
archive location
41721 by: Jerry Lake
41768 by: David Robley
phpAtlanta User Group
41722 by: Stephen VanDyke [OPIDO]
Weird Problem
41723 by: Steve Segarra
41773 by: David Robley
Re: Change dir mode to writable for uploading..
41725 by: Charlie Llewellin
Re: Printing long strings
41726 by: Christian Reiniger
File Upload Strangeness
41728 by: Jason Murray
2 columns same name cuz of a join
41729 by: Jason Jacobs
41735 by: Jason Murray
mod_php4
41730 by: styles
Lets nock off any numbers at the begging of a string...
41731 by: Brandon Orther
41736 by: Mark Maggelet
Walking Through Mail Headers
41732 by: Jason
41733 by: Kelly Corkill
41769 by: David Robley
Payflow Pro
41734 by: Dan Harrington
php4 as a module AND a cgi
41737 by: colin olkowski
41760 by: php3.developersdesk.com
41761 by: Kath
php quit working
41738 by: Jerry Lake
41759 by: php3.developersdesk.com
41763 by: Jerry Lake
Re: hiding .php
41739 by: MaD dUCK
Table looking odd as a result of while loop?
41740 by: James, Yz
41741 by: Johnson, Kirk
41744 by: Todd Kerpelman
41745 by: Todd Kerpelman
Re: php and apache protected directories
41742 by: Krznaric Michael
Mail() Problems in a heterogenous network
41743 by: Parker, John (Snorkel)
41746 by: Kelly Corkill
41757 by: php3.developersdesk.com
Enumerate files in a folder
41747 by: Karl J. Stubsjoen
41755 by: php3.developersdesk.com
PHP4 on UNIX connect to MS SQL Server
41749 by: Scott Fletcher
41751 by: Michael Stearne
Php4 and GD
41752 by: Dale Frohman
Forcing htaccess login again
41753 by: Chris Aitken
41758 by: Sander Pilon
41765 by: Chris Aitken
Re: Postgresql session handling
41756 by: Bolt Thrower
PHP3 and Oracle 8.1.6
41762 by: Bob Kakalec
firewalls & MySQL sessions
41764 by: Jared Howard
41779 by: Yasuo Ohgaki
Re: installation problem
41766 by: David Robley
41770 by: eschmid+sic.s.netic.de
forms & functions
41767 by: Peter Houchin
Re: PERL to PHP
41771 by: David Robley
parent functions and derived classes - the data problem
41772 by: Tyson Lloyd Thwaites
41775 by: John Donagher
try catch in php?
41774 by: Jeff
41786 by: Jason Cox
Copying Files to the Web Directory
41776 by: Miles Thompson
41785 by: Jason Cox
Re: Very strange Nutscrape behavior - PHP/JS/DHTML???
41777 by: Yasuo Ohgaki
Question about global variables
41778 by: Zenith
41788 by: Yasuo Ohgaki
Another question about using shmop!
41780 by: Zenith
calling functions
41781 by: Peter Houchin
41782 by: Jason Murray
How to wrap output of formatted text
41783 by: Clayton Dukes
41784 by: Clayton Dukes
41787 by: Stephan Ahonen
redirect pages
41789 by: Peter Houchin
41791 by: Ankur Verma
41792 by: David Robley
41793 by: David Robley
FORM module/extention for PHP4??
41790 by: Yasuo Ohgaki
image file prob
41794 by: John LYC
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
Wow, I hope you all will forgive me for one last go around on this thread :)
Technically, what does "set" mean? It is not the same as "is registered" or
"has a value", right? What is "is set"? Is it "introduced to the global
namespace"?
TIA
Kirk
>Except that it will throw a warning in PHP4 if $var is not set.
>=> isset () should be used.
man, this is like the thread that will not die.
On Monday 26 February 2001 18:07, Johnson, Kirk wrote:
> Wow, I hope you all will forgive me for one last go around on this
> thread :)
>
> Technically, what does "set" mean? It is not the same as "is
> registered" or "has a value", right? What is "is set"? Is it
> "introduced to the global namespace"?
"introduced to the *current* namespace"
--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)
"use the source, luke." (obi-wan gnuobi)
I am trying to post some info to my php script using the microsoft internet control:
strurl = http://www.myserver.com/test.asp
strdata = "lah=sd&dta=test
Inet1.Execute strurl, "POST", strdata
PHP returns HTTP_POST_VARS as being empty.
Yet, if I use PERL, I can read the posted info just fine.
PHP does work fine with normal php forms.
Why can PERL recognize my data, but PHP not, how are they handling the posted info
differently?
Is there a way I can get PHP to display the raw data that the script receives so I can
see what is happening?
Thanks for any help,
Chris
Put phpinfo() in the script to see what is going on..
On Monday, 26 February 2001, at 09:12:11 (-0800),
Chris wrote:
>
> I am trying to post some info to my php script using the microsoft internet control:
>
> strurl = http://www.myserver.com/test.asp
> strdata = "lah=sd&dta=test
> Inet1.Execute strurl, "POST", strdata
>
> PHP returns HTTP_POST_VARS as being empty.
> Yet, if I use PERL, I can read the posted info just fine.
>
> PHP does work fine with normal php forms.
>
> Why can PERL recognize my data, but PHP not, how are they handling the posted info
>differently?
>
> Is there a way I can get PHP to display the raw data that the script receives so I
>can see what is happening?
>
> Thanks for any help,
> Chris
>
--
David Raufeisen <[EMAIL PROTECTED]>
Cell: (604) 818-3596
Unfortuanetly, phpinfo is not telling me anything.
It returns all the normal info, but it still seems to act like there was no
data posted.
> Put phpinfo() in the script to see what is going on..
>
>
> On Monday, 26 February 2001, at 09:12:11 (-0800),
> Chris wrote:
>
> >
> > I am trying to post some info to my php script using the microsoft
internet control:
> >
> > strurl = http://www.myserver.com/test.asp
> > strdata = "lah=sd&dta=test
> > Inet1.Execute strurl, "POST", strdata
> >
> > PHP returns HTTP_POST_VARS as being empty.
> > Yet, if I use PERL, I can read the posted info just fine.
> >
> > PHP does work fine with normal php forms.
> >
> > Why can PERL recognize my data, but PHP not, how are they handling the
posted info differently?
> >
> > Is there a way I can get PHP to display the raw data that the script
receives so I can see what is happening?
> >
> > Thanks for any help,
> > Chris
> >
>
> --
> David Raufeisen <[EMAIL PROTECTED]>
> Cell: (604) 818-3596
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
Strange,
phpinfo is showing this:
POST /members/plurp.asp HTTP/1.1
and a content length of 16, which is exactly right for lah=sd&dta=test
but I can't seem to get to the actual data.
Is there a way to see the acutal content data, like you can with perl:
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> Put phpinfo() in the script to see what is going on..
>
>
> On Monday, 26 February 2001, at 09:12:11 (-0800),
> Chris wrote:
>
> >
> > I am trying to post some info to my php script using the microsoft
internet control:
> >
> > strurl = http://www.myserver.com/test.asp
> > strdata = "lah=sd&dta=test
> > Inet1.Execute strurl, "POST", strdata
> >
> > PHP returns HTTP_POST_VARS as being empty.
> > Yet, if I use PERL, I can read the posted info just fine.
> >
> > PHP does work fine with normal php forms.
> >
> > Why can PERL recognize my data, but PHP not, how are they handling the
posted info differently?
> >
> > Is there a way I can get PHP to display the raw data that the script
receives so I can see what is happening?
> >
> > Thanks for any help,
> > Chris
> >
>
> --
> David Raufeisen <[EMAIL PROTECTED]>
> Cell: (604) 818-3596
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
HTTP_USER_AGENT
http://php.net/manual/en/language.variables.predefined.php
-Brian
> -----Original Message-----
> From: Paulson, Joseph V. "Jay" [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 26, 2001 11:16 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Browser?
>
>
> Is there a way to tell what browser is being used by the client in php?
>
> Thanks,
> Jay
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
The problem I had with this in the past is that I didn't have permission to
write to the dir mysql.sock was supposed to be in so when Mysql tried to
start it would fail.
--
phill
Addressed to: "Scott Rothgaber" <[EMAIL PROTECTED]>
[EMAIL PROTECTED]
** Reply to note from "Scott Rothgaber" <[EMAIL PROTECTED]> Mon, 26 Feb 2001 09:45:42
-0500
>
> PHP 4.0.4 pl1, Apache 1.3.17, BSD/OS 4.1 pl37
>
> Good Morning!
>
> Please forgive me if this has been covered ad nauseum, but I
> have searched high and low for an answer with no luck.
>
> After building PHP as a module, following the online
> instructions, Apache complained that it could not resolve
> hostnames. I got around this by using IP's in httpd.conf and
> making wusage do the lookups.
>
> Is there a fix for this or is it an unpleasant side effect that
> we must accept and deal with?
The official word on the Apache config files is that you _should_ use IP
addresses rather than host names.
That said, I don't do it. I find the host names more understandable
when I am working on the file. The problem is you MUST make sure DNS
or /etc/hosts name resolution is available BEFORE you start the web
server.
The first thing to try is get a list of the host names that fail and do
a nslookup to make sure you can resolve them. You may have bigger
problems with DNS.
If the problem happens only when you boot the computer, make sure you
start networking ans named long before you try to start the web server.
A way to side step the entire DNS issue is to list each of your web IP
addresses in /etc/hosts, and make sure that /etc/resolv.conf looks in
that file before it goes out to DNS. Even if you do this you need to
find out why the host names can not be resolved. If the master DNS
server is setup wrong, no one will be able to see the site.
Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com
Addressed to: "Scott Rothgaber" <[EMAIL PROTECTED]>
[EMAIL PROTECTED]
** Reply to note from "Scott Rothgaber" <[EMAIL PROTECTED]> Mon, 26 Feb 2001 12:46:08
-0500
>
> On 26 Feb 2001, at 10:21, [EMAIL PROTECTED] wrote:
>
> > The first thing to try is get a list of the host names that
> > fail and do a nslookup to make sure you can resolve them.
>
> The way I see it, this is strictly a PHP issue. *No* lookups are
> succeeding, not even in the log file. If I switch back to my
> Apache binary built without PHP, everything works.
>
Take a look thru your Apache config files for HostNameLookups, that is
probably what it is. You can set it to ON to get this behavior back.
You might want to think about it a little before you do. Having this on
means that EVERY SINGLE page and image hit requires a DNS lookup BEFORE
the page/image is sent. If there is a problem with reverse DNS on the
modem your visitor is connected to (not uncommon) they get to wait up to
30 seconds for a DNS timeout before the page will load. Not good.
Consider how often you really care about what the host name is. Is it
worth the extra delay for the DNS lookup on EVERY page sent.
You mentioned having to have your log analyzer do the DNS lookups when
it processes the logs. I say better pay for it then when it is only you
waiting for results than making your visitors pay on every page and
image they download.
Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com
Dan...
You are the man, thanks! :-)
----- Original Message -----
From: "Dan Olsen" <[EMAIL PROTECTED]>
To: "Clayton Dukes" <[EMAIL PROTECTED]>
Sent: Monday, February 26, 2001 12:30 PM
Subject: RE: [PHP] Making a variable -Trim output
>
> clayton-
>
> the only problems were syntactic.
>
> there was an extra $ on the filename for file.txt, and there were no $'s
on
> the loop variable i (happens to me all the time, switching from perl to
> java(script) to php depending on what day it is).
>
> this code compiles and runs fine.
>
> <?
>
> $arrayoflines = file('file.txt');
> $arraysize = sizeof($arrayoflines);
> $limit = $arraysize - 2;
> $output = "";
>
> for ( $i=0; $i<$arraysize; $i++) {
> if ( ($i>12) && ($i<$limit) ) {
> $output .= $arrayoflines[$i];
> }
> }
>
> print $output;
>
> ?>
>
> enjoy,
> DanO
>
>
>
> -----Original Message-----
> From: Clayton Dukes [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 26, 2001 9:08 AM
> To: Dan Olsen
> Subject: Re: [PHP] Making a variable -Trim output
>
>
> Thanks so much for your help Dan,
>
> here's what I get when I try it:
>
> Parse error: parse error, expecting `';'' in - on line 7
>
> line 7 is:
> for (i=0; i<\$arraysize; i++) {
>
> any ideas?
>
>
> ----- Original Message -----
> From: "Dan Olsen" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, February 26, 2001 12:02 PM
> Subject: RE: [PHP] Making a variable -Trim output
>
>
> >
> > yes but you might want to use a for() loop instead since you know what
you
> > want.
> >
> > $arrayoflines = file("$file.txt");
> > $arraysize = sizeof($arrayoflines);
> > $limit = $arraysize - 2;
> >
> > for (i=0; i<$arraysize; i++) {
> > if ( (i>12) && (i<$limit) ) {
> > $output .= $arrayoflines[i];
> > }
> > }
> >
> > you'll have to debug, but it should work.
> >
> > DanO
> >
> >
Addressed to: "Jason Jacobs" <[EMAIL PROTECTED]>
[EMAIL PROTECTED]
** Reply to note from "Jason Jacobs" <[EMAIL PROTECTED]> Mon, 26 Feb 2001 11:28:37
-0500
>
> Hi. In some of my files, I have a require statement to get some global
> stuff accessable. I also have some header() redirects. They don't work
> (they worked before I added the requires). I moved the require under one of
> the header()s and that one works now, but I can't move it under the other
> one because stuff has to happen before the redirect and it needs the
> required stuff. So my question is do require statements produce output that
> I can't see (which would make the redirects not work)? The files I'm
> requiring don't have any output, which is why I'm confused. Thanks.
The most common cause of this problem is a blank line, or evan a space
in the wrong place in one of the required files. The following examples
will cause the problem:
--------------------------------------
<?
some code here
?>
--------------------------------------
--------------------------------------
<?
some code here
?>
--------------------------------------
--------------------------------------
<?
some code here
?>
--------------------------------------
--------------------------------------
<?
some code here
?> NOTE: even a single space after the > will cause a problem.
--------------------------------------
--------------------------------------
<?
some code
?>
<?
some more code
?>
--------------------------------------
What they all have in common, is ANYTHING outside of <? and ?> in the
file.
Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com
Hello,
I am looking for a php trace route that I can have get the IP of the person
browsing the site and do a trace route from the server. Then I want to
reverse the results so It looks like they are doing a trace route on the
server rather than the server doing a trace route on them.
Thank you,
--------------------------------------------
Brandon Orther
WebIntellects Design/Development Manager
[EMAIL PROTECTED]
800-994-6364
www.webintellects.com
--------------------------------------------
Use passthru to run traceroute on the ip of interest, then output the
results of that command, line by line, starting with the last line.
J
on 2/26/01 9:48 AM, Brandon Orther at [EMAIL PROTECTED] wrote:
>
> Hello,
>
> I am looking for a php trace route that I can have get the IP of the person
> browsing the site and do a trace route from the server. Then I want to
> reverse the results so It looks like they are doing a trace route on the
> server rather than the server doing a trace route on them.
>
> Thank you,
>
> --------------------------------------------
> Brandon Orther
> WebIntellects Design/Development Manager
> [EMAIL PROTECTED]
> 800-994-6364
> www.webintellects.com
> --------------------------------------------
>
--
Julian Wood
Multimedia Developer
University of Calgary
How can I have an new session id without closing the browser?
session.inc contains basically the postgresql session functions (user
handler) in http://www.php.net/manual/en/ref.session.php
I have change pg_pconnect for pg_connect and I have added
pg_destroy_session.
1. There is a login/password page
2. Afterwards all pages that access the DB have the following include
file:
<?
include('sesion.inc');
if (!isset($g_login)) { // flag that indicates that validation was
succesful
echo "<script language='javascript'>
<!--
var lugar = window.location.href;
if ( lugar != \"http://www.my_web.com/login.php\" ) {
window.location.assign('http://www.my_web.com/login.php');
}
//-->
</script>";
}
if (isset($g_hora)) {
$timeout = 3600 ;
$lapso = time() - $g_hora;
if ( $lapso >= $timeout ) {
session_destroy(); // delete session from database
session_unset(); // suppose to delete session
variable from memory
$sesion = md5(uniqid("prueba"));
session_id($sesion); // new session
echo "<script language='javascript'>
<!--
var lugar = window.location.href;
var lugars;
window.alert('La sesión ha expirado');
var lugar = window.location.href;
if ( lugar != \"http://www.my_web.com/login.php\" ) {
window.location.assign('http://www.my_web.com/login.php');
}
//-->
</script>";
}
}
?>
3. How am I supposed to create a new session identificator ?
session_unset is suppose to "free" (delete?) all session variables
currently registered, isn't it?
After timeout, it goes to login page but I have still the old
session id instead of the new one.
What am I missing?
TIA
--
Evelio Martínez
On Mon, 26 Feb 2001, Chris Aitken wrote:
>
> Okay, I got a bit of a curley one that I havent been able to solve by
> looking at the archives and in the manual. Its kind of a PHP/Apache
> question.
>
> I have a system where a user logs in through .htaccess, it queries my
> mysql database, sets a cookie which logs their username and access
> level number.
>
> What I want to be able to do it this.......... Give the option to "Log
> Out" which will clear the cookie, and also make htaccess re-request a
> login. Once it logs in again, the current scripts do their thang and
> log the new user in.
>
> Is there any direction anyone can point me to start looking cause I
> have a feeling im off the track on what im searching for in TFM and in
> TFA.
I've got a setup similar to this, but it doesn't use htaccess for
authentication. If you send a 401 back at the client, it will void its
cached username/password. You could do this at the top of your code:
header("WWW-Authenticate: Basic realm=\"stuff\"");
header("HTTP/1.0 401 Unauthorized");
exit;
..if 1) the login cookie is not present, and 2) the user is not currently
logging in (trying to get the cookie) on that hit.
If you want to do it quietly, just unset the cookie and bounce them to
somewhere outside of the realm of your htaccess protection. Next time
they enter, the cookie will not exist, so they'll be forced to re-login
anyway.
--
Douglas R. Winslow III
MetroNet Internet Services, Inc.
Hi All,
I have been using PHP for the last 5 months, and it's great, Unitl now,
I have been using connections to informix and everything is OK.
Now I need to connect from a linux-apache server to a paradox db in
other machine (Windows NT), so the question is, What do I need to make
the connection, for what I have readed in the mailing list archives I
need an ODBC Driver for paradox, where can I get it, and where I heve
to put it, and what else do I need to do???
Thanks
Rene
Rene,
You can use OpenLink's Multi-Tier driver. We don't directly support
Paradox, but there is a MS driver on most NT systems that we can work with,
in a 'piggyback' method.
Use the iODBC-PHP HOWTO at http://www.iodbc.org/odbc-phpHOWTO.html
Install the OpenLink Multi-Tier drivers for linux client and Windows server,
from http://www.openlinksw.com
Then:
1. create DSN on the Win box using the MS Driver for Paradox, call it 'foo'
for this example
2. create a DSN on the Linux box, using OpenLink's driver, and:
- hostname is the Win box
- ServerType is Odbc
- Database is foo
- other parameters as needed
If you run into problems, free support is available at
http://www.openlinksw.com/support/suppindx.htm
Best regards,
Andrew
--------------------------------------
Andrew Hill - OpenLink Software
Director Technology Evangelism
eBusiness Infrastructure Technology
http://www.openlinksw.com
> -----Original Message-----
> From: Rene Maldonado [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 26, 2001 1:18 PM
> To: Lista PHP
> Subject: [PHP] [PHP-DB] To use paradox??..
>
>
> Hi All,
>
> I have been using PHP for the last 5 months, and it's great, Unitl now,
> I have been using connections to informix and everything is OK.
>
> Now I need to connect from a linux-apache server to a paradox db in
> other machine (Windows NT), so the question is, What do I need to make
> the connection, for what I have readed in the mailing list archives I
> need an ODBC Driver for paradox, where can I get it, and where I heve
> to put it, and what else do I need to do???
>
> Thanks
>
> Rene
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
At 3:47 PM +0530 2/26/01, Harshdeep S Jawanda wrote:
>Hello everybody,
>
>I am a newbie, so please help me out with my rather basic question.
>
>Please take a look at the following code snippet:
>
> class HTMLTable extends HTMLElement {
> var $attributes;
>
> function HTMLTable() {
> $attributes[] = array("border", "0");
> $attributes[] = array("cellpadding", "0");
> // and some other things
> }
>
> function emit() {
> // I get an error on this line
> $arrLength = count($this->attributes[1]);
> }
> }
>
>On the line indicated above, I get the error: "Warning: Undefined
>property: attributes in html_base_classes.inc on line <line-number>"
>
>Can anybody give me a clue as to why this is happening?
In your HTMLTable() function, use
$this->attributes[] = array("border", "0");
$this->attributes[] = array("cellpadding", "0");
otherwise, PHP thinks $attributes is a variable local to that
function, rather that a class variable.
-steve
>--
>Regards,
>Harshdeep Singh Jawanda.
>
--
+--- "They've got a cherry pie there, that'll kill ya" ------------------+
| Steve Edberg University of California, Davis |
| [EMAIL PROTECTED] Computer Consultant |
| http://aesric.ucdavis.edu/ http://pgfsun.ucdavis.edu/ |
+-------------------------------------- FBI Special Agent Dale Cooper ---+
How do you determine a user's screen size (resolution)? Isn't there a
variable/function for this?
--
Focus Design Group, Inc.
http://www.focusdesigngroup.com
> How do you determine a user's screen size (resolution)? Isn't there a
> variable/function for this?
I doubt you could do this in PHP, since your browser doesn't normally
include screen size information in the headers it sends across to web
servers.
However, JavaScript can do this -- there's a screen object, with properties
called screen.width and screen.height that specify (surprisingly enough) the
width and height of the user's screen.
You could create a form with some hidden inputs, and have a JavaScript body
onLoad() event that would set the values of these hidden inputs to your
user's screen size. When PHP receives this form. it could process the
information from there.
Hope this helps...
--Todd
> -----Original Message-----
> From: Jason Bryner :: Focus Design Group, Inc.
> [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, February 25, 2001 10:52 PM
> To: PHP
> Subject: [PHP] Screen Size?
>
>
> How do you determine a user's screen size (resolution)? Isn't there a
> variable/function for this?
>
>
> --
> Focus Design Group, Inc.
> http://www.focusdesigngroup.com
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
>
What is the newsgroup archive location ?
marc.themaesgroup.something ?
Jerry Lake - [EMAIL PROTECTED]
Web Designer
Europa Communications - http://www.europa.com
Pacifier Online - http://www.pacifier.com
On Tue, 27 Feb 2001 05:33, Jerry Lake wrote:
> What is the newsgroup archive location ?
> marc.themaesgroup.something ?
>
> Jerry Lake - [EMAIL PROTECTED]
> Web Designer
> Europa Communications - http://www.europa.com
> Pacifier Online - http://www.pacifier.com
nearly - marc.theaimsgroup.com or check /support.php at your local PHP
mirror for direct links to all the mail list archives.
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA
Hello everyone,
I know this is a bit of an deviation from the normal type of email this list
gets, so I'll keep it short. If you are reading this, then you have probably
judged by the title that this has to do with a user group, in Atlanta. If
you live in Atlanta, GA (or close enough that you tell people you live here)
then you may want to come join us and help us form a user group. We are
relatively new but we are already getting things rolling as far as meetings,
newsletters and the such.
If this interests you, come on over to http://www.phpatlanta.org/ for more
info. If you don't live in/around Atlanta please forward this message to
someone who does, or just delete it.
Thanks for your time.
Stephen VanDyke
[EMAIL PROTECTED]
Hi everyone,
First, let me explain I am a very knowledgable php developer. I'm not
someone trying to write their first script. I have been working on a
very large and complex problem for some time now when it suddenly
stopped working. I did not change anything in any configurations or
edit any code that would have affected how my database functionality
class would function. But, all of my connections started to bomb out.
Follows are the entire contents of a file simp.php (minus the line numbers):
1 <?
2
3 $db = mysql_connect("localhost", "web", "pw") || print "error
connecting ".mysql_error()." ".mysql_errno();
4 mysql_select_db("surveys");
5
6 $result = mysql_query("select * from attract") || print "error
querying ".mysql_error()." ".mysql_errno();
7
8 $i = 0;
9 while ($row = mysql_fetch_array(mysql_query("select * from
attract"))){ // && ($i++ < 5)){
10 echo $row[0]." ".$row[1]."<br>";
11 }
12 ?>
Please note that the user web@localhost identified by pw has permissions
to select from the table attract.
Here is what I have identified so far:
A - If I use $result in mysql_fetch_array() line 9, I get the error:
Warning: Supplied argument is not a valid MySQL result resource in
simp.php3 on line 9
But if I use the statement mysql_query("select * from attract")
in its
place, the loop (although infinite) will produce expected results, ie
print out the first and second columns of the first row of the table
infinitely. So basically, I would conclude the life of the variable
result is terminiating before I can use it. Why, I don't have a clue.
B - Being tired of an infinite loop in my investigation, I added line 8
and I placed the statement && ($i++ < 5) inside the while loop
condition. Now, only the <br> and spaces from line 10 will print, not
the actual values of the $row array. The output is <br> <br> <br> <br>
<br>, with no values from the table attract.
This is where I stand now, completely flabberghasted and nearly insane.
Can anyone shed any light on this before I have to commit to bringing
down the webserver while I reinstall php4. (oh, btw I am running
Apache/1.3.14 (Unix) PHP/4.0.4pl1 on Red Hat 6.2 (I hate redhat, but the
bossman says its better supported than slakware. bah.))
Thank you all for your help.
steve
On Tue, 27 Feb 2001 05:53, Steve Segarra wrote:
> Hi everyone,
> First, let me explain I am a very knowledgable php developer. I'm not
> someone trying to write their first script. I have been working on a
> very large and complex problem for some time now when it suddenly
> stopped working. I did not change anything in any configurations or
> edit any code that would have affected how my database functionality
> class would function. But, all of my connections started to bomb out.
>
> Follows are the entire contents of a file simp.php (minus the line
> numbers):
>
> 1 <?
> 2
> 3 $db = mysql_connect("localhost", "web", "pw") || print "error
> connecting ".mysql_error()." ".mysql_errno();
> 4 mysql_select_db("surveys");
> 5
> 6 $result = mysql_query("select * from attract") || print "error
> querying ".mysql_error()." ".mysql_errno();
> 7
> 8 $i = 0;
> 9 while ($row = mysql_fetch_array(mysql_query("select * from
> attract"))){ // && ($i++ < 5)){
> 10 echo $row[0]." ".$row[1]."<br>";
> 11 }
> 12 ?>
>
>
> Please note that the user web@localhost identified by pw has
> permissions to select from the table attract.
>
> Here is what I have identified so far:
>
> A - If I use $result in mysql_fetch_array() line 9, I get the error:
> Warning: Supplied argument is not a valid MySQL result resource
> in simp.php3 on line 9
>
> But if I use the statement mysql_query("select * from attract")
> in its
> place, the loop (although infinite) will produce expected results, ie
> print out the first and second columns of the first row of the table
> infinitely. So basically, I would conclude the life of the variable
> result is terminiating before I can use it. Why, I don't have a clue.
>
> B - Being tired of an infinite loop in my investigation, I added line 8
> and I placed the statement && ($i++ < 5) inside the while loop
> condition. Now, only the <br> and spaces from line 10 will print, not
> the actual values of the $row array. The output is <br> <br> <br> <br>
> <br>, with no values from the table attract.
>
> This is where I stand now, completely flabberghasted and nearly insane.
> Can anyone shed any light on this before I have to commit to bringing
> down the webserver while I reinstall php4. (oh, btw I am running
> Apache/1.3.14 (Unix) PHP/4.0.4pl1 on Red Hat 6.2 (I hate redhat, but
> the bossman says its better supported than slakware. bah.))
>
> Thank you all for your help.
> steve
Is it possible that the || construct doesn't work in the way you are
using it and thus you aren't seeing mysql_error? The most common examples
I have seen use the actual string 'or'. Try with a query that you _know_
will trip an error.
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA
Another neat trick is to use ftp to upload, avoiding the need to change
permssions.
----- Original Message -----
From: "Dhaval Desai" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 24, 2001 12:25 AM
Subject: [PHP] Change dir mode to writable for uploading..
> Hi!
>
> I have problem uploading the file to a directory...
> It says permission denied. THe problem is taht ther
> directory is on the web.
> I connect using WS_ftp.
> THe directory is set to:
>
> drwxr-xr-x
>
> How do I make it writable..?
>
>
> I am using form to upload the files there..
>
>
> Is there any way I can make the directory writable..?
>
> Thank You!
>
> Dhaval Desai
>
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
On Monday 26 February 2001 14:38, PHPBeginner.com wrote:
> > Yes, you could use stripslashes($string) on it's output, in this way
it
> will be no different as it was inputted.
> -----Original Message-----
> From: Clayton Dukes [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 26, 2001 9:57 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Printing long strings
>
>
> How can I get php to print a long string and ignore any of the
> characters in the string?
>
> ie:
> $string = "so<me'strin^g";
> print $string;
Hmm, perhaps he looks for a way to let the *browser* preserve the string
(and not e.g. parse the "<" as start of a tag).
htmlentities () ist the function of choice then...
--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)
"use the source, luke." (obi-wan gnuobi)
Hi there,
We are currently using 3.0.16 (I know :().
I have a form action pointing to $PHP_SELF. After submitting the form
information, $userfile contains what I expect in $userfile_name. I have
had all sorts of troubles with file uploads lately, but eventually they
start working. Not this time.
Can someone give me a clue, please?
Thanks,
Jason
--
Jason Murray
Developer
http://www.jwebmedia.com/
1 877 525 jWEB
Hi again. :) Does anyone know how to reference a value in an array or
object if the returned table has 2 fields of the same name. IE, I am
querying 2 tables and returning an id value from each. On both tables, the
id fieldname is "id". I know I can access the vals like $array[0] and
$array[1], but is there a way I can fetch_object do do that? Can I
reference them like $object->table1.id and $object->table2.id? I would
assume not since it just makes a new table when it returns the data. Thanks
for the help, and I hope my question is clear. :)
Jason
Jason Jacobs wrote:
>
> Hi again. :) Does anyone know how to reference a value in an array or
> object if the returned table has 2 fields of the same name. IE, I am
> querying 2 tables and returning an id value from each. On both tables, the
> id fieldname is "id". I know I can access the vals like $array[0] and
> $array[1], but is there a way I can fetch_object do do that? Can I
> reference them like $object->table1.id and $object->table2.id? I would
> assume not since it just makes a new table when it returns the data. Thanks
> for the help, and I hope my question is clear. :)
>
> Jason
>
Something like
select tbl1.id as tbl1_id, tbl2.id as tbl2_id ....
$ob->tbl1_id;
should work... o fthe top of my head.
Jason
--
Jason Murray
Developer
http://www.jwebmedia.com/
1 877 525 jWEB
Greetings -
FYI: I have WinNT + Apache + PHP
Does anyone know the difference between the cgi version of php4 (php.exe) as
opposed to setting up php4 as a server's module?
I have both versions installed its just that I do not know what is the
difference when it comes to functionality. Does the cgi version execute
faster then the other...things like this!
A Web site would be great an explanation would be ideal.
Thanx in advance
Hello,
Is there a way to remove the first numbers of a string? Here is an example:
$string1 = "12 this is number twelve";
when done: " this is number twelve";
$sting1 = "123 this is number one twenty three"
when done: " this is number one twenty three";
Thank you,
--------------------------------------------
Brandon Orther
WebIntellects Design/Development Manager
[EMAIL PROTECTED]
800-994-6364
www.webintellects.com
--------------------------------------------
On Mon, 26 Feb 2001 11:57:04 -0800, Brandon Orther
([EMAIL PROTECTED]) wrote:
>Hello,
>
>Is there a way to remove the first numbers of a string? Here is an
>example:
>
>$string1 = "12 this is number twelve";
>when done: " this is number twelve";
>
>$sting1 = "123 this is number one twenty three"
>when done: " this is number one twenty three";
$string1=ereg_replace("^[0-9]+","",$string1);
Hi,
I need a way to walk through mail headers and search for a specific string
in the subject. If the message contains the string, it will be forwarded to
a different account, otherwise it will trigger an autoresponse with a
certain message to the sender. Does anyone have any infomation on doing
this, or can point me where to start. I think the thing I'm caught up on is
how I walk through the mail headers in the mail file (We are on FreeBSD).
Thanks.
Jason
On the surface this sounds like a job for procmail (www.procmail.org).
On Mon, 26 Feb 2001, Jason wrote:
> Date: Mon, 26 Feb 2001 11:58:53 -0800
> From: Jason <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: [PHP] Walking Through Mail Headers
>
> Hi,
>
> I need a way to walk through mail headers and search for a specific string
> in the subject. If the message contains the string, it will be forwarded to
> a different account, otherwise it will trigger an autoresponse with a
> certain message to the sender. Does anyone have any infomation on doing
> this, or can point me where to start. I think the thing I'm caught up on is
> how I walk through the mail headers in the mail file (We are on FreeBSD).
> Thanks.
>
> Jason
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
Kelly
303-444-1671
Boulder, Colorado
On Tue, 27 Feb 2001 06:28, Jason wrote:
> Hi,
>
> I need a way to walk through mail headers and search for a specific
> string in the subject. If the message contains the string, it will be
> forwarded to a different account, otherwise it will trigger an
> autoresponse with a certain message to the sender. Does anyone have any
> infomation on doing this, or can point me where to start. I think the
> thing I'm caught up on is how I walk through the mail headers in the
> mail file (We are on FreeBSD). Thanks.
>
> Jason
Procmail should be able to do this for you?
But how are you actually dealing with the incoming mails? Are they being
sent to the php script as they arrive from an alias or procmail, or are
you attempting to parse the contents of the mail spool file for a
particular user?
If it's the former, all you need to do is parse each line until you find
the one beginning with Subject and do the necessary.
If the latter, you'll need to check the relevant RFCs to determine how
messages are separated in the spool, and how the body of the message is
separated from the headers - I'm fairly sure that's two newlines. RFC1822
from memory?
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA
Hello,
I am attempting to install php4.04 and apache1.3.14
php configure commands:
./configure --with-apache=../apachessl-1.3.14 \
--with-jpeg-dir=/usr/local/lib --with-pgsql --with-gd \
--with-ttf=/usr/local/lib --with-t1lib=/usr/local/lib \
--enable-gd-imgstrttf --with-pfpro=/usr/local/lib
apache configure commands:
./configure \
"--with-layout=Apache" \
"--target=https" \
"--prefix=/usr/local/apache-ssl" \
"--activate-module=src/modules/php4/libphp4.a" \
php4.04 compiles without complaint, yet when I compile apache, it dies on
this error:
=====
modules/php4/libphp4.a(pfpro.o): In function `php_info_pfpro':
/usr/local/src/php-4.0.4-ssl/ext/pfpro/pfpro.c:113: undefined reference to
`PNVersion'
modules/php4/libphp4.a(pfpro.o): In function `php_if_pfpro_version':
/usr/local/src/php-4.0.4-ssl/ext/pfpro/pfpro.c:129: undefined reference to
`PNVersion'
Anyone know what is going on here? I have copied pfpro.h to
/usr/local/include
and libpfpro.so /usr/local/lib and I ran ldconfig.
Thanks
Dan
hi all,
thanks for the replies. many of you asked why I want to use php4 as a cgi.
basically it boils down to this, using PHP as CGI you can run PHP scripts
via cron tab, which eliminates the need for shell scripting (yeah baby).
i did some investigation a few months ago (when I was on a virtual host) and
found that cron could not call PHP scripts due to the fact that it's Apache
calling the cron process not root (or another user).
a work around seems to be sending everything to Lynx (or the equivalent) but
at the time my hosting provider would not allow me to do this.
anyone have a faster, more secure way to call PHP via cron?
p.s. in reply to my earlier post i got differing reports as to the security
concerns of running PHP as a cgi. one person replied that cgi shoudl be
avoided at all costs while another said that he thought it was the way to
go.
thoughts?
p.p.s thanks for the replies to my questions, it's extremely helpful.
colin o.
colin olkowski - [EMAIL PROTECTED]
cell 917.549.8395
land 212.414.4481
Addressed to: <[EMAIL PROTECTED]>
[EMAIL PROTECTED]
** Reply to note from <[EMAIL PROTECTED]> Mon, 26 Feb 2001 15:58:19 -0500
>
> hi all,
>
> thanks for the replies. many of you asked why I want to use php4 as a cgi.
>
> basically it boils down to this, using PHP as CGI you can run PHP
> scripts via cron tab, which eliminates the need for shell scripting
> (yeah baby).
In that case, compile php without using with-apache or with-apxs to
create a php binary. Place it in /usr/local/bin or someplace in your
path.
There is a way to run php from cron something like:
/usr/local/bin/php -q script-name.php
The way I do it is a little different. In cron I specify:
/path/to/php/script.php
In the top of script.php, I add a special first line:
--------------------------------
#!/usr/local/bin/php -q
<?
phpinfo();
?>
--------------------------------
The important thing to remember here, it has NOTHING to do with Apache
or CGI, you are using standard shell operations to allow php to execute
scripts the same way most perl scripts, and a lot of other scripts are
run.
Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com
I'd like to see this also.
- Kath
----- Original Message -----
From: "colin olkowski" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 26, 2001 3:58 PM
Subject: [PHP] php4 as a module AND a cgi
> hi all,
>
> thanks for the replies. many of you asked why I want to use php4 as a
cgi.
>
> basically it boils down to this, using PHP as CGI you can run PHP scripts
> via cron tab, which eliminates the need for shell scripting (yeah baby).
>
> i did some investigation a few months ago (when I was on a virtual host)
and
> found that cron could not call PHP scripts due to the fact that it's
Apache
> calling the cron process not root (or another user).
>
> a work around seems to be sending everything to Lynx (or the equivalent)
but
> at the time my hosting provider would not allow me to do this.
>
> anyone have a faster, more secure way to call PHP via cron?
>
> p.s. in reply to my earlier post i got differing reports as to the
security
> concerns of running PHP as a cgi. one person replied that cgi shoudl be
> avoided at all costs while another said that he thought it was the way to
> go.
>
> thoughts?
>
> p.p.s thanks for the replies to my questions, it's extremely helpful.
>
> colin o.
>
> colin olkowski - [EMAIL PROTECTED]
> cell 917.549.8395
> land 212.414.4481
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
I just installed php as an apache DSO module
on the first try of a phpinfo(); it worked
just as it should, then I loaded phpmyadmin
and now when I make a request for a php file
it tries to download, my httpd.conf file seems
to be in order...any ideas?
Jerry Lake - [EMAIL PROTECTED]
Web Designer
Europa Communications - http://www.europa.com
Pacifier Online - http://www.pacifier.com
Addressed to: "Jerry Lake" <[EMAIL PROTECTED]>
[EMAIL PROTECTED]
** Reply to note from "Jerry Lake" <[EMAIL PROTECTED]> Mon, 26 Feb 2001 12:58:35 -0800
>
> I just installed php as an apache DSO module
> on the first try of a phpinfo(); it worked
> just as it should, then I loaded phpmyadmin
> and now when I make a request for a php file
> it tries to download, my httpd.conf file seems
> to be in order...any ideas?
What file extension did you use on your phpinfo() attempt?
What file extension does phpMyAdmin use?
Are they different> You may need to add php3 to the AddType
application/x-httpd-php declaration somewhere in your Apache
configuration.
Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com
I used a .php extension which phpmyadmin uses also
it is rather odd, it worked until I loaded phpmyadmin
(i unloaded it, but nothing fixed)
Jerry Lake - [EMAIL PROTECTED]
Web Designer
Europa Communications - http://www.europa.com
Pacifier Online - http://www.pacifier.com
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 26, 2001 3:32 PM
To: Jerry Lake; [EMAIL PROTECTED]
Subject: Re: [PHP] php quit working
Addressed to: "Jerry Lake" <[EMAIL PROTECTED]>
[EMAIL PROTECTED]
** Reply to note from "Jerry Lake" <[EMAIL PROTECTED]> Mon, 26 Feb 2001
12:58:35 -0800
>
> I just installed php as an apache DSO module
> on the first try of a phpinfo(); it worked
> just as it should, then I loaded phpmyadmin
> and now when I make a request for a php file
> it tries to download, my httpd.conf file seems
> to be in order...any ideas?
What file extension did you use on your phpinfo() attempt?
What file extension does phpMyAdmin use?
Are they different> You may need to add php3 to the AddType
application/x-httpd-php declaration somewhere in your Apache
configuration.
Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
also sprach Fredrik Arild Takle (on Mon, 26 Feb 2001 10:34:11PM +0100):
> did you get answers to your problem?
not from the list. but i found two solutions, both of which require
modification of httpd.conf, and both of which are ergo
apache-specific:
http://www.zend.com/tips/tips.php?id=145&single=1
http://www.zend.com/tips/tips.php?id=147&single=1
i will be using the first one because it provides greater flexibility.
martin
[greetings from the heart of the sun]# echo madduck@!#:1:s@\@@@.net
--
windows nt crashed.
i am the blue screen of death.
no one hears your screams.
Hi all, This is probably something dumb I'm missing, but I am using the
following code:
echo "<table border=\"0\">\n";
echo "<tr>\n";
$photocount = 0;
while($row = mysql_fetch_array($result)) {
$smallpic = $row['smallpic'];
if (($photocount % 3) == 2) {
echo "</tr>\n<tr>\n";
}
echo "<td>$smallpic</td>\n";
$photocount++;
}
echo "</tr>\n";
echo "</table>";
and it's outputting a table like this:
<table border="0">
<tr>
<td>sm982438092.gif</td>
<td>sm982437452.gif</td>
</tr>
<tr>
<td>sm982439016.gif</td>
<td>sm982529915.gif</td>
<td>sm983222652.gif</td>
</tr>
<tr>
<td>sm983222686.gif</td>
<td>sm983222868.gif</td>
<td>sm983222919.gif</td>
</tr>
</table>
(There are currently 8 pics that have been uploaded). As you can see that
the first row has returned just two columns. I'd like the photos to be
displayed in rows of three, and if there are only 8 pictures (or any othe
number that's not directly divisible by three) to be displayed on the last
row. At the moment it's doing it "upside down." Any ideas?
And I know, I'm going to have to force an extra cell for it to display
correctly....
Thanks as always,
James.
Is it because 1 % 3 is 0 with a remainder of 2? Looks like the code is doing
just what it is written to do. The "if" evaluates to true on the second
picture.
Kirk
-----Original Message-----
From: James, Yz [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 26, 2001 2:55 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Table looking odd as a result of while loop?
Hi all, This is probably something dumb I'm missing, but I am using the
following code:
echo "<table border=\"0\">\n";
echo "<tr>\n";
$photocount = 0;
while($row = mysql_fetch_array($result)) {
$smallpic = $row['smallpic'];
if (($photocount % 3) == 2) {
echo "</tr>\n<tr>\n";
}
(There are currently 8 pics that have been uploaded). As you can see that
the first row has returned just two columns. I'd like the photos to be
displayed in rows of three, and if there are only 8 pictures (or any othe
number that's not directly divisible by three) to be displayed on the last
row. At the moment it's doing it "upside down." Any ideas?
Hmmm... I'm pretty sure 1%3 is equal to 1.
I'm suspecting you might be incrementing $photocount too early -- that is,
before the if (($photocount % 3) == 2) statement. That would certainly
explain the weirdness you're seeing.
--Todd
> -----Original Message-----
> From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 26, 2001 1:57 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP] Table looking odd as a result of while loop?
>
>
> Is it because 1 % 3 is 0 with a remainder of 2? Looks like
> the code is doing
> just what it is written to do. The "if" evaluates to true on
> the second
> picture.
>
> Kirk
>
> -----Original Message-----
> From: James, Yz [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 26, 2001 2:55 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Table looking odd as a result of while loop?
>
>
> Hi all, This is probably something dumb I'm missing, but I
> am using the
> following code:
>
> echo "<table border=\"0\">\n";
>
> echo "<tr>\n";
> $photocount = 0;
>
> while($row = mysql_fetch_array($result)) {
> $smallpic = $row['smallpic'];
>
> if (($photocount % 3) == 2) {
> echo "</tr>\n<tr>\n";
> }
>
> (There are currently 8 pics that have been uploaded). As you
> can see that
> the first row has returned just two columns. I'd like the
> photos to be
> displayed in rows of three, and if there are only 8 pictures
> (or any othe
> number that's not directly divisible by three) to be
> displayed on the last
> row. At the moment it's doing it "upside down." Any ideas?
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
>
Sorry. Take that back. Just saw the original post.
The problem is that you're doing the <td> stuff AFTER deciding whether you
want to change rows or not. Imagine going through the list below when you're
on $photocount=2, which is really the third picture.
while($row = mysql_fetch_array($result)) {
$smallpic = $row['smallpic'];
if (($photocount % 3) == 2) {
echo "</tr>\n<tr>\n";
}
echo "<td>$smallpic</td>\n";
$photocount++;
}
See what happens? You end the current table row, and THEN print out the
third table cell, which really ends up on the next row.
Just move that echo statement about your if statement (leave the
auto-increment where it is), and you should be fine.
--Todd
> -----Original Message-----
> From: Todd Kerpelman
> Sent: Monday, February 26, 2001 2:10 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP] Table looking odd as a result of while loop?
>
>
> Hmmm... I'm pretty sure 1%3 is equal to 1.
>
> I'm suspecting you might be incrementing $photocount too
> early -- that is,
> before the if (($photocount % 3) == 2) statement. That would
> certainly
> explain the weirdness you're seeing.
>
> --Todd
>
>
> > -----Original Message-----
> > From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, February 26, 2001 1:57 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: [PHP] Table looking odd as a result of while loop?
> >
> >
> > Is it because 1 % 3 is 0 with a remainder of 2? Looks like
> > the code is doing
> > just what it is written to do. The "if" evaluates to true on
> > the second
> > picture.
> >
> > Kirk
> >
> > -----Original Message-----
> > From: James, Yz [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, February 26, 2001 2:55 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Table looking odd as a result of while loop?
> >
> >
> > Hi all, This is probably something dumb I'm missing, but I
> > am using the
> > following code:
> >
> > echo "<table border=\"0\">\n";
> >
> > echo "<tr>\n";
> > $photocount = 0;
> >
> > while($row = mysql_fetch_array($result)) {
> > $smallpic = $row['smallpic'];
> >
> > if (($photocount % 3) == 2) {
> > echo "</tr>\n<tr>\n";
> > }
> >
> > (There are currently 8 pics that have been uploaded). As you
> > can see that
> > the first row has returned just two columns. I'd like the
> > photos to be
> > displayed in rows of three, and if there are only 8 pictures
> > (or any othe
> > number that's not directly divisible by three) to be
> > displayed on the last
> > row. At the moment it's doing it "upside down." Any ideas?
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail:
> > [EMAIL PROTECTED]
> >
>
Yes, try lib cURL it supports authentification and even SSL.
http://www.php.net/manual/en/ref.curl.php
Mike
-----Original Message-----
From: Marius David [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 23, 2001 5:33 PM
To: [EMAIL PROTECTED]
Subject: [PHP] php and apache protected directories
I want to open a html file from a php script. The problem is that the html
file is located in a password protected directory on an apache web server. I
know the user/password for that directory and I want the php script to
handle the authentification automaticly. Is there a way to acomplish this ?
Thank you,
Marius
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
Ok. Here's the situation:
I'm running PHP on a Unix (SGI) box with Apache as a module running an
Intranet web server (call it inside.mydomain.com). Sendmail is running on
the machine. I'm on a network with a windows Mail server (MS. Exchange 5.5)
with (I'm told) appropriate SMTP services running (call it
mail.mydomain.com).
I'm using a mail class I downloaded from somewhere, which basically calls
PHP's mail funciton.
The behaviour is this: When I send mail from the webserver (running as
[EMAIL PROTECTED]) to an inside address (same domain, i.e.
[EMAIL PROTECTED]) I get everything just fine. I can even use the from
feature in the mail class to make the mail appear to come from a real (or
not so real, I've tried [EMAIL PROTECTED] and it takes it just fine) address.
However, when I send mail to an outside address, i.e. [EMAIL PROTECTED], it
gets dropped somewhere. Unfortunately those running the mailserver are
unable/unwilling to help me track this down, so I've got to come to you guys
with limited information and hope you have an answer. If it helps, here's
the header of a message sent from inside.mydomain.com to an inside address.
Thanks in advance.
Received: from sneasv02.omniquip.textron.com
(insidesnorkel.omniquip.textron.com [10.220.15.149]) by
oqamapw1ab.omniquip.textron.com with SMTP (Microsoft Exchange Internet Mail
Service Version 5.5.2650.21)
id 14MPSVVH; Sat, 24 Feb 2001 11:18:24 -0600
Received: (from nobody@localhost) by sneasv02.omniquip.textron.com
(980427.SGI.8.8.8/970903.SGI.AUTOCF) id LAA42386; Sat, 24 Feb 2001 11:13:51
-0600 (CST)
Date: Sat, 24 Feb 2001 11:13:51 -0600 (CST)
Message-Id: <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: You\'ve been very good
From: [EMAIL PROTECTED]
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary = b0c7d5a8cfe35ac094237730d7b4e46d6
...
...
..
John Parker
----------------------------------------------------------------------------
-------------------------------
John Parker, Senior Design Engineer
Ph: 816/676-6419
Fax: 785/989-3556
Sounds like they have relay disabled on their SMTP server and the IP that
your PHP is running on is not on an included network address. As them to
verify that your ip address is ok.
The mail server will accept locally destined mail but anything else is seen
as a relay attempt (Spam) and blocked. In most cases ISPs and admins reject
with complaint (which would help considerably in your case), in others they
reject transparently by routing to /dev/null.
On Mon, 26 Feb 2001, Parker, John (Snorkel) wrote:
> Date: Mon, 26 Feb 2001 16:02:32 -0600
> From: "Parker, John (Snorkel)" <[EMAIL PROTECTED]>
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: [PHP] Mail() Problems in a heterogenous network
>
> Ok. Here's the situation:
>
> I'm running PHP on a Unix (SGI) box with Apache as a module running an
> Intranet web server (call it inside.mydomain.com). Sendmail is running on
> the machine. I'm on a network with a windows Mail server (MS. Exchange 5.5)
> with (I'm told) appropriate SMTP services running (call it
> mail.mydomain.com).
>
> I'm using a mail class I downloaded from somewhere, which basically calls
> PHP's mail funciton.
>
> The behaviour is this: When I send mail from the webserver (running as
> [EMAIL PROTECTED]) to an inside address (same domain, i.e.
> [EMAIL PROTECTED]) I get everything just fine. I can even use the from
> feature in the mail class to make the mail appear to come from a real (or
> not so real, I've tried [EMAIL PROTECTED] and it takes it just fine) address.
> However, when I send mail to an outside address, i.e. [EMAIL PROTECTED], it
> gets dropped somewhere. Unfortunately those running the mailserver are
> unable/unwilling to help me track this down, so I've got to come to you guys
> with limited information and hope you have an answer. If it helps, here's
> the header of a message sent from inside.mydomain.com to an inside address.
> Thanks in advance.
>
> Received: from sneasv02.omniquip.textron.com
> (insidesnorkel.omniquip.textron.com [10.220.15.149]) by
> oqamapw1ab.omniquip.textron.com with SMTP (Microsoft Exchange Internet Mail
> Service Version 5.5.2650.21)
> id 14MPSVVH; Sat, 24 Feb 2001 11:18:24 -0600
> Received: (from nobody@localhost) by sneasv02.omniquip.textron.com
> (980427.SGI.8.8.8/970903.SGI.AUTOCF) id LAA42386; Sat, 24 Feb 2001 11:13:51
> -0600 (CST)
> Date: Sat, 24 Feb 2001 11:13:51 -0600 (CST)
> Message-Id: <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: You\'ve been very good
> From: [EMAIL PROTECTED]
> MIME-Version: 1.0
> Content-Type: multipart/mixed; boundary = b0c7d5a8cfe35ac094237730d7b4e46d6
> ...
> ...
> ..
>
> John Parker
>
> ----------------------------------------------------------------------------
> -------------------------------
> John Parker, Senior Design Engineer
> Ph: 816/676-6419
> Fax: 785/989-3556
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
Kelly
303-444-1671
Boulder, Colorado
Addressed to: "Parker, John (Snorkel)" <[EMAIL PROTECTED]>
"'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
** Reply to note from "Parker, John (Snorkel)" <[EMAIL PROTECTED]> Mon, 26
Feb 2001 16:02:32 -0600
> The behaviour is this: When I send mail from the webserver (running as
> [EMAIL PROTECTED]) to an inside address (same domain, i.e.
> [EMAIL PROTECTED]) I get everything just fine. I can even use the from
> feature in the mail class to make the mail appear to come from a real (or
> not so real, I've tried [EMAIL PROTECTED] and it takes it just fine) address.
> However, when I send mail to an outside address, i.e. [EMAIL PROTECTED], it
> gets dropped somewhere.
What gets dropped?
The entire message - See the message from Kelly Corkill
Just the From info - read on.
> Unfortunately those running the mailserver are
> unable/unwilling to help me track this down,
Probably unable. Windows is Easy, that means you don't have to know
anything to admin it. At least till something unusual happens.
> Received: from sneasv02.omniquip.textron.com
> (insidesnorkel.omniquip.textron.com [10.220.15.149]) by
> oqamapw1ab.omniquip.textron.com with SMTP (Microsoft Exchange Internet Mail
> Service Version 5.5.2650.21)
> id 14MPSVVH; Sat, 24 Feb 2001 11:18:24 -0600
> Received: (from nobody@localhost) by sneasv02.omniquip.textron.com
> (980427.SGI.8.8.8/970903.SGI.AUTOCF) id LAA42386; Sat, 24 Feb 2001 11:13:51
> -0600 (CST)
Take a look at the headers on an internal message. I bet you find some
additional headers like: From: and Reply To: that are being stripped by
the mail server.
Can you load sendmail or qmail on your UNIX box and bypass them. You
don't have to handle incoming email, and you don't want the machine
listening on port 25, but you may be able to have your own machine
handle mail connections and bypass them entirely.
Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com
Hello,
I need a little help getting started with my project (i'm new to PHP). I
need to enumerate all of the files in a folder, their name mostly. How
would I do that?
Thank you!
Addressed to: "Karl J. Stubsjoen" <[EMAIL PROTECTED]>
[EMAIL PROTECTED]
** Reply to note from "Karl J. Stubsjoen" <[EMAIL PROTECTED]> Mon, 26 Feb 2001
15:28:27 -0700
>
> Hello,
>
> I need a little help getting started with my project (i'm new to PHP). I
> need to enumerate all of the files in a folder, their name mostly. How
> would I do that?
Take a look here:
http://www.php.net/manual/en/html/ref.dir.html
opendir, readdir, and closedir will get you moving in the right
direction.
Opendir includes a complete example.
Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com
Anyone know of a open-source driver that would allow unlimited database
connection to connect the UNIX machine to a MS-SQL Server 7.0 and is free?
I have see FreeTDS but it use myssql, I am looking for odbc.
Thanks!
This is a really common question. Check the mailing list archive for an
answer. (I don't know)
Michael
Scott Fletcher wrote:
> Anyone know of a open-source driver that would allow unlimited database
> connection to connect the UNIX machine to a MS-SQL Server 7.0 and is free?
>
> I have see FreeTDS but it use myssql, I am looking for odbc.
>
> Thanks!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
Im trying to get GD to work on my box and i keep getting the following
errors:
gdttf.c:66: syntax error before `TT_Engine'
gdttf.c:72: syntax error before `TT_Matrix'
gdttf.c:81: syntax error before `TT_Engine'
gdttf.c:87: syntax error before `TT_Glyph'
gdttf.c: In function `fontFetch':
gdttf.c:326: syntax error before `err'
gdttf.c:339: structure has no member named `engine'
etc...............
If i remove the following line from the Makefile
-DHAVE_LIBTTF and -lttf
it compiles fine.
I recompiled php with:
'./configure' '--with-mysql=/usr/local/mysql' '--with-xml'
'--with-apache=../apache_1.3.17' '--enable-track-vars'
'--with-gd=/usr/local/include/gd' '--with-zlib=/usr/local/lib'
'--with-ttf=/usr/local/include/freetype2/freetype'
but when i try to execute a php script with imagettfbbox() i get:
"Call to unsupported or undefined function imagettfbbox()'
Any help on or off the list will be greatly appreciated.
Thanks,
Dale
Now im even getting more confused. Ive been doing some more research into
the subject, and cant seem to find any answers.
All of the PHP documentation about headers() talks about auth via PHP, but
doesnt mention anything about htaccess as the auth system.
On my main.php screen, this is where the cookie gets set once the user logs
in with htaccess. What im trying to do is incorporate a section into
(possibly) main.php which forces the htaccess to rerequest login again
using my .htpasswd password file as the criteria.
Is there some sort of header information which will make the webserver turn
around and say..... "Hey, you shouldnt be here anymore, login again and I
might think about letting you in"
Because once I can get the user logging in again, it will go to the rest of
main.php and unset/reset the cookie with the new user.
Scratching my head.
Chris
The request for a password is usually generated by a 401 header. Just do
this -
Header("WWW-authenticate: basic realm=\"Some realm\"");
Header("HTTP/1.1 401 Unauthorized");
exit;
That should pop up a box. Just make sure you check the values of
$PHP_AUTH_USER/PW first before presenting those headers.
This is more of an http question then it is a php question, I strongly
advise you to read and understand the HTTP/1.1 rfc - it can be found at
http://www.faqs.org/rfcs/rfc2616.html
(See chapter 10.4.2 for the documentation of the 401 header)
Regards,
Sander
> -----Original Message-----
> From: Chris Aitken [mailto:[EMAIL PROTECTED]]
> Sent: 27 February 2001 00:12
> To: [EMAIL PROTECTED]
> Subject: [PHP] Forcing htaccess login again
>
>
> Now im even getting more confused. Ive been doing some more research into
> the subject, and cant seem to find any answers.
>
> All of the PHP documentation about headers() talks about auth via
> PHP, but
> doesnt mention anything about htaccess as the auth system.
>
> On my main.php screen, this is where the cookie gets set once the
> user logs
> in with htaccess. What im trying to do is incorporate a section into
> (possibly) main.php which forces the htaccess to rerequest login again
> using my .htpasswd password file as the criteria.
>
> Is there some sort of header information which will make the
> webserver turn
> around and say..... "Hey, you shouldnt be here anymore, login again and I
> might think about letting you in"
>
> Because once I can get the user logging in again, it will go to
> the rest of
> main.php and unset/reset the cookie with the new user.
>
>
> Scratching my head.
>
>
>
> Chris
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
At 12:26 AM 27/02/2001, Sander Pilon wrote:
>The request for a password is usually generated by a 401 header. Just do
>this -
>
>Header("WWW-authenticate: basic realm=\"Some realm\"");
>Header("HTTP/1.1 401 Unauthorized");
>exit;
>
>That should pop up a box. Just make sure you check the values of
>$PHP_AUTH_USER/PW first before presenting those headers.
I have tried this, and all it keeps doing is reasking for the U/P until the
3rd time and errors me out. I checked the $PHP_AUTH_USER/PW and both
display my own username and password, but when I enable the above lines it
just keeps asking for a u/p
where does the above try and verify the password from ?
The initial .htaccess request authenticates from a htpasswd file held in
the root dir of the user on the server. How can I make the above lines read
from this htpasswd file to authenticate a new user/pass ?
Chris
I <[EMAIL PROTECTED]> wrote:
> Can someone give me a simple example script that uses postgres session
> handling, that works with register_globals "off"?
As a followup again, it seems what I've been running into is a bug
in PHP:
http://bugs.php.net/bugs.php?id=8772
http://bugs.php.net/bugs.php?id=9002
So, hopefully, someday, it will be fixed.
--
Steve <[EMAIL PROTECTED]>
Now playing: Moon and Sun Part II: North's Son
(Amorphis - "Black Winter Day")
I am trying to install and configure PHP3 with Oracle 8.1.6 and am
receiving the following error when I run $ make
In file included from functions/php3_oci8.h:53,
from internal_functions.c:53:
/stuff/oracle/product/8.1.6/rdbms/demo/oci.h:1659: ociextp.h: No such
file or directory
make: *** [internal_functions.o] Error 1
[bob@rojo /php-3.0.16]#
I verified that the file is not there.
Here is how I configured php3:
./configure --with-apxs=/usr/local/apache/bin/apxs
--with-config-file-path=/etc/httpd
--with-oracle=/stuff/oracle/product/8.1.6
Any suggestions or ideas as to what might be wrong?
Is it possible to run 8.1.6 with PHP3? or do I need PHP4?
I am using RedHat 6.0
Thanks,
Bob K
I'm having trouble establishing MySQL sessions when the client is running
from behind a remote firewall. (I.e., the MySQL server has a static
internet IP, but the remote client which is accessing, or better said,
attempting to access the MySQL database via PHP in their browser can't seem
to establish a MySQL session.)
Does anybody have any experience with this phenomenon?
Thanks.
Lee Howard
Hello Lee,
I cannot imagin exact environtment that you have. Anyway,
Are you sure that your servers (Web Server running PHP and Database server
running MySQL) can talk to each other? It seems you have firewall(or like,
router/proxy/etc) between your web server and your database server.
Regards,
--
Yasuo Ohgaki
> I'm having trouble establishing MySQL sessions when the client is running
> from behind a remote firewall. (I.e., the MySQL server has a static
> internet IP, but the remote client which is accessing, or better said,
> attempting to access the MySQL database via PHP in their browser can't
seem
> to establish a MySQL session.)
>
> Does anybody have any experience with this phenomenon?
>
> Thanks.
>
> Lee Howard
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
On Mon, 26 Feb 2001 20:52, [EMAIL PROTECTED] wrote:
> I'm a beginner but...I can't install php-4.o.4pl1 on my linux
> mandrake..why?
> When I run configure ,the program checks all the files...
> there are some missing..but it never return an error
> it return a warning 'you will need bison if you want to regenerate the
> php parsers'
> and after other check..it stops with this error'cannot find output for
> lex;giving up'
>
> what can i do?
> thanks
> Daniele
You are missing some of the files you need to compile - you may need to
seek assistance from someone familiar with Mandrake to determine how to
add the necessary stuff. I can tell you how with slackware....
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA
On Tue, Feb 27, 2001 at 10:34:53AM +1030, David Robley wrote:
> On Mon, 26 Feb 2001 20:52, [EMAIL PROTECTED] wrote:
> > I'm a beginner but...I can't install php-4.o.4pl1 on my linux
> > mandrake..why?
> > When I run configure ,the program checks all the files...
> > there are some missing..but it never return an error
> > it return a warning 'you will need bison if you want to regenerate the
> > php parsers'
> > and after other check..it stops with this error'cannot find output for
> > lex;giving up'
You need to do a installation of a complete C development environment,
including flex and bison. Locate the RPMs on your CD or load it from a RPM
repository. www.rpmfind.com seems to be down.
> You are missing some of the files you need to compile - you may need to
> seek assistance from someone familiar with Mandrake to determine how to
> add the necessary stuff. I can tell you how with slackware....
If you want control everything yourself install Debian. At the LinuxDays
last year in Stuttgart we have installed Mandrake. But the friendly people
from the Mandrake booth couldn't help us with Jade and DocBook.
-Egon
--
http://www.linuxtag.de/
http://php.net/books.php
http://www.concert-band.de/
http://www.php-buch.de/
Hiya,
Can i call a function from the action line of a form?
ie:
<?
function myfunction(){
if($submit){
$result = mysql_query("INSERT INTO app
(name,company,address,suburb,state,post,areacode,phone,faxareacode,fax,email,secret)
VALUES
('$name','$company','$address','$suburb','$state','$post','$areacode','$phone','$faxareacode','$fax','$email','$secret')");
}
}
?>
<form action="<? myfunction(); ?>
i would like to do it this way because i have a form on another page with passed the
vaules thru to this one .. and i don't want it looking at the if($submit)
Any help would be great
Thanks
Peter Houchin
Sun Rentals
[EMAIL PROTECTED]
On Tue, 27 Feb 2001 01:28, Clayton Dukes wrote:
> > Hi :-)
> Can someone tell me how to do the equivalant of this Perl script in
> PHP?
>
> ###
> ### This function prints all lines between the dashes read in a text
> file ###
> ### The file looks like this:
>
> # -----------------------------
> # Somedata: something
> # Someother: something else
> # ------------------------------
> #
> # Several paragraphs
> # Several paragraphs
> # Several paragraphs
> # ----------END--------------
> #
>
>
>
> #!/usr/bin/perl -w
> @rray = <STDIN>;
>
>
> $inside = 0;
> foreach $line (@rray) {
> if ($line =~ /-----/ig) {
> $inside = 1;
> } elsif ($line =~ /-----/gi) {
> $inside = 0;
> }
>
> if ($inside == 1) {
> print $line;
> }
> }
>
>
> TIA!
Seems like your solution boils down to this:
Set toggle = 0
open file for read
while not EOF
Read file line by line
if(line has dashes)
toggle = not(toggle) // flip the toggle
endif
if (toggle)
print line
endif
endwhile
close file
The code is left as an exercise for the student :-)
Cheers
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA
Hi all,
I understand that you can call the parent function
from within an overriding child function using the
parent::method syntax. That's OK.
My problem is...I need the parent's data! (I know
that the class has no data, only objects of that
class have data, etc etc.)
I have a class that can execute SQL statements. It
is extended into many different classes that add
extra functionality - no rocket science.
What I want to do is add permission checking in
the child classes that then call the same function
in the parent *object. ie:
Class A {
function save() {
//refer to member data...
//execute sql based on member data...
}
}
Class B extends A {
function save() {
//check current user rights
//if ok, execute parent::save()
//BUT parent::save() won't have
//access to the member data it
//needs because it is a static call.
}
}
Any ideas? I have a feeling it could be achieved with
the serialize funtion, as I saw in the annotated manual,
but I don't quite understand what is going on in the
example. (I assume it is hacking the object's internal
representation so that it refers to a different class.
Scary.)
Thanks for any help
Regards,
Tyson Lloyd Thwaites
IT&e Limited
e-Commerce Division
Adelaide
(08) 8346 3888
Actually, static calls aren't so static when they're calling a method which is
in the inheritance tree.
In other words, parent:: calls (assuming the subclass is instanciated) will
operate instanciated.
John
On Tue, 27 Feb 2001, Tyson Lloyd Thwaites wrote:
> Hi all,
>
> I understand that you can call the parent function
> from within an overriding child function using the
> parent::method syntax. That's OK.
>
> My problem is...I need the parent's data! (I know
> that the class has no data, only objects of that
> class have data, etc etc.)
>
> I have a class that can execute SQL statements. It
> is extended into many different classes that add
> extra functionality - no rocket science.
>
> What I want to do is add permission checking in
> the child classes that then call the same function
> in the parent *object. ie:
>
> Class A {
> function save() {
> //refer to member data...
> //execute sql based on member data...
> }
> }
>
> Class B extends A {
> function save() {
> //check current user rights
>
> //if ok, execute parent::save()
> //BUT parent::save() won't have
> //access to the member data it
> //needs because it is a static call.
> }
> }
>
> Any ideas? I have a feeling it could be achieved with
> the serialize funtion, as I saw in the annotated manual,
> but I don't quite understand what is going on in the
> example. (I assume it is hacking the object's internal
> representation so that it refers to a different class.
> Scary.)
>
> Thanks for any help
>
> Regards,
>
> Tyson Lloyd Thwaites
> IT&e Limited
> e-Commerce Division
> Adelaide
> (08) 8346 3888
>
>
--
John Donagher
Application Engineer
Intacct Corp. - Powerful Accounting on the Web
408-395-0989
720 University Ave.
Los Gatos CA 95032
www.intacct.com
Public key available off http://www.keyserver.net
Key fingerprint = 4024 DF50 56EE 19A3 258A D628 22DE AD56 EEBE 8DDD
Is there any equivalent java try catch syntax in php ?
Thanks,
Jeff
No, PHP doesn't have the extensive error handling that Java does. It's a
bit more like C.
Jason
----- Original Message -----
From: "Jeff" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 26, 2001 6:30 PM
Subject: [PHP] try catch in php?
> Is there any equivalent java try catch syntax in php ?
>
> Thanks,
>
> Jeff
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
I have a customer who insists on using Front Page, but wants protection
against intruders on all his web pages. I envisioned a solution where he
works in Front Page, then all his files are ftp'd to a directory on the
server, opened and re-written as .php files with all links changed from
"something.htm" to "something.php" and then copied to a directory on the
same level called "test". So far so good, and this allows a php-one-liner
to provide the necessary security.
Now I'm stuck, because I have to copy these files from test to the location
of the web page itself. And I've not been able to do it, and I can't do
it, as far as I can see without giving world-writeable permission to the
web directory. Here's the skeletal directory structure ...
.../www.website.com
/admin
/upload
/test
The script (php page) I'm using to do this is stored in /admin and I want
to copy everything in /test (and any subdir's it may have) to www.website.com.
On the server, logged in as root, I can execute a shell script named
newpub-web, located in www.website.com, which consists of:
rm -f *.php
rm -f ./graphics/*
cp -fR ./admin/test/* .
I've tried executing newpub-web from a php script, which changes to the the
working directory to www.website.com, as:
exec( "newpub-web"), or system( "newpub-web" ) or passthru(
"newpub-web"). None have worked.
I've also tried executing the commands directly using system(), all without
effect, no errors, nothing.
Do I have to change the group of www.website.com to nobody? That seems to
be an awful security hole.
Stymied in Nova Scotia - Miles Thompson
PHP runs as the webserver user which in most cases is user nobody. For PHP
to write to a directory, it has to be writable to this directory. A
possible solution would be to compile a PHP executable and run a script from
cron to copy the files periodically. By using cron and a cgi-version of PHP
you can run it as your desired user.
Jason
----- Original Message -----
From: "Miles Thompson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 26, 2001 7:18 PM
Subject: [PHP] Copying Files to the Web Directory
> I have a customer who insists on using Front Page, but wants protection
> against intruders on all his web pages. I envisioned a solution where he
> works in Front Page, then all his files are ftp'd to a directory on the
> server, opened and re-written as .php files with all links changed from
> "something.htm" to "something.php" and then copied to a directory on the
> same level called "test". So far so good, and this allows a php-one-liner
> to provide the necessary security.
>
> Now I'm stuck, because I have to copy these files from test to the
location
> of the web page itself. And I've not been able to do it, and I can't do
> it, as far as I can see without giving world-writeable permission to the
> web directory. Here's the skeletal directory structure ...
>
> .../www.website.com
> /admin
> /upload
> /test
>
> The script (php page) I'm using to do this is stored in /admin and I want
> to copy everything in /test (and any subdir's it may have) to
www.website.com.
>
> On the server, logged in as root, I can execute a shell script named
> newpub-web, located in www.website.com, which consists of:
> rm -f *.php
> rm -f ./graphics/*
> cp -fR ./admin/test/* .
>
> I've tried executing newpub-web from a php script, which changes to the
the
> working directory to www.website.com, as:
> exec( "newpub-web"), or system( "newpub-web" ) or passthru(
> "newpub-web"). None have worked.
>
> I've also tried executing the commands directly using system(), all
without
> effect, no errors, nothing.
>
> Do I have to change the group of www.website.com to nobody? That seems to
> be an awful security hole.
>
> Stymied in Nova Scotia - Miles Thompson
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
Hello Brian,
JavaScript book, that I have, mentions some NN cannot display JavaScript
code correctly when user views HTML source code. To work around this, author
says disable JavaScript on NN and display source.
How about try this to see what the browser really get?
(PHP sends the same output for all browsers unless you explicitly does so, I
believe. I guess it is due to the browser implementation difference or bug
in NN.)
Regards,
--
Yasuo Ohgaki
> This could be a JS issue but right now I'm really
> not sure.
>
> I have this code,
>
> } elseif ($cat == 'bikes' && $sub_cat == 'Road') {
> $i = 1;
> while ( list($type,) = each($bikes[$sub_cat])) {
> echo "<TD><IMG SRC=\"images/spacer.gif\" WIDTH=\"25\" HEIGHT=\"1\"
> ALT=\"\" BORDER=\"0\"></TD>\n";
> echo "<TD><A HREF=\"#\" CLASS=\"menu\"
> onMouseOver=\"popUp('HM_Menu$i',event)\"
onMouseOut=\"popDown('HM_Menu$i')\"
> onClick=\"return false\">$type</A></TD>\n";
> $i++;
> }
> echo "<SCRIPT LANGUAGE=\"JavaScript1.2\" SRC=\"HM_Loader.js\"
> TYPE=\"text/javascript\"></SCRIPT>";
>
> Which creates this (in IE),
>
> <TD><IMG SRC="images/spacer.gif" WIDTH="25" HEIGHT="1" ALT=""
> BORDER="0"></TD>
> <TD><A HREF="#" CLASS="menu" onMouseOver="popUp('HM_Menu1',event)"
> onMouseOut="popDown('HM_Menu1')" onClick="return false">Trek</A></TD>
> <TD><IMG SRC="images/spacer.gif" WIDTH="25" HEIGHT="1" ALT=""
> BORDER="0"></TD>
> <TD><A HREF="#" CLASS="menu" onMouseOver="popUp('HM_Menu2',event)"
> onMouseOut="popDown('HM_Menu2')" onClick="return false">Schwinn</A></TD>
> <TD><IMG SRC="images/spacer.gif" WIDTH="25" HEIGHT="1" ALT=""
> BORDER="0"></TD>
> <TD><A HREF="#" CLASS="menu" onMouseOver="popUp('HM_Menu3',event)"
> onMouseOut="popDown('HM_Menu3')" onClick="return false">LeMond</A></TD>
> <TD><IMG SRC="images/spacer.gif" WIDTH="25" HEIGHT="1" ALT=""
> BORDER="0"></TD>
> <TD><A HREF="#" CLASS="menu" onMouseOver="popUp('HM_Menu4',event)"
> onMouseOut="popDown('HM_Menu4')" onClick="return false">Moots</A></TD>
> <SCRIPT LANGUAGE="JavaScript1.2" SRC="HM_Loader.js"
> TYPE="text/javascript"></SCRIPT>
>
> However, in NN it creates,
>
> <TD><A HREF="#" CLASS="menu" onMouseOver="popUp('HM_Menu1',event)"
> onMouseOut="popDown('HM_Menu1')" onClick="return false">Trek</A></TD>
> <TD><IMG SRC="images/spacer.gif" WIDTH="25" HEIGHT="1" ALT=""
> BORDER="0"></TD>
> <TD><A HREF="#" CLASS="menu" onMouseOver="popUp('HM_Menu2',event)"
> onMouseOut="popDown('HM_Menu2')" onClick="return false">Schwinn</A></TD>
> <TD><IMG SRC="images/spacer.gif" WIDTH="25" HEIGHT="1" ALT=""
> BORDER="0"></TD>
> <TD><A HREF="#" CLASS="menu" onMouseOver="popUp('HM_Menu3',event)"
> onMouseOut="popDown('HM_Menu3')" onClick="return false">LeMond</A></TD>
> <TD><IMG SRC="images/spacer.gif" WIDTH="25" HEIGHT="1" ALT=""
> BORDER="0"></TD>
> <TD><A HREF="#" CLASS="menu" onMouseOver="popUp('HM_Menu4',event)"
> onMouseOut="popDown('HM_Menu4')" onClick="return false">Moots</A></TD>
>
> Specifically the line,
> echo "<SCRIPT LANGUAGE=\"JavaScript1.2\" SRC=\"HM_Loader.js\"
> TYPE=\"text/javascript\">
> is simply missing and the JS of course does not work.
>
> Now, if I reload the page the Jscript WILL work however the line,
> echo "<SCRIPT LANGUAGE=\"JavaScript1.2\" SRC=\"HM_Loader.js\"
> TYPE=\"text/javascript\">
> still does not show up in the source.....
>
> This is version 4.08 and it only appears to happen with NN furthermore it
> only happens when
> the browser is first loaded. Once I go to the page and refresh it I can go
> to other pages,
> even other sites and come back to it and it will still be fine. But, as
soon
> as I restart the browser and go to the site it happens again.
>
> What do you all think? Is this a PHP, Javascript, or DHTML issue?
>
> -Brian
> *************
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
hello!!
I have a question about variables scope!!
<?php
$var = 10;
function func1()
{
func2();
}
function func2()
{
echo $var;
}
func1();
?>
In the above segment, I know that, func2 won't echo anything, even I add
"global var;" in func2.
if, I modified the segment, so, that, it like the following!!
<?php
$var = 10;
function func1()
{
global var;
func2();
}
function func2()
{
global var;
echo $var;
}
func1();
?>
It works!!
However, I am now doing a project, using PHP, I decide to write some
modules, for frequestly used. How ever, these module, have to use some
variables, whose scope is originally on only the upper most level.
If using these way (global all var in each function, even not the
modules functions),
it is very inconivent, as I need to know which variable, should 'global'
it, if I use some module functions,
Is there any convient way to do so???
Zenith
Hello Zenith,
SNIP
> However, I am now doing a project, using PHP, I decide to write some
> modules, for frequestly used. How ever, these module, have to use some
> variables, whose scope is originally on only the upper most level.
> If using these way (global all var in each function, even not the
> modules functions),
> it is very inconivent, as I need to know which variable, should 'global'
> it, if I use some module functions,
> Is there any convient way to do so???
Globals in PHP differ from many other languages and PHP does not support
name space. All global vars are not visible in function or class by default.
( Programmer must declare as global before using it)
I recommed you to browse http://www.php.net/docs.php
I recommend to set 'enable track vars' and 'disable register globals' in
php.ini. If you done this in php.ini, programmer can only access variables
from server, browser, etc as acciative arrays like
$HTTP_POST_VARS, $HTTP_GET_VARS, $HTTP_SERVER_VARS, $HTTP_UPLOAD_FILES,
$HTTP_SESSION_VARS,.....
If you want to access POST data from user's browser you can write like
function foo() {
global $HTTP_POST_VARS;
// do something
}
to access all data that are posted by POST method. (Except
$HTTP_UPLOAD_FILES)
Using $HTTP_* variables improves code readability I think
PS: You can use $GLOBALS[] to access all global vars.
Regards,
--
Yasuo Ohgaki
>
> Zenith
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
I read about the php manual, I find that, shmop function can let me use
to store information directly on a shared segment memory.
However, I have some question about these!
Does it provide a faster performance, if I use these rather than store
things in mysql DB, I know this might be stupid, but I have to make sure
this.
And, can I shared the segment ( the data stored inside ) with different
user session.
Would you show me how.
Lastly, is there any further information about using this? the manual
only take a little bit!!
Thanks
Zenith
Hiya,
Can i call a function from the action line of a form?
ie:
<?
function myfunction(){
if($submit){
$result = mysql_query("INSERT INTO app
(name,company,address,suburb,state,post,areacode,phone,faxareacode,fax,email,secret)
VALUES
('$name','$company','$address','$suburb','$state','$post','$areacode','$phone','$faxareacode','$fax','$email','$secret')");
}
}
?>
<form action="<? myfunction(); ?>
i would like to do it this way because i have a form on another page with passed the
vaules thru to this one .. and i don't want it looking at the if($submit)
Any help would be great
Peter Houchin
Sun Rentals
[EMAIL PROTECTED]
> Can i call a function from the action line of a form?
No, since the <FORM> tag needs to point to a receiving PHP script.
PHP code is executed on the server side, not the browser.
PHP code is executed on the server side, not the browser.
PHP code is executed on the server side, not the browser.
PHP code is executed on the server side, not the browser.
PHP code is executed on the server side, not the browser.
:)
Jason
--
Jason Murray
[EMAIL PROTECTED]
Web Design Team, Melbourne IT
Fetch the comfy chair!
Hi all,
how can I tell the output from a mysql query to
wrap the cols at 80 (or whatever)?
here's what I have:
$row = mysql_fetch_array($sth);
if ($row[0] != "")
{ echo $row[0];
prints the data, but some of the results are long
strings of text that don't wrap in the browser, how can I force them to wrap at
the edge of the browser?
Thanks,
Clayton Dukes
|
Nevermind,
I got it :-)
I used:
function wraptext($text,$warp) {
$text = explode(" ", $text);
$i = 0; $length = 0;
while ($i <= count($text)) {
$length += strlen($text[$i]);
if ($length <= $warp) {
$output .= $text[$i]." ";
$i++;
} else {
$output .= "\n";
$length = 0;
}
}
return $output;
}
Then in the php file:
echo (wraptext($row[0],80));
I'm learning :-)
----- Original Message -----
From: Clayton Dukes
To: [EMAIL PROTECTED]
Sent: Monday, February 26, 2001 9:59 PM
Subject: [PHP] How to wrap output of formatted text
Hi all,
how can I tell the output from a mysql query to wrap the cols at 80 (or whatever)?
here's what I have:
$row = mysql_fetch_array($sth);
if ($row[0] != "") {
echo $row[0];
prints the data, but some of the results are long strings of text that don't wrap in
the browser, how can I force them to wrap at the edge of the browser?
Thanks,
Clayton Dukes
------------------------------------------------------------------------------
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
There's a PHP function that does this. See: http://www.php.net/wordwrap
Sig for a Day
Stephan Ahonen, ICQ 491101
"That's very funny Scotty, now beam down my clothes!"
Come back tomorrow for a different sig!
Backspace a single "s" to reply by email
can some one offer a suggestion please ... i have a
if ($update) {
$result=foo;
}
in that if statement i want to redirect them to another page after it has processed
the result ..
i tried having using
if ($update) {
$result=foo;
echo "<META HTTP-EQUIV=\"refresh\" CONTENT=\"1;page.php\">";
}
but to no avail ..
any suggestions ?
Peter Houchin
Sun Rentals
[EMAIL PROTECTED]
try the header function
http://www.php.net/manual/en/function.header.php
for ex, if you want the user to be redirected to abc.php3 file, then use
this function call
header("location:abc.php3");
exit;
do take all the precautions subscribed for the header function in the
manual.
hope that helps
best regards
Ankur Verma
HCL Technologies
A1CD, Sec -16
Noida, UP
India
----- Original Message -----
From: "Peter Houchin" <[EMAIL PROTECTED]>
To: "PHP MAIL GROUP" <[EMAIL PROTECTED]>
Sent: Tuesday, February 27, 2001 9:58 AM
Subject: [PHP] redirect pages
> can some one offer a suggestion please ... i have a
>
> if ($update) {
> $result=foo;
> }
>
> in that if statement i want to redirect them to another page after it has
processed the result ..
>
> i tried having using
>
> if ($update) {
> $result=foo;
> echo "<META HTTP-EQUIV=\"refresh\" CONTENT=\"1;page.php\">";
> }
>
> but to no avail ..
>
> any suggestions ?
>
> Peter Houchin
> Sun Rentals
> [EMAIL PROTECTED]
>
>
On Tue, 27 Feb 2001 14:58, Peter Houchin wrote:
> > can some one offer a suggestion please ... i have a
>
> if ($update) {
> $result=foo;
> }
>
> in that if statement i want to redirect them to another page after it
> has processed the result ..
> i tried having using
>
> if ($update) {
> $result=foo;
> echo "<META HTTP-EQUIV=\"refresh\" CONTENT=\"1;page.php\">";
> }
>
> but to no avail ..
>
> any suggestions ?
>
> Peter Houchin
if ($update) {
$result=foo;
header("page.php");
}
and make _absolutely_ sure that your script doesn't even have a white
space _anywhere_ before issuing the header.
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA
On Tue, 27 Feb 2001 15:15, David Robley wrote:
> On Tue, 27 Feb 2001 14:58, Peter Houchin wrote:
> > > can some one offer a suggestion please ... i have a
> >
> > if ($update) {
> > $result=foo;
> > }
> >
> > in that if statement i want to redirect them to another page after it
> > has processed the result ..
> > i tried having using
> >
> > if ($update) {
> > $result=foo;
> > echo "<META HTTP-EQUIV=\"refresh\" CONTENT=\"1;page.php\">";
> > }
> >
> > but to no avail ..
> >
> > any suggestions ?
> >
> > Peter Houchin
>
> if ($update) {
> $result=foo;
> header("page.php");
I mean, of course
header("Location: page.php");
Must teach fingers to wait for brain to engage :-)
> }
>
> and make _absolutely_ sure that your script doesn't even have a white
> space _anywhere_ before issuing the header.
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA
Hello all,
I would like to know if anyone already wrote FORM module (not PHP
class/function) that handles HTML forms (elements, validation, etc).
I searched freashmeat, I couldn't find one.
Thanks,
--
Yasuo Ohgaki
hi..
i have a form that allow users to upload several image files.
every time they submit, i do fread them and assign them to an array...
this array will be passed on until user confirmation.. then i insert
into database as blob type....
//freed image file and assign to array.
$diagram[$ind] =
addslashes(fread(fopen($HTTP_POST_FILES["QuestDia"]["tmp_name"][$ind],"r"),
//to facilitate posting of any existing array of the above to the next
form...
for($ind=0;$ind < count($diagram);$ind++)
print "<input type=\"hidden\" name=\"diagram[$ind]\"
value=\"".$diagram[$ind]."\">";
the script will bring user back to the form and allow them to upload
more...
the 2nd time round, i have got error..
i see parts of $diagram being displayed out... meaning funny characters
are displayed..
once $diagram is insert into database,,, the pic is corrupted..
it works fine if the form does not repeat.. meaning user post images and
database is updated straight away.
can someone tell me wat's wrong?
john