Re: [PHP] extension development
Evert|Rooftop wrote: Hi people, I want to write a PHP extension that allows clustering and simple information sharing between processes and hosts. What would be the prober mailing list subscribe to for my questions about the zend engine? grt, Evert See http://pecl.php.net for information on exsisting extensions. http://pecl.php.net/support.php has a list of mailing lists and resources. Also, one of the best way to learn about writing extensions is from looking at source of other extensions. And of course, the good ol' PHP manual is also useful: http://www.php.net/manual/en/zend.php Regards, Matthew Fonda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Matching Number of Times a Word Occurs...
Hello, http://us4.php.net/substr_count Regards, Matthew Fonda Russell P Jones wrote: Im trying to count the number of times a word occurs in a string - is the only way to do this preg_match_all? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Amazon/eBay API
Brian Dunning wrote: Does anyone know of any PHP classes for processing the Amazon or eBay XML feeds? There are two PEAR classes which handle both of these things, Services_Ebay and Services_Amazon. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IRC from PHP - help
You might want to check out PEAR::Net_SmartIRC http://pear.php.net/package/Net_SmartIRC hello i'm a newcomer to this list, fairly experienced PHP programmer but coding mostly for personal web sites or hobbies. I also run an irc chat network and am curious as to if I can integrate php into it somehow. for example: I want to have a webpage that can present a list of all connected users to my irc network, or maybe a webpage to facilitate nickname registration/activation. my idea is to somehow connect a randomly-nicknamed client to the server like PHP-19942333 or something, which would execute the commands. I fully understand the irc protocol and have written a working irc client in VB. i don't have experience enough to know if PHP has some sort of event mechanism, for example, to be like on ircNamesList($names) { echo $names['1']; } or something. (pseudo-code) does anyone have an idea as to how this stuff could be done? Here's a sort of pseudo-code of what I'd want, PHP-style but obviously most of the functions are fake. // Begin pseudo-code. ?php echo Activating nickname...; $php_nickname = PHPInterface // or have it generate a random number irc_connect(192.168.1.1,6667,$php_nickname) $nick_command = REGISTER $_GET['nick'] $_GET['email'] $_GET['pass']; irc_send_privmsg(NickServ,$nick_command); // some way to hold processing until the response is received... wait_for_response(); // or maybe a while loop, like while $success = false... // after response, die exit(Finished); // parse response on event irc_privmsg($nick,$msg) { if ($nick == NickServ) { if ($msg == Your nickname has been successfully registered.) { echo Registration succeeded!; } elseif ($msg == Invalid syntax) { echo Error.; } irc_quit(PHP Script finished.); } ? obviously I'd also have to dress that page up a lot more, adding HTML code and such. This would also need a lot of error-trapping. Like if IRC couldn't connect for whatever reason, or if NickServ wasn't available, or who knows what. Well that's basically what I'm after. IDEAS??.. Flint -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php user groups - searching for php developers for a project...
Im not sure if you have checked it, but there is a calender on www.php.net with a list of a lot of user group events, perhaps you could find one there. hi... we're trying to find php developers/partners for a project, and we're wondering if there are php user groups in the cali/bay area (san fran/san jose) area that we can talk with, attend meetings, etc... searching google didn't really turn up anything... we know that there are some php job sites, but we didn't want to post there, given that this isn't a 'salaried' opportunity. this would be strictly startup/sweat equity, ie.. risky as hell!! thanks bruce [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5 Status
Yes, PHP5 is ready for production environments. It is stable, and has been stable for almost an entire year. Is PHP 5 ready for production environments? Is it concidered stable, or is it just a matter of going a while with no new bugs discovered to get to stable.. Colin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Help!
Chances are you are not connected to the database, or you have a MySQL error somewhere along the lines. Try using mysql_error() to help find whats going on. [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I get this error: Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/helljump/public_html/php/index.php on line 39 and I am connecting to the database! Here is line 39: ?php $query=mysql_query(SELECT boardid,boardname,boardcaption,topics,messages,views FROM boards ORDER BY id ASC); while($row=mysql_fetch_row($query)) echo 'tr ',shading(),'tda href=http://subzer0.net/php/topics.php?board='.$row[0].''.$row[1].'/a/ tdtd '.$row[2].'/tdtd'.$row[3].'/tdtd'.$row[4].'/td/tr'; echo 'tr class=cell1td align=center colspan=10bUser Options/b /td/trtr ',shading(),'tdUse your a href=/php/board_manager.phpboard manager/a to add or remove boards from the index./td/trtr ',shading(),' tda href=/php/meta_mod.phpMeta-Moderate/a to give feedback to the staff of '.$config['sitename'].'/td/tr'; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: modules
I would say the best way to go about doing this would be to look at examples of the code in sites you find that do this. Observe how they do it, and base your code off of it. Cima [EMAIL PROTECTED] wrote: hi, im building a web site and i have seen some sites built using modules to facilitate further maintainance. by modules im referring to having a module for administrating the web site , another for searchs to be done, another for reports to be generated ect. i hope im explaining my self. what i would like are references to documentation on how to build such a web site using php (im working php 4). thanx. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_fetch_row() --Still not working
Any idea how I could fix it? Yes, use mysql_error() to see what the error is, once you know what MySQL error you are getting, it will be easy to fix. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Netobjects Fusion problem
On Sat, 2005-03-26 at 11:43, Johan van Zyl wrote: Fatal error: Call to undefined function: ibase_fetch_assoc() in /home/e-smith/files/ibays/Primary/html/html/untitled17.php on line 209 How do I slove this? Perhaps you haven't updated for a while, so you don't have this function in your PHP version. This is a note on the ibase_fetch_assoc() manual page saying: If your php is older than version 4.3.0, you can use the following: $arr_record = get_object_vars(ibase_fetch_object($sql_result)); which is the same as: $arr_record = ibase_fetch_assoc($sql_result); -- Regards, Matthew Fonda http://mfonda.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reg expressions
I wouldnt recommend using a regular expression for this. Regular expressions most of the time are now the answer. You could just do something like: foreach ($line as file('/home/virtual/')) { if (substr(trim($line), 0, 1) == '#') { //$line is a comment } else { //$line is not a comment } } On Fri, 2005-03-25 at 11:50, Steve Buehler wrote: Ok. I am really bad at regular expressions. I have to search through some files and put the contents into an array. A file could look like this: $aliases=`cat /home/virtual/site$site_id/fst/etc/mail/local-host-names`; start of file # local-host-names - include all aliases for your machine here. # Please do not add any domain names in this file. domain.net domain.com end of file In $aliases, I need to ignore the lines that start with a # sign. It is possible, but not probably that it will be more than just the first 2 lines and possible that it isn't even the first two lines. After done, $aliases should have just the two domain names in it. One per line. Then I need to loop through the lines in $aliases and do stuff with each line. Any help would be GREATLY appreciated. It would also be fine to just do a loop that checks each line. Since I guess that would be quicker. If the line starts with a #, then ignore it, otherwise, do some other stuff. Thanks Steve -- Regards, Matthew Fonda http://mfonda.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] following php development
Aaron Wormus writes an article called the PHPBarnstormer which contains a weekly summary of what is going on in PHP and in the mailing lists, you might check it out. http://phpbarnstormer.com On Fri, 2005-03-25 at 13:49, mbneto wrote: hi, I used to visit zend.com for the weekly summary but it seems that it has not been updated in a while. Besides the php-devel is there any other source of information about php's development ? -- Regards, Matthew Fonda http://mfonda.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: html image
Hello, I cannot think of anyway you could do this natively in PHP without using some kind of exterior library. You could always write a PHP extension to render HTML, then create a snapshot from that, but that would be a lot of work. I was searching around and found this, http://www.babysimon.co.uk/khtml2png/index.html you could use that, or even create a wrapper extension for it. Delos [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] i would like to produce a script that can make an image (screenshot) based only on the site url. so that i enter an URL and php makes the picture. can such a thing be done by php? if not, maybe by some other language? -- Regards, Matthew Fonda http://www.mfonda.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ending PHP
you could use die() or exit() they both take an optional parameter of a string to display when called. On Fri, 2005-03-25 at 20:12, Marquez Design wrote: I have an if statement, and if it is true, I want PHP not to continue. How do I do this? The following statement is true If ($a = $b){ This } Do not continue to the next piece of code, if false, continue to the next piece of code. Thanks for any help. -- Steve Marquez [EMAIL PROTECTED] -- Regards, Matthew Fonda http://mfonda.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] shell script - disable log output
I suppose error_log(My error message, 3, /dev/null) would work. On Wed, 2005-03-09 at 12:59, Eli wrote: Hello... I'm writing a shell script that uses error_log function to log some data, but it echos the error message to the output without logging the message to the log file. Code I use (php5 on unix): * #!/usr/local/php/bin/php -q ?php error_log(My error message); ? * OUTPUT: $ test.php My error message $ How can I prevent the error messages from being echoed to the client? -thanks, Eli -- Regards, Matthew Fonda http://mfonda.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comments and performance
Hello, Comments should not affect speed or performance at. Commenting is a good thing, and you should continue to do it. :) On Sat, 2005-03-05 at 13:15, Chris Smith wrote: Hi, Probably a silly question, but when I am writing php scripts (specifically large classes), I tend to write just as many comments as lines of code (for my own reference). Does this affect _execution performance_ of the scripts at all i.e. are they precompiled/interpreted and cached without comments or interpreted on every execution? I am using PHP 5.0.3 on Apache on Windows. Many Thanks, Chris Smith Ninja Labs http://www.ninjalabs.co.uk/ -- Regards, Matthew Fonda http://mfonda.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pulling content from a URL
I would recommend using PEAR::HTTP_Request for this. It does exactly what you want to do, and can handle error handling very well http://pear.php.net/package/HTTP_Request I'm writing a script that needs to put the contents of an external URL into a variable. I need to include some sort of error checking that will kill this request if for some reason the URL request hangs for more then 15 seconds. In researching this, I think the correct function to use is fsockopen, but I can't seem to get it to work. Can someone verify if fsockopen is the best way to grab an external URL, but kill the request if it hangs for a certain amount of time ... and if so, show me some sample code on how to place this URL's contents into a variable that I can then parse. The URL will be hard coded into the script, so I don't need a lot of error checking to insure correct URL format, etc. -- Regards, Matthew Fonda http://mfonda.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Data Encryption
shameless plug I would recommend using PEAR::Crypt_Blowfish http://pear.php.net/package/Crypt_Blowfish /shameless plug It should work pretty good and get exactly what you need to do done. You can provide a key, and it has a method to encrypt and decrypt text using the key, so should be pretty easy Hi, I'm not sure if this is even a PHP question, but I'm hoping someone can help me. I need to encipher data to be stored in a database and then I need to be able to decipher it to use it. I was thinking of using DES and I obtained a pair of keys, but I'm not sure where to go from there. I've scoured the internet for help, but I just can't figure out which is the best way to do what I need to do. If someone could please point me in the right direction I'd really appreciate it. Once data is sent in a form, how do I encipher it before saving it in the database and then how do I decipher it to be used later on? Also, not to sound helpless, but I'm pretty new to PHP and I don't quite have a handle on the jargon, so if it could be explained as simply as possible that would be helpful. Thanks so much! Cat -- Regards, Matthew Fonda http://mfonda.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] xml-rpc with php5
On Tue, 2005-03-01 at 21:14, Alex Duggan wrote: Hello, What is the best solution for setting up an xml-rpc client with php5? Are the built in functions still experimental, are the classes from useful inc better to use? I want to continue using xml-rpc instead of soap because of it's simplicity and less overhead. Alex You could try the new xmlrpci PHP extension http://pecl.php.net/package/xmlrpci If not, you can use PEAR::XML_RPC http://pear.php.net/package/XML_RPC -- Regards, Matthew Fonda http://mfonda.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wierd PHP Problem
$HTTP_*_VARS is deprecated in PHP5, so if the server is running PHP5, this code won't work. Instead, you should use $_POST $username = $HTTP_POST_VARS['username']; $password = $HTTP_POST_VARS['password']; change to: $username = $_POST['username']; $password = $_POST['password']; -- Regards, Matthew Fonda http://mfonda.info -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Foreach problem.
remove the semi-colon at after foreach(...) On Wed, 2005-02-09 at 14:22, Mirco Blitz wrote: HI, I am really confused. I have an array, that looks like this: print_r($elementsarr) = Array ( [0] = knr [1] = subject [2] = title [3] = kat [4] = pages [5] = access [6] = dofile [7] = MAX_FILE_SIZE [8] = pdf [9] = dolink [10] = link [11] = erstam [12] = endless [13] = from [14] = until [15] = openbem [16] = history [17] = closedbem [18] = [19] = b [20] = br [21] = bw [22] = bay [23] = h [24] = hb [25] = hh [26] = mv [27] = n [28] = nw [29] = rp [30] = s [31] = sa [32] = sh [33] = sn [34] = t [35] = bund ) Now i try to work with this array in a foreach. foreach($elementsarr as $key=$tmp); { echo $key=$tmpbr; } Now the result of that is: 35=bund Ist not the first time i work with foreach. But it is the first time it just returns the last value. Do you have an idea why? Thank you very much Mirco Blitz -- Regards, Matthew Fonda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Development IDE's/Editors
Personally I use either emacs or kate. On Wed, 2005-02-09 at 19:56, Darren Linsley wrote: I will apologise for this questions now, but everyone has to start somewhere. I am just starting out with PHP and wanted to know what development environments/editors that you guys are using for your PHP development. (On Windows) I know that you can use good ol Visual Notepad, but i was wondering if there was anything better out there. Thanks. -- Regards, Matthew Fonda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing whois lookup information
You might want to check out PEAR::Net_Whois http://pear.php.net/package/Net_Whois On Wed, 2005-02-09 at 20:13, Harish Rao K wrote: Hello, For a project I need to parse whois domain lookup data. Have some one parsed these data in PHP? Please let me know where can I find them. I have already gone through google and couldn't find anything useful. There is one .NET library (http://www.hexillion.com/whois/) available, but it is charged. :((. So if someone can help me out it would be grateful. Thank you very much, Harish Rao K. Nous Infosystems This e-mail transmission may contain confidential or legally privileged information that is intended only for the individual(s) or entity(ies) named in the e-mail address. If you are not the intended recipient, please reply to the [EMAIL PROTECTED], so that arrangements can be made for proper delivery, and then please delete all copies and attachments.Any disclosure, copying, distribution, or reliance upon the contents of this e-mail, by any other than the intended recipients, is strictly prohibited. -- Regards, Matthew Fonda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question on getting URL
$file = basename(_FILE_); On Sun, 2005-01-30 at 01:26, David Banning wrote: I have a script called index.php on my main page and it actually is used to launch several webpages like so; http://mysite.com/index.php?id=16 When http://mysite.com runs it still uses index.php. but it doesn't show it in the address bar. All it shows is; http://mysite.com What I would like to do is to get the information from the address bar to know when I am on the main page. -- -- Regards, Matthew Fonda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Get a PAGE
just use file_get_contents() or fopen() On Thu, 2005-01-27 at 22:52, Louie Miranda wrote: Im trying to capture the whole page of a certain courier service. What i want to do is, after i got the form to query the AWB (Air Way Bill No.) It will dump on my local folder the page containing the details on it. Im going to try PEAR HTTP_Download Is there another application or syntax on php that can do this? -- Louie Miranda http://www.axishift.com -- Regards, Matthew Fonda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Class declaration, constants and array
t'isnt good OOP practice to do what you want to do in the first place perhaps use the constructor to do it On Fri, 2005-01-28 at 12:50, Marek wrote: php5 class { const _SOMETHING_ = 'test'; private $abc=_SOMETHING_; // fails, well actually anything fails similar to this. var $test=$test2;// also fails So since I can not use dynamic var assignment within the class declaration, what are some of the easy solutions to this ? without making anything global to the script ? Thanks -- Regards, Matthew Fonda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Classes and parents.
the run function in b overrides the run function in a, thats why it echo's B On Fri, 2005-01-21 at 18:37, Dmitry wrote: Greetings. If i run this code (php5): -- class a { function say() { echo A; } function run() { $this-say(); } } class b extends a { function say() { echo B; } function run() { parent::run(); } } $obj = new b; $obj-run(); --- I will get B, but how i may get A? -- Regards, Matthew Fonda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] delete part of array
use the unset() function. for ($i = 0; $i count($array); $i++) { if (empty($array[$i]) { unset($array[$i]); } } On Wed, 2005-01-12 at 16:22, Sebastian wrote: how do i delete keys from an array if it has no values? eg, this: [name] = Array ( [0] = grape [1] = apple [2] = [3] = orange [4] = [5] = cherry ) to: [name] = Array ( [0] = grape [1] = apple [2] = orange [3] = cherry ) -- Regards, Matthew Fonda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Align pic
or just use css, set it to the background image of the body and use background-position: center center; On Wed, 2004-12-29 at 20:20, Jonathan wrote: table align=center Labunski [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Sorry for posting this here, but this is only newsgroup I'm using, and I can't solve simple HTML problem. yeah, it's funny, but still.. ;) I need to center image on the blank screen without using javascript. - so I wrote: table width=100% height=100% tr td width=100% height=100% align=center valign=middle img src=logo.jpg /td /tr /table this should work, but it's not. now the image is centered horizontally, but I need it vertically, too. what to do? Thank you, Lab. -- Regards, Matthew Fonda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Wiki recomendations
Yawiki is nice http://yawiki.com/ On Sat, 2004-12-25 at 09:13, Greg Donald wrote: Could anyone recommend a good PHP-based Wiki script, for PHP 4.x? I've been testing a bunch of them and almost all seem to be crap so far. Thanks.. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- Regards, Matthew Fonda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Converting a string into ASCII and a bit more - newbie
This ought to work: ?php $string = 'ABCDEFGHIJ'; $chars = preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY); for ($i = 0; $i count($chars); $i++) { $chars[$i] = ord($chars[$i]); //$chars[$i] = ord($chars[$i]) + 10; } $string = implode('', $chars); ? On Sun, 2004-11-14 at 22:32, Alp wrote: Hi, My question could have quite stright forward answer or the question itself might be silly but being a newbie, I'll ask it anyway. First I am trying to convert each character in a string into their respective ASCII codes and then keep these again in a string. Such as: string : ABCDEFGHIJ, expect to see in the result : 65666768697071727374 Then I would like to further manipulate this result with some math, say add 10 to each pair (the ascii code) so the new result becomes: 75767778798081828384 For my first attempt I tried: $x=1 while ($x=strlen($string)) { $holder = ord(substr($string, $x, 1)); $result = $result . $holder; } and failed since it takes ages to process and does not really return a proper value/result but repetitive number such as 1.. I have also tried a 'for' example I found which failed as well. I truely hope an expert here could show me some light and point me in the right direction. I have 2 sets installed on my PC as PHPDEV423 and XAMPP 1.4.9 (set to use php4) and it fails in both. Thanks in advance, Alp P.S.: I hope I have posted this in the correct NG -- Regards, Matthew Fonda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best Functions for Checking Remote File last modified?
You could try using filectime http://us2.php.net/manual/en/function.filectime.php On Sat, 2004-10-23 at 09:45, Nick Wilson wrote: Hello, I need to connect to a remote http server and pick up a file *only* if it has been modified since i last did this. The file is in csv format (not tht i think that matters?) and is http password protected. Which functions should I look at for acheiving this please? Thanks very much! -- Nick W -- Regards, Matthew Fonda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple math computation..
Howdy. It seems to work fine for me, perhaps you have a typo along the lines some where. ?php $totalCost = 4000; $shippingestimate = $totalCost * .20; echo $shippingestimate; ? echoes 800 -- Regards, Matthew Fonda On Sun, 2004-10-03 at 23:26, Louie Miranda wrote: the percent of 20% is = .20 right? how can i compute the correct value for this? my $totalCost is $4,000 and when i compute it to .20 using this method.. $shippingestimate = $totalCost * .20; i get the value for the shippingestimate = $0.8 which is wrong.. it should $800 what seems to be wrong? -- Louie Miranda http://www.axishift.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Function declaration failing on return value
Howdy, It seems to work just fine for me, perhaps you have a syntax error somewhere else, such as a missing ; or $ or {. Check and make you you have no typo's, it seems to work perfectly for me. -- Regards, Matthew Fonda On Mon, 2004-10-04 at 13:59, Whil Hentzen wrote: Don't get too excited; this is an awfully lame newbie question. I'm trying out my first functions and can't get past some sort of stupid syntax mistake I'm making. I've cut the following snippet directly out of the online PHP manual and put it in a PH page, like so: html headtitleTest function/title/head body bSquare of number/b/fontbrbr ?php function square($num) { return $num * $num; } echo square(4); // outputs '16'. ? br /body /html When I run the php page, I get Parse error: parse error, unexpected T_RETURN in /var/www/html/afi/sq.php on line 12 I've experimented with a half dozen different functions and variations, and I'm always getting the same 'unexpected T_RETURN' error. This is pretty basic but I'm outa clues. I've searched the archives for the last 3 mo for T_RETURN (and user-defined functions) as well as the online doc; no relevant hits. Thanks, -- Whil Moving to Linux: Freedom, Choice, Security, Opportunity http://www.hentzenwerke.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about handling credit cards
The best way to store credit card numbers is to have them encrypted when they are stored in the database, and decrypted when they need to be used, that way it will be safer for the most part On Mon, 2004-10-04 at 14:49, Ed Lazor wrote: I'm looking at online stores and it seems like a lot of them maintain copies of credit card numbers. Is this true? That seems like a bad thing to me, especially in terms of liability and risk of hackers. On the flip side, it seems like there are legitimate reasons. For example, if you bill the customer when products ship, rather than when the order is received. Or, if the customer decides to have instock items ship now and back ordered items ship when they arrive - which results in two shipping charges. How do you guys handle this? -Ed -- Regards, Matthew Fonda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using PHP4 or PHP5
I would say PHP5, for sure. PHP5 is much better in nearly every way, and more and more people are using it every day. Also, for the most part, PHP4 is backwards compatible with PHP5, so it shouldn't be too much of a problem. I would absolutely recommend upgrading to PHP5. -- Regards, Matthew Fonda On Sat, 2004-10-02 at 12:19, Michael Lauzon wrote: As I mentioned earlier, I am putting a team together to create a web-based RPG, different from the one I am currently playing. Would it be better to use PHP4 with it's strong developer base, or the new PHP5 which is more object oriented an in my opinion would be easier to keep the game up to date? -- Michael Lauzon P.S. This is the game I am playing, but I have ideas that I think can be done better than what was done for this game -- but everyone always says that!: http://phantasyrpg.com/main.php?view=9898 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to install php5 on Fedora Core2
Howdy, Redhat is notorious for leaving out things, such as apxs. To get php working, you will most likely have to download apache, build it, and install it. Make sure you configure apache with --enable-so. After apache builds, do make install. And then, when configuring php, do ./configure --with-apxs2=/usr/local/apache2/bin/apxs That should work just fine. You can still have your old apache installed at the same time, just don't use it. Copy the config files from the old apache, and do /etc/init.d/httpd stop, then startup the other apache (probably /usr/local/apache2/bin/httpd), and php should be working perfectly -- Regards, Matthew Fonda On Sun, 2004-10-03 at 07:03, Robert Cummings wrote: On Sun, 2004-10-03 at 09:43, Teng Wang wrote: Surely apache is running. And I checked httpd.conf. There is no LoadModule php4.x.x Anyother settings should be removed? The first time I installed php5.0.0, I forgot to add --with-apxs2=/usr/sbin/apxs. It works but the version is 4.3.8 as phpinfo() shows. When I added this option, the php didn't work anymore. But the apache works fine. The browser can read .html files. Redhat splits up the http config file into sub configurations for each module. Check the config file located at: /etc/httpd/conf.d/php.conf Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A problem of installation
Howdy, Redhat is notorious for leaving out things, such as apxs. To get php working, you will most likely have to download apache, build it, and install it. Make sure you configure apache with --enable-so. After apache builds, do make install. And then, when configuring php, do ./configure --with-apxs2=/usr/local/apache2/bin/apxs That should work just fine. You can still have your old apache installed at the same time, just don't use it. Copy the config files from the old apache, and do /etc/init.d/httpd stop, then startup the other apache (probably /usr/local/apache2/bin/httpd), and php should be working perfectly -- Regards, Matthew Fonda On Sat, 2004-10-02 at 21:27, Robert Cummings wrote: On Sun, 2004-10-03 at 00:05, Teng Wang wrote: I met with a problem when installing php5.0.0 on my Federo Core 2.0 system. I use the default settings: ./configure make make install Everything is ok, but when I test my phpinfo(),it always shows the 4.3.8 version. Yet, when I type the following command php -v to show the version of php, it's 5.0.0 What's the problem? Any kindly help would be appreciated. Where are you loading phpinfo()? If it is in browser then there's a good chance you've only built the cgi/cli version and not the module. The module version needs the --with-apxs flage enabled. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to install php5 on Fedora Core2
Howdy, When you configure, you need to make sure you have --with-ext= or --enable-ext for all the extensions you want to use. If you want all the same extensions from your previous install, you could copy and paste them out of the configuration command of your old phpinfo() page. If you try and use mysql, you may get an error about header files being missing, you need to copy the mysql .h files into the include directory for mysql. Also, if you dont want to re compile the entire thing, you can compile extensions separately, and load them with either dl() in a script, or just add them to php.ini -- Regards, Matthew Fonda On Sun, 2004-10-03 at 07:21, Teng Wang wrote: Thanks a lot. It works! But a new problem is: default setting loses all extensions. If I wanna install all extension in the package, how to configure the installation and reinstall? Thanks a lot! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: set multiple variables
On Sun, 2004-10-03 at 04:39, Graham Cossey wrote: isn't the || same as ? Or I missed something? No, || is OR, and is AND Check out http://www.php.net/manual/en/language.operators.logical.php -- Regards, Matthew Fonda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HOWTO: Install PHP on Fedora Core / Redhat
Howdy, I noticed that quite a few people were having a hard time installing PHP on Fedora Core or Redhat, so I put together a little tutorial explaining how to do it. Hope it helps :D http://mfonda.dotgeek.org/fcrh.php -- Regards, Matthew Fonda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] World time convertor
Howdy, Check out the Date PEAR package, http://pear.php.net/package/Date -- Regards, Matthew Fonda On Thu, 2004-09-30 at 02:19, Phpu wrote: Howdy Is there a time convertor written in php? I mean to convert a specific hour/date in all world countries. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Data cache ideas/solutions
You could do something like: $result = mysql_query(SELECT * FROM whatever, $link); while ($topic = mysql_fetch_assoc($result)) { $all[] = $topic; } The array $all will contain all of the things fetched. On Wed, 2004-09-29 at 02:04, Niklas Ojala wrote: Hello I am kind of new to this news thing, but here goes. I am looking for a class or some samples that would read a table from mysql and store it in an array variable, so that it will be avilable to other parts of the page without having to get it from the database again. So I would like to only get the table once per page load but I must be able to filter the table to get the data that I want. I am looking for some similar code to get me started or other ideas on how to make less queries to the database. /Niklas Ojala -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best way to allow a user to indicate formatting to be displayed but stored.
Typically people use BBCode to do this. This mean the user will enter something like [b]this is bold[/b] or [i]italic[/u] and the BBCode will be parsed and transformed into HTML when the page is displayed. There are many parsers already written to do this, or you could make your own, or use PEAR: http://pear.php.net/package/HTML_BBCodeParser On Wed, 2004-09-29 at 10:51, GH wrote: I am looking for the best way to have a user enter information and format it ... i.e. Bold, Italics, etc... with out havng to use the HTML commands... Using PHP4. Any suggestions... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I make an 'email this page' feature?
Check out the PHP mail function: http://www.php.net/manual/en/ref.mail.php http://www.php.net/manual/en/function.mail.php On Wed, 2004-09-29 at 14:03, PHP Tech wrote: Hi. I am on a tight deadline here- I am trying to get a feature on a website I am creating where you click a link on a page which says 'email this page' and it takes you to a new page with a form asking you to enter your name, email and an email address and name of a person you would like to email the link of the page together with a message. In theory this is easy to do- but what would be the best and secure way of doing it? I thought by clicking the link this would be a form sending the url of the page to the next page and so I could then use $_GET to retrieve this. I also thought of using $_SERVER and getting the referer web address. Then I could use this in a hidden field and use the mail() function to mail it off. Aren't both these options open to abuse? I was impressed with a feature I saw on this website- http://www.chesternovello.com/composer/606/main.html - at the bottom of the page when you click on Email this page it takes you to another page without using a form, and it seems to use just html. How do they do that? I would really like to use a nice PHP script to do this. Any ideas? Would be grateful for any thoughts. I. Gray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] classes in php5
?php class Foo { } $className = Foo; $fooInstance = new $className; ? Works fine for me. It still works if you add methods or properties to Foo as well, I'm not sure why it wouldn't work for you, possibly you have another error along the lines somewhere. I am on PHP 5.0.1 BTW On Tue, 2004-09-28 at 19:42, Curt Zirzow wrote: * Thus wrote Daniel Watrous: Hello all, I have a class Foo. In PHP4 I could create an instance of Foo in the following manner: $className = Foo; $fooInstance = new $className; This would yield the same result as: $fooInstance = new Foo; Can you provide the definition of your class Foo. what you describe works find in php5. Curt -- The above comments may offend you. flame at will. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple pages of data.
Or if you wanted to do it all in PHP, without using LIMIT, you could do something like this. I'm not exactly sure how your database is set up, so I just used this made this dummy table as the one I will use in this example: create table topics(id int(8) not null auto_increment, topic varchar(30), author varchar(20), body text, primary key(id)); Ok, so then I just inserted some random data into to test with. Here is some PHP code: ?php $link = mysql_connect('localhost', 'user', 'password'); mysql_select_db(database, $link); $result = mysql_query(SELECT * FROM table, $link); $num_rows = mysql_num_rows($result); $all = array(); while ($topic = mysql_fetch_assoc($result)) { $all[] = $topic; } if (isset($_GET['start'])) { $start = $_GET['start']; } else { $start = 0; } for($i = $start; $i $start + 15; $i++) { echo Topic ID: . $all[$i]['id'] .br /; echo Topic Title: . $all[$i]['topic'] .br /; echo Topic Author: . $all[$i]['author'] .br /; echo Topic Body: . $all[$i]['body'] .br /; echo hr; if ($i == $start + 14) { echo pa href=\pages.php?start=.($i+1).\Next Page/a/p; } } mysql_free_result($result); mysql_close($link); ? That will do simple paging, and works seems to work fine. On Tue, 2004-09-28 at 22:05, Nick Patsaros wrote: I'm trying to build a bulletin style system right now. I have topics and replies to each topic. If a topic gets more than 15 replies I want them to start carrying over onto page 2 and then 3 and so on with 15 replies per page. The key that I'm missing I guess is, how do I keep track of the last accessed row in the database? So if I run a LIMIT 15 I can go back and pick up where I left on previously? Using the primary key isn't going to help because if posts get deleted I would have less than 15 per page. Maybe I'm totally lost on this though, if someone could give me a bit of help on the most efficient way to accomplish this. --Nick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple pages of data.
oops, forgot to add this, put as first line in the for loop: if ($i == $num_rows) break; On Tue, 2004-09-28 at 22:45, Matthew Fonda wrote: Or if you wanted to do it all in PHP, without using LIMIT, you could do something like this. I'm not exactly sure how your database is set up, so I just used this made this dummy table as the one I will use in this example: create table topics(id int(8) not null auto_increment, topic varchar(30), author varchar(20), body text, primary key(id)); Ok, so then I just inserted some random data into to test with. Here is some PHP code: ?php $link = mysql_connect('localhost', 'user', 'password'); mysql_select_db(database, $link); $result = mysql_query(SELECT * FROM table, $link); $num_rows = mysql_num_rows($result); $all = array(); while ($topic = mysql_fetch_assoc($result)) { $all[] = $topic; } if (isset($_GET['start'])) { $start = $_GET['start']; } else { $start = 0; } for($i = $start; $i $start + 15; $i++) { echo Topic ID: . $all[$i]['id'] .br /; echo Topic Title: . $all[$i]['topic'] .br /; echo Topic Author: . $all[$i]['author'] .br /; echo Topic Body: . $all[$i]['body'] .br /; echo hr; if ($i == $start + 14) { echo pa href=\pages.php?start=.($i+1).\Next Page/a/p; } } mysql_free_result($result); mysql_close($link); ? That will do simple paging, and works seems to work fine. On Tue, 2004-09-28 at 22:05, Nick Patsaros wrote: I'm trying to build a bulletin style system right now. I have topics and replies to each topic. If a topic gets more than 15 replies I want them to start carrying over onto page 2 and then 3 and so on with 15 replies per page. The key that I'm missing I guess is, how do I keep track of the last accessed row in the database? So if I run a LIMIT 15 I can go back and pick up where I left on previously? Using the primary key isn't going to help because if posts get deleted I would have less than 15 per page. Maybe I'm totally lost on this though, if someone could give me a bit of help on the most efficient way to accomplish this. --Nick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regular expression help
Howdy, Regular expressions are a simple way of matching patters. You can learn more about regular expressions in general here: http://www.opengroup.org/onlinepubs/007908799/xbd/re.html If you are interested in using regular expressions in PHP, check out these sites: http://www.php.net/manual/en/reference.pcre.pattern.syntax.php http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php A regex to match what you are looking for would be /\{(.+?)\}/, and then just replace it without the { and } for the replace part. On Tue, 2004-09-28 at 22:46, Ed Lazor wrote: complain Today I discovered that my ISP can't upgrade to PHP 5. They use Plesk for server Administration and PHP 5 apparently breaks Plesk. Plesk says they'll make PHP 5 support available as soon as it starts coming default on RedHat Enterprise. /complain Unfortunately, I now have a bunch of scripts that require PHP 5. I'd upgraded my beta server for testing and everything has been going so great that I went gungho. Honestly, I tried to not too many of the new features, just so I could ease into it and do more testing. I'm finding little differences that I didn't even realize I was taking advantage of. For example, there are a lot of places in the code where I've done something like this: print Learn more about {$product-get_Title()}.br; I uploaded scripts like this to the production server for more testing and PHP4 flagged all of the code like this as parse errors. I'm not sure, but now I'm stuck having to go through all of the code to change the coding style my editor (Dreamweaver MX 2004) allows me to do a global search and replace using regular expressions. I have no idea what regular expression I'd use for something like this. Any recommendations? Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php