|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: php-general-digest-help
lists.php.netDate: Tue Apr 16 2002 - 01:40:41 CDT
php-general Digest 16 Apr 2002 06:40:41 -0000 Issue 1289
Topics (messages 93051 through 93133):
Re: variable question
93051 by: David McInnis
93060 by: Jule Slootbeek
93065 by: cal.calevans.com
Re: Detecting language
93052 by: Erik Price
93054 by: Boaz Yahav
Copy image from a website to another?
93053 by: Lic. Carlos A. Triana Torres
93088 by: Chris Hewitt
XML Flatfile Database
93055 by: Sebastian A.
Re: chown ..opperation not permitted
93056 by: Erik Price
93057 by: John Weez
93058 by: Darren Gamble
93059 by: Eugene Lee
93061 by: Erik Price
93062 by: Erik Price
calculating US holidays
93063 by: Tom Beidler
93069 by: Erik Price
93070 by: Tyler Longren
93071 by: Tom Beidler
93073 by: Robert Cummings
93081 by: Steve Cayford
93086 by: heinisch.creaction.de
93115 by: Tom Rogers
93116 by: Tom Rogers
Re: "What date/time was it 7 hours ago"?
93064 by: Richard Emery
eregi() problems...
93066 by: jas
93068 by: Robert Cummings
93094 by: jas
web spider?
93067 by: Ryan Govostes
93075 by: Greg Donald
93077 by: Andrew Brampton
93078 by: Steve Bissonnette
93091 by: DL Neil
meta tags from mysql
93072 by: Andras Kende
93074 by: Julio Nobrega Trabalhando
Confused on Session Register
93076 by: Lash, David A (David)
Re: [PHP-DB] Arrays
93079 by: Richard Emery
credit card validation
93080 by: jas
93083 by: phplists.woodenpickle.com
93090 by: Analysis & Solutions
peer code review wanted
93082 by: Erik Price
93085 by: Robert Cummings
93087 by: Erik Price
Re: PHP Shopping Engine Recommendation
93084 by: phplists.woodenpickle.com
Re: Newbie Question
93089 by: Chris Hewitt
Re: calculating US holidays OT
93092 by: DL Neil
evaluate my mailing list attempt?
93093 by: Police Trainee
Re: newbie question: templates with frames
93095 by: Richard Archer
Re: PHP MySQL Hosting services
93096 by: Vins
93100 by: Michael Kimsal
Re: Searching a mySQL DB
93097 by: Richard Archer
Seeing if a value matches anything in an array
93098 by: Leif K-Brooks
93108 by: CC Zona
Re: Poor results with GD
93099 by: Richard Archer
How do I overwrite file via FTP without changing owner/group?
93101 by: John Kelly
Re: Need row number from database select
93102 by: SP
93110 by: SP
Re: Cross DB application
93103 by: Manuel Lemos
93104 by: Manuel Lemos
93107 by: James Cox
93109 by: Manuel Lemos
Re: HELP! Connect or no connect, that's the question...
93105 by: Brad Thomas
newbe printing routine??
93106 by: Dan Koken
[ Variable Problems ]
93111 by: [ rswfire ]
str_replace question
93112 by: Andras Kende
93117 by: Justin Blake
Faking a form POST
93113 by: .ben
Definitive answer for large scale registration/authentication
93114 by: Brad Hubbard
93119 by: Manuel Lemos
Re: graphing packages
93118 by: Allen Lee
Re: [PHP-DB] Re: Definitive answer for large scale registration/authentication
93120 by: Brad Hubbard
93124 by: Manuel Lemos
93126 by: Richard Archer
93128 by: Brad Hubbard
93133 by: Brad Hubbard
naver.com ????
93121 by: Brad Hubbard
PHP/MySQL Query Prob
93122 by: Jason Soza
93129 by: David Robley
variable question...
93123 by: Phil Schwarzmann
93130 by: Justin Blake
smarter way to write config file?
93125 by: Justin French
93132 by: Justin Blake
Login Frontend: Call for Suggestions
93127 by: Ashley M. Kirchner
Re: Error accessing class
93131 by: Andrew Schoenherr
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
You would need to read in the line and explode the line into an array
using explode(). How you do this depends on how you wrote the variables
to a file. If you separated them using a "," you could use
$values = explode(",", $inputstring);
see also: http://www.php.net/manual/en/function.explode.php
David McInnis
-----Original Message-----
From: Jason Wong [mailto:php-general
gremlins.com.hk]
Sent: Monday, April 15, 2002 10:49 AM
To: php-general
lists.php.net
Subject: Re: [PHP] variable question
On Tuesday 16 April 2002 00:41, Jule Slootbeek wrote:
> Hey Guys and Gals,
> I'm writing this little script that takes two inputs: $name and
> $welcomemssg from a form and puts them in a text file. Now i only want
to
> extract one of those variables open it with welcome.php, how do i go
about
> this? when i just do fopen and fwrite it prints both variables.
> any thoughts?
Show us your code.
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* Kissing your hand may make you feel very good, but a diamond and sapphire bracelet lasts for ever. -- Anita Loos, "Gentlemen Prefer Blondes" */
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Here's my code, teh $welcomemssg is one of the two variable store in index.php the other one is $name
<?php $File = "welcome/index.php"; $Open = fopen ($File, "r"); if ($Open) { print ("$welcomemssg"); } fclose ($Open); ?>
Jule
On Monday 15 April 2002 13:49, you typed on your keyboard, and you sent me the following: On Tuesday 16 April 2002 00:41, Jule Slootbeek wrote: > Hey Guys and Gals, > I'm writing this little script that takes two inputs: $name and > $welcomemssg from a form and puts them in a text file. Now i only want to > extract one of those variables open it with welcome.php, how do i go > about this? when i just do fopen and fwrite it prints both variables. > any thoughts?
Show us your code.
-- Jule Slootbeek jslootbeekclarku.edu http://blindtheory.cjb.net
attached mail follows:
store $name on one line and $welcomemssg on a separate line. Then just remember that all odd numbered liens are names and even numbered lines are messages.
=C= * * Cal Evans * Techno-Mage * http://www.calevans.com *
----- Original Message -----
From: "Jule Slootbeek" <jslootbeek
clarku.edu>
To: <php-general
lists.php.net>
Sent: Monday, April 15, 2002 1:30 PM
Subject: Re: [PHP] variable question
>
> Here's my code, teh $welcomemssg is one of the two variable store in
> index.php the other one is $name
>
> <?php
> $File = "welcome/index.php";
> $Open = fopen ($File, "r");
> if ($Open) {
> print ("$welcomemssg");
> }
> fclose ($Open);
> ?>
>
> Jule
>
> On Monday 15 April 2002 13:49, you typed on your keyboard, and you sent me
> the following:
> On Tuesday 16 April 2002 00:41, Jule Slootbeek wrote:
> > Hey Guys and Gals,
> > I'm writing this little script that takes two inputs: $name and
> > $welcomemssg from a form and puts them in a text file. Now i only want
to
> > extract one of those variables open it with welcome.php, how do i go
> > about this? when i just do fopen and fwrite it prints both variables.
> > any thoughts?
>
> Show us your code.
>
> --
> Jule Slootbeek
> jslootbeek
clarku.edu
> http://blindtheory.cjb.net
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
attached mail follows:
On Monday, April 15, 2002, at 02:43 PM, Boaz Yahav wrote:
> I have an application that works with two languages. I'm trying to write > a function that will tell me if a string > contains only English or also chars from the other language. It's enough > that there is one char of a different > language to make the function return a true value. > > I guess I'm not inventing the wheel here...
I would create an array of characters according to your definition of English characters, and then check to see if any of those characters are in the string.
But since the trend appears to be in moving toward Unicode, the "official" distinction of an English character vs any other language's character is becoming blurry -- at least in the field of information delivery.
Erik
----Erik Price Web Developer Temp Media Lab, H.H. Brown pricee
hhbrown.com
attached mail follows:
In case anyone is interested....
Function IsHebrew($string) { If(ereg('[?-?]',$string,$regs)) { Echo"Hebrew"; }Else{ Echo"English"; } }
Not everyone can see the [?-?]. In any case this can be good for any language....
berber
-----Original Message----- From: Boaz Yahav Sent: Monday, April 15, 2002 8:44 PM To: PHP General (E-mail) Subject: [PHP] Detecting language
Hi
I have an application that works with two languages. I'm trying to write a function that will tell me if a string contains only English or also chars from the other language. It's enough that there is one char of a different language to make the function return a true value.
I guess I'm not inventing the wheel here...
Sincerely
berber
Visit http://www.weberdev.com Today!!! To see where PHP might take you tomorrow.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hello all, I am learning php and I am trying to make a very simple script so as to download a jpg from one site I manage to another that I also manage. It would be, get a jpg from http://www.first_site.com/image.jpg and put in to http://www.second_site.com/image.jpg. I have tried this, but the only way it works is if I give the absolute path to the file...($file_name="/usr/local/htdocs/...image.jpg") but how can I make it work with the URL? Thanks for your suggestions...
<? $file_name="http://www.first_site.com/image.jpg" if(isset($upload)){copy($file, "uploads/$dir/$file_name"); } ?> <table border="0" width="80%" cellspacing="5" cellpadding="5"> <form action="<?=$PHP_SELF;?>" method="post" enctype="multipart/form-data"> <tr> <td colspan="2"><input type="hidden" name="max_tam" value="100000"><input type="submit" name="upload" value="Upload"></td> </tr> </form> </table>
attached mail follows:
Carlos,
I may misunderstand you but surely the easiest way to copy a file from one computer to another is by ftp? Log into a shell on computer 1, ftp to computer 2 and transfer whatever files you want. This may be by a simple script and does not need php (did I say that?).
On the other hand, php has ftp functions you can use to do it with php (assuming you compiled php with ftp).
HTH Regards
Chris
Lic. Carlos A. Triana Torres wrote:
>Hello all, > I am learning php and I am trying to make a very simple script so as to >download a jpg from one site I manage to another that I also manage. It >would be, get a jpg from http://www.first_site.com/image.jpg and put in to >http://www.second_site.com/image.jpg. I have tried this, but the only way it >works is if I give the absolute path to the >file...($file_name="/usr/local/htdocs/...image.jpg") but how can I make it >work with the URL? > Thanks for your suggestions... > ><? >$file_name="http://www.first_site.com/image.jpg" > if(isset($upload)){copy($file, "uploads/$dir/$file_name"); } >?> ><table border="0" width="80%" cellspacing="5" cellpadding="5"> > <form action="<?=$PHP_SELF;?>" method="post" >enctype="multipart/form-data"> > <tr> > <td colspan="2"><input type="hidden" name="max_tam" >value="100000"><input type="submit" name="upload" value="Upload"></td> > </tr> > </form> ></table> > > > >
attached mail follows:
Recently I have caught on to XML, and I think it truly is a good idea. Because XML was *made* to store data I believe an XML flatfile database is (perhaps) one of the best ways to store data because it can be easily exchanged. Therefore I would like to embark on the feat of trying to create xml_db_lib, which (as the name suggests) will be a library of XML database functions. This includes everything from adding data, to querying the data. It would greatly help if anyone could point out a PHP application to me that uses a XML database so I can get a better idea of the inner workings of it, also if you have any suggestions I will gladly hear them...
attached mail follows:
On Monday, April 15, 2002, at 01:54 PM, John Weez wrote:
> I have a script which makes a directory. This directory is owned by > nobody.nobody because that is what apache runs as. But, I want this > directory to be owned by a differrent user. So, After making the > directory i use the php command chown to change the directory > ownership. Now, I get an error saying opperation not permitted. > > I figured this is because of some security problems... So i try > dropping in to the shell using teh backtick operator and by also > setting up sudo to give access to the chown command to user > nobody....this does not work from my php script BUT, it does work fine > if i enter it on a shell line...
Are you saying that when you are logged in as "nobody", you can execute "chown otheruser directoryname"? If that is so then PHP, which runs under Apache which runs as "nobody", should also be able to execute that command. But I wonder if you really can execute that command -- why would "nobody" have permission to change the ownership of a file to "otheruser"? I certainly hope that "nobody" doesn't have superuser privileges on your system.
Try using chgrp instead -- you can have "nobody" belong to group "otheruser" and change the group of the file to "otheruser".
NOTE: You're better off running Apache as some other username (like "apacheuser") and under some other group (like "apachegroup"). Several other systems run under "nobody" on most Unix systems, so you could compromise those if "nobody" is compromised.
Erik (somebody)
----Erik Price Web Developer Temp Media Lab, H.H. Brown pricee
hhbrown.com
attached mail follows:
No, user nobody does not have access to chown command. This is part of my problem i suspect.
Erik Price wrote:
> > >> > > Are you saying that when you are logged in as "nobody", you can > execute "chown otheruser directoryname"? If that is so then PHP, > which runs under Apache which runs as "nobody", should also be able to > execute that command.
attached mail follows:
Good day.
As you've probably surmised, chown needs to be run as the root user, even if the file or directory in question is owned by the user wanting to make the change.
Setting up sudo access should work properly. Ensure that the service is actually running as "nobody" and not another unprivileged user.
However, it should be mentioned that this is a very, very insecure method! The chown operator was designed more for PHP command-line scripts that would be run as another user. You may want to re-evaluate why you are changing ownerships of directories from a web page, and determine if there is a safer, more secure way of doing what you want.
============================ Darren Gamble Planner, Regional Services Shaw Cablesystems GP 630 - 3rd Avenue SW Calgary, Alberta, Canada T2P 4L4 (403) 781-4948
-----Original Message-----
From: John Weez [mailto:john
atomfx.com]
Sent: Monday, April 15, 2002 11:55 AM
To: php-general
lists.php.net
Subject: [PHP] chown ..opperation not permitted
Hi all,
My config is Apache 1.3 with PhP4 loaded as a module.
I have a script which makes a directory. This directory is owned by nobody.nobody because that is what apache runs as. But, I want this directory to be owned by a differrent user. So, After making the directory i use the php command chown to change the directory ownership. Now, I get an error saying opperation not permitted.
I figured this is because of some security problems... So i try dropping in to the shell using teh backtick operator and by also setting up sudo to give access to the chown command to user nobody....this does not work from my php script BUT, it does work fine if i enter it on a shell line...
There must be a simple way that I can implement the chown function in php? Any ideas???
John
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
On Mon, Apr 15, 2002 at 10:54:51AM -0700, John Weez wrote: : : I have a script which makes a directory. This directory is owned by : nobody.nobody because that is what apache runs as. But, I want this : directory to be owned by a differrent user. So, After making the : directory i use the php command chown to change the directory ownership. : Now, I get an error saying opperation not permitted.
The 'chown' command can only be executed by the superuser.
The next question to ask is, why do you want this PHP-created directory to be owned by a different user?
-- Eugene Lee eugenefsck.net
attached mail follows:
On Monday, April 15, 2002, at 02:05 PM, John Weez wrote:
> No, user nobody does not have access to chown command. This is part of > my problem i suspect.
So then your "chown" command's permissions do not allow "everyone" to execute it? If this is not the standard setup, so I would speak to your system administrator and find out why "chown" is not available. On most systems I've seen, chown is a standard utility that both its owner, members of its group, an everyone else on the system has access to. This means that "nobody" has access to it as well. Whether or not "nobody" has permission to change the ownership of a file to someone else is another matter entirely.
Erik
----Erik Price Web Developer Temp Media Lab, H.H. Brown pricee
hhbrown.com
attached mail follows:
On Monday, April 15, 2002, at 02:22 PM, Darren Gamble wrote:
> Setting up sudo access should work properly. Ensure that the service is > actually running as "nobody" and not another unprivileged user. > > However, it should be mentioned that this is a very, very insecure > method! > The chown operator was designed more for PHP command-line scripts that > would > be run as another user. You may want to re-evaluate why you are > changing > ownerships of directories from a web page, and determine if there is a > safer, more secure way of doing what you want.
Yes, I wouldn't give "nobody" privileges to do anything with sudo. You're better off making "nobody" a member of the same group as the other user, and using chgrp.
erik
----Erik Price Web Developer Temp Media Lab, H.H. Brown pricee
hhbrown.com
attached mail follows:
I need to calculate the date to see if it's a holiday, i.e. is today presidents day, which happens to be the third monday of february. Can someone point me to some code that can do that?
attached mail follows:
On Monday, April 15, 2002, at 03:17 PM, Tom Beidler wrote:
> I need to calculate the date to see if it's a holiday, i.e. is today > presidents day
No, today is Patriot's Day!
Not sure if it's celebrated outside of Massachusetts....
Erik
----Erik Price Web Developer Temp Media Lab, H.H. Brown pricee
hhbrown.com
attached mail follows:
<? $month = date("m"); $day = date("d"); if ($month == "10" && $day == "31") { print "It's Halloween!"; } ?>
you could do something similar to that.
tyler
----- Original Message -----
From: "Tom Beidler" <tom
orbittechservices.com>
To: "php list" <php-general
lists.php.net>
Sent: Monday, April 15, 2002 2:17 PM
Subject: [PHP] calculating US holidays
> I need to calculate the date to see if it's a holiday, i.e. is today > presidents day, which happens to be the third monday of february. Can > someone point me to some code that can do that? > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
That's fine for fixed dates, and I have that figured out, but presidents day, memorial day, labor day and thanksgiving fall on different days each year. Presidents day is the third monday of February. How do I calculate that?
> From: "Tyler Longren" <tyler
captainjack.com>
> Organization: Captain Jack Communications
> Date: Mon, 15 Apr 2002 14:48:15 -0500
> To: "Tom Beidler" <tom
orbittechservices.com>, "php list"
> <php-general
lists.php.net>
> Subject: Re: [PHP] calculating US holidays
>
> <?
> $month = date("m");
> $day = date("d");
> if ($month == "10" && $day == "31") {
> print "It's Halloween!";
> }
> ?>
>
> you could do something similar to that.
>
> tyler
>
> ----- Original Message -----
> From: "Tom Beidler" <tom
orbittechservices.com>
> To: "php list" <php-general
lists.php.net>
> Sent: Monday, April 15, 2002 2:17 PM
> Subject: [PHP] calculating US holidays
>
>
>> I need to calculate the date to see if it's a holiday, i.e. is today
>> presidents day, which happens to be the third monday of february. Can
>> someone point me to some code that can do that?
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
attached mail follows:
He wants the third sunday in february which can't be handled by your code :) since the third sunday could fall on any number of days. The following isn't very optimal but will work (not syntax checked either).
$i = 1; while( $i++ <= 7 ) { // // First we find the first Sunday in February. // if( date( '%a', mktime( 0,0,0, 2,$i,2002 ) == 'Sun' ) { break; } }
return date( '%s-%m-%Y', mktime( 0,0,0, 2,($i + 14),2002 );
Generalization of the above is left to you as an exercise *grin*.
Cheers,
Rob.
-----------------------------------------------------------------
Tyler Longren wrote:
>
> <?
> $month = date("m");
> $day = date("d");
> if ($month == "10" && $day == "31") {
> print "It's Halloween!";
> }
> ?>
>
> you could do something similar to that.
>
> tyler
>
> ----- Original Message -----
> From: "Tom Beidler" <tom
orbittechservices.com>
> To: "php list" <php-general
lists.php.net>
> Sent: Monday, April 15, 2002 2:17 PM
> Subject: [PHP] calculating US holidays
>
> > I need to calculate the date to see if it's a holiday, i.e. is today
> > presidents day, which happens to be the third monday of february. Can
> > someone point me to some code that can do that?
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
-- .-----------------. | Robert Cummings | :-----------------`----------------------------. | Webdeployer - Chief PHP and Java Programmer | :----------------------------------------------: | Mail : mailto:robert.cummingswebmotion.com | | Phone : (613) 731-4046 x.109 | :----------------------------------------------: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `----------------------------------------------'
attached mail follows:
You could port Date::Calc from perl... or just call a perl script to do the calculation. Probably the easiest way to figure out Easter (for the extreme example) that I can think of.
-Steve
On Monday, April 15, 2002, at 03:05 PM, Tom Beidler wrote:
> That's fine for fixed dates, and I have that figured out, but presidents
> day, memorial day, labor day and thanksgiving fall on different days
> each
> year. Presidents day is the third monday of February. How do I calculate
> that?
>
>> From: "Tyler Longren" <tyler
captainjack.com>
>> Organization: Captain Jack Communications
>> Date: Mon, 15 Apr 2002 14:48:15 -0500
>> To: "Tom Beidler" <tom
orbittechservices.com>, "php list"
>> <php-general
lists.php.net>
>> Subject: Re: [PHP] calculating US holidays
>>
>> <?
>> $month = date("m");
>> $day = date("d");
>> if ($month == "10" && $day == "31") {
>> print "It's Halloween!";
>> }
>> ?>
>>
>> you could do something similar to that.
>>
>> tyler
>>
>> ----- Original Message -----
>> From: "Tom Beidler" <tom
orbittechservices.com>
>> To: "php list" <php-general
lists.php.net>
>> Sent: Monday, April 15, 2002 2:17 PM
>> Subject: [PHP] calculating US holidays
>>
>>
>>> I need to calculate the date to see if it's a holiday, i.e. is today
>>> presidents day, which happens to be the third monday of february. Can
>>> someone point me to some code that can do that?
>>>
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Oh, I love these 32 second answers ;-) Just type it in google and zapp http://php.resourceindex.com/Functions_and_Classes/Date_and_Time/ 1st page, second answer ! G Oliver
At 15.04.2002 13:05, you wrote:
>
>That's fine for fixed dates, and I have that figured out, but presidents
>day, memorial day, labor day and thanksgiving fall on different days each
>year. Presidents day is the third monday of February. How do I calculate
>that?
>
> > From: "Tyler Longren" <tyler
captainjack.com>
> > Organization: Captain Jack Communications
> > Date: Mon, 15 Apr 2002 14:48:15 -0500
> > To: "Tom Beidler" <tom
orbittechservices.com>, "php list"
> > <php-general
lists.php.net>
> > Subject: Re: [PHP] calculating US holidays
> >
> > <?
> > $month = date("m");
> > $day = date("d");
> > if ($month == "10" && $day == "31") {
> > print "It's Halloween!";
> > }
> > ?>
> >
> > you could do something similar to that.
> >
> > tyler
> >
> > ----- Original Message -----
> > From: "Tom Beidler" <tom
orbittechservices.com>
> > To: "php list" <php-general
lists.php.net>
> > Sent: Monday, April 15, 2002 2:17 PM
> > Subject: [PHP] calculating US holidays
> >
> >
> >> I need to calculate the date to see if it's a holiday, i.e. is today
> >> presidents day, which happens to be the third monday of february. Can
> >> someone point me to some code that can do that?
> >>
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
> >
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hi This is one way:
echo date("d/m/Y",strtotime("third sunday",strtotime("2/1/2002")));
Tom
At 05:17 AM 16/04/2002, Tom Beidler wrote: >I need to calculate the date to see if it's a holiday, i.e. is today >presidents day, which happens to be the third monday of february. Can >someone point me to some code that can do that? > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hi Perhaps that should have been:
echo date("d/m/Y",strtotime("third monday",strtotime("2/1/2002")));
:-) Tom
At 05:17 AM 16/04/2002, Tom Beidler wrote: >I need to calculate the date to see if it's a holiday, i.e. is today >presidents day, which happens to be the third monday of february. Can >someone point me to some code that can do that? > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
If you are using mysql, you can perform the calculations in mysql during the SELECT, such as: SELECT date_field - INTERVAL 7 HOUR FROM my_table;
----- Original Message ----- On Monday, April 15, 2002, at 09:50 AM, Torkil Johnsen wrote:
> "What date/time was it 7 hours ago"? > > I'm just trying to make a log using mysql/php > This log is kinda supposed to show the time, local to the user. > > So I store datetime on the format YYYY-MM-DD HH:MM:SS in a datetime > field. > Using the php date function to get the date. > > This will store the time that right then ON THE SERVER. > > Now, when fetching data from the mysql table, I want to display what the > time WAS, LOCALLY (where I'm at, not the server) when the log entry was > made. > > So. How do I make a function that takes in YYYY-MM-DD HH:MM:SS and > spits out > the YYYY-MM-DD HH:MM:SS minus... for instance, 7 hours? > > "What date/time was it 7 hours ago"? > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
// second selection for main image on main page $dir_name = "/path/to/images/directory/"; $dir = opendir($dir_name); $file_lost .= "<p><FORM METHOD=\"post\" ACTION=\"done.php3\" NAME=\"ad01\"> <SELECT NAME=\"images\">"; while ($file_names = readdir($dir)) { if ($file_names != "." && $file_names !=".." && eregi('_[0-9]{4}.jpg$', $file_name)) { $file_lost .= "<OPTION VALUE=\"$file_names\" NAME=\"$file_names\">$file_names</OPTION>"; } } $file_lost .= "</SELECT><br><br><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"select\"></FORM></p>"; closedir($dir);
My problem is with the eregi() function to filter out files without the following criteria *_4444.jpg, it must have an underscore followed by 4 numbers and then ending in .jpg file extension. I have tried a few different methods to try and get this to work however I think I am missing something. All of the documentation I have read on php.net states that this string should work as is... I have checked the contents of the directory and I only have files of these two types... filename_logo.jpg filename_0103.jpg Could anyone enlighten me on how this is not working? Thanks in advance, Jas
attached mail follows:
jas wrote: > > // second selection for main image on main page > $dir_name = "/path/to/images/directory/"; > $dir = opendir($dir_name); > $file_lost .= "<p><FORM METHOD=\"post\" ACTION=\"done.php3\" NAME=\"ad01\"> > <SELECT NAME=\"images\">"; > while ($file_names = readdir($dir)) { > if ($file_names != "." && $file_names !=".." && eregi('_[0-9]{4}.jpg$', > $file_name)) { > $file_lost .= "<OPTION VALUE=\"$file_names\" > NAME=\"$file_names\">$file_names</OPTION>"; > } > } > $file_lost .= "</SELECT><br><br><INPUT TYPE=\"submit\" NAME=\"submit\" > VALUE=\"select\"></FORM></p>"; > closedir($dir); > > My problem is with the eregi() function to filter out files without the > following criteria *_4444.jpg, it must have an underscore followed by 4 > numbers and then ending in .jpg file extension. I have tried a few > different methods to try and get this to work however I think I am missing > something. All of the documentation I have read on php.net states that this > string should work as is... I have checked the contents of the directory and > I only have files of these two types... > filename_logo.jpg > filename_0103.jpg > Could anyone enlighten me on how this is not working? > Thanks in advance,
I hope I'm reading right... it seems you want to filter OUT files with the extension '_4444.jpg' the above check appears to be filtering out everything BUT these files. I think you want the following check:
if( $file_names != "." && $file_names !=".." && !eregi( '_[0-9]{4}\.jpg$', $file_name) )
Cheers, Rob.
-- .-----------------. | Robert Cummings | :-----------------`----------------------------. | Webdeployer - Chief PHP and Java Programmer | :----------------------------------------------: | Mail : mailto:robert.cummingswebmotion.com | | Phone : (613) 731-4046 x.109 | :----------------------------------------------: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `----------------------------------------------'
attached mail follows:
I must be doing something wrong, for that solution did not work.
"Robert Cummings" <robert.cummings
webmotion.com> wrote in message
news:3CBB2D74.A8CA0852
webmotion.com...
> jas wrote:
> >
> > // second selection for main image on main page
> > $dir_name = "/path/to/images/directory/";
> > $dir = opendir($dir_name);
> > $file_lost .= "<p><FORM METHOD=\"post\" ACTION=\"done.php3\"
NAME=\"ad01\">
> > <SELECT NAME=\"images\">";
> > while ($file_names = readdir($dir)) {
> > if ($file_names != "." && $file_names !=".." &&
eregi('_[0-9]{4}.jpg$',
> > $file_name)) {
> > $file_lost .= "<OPTION VALUE=\"$file_names\"
> > NAME=\"$file_names\">$file_names</OPTION>";
> > }
> > }
> > $file_lost .= "</SELECT><br><br><INPUT TYPE=\"submit\" NAME=\"submit\"
> > VALUE=\"select\"></FORM></p>";
> > closedir($dir);
> >
> > My problem is with the eregi() function to filter out files without the
> > following criteria *_4444.jpg, it must have an underscore followed by 4
> > numbers and then ending in .jpg file extension. I have tried a few
> > different methods to try and get this to work however I think I am
missing
> > something. All of the documentation I have read on php.net states that
this
> > string should work as is... I have checked the contents of the directory
and
> > I only have files of these two types...
> > filename_logo.jpg
> > filename_0103.jpg
> > Could anyone enlighten me on how this is not working?
> > Thanks in advance,
>
> I hope I'm reading right... it seems you want to filter OUT files with
> the extension '_4444.jpg' the above check appears to be filtering out
> everything BUT these files. I think you want the following check:
>
> if( $file_names != "."
> &&
> $file_names !=".."
> &&
> !eregi( '_[0-9]{4}\.jpg$', $file_name) )
>
> Cheers,
> Rob.
> --
> .-----------------.
> | Robert Cummings |
> :-----------------`----------------------------.
> | Webdeployer - Chief PHP and Java Programmer |
> :----------------------------------------------:
> | Mail : mailto:robert.cummings
webmotion.com |
> | Phone : (613) 731-4046 x.109 |
> :----------------------------------------------:
> | Website : http://www.webmotion.com |
> | Fax : (613) 260-9545 |
> `----------------------------------------------'
attached mail follows:
i was wondering if it would be possible to make a web spider in PHP. they work by download a website, then following all the links on the website to other pages, and then following the links on that page...
is this possible in PHP without a whole lot of work? i just want to keep a counter of how many links (not e-mail addresses or file downloads) it finds. if someone has the time, could you write up a quick recursive script that i could use as a basis of my project?
thanks ~toaster©
attached mail follows:
On Mon, 15 Apr 2002, Ryan Govostes wrote:
>i was wondering if it would be possible to make a web spider in PHP. >they work by download a website, then following all the links on the >website to other pages, and then following the links on that page... > >is this possible in PHP without a whole lot of work? i just want to keep >a counter of how many links (not e-mail addresses or file downloads) it >finds. if someone has the time, could you write up a quick recursive >script that i could use as a basis of my project?
Well, I love PHP, but this sounds more like a job for C/C++. The reason being is the socket support in C/C++ is way better than that found in PHP. Harder to code mind you, but better in the end.
Also, you might want to check out some exisiting applications that already do this sort of thing, there's no need in re-inventing the wheel. I use htdig and it works swell for small projects where you need to index a small to medium sized website for later searching.
-- ----------------------------------------------------------------------- Greg Donald - http://destiney.com/ http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/ -----------------------------------------------------------------------
attached mail follows:
You most certainly can use PHP to do this.
And if i'm not wrong I think there are allready scripts which do this (which wouldn't be too hard to hack up for yourself)
Check out hotscripts.com
Andrew
----- Original Message -----
From: "Ryan Govostes" <panic
twcny.rr.com>
To: "PHP People" <php-general
lists.php.net>
Sent: Monday, April 15, 2002 8:42 PM
Subject: [PHP] web spider?
i was wondering if it would be possible to make a web spider in PHP. they work by download a website, then following all the links on the website to other pages, and then following the links on that page...
is this possible in PHP without a whole lot of work? i just want to keep a counter of how many links (not e-mail addresses or file downloads) it finds. if someone has the time, could you write up a quick recursive script that i could use as a basis of my project?
thanks ~toaster©
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Ryan,
You might want to look into this as a basis for some of your code,
http://agent-source.com/sitemapper/
Contains a good ammount of "spidering" code that's broken down into small functions. ( not that I understand half of it ; )
Good luck
-- s t e v e b i s s o n n e t t e steveplankdesign.com
PLANK. A multi-faceted-media company. http://www.plankdesign.com v. 514.875.0003 f. 514.875.7611
on 4/15/02 3:42 PM, Ryan Govostes at panic
twcny.rr.com wrote:
> i was wondering if it would be possible to make a web spider in PHP. > they work by download a website, then following all the links on the > website to other pages, and then following the links on that page... > > is this possible in PHP without a whole lot of work? i just want to keep > a counter of how many links (not e-mail addresses or file downloads) it > finds. if someone has the time, could you write up a quick recursive > script that i could use as a basis of my project? > > thanks > ~toaster© > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
Greg,
> >i was wondering if it would be possible to make a web spider in PHP. > >they work by download a website, then following all the links on the > >website to other pages, and then following the links on that page... > > > >is this possible in PHP without a whole lot of work? i just want to keep > >a counter of how many links (not e-mail addresses or file downloads) it > >finds. if someone has the time, could you write up a quick recursive > >script that i could use as a basis of my project? > > Well, I love PHP, but this sounds more like a job for C/C++. The reason > being is the socket support in C/C++ is way better than that found in PHP. > Harder to code mind you, but better in the end.
I learned from the manual and coded up a quick page-reader/status checker using fopen and fread - and thought I was fairly clever for something so 'quick and dirty'. However perhaps this approach would not work if something a bit more 'demanding' was required. Please would you explain the advantage/necessity for using sockets (would appreciate pointers to any reading/tutorials).
Thanks, =dn
attached mail follows:
Hello All,
I looking to to generate different meta tags from mysql for each page on a dynamic site which has about 400 pages from mysql database .....
Searched around but didnt find anything which will give me some hint whats the best way doing it....
Any help appreciated :)
Thanks,
Andras Kende
andras
kende.com
attached mail follows:
Mysql table with a meta column and a url column:
$url = $PHP_SELF;
$sql = "SELECT meta FROM table WHERE url = '$url'";
Just select from the database a meta column depending on the url people are.
--Julio Nobrega.
Um dia eu chego lį: http://sourceforge.net/projects/toca
Ajudei? Salvei? Que tal um presentinho? http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884
"Andras Kende" <andras
kende.com> wrote in message news:000a01c1e4b9$293052c0$b59fb841
a... > Hello All, > > I looking to to generate different meta tags from mysql for each page on a > dynamic > site which has about 400 pages from mysql database ..... > > Searched around but didnt find anything which will give me some hint whats > the best way doing it.... > > Any help appreciated :) > > Thanks, > > Andras Kende > andras
kende.com > >
attached mail follows:
Hi All
I was trying to write a PHP session and was confused whether to use session_register or $_SESSION. Anyone know when to use either of these? (Or an interpretation of the following line)?
Use of $_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended for security and code readablity. With $_SESSION or $HTTP_SESSION_VARS, there is no need to use session_register()/session_unregister()/session_is_registered() functions. Users can access session variable like a normal variable.
Thanks dave lash
> ----------
> From: Tyler Longren[SMTP:tyler
captainjack.com]
> Sent: Monday, April 15, 2002 2:48 PM
> To: Tom Beidler; php list
> Subject: Re: [PHP] calculating US holidays
>
> <?
> $month = date("m");
> $day = date("d");
> if ($month == "10" && $day == "31") {
> print "It's Halloween!";
> }
> ?>
>
> you could do something similar to that.
>
> tyler
>
> ----- Original Message -----
> From: "Tom Beidler" <tom
orbittechservices.com>
> To: "php list" <php-general
lists.php.net>
> Sent: Monday, April 15, 2002 2:17 PM
> Subject: [PHP] calculating US holidays
>
>
> > I need to calculate the date to see if it's a holiday, i.e. is today
> > presidents day, which happens to be the third monday of february. Can
> > someone point me to some code that can do that?
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
You are getting "array" because that's what $eventdate is.
Now, WHAT do you REALLY want to insert?
----- Original Message -----
From: Alex Francis <afrancis
camerondesign.co.uk>
To: <php-db
lists.php.net>
Sent: Monday, April 15, 2002 3:13 PM
Subject: [PHP-DB] Arrays
I am trying to insert event dats into a database and to make sure the user puts the date in the correct format. I am now trying to collect the information from the three fields and insert it into one field.
code as follows: $eventdate = array ("eventyear", "eventmonth", "eventday");
when I insert it into the database like: $query = "INSERT INTO $tablename4 VALUES ('0', '$entername', '$date', '$eventdate', '$eventheading', '$eventbody' )";
for the $eventdate variable the word "array" is inserted.
Could someone please tell me where I am going wrong.
-- Alex Francis Cameron Design 35, Drumillan Hill Greenock PA16 0XDTel 01475 798106 afrancis
camerondesign.co.uk http://www.camerondesign.co.uk
This message is sent in confidence for the addressee only. It may contain legally privileged information. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission.
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
I need to know if there is one place to get information on creating a credit card validation script based on the users selected payment type (i.e. mastercard, visa, american express, etc.) If anyone knows of a good tutorial or sample of such a function please point me that way. thanks in advance, Jas
attached mail follows:
Check out the code section at Zend.com.. There is at least one CCVal function there.. I think two.. I do believe hotscripts.com has some too in their PHP section..
Later,
Bob Weaver
"Jas" <jlgerfen
hotmail.com> wrote in message
news:20020415203734.1730.qmail
pb1.pair.com...
> I need to know if there is one place to get information on creating a
credit
> card validation script based on the users selected payment type (i.e.
> mastercard, visa, american express, etc.) If anyone knows of a good
> tutorial or sample of such a function please point me that way.
> thanks in advance,
> Jas
>
>
attached mail follows:
On Tue, Apr 16, 2002 at 02:41:53AM -0600, jas wrote: > I need to know if there is one place to get information on creating a credit > card validation script based on the users selected payment type (i.e. > mastercard, visa, american express, etc.)
I've got the best one out there. Automatically determines the card type from the card number. Accurately checks cards from American Express, Australian BankCard, Carte Blache, Diners Club, Discover/Novus, JCB, MasterCard and Visa.
http://www.analysisandsolutions.com/code/ccvs-ph.htm
That's the PHP version. It also comes in Perl and Visual Basic flavors.
--
PHP classes that make web design easier
SQL Solution | Layout Solution | Form Solution
sqlsolution.info | layoutsolution.info | formsolution.info
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
attached mail follows:
Hi, I am just not seeing what is wrong with my code.
Can anyone tell me if there is anything wrong with the following function?
function set_material_id($material_id) { if (!preg_match('/^\d{1,3}$/', $material_id)) { return false; } else { $this->ff_material_id = $material_id; } }
The value being passed to this function is "1" (contained in a POST form field named "ffmaterial0"), yet it is returning false. I have a test in my script that looks like this:
} elseif (!$ff_instance->set_material_id($_POST["ffmaterial{$ff_counter}"])) { die("set_material_id() method of \$ff_instance failed");
And I am getting the "die()" error message. $ff_counter is 0, the first iteration of a for loop.
Can anyone see a problem with this, or at least confirm that I'm not crazy?
Erik
----Erik Price Web Developer Temp Media Lab, H.H. Brown pricee
hhbrown.com
attached mail follows:
Erik Price wrote: > > Hi, I am just not seeing what is wrong with my code. > > Can anyone tell me if there is anything wrong with the following > function? > > function set_material_id($material_id) > { > if (!preg_match('/^\d{1,3}$/', $material_id)) { > return false; > } else { > $this->ff_material_id = $material_id; > } > } > > The value being passed to this function is "1" (contained in a POST form > field named "ffmaterial0"), yet it is returning false. I have a test in > my script that looks like this: > > } elseif > (!$ff_instance->set_material_id($_POST["ffmaterial{$ff_counter}"])) { > die("set_material_id() method of \$ff_instance failed"); > > And I am getting the "die()" error message. $ff_counter is 0, the first > iteration of a for loop. > > Can anyone see a problem with this, or at least confirm that I'm not > crazy?
Well you don't return true anywhere... default return is false which is what happens if the else statement is reached.
Cheers, Rob.
-- .-----------------. | Robert Cummings | :-----------------`----------------------------. | Webdeployer - Chief PHP and Java Programmer | :----------------------------------------------: | Mail : mailto:robert.cummingswebmotion.com | | Phone : (613) 731-4046 x.109 | :----------------------------------------------: | Website : http://www.webmotion.com | | Fax : (613) 260-9545 | `----------------------------------------------'
attached mail follows:
On Monday, April 15, 2002, at 04:58 PM, Robert Cummings wrote:
> Well you don't return true anywhere... default return is false which is > what happens if the else statement is reached.
EUREKA! Thanks so much Rob! I too busy wondering how the preg_match was failing to notice that I didn't even have a return true!
Now, back to work. I can stop fuming around the room.
Erik
----Erik Price Web Developer Temp Media Lab, H.H. Brown pricee
hhbrown.com
attached mail follows:
http://woodenpickle.com:8080/shop/admin.php
login: shopadmin pass: demo
Later,
Bob
"Robert Collins" <RCollins
NORTA.COM> wrote in message
news:D54DBC194E89D411ABA1000629551764601FA3
rtamail.norta.com...
> Can anyone recommend a good commercial shopping cart written in php?
>
> Robert W. Collins II
> Webmaster
> New Orleans Regional Transit Authority
> Phone : (504) 248-3826
> Email : rcollins
norta.com
attached mail follows:
Hubert,
It may just be the way you typed it in the email but your "products.php?tosend = 1" has spaces in it. This will truncate the tosend parameter and give it a null value.
HTH Regards
Chris
Janet Valade wrote:
>>On the browser i have a page in which i select the first button which has >>a link in the form of "products.php?tosend = 1" >>but in the second pagein where I try to trap the value of tosend to >>include a file, i don't get anything. >> > >I assume you mean that you can see the value in the URL, but when you access >$tosend, it has no value. You should be able to get it from $_GET['tosend']. >Or if you are using a version of PHP prior to 4.1.0, you can use >$HTTP_GET_VARS. The problem may be that you have register_globals turned >off. > >Janet > >>If somebody could help me >> >>TYA >> >>Hubert DAUL >>Lyon - France >> >> >> >> >> >>-- >>PHP General Mailing List (http://www.php.net/) >>To unsubscribe, visit: http://www.php.net/unsub.php >> >> > >
attached mail follows:
> > I need to calculate the date to see if it's a holiday, i.e. is today > > presidents day > > No, today is Patriot's Day! > > Not sure if it's celebrated outside of Massachusetts....
It's celebrated any day there's a SCUD inbound! =dn
attached mail follows:
Well, constructed from the help i received from some of you, this is the end result of my attempts to be able to send email to everyone listed in a file and including their names in the email. i would appreciate any feedback or suggestions for simplification, etc.
<?$doc="emaillist.dat";$fp=fopen("$doc","r"); $contents = fread ($fp,filesize $doc)); fclose($fp);//read file contents into variable $list=explode("\n",$contents); //explode each dataset into array $size=count($list);//count number of array items $size=$size-1;//subtract one for looping process $counter=0;//set counter while($counter<$size){ //do until no more array items $list2=explode("#",$list[$counter]); //explode each dataset into two separate arrays (name/email) $to=$list2[1];//set "to" to email address $subject="Newsletter"; $msg="Hello $list2[0], bla bla bla"; //include name in message mail("$to,$subject,$msg"); //individual mail during loop $counter++; //increment } ?>
i know several of you have expressed concerns about overloading email servers, but since i have less
than 20 people on the list, i'm sure it can handle it.
__________________________________________________ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/
attached mail follows:
At 3:02 AM -0700 15/4/02, Alexander Javier wrote:
>Hello to all. Please help me in this problem of mine. I have an html >template with a frame. I'm using phplib's templating functions to >replace values in the templates. How do i also replace values both in >the main template (frleft.htm) and in the html page contained in the >frame? My code looks like the following:
You can't use PHP to change the content of an existing frame. You can use Javascript, but it gets ugly real fast.
So you will need to regenerate *all* the frames with each request. This requires maintaining state across the frameset and the child frames. You could do that either by embedding a GET string in the URL of the frame pages, or using cookies. I prefer the GET option as it works for all users.
...R.
p.s. PHPLIB questions are best asked at phplib-users
lists.sourceforge.net
attached mail follows:
you get unlimited traffic. here it is very cheep. so they can offer a great service.
www.wthosting.cjb.net
and they also don't pay for a domain. so that means even more cheeper prices. LOL
they crazy. I know they guy, his way of thinking is free is better for the client and for them client gets cheeper prices. they get more moeny.
works, you should see what he drives
"The_radix" <the_radix
hotkey.net.au> wrote in message
news:002801c1e481$34c849e0$3300a8c0
oracle...
> What's the URL of host..
>
>
> Ahh za. I have seen them.. They also run a free php hosting service..
>
>
> Yes ok but how much downloads/transfer off server do you get??
>
>
>
>
>
>
>
> :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
> Julien Bonastre [The-Spectrum.org CEO]
> A.K.A. The_RadiX
> the_radix
hotkey.net.au
> ABN: 64 235 749 494
> Mobile: 0407 122 268
> QUT Student #: 04475739
> :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>
>
> ----- Original Message -----
> From: "Vins" <vins
webonline.co.za>
> To: <php-general
lists.php.net>
> Sent: Monday, April 15, 2002 7:12 AM
> Subject: [PHP] Re: PHP MySQL Hosting services
>
>
> > Hey.
> > I have the best hosting you can get.
> > for only $46 p/m
> >
> > ALL THIS...
> >
> > 400 MB web space
> > Execution of Custom CGI scripts
> > Support for PERL
> > Support for C and C++
> > Support for SSI
> > Support for GCC
> > Support for GD
> > Support for 5 independent MySQL Databases
> >
> > Own URL in the format
> > Extensive Support Forum
> > 99,9% Uptime
> > 24/7/365 Network Monitoring
> > Power Back-up & Generator
> > Daily Back-ups
> > Web Site Control Panel
> > FTP User Login
> > 25 POP3 Accessible Mailbox(es)
> > Unlimited E-mail Aliases
> > Online Mail Administration Tool
> > Online Web Mailbox
> > Advanced E-mail Forwarding
> > E-mail Auto Responder
> > Form to e-mail CGI script (cgiemail and formmail.pl)
> > Access to CGI Counter and Counter Configurations Tool
> > Daily Log Files
> > Graphic Statistics Report
> > Disk Usage Monitor
> > Full range of MIME types
> > Execution of PHP scripts (PHP4)
> > Telnet Access (activated on request)
> > SSH Access (activated on request)
> > Microsoft Frontpage 2000 Extensions (activated on request)
> > 5 Databases with MySQL
> > CGI Shopping Cart
> > Custom CGI
> > Support for SSI
> > Perl
> > C, C++
> > GCC
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
attached mail follows:
Vins wrote: > you get unlimited traffic. > here it is very cheep. > so they can offer a great service. > > www.wthosting.cjb.net > > and they also don't pay for a domain. > so that means even more cheeper prices. > LOL > > they crazy. > I know they guy, his way of thinking is free is better for the client and > for them > client gets cheeper prices. > they get more moeny. >
So, that $14.95/year he saves on his own domain name is split between, what, 10 clients and each one is saving $1.50/year? Wow! That's over 10 cents per month he's saving his clients!.
Maybe he should get rid of the phone lines too - that would save even MORE money, and mean even CHEAPER prices for people! There's no end to how much money he can save us!
> works, you should see what he drives >
Did he pay cash? Or is he leasing? "Fake it till you make it" is quite a popular lifestyle for many people. :)
Michael Kimsal http://www.phphelpdesk.com 734-480-9961
attached mail follows:
At 4:06 AM -0700 15/4/02, Thomas Edison Jr. wrote:
>I have a table with a column vProName, which >let's say, contains a record "Basket Ball Game". >Now what i want is that if someone searches for "Game" >or "Ball", even then this record should appear.
Either "select * from ThatTable where vProName like '%Game%'"
or for better performance and result ranking:
http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#Fulltext_Search
...R.
attached mail follows:
I'm trying to build some sort of AI chat bot in php (yes, I know I'm crazy). To do this, I need some way to check for the presence of any value from an array. Example:
$pharray = array("php","the best language ever"); if($question == "What is ".anything_in_array_function($phparray)."?"){ print "Php is a programming language used mostly as a web scripting language. (put some more stuff about php here)"; }
What is the best way to do something like this?
attached mail follows:
In article <B8E0C44D.C19B%eurleif
buyer-brokerage.com>,
eurleif
buyer-brokerage.com (Leif K-Brooks) wrote:
> I need some way to check for the presence of any value from an > array.
<http://php.net/in-array> <http://php.net/array-search>
-- CC
attached mail follows:
At 5:32 PM +0200 15/4/02, Sear, Mick wrote:
>Not sure if anyone else uses GD much, but I've been experimenting with it >and PHP recently and I've found I get large file sizes and very 'aliased' >graphics.
gd is the correct tool for your job. But there are some caveats.
You will need to be using gd-2.0 or better to get satisfactory results for this sort of work. gd-2.0.1 supports: bicubic interpolation for scaling images 24-bit (true colour) images
Make sure your images aren't being converted to 8-bit at any stage of the scaling/cropping process. Use ImageCreateTrueColor to create images.
Oh, and there's a bug in either php-4.1.2 or gd-2.0.1 where scaling and cropping with one operation using imagecopyresampled fails. I use a work-around of cropping with imagecopyresized and then scaling with imagecopyresampled.
The large file sizes could be improved by reducing the quality of the JPEG compression. Also, once the images have been scaled smoothly, there will be fewer sharp edges allowing JPEG compression to be more efficient.
...R.
attached mail follows:
Hi, I am using the example code at php.net to FTP a file to a remote server. I am trying to overwrite an existing file, but want to maintain the owner/group of the file being overwritten but it keeps giving the overwritten file the owner/group name of the userid that I am loggin in via FTP with. When I do the same with a windows FTP client it does not change the file ownership. How can I make this happen in php's FTP functions? The file I am overwritting is owned by username nobody and I want the overwritten file to maintain that username.
attached mail follows:
Thanks Kevin, someone else suggested using global variable too. I didn't want to do that but I think this is the only way around it.
So if I use a global variable called $row_number and $row_number++ as I print out each row then if two people are viewing the page, there would be two $row_number variables keeping track of the running total for their respectively page, right?
-----Original Message-----
From: Kevin Bucknum [mailto:Kevin
MedtronSoftware.com]
Sent: April 15, 2002 10:29 AM
To: 'php-general
lists.php.net'
Subject: RE: [PHP] Re: Need row number from database select
Keep track of it outside of the function in a global variable.
> -----Original Message-----
> From: SP [mailto:internetracer
yifan.net]
> Sent: Sunday, April 14, 2002 8:28 PM
> To: David Robley; php-general
lists.php.net
> Subject: RE: [PHP] Re: Need row number from database select
>
>
> I see what you are trying to do David but that was what I
> tried first but it
> doesn't work because the function calls itself depending if it's not a
> parent so the alternating colors become all messed up depending on the
> structure of my folders. That's why I was hoping to get the
> number for each
> of the result returned so I could change the color depending
> if it was odd
> or even.
>
> Any other suggestions?
>
>
>
> -----Original Message-----
> From: David Robley [mailto:robleyd
paradise.net.nz]
> Sent: April 14, 2002 6:50 PM
> To: php-general
lists.php.net
> Subject: RE: [PHP] Re: Need row number from database select
>
>
> Well, you don't need to know what row number is. Something like:
>
> function build_folder_tree(&$output, $parent=1, $indent="")
> {
> $color = "red"; // Set var to first option
>
> $qid = mysql_query("SELECT id, name FROM folders WHERE parent_id =
> $parent");
> while ($cat = mysql_fetch_object($qid))
> {
> $output .= $cat->name + $indent; // here is where I want
> to assign diff.
> colors
> $color == "red" ? $color = "blue": $color = "red"; //
> Cycle color for
> each iteration
>
> if ($cat->id != $parent)
> build_folder_tree($output, $cat->id, $indent." ");
> }
> }
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Hi AJ, very interesting way of displaying a folder tree. Never thought of it that way. The problem I see is that you are limited to the depth of the tree because you can't just keep adding a new folder number to the end of the path. And the total number of folders is limited by the number of digits you assign per level. Also why are you using a hex?
-----Original Message-----
From: Aj Lavin [mailto:aj
haightmail.org]
Sent: April 15, 2002 3:24 PM
To: SP
Cc: php-general
lists.php.net
Subject: Re: [PHP] Re: Need row number from database select
On Sun, Apr 14, 2002 at 09:27:50PM -0400, SP wrote: > I see what you are trying to do David but that was what I tried first but it > doesn't work because the function calls itself depending if it's not a > parent so the alternating colors become all messed up depending on the > structure of my folders. That's why I was hoping to get the number for each > of the result returned so I could change the color depending if it was odd > or even. > > Any other suggestions?
It is possible to get all of your folders in a single query if you add a field to your database table that encodes the folder hierarchy positions.
Example:
id path name == ========= ======= 1 1 Home 2 12 Products 3 123 Fruits 4 124 Vegetables 5 1235 Apples
Here we encode the path using one digit per hierarchy level. The path encoding for any folder equals the path encoding of its parent plus the encoding of its id.
If the digits are hex, then this works as long as there are no more than 16 elements in any level of the hierarchy. If you need more, you can use multiple digits per level. I use 8 hex digits to encode 4 byte int's at each level. You would have shorter path names using base 60.
In PostgreSQL, to get the Products directory and all its subdirectories, in order, use:
$root = "12";
$result = pg_exex( $db, "SELECT * FROM folders WHERE path LIKE '{$root}%' ORDER BY path ASC");
Sorry, I don't know MySQL, but all you need to know here is that the '%' char above is a wild card character, like '*' on the command line.
Now you can iterate over the records stored in result. They are in the proper order. The level of any record is the length of the path string divided by the number of digits per level.
Hope this helps.
- Aj
PS: My posts don't show up on the PHP list for some reason, so I am also sending you this directly.
attached mail follows:
Hello,
"Arcadius A." wrote: > > Hello ! > I'm planning to write a database application for MySQL, and then port it to > PostrgeSQL. > Is there any library or class that could help me to write/maintain just one > source code for both MySQL and PostgreSQL ?
I think your best (if not the only) option in PHP is Metabase.
http://www.phpclasses.org/metabase
This is a PHP databases abstraction focused on application portability. AFAIK, it is the only one that provide complete and true data type abstraction. This means that for instance if you have to deal with dates in your application, Metabase assures that you only have to deal with a single date format (ISO 9601 - YYYY-MM-DD HH:MM:SS) even if the underlying databases use other formats. So, when you switch to a different database, you do not have to touch a single thing in your application other that the choice of database type option.
Metabase goes farther, it also abstracts database schema installation and maintenance. This means that it provides a way to describe a schema of database tables, fields, indexes and sequences using a simple XML syntax. Then the Metabase manager class will install it for you in the target database that you use. If you move to another database, Metabase can export the database contents in the same XML format and then you may reinstall the schema in the new database type without loosing information.
Here it is an example of a Metabase schema:
http://www.phpclasses.org/browse.html/file/59.html
Regards, Manuel Lemos
attached mail follows:
Hello,
"Arcadius A." wrote: > > Hello ! > I'm planning to write a database application for MySQL, and then port it to > PostrgeSQL. > Is there any library or class that could help me to write/maintain just one > source code for both MySQL and PostgreSQL ?
I think your best (if not the only) option in PHP is Metabase.
http://www.phpclasses.org/metabase
This is a PHP databases abstraction focused on application portability. AFAIK, it is the only one that provide complete and true data type abstraction. This means that for instance if you have to deal with dates in your application, Metabase assures that you only have to deal with a single date format (ISO 9601 - YYYY-MM-DD HH:MM:SS) even if the underlying databases use other formats. So, when you switch to a different database, you do not have to touch a single thing in your application other that the choice of database type option.
Metabase goes farther, it also abstracts database schema installation and maintenance. This means that it provides a way to describe a schema of database tables, fields, indexes and sequences using a simple XML syntax. Then the Metabase manager class will install it for you in the target database that you use. If you move to another database, Metabase can export the database contents in the same XML format and then you may reinstall the schema in the new database type without loosing information.
Here it is an example of a Metabase schema:
http://www.phpclasses.org/browse.html/file/59.html
Regards, Manuel Lemos
attached mail follows:
Hello,
"Arcadius A." wrote: > > Hello ! > I'm planning to write a database application for MySQL, and then port it to > PostrgeSQL. > Is there any library or class that could help me to write/maintain just one > source code for both MySQL and PostgreSQL ?
I think your best (if not the only) option in PHP is Metabase.
http://www.phpclasses.org/metabase
<snip spam>
you could also use PEAR (http://pear.php.net/) which has a more than adequate abstraction layer for various databases.
But, I doubt even metabase can rewrite your SQL queries for you so that it's optimized for postgres AND mysql (and any other option you would like to choose).
you're much better off either picking one DB system, or use both but maintain seperate SQL for each, to provide full optimization.
james
attached mail follows:
Hello,
James Cox wrote: > > I'm planning to write a database application for MySQL, and then port it > to > > PostrgeSQL. > > Is there any library or class that could help me to write/maintain just > one > > source code for both MySQL and PostgreSQL ? > > I think your best (if not the only) option in PHP is Metabase. > > http://www.phpclasses.org/metabase > > <snip spam> > > you could also use PEAR (http://pear.php.net/) which has a more than > adequate abstraction layer for various databases.
PEAR does not offer a good means of writing portable database applications because it does not have data type abstraction support.
This is important because different databases represent data types differently. For instance, Oracle, unlike other databases, does not have individual time and date field types, only a single type that represents both a full timestamp with time and date. This means that if you just want to store a date on the field you have to use the whole timestamp field and discard the time part. Metabase handles that for you. PEAR does not provide any support for this level of database portability.
I think this is an important point to mention about this limitatation of PEAR because I noticed that a lot of people that use PEAR did not know about it because they develop applications that only deal with text and integers that need little or no conversion, besides any eventual quoting.
As soon they need to use other data types like date and time, when they need to run their applications in different databases, they realize that PEAR was not a good idea because, unlike Metabase, it doesn't handle datatype representation format differences.
This may not be a problem for you James, but it is a problem for a lot of database developers that really care about portability because it costs a lot of time and money to maintain the applications that need to work with different databases if you have to tweak your application to handle the differences of the databases.
This is the main reason why Java JDBC provide such an high level of database application portability, that in the PHP world only has parallel with Metabase.
> But, I doubt even metabase can rewrite your SQL queries for you so that it's > optimized for postgres AND mysql (and any other option you would like to > choose).
Metabase does not rewrite queries. You need to know Metabase better. It just converts datatypes of between a database independent format that applications use and the native database datatype format, if and when the develop wants that.
> you're much better off either picking one DB system, or use both but > maintain seperate SQL for each, to provide full optimization.
If the original poster would not mind to have the major headache of doing that, he would not have posted, don't you think?
Regards, Manuel Lemos
attached mail follows:
<Syd
gmx.net> wrote in message news:22815.1018863179
www1.gmx.net...
> Dear all,
>
> I installed mysql for windows and had to copy some databases (including
> mysql standard databases), that I have to use for my php-project. I also
> installed the Apache server 1.3 ...
>
> My problem is, that I get a connect with mysql_connect("localhost",
> $username, $password); only for the first time after installing an copying
the
> databases. After reboot and starting mysql as a service with mysqladmin
and
> entering password and user in my "login.php", this error occurs:
>
> 2003: Can't connect to MySQL server on 'localhost' (10061)
>
> I tried "telnet localhost 3306" under DOS but connection failed. ( After
> install, it worked ) I tried other users and passwords, which are in
mysql.user
> - but no connect.
>
> I don't have a glimpse of an idea left to do. What do I have to do to get
> the connect with mysql_connect oder do I have to something with the tables
in
> mysql ?
>
> After reboot Mysqladmin shows the tables at least...
>
> so I desperately need help :-(
>
> --
> GMX - Die Kommunikationsplattform im Internet.
> http://www.gmx.net
>
Have you started the MySQL server before trying to connect to it?
attached mail follows:
Being completely new to PHP I went to this site for help on how to print reports. Thanks for all the ideas.
I guess being a newbe, I was wondering if this is kind of the standard way most of you do all your reporting.
Based on all the help I got, I did the following: 1. Wrote a report writer with multiple header breaks, multiple total breaks. Selection of data in the detail , headers, and totals. Selection of 5 sort orders, and join selections. They select who gets copies of the report (up to 100 in the selection). 3. They give the report a name, and can execute it anytime. Or it can be fired with date triggers defined in item 1. Like every Friday at 10AM. etc. 4. I wrote a report file system. When a report fires it shows up in your IN-BASKET. When you delete it it goes to the Waste-Basket for 10 days. The file has the name of the report, number of lines, number of pages, who owns the report, when run and any comments set up in the report definition in item 1. 5. All reports run on the server, so they are fast. The report is stored in mySQL only once and everyone who gets the report has their IN-BASKET point to it. 6. Anyone can file the report or copy the report to multiple files or mail it to anyone. For example file a report from IN-BASKET to the Daily-Log file etc. The mail basically creates another entry in the recipient's IN-BASKET. 7. If you view a report it brings up as many pages at a time as you want (default is 5). you can move from page to page with arrows, or bring up the another section, or the whole report. You can print the report.
I know this is a fairly simple reporting system. Just wondering if I'm on the right track.
Thanks again for all the help..
attached mail follows:
I have created a website that works somewhat uniquely. Every page is created using the root index.php file. I have an .htaccess document that redirects all 404 errors to this index.php file.
So if someone access www.mydomain.com/mypage.html the index.php file is called and knows what to do. The problem I am having is that it throws off all of the variables in PHP. First of all, if the page is called using a form the POST variables are not posted. Secondly, included files do not seem to be able to access global variables in the same way.
What can I do????
_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
attached mail follows:
Is a nicer way to remove any number 1-0 from a string???
Currently: $metakeywords=str_replace("1",'',strtolower($metakeywords)); $metakeywords=str_replace("2",'',strtolower($metakeywords)); $metakeywords=str_replace("3",'',strtolower($metakeywords)); $metakeywords=str_replace("4",'',strtolower($metakeywords)); $metakeywords=str_replace("5",'',strtolower($metakeywords)); $metakeywords=str_replace("6",'',strtolower($metakeywords)); ......
Thanks :)
Andras Kende
attached mail follows:
"Andras Kende" <andras
kende.com> wrote:
> Is a nicer way to remove any number 1-0 from a string??? > > Currently: > $metakeywords=str_replace("1",'',strtolower($metakeywords)); > $metakeywords=str_replace("2",'',strtolower($metakeywords)); > $metakeywords=str_replace("3",'',strtolower($metakeywords)); > $metakeywords=str_replace("4",'',strtolower($metakeywords)); > $metakeywords=str_replace("5",'',strtolower($metakeywords)); > $metakeywords=str_replace("6",'',strtolower($metakeywords)); > ......
use a regular expression with ereg_replace(), like this:
$metakeywords = ereg_replace('[0-9]', '', $metakeywords);
hope that helps justin
attached mail follows:
Hi. Does anyone know how to POST data to another script as if a form had done so? I want to POST some data to a script on another site and retrieve the data that is returned so i can poick it apart, i did it in ASP using a 3rd party component... just wondering if the same could be done in PHP.
Any help appreciated.
Cheers,
.ben
attached mail follows:
Can I get some feedback on the conventional wisdom as to the best solution for high volume registration and authentication of users accessing a secure site? I have worked before with database/session based methods as well as htaccess. Which is preferred? Are there alternatives?
Thanks for the feedback, Brad
attached mail follows:
Hello,
Brad Hubbard wrote: > > Can I get some feedback on the conventional wisdom as to the best solution > for high volume registration and authentication of users accessing a secure > site? I have worked before with database/session based methods as well as > htaccess. Which is preferred? Are there alternatives?
Probably the fastest way to keep session profile information is by serializing the data array into a string that will be encrypted and then stored in cookie. The security weakness of this method is that if the secret key leaks, hackers may use to forge new sessions.
A more secure but eventually less scalable method is to store the session data in a shared memory cache, so you minimize database accesses to just one after the server is restarted. This is probably the one you want to use as long you know how to deal with shared memory and semaphores.
Regards, Manuel Lemos
attached mail follows:
cacti
http://www.raxnet.net/products/cacti/
Allen Lee http://www.modwest.com Modwest PHP Hosting
On Mon, 15 Apr 2002, Jason Wong wrote:
> On Monday 15 April 2002 07:14, Christian Calloway wrote: > > hey ppl, > > > > I need to create some fairly complex graphs dynamically, and I need to be > > able to specify line, bar, or pie charts. Are there any PHP packages that > > someone could point me to that would fill my needs. Thanks > > There is jpgraph. Also take a look in www.phpclasses.org. > >
attached mail follows:
On Tue, 16 Apr 2002 14:01, Manuel Lemos did align ASCII characters thusly: > Probably the fastest way to keep session profile information is by > serializing the data array into a string that will be encrypted and then > stored in cookie. The security weakness of this method is that if the > secret key leaks, hackers may use to forge new sessions.
Is this documented anywhere?
> A more secure but eventually less scalable method is to store the > session data in a shared memory cache, so you minimize database accesses > to just one after the server is restarted. This is probably the one you > want to use as long you know how to deal with shared memory and > semaphores.
Is this documented anywhere?
My understanding was that htaccess authentication was more secure that session based because of the porblems of session hijacking???
Brad
attached mail follows:
Hello,
Brad Hubbard wrote: > > On Tue, 16 Apr 2002 14:01, Manuel Lemos did align ASCII characters thusly: > > Probably the fastest way to keep session profile information is by > > serializing the data array into a string that will be encrypted and then > > stored in cookie. The security weakness of this method is that if the > > secret key leaks, hackers may use to forge new sessions. > > Is this documented anywhere?
Yes, but where I know I can't tell you because it is part of a proprietary system. Maybe somebody else did it like this and documented somewhere but I have no knowledge of that. Anyway what part didn't you understand?
> > A more secure but eventually less scalable method is to store the > > session data in a shared memory cache, so you minimize database accesses > > to just one after the server is restarted. This is probably the one you > > want to use as long you know how to deal with shared memory and > > semaphores. > > Is this documented anywhere?
Probably only in my mind . :-)
> My understanding was that htaccess authentication was more secure that > session based because of the porblems of session hijacking???
I guess you mean HTTP based authentication. No, AFAIK that is very unsecure because you can't end a "session" because browsers cache authenticated passwords and only drop them (of they do, IE may not do it) when you quit your browser. If you leave your browser terminal for some time, somebody may come in and take advantage of your account privileges.
Regards, Manuel Lemos
attached mail follows:
At 2:11 PM +1000 16/4/02, Brad Hubbard wrote: >On Tue, 16 Apr 2002 14:01, Manuel Lemos did align ASCII characters thusly: >> Probably the fastest way to keep session profile information is by >> serializing the data array into a string that will be encrypted and then >> stored in cookie. The security weakness of this method is that if the >> secret key leaks, hackers may use to forge new sessions. > >Is this documented anywhere?
What aspect of it do you want to see documentation for?
Try: http://www.google.com/search?q=cookie+session+hijack
I also have a bookmark to: http://cookies.lcs.mit.edu/ I recall that site has a link to a security study of high-profile sites and their insecure use of cookies. But the site is not reachable from here at present.
>> A more secure but eventually less scalable method is to store the >> session data in a shared memory cache, so you minimize database accesses >> to just one after the server is restarted. This is probably the one you >> want to use as long you know how to deal with shared memory and >> semaphores. > >Is this documented anywhere?
What aspect of it do you want to see documentation for?
PHPLIB has session management via shared memory. I believe it's a little flaky, but certainly a good start.
>My understanding was that htaccess authentication was more secure that >session based because of the porblems of session hijacking???
Aah, but does it scale? And do you want to run SSL for all page views?
...R.
attached mail follows:
On Tue, 16 Apr 2002 14:59, Richard Archer did align ASCII characters thusly: > Aah, but does it scale?
By most aqccounts..... no :-(
> And do you want to run SSL for all page views? >
Yes.
Brad
attached mail follows:
On Tue, 16 Apr 2002 14:51, Manuel Lemos did align ASCII characters thusly: > > > then stored in cookie. The security weakness of this method is that if > > > the secret key leaks, hackers may use to forge new sessions. > > > > Is this documented anywhere? > Anyway what part didn't you > understand?
I think I understand all of it. Serialization of a session (or session object) is fairly straightforward and I know how to store that in a cookie. I was just hoping there was a "cookbook" out there. Don't have any classes on your site that do this do you? ;-)
> > > accesses to just one after the server is restarted. This is probably > > > the one you want to use as long you know how to deal with shared memory > > > and semaphores. > > > > Is this documented anywhere? > > Probably only in my mind . :-)
Can I borrow it????
> I guess you mean HTTP based authentication.
Yes.
> No, AFAIK that is very > unsecure because you can't end a "session" because browsers cache > authenticated passwords and only drop them (of they do, IE may not do > it) when you quit your browser. If you leave your browser terminal for > some time, somebody may come in and take advantage of your account > privileges.
The physical security of the users machine is their responsibility. I'm looking for good security, ease of implementation, and scalability.
At the moment it seems to be a case of "pick any two".
Brad
attached mail follows:
Anyone else getting the weird messages from naver.com in response to posts to the list?
Looks like a Korean out of office reply.
Brad
attached mail follows:
Hey... new to the list, but didn't have time to lurk and watch the traffic, kind of in a bind here. I apologize in advance if I do something wrong...
Using this code: <?php $link = mysql_connect() or die("Could not connect"); mysql_select_db("mydb") or die("Could not select database");
$result = mysql_query("SELECT * FROM cars WHERE year=1991"); extract(mysql_fetch_array($result));
while ($row = mysql_fetch_object($result)) { $generation = $row->generation; $year = $row->year; $owner = $row->owner; $email = $row->email; $pic1 = $row->pic1; $tmb1 = $row->tmb1; printf("<img src='%s'><br>", $pic1); printf("<small>%s</small><br>",$generation); printf("<b>%s</b><br>",$year); printf("%s<br>",$owner); printf("<a href=mailto:'%s'>%s</a><p>", $email, $email); printf("<a href='%s'><img src='%s' border=0></a><p>", $pic1, $tmb1); }
/* Free resultset */ mysql_free_result($result);
/* Closing connection */ mysql_close($link); ?>
I'm successfully able to retrieve and display information for year='1991'. It works great. However, if I replace '1991' with any other year that I KNOW there's a matching record for, I get no results. So if I were to replace year='1991' with year='1990', no results would be produced although the same query given directly in MySQL will give results. Make sense? This same problem happens with other fields too, it seems really selective. I can use WHERE color='red' and get results, but color='black' returns nothing, although there are matching records. Taking out the WHERE in the above code will return all but the first record in the table. I fixed that just by putting a dummy record first, but that still shouldn't be happening.
Any ideas? I need to get this fixed but I'm not sure what's wrong!
Thanks in advance, Jason (PHP 4.1.2 Win32) (MySQL 3.23 Win32)
attached mail follows:
In article <FBEIKNNDFEJJJJBGOGKEOEKNDCAA.solja
gci.net>, solja
gci.net
says...
> Hey... new to the list, but didn't have time to lurk and watch the traffic,
> kind of in a bind here. I apologize in advance if I do something wrong...
>
> Using this code:
> <?php
> $link = mysql_connect()
> or die("Could not connect");
> mysql_select_db("mydb") or die("Could not select database");
>
> $result = mysql_query("SELECT * FROM cars WHERE year=1991");
> extract(mysql_fetch_array($result));
What is that line above for? It's probably swallowing your first record. Get rid of it. > // while ($row = mysql_fetch_object($result)) {
Use this to avail yourself of extract correctly while ($row = mysql_fetch_array($result)) { extract($row); // Not needed with extract $generation = $row->generation; // Not needed with extract $year = $row->year; // Not needed with extract $owner = $row->owner; // Not needed with extract $email = $row->email; // Not needed with extract $pic1 = $row->pic1; // Not needed with extract $tmb1 = $row->tmb1; > printf("<img src='%s'><br>", $pic1); > printf("<small>%s</small><br>",$generation); > printf("<b>%s</b><br>",$year); > printf("%s<br>",$owner); > printf("<a href=mailto:'%s'>%s</a><p>", $email, $email); > printf("<a href='%s'><img src='%s' border=0></a><p>", $pic1, $tmb1); > } > > /* Free resultset */ > mysql_free_result($result); > > /* Closing connection */ > mysql_close($link); > ?> > > I'm successfully able to retrieve and display information for year='1991'. > It works great. However, if I replace '1991' with any other year that I KNOW > there's a matching record for, I get no results. So if I were to replace > year='1991' with year='1990', no results would be produced although the same > query given directly in MySQL will give results. Make sense? This same > problem happens with other fields too, it seems really selective. I can use > WHERE color='red' and get results, but color='black' returns nothing, > although there are matching records. Taking out the WHERE in the above code > will return all but the first record in the table. I fixed that just by > putting a dummy record first, but that still shouldn't be happening. > > Any ideas? I need to get this fixed but I'm not sure what's wrong!
Try the mods above; make sure that you quote the year value if the year field is text, and perhaps stick in a mysql_error after your query to see if any eror is coming back from mysql.
Is there any chance that you have stray white space in your year fields? If year is a char type and SELECT * FROM cars WHERE year LIKE '%1990%' works, you likely have stray junk in your db.
-- David Robley Temporary Kiwi!Quod subigo farinam
attached mail follows:
Let's say I a variable called $var1 and it's values is "one"
...I want to access them by doing something like this...
$i = 1; if ("var".$i == "one") echo "Hello!";
...I want the combination of "var" and $i to equal $var1
How do I do this?? The code I just wrote will not print out "Hello!"
THANKS!!!!!!! Phil
attached mail follows:
"Phil Schwarzmann" <pschwar
jhmi.edu> wrote:
> Let's say I a variable called $var1 and it's values is "one" > > ...I want to access them by doing something like this... > > $i = 1; > if ("var".$i == "one") echo "Hello!"; > > ...I want the combination of "var" and $i to equal $var1 > > How do I do this?? > The code I just wrote will not print out "Hello!"
You can use variable variable names by adding another '$'. so if $i == 1 and $var1 == "one", you can do this:
$var_name = "var".$i; if($$var_name == "one") echo "Hello!";
That should work, Justin
attached mail follows:
Hi all,
Currently i've got a config file for each website, and I split it into essentially two config files, based on the server name, so that I can have 1 file for both my local server and the live server.
something like:
<?
if($local)
{
$cfgAdminEmail = "justin
indent.com.au";
$cfgReportErrors = 1;
$cfgSendMail = 0;
}
else
{
$cfgAdminEmail = "webmaster
foo.com";
$cfgReportErrors = 0;
$cfgSendMail = 1;
}
?>
But of course, there's more like 20 config elements. The small problem I'm having is making sure that I keep both halves (live and local) the same (but with different settings).
What i was hoping was that there may be a way of writing the config once, and having it work in both situations, perhaps with a switch, or with some other language construct I have no idea about:
I know this isn't the answer, but I was hoping for something like:
<?
$cfgAdminEmail = "justin
indent.com.au|webmaster
foo.com";
$cfgReportErrors = "1|0;
$cfgSendMail = "0|1";
?>
Where both the options "local|live" were declared in one hit.
Whatever solution there is (arrays? switches?) it has to be easy to maintain, otherwise it's a step backwards I guess.
Any suggestions appreciated, or pointers to stuff in the manual i've never heard of!!!
Justin French
attached mail follows:
Justin French <justin
indent.com.au> has the same first name as me :)
and wrote:
> Currently i've got a config file for each website, and I split it into
> essentially two config files, based on the server name, so that I can have
1
> file for both my local server and the live server.
>
> something like:
>
> <?
>
> if($local)
> {
> $cfgAdminEmail = "justin
indent.com.au";
> $cfgReportErrors = 1;
> $cfgSendMail = 0;
> }
> else
> {
> $cfgAdminEmail = "webmaster
foo.com";
> $cfgReportErrors = 0;
> $cfgSendMail = 1;
> }
>
> ?>
>
> But of course, there's more like 20 config elements. The small problem
I'm
> having is making sure that I keep both halves (live and local) the same
(but
> with different settings).
>
>
> What i was hoping was that there may be a way of writing the config once,
> and having it work in both situations, perhaps with a switch, or with some
> other language construct I have no idea about:
>
> I know this isn't the answer, but I was hoping for something like:
>
> <?
> $cfgAdminEmail = "justin
indent.com.au|webmaster
foo.com";
> $cfgReportErrors = "1|0;
> $cfgSendMail = "0|1";
> ?>
>
> Where both the options "local|live" were declared in one hit.
>
>
> Whatever solution there is (arrays? switches?) it has to be easy to
> maintain, otherwise it's a step backwards I guess.
>
>
> Any suggestions appreciated, or pointers to stuff in the manual i've never
> heard of!!!
You could do it by making each variable an array with a key of 'local' and 'live' like this:
<? $cfgAdminEmail = array("local" => "localaddress", "live" => "liveaddress"); etc. etc. ?>
Then you could set something like $server to "local" or "live" and refer to the var's by $cfgAdminEmail[$server];
Justin
attached mail follows:
I have a directory on my server that contains log files for all my virtual hosts. I'd like to create a (web) login page where each owner of those vhosts can use to gain access to their individual log files. Ideally by using the same login they have on the system (their physical log in).
My problems are, a) each login need only access to their log files, no one else's, and b) some logins will have more than one vhost (and consequently more than one log directory).
Right now I have the directory structure setup as follows:
/main logs/ /main logs/<vhost 1> /main logs/<vhost 2> /main logs/<vhost 3> etc. etc.
So, if the owner of <vhost 1> logs in, I want them to be "dropped" within /main_logs/<vhost 1>/ to see their log files. But, I don't know how to tie the different vhosts that belong to the same user together.
(I suspect someone might ask why, so I'll also note this: The reason I have this setup is because I run statistics on each log file, and it's those reports that the users get access to, not the actual physical log file)
I'm open to suggestions.
-- H | "Life is the art of drawing without an eraser." - John Gardner +-------------------------------------------------------------------- Ashley M. Kirchner <mailto:ashleypcraft.com> . 303.442.6410 x130 Director of Internet Operations / SysAdmin . 800.441.3873 x130 Photo Craft Laboratories, Inc. . 3550 Arapahoe Ave, #6 http://www.pcraft.com ..... . . . Boulder, CO 80303, U.S.A.
attached mail follows:
Hi Tyler,
Thank you, I checked the permissions and the ownership, all ok, but by inserting the absolute path in the page, the code is running and get the expected output from the script. I realized that I made the same mistake in the php.ini file, I updated the include_path statement to
include_path = ".:/var/www/htmls/php/includes" and now can simply reference the class file without the path and it is working fine.
One question, what is the significance of the colon (:) in the include_path directive?
Thanks,
Andrew
tyler
captainjack.com wrote:
>Hi Andrew,
>
>This error indicates that your path to class.Htpasswd.php3 is wrong.
>use this:
>include("path/to/class.Htpasswd.php3");
>
>Right now, it's set to look in the php/includes dir. If the file is
>actually in there, then apache might not have perms to read the file (IE:
>it's owned by root).
>
>Good luck,
>Tyler Longren
>Captain Jack Communications
>www.captainjack.com
>tyler
captainjack.com
>
>----- Original Message -----
>From: "Andrew Schoenherr" <bhelisN6
netscape.net>
>To: <php-general
lists.php.net>
>Sent: Saturday, April 13, 2002 12:54 AM
>Subject: [PHP] Error accessing class
>
>
>>Hello,
>>
>>PHP Version: 4.1.0, Apache Version: 1.3.12, Server: Linux 7.0
>>Class name: class.Htpasswd.php3
>>
>>Thanks to Jason Wong for pointers on posting to the list, the parse
>>error was a simple omission of a quotation mark on my part.
>>
>>This is the error I am getting...
>>
>>Warning: Failed opening 'class.Htpasswd.php3' for inclusion
>>(include_path='.:/php/includes') in /var/www/html/php/dev/valid_user.php
>>on line 9
>>
>>Fatal error: Cannot instantiate non-existent class: htpasswd in
>>/var/www/html/php/dev/valid_user.php on line 10
>>
>>7 <body>
>>8 <?php
>>9 include("class.Htpasswd.php3");
>>10 $aHTPasswd = new Htpasswd("/var/www/html/private/.htpassd");
>>11 if (!$aHTPasswd->EXISTS)
>>12 {
>>13 print("authentication error<br>);
>>14 }
>>15 else
>>16 {
>>17 if ( $aHTPasswd->verifyUser( "phpbook", "phpbook" ) )
>>18 {
>>19 print( "phpbook is a valid user<br>" );
>>20 }
>>21 else
>>22 {
>>23 print( "phpbook is not a valid user<br>" );
>>24 }
>>25 }
>>26 ?>
>>27 </body>
>>28 </html>
>>
>>Any ideas on the error?
>>
>>Thank you,
>>
>>Regards,
>>
>>Andrew Schoenherr
>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]