|
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: Mon Aug 20 2001 - 12:07:37 CDT
php-general Digest 20 Aug 2001 17:07:37 -0000 Issue 827
Topics (messages 63452 through 63535):
Re: option tags and WHILE
63452 by: Chris Schneck
63453 by: Rudolf Visagie
63456 by: David Robley
E-Commerce - Integrating Sessions With Charging Processes That rePOST
63454 by: Fotwun
Re: Virtual Servers (apache) and php
63455 by: B. van Ouwerkerk
flash and php
63457 by: Jack
63495 by: Tribun
print two Digits after decimal point
63458 by: Andonny
63459 by: Fotwun
GD & ISAPI don't work
63460 by: Juraj Hasko
63473 by: MindHunter
Re: Passing variables to a file
63461 by: Daniel Rezny
Re: Oudoor database website - waypoints - please review
63462 by: B. van Ouwerkerk
Session expiration detection and handling
63463 by: Ryan Mahoney
Re: PHP based authentification -----------
63464 by: Jon Farmer
63520 by: Charles Williams
hope someone can help !
63465 by: Keith
63468 by: speedboy
Countries and ip addresses
63466 by: Mihailo Dzigurski
63467 by: speedboy
63470 by: Tom Carter
time in php
63469 by: nafiseh saberi
63472 by: speedboy
re:insertion question
63471 by: nafiseh saberi
mail from
63474 by: PHP
63475 by: speedboy
63476 by: Jan De Luyck
63481 by: Tony G. Bolaño
2D-3D Imagem (GD Library)
63477 by: Augusto Cesar Castoldi
php executable
63478 by: Nick Davies
63479 by: Jason Brooke
63492 by: Chris Lambert
Re: Function to Build Trees
63480 by: Chris Hayes
63531 by: Dan Harrington
php query for mysql table
63482 by: Wolfgang Schneider
63483 by: Gianluca Baldo
63484 by: Niklas Lampén
63485 by: Jon Haworth
63486 by: Wolfgang Schneider
63487 by: Morten Winkler Jørgensen
63488 by: Niklas Lampén
63490 by: php mailing list
63535 by: Alfredeen, Johan
Date Functions
63489 by: Peter Allum
63491 by: Renze Munnik
PHP files appearing in error_log
63493 by: Kermit
confusing problem w/sessions
63494 by: Gabriele Biondo
63498 by: php mailing list
63500 by: Gabriele Biondo
ImagePNG problem
63496 by: Adrian Ciutureanu
Dreamweaver templates
63497 by: -:-Doigy-:-
63499 by: Darius Ivanauskas
63515 by: Tim
Multi-Task on PHP by submitting a form!
63501 by: Jack
63502 by: Steve Brett
63519 by: «davidc»
Re: sample or tutorial for conditional pulldown menus
63503 by: Justin French
Re: [PHP-WIN] Multi-Task on PHP by submitting a form!
63504 by: Angie Tollerson
63505 by: Asendorf, John
Re: force download in IE
63506 by: bill
How to run php function from command line?
63507 by: Moise Bertrand TACHAGO
63508 by: Tyler Longren
Re: security check - virtual host and mod php setup
63509 by: Peter Clarke
PNG support...
63510 by: Jeff Lewis
63512 by: Brian C. Doyle
63518 by: scott [gts]
63521 by: Jeff Lewis
Re: new one is it ??
63511 by: billfarr.ages.com
while loop with if statement
63513 by: sgibbs.vt.globalhealth.org
Re: while loop with if statement - here's the attachment
63514 by: sgibbs.vt.globalhealth.org
63516 by: Steve Brett
Re: while loop with if statement - here's the code
63517 by: sgibbs.vt.globalhealth.org
63523 by: Steve Brett
63525 by: Steve Brett
63528 by: Alnisa Allgood
gettext()
63522 by: Colin Viebrock
security
63524 by: nafiseh saberi
crop string?
63526 by: Jeremy Morano
63527 by: Rasmus Lerdorf
PHP and the Console
63529 by: Bill Brigden
63530 by: Andrew Libby
63532 by: Tim
Re: MySQL substrings?
63533 by: Alfredeen, Johan
MD5_Crypt Support
63534 by: Casey Mueller
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:
Thanks to CC Zona and David Robley for their help in gettin this code out.
This code is really nice for satisfying search engines. It offers different
page content every time you refresh and if you feel like spamming, just use
print_keywords(); here and there to be more relevant :) I'll post the code
in case anyone else wishes to use it.
// get the keywords from db
$keyquery = ("select fld_keyword_word from tbl_keyword order by
rand()");
$keyresult = mysql_query($keyquery) or die ("couldnt randomize
words");
// put them into an array
while ($keyrow = mysql_fetch_array($keyresult))
{
$keyword[] = $keyrow["fld_keyword_word"];
}
$mykeywords = implode(", ", $keyword);
// print the keywords with a function
function print_keywords()
{
global $mykeywords;
echo ($mykeywords);
}
attached mail follows:
Also
while ($array[1] >= $array[0]) {
and not
while ($array[1] => $array[0]) {
Rudolf Visagie
rudolf
qedi.co.za
-----Original Message-----
From: David Robley [mailto:huntsman
www.nisu.flinders.edu.au]
Sent: 20 August 2001 07:01
To: CGI GUY; php-general
lists.php.net
Subject: Re: [PHP] option tags and WHILE
On Mon, 20 Aug 2001 12:23, CGI GUY wrote:
> What's wrong with this code? I keep getting a parse
> error at the form/select lines...
>
> $array = mysql_fetch_array($mysql_result) or die("no
> go");
>
> print ("<form>");
> print ("<select>");
> while ($array[1] => $array[0]) {
> print ("<option value=\"$array[0]\
> ">$array[1]</option>\n");
> }
> print ("</select>");
> print ("</form>");
> ?>
That's an, er, interesting script. But it's not going ever to do what I
think you expect it to.
You need to use while to loop through the rows returned by your SQL
query, and for each iteration in the while loop, print the values you
need. Also, if you use extract, you can directly access variables that
have the same names as the rows in your table, so you don't have to refer
to array elements.
Frinstance, if you are fetching fields named value and label for this
exercise, something like:
echo '<FORM><SELECT>';
while ($array = mysql_fetch_array($mysql_result)) {
extract($array);
echo '<OPTION VALUE="' . $value . '">' . $label . '</OPTION>';
}
echo '</SELECT></FORM>';
Of course, you'll need to put some more info in your <FORM> tag and add
submit buttons and so forth.
-- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIAEnsign Expendable, step on that rock! - Kirk
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
On Mon, 20 Aug 2001 15:05, Chris Schneck wrote: > Thanks to CC Zona and David Robley for their help in gettin this code > out. This code is really nice for satisfying search engines. It offers > different page content every time you refresh and if you feel like > spamming, just use print_keywords(); here and there to be more relevant > :) I'll post the code in case anyone else wishes to use it. > > // get the keywords from db > $keyquery = ("select fld_keyword_word from tbl_keyword order by > rand()"); > $keyresult = mysql_query($keyquery) or die ("couldnt randomize > words"); > > // put them into an array > while ($keyrow = mysql_fetch_array($keyresult)) > { > $keyword[] = $keyrow["fld_keyword_word"]; > } > $mykeywords = implode(", ", $keyword); > > // print the keywords with a function > function print_keywords() > { > global $mykeywords; > echo ($mykeywords); > }
Oh, is that what you wanted to do? Lets cut the processing down by eliminating the duplication of effort :-) ie get rid of the 'Put it in an array; take it out of an array;print it'.
// get the keywords from db $keyquery = ("select fld_keyword_word from tbl_keyword order by rand()"); $keyresult = mysql_query($keyquery) or die ("couldnt randomize words"); // Print the keywords while($row = mysql_fetch_array($result)) { extract $row; echo $fld_keyword_word; }
-- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIATo a cat, "NO!" means "Not while I'm looking."
attached mail follows:
Hi,
I have basically seen and used two methods for integrating credit card gateways into PHP code.
The first method is one that opens a socket to the gateway server and sends the data from within the code.
The second is where FORM data is posted to a https URL with the URL is should send the response back to, with the confirmation code, etc.
I traditionally use PG for situations of e-commerce, mainly because of transactions. I like the first method better, because I feel it is more secure, seemless, and less chance for errors to occur (either user induced, or other problems). I like being able to store all of the required data in sessions (rather than adding to the DB at each step) and then making all of the transactional queries at the end of the credit card charging process.
The problem I face is that all of the companies I've researched that allow direct socket integration seem to charge quite a bit more in general than those that use the POST/REDIRECT method of charging. **** So, if anyone knows of a reliable and affordable company that allows socket integration, that would solve the problem best. ****
However, because of budget issues, I may need to use one of these cheaper companies, who ultimately use the POST/REDIRECT method.
My questions are how do you securly, reliably, and seemlessly integrate sessions within that type of gateway. Because once the form data is posted to the credit card gateway, it redirects (posts response data) back to the script of your choice. However, in my experience, the sessions are not restored/recognized until the browser is refreshed on the client side (through the use of JavaScript) to get the server to recognize the request as coming from your user, rather than the as a post from the gateway. I don't want to have to deal with getting sloppy and adding additional refreshes/java script if thats the only way to do it. If I were to merely have the code generate a form based on hidden tags and have javascript auto-form submit, then I would open to security problems, because I could no longer restrict the script the gateway respondes to by an HTTP_REFFER.
Because the clients order id that is generated will be stored as a session, I need a way to reference the order ID and confirmation code that is returned by the posted data from the gateway, against the session data to start inserting the data into the DB if it was a successful charge.
Any ideas...? Maybe there's a quick solution out there I am just overlooking. The solution would be easy if I wasn't inserting all of my data at the end of the process based on the session data. But this is how the code is has to work, so what do you all think, how should I deal with this?
Thanks,
FT
attached mail follows:
> AddType application/x-httpd-php .php .php3 > AddType application/x-httpd-php-source .phps
If those lines aren't you should get your code in your browser.
403 might be a rights issue. Say you created the file you're trying to open as root you should chown it to the user under which apache is running.. or to another normal user..
Bye,
B.
attached mail follows:
I know this issue has been talk a lot already, but can anyone guide me where can I find information about how to build a dynamic content flash file driven by database?
Jack
jacky
activelifestyle.com
"Love your enemies, it will drive them nuts"
attached mail follows:
Simply user the GetVariable function in Flash.
The targeting file must be a PHP-File.
This File should reads out the Informations you want.
If the requests are also variable, call the file through GET and add "?queryÚte" to the filename.
The file must echo this... &variable=something&cat g&
Hope you understand my short introduction..
MöfG, Tribun (Patrick Lehnen)
--- www.mp3o.net"Jack" <jacky
activelifestyle.com> schrieb im Newsbeitrag news:017701c129a4$6dff2e60$0e00a8c0
activelifestyle.com... I know this issue has been talk a lot already, but can anyone guide me where can I find information about how to build a dynamic content flash file driven by database? Jack jacky
activelifestyle.com "Love your enemies, it will drive them nuts"
attached mail follows:
Hi, I need to print on the webpage two digits after the decimal point. This is what I have at the moment: <? print "$$price" ?> I need to have for example $5.00 not $ 5 as it does at the moment.
Thanks for your help Andonny
attached mail follows:
<? echo "\$".number_format($price,2); ?>
> -----Original Message-----
> From: Andonny [mailto:wje
multiline.com.au]
> Sent: Sunday, August 19, 2001 11:21 PM
> To: php-general
lists.php.net
> Subject: [PHP] print two Digits after decimal point
>
>
> Hi,
> I need to print on the webpage two digits after the decimal point.
> This is what I have at the moment:
> <? print "$$price" ?>
> I need to have for example $5.00 not $ 5 as it does at the moment.
>
> Thanks for your help
> Andonny
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
>
attached mail follows:
Hi,
I've encounter strange problem with GD library. I'm running PHP 4.0.6 on WinNT 4.0 and IIS 4.0. While I use CGI version, each of extensions including php_gd.dll works fine. But when I try change it to ISAPI, it works but without php_gd.dll. All others libraries works fine, but when I add GD lib. IIS will not start with error message:
"A system error has occured.
System error 1067 has occured.
The proces terminated unexpectedly."
Do you have any idea how to solve this problem ?
Thank you in advance,
Juraj Hasko
System Administrator
CAC LEASING Slovakia, a.s.
mailto:Juraj.Hasko
cacleasing.sk
http://www.cacleasing.sk
attached mail follows:
I had the same prob on Win98 and Win2K. On Win98 I reverted to Apache and on Win2K I am using CGI, besides that I don't know of much that you can do. Why not stick to CGI?
BK
"Juraj Hasko" <hasko
cacleasing.sk> wrote in message
news:000e01c12940$b9490260$ec01db0a
HASKO...
> Hi,
>
> I've encounter strange problem with GD library. I'm running PHP 4.0.6 on
WinNT 4.0 and IIS 4.0. While I use CGI version, each of extensions including
php_gd.dll works fine. But when I try change it to ISAPI, it works but
without php_gd.dll. All others libraries works fine, but when I add GD lib.
IIS will not start with error message:
> "A system error has occured.
> System error 1067 has occured.
> The proces terminated unexpectedly."
> Do you have any idea how to solve this problem ?
> Thank you in advance,
>
> Juraj Hasko
> System Administrator
>
> CAC LEASING Slovakia, a.s.
> mailto:Juraj.Hasko
cacleasing.sk
> http://www.cacleasing.sk
>
attached mail follows:
Hello Seb,
Sunday, August 19, 2001, 11:44:59 PM, you wrote:
SF> OK I know this can be done like so:
SF> file.php4?foo=bar
SF> but what if I want to keep the value of foo secret from the user?
SF> - seb
I don't know if it's best idea but you can try to encode link with base64_encode() and base64_decode function.
And this is secret for most users.
I hope it helps
-- Best regards, Daniel mailto:danielrezny.sk
attached mail follows:
At 21:07 19-8-01 -0600, WildOutThere wrote: >I just got done (am still improving) building a website to share waypoints >and file related. Database is still thin, but i want to know if the >features work and are intuitive.
You should figure out by yourself whether it works or not.
Two little remarks: - view your website with 800x600 - pictures with a size of 77kB are to big
Bye,
B.
attached mail follows:
I am interested in detecting when the session expires and displaying a "your session has expired..." page. If anyone can recommend how to do this or recommend a tutorial it would be greatly appreciated!
Thanks!
-r
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.251 / Virus Database: 124 - Release Date: 4/26/01
attached mail follows:
>Thus, the way to "logout" is to maintain a dynamic unique dataset of >"Realms" and require authentication in a new Realm for any user that is >"logged out
Yes, Richard recently advised me simialry. I set a cookie on a successful login and then delete it on a logout. If the cookie is not present when they go back to the page that needs login then it presents a login box to a realm that contains the current date and time in it.
Regards
Jon
-- Jon Farmer Systems Programmer, Entanet www.enta.net Tel 01952 428969 Mob 07968 524175 PGP Key available, send blank email to pgpkeybctech.co.uk
".
attached mail follows:
Alex,
If your using sessions then just use session_destroy(); in your logout.
chuck
----- Original Message -----
From: "Alex Sofronie" <maxx
mail.dntis.ro>
To: "PHP General" <php-general
lists.php.net>
Sent: Sunday, August 19, 2001 4:25 PM
Subject: [PHP] PHP based authentification -----------
> Hi all!
>
> How can I "logout" from a PHP based auth (with PHP_AUTH_USER and
PHP_AUTH_PW
> and appropriate headers sent at the beginning)?
> It seems like unset($PHP_AUTH_USER) does not wotk in this case...
>
> Any help would be appreciated!
>
> Alex Sofronie
> maxx
mail.dntis.ro
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
Clean Suse Linux install !
Get the following from phpinfo.php
PHP Version 4.0.4pl1
'./configure' '--prefix=/usr' '--bindir=/usr/bin' '--libdir=/usr/lib' '--with-config-file-path=/etc' '--with-exec-dir=%{libdir}/php/bin' '--with-pgsql=/usr' '--with-mysql=/usr' '--with-gd=yes' '--with-tiff-dir=/usr' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr/X11R6' '--with-pdflib=/usr' '--with-ldap=yes' '--with-imap=yes' '--with-imap-ssl' '--with-zlib=yes' '--with-bz2' '--with-xml' '--with-ttf' '--with-t1lib' '--with-mcal=/usr/include/mcal/' '--with-sablot' '--with-readline' '--with-ftp' '--with-ndbm' '--with-gdbm' '--with-mcrypt' '--with-gettext' '--with-curl' '--with-mm' '--with-gd=yes' '--with-qtdom=/usr/lib/qt-2.2.1/' '--enable-versioning' '--enable-yp' '--enable-bcmath' '--enable-trans-sid' '--enable-inline-optimization' '--enable-track-vars' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-shmop' '--enable-calendar' '--enable-exif' '--enable-ftp' '--enable-memory-limit' '--enable-wddx' '--enable-filepro' '--enable-dbase' '--enable-ctype' '--enable-debug' '--enable-force-cgi-redirect' '--enable-discard-path' '--enable-sigchild' '--enable-gd-imgstrttf' '--with-openssl' '--with-swf=./dist/' '--with-apxs=/usr/sbin/apxs' 'i386-suse-linux-gnu'
so why when I try ImageTTFText do I get call to unknown function php must be compiled with ttf ??
attached mail follows:
> so why when I try ImageTTFText do I get call to unknown function php must > be compiled with ttf ??
Try this first:
http://database.sourceforge.net/Installing_apache_with_gd_zlib_png_jpg_tiff_pdf_support.html
Possibly also try configuring without somany options initially.
attached mail follows:
Hello,
How can I find out from witch country user is based on user ip address? I need this from php script.
Thanks, Mihailo.
_________________________________________________________
Do You Yahoo!?
Get your free
yahoo.com address at http://mail.yahoo.com
attached mail follows:
> How can I find out from witch country user is based on user ip address? I > need this from php script.
You can't. You can try with their hostname.
attached mail follows:
It's not possible to be assured of doing this properly for the following reason..
1. not all hosts translate to IP address 2. Soem host names are often meaningless (eg .com)
The way to do it is basically this 1. use gethostbyaddr() (http://www.php.net/gethostbyaddr) to do a reverse DNS from IP to host name 2. use a regex to match everything to the right of the last . 3. Look that value up in some table of countries eg. notam.uio.no to no to norway
HTH, Tom
----- Original Message -----
From: "Mihailo Dzigurski" <mdzigurski
yahoo.com>
To: <php-general
lists.php.net>
Sent: Monday, August 20, 2001 9:57 AM
Subject: [PHP] Countries and ip addresses
> Hello,
>
> How can I find out from witch country user is based on user ip address? I
> need this from php script.
>
> Thanks,
> Mihailo.
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free
yahoo.com address at http://mail.yahoo.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
hi. how I compare two times with php? 12:23:50 - 13:12:00 = ???
thanks.
attached mail follows:
> hi. > how I compare two times with php? > 12:23:50 - 13:12:00 = ???
Convert them to timestamps (unix timestamps) and subtract the two.
attached mail follows:
hi.
you can find the field that any relationship with other and place them in one table. for example if the name and work have relate with eachother ,build table with that 2 fields.
this problem solve with build 1nf,2nf,3nf,... (normalization for tables).
I am software engineering,work on php,postgres.... regards.
attached mail follows:
Hello all. Does anyone know how i can set up the "from " and "Return Address" fields in the mail functions in php?
thanks
attached mail follows:
> Hello all. Does anyone know how i can set up the "from " and "Return > Address" fields in the mail functions in php?
mail("user
host.com", "subject.", "body.", "From: php
$SERVER_NAME\n");
attached mail follows:
You can set them using the header field in the mail function.
Checkout http://www.php.net/mail
Jan De Luyck
> -----Original Message-----
> From: PHP [mailto:Darren
jplgroup.co.uk]
> Sent: Monday, August 20, 2001 11:26 AM
> To: php-general
lists.php.net
> Subject: [PHP] mail from
>
>
> Hello all. Does anyone know how i can set up the "from " and "Return
> Address" fields in the mail functions in php?
>
> thanks
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
>
attached mail follows:
Use the header field in the mail function:
$header ="From: <fromme
nowhere.com>\n>";
$header .="X-Sender: <sender
nowhere.com>\n";
$header .="X-Mailer: PHP\n";
$header .="Reply-To: <replyto
nowhere.com>\n";
$header .="Return-Path: <return
nowhere.com>\n";
...
mail($recipient, $subject, $message, $header);
hope this helps,
Tony G. Bolaño
attached mail follows:
HI.
I'd like to know if I can create 2D images with the image function of GD Library.
Regards.
Augusto
_______________________________________________________________________________________________ Yahoo! GeoCities Tenha seu lugar na Web. Construa hoje mesmo sua home page no Yahoo! GeoCities. É fácil e grátis! http://br.geocities.yahoo.com/
attached mail follows:
Is it possible to surpress the
X-Powered-By: PHP/4.0.6 Content-type: text/html
text when running php from the commandline?
Thanks. Nick.
attached mail follows:
php -q
try php -h for other options - if that fails, there's always the manual - http://www.php.net/manual
----- Original Message -----
From: "Nick Davies" <nick
sensei.co.uk>
To: <php-general
lists.php.net>
Sent: Monday, August 20, 2001 8:06 PM
Subject: [PHP] php executable
> > Is it possible to surpress the > > X-Powered-By: PHP/4.0.6 > Content-type: text/html > > text when running php from the commandline? > > Thanks. > Nick.
attached mail follows:
/usr/bin/php -q ...I believe.
/* Chris Lambert, CTO - chris
whitecrown.net
WhiteCrown Networks - More Than White Hats
Web Application Security - www.whitecrown.net
*/
----- Original Message -----
From: Nick Davies <nick
sensei.co.uk>
To: <php-general
lists.php.net>
Sent: Monday, August 20, 2001 6:06 AM
Subject: [PHP] php executable
|
| Is it possible to surpress the
|
| X-Powered-By: PHP/4.0.6
| Content-type: text/html
|
| text when running php from the commandline?
|
| Thanks.
| Nick.
|
|
| --
| PHP General Mailing List (http://www.php.net/)
| To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
| For additional commands, e-mail: php-general-help
lists.php.net
| To contact the list administrators, e-mail: php-list-admin
lists.php.net
|
|
|
attached mail follows:
> Onderwerp: [PHP] Function to Build Trees
A most interesting question!
> Given a multidimensional array with words as keys, I want to match > the values of each array with the keys of the array and build a new > array that reflects these relationships as a sort of tree. So, in > the list below, "fruit", "apples", "oranges", "red" are the keys and > in the "fruit" array are the values "apples" and "oranges", so I want > the function to create a new array that looks like: > > ORIGINAL ARRAY: > $array['fruits'] = array("apples","oranges","pears"); > $array['apples'] = array("red","granny smith"); > $array['oranges'] = array('mandarin'); > $array['red'] = array("big red","small red"); > > NEW ARRAY: > $array['fruits'] = array(apples,oranges,pears); > $array['fruits']['apples'] = array("red","granny smith"); > $array['fruits']['oranges'] = array('mandarin');
At first peek i fear endless loops. But never mind about those :-). Well not never, i think you MUST test new data on the loop danger. What may cause loops? $array['fruits'] = array("apples","oranges","pears"); $array['apples'] = array("red","granny smith","fruit"); May cause an endless array fruit-apple-fruit-apple- ad infinitum.
> And then I want it further to figure out that "red", now in the array > found at: $array['fruits']['apples'] matches a key in the original > array so the final result looks like: > > FINAL ARRAY: > $array['fruits'] = array(apples,oranges,pears); > $array['fruits']['oranges'] = array('mandarin'); > $array['fruits']['apples'] = array("red","granny smith"); > $array['fruits']['apples']['red'] = array("big red","small red"); > > So, you see how it builds a little tree, right?
I think the thing is to make a step by step description of what should be done. Write the logic down with this example in a way that can be translated into array handling functions (walk through, search, add).
I think there are several ways to approach it.
Mine would be probably.....
STEP 1: find highest in hierarchy to make stems a Make $highest_keywords_array contain all mentioned keywords. b Now look for every key if there is a 'higher' keyword, if so delete it from this array. c You should in your example end up with $highest_keywords_array containing only 'fruit'.
STEP 2: build on branches and twigs Now go through the initial array several times and glue on branches that go under the highest keywords, then twigs, twiglets, twigletlets... Make every word $highest_keywords_array a 1st level result array item Walk through 1st level keys, For every key look in initial array for the values Stick these values in the result array: array[thiskey]=[value] Walk through 2nd level
Ad 1b: For every word in array see if it is in the array at a 'value location'. No idea how to do it - ask the group.
Ad 2: I don't know how to make this function go through all existing values. I am not going to break my early morning brain on it as i a not sure you will use this approach. Correction. Some questions are too tempting so i still tried.
STEP 1 results in: $arrayname=array(keys at 1st level, i.e. fruit); STEP 2 function GLUE ($arrayname) {global $arrayname; for every KEY in $arrayname [at this level] { $arrayname[KEY] = initial array[key] GLUE ($arrayname[KEY]) } } GLUE($array_with_first_level_keys) This should do the reciprocal thing as efficient as possible.
Think about strawberry (red) (small,big) apple (red) (small,big) when making this leveled function (or maybe reciprocal).
This system should leave no orphans, as orphans should have been at the highest hierarchy.
hope this helps (let me know!)
Chris ---------------------------------------------------------
PS shit i couldn't help it:
<?php
$array_in['apples'] = array("red","granny smith"); $array_in['fruits'] = array("apples","oranges","pears"); $array_in['oranges'] = array('mandarin'); $array_in['red'] = array("big red","small red"); $array_in['oranges'] = array('mandarins');
#STEP 1: find highest in hierarchy to make stems #a Make $highest_keywords_array contain all mentioned keywords.
$highest_keywords_array = array_keys($array_in);
#first make a list of all values $values_array[]=''; function val_array (&$arrayname) {global $values_array; foreach (array_values($arrayname) as $key) {if (!is_array($key))$values_array[] = $key; val_array ($key); } } val_array(&$array_in );
ECHO '<b>Original keywords:</b>'; foreach ($highest_keywords_array as $key) { echo $key .' - ';} ECHO '<br><b>Original values:</b>'; foreach ($values_array as $val) { echo $val .' - ';};
#b Now look for every key if there is a 'higher' keyword, if so delete it from this array.
$position=0; foreach ($highest_keywords_array as $key) {if (in_array($key,$values_array)) {array_splice($highest_keywords_array,$position,1);$position--;} $position++; }
ECHO '<br><b>Stripped to highest level keyword(s):</b>'; foreach ($highest_keywords_array as $key) { echo $key .' ';}
$arrayname=$highest_keywords_array ;
function GLUE (&$arrayname) { global $array_in; $position=0; foreach ($arrayname as $key) {#echo '<br>^'.$key.'-- '.$array_in[$key].'['.isset($array_in[$key]).']'; if (isset($array_in[$key])){ $arrayname[$key] = $array_in[$key]; GLUE ($arrayname[$key]); $position++; } } } GLUE(&$arrayname );
# done, now show it!
echo "<table bgcolor=green border=1><tr><td><b>Level</></td><td><b>value</></td></tr>"; function showarray (&$arrayname,$level) { foreach ($arrayname as $key) { if (!is_array($key)) {echo "<tr><td>$level</td><td>"; for ($i=0;$i<$level;$i++) {echo ' ';} echo '-'.$key.'</td></tr>'; } if (is_array($arrayname[$key])) showarray ($arrayname[$key],$level+1); } } showarray(&$arrayname,0 );
echo '</table>';
?>
-------------------------------------------------------------------- -- C.Hayes Droevendaal 35 6708 PB Wageningen the Netherlands -- --------------------------------------------------------------------
attached mail follows:
Or you could just buy from http://www.plumbdesign.com/ or write a PHP SDK for them. :-)
> -----Original Message-----
> From: Chris Hayes [mailto:chayes
antenna.nl]
> Sent: Monday, August 20, 2001 4:15 AM
> To: php-general
lists.php.net
> Subject: Re: [PHP] Function to Build Trees
>
>
> > Onderwerp: [PHP] Function to Build Trees
>
> A most interesting question!
>
>
> > Given a multidimensional array with words as keys, I want to match
> > the values of each array with the keys of the array and build a new
> > array that reflects these relationships as a sort of tree. So, in
> > the list below, "fruit", "apples", "oranges", "red" are the keys and
> > in the "fruit" array are the values "apples" and "oranges", so I want
> > the function to create a new array that looks like:
> >
> > ORIGINAL ARRAY:
> > $array['fruits'] = array("apples","oranges","pears");
> > $array['apples'] = array("red","granny smith");
> > $array['oranges'] = array('mandarin');
> > $array['red'] = array("big red","small red");
> >
> > NEW ARRAY:
> > $array['fruits'] = array(apples,oranges,pears);
> > $array['fruits']['apples'] = array("red","granny smith");
> > $array['fruits']['oranges'] = array('mandarin');
>
> At first peek i fear endless loops. But never mind about those :-). Well not
> never, i think you MUST test new data on the loop danger.
> What may cause loops?
> $array['fruits'] = array("apples","oranges","pears");
> $array['apples'] = array("red","granny smith","fruit");
> May cause an endless array fruit-apple-fruit-apple- ad infinitum.
>
>
> > And then I want it further to figure out that "red", now in the array
> > found at: $array['fruits']['apples'] matches a key in the original
> > array so the final result looks like:
> >
> > FINAL ARRAY:
> > $array['fruits'] = array(apples,oranges,pears);
> > $array['fruits']['oranges'] = array('mandarin');
> > $array['fruits']['apples'] = array("red","granny smith");
> > $array['fruits']['apples']['red'] = array("big red","small red");
> >
> > So, you see how it builds a little tree, right?
>
> I think the thing is to make a step by step description of what should be
> done.
> Write the logic down with this example in a way that can be translated into
> array handling functions (walk through, search, add).
>
> I think there are several ways to approach it.
>
> Mine would be probably.....
>
> STEP 1: find highest in hierarchy to make stems
> a Make $highest_keywords_array contain all mentioned keywords.
> b Now look for every key if there is a 'higher' keyword, if so delete it
> from this array.
> c You should in your example end up with $highest_keywords_array containing
> only 'fruit'.
>
> STEP 2: build on branches and twigs
> Now go through the initial array several times and glue on branches that go
> under the highest keywords, then twigs, twiglets, twigletlets...
> Make every word $highest_keywords_array a 1st level result array item
> Walk through 1st level keys,
> For every key look in initial array for the values
> Stick these values in the result array: array[thiskey]=[value]
> Walk through 2nd level
>
> Ad 1b:
> For every word in array see if it is in the array at a 'value location'. No
> idea how to do it - ask the group.
>
> Ad 2:
> I don't know how to make this function go through all existing values. I am
> not going to break my early morning brain on it as i a not sure you will use
> this approach.
> Correction. Some questions are too tempting so i still tried.
>
> STEP 1 results in:
> $arrayname=array(keys at 1st level, i.e. fruit);
> STEP 2
> function GLUE ($arrayname)
> {global $arrayname;
> for every KEY in $arrayname [at this level]
> { $arrayname[KEY] = initial array[key]
> GLUE ($arrayname[KEY])
> }
> }
> GLUE($array_with_first_level_keys)
> This should do the reciprocal thing as efficient as possible.
>
> Think about strawberry (red) (small,big)
> apple (red) (small,big)
> when making this leveled function (or maybe reciprocal).
>
>
>
> This system should leave no orphans, as orphans should have been at the
> highest hierarchy.
>
> hope this helps (let me know!)
>
> Chris
> ---------------------------------------------------------
>
>
> PS shit i couldn't help it:
>
>
>
>
> <?php
>
> $array_in['apples'] = array("red","granny smith");
> $array_in['fruits'] = array("apples","oranges","pears");
> $array_in['oranges'] = array('mandarin');
> $array_in['red'] = array("big red","small red");
> $array_in['oranges'] = array('mandarins');
>
>
> #STEP 1: find highest in hierarchy to make stems
> #a Make $highest_keywords_array contain all mentioned keywords.
>
> $highest_keywords_array = array_keys($array_in);
>
>
>
> #first make a list of all values
> $values_array[]='';
> function val_array (&$arrayname)
> {global $values_array;
> foreach
> (array_values($arrayname) as $key)
> {if
> (!is_array($key))$values_array[] = $key;
> val_array ($key);
> }
> }
> val_array(&$array_in );
>
> ECHO '<b>Original keywords:</b>'; foreach ($highest_keywords_array as $key)
> { echo $key .' - ';}
> ECHO '<br><b>Original values:</b>'; foreach ($values_array as $val) { echo
> $val .' - ';};
>
> #b Now look for every key if there is a 'higher' keyword, if so delete it
> from this array.
>
> $position=0;
> foreach ($highest_keywords_array as $key)
> {if (in_array($key,$values_array))
> {array_splice($highest_keywords_array,$position,1);$position--;}
> $position++;
> }
>
>
> ECHO '<br><b>Stripped to highest level keyword(s):</b>';
> foreach ($highest_keywords_array as $key) { echo $key .' ';}
>
>
> $arrayname=$highest_keywords_array ;
>
> function GLUE (&$arrayname)
> { global $array_in;
> $position=0;
> foreach ($arrayname as $key)
> {#echo '<br>^'.$key.'--
> '.$array_in[$key].'['.isset($array_in[$key]).']';
> if (isset($array_in[$key])){
> $arrayname[$key] =
> $array_in[$key];
> GLUE ($arrayname[$key]);
> $position++;
> }
> }
>
> }
> GLUE(&$arrayname );
>
> # done, now show it!
>
> echo "<table bgcolor=green
> border=1><tr><td><b>Level</></td><td><b>value</></td></tr>";
> function showarray (&$arrayname,$level)
> { foreach ($arrayname as $key)
> {
> if (!is_array($key))
> {echo "<tr><td>$level</td><td>";
> for ($i=0;$i<$level;$i++) {echo
> ' ';}
> echo '-'.$key.'</td></tr>';
>
> }
> if (is_array($arrayname[$key])) showarray
> ($arrayname[$key],$level+1);
> }
> }
> showarray(&$arrayname,0 );
>
> echo '</table>';
>
>
> ?>
>
>
> --------------------------------------------------------------------
> -- C.Hayes Droevendaal 35 6708 PB Wageningen the Netherlands --
> --------------------------------------------------------------------
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
Hi
I am a newbie to php + mysql and wanted to ask for some help on a particular item which I can't seem to find "the right key" in the documentation. I am trying to set up a simple Q&A system with an entry page where one can select to either have all questions & answers from a mysql database displayed or else search with a text field for only those questions which contain a certain word(s).
Can someone tell me how to set in a query when trying to find records in a mysql table that have a certain word or perhaps 2 or 3 words (among others) ...?
I know about using SELECT and WHERE in order to find records which match *exactly*, but am looking for something a bit different ...
Example: The values of 3 records for the "question" field of the database might be the following:
[1] How do you deal with anger? [2] Ever been full of anger in your life? [3] Is life always easy?
How can I set a PHP query with SELECT and WHERE to express the following:
Which questions contain the word "life"? That is, have someone search the database in the "question" field for records where the word "life" is used as part of the question ... The result then should return the records 2 & 3 above
Any help is greatly appreciated. Thanks mucho. God bless you with His grace and peace Wolfgang
Looking for Biblical information? COME AND SEE! -- ONLINE Courses: http://classes.bibelcenter.de ... NEW! -- BibelCenter: http://www.bibelcenter.de -- Bookstore: http://www.worthy.net/BibelCenter/
attached mail follows:
You should use the "like" clause whch allows the use of wild cards % and ?.
Have a look at the MySQL manual, it should be explained there.
HTH Gianluca
WS> I am a newbie to php + mysql and wanted to ask for some help on a WS> particular item which I can't seem to find "the right key" in the WS> documentation. I am trying to set up a simple Q&A system with an entry WS> page where one can select to either have all questions & answers from a WS> mysql database displayed or else search with a text field for only WS> those questions which contain a certain word(s).
WS> Can someone tell me how to set in a query when trying to find records WS> in a mysql table that have a certain word or perhaps 2 or 3 words WS> (among others) ...?
WS> I know about using SELECT and WHERE in order to find records which WS> match *exactly*, but am looking for something a bit different ...
WS> Example: WS> The values of 3 records for the "question" field of the database might WS> be the following:
WS> [1] How do you deal with anger? WS> [2] Ever been full of anger in your life? WS> [3] Is life always easy?
WS> How can I set a PHP query with SELECT and WHERE to express the WS> following:
WS> Which questions contain the word "life"? That is, have someone search WS> the database in the "question" field for records where the word "life" WS> is used as part of the question ... The result then should return the WS> records 2 & 3 above
WS> Any help is greatly appreciated. Thanks mucho. WS> God bless you with His grace and peace WS> Wolfgang
WS> Looking for Biblical information? COME AND SEE! WS> -- ONLINE Courses: http://classes.bibelcenter.de ... NEW! WS> -- BibelCenter: http://www.bibelcenter.de WS> -- Bookstore: http://www.worthy.net/BibelCenter/
gianluca.baldo
bcninedita.com
BcnInédita EURO RSCG INTERACTION www.bcninedita.com Planella, 39 08017 Barcelona Tel.34 932 531 950 (directo 93 253 19 53) Fax. 34 932 114 546
attached mail follows:
% works as a wildcard in mySQL.
Example:
"SELECT * FROM table WHERE Question LIKE '%life%'" would return all rows with field Question containing string "life".
Niklas
-----Original Message-----
From: Wolfgang Schneider [mailto:schneider
bibelcenter.de]
Sent: 20. elokuuta 2001 13:22
To: php-general
Subject: [PHP] php query for mysql table
Hi
I am a newbie to php + mysql and wanted to ask for some help on a particular item which I can't seem to find "the right key" in the documentation. I am trying to set up a simple Q&A system with an entry page where one can select to either have all questions & answers from a mysql database displayed or else search with a text field for only those questions which contain a certain word(s).
Can someone tell me how to set in a query when trying to find records in a mysql table that have a certain word or perhaps 2 or 3 words (among others) ...?
I know about using SELECT and WHERE in order to find records which match *exactly*, but am looking for something a bit different ...
Example: The values of 3 records for the "question" field of the database might be the following:
[1] How do you deal with anger? [2] Ever been full of anger in your life? [3] Is life always easy?
How can I set a PHP query with SELECT and WHERE to express the following:
Which questions contain the word "life"? That is, have someone search the database in the "question" field for records where the word "life" is used as part of the question ... The result then should return the records 2 & 3 above
Any help is greatly appreciated. Thanks mucho. God bless you with His grace and peace Wolfgang
Looking for Biblical information? COME AND SEE! -- ONLINE Courses: http://classes.bibelcenter.de ... NEW! -- BibelCenter: http://www.bibelcenter.de -- Bookstore: http://www.worthy.net/BibelCenter/
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: For additional commands, e-mail: php-general-helplists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
You can use the SQL keyword "LIKE" for this. Have a look at the MySQL docs for full info, but the idea is you'd do something like:
$query = "SELECT * FROM table WHERE question LIKE '%". $search_phrase. "%'";
HTH Jon
-----Original Message-----
From: Wolfgang Schneider [mailto:schneider
bibelcenter.de]
Sent: 20 August 2001 11:22
To: php-general
Subject: [PHP] php query for mysql table
Hi
I am a newbie to php + mysql and wanted to ask for some help on a particular item which I can't seem to find "the right key" in the documentation. I am trying to set up a simple Q&A system with an entry page where one can select to either have all questions & answers from a mysql database displayed or else search with a text field for only those questions which contain a certain word(s).
Can someone tell me how to set in a query when trying to find records in a mysql table that have a certain word or perhaps 2 or 3 words (among others) ...?
I know about using SELECT and WHERE in order to find records which match *exactly*, but am looking for something a bit different ...
Example: The values of 3 records for the "question" field of the database might be the following:
[1] How do you deal with anger? [2] Ever been full of anger in your life? [3] Is life always easy?
How can I set a PHP query with SELECT and WHERE to express the following:
Which questions contain the word "life"? That is, have someone search the database in the "question" field for records where the word "life" is used as part of the question ... The result then should return the records 2 & 3 above
Any help is greatly appreciated. Thanks mucho. God bless you with His grace and peace Wolfgang
attached mail follows:
On Mon, 20 Aug 2001 13:35:39 +0300, Niklas Lampén wrote:
>% works as a wildcard in mySQL. > >Example: > >"SELECT * FROM table WHERE Question LIKE '%life%'" would return all rows >with field Question containing string "life".
Hello all helpers,
well ... thanks to those who have already replied and helped me out here. I suppose it is when looking in the wrong place one can't quite find the right answer :-)
I appreciate the mails and suggestions. It sure is nice to have a forum like this available ! Thanks ! God bless you with His grace and peace Wolfgang
Looking for Biblical information? COME AND SEE! -- ONLINE Courses: http://classes.bibelcenter.de ... NEW! -- BibelCenter: http://www.bibelcenter.de -- Bookstore: http://www.worthy.net/BibelCenter/
attached mail follows:
Notice that if a user enters
"life anger"
in the search field
SELECT * FROM table WHERE question LIKE "%life anger%" none of the questions
>> [1] How do you deal with anger? >> [2] Ever been full of anger in your life? >> [3] Is life always easy?
will match. For that you must split the query by " " and perform a
SELECT * FROM table WHERE question LIKE "%life%" OR question LIKE "%anger%"
or possibly change the OR with a AND.
Kind regards, Morten Winkler
attached mail follows:
This can be solved by building a function to split users entry to pieces so that the query will be like "SELECT * FROM table WHERE Question LIKE '%word1%' || Question LIKE '%word2%' || Question....." if only one of the words have to match the Question field.
Niklas Lampén
-----Original Message-----
From: Morten Winkler Jørgensen [mailto:madmax
mip.sdu.dk]
Sent: 20. elokuuta 2001 13:47
To: php-general
lists.php.net
Subject: Re[2]: [PHP] php query for mysql table
Notice that if a user enters
"life anger"
in the search field
SELECT * FROM table WHERE question LIKE "%life anger%" none of the questions
>> [1] How do you deal with anger? >> [2] Ever been full of anger in your life? >> [3] Is life always easy?
will match. For that you must split the query by " " and perform a
SELECT * FROM table WHERE question LIKE "%life%" OR question LIKE "%anger%"
or possibly change the OR with a AND.
Kind regards, Morten Winkler
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
select * from yourtable where question like '%life%'
---------- Original Message ----------------------------------
From: "Wolfgang Schneider" <schneider
bibelcenter.de>
Reply-To: "Wolfgang Schneider" <schneider
bibelcenter.de>
Date: Mon, 20 Aug 2001 12:22:15 +0200
>Hi
>
>I am a newbie to php + mysql and wanted to ask for some help on a
>particular item which I can't seem to find "the right key" in the
>documentation. I am trying to set up a simple Q&A system with an entry
>page where one can select to either have all questions & answers from a
>mysql database displayed or else search with a text field for only
>those questions which contain a certain word(s).
>
>Can someone tell me how to set in a query when trying to find records
>in a mysql table that have a certain word or perhaps 2 or 3 words
>(among others) ...?
>
> I know about using SELECT and WHERE in order to find records which
>match *exactly*, but am looking for something a bit different ...
>
>Example:
>The values of 3 records for the "question" field of the database might
>be the following:
>
>[1] How do you deal with anger?
>[2] Ever been full of anger in your life?
>[3] Is life always easy?
>
>How can I set a PHP query with SELECT and WHERE to express the
>following:
>
>Which questions contain the word "life"? That is, have someone search
>the database in the "question" field for records where the word "life"
>is used as part of the question ... The result then should return the
>records 2 & 3 above
>
>Any help is greatly appreciated. Thanks mucho.
>God bless you with His grace and peace
>Wolfgang
>
>Looking for Biblical information? COME AND SEE!
>-- ONLINE Courses: http://classes.bibelcenter.de ... NEW!
>-- BibelCenter: http://www.bibelcenter.de
>-- Bookstore: http://www.worthy.net/BibelCenter/
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
>For additional commands, e-mail: php-general-help
lists.php.net
>To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
>
attached mail follows:
Wolfgang, Use LIKE '%life%' as in
SELECT somecolumn FROM mytable WHERE LOWER(mycolumn) LIKE '%life%'
Don't forget to compare same case strings.
Johan Alfredeen www.pongworld.com
From mySQL manual: mysql> SELECT * FROM tbl_name WHERE set_col LIKE '%value%'; mysql> SELECT * FROM tbl_name WHERE FIND_IN_SET('value',set_col)>0;
-----Original Message-----
From: Wolfgang Schneider [mailto:schneider
bibelcenter.de]
Sent: Monday, August 20, 2001 4:22 AM
To: php-general
Subject: [PHP] php query for mysql table
Hi
I am a newbie to php + mysql and wanted to ask for some help on a particular item which I can't seem to find "the right key" in the documentation. I am trying to set up a simple Q&A system with an entry page where one can select to either have all questions & answers from a mysql database displayed or else search with a text field for only those questions which contain a certain word(s).
Can someone tell me how to set in a query when trying to find records in a mysql table that have a certain word or perhaps 2 or 3 words (among others) ...?
I know about using SELECT and WHERE in order to find records which match *exactly*, but am looking for something a bit different ...
Example: The values of 3 records for the "question" field of the database might be the following:
[1] How do you deal with anger? [2] Ever been full of anger in your life? [3] Is life always easy?
How can I set a PHP query with SELECT and WHERE to express the following:
Which questions contain the word "life"? That is, have someone search the database in the "question" field for records where the word "life" is used as part of the question ... The result then should return the records 2 & 3 above
Any help is greatly appreciated. Thanks mucho. God bless you with His grace and peace Wolfgang
Looking for Biblical information? COME AND SEE! -- ONLINE Courses: http://classes.bibelcenter.de ... NEW! -- BibelCenter: http://www.bibelcenter.de -- Bookstore: http://www.worthy.net/BibelCenter/
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
I am using PHP 4, I have a date which I am adding to a MYSQL db, I have that bit sorted, I am trying to calculate an 2 expiry dates, one that is 1 year and 11 months ahead of the 1st date and another that is 2 years ahead of the 1st date.
Any Ideas, I have seen lots of scripts for adding days but not months or years. Thank you in advance for your reply
attached mail follows:
On Mon, Aug 20, 2001 at 12:12:15PM +0100, Peter Allum wrote: > I am using PHP 4, I have a date which I am adding to a MYSQL db, I have that > bit sorted, I am trying to calculate an 2 expiry dates, one that is 1 year > and 11 months ahead of the 1st date and another that is 2 years ahead of the > 1st date. > > Any Ideas, I have seen lots of scripts for adding days but not months or > years. > Thank you in advance for your reply
Peter,
For the first date: ----- $month = date("m") + 11; $day = date("d"); $year = date("Y") + 1; $newDate = date("Y-m-d",mktime(0,0,0,$month,$day,$year));
or
$newDate = date("Y-m-d",mktime(0,0,0,date("m")+11,date("d"),date("Y")+1)); -----
And for the second date: ----- $month = date("m") + 11; $day = date("d"); $year = date("Y") + 3; $newDate = date("Y-m-d",mktime(0,0,0,$month,$day,$year));
or
$newDate = date("Y-m-d",mktime(0,0,0,date("m")+11,date("d"),date("Y")+3)); -----
And that's all you need!
-- * R&zE:-- »»»»»»»»»»»»»»»»»»»»»»»» -- Renze Munnik -- DataLink BV -- -- E: renze
datalink.nl -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- -- http://www.datalink.nl -- ««««««««««««««««««««««««
attached mail follows:
Greetings.
I am experiencing an odd issue that I am not sure is Apache or PHP (php-4.0.4pl1-9) related.
The issue is that every once in a while I get a full copy of a page in my system error_log. That is, not the error_log for the site the page exists on, but the /var/log/httpd/error_log.
I have studied my logs and not found any relationship between the pages that appear in this log, or with browsers, etc.
The only common thread here is that they are all php files, thus my post to this list. It *IS* possible that this is just a coincidence, as many of my pages are php based.
If this is in a FAQ somewhere or a common question, I apologize, I am new to this list. I would greatly appreciate a pointer to such a FAQ if it exists.
Thanks in advance for your time.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kermit
perkigoth.com http://www.perkigoth.com/
Perkigoth Streaming Music - Listen Now! - http://www.perkigoth.com/music/
Ain't Dead Yet! August 25th, 2001 http://www.perkigoth.com/aintdeadyet/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attached mail follows:
Dear sirs; i have a simple snippet of code : <? session_start(); $a = 10; session_register("a"); ?>
i am trying to understand how do session work.
Accessing at this document directly from the server (it is a SuSE 7.2 PE - running PHP 4.0.4 and apache 1.3.9) i find out the following problem:
Warning: cannot send session cookie - headers already sent (output started at ....)
and
Warning: cannot send session cache limiter - headers already sent (output started at ....)
The matter is that if i access this variables from another page, they seem to be empty...
How can i solve this little confusing problem?
Thanks in advance
Gabriele
attached mail follows:
start your session before sending any html output to browser check that register_globals is on if not use $HTTP_SESSION_VARS("a") instead to reference your session var assign a value after having initialiazed your var not before
---------- Original Message ----------------------------------
From: "Gabriele Biondo" <gbiondo
mac.com>
Date: Mon, 20 Aug 2001 14:34:35 +0200
>Dear sirs;
>i have a simple snippet of code :
><?
> session_start();
> $a = 10;
> session_register("a");
>?>
>
>i am trying to understand how do session work.
>
>Accessing at this document directly from the server (it is a SuSE 7.2 PE -
>running PHP 4.0.4
>and apache 1.3.9) i find out the following problem:
>
>Warning: cannot send session cookie - headers already sent (output started
>at ....)
>
>and
>
>Warning: cannot send session cache limiter - headers already sent (output
>started at ....)
>
>The matter is that if i access this variables from another page, they seem
>to be empty...
>
>How can i solve this little confusing problem?
>
>Thanks in advance
>
>Gabriele
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
>For additional commands, e-mail: php-general-help
lists.php.net
>To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
>
attached mail follows:
> start your session before sending any html output to browser
Okay. This solves the problem w/the warnings
> check that register_globals is on
It is actually on
> if not use $HTTP_SESSION_VARS("a") instead to reference your session var > assign a value after having initialiazed your var not before Done. Nothing changes at all... my variables are saved (session_register("a") returns true) but from the second page, wich code is: <?session_start(); print $HTTP_SESSION_VARS["a"]; print "<br>$a"; ?> i do not see anything at all...
more suggestions?
thanks in advance
Gabriele
attached mail follows:
Is there any way to tell ImagePNG() to create PNG24 images instead of PNG8 images? Seems that ImageCreateFromPNG() can read PNG24, but ImagePNG() writes only PNG8.
attached mail follows:
Hi Folks,
Can't find an answer in the archives... Can php parse DW templates? ie. I want only a small amount of code to be editable with the <?php ?> tag. Dreamweaver places the following code to identify editable regions: <!-- #BeginEditable "Name_of_region" --> \\ editable code here <!-- #EndEditable -->
I don't think PHP will parse the tags and leave them as dw comments only. They appear to invoke server functions e.g. <!-- #include file="" --> Is there a way to configure PHP to ignore these tags?
Kind regards
Steve
attached mail follows:
I think you should look at Smarty Template Engine: http://www.phpinsider.com/php/code/Smarty/ Hope this helps.
Regards
-- Darius IvanauskasOn Mon, 20 Aug 2001, -:-Doigy-:- wrote:
> Hi Folks, > > Can't find an answer in the archives... > Can php parse DW templates? > ie. I want only a small amount of code to be editable with the <?php ?> tag. > Dreamweaver places the following code to identify editable regions: > <!-- #BeginEditable "Name_of_region" --> > \\ editable code here > <!-- #EndEditable --> > > I don't think PHP will parse the tags and leave them as dw comments only. > They appear to invoke server functions e.g. <!-- #include file="" --> > Is there a way to configure PHP to ignore these tags? > > Kind regards > > Steve > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net > For additional commands, e-mail: php-general-help
lists.php.net > To contact the list administrators, e-mail: php-list-admin
lists.php.net >
attached mail follows:
PHP already ignores those SGML comments. They're just there for the Dreamweaver editor to know where the editable regions are.
- Tim
On Mon, 2001-08-20 at 08:45, -:-Doigy-:- wrote: > Hi Folks, > > Can't find an answer in the archives... > Can php parse DW templates? > ie. I want only a small amount of code to be editable with the <?php ?> tag. > Dreamweaver places the following code to identify editable regions: > <!-- #BeginEditable "Name_of_region" --> > \\ editable code here > <!-- #EndEditable --> > > I don't think PHP will parse the tags and leave them as dw comments only. > They appear to invoke server functions e.g. <!-- #include file="" --> > Is there a way to configure PHP to ignore these tags? > > Kind regards > > Steve > > > > >
attached mail follows:
Dear all I was trying to get a user input form to insert to a mysql_database and e-mail to me! Is it possible to make php perform two task in one single submit button?
The form will post the input --> mail.php.
In the mail.php, i was thinking to add another process just after the mail process had finish, which will insert the data from the from to mysql_database.
Thx
Jack
jack
nedcor.com
attached mail follows:
you're there already.
have an if statement on mail.php:
if (isset($posted_info)) {
// send mail here
// do db insert here
} // end of if
Steve
"Jack" <jack
nedcor.com> wrote in message
news:20010820131552.9635.qmail
pb1.pair.com...
> Dear all
> I was trying to get a user input form to insert to a mysql_database and
> e-mail to me!
> Is it possible to make php perform two task in one single submit button?
>
> The form will post the input --> mail.php.
>
> In the mail.php, i was thinking to add another process just after the mail
> process had finish, which will insert the data from the from to
> mysql_database.
>
> Thx
> Jack
> jack
nedcor.com
>
>
attached mail follows:
: In the mail.php, i was thinking to add another process just after the mail : process had finish, which will insert the data from the from to : mysql_database.
You could include(); the file that adds it to the database. I know what you're getting at, I do it myself.
«dc»
attached mail follows:
Steve Werby wrote:
> Others on the list made good suggestions about the database structure. The > URL you referenced reloads the whole page. I've seen other sites achieve > the same functionality by loading the elements of the second, third and > fourth select boxes into javascript arrays which and regenerate the contents > of the dropdown boxes and make them visible based on the element selected in > the parent select box.
I wouldn't being doing that, based on the plain and simple reason that if the user has javascript turned off, the whole thing falls apart.
With carefull <NOSCRIPT> content, it *might* be do-able, but it's one of those risks that I wouldn't be taking on a commercial site which is trying NOT to alienate customers and prevent sales.
In a controlled environment (corporate intranet) I agree this style solution would be lurvly, but I wouldn't want to turn away a single user if my site relied on sales to survive.
If the page that reloads is lean and fast loading, it will be the best solution to just reload and avoid problems.
Justin French
Creative Director Indent.com.au
> This avoids a page reload, but forces the page to
> load all of the possible select box elements when it's first loaded - and it
> obviously requires javascript. It might be a good alternative depending on
> your needs. I've found that it only makes sense when very few target users
> will have javascript disabled and the potential contents of the select boxes
> are less extensive than make and model detail.
>
> --
> Steve Werby
> President, Befriend Internet Services LLC
> http://www.befriend.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
Jack, Yes, you can do as many things as you want in a php document before you have die() at the end :) Angie
>>> "Jack" <jack
nedcor.com> 08/20/01 08:12AM >>>
Dear all
I was trying to get a user input form to insert to a mysql_database and
e-mail to me!
Is it possible to make php perform two task in one single submit button?
The form will post the input --> mail.php.
In the mail.php, i was thinking to add another process just after the mail process had finish, which will insert the data from the from to mysql_database.
Thx
Jack
jack
nedcor.com
-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-windows-unsubscribelists.php.net For additional commands, e-mail: php-windows-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
No problem... I do this with a file upload. Just include a mail function before or after the other work you do with the information:
if ( isset ( $files ) ) {
//send an email to the webmaster if someone hits this area
MAIL( "webmaster
lcounty.com", "CC Resolution Uploads Attempted", "From:
$email\nX-Mailer: PHP/" . phpversion());
for ( $i=0 ; file_exists ( $files[$i] ) ; $i++ ) { echo "Trying to upload " . $files_name[$i] . "...<br />\n";
// if the file is too big, don't accept it (200K) if ( $files_size[$i] > 200000 ) { echo "The file, $result_name ($file_size bytes), is too big. Files that large are too big for this particular use. Possible attack dropped. Please contact $webmaster if you receive this message.<br />\n"; }
// if $result_name isn't empty, try to copy the file elseif ( eregi ( "([0-9]{1,3})\-([0-9]{1,3})([A-Za-z]?)([a-z0-9 ,.]*).(doc|rtf)" , $files_name[$i] , $newres_name ) ) {
etc. etc. etc.
}
---------------------
John Asendorf - jasendorf
lcounty.com
Web Applications Developer
http://www.lcounty.com - NEW FEATURES ADDED DAILY!
Licking County, Ohio, USA
740-349-3631
Aliquando et insanire iucundum est
> -----Original Message-----
> From: Jack [mailto:jack
nedcor.com]
> Sent: Monday, August 20, 2001 9:13 AM
> To: php-db
lists.php.net; php-general
lists.php.net;
> php-windows
lists.php.net
> Subject: [PHP-WIN] Multi-Task on PHP by submitting a form!
>
>
> Dear all
> I was trying to get a user input form to insert to a
> mysql_database and
> e-mail to me!
> Is it possible to make php perform two task in one single
> submit button?
>
> The form will post the input --> mail.php.
>
> In the mail.php, i was thinking to add another process just
> after the mail
> process had finish, which will insert the data from the from to
> mysql_database.
>
> Thx
> Jack
> jack
nedcor.com
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-windows-unsubscribe
lists.php.net
> For additional commands, e-mail: php-windows-help
lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin
lists.php.net
>
attached mail follows:
Have you tried this?
header("Content-Type: application/x-octet-stream"); header("Content-Description: MP3 file");
David Minor wrote:
> Can anybody tell me why this doesn't work in IE? I need to force download > mp3 files instead of IE5.5 trying to apply a helper app. This code works > fine for NN. > > // detect for MSIE bug > if (strstr($HTTP_USER_AGENT, "MSIE")) > $attachment = ""; > else > $attachment = " attachment;"; > > // stream file to user > header("Content-Type: application/octet-stream"); > header("Content-Disposition:$attachment filename=$filename"); > header("Content-Length: ".filesize($tmp_file)); > header("Content-Transfer-Encoding: binary"); > readfile($tmp_file);
attached mail follows:
Hi, please, how to run php function which update mysql db from command line?
Thanks in advance
-- Moise Bertrand TACHAGO Computer scientist, Volunteer DBMS Specialist SDNP Cameroon, 506 Hajal Center Building, Yaounde CAMEROON phone (237)22 24 90 E_mails mbtachagosdnp.cm tachago_bertrand
yahoo.fr
attached mail follows:
First of all, you need to have php installed WITHOUT a webserver. If you haven't done this already, download php, and this should be your ./configure command: ./configure --with-mysql make; make install
your php binary will be in /usr/local/lib/php/bin/php (I think). Then put this in test.php, and chmod +x it: #!/usr/local/lib/php/bin/php $connection = mysql_connect("localhost","user","pass"); $db = mysql_select_db("db_to_use", $connection); $sql = mysql_query("UPDATE table SET name='name', email='email'");
Then do ./test.php from the command line.
-- Tyler Longren Captain Jack Communications tylercaptainjack.com www.captainjack.com
On Mon, 20 Aug 2001 14:13:34 +0100 Moise Bertrand TACHAGO <mbtachago
sdnp.cm> wrote:
> Hi, > please, how to run php function which update mysql db from command line? > > Thanks in advance > > -- > Moise Bertrand TACHAGO > Computer scientist, Volunteer DBMS Specialist > SDNP Cameroon, 506 Hajal Center Building, Yaounde CAMEROON > phone (237)22 24 90 > E_mails mbtachago
sdnp.cm > tachago_bertrand
yahoo.fr > > >
attached mail follows:
"Dave" <dave
nexusinternetsolutions.net> wrote in message
news:DBEIKNMKGOBGNDHAAKGNKEFOHNAA.dave
nexusinternetsolutions.net...
> please hack apart this solution and point out the error/insecure nature of
the
> setup.
>
> goal, provide php access to name based virtual hosts on FreeBSD boxes
>
> problem, security of PHP access to base system and other user scripts
>
> solution,
>
> apache compiled with suexec
> # set user and group to unique
> chown USERID:USERID /path/to/user/html/directory
>
> # no public access to any files under here that
> # you don't want public reading, like scripts
> # with database login information in them
> chmod -R 0750 /path/to/user/html/directory
>
> # set group sticky execution... we will run
> # apache as this unique group so may not be needed
> chmod g+s /path/to/user/html/directory
>
> >in apache's httpd.conf
> # set each virtual host to run any accesses
> # as the group USERID giving them only access
> # to this directory... defeats PHP directory
> # and shell scripts as long as no public read bits
> # are set
> <virtual *>
> ServerName whatever.com
> Group USERID
> </virtual>
>
>
> Sufficient?
>
> you end up with http://test1.com and http://test2.com being unable to
create PHP
> scripts or do listings of any other virtual user directory since they are
not of
> the same group, but accesses to the site are made by invoking apache as
that
> group for that session.
>
> directory tree
> drwxr-s--- 2 user1 user1 512 Aug 19 18:23 vtest1
> drwxr-s--- 2 user2 user2 512 Aug 19 18:26 vtest2
>
> with directory groups set in the httpd.conf for user1 in vtest1 and user2
in
> vtest2, neither user should be able to use PHP filesystem functions to
browse
> the other directories as long as no public bits are set, and apache server
> requests still server the documents from the directories since each users
> directory has an Group user1 (or user2) set for his directory in the
directory
> or virtual container, thus executing the apache requsts as the appropriate
user
> and not the generic www user.
>
>
> Please feel free to point out any errors in my logic... it appears pretty
solid
> from here.
>
> Dave
>
Have you looked at "open_basedir" in php.ini ? Here's what I do: in php.ini open_basedir = /dev/null
in httpd.conf <VirtualHost 192.168.1.10> ServerName whatever.com php_admin_value open_basedir /path/to/website </VirtualHost>
Peter
attached mail follows:
With 4.04 I had PNG working fine and could create images in a cron job I was running. When we upgraded to 4.06 we seemed to have lost the ability. While calling my PHP file up in the browser, it creates the image but my cron job keeps failing with this error:
ImageCreateFromPng: No PNG support in this PHP build
Anyone have any hints on how to fix this?
Jeff
attached mail follows:
I have had the same problem with no resolution is this a BUG?
At 10:21 AM 8/20/01 -0400, Jeff Lewis wrote: >With 4.04 I had PNG working fine and could create images in a cron job I >was running. When we upgraded to 4.06 we seemed to have lost the >ability. While calling my PHP file up in the browser, it creates the >image but my cron job keeps failing with this error: > >ImageCreateFromPng: No PNG support in this PHP build > >Anyone have any hints on how to fix this? > >Jeff
attached mail follows:
looks like some GD options were changed between builds.
check phpinfo() to find out how PHP was compiled, and what version GD it's using.
> -----Original Message-----
> From: Jeff Lewis [mailto:jeff
hyrum.net]
> Sent: Monday, August 20, 2001 10:21 AM
> To: php-general
lists.php.net
> Subject: [PHP] PNG support...
>
>
> With 4.04 I had PNG working fine and could create images in a cron job I
> was running. When we upgraded to 4.06 we seemed to have lost the ability.
> While calling my PHP file up in the browser, it creates the image but my
> cron job keeps failing with this error:
>
> ImageCreateFromPng: No PNG support in this PHP build
>
> Anyone have any hints on how to fix this?
>
> Jeff
>
attached mail follows:
The GD section looks like:
gd GD Support enabled GD Version 1.6.2 or higher FreeType Support enabled FreeType Linkage with TTF library JPG Support enabled WBMP Support enabled
Hopefully that shows :)
GD Support: Enabled GD Version: 1.6.2 or higher FreeType Support: enabled FreeType Linkage: with TTF library JPG Support: enabled WBMP Support: enabled
Jeff
----- Original Message -----
From: "scott [gts]" <scott
graphictype.com>
To: "php" <php-general
lists.php.net>
Sent: Monday, August 20, 2001 10:57 AM
Subject: RE: [PHP] PNG support...
> looks like some GD options were changed between builds.
>
> check phpinfo() to find out how PHP was compiled,
> and what version GD it's using.
>
> > -----Original Message-----
> > From: Jeff Lewis [mailto:jeff
hyrum.net]
> > Sent: Monday, August 20, 2001 10:21 AM
> > To: php-general
lists.php.net
> > Subject: [PHP] PNG support...
> >
> >
> > With 4.04 I had PNG working fine and could create images in a cron job I
> > was running. When we upgraded to 4.06 we seemed to have lost the
ability.
> > While calling my PHP file up in the browser, it creates the image but
my
> > cron job keeps failing with this error:
> >
> > ImageCreateFromPng: No PNG support in this PHP build
> >
> > Anyone have any hints on how to fix this?
> >
> > Jeff
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
>
>
attached mail follows:
Hiya again, Erik:
Here's the barely-tested but apparently functional Code Red detector. I added some variables at the top for configuring email destinations. The important change is that it will query ARIN, RIPE, and APNIC until it finds a reasonable answer. In the case of ARIN, it's necessary to query twice to get the email address you REALLY want, due to the number of Tier II providers in the States. Those don't always show up in the WHOIS. That caused me to do a bit more looping and fiddling until the answers came out the way I would expect if I were looking by eye.
It may be a bit late for Code Red, but the part of the routine that does the authority-queries is re-usable all over the place. The code ain't pretty (I'm no PHP maven YET :-) but it appears to do the job.
Enjoy! Bill
-----Original Message-----
From: Erik H. Mathy [mailto:erik
butlerandco.com]
Sent: Tuesday, August 14, 2001 3:43 PM
To: Bill Farrell
Subject: RE: [PHP] new one is it ??
No worries. I'm not going to get all worked up when something that's free
takes a bit longer than expected! :)
-----Original Message-----
From: billfarr
ages.com [mailto:billfarr
ages.com]
Sent: Tuesday, August 14, 2001 2:45 PM
To: erik
butlerandco.com
Subject: RE: [PHP] new one is it ??
Hey!
Just wanted to let ya know that I didn't get time to work on it last night,
but have been playing with it through the day. I should finish the thing
tonight and test it.
I hadn't forgot ya!
Regards,
B
-----Original Message-----
From: Erik H. Mathy [mailto:erik
butlerandco.com]
Sent: Monday, August 13, 2001 1:44 PM
To: Bill Farrell
Subject: RE: [PHP] new one is it ??
You da man! You da man!
Or, in other words, that's awesome and, um, I'll take a copy when you're
done. ;)
- Erik
> -----Original Message-----
> From: billfarr
ages.com [mailto:billfarr
ages.com]
> Sent: Monday, August 13, 2001 12:44 PM
> To: php-general
lists.php.net
> Subject: RE: [PHP] new one is it ??
>
>
> Way cool... with a bit of work, one could query ARIN, RIPE, and APNIC
> until
> an answer was received (that's what I'm modifying it to do) else die.
> With
> the timeout set to "forever", what would we care if it takes a few extra
> seconds to go spy-out a potential
> (would-be-if-we-were-running-IIS)intruder.
>
> The author made a really nifty framework and left it pretty easy to
> modify.
> I already swiped a copy (thanks, Mark!!) and am having a ball adding my
> own
> "bends" to it.
>
> Tim, the part that does the WHOIS query is only querying RIPE. I'm
> modifying mine to loop through a known set of authorities (right now,
> the
> three I mentioned above) and to set a flag ($IGotIt or something I can
> test
> afterward with "if ( $IGotIt ) { yaddayadda }"), and to quit looking
> when it
> gets a reasonable answer.
>
> If I get it working before anyone else (doubtful, I'm still a bit slow
> with
> PHP and I'm also at work), I'd be more than happy to share.
>
> CY'all,
> Bill
>
> -----Original Message-----
> From: Tim [mailto:infoz
earthlink.net]
> Sent: Monday, August 13, 2001 1:16 PM
> To: Mark Roedel
> Cc: Mark Lo; php general
> Subject: RE: [PHP] new one is it ??
>
>
> That's pretty cool. Alas, the 'whois' part of the code doesn't work
> properly (at least on my system).
>
> - Tim
>
> On 13 Aug 2001 10:21:45 -0500, Mark Roedel wrote:
> > I rather liked this approach that I saw posted in another list:
> >
> > http://www.klippan.seths.se/default.phps
> >
> > (Does some hostname/whois lookups on the infected server and attempts
> to
> > email some people who might be able to do something about it.)
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
attached mail follows:
I can't figure out why the if statement isn't working. The page displays the same with or without the if statement. Any idea what I'm doing wrong?
I attached the code in a word document.
Thank you, Shawna
attached mail follows:
Here's the attachment - I hate it when I do that! :)
-----Original Message-----
From: sgibbs
vt.globalhealth.org
To: php-general
lists.php.net
Sent: 8/20/01 10:25 AM
Subject: [PHP] while loop with if statement
I can't figure out why the if statement isn't working. The page displays the same with or without the if statement. Any idea what I'm doing wrong?
I attached the code in a word document.
Thank you, Shawna
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
did you do it again ?
:-)
pasting you code is ok ...
Steve
<sgibbs
vt.globalhealth.org> wrote in message
news:BB6D932A42D6D211B4AC0090274EBB1D2EF0EE
GLOBAL1...
>
> Here's the attachment - I hate it when I do that! :)
>
>
>
> -----Original Message-----
> From: sgibbs
vt.globalhealth.org
> To: php-general
lists.php.net
> Sent: 8/20/01 10:25 AM
> Subject: [PHP] while loop with if statement
>
> I can't figure out why the if statement isn't working. The page
> displays
> the same with or without the if statement. Any idea what I'm doing
> wrong?
>
> I attached the code in a word document.
>
> Thank you, Shawna
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
>
attached mail follows:
Thanks Steve! :) Here's the code:
<?
$results = mysql_db_query("$db", "select * from $table where $query order by update_datetime desc limit $offset, 10");
while($one = mysql_fetch_array($results)){ $id=$one["id"]; $title=$one["title"]; $description=$one["description"];
print " <TR><TD VALIGN=TOP><img src=/assets/images/bullet.gif width=10 height=8></TD><TD><FONT FACE=VERDANA,ARIAL,HELVETICA,SANS-SERIF SIZE=2><A HREF=/view_top.php3?id=$id>$title</A><BR>$description</TD></TR>\n <TR><TD VALIGN=TOP COLSPAN=2><img src=/assets/images/spacer.gif width=10 height=6></TD></TR>\n "; }; if($results <= 0) { print " <TR><TD><FONT FACE=VERDANA,ARIAL,HELVETICA,SANS-SERIF SIZE=2>NO RESULTS</TD></TR>\n <TR><TD VALIGN=TOP COLSPAN=2><img src=/assets/images/spacer.gif width=10 height=6></TD></TR>\n "; }
?>
attached mail follows:
try using mysql_num_rows() to get the number of rows returned by the query. you need to supply it with the identifier for the query not the sql you sent to the query. not exactly sure what you're trying to do though ...
Steve
<sgibbs
vt.globalhealth.org> wrote in message
news:BB6D932A42D6D211B4AC0090274EBB1D2EF0F0
GLOBAL1...
> Thanks Steve! :) Here's the code:
>
> <?
>
> $results = mysql_db_query("$db", "select * from $table where $query order
> by update_datetime desc limit $offset, 10");
>
> while($one = mysql_fetch_array($results)){
> $id=$one["id"];
> $title=$one["title"];
> $description=$one["description"];
>
> print "
> <TR><TD VALIGN=TOP><img src=/assets/images/bullet.gif width=10
> height=8></TD><TD><FONT FACE=VERDANA,ARIAL,HELVETICA,SANS-SERIF SIZE=2><A
> HREF=/view_top.php3?id=$id>$title</A><BR>$description</TD></TR>\n
> <TR><TD VALIGN=TOP COLSPAN=2><img src=/assets/images/spacer.gif
> width=10 height=6></TD></TR>\n
> ";
> };
>>>>>>>>>>>>>>>$numrows=mysql_num_rows($one);
> if($numrows= =0) > { > print " > <TR><TD><FONT FACE=VERDANA,ARIAL,HELVETICA,SANS-SERIF SIZE=2>NO > RESULTS</TD></TR>\n > <TR><TD VALIGN=TOP COLSPAN=2><img src=/assets/images/spacer.gif > width=10 height=6></TD></TR>\n > "; > > } > > ?> >
attached mail follows:
okay - read all the code now.
this might be a better way:
<?php
$results = mysql_db_query("$db", "select * from $table where $query order by update_datetime desc limit $offset, 10");
$one = mysql_fetch_array($results);
$numrows=mysql_num_rows($one); // get the number of results if ($numrows>0) { for ($x=0;$x<$numrows;$x++) { $id=$one["id"]; $title=$one["title"]; $description=$one["description"];
print " <TR><TD VALIGN=TOP><img src=/assets/images/bullet.gif width=10 height=8></TD><TD><FONT FACE=VERDANA,ARIAL,HELVETICA,SANS-SERIF SIZE=2><A HREF=/view_top.php3?id=$id>$title</A><BR>$description</TD></TR>\n <TR><TD VALIGN=TOP COLSPAN=2><img src=/assets/images/spacer.gif width=10 height=6></TD></TR>\n "; } // end of for } else { print " <TR><TD><FONT FACE=VERDANA,ARIAL,HELVETICA,SANS-SERIF SIZE=2>NO RESULTS</TD></TR>\n <TR><TD VALIGN=TOP COLSPAN=2><img src=/assets/images/spacer.gif width=10 height=6></TD></TR>\n "; } ?>
attached mail follows:
At 11:02 AM -0400 8/20/01, sgibbs
vt.globalhealth.org wrote:
>
><?
>
>$results = mysql_db_query("$db", "select * from $table where $query order
>by update_datetime desc limit $offset, 10");
>
>while($one = mysql_fetch_array($results)){
> $id=$one["id"];
> $title=$one["title"];
> $description=$one["description"];
>
> print "
> <TR><TD VALIGN=TOP><img src=/assets/images/bullet.gif width=10
>height=8></TD><TD><FONT FACE=VERDANA,ARIAL,HELVETICA,SANS-SERIF SIZE=2><A
>HREF=/view_top.php3?id=$id>$title</A><BR>$description</TD></TR>\n
> <TR><TD VALIGN=TOP COLSPAN=2><img src=/assets/images/spacer.gif
>width=10 height=6></TD></TR>\n
> ";
> };
>
> if($results <= 0)
> {
> print "
> <TR><TD><FONT FACE=VERDANA,ARIAL,HELVETICA,SANS-SERIF SIZE=2>NO
>RESULTS</TD></TR>\n
> <TR><TD VALIGN=TOP COLSPAN=2><img src=/assets/images/spacer.gif
>width=10 height=6></TD></TR>\n
> ";
>
> }
>
>?>
try...
<?
$results = mysql_db_query("$db", "select * from $table where $query order by update_datetime desc limit $offset, 10");
while($one = mysql_fetch_array($results)){ $id=$one["id"]; $title=$one["title"]; $description=$one["description"];
if($results <= 0) { print " <TR><TD><FONT FACE=VERDANA,ARIAL,HELVETICA,SANS-SERIF SIZE=2>NO RESULTS</TD></TR>\n <TR><TD VALIGN=TOP COLSPAN=2><img src=/assets/images/spacer.gif width=10 height=6></TD></TR>\n "; else { print " <TR><TD VALIGN=TOP><img src=/assets/images/bullet.gif width=10 height=8></TD><TD><FONT FACE=VERDANA,ARIAL,HELVETICA,SANS-SERIF SIZE=2><A HREF=/view_top.php3?id=$id>$title</A><BR>$description</TD></TR>\n <TR><TD VALIGN=TOP COLSPAN=2><img src=/assets/images/spacer.gif width=10 height=6></TD></TR>\n ";
}; }
?>
The if should be before the print statement. You want it to compare then print, not print then compare.
Alnisa
--
.........................................
Alnisa Allgood
Executive Director
Nonprofit Tech
(ph) 415.337.7412 (fx) 415.337.7927
(url) http://www.nonprofit-techworld.org
(url) http://www.nonprofit-tech.org
(url) http://www.tech-library.org
.........................................
Nonprofit Tech E-Update
mailto:nonprofit-tech-subscribe
egroups.com
.........................................
applying technology to transform
.........................................
attached mail follows:
I am interested in speaking to anyone who has used PHP's gettext() functionality on a fairly large website, preferably one that uses CVS for development.
We are in the process of getting our site ready for i18n, and want to use gettext(). However, I'm a bit unsure on how to set up the file structure.
Our site consists of about 400+ seperate PHP files, in about 5 levels of subdirectories. To generate and maintain one .po file for the entire site would be unmanageable I think. Ditto for maintaining 400+ .po files, one per PHP file.
I'm wondering how other people have addressed this issue. Feel free to respond on- or off-list.
- Colin
attached mail follows:
hi.
I work in ISP and work on distrbuted database, I want to secure it. I search and find that freebsd work for help linux for secure it. but I dont know how is it?
I define group and user in shell not in php. my question is: how do I do it with php? and how freebsd help me??
thanks much.
attached mail follows:
Hi, I would like to know how to crop this string from this,
$string = \home\folder1\folder2\page1.php
to this
$string = page1.php
attached mail follows:
basename()
On Mon, 20 Aug 2001, Jeremy Morano wrote:
> Hi, > > I would like to know how to crop this string from this, > > $string = \home\folder1\folder2\page1.php > > to this > > > $string = page1.php > > > >
attached mail follows:
Hi all,
How could I use a script on the console - to interact, and take the users input. Like a shell/perl script - but in php?
Bill.
attached mail follows:
#!/path/to/php -q <?PHP
echo "Hello World!\n";
?>
On Mon, Aug 20, 2001 at 05:14:22PM +0100, Bill Brigden wrote:
> Hi all,
>
> How could I use a script on the console - to interact, and take the users
> input. Like a shell/perl script - but in php?
>
> Bill.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
-- -------------------------------------------------- Andrew Libby Director of Technology CommNav, Inc alibbycommnav.com
attached mail follows:
I haven't tried this personally, but according to
http://www.php.net/manual/en/function.fopen.php
you can open the standard streams as php://stdin and php://stdout, which should allow you to read and write to the user directly.
- Tim
On Mon, 2001-08-20 at 12:14, Bill Brigden wrote: > Hi all, > > How could I use a script on the console - to interact, and take the users > input. Like a shell/perl script - but in php? > > Bill. > > >
attached mail follows:
This is actually not so difficult. Just download the mySQL documentation (from mysql.org or .com I believe is where I got it) and search the function list.
Johan Alfredeen
-----Original Message-----
From: Tom Carter [mailto:subs
roundcorners.com]
Sent: Sunday, August 19, 2001 8:53 AM
To: Chris Lambert; php-general
lists.php.net
Subject: Re: [PHP] MySQL substrings?
very hard obviously.. I've looked quite a bit before to no avail! I tried guessing it, obviously stupidity prevailed
(note to self.. go back and use substring function instead)
----- Original Message -----
From: "Chris Lambert" <chris
php.net>
To: <php-general
lists.php.net>
Sent: Sunday, August 19, 2001 3:48 PM
Subject: Re: [PHP] MySQL substrings?
> There is a SUBSTRING() function, its just hard to find with their search
> system.
>
> /* Chris Lambert, CTO - chris
whitecrown.net
> WhiteCrown Networks - More Than White Hats
> Web Application Security - www.whitecrown.net
> */
>
> ----- Original Message -----
> From: Tom Carter <subs
roundcorners.com>
> To: Seb Frost <seb
raceshoot.com>; <php-general
lists.php.net>
> Sent: Sunday, August 19, 2001 10:32 AM
> Subject: Re: [PHP] MySQL substrings?
>
>
> | You can achieve the same effect by using left and right
> | ----- Original Message -----
> | From: "Seb Frost" <seb
raceshoot.com>
> | To: <php-general
lists.php.net>
> | Sent: Sunday, August 19, 2001 3:12 PM
> | Subject: [PHP] MySQL substrings?
> |
> |
> | > This is thew sort of thing I want:
> | >
> | > SELECT * FROM table ORDER BY substr(field,5,6)
> | >
> | > but I don't know the correct function, if there is one, or how to
> | implement
> | > it.
> | >
> | > cheers,
> | >
> | > - seb
> | >
> | > -----Original Message-----
> | > From: Michael [mailto:mwaples
waples.net]
> | > Sent: 19 August 2001 12:51
> | > To: php-general
lists.php.net
> | > Subject: [PHP] Re: transaction
> | >
> | >
> | > Nafiseh Saberi wrote:
> | > >
> | > > hi.
> | > > in large database with php,postgres
> | > > and when in each time come many request ,
> | > > how do we implement transactions??
> | >
> | > > nafiseh.
> | >
> | > If you are wanting to run several queries in the one script though the
> | > one transaction -
> | > you'll need to send a begin(as a query) and execute it - then to the
> | > same connection send all your other queries as normal, and follow it
up
> | > with a commit.
> | >
> | > --
> | > PHP General Mailing List (http://www.php.net/)
> | > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> | > For additional commands, e-mail: php-general-help
lists.php.net
> | > To contact the list administrators, e-mail:
php-list-admin
lists.php.net
> | >
> | >
> | > --
> | > PHP General Mailing List (http://www.php.net/)
> | > To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> | > For additional commands, e-mail: php-general-help
lists.php.net
> | > To contact the list administrators, e-mail:
php-list-admin
lists.php.net
> | >
> |
> |
> | --
> | PHP General Mailing List (http://www.php.net/)
> | To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> | For additional commands, e-mail: php-general-help
lists.php.net
> | To contact the list administrators, e-mail: php-list-admin
lists.php.net
> |
> |
> |
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe
lists.php.net
> For additional commands, e-mail: php-general-help
lists.php.net
> To contact the list administrators, e-mail: php-list-admin
lists.php.net
>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribelists.php.net For additional commands, e-mail: php-general-help
lists.php.net To contact the list administrators, e-mail: php-list-admin
lists.php.net
attached mail follows:
Hi, I'm trying to use crypt to make MD5 passwords and am having troubles. I read that I need to have MD5 crypt support at "./configure" time of installation. I noticed from configure that I get this: "checking for MD5 crypt... no". I am running SuSE, what package do I need to get MD5 crypt support enabled?
Thanks,
Casey Mueller
casey
gcentral.com
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]