Re: [PHP] Generating forms using OOP
On 7 Dec 2002 at 0:43, Davy Obdam wrote: I ve just started with some OOP programming in PHP and now i have to build a set of classes that can generate a html form.. But i have a problem with the selectoption/option/select thing I hope someone can help me here or give me some pointers,... any help is apreciated. Here is a part of my code : class selectField extends formElement { //Constructor function selectField($name, $value) { formElement::setName($name); formElement::setValue($value); } function generateSelectField() { $theOutput = select name=\.$this-name.\\n; foreach($this-value as $key=$val) { $theOutput .= option value=\.$this-value.\.$this-value./option\n; } $theOutput .= /select\n; Return $theOutput; } } This is how i call the Object: $test[] = Test1; $test[] = Test2; $test[] = Test3; $test[] = Test4; $test[] = Test5; $select = new selectField(testje, $test); echo$select-generateSelectField(); But all i get is a select box with the word Array in it 5 times...Thanks for your time... Below is an example that works. I don't know from formElement. But why, why in the world do you REALLY want to do this? Have you truly used and understood smarty and yet felt this must be done? I haven't. http://smarty.php.net/ It lets you focus on your application. Peter ?php // require_once 'selectField.php'; $test[] = Yea, this works; $test[] = No trouble mate; $test[] = Test3; $test[] = Test4; $test[] = Test5; $select = new selectField(testje, $test); echo $select-generateSelectField(); class selectField { var $name; var $value; function selectField($name, $value) { $this-name = $name; $this-value = $value; } function generateSelectField() { $theOutput = select name=\.$this-name.\\n; foreach($this-value as $key=$val) { $theOutput .= option value=\.$val.\.$val./option\n; } $theOutput .= /select\n; return $theOutput; } } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] seeking good Bug Tracker in PHP
Hi, I'm seeking a good Bug Tracker in PHP. I've tried Mantis. I was at freshmeat and tried a bunch of those. Found nothing I liked. I did find one bug tracker that used Smarty but I did not like it. I'm seeking a Bug Tracker where everything is in classes. Design is in a template class (strong preference for Smarty) and it uses as many Pear classes as possible. Anyone know of one? Thanks, Peter http://www.coremodules.com/ Web Development and Support at Affordable Prices 901-757-8322[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] why does eregi match for whitespace when there is none?
Here is the example: ?php $string = 'asfddsaz'; if (eregi('\s', $string)) { echo Whitespace present; }else { echo NO Whitespace present; } ? Why does the above return true? There is no whitespace in the string. What am I missing? Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Looking for good ZIP Code / Latitude / Longitude table
On 30 Oct 2002 at 17:11, Michael Zornek wrote: I can't really use that class. I'm looking for a table of zip codes, with relating lat and lon cords. I already wrote the calculation code. That PHP class is reliant on a web service which I'm not interested in. Umm .. I bought such a database for a project I did. These people have what you want: http://zipinfo.com/products/products.htm Just an interesting link: http://www.census.gov/geo/www/gazetteer/places.html I was just trying to find something that I read had been done with Perl. I think maybe it was just for log analysis, anyhow, while searching I found this: http://greatcircle.locallink.net/ kind of hokey site but how knows. They say they have a database for US$ 9.95. I used the people above about 3 years ago and they are still in business, I like that. Lots of stuff out there. Here is an interesting company: http://www.mailerssoftware.com/zipcodesolutions/index.htm Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing the variables ...
On 29 Oct 2002 at 9:41, Mukta Telang wrote: I have written followong code in hello.html: FORM ACTION=hello.php METHOD=POST INPUT TYPE=TEXTAREA NAME=textbox ?php printf(BRhello %s!,$textbox); ? This script works fine with php in redhat 7.2 system but does not work in solaris 7 ! I have done the php installation... What are the chances that the problem is with the php-installation? ( I had to copy code from apache2filter directory of pre 4.3 version of php to remove errors during make ) I tried using echo($_GET['$textbox']) instead of printf statement in hello.php.. I tried to snip the above to keep only the necessary. I think you might try using some existing scripts that you know work and then understand why they work. Keep the orginals, make some changes and if something breaks you have the original and you can probably see what you did to break it. This is what I usually do with a new language and only later, sometimes, do I begin to understand the why. I'm learning assembly now and the author tells me I cannot do this with assembly :), I'll see. Couple of things: Perhaps it's a case of globals being off so $textbox doesn't (thank goodness) spring into existence. See the php site: http://www.php.net/manual/en/security.registerglobals.php A VERY helpful site. Check your php.ini file. Run phpinfo() in a script and you'll see the location of your ini file and whether globals are turned on or off. You Use POST in the form but then use $_GET, that should seem odd to you. You also use $_GET['$textbox'] when it should have used $_POST['textbox'], I think, I never use this method, check the php.net site, you can download the documentation.. I personally have a simple function where I put all my user input an array and it matters not whether post or get is used. Here is another example of your hello.html and hello.php. I also highly, highly recommend you look at using Smarty as a templating system. As far as PHP uses OO I suggest you use it (I personally find OO type apps much easier to debug than stream of consciousness types, even my own); hell.html (I apologize for not improving the html) HTML HEAD /HEAD BODY FORM ACTION=hello.php METHOD=POST Benter your name:/B INPUT TYPE=TEXTAREA NAME=textbox INPUT TYPE=SUBMIT /FORM /BODY /HTML hello.php ? $input = ProcessFormData($GLOBALS); function ProcessFormData($GLOBAL_INPUT) { $FormVariables = array(); $input = $GLOBAL_INPUT['HTTP_GET_VARS'] ? $GLOBAL_INPUT['HTTP_GET_VARS'] : $GLOBAL_INPUT['HTTP_POST_VARS']; foreach($input as $Key=$Value) { if(is_array($Value)) { foreach($Value as $SubKey=$SubValue) { $FormVariables[$Key][$SubKey] = $SubValue; } }else { $FormVariables[$Key] = $Value; } } # End of foreach return $FormVariables; } # End ProcessFormData ? HTML HEADtitleHello ? echo $input['textbox']; ?/title/HEAD BODY ?php printf(BRhello %s!,$textbox); print pre; print_r($input); print /pre; ? /BODY /HTML __end Of course I'd put the ProcessFormData in some included file, not in a php file as such. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] standardization across apps?
On 29 Oct 2002 at 0:14, taylor wrote: i might be crazy, but why don't the many CMS, forum, link directory, etc packages integrate with a unified user manager? is this possible? is there perhaps an xml standard for contact datatypes that could be used? I'm not sure I understand you but I think you might be talking about what I'm thinking about and reading about in compent software architecture (book I'm reading). Actually, if most of these CMS just used Classes (properly) and used a template system then you'd have half of the ball game. I've worked on some CMS in PHP and they drive me nuts. I think you'll find that most PHP stuff is just slung together. CORBA CORBA is the acronym for Common Object Request Broker Architecture, OMG's open, vendor-independent architecture and infrastructure that computer applications use to work together over networks. http://www.omg.org/gettingstarted/corbafaq.htm Been reading more about it but have not absorbed near enough to consider using. SOAP, eh But hey, just good Class design would be a great place to start. Not that I'm that great myself, but I see that as a quick, early win in the ballgame to really re-use stuff. http://www.smartarchitectures.com/ I've only got one framework in PHP on that site so far. Most are Perl systems. But of course the site itself uses GeekLog which is certainly easy to setup but I just haven't had much time to see how easy it is to extend. It doesn't use Smarty or any better template system and for that reason I'm leery. But I like it better than Nuke which a customer is using and I've had to work with. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CC Processing Merchants
On 10 Oct 2002 at 0:48, Andrew Brampton wrote: Sorry for this slightly off topic question, but I beleive many of you will have delt with this kind of thing before. Yeah off-topic but I was wondering the same thing myself as I have not done many carts in awhile. So can anyone recommend a good (maybe cheap) Merchant that can validate and charge credit cards online? My client is searching for some reviews online, but he asked if I could maybe get a list from progammers which have done it before. A few months ago I setup a client with Authorize.net. I always hated using them as I lose control for a click but it worked out well. I save all the data before I send them off and then update their record when Authorize.net sends them back to the url that I gave them. It has worked well. Last year I used Verisign and they were very good. Very helpful and simple API. They bought cybercash who I used to use all the time. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HYML Forms to Validate?
On 3 Oct 2002 at 12:27, Stephen wrote: I've been reading tutorials lately on user authentication in PHP and they all are for the HTTP way of authentication. How can I use the same system but with forms instead of that ugly pop-up box? Of course the best solution for this is mod_perl (for those who know some Perl) but you can cheat in PHP. The problem in PHP is that you cannot intercept the Apache request phases as you can with mod_perl. I've mentioned this in other posts and even have an example up on my site: http://www.schoenster.com/login.php I tell apache to use my handler for access/authentication. One way to do this in PHP is to have ONE index.php or whatever you set the index file to in a folder. It determines who is requesting what and then determines if this person is is authorized to access what they wanted. You'd have to put the actual *data* outside the document root otherwise they might just find it. Your index.php could grab the files (if html) and just print them back. I used the same system in Perl before learning of mod_perl. So far this is the only case where I can do something in mod_perl that I cannot do as eloquently in PHP but since I don't mind the pop up box that's not a big deal and since most of my apps go through just a few php handlers I do my own auth/access for every request and return my custom login page when needed. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Global variables
On 2 Oct 2002 at 22:06, Anna Gyor wrote: how can I use global variables in my web portal? I have read the php documentation, but it works only in the same file. I want use more global variable on many php site. For example: In login.php I use the code $first=mysql_result($result,0,FIRST_NAME); and I want to print this $first variable all of my php site. Easy, use one script for your whole site. There is nothing that drives me more nuts than to encounter an application whose developers have left town and run into global variables. I don't mind file scoped variables so much, but to make a variable global across an application can drive one nuts when trying to debug. That said, I do use global variables but they are from a class whose 'object' is global. I don't have 3000 php files running all over my site as I've seen done. I have just a couple of *handlers* that use classes and I have one class which creates my global array which is shared. It's very easy to trace variables. I'd be very careful before I began to make variables global without some EASYmeans of tracing them. And it gets real interesting when one file inherits another which inherits another and in any one of them the value of your global variable can be changed. Does anyone know a good way for tracing such things? Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Smarty template question
On 28 Sep 2002 at 15:48, Matt Giddings wrote: Hello, Be for warned that I am new to smarty and for some reason I'm finding it very difficult to learn. ??? Anyway, my question is how do I access an array of associative arrays via the {section} statement? Heres the code: Matt, I suggest you break your code down to the simplest possible. Too many factors in there for my taste. FWIW, I had to bang my head a few times to get it and still have to verify my assumptions. For some reason I took to Template::Toolkit rather fast but smarty is working fine for me. Here are a few notes, but I'm fairly new to PHP so caution. First, totally unrelated to your question: Function readComment( $smarty, $bid ) { In Perl and in PHP I have my classes ONLY manipulate data and return data to the handerl which then passes it off to what I call the viewer. In this way, in Perl for instance, I can use more than one template system as I create a class for each template system and manipulate the data as needed for that system. Works like a charm. In this way you can use the code in your classes for manythings ... it's not tied to your output. Also, now some might complain that this might be slower or take more memory or whatever, but I do this with smarty: $data = $g-run($com,$fid); $data is an array of data returned by my functions. $data['content'] = $g-viewer-Merge($data,$template); print $g-viewer-Merge($data,'index.html'); So I *wrap* the content of pages into a page which pulls in header/footer rather than having a header/footer in every page. Okay, back to your qeustion: while( $row = $result-fetchRow( DB_FETCHMODE_ASSOC ) ) { $rowdata[$i] = $row; $i++; I don't think you need the $i. Are you sure you have data in $rowdata? Your use of section looks good to me. You've got those if statements. Sure they are all true. I'm using section in lots of stuff and it's working fine. When I run into trouble I work from the most basic, the simplest and then move up. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Smarty template question
Was written while( $row = $result-fetchRow( DB_FETCHMODE_ASSOC ) ) { $rowdata[$i] = $row; $i++; I don't think you need the $i. I need the $i because I'm assigning the every row from the result into an array. http://www.php.net/manual/en/language.types.array.php#language.types.arr ay.syntax This is done by assigning values to the array while specifying the key in brackets. You can also omit the key, add an empty pair of brackets ([]) to the variable-name in that case. $arr[key] = value; $arr[] = value; // key is either string or nonnegative integer // value can be anything You really don't have to create $i, it will be created *on the fly*, works for me. I took your template and created a simple php script using smarty. It works. Here it is: http://www.schoenster.com/tests/smarty.php and here is the PHP script I wrote: (not that I used debugging!, that is a real nice helpful touch). ?php include_once ( 'Smarty.class.php'); // $smarty = new Smarty; $smarty-compile_check = true; $smarty-template_dir = '.'; $smarty-debugging = true; $action = 'read'; $colors = array('red','blue','green','yellow'); foreach ( $colors as $color ) { $comments[] = array('nick'=nick $color,'comment'=comment $color); } $smarty-assign('action',$action); $smarty-assign('comments',$comments); $smarty-display('smarty.html'); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] seeking data validation class
Hi, I looked at phpclasses but saw nothing as simple as I wanted. There's a Perl module which does just what I want and perhaps I'll have to port it. The class accepts an assoc array of name=value, and the key to another assoc array which describes the constraints for the assoc array I'm passing in. Here is an example of the assoc array (it's Perl) which contains all my forms and then the class returns 3 assoc arrays (valid, invalid,missing using the key names, and this makes it very easy to use in your templates e.g. if missing_name, or invalid_zipcode etc.). my %forms = ( confirm_email = { required = [ qw(emailaddress emailaddress_verified searchengine_accounts) ], constraints = { emailaddress_verified = email, emailaddress = email, }, filters = [ trim ], }, verify_contact_info = { required = [ qw(country lastname firstname phone state zipcode city company street) ], optional = [ qw(fax) ], constraints = { #phone = american_phone, #zipcode= '/^\s*\d{5}(?:[-]\d{4})?\s*$/', state = '/\w{2,}/', #fax= american_phone, }, filters = [ trim ], field_filters = { phone = [phone] }, }, The Perl module that does this is: HTML::FormValidator So far I'm find PHP stuff that does everything under the sun. Anyone know of something like this? Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: seeking data validation class
On 27 Sep 2002 at 22:09, Manuel Lemos wrote: Assumming that you tried the forms generation and validation class, what did you realize that was missing to match your needs? http://www.phpclasses.org/formsgeneration Well that's the first thing I found and I downloaded it. It does much more than what I want, for instance here: $subscription-AddInput(array( TYPE=text, NAME=email, MAXLENGTH=100, Capitalization=lowercase, ValidateAsEmail=1, ValidationErrorMessage=It was not specified a valid e-mail address )); Those attributes already exist in the form. I create the forms on the fly only once afterwhich they are in the hands of the designers to manipulate. I pass back to the form a data structure that will have something like: missing_email invalid_email and the designer can check for this, lke this in smarty: {if $error.missing_email}Yo give me email{/if} {if $error.invalid_email}Please verify your email{/if} and I have a script that will generated those if statements so one doesn't need to do a lot of typing. I don't like generating the form programmatically all the time ... I leave that to the *view*. I just want to pass the input data I received, the definition of the form I'm using with this data and have the function return the 3 arrays : good, invalid, missing. I've been very happy with this in Perl. The formgen is very powerful, too powerful and too intrusive into the other things I'm doing. I only need a small part of it. What I want has nothing really to do with html forms, just data validation. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Looking for a forum
On 26 Sep 2002 at 1:26, John Taylor-Johnston wrote: Hi, I'm looking for some forum script, a bit like this: http://www.chevelles.com/cgi-bin/forum/Ultimate.cgi Can anyone post a link to something useful? I know a couple of webmasters who are using and like http://www.phpbb.com/ I've never used any bb systems to say one way or another. Certainly easy to install. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Looking for some help on web header coding.
On 26 Sep 2002 at 10:35, Joshua Patterson wrote: I have been working to try and have flash MX use PHP to access a database but have been having issues with retrieving the post values in php. http://127.43.1.1/learning/checkpassword.php?password=somepasswordusern am e= MyUserName //store header values to internal defined values. $username = $HTTP_POST_VARS['username']; $password = $HTTP_POST_VARS['password']; //db_connect has been removed for security purposes. You are using a GET, not a POST. I've never worried about this stuff. I started with Perl and using the CGI.pm library I just was given the input in a hash .. left details up to CGI.pm and I got the input no matter how it was given. I use the following in PHP function ProcessFormData($GLOBAL_INPUT) { $FormVariables = array(); $input = $GLOBAL_INPUT['HTTP_GET_VARS'] ? $GLOBAL_INPUT['HTTP_GET_VARS'] : $GLOBAL_INPUT['HTTP_POST_VARS']; foreach($input as $Key=$Value) { if(is_array($Value)) { foreach($Value as $SubKey=$SubValue) { $FormVariables[$Key][$SubKey] = htmlspecialchars($SubValue); } }else { $FormVariables[$Key] = htmlspecialchars($Value); } } return $FormVariables; } # End ProcessFormData You might not want to use htmlspecialchars. Also, when I do use globals (and I hate to do that) I stick them in a global array that gets passed around. I don't use global Yaddda (only very rarely). Have you ever worked on someone else's code which has over 50 scattered files and no documentation and you need to find out where in the heck a variable is intialiazed and modified (can be anywhere)? Is there an easy way to handle this? Drives me nuts :) Maybe I've just not recognized the nutcracker. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] advise needed for 'authorized only' site
On 23 Sep 2002 at 8:14, [EMAIL PROTECTED] wrote: I have set up a section of my company site for use by authorized dealers only. I am currently using mysql authorization, which works for the first page, but if someone were to type in the url of an underlying page they would be able to get in without authorization. I know I could use .htaccess for handling this but with a minimum of 350 -400 users to keep track of that would be unwieldly to say the least, especially for my boss who doesn't have a clue about *nix and has never even heard of .htaccess. What other options do I have to keep the underlying pages from being accessed without the user being forced to go through the logon screen? Umm .. I did something along these lines awhile back ... yeah, I had all the public pages outside of the document root. I had every request for a page going to my script, if the person was recognized (using a cookie), I would get the page they wanted and return it. Plain cgi and was fast enough. You could do this in PHP. No one can access the restricted pages as they are outside the doc root. This is of course something for mod_perl where you can write your own auth handler and you don't need to do something as goofy as I did above. I don't think PHP has that ability. Your pages can still be in PHP. Here is an example (I just wrote this up will quick so if you go this route, do your homework) http://www.schoenster.com/authtest/ The above url is protected by a mod_perl handler which requires a cookie (script below) If you go to the above url you get redirected here: http://www.schoenster.com/login.php Enter something, cookie set, you are in. Click on welcome.php and logout to kill the cookie. I don't know how you can do this in PHP without doing something goofy like I suggest above or other suggestions I've seen. I use an .htaccess file in /authtest PerlAccessHandler Apache::GateKeeper PerlSetVar login_failure_handler 'http://www.schoenster.com/login.php' PerlSetVar column_name username The mod_perl handler is such (I just cut,pasted from some other stuff) package Apache::GateKeeper; use strict; use Apache::Constants qw(:common REDIRECT); sub handler { my $r = shift; my $location = $r-dir_config(login_failure_handler); my $okay = get_cookie($r); if ($okay) { return DECLINED; }else { $r-status(REDIRECT); $r-header_out( Location = $location ); return 1; } } ## sub get_cookie { my $r = shift; my %headers_in = $r-headers_in; my $cookie = $headers_in{'Cookie'}; my %cookie = (); my(@bites) = split /;/,$cookie; my $n = ''; my $v = ''; for(@bites) { ($n,$v) = split /=/; $n =~ s/^\s+//; $cookie{$n} = $v; } my $username = $r-dir_config(column_name); if($cookie{$username}) { return 1; }else { return undef; } } ## 1; Now, if you reckon I should have only given a solution as above in PHP, well, I would have if I had known one. The solutions I've seen so far are not very elegant or evolutionary imho. Can the above be done in PHP so you don't have to tell every page your write to check for permissions? Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Mail problem with more than 1k users
On 09/23/2002 08:08 PM, Research And Development wrote: So I re-designed the script to send emails in parts. 500 emails per header. But after the database reached more than 3,000 records the emailing did not work at all. Sendmail refused to send to any of the emails in the database result set. Any thoughts? I guess you are putting 500 emails in the Bcc field. I guess. I like to personalize outgoing mail. I has a script sending *lots* of email and I didn't think it through. My cohort had to clean up after me and he said that he just changed a parameter to sendmail to queue the mail, I *think* ... I haven't sent a lot of mail since then but I'll look at how I was using sendmail. On 24 Sep 2002 at 0:41, Manuel Lemos wrote: I am not sure what you mean by 500 emails per header. Anyway, if you are personalizing messages, ie send a message per user, avoid that at all costs and if possible send a single message to all users. Eeks. I hate that. I hate email that does not indicate it knows who I am. Why is sending one email to one user so bad? I can't think of a reason that would trump the personalization that I like so much. But I'm all ears. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_GLOBAL[var] or $_GLOBAL['var'] or $_GLOBAL[var]; ???
On 22 Sep 2002 at 12:10, Victor wrote: $_GLOBAL[var] or $_GLOBAL['var'] or $_GLOBAL[var] - I noticed that in a mysql statement you can only use: $_GLOBAL[var]. I would like to get the advice of more experienced php programmers out there about this. Which one of the above it the most best way to write? Yeah, this through me as well. Using Perl I got completely out of using quotes when not essential, still don't like em. But the php.net site's got the answer: http://www.php.net/manual/en/language.types.string.php someone put a link to another good explanation: http://www.zend.com/zend/tut/using-strings.php And of course take care of the magic (imho, black magic) that can go on with auto escaping, quoting etc. that I should fathom but haven't. the php.net site is wealth of info, good search, I find 98% of my answers there. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Designing N-tier applications in PHP (long)
On 22 Sep 2002 at 10:23, Michael Sims wrote: of creating this application. I decided (for various reasons) to implement this application in Perl. I began programming in Perl back in 1995. Took up mod_perl (the only way to seriously use Perl btw on web apps) but as I work primarily on virtual servers mod_perl was just too sophisticated for most environments, so I settled for just Apache::Registry which would also run as plain cgi. Well ... I've finally found a nice framework using PHP (using smarty.php.net) with Pear and then private classes for the App at hand. Works like a charm. I'm a fan of Perl but you can't beat PHP for ease of deployment and PHP does everying Perl does (all that I need) (although not all that mod_perl allows but then those conditions are pretty rare, for instance, like taking command at any of the apache request phases, especially good for custom auth stuff). in my Perl script. Worse yet, I realized that if any of this business logic changes (which it often does), I was going to have to remember to change it in TWO places. Up until this point there was only the website, but now that I had two completely seperate applications that I have to maintain whenever anything changes. Oh yeah, avoid that at all costs. Sounds like something like SOAP etc. could have been an answer, but then it depends on how you write your apps. I write both Perl and PHP to manipulate data. Every function has input and output and those are just arrays. I ran into a similar problem with NUKE. My customer wanted me to allow a user to join via a multi- newsletter module I was writing. Well I got it to work but it was not as easy as it should have been imho. I should have been able to call CreateNewUser and pass it the require input and gotten back a user id and then I could have called soemthing like GetUser and pass it a user id and get back an associative array (my pref) of that user. It was not like that, not at all, or I missed it. It seemed that the creation of a new user was tightly *coupled* with an html signup process. I realized at this point that I would be really nice if the business logic that determines how to construct the queries and which bits of data to display were completely seperated from the presentation logic that existed in my PHP pages. If I had some sort of component that merely accepted search parameters and returned data then I could access this component from both the PHP page and the Perl script. If the business logic changed later I could simply update the component and I (theoretically speaking) wouldn't have to touch the PHP page or the Perl script. Ummm like the other guy said, why bother? You can do that. Of course. But what are you doing in Perl that you cannot do in PHP? Maybe a cron script? I've not written any cron stuff in PHP and I'm not calling lynx to do it as I've seen advertised :( ... I've been doing research into this kind of application design. From my limited and inexperienced perspective, it does appear that Microsoft does offer some advantages in this area. But COM is not an option for me, for several reasons, not the least of which is the fact that our servers run Linux and I cannot access PHP's COM functions. SOAP, XML-RPC http://php.weblogs.com/xml-rpc I just did a search on Google. I have not written anything along these lines but given XML you could write your own but I'd always go the public route if I were to do this. I'm reading an interesting book called Software Architect Bootcamp where components is the big word. It's interesting. I'm not sure if I've got a full grasp but it defintiely seems to have an emphasis on decoupling (something going back to I read about in McConnell who is very good). But how to implement? In the book I'm guilty of what he calls the Stovepipe System :( but I'm working on it. I have considered setting up a PHP page that runs on a seperate port. This page would accept search criteria via a query string, and then return listing data in XML format. Then on the PHP presentation side (or my Perl script), I would parse the XML and either display it manually, or use XSLT. I don't have a lot of experience with this, however. It seems that XML support in PHP is still in a state of infancy. I don't know about that. Works well for me. I take an Amazaon XML feed and run it through my smarty templates with no problem here: http://www.readbrazil.com/books/amazon.php?mode=books please note that above site has been more of a php playground than anything else. No need to go the XSLT route although that is interesting. I use Template::Toolkit in Perl and have templates in html, xml, or plain text. the best thing to do is to wait a bit until XML support in PHP solidifies a little more. I really don't now enough about this. Seem strong to me but I have'nt done much. Another technology I was toying around with is Java servlets and Java
Re: [PHP] Designing N-tier applications in PHP (long)
On 22 Sep 2002 at 13:52, Michael Sims wrote: Well, that is basically my question. I considered both SOAP and XML-RPC (which you mention later) but I wasn't sure what the impact on performance would be. I am basically looking for anecdotal evidence from people who have implemented this sort of thing before... I was just looking at my software architect book ... not half-way through yet. Good book. CORBA is what is mentioned know, a bit different than SOAP but I don't know enough of either yet to say for sure. with writing standalone scripts in PHP. I used Perl because for this particular task it seemed better suited, and I wanted to get some more Perl experience. In retrospect it was probably not the wisest decision, and I probably have made things more complicated than necessary... Personally, I think you were correct. I cannt imagine just doing everything with one tool. But how to write PHP and your Perl so they can talk to each other. Dunno. IDL, CORBA but as you say, it sure would be good to hear from someone who's been here already. I don't know about that. Works well for me. I take an Amazaon XML feed and run it through my smarty templates with no problem here: http://www.readbrazil.com/books/amazon.php?mode=books please note that above site has been more of a php playground than anything else. That was just the impression that I picked up from my admittedly limited research I did on XML support in PHP. I was focusing mainly on XSL transformations though. Do you mind if I ask how exactly you are parsing the XML in your PHP pages? It seems to me that there are a few different options available on www.php.net. There is the --with-xml option that uses expat, and Yes, I avoid XSL with the SABOLOTRON (or whatever it is) cus it's not in most virtual environments and that's a reason to use PHP over Perl, the ease of deployment. If I have my own box, heck, mod_perl is strong. Anyhow, I'm a lazy guy, avoid writing code at all costs :) include_once ( 'AmazonLiteXMLParser.inc'); // include_once ( 'AmazonAPI.inc'); // written by Daniel Kushner http://www.amazonlite.com/ And so my script is essentially this: $xml = new AmazonAPI(); $rxml = $xml- keywordSearch($input['keyword'],$input['mode'],$input['page']); $parse = new AmazonLiteXMLParser($rxml); $records = $parse-getRecords(); for($i = 0; $i sizeof($records); $i++) { for($inner = 0; $inner sizeof($records[$i]['rating']); $inner++) { $records[$i]['reviews'][$inner]['summary'] = $records[$i]['summary'][$inner]; $records[$i]['reviews'][$inner]['rating'] = $records[$i]['rating'][$inner]; $records[$i]['reviews'][$inner]['comment'] = $records[$i]['comment'][$inner]; } unset($records[$i]['summary']); unset($records[$i]['rating']); unset($records[$i]['comment']); } $smarty-assign(BookLoop,$records); $smarty-assign($input); $smarty-display('book_index.tpl'); And that's it. Thanks for your response, you've given me some nice food for thought. I've heard of Smarty several times before but never looked into it. I definitely will take a look at it now... If you continue to use Perl, look at Template::Toolkit. I use it for all sorts of things, everything, really nice. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best Practice
On 21 Sep 2002 at 12:51, Ashley M. Kirchner wrote: I'm working on converting several static (price) pages on our site into dynamic pages, with the data stored in an MySQL database and PHP to pull the data out, with CSS to build the page and present it. I don't see how CSS would build anything, I guess it's just terminology. At the same time, I would also like to have a 'printer friendly' link on each page that visitors can click on and get the same page re-rendered for easy printing. What's the best way to get the data converted from one form to another? Should I be querying the database again to get the same data to reformat? Should I store the data in sessions and reformat based on the CSS? I would think having to query twice for the same thing would be a degradation in performance, right? So what's the best practice? I have not idea what the best practice is. If your data changes infrequently you could build static pages, nothing faster than static pages. Few people work on sites where most of these questions mean much. A friend worked on a site that he and I had developed and I left the firm and he later said the customer was complaining about response time .. I suggested he take the query string and cache the response in a db file and check that db file for every incoming request rather than going to Oracle (yeah, they were using Oracle when mysql would have done fine). They opted to just bolster the hardware, end of complaints and it was running plain cgi, not even mod_perl. Oh well. I do something that few people do. I take a request from the *client* and I process it. Just data manipulation. Since I'm doing the web I get an html template (from Smarty.php.net in this case) and do a merge. I like to use a wrapper, as such: $data contains an array or arrays of whatever which is all the data needed for this page (based on the query string in the request). It is the body of the page (I've got smarty in my own class, viewer): $data['content'] = $g-viewer-Merge($data,$template); Now, I merge everything with the WRAPPING page: print $g-viewer-Merge($data,'index.html'); Here is my index.html page ($content is the body of the page): {include file=inc/header.html} {include file=../site_nav.html} table width=80% tr td valign=top width=25% {include file=./left_nav.html} /td td valign=top width=74% {$content} /td /tr /table {include file=inc/footer.html} __END index.html So if you want to show a printable page just do something like this: if($print == 1) { print $g-viewer-Merge($data,'print_index.html'); where print_index.html would have a different layout, perhaps minimal header and footer or none at all. Or you could do some processing on the data or whatever. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best Practice
On 22 Sep 2002 at 12:31, Edwin wrote: Actually, in a sense, CSS can build a page--esp. if build means how data are to be presented (formatted) by the browser. Remember, with CSS you can hide and unhide elements? Ah .. yes ... forgot about that. That is building. Appreciate the reminder. The best practice, IMHO, is the one implemented here: http://www.alistapart.com/ Try the page with your standard-compliant browser (like N7) and with a (crappy) browser like N4 and see the difference. You can dissect the site and find out how they did it. Or, you can read articles like this: http://www.alistapart.com/stories/netscape/ And one for easy printing: http://www.alistapart.com/stories/goingtoprint/ I gotta go back and refresh myself. Thanks for the links. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling on functions in a url
On 19 Sep 2002 at 16:13, Tom Ray wrote: I have a question that I have yet to figure out. Let's say I have a PHP script with multiple fuctions, how do I call on the script to perfom specific functions through a url? Ex: http://www.sample.com/script.php?fucntion1 I wouldn't say this is a specific PHP question. True to all web languages I now of, and as many responses :) The quick answer is that most people use a switch statement: $thefunction_call = 'whatever' for instance: switch($thefunction_call) { case Ask : $action = 'SeekAnswer'; break; case SlowSearch : $action = 'SlowSearch'; break; case askus : $action = 'askus'; break; default : $action = 'SeekAnswer'; break; } But there are other ways, too many other ways :), here is one I'm using on a current app: $fid = get_fid($input); $input is the get or post input that I run through a processor (check for stuff I don't like and return new array). The following allows me to use the submit field to call different functions based upon the value of the submit button. function get_fid($input) { $submit2fid = array( 'Mark done'='markTaskDone', 'Mark dropped'='markTaskDropped', 'Edit'='editTask', 'Update All'='UpdateAllTasks', ); if(empty($input['fid'])) { if(empty($submit2fid[$input['submit']])) { $fid = 'showAdminPage'; }else{ $fid = $submit2fid[$input['submit']]; } }else{ $fid = $input['fid']; } return $fid; } so now I have a $fid (function id) I actually do something bizarre like this: $app_results = $functions-run($class,$fid); Function has this: return call_user_func(array($this-$class,$fid),$this-global); I'm *trying* to come up with a componentization idea which sounds good but is hard to implement and I've yet to see an implemenation that I like. I run an element of $app_results through it's template $data = $app_results[0]; $status = $app_results[1]; $new_fid= $app_results[2]; // can be empty $body_file = $viewer-Merge($data,$template); $data['content'] = $body_file; $html_file = $viewer-Merge($data,'index.html'); Now I have just one html file which contains the pieces of my app to now be presented to whatever called it (would have different templates and the viewer would manipulate the data depending on the caller). Peter http://www.coremodules.com/ Web Development and Support at Affordable Prices 901-757-8322[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] can you recommend PHP shopping cart
Hi, Looking for a shopping cart. I've written plenty in the past but in Perl. I'm looking for one in PHP and I don't want to write my own. I looked at this: http://www.x-cart.com/ And I asked to see their code but I have not heard anything back. I'm already favorable to anything that uses Smarty. I'd like something that is as OO as possible. Something that's got all the core features and is then easy to extend as every customer has their uniqure requirements. Anyone got some suggestions? Peter http://www.coremodules.com/ Web Development and Support at Affordable Prices 901-757-8322[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] can you recommned a simple banner rotator in PHP
Hi, I've got a customer who needs a banner rotation system. I don't want to recreate any wheels and I'm tryin to avoid a lot of research. I'd like one that doesn't use globals, it uses PEAR classes and preferably uses the Smarty template system or another template system, or you've used it and it works like a charm :) I would like something that has some statistics, works with MySQL, but they'd prefer a freebie or low cost. They don't need a super duper package at this time. Thanks, Peter http://www.coremodules.com/ Web Development and Support at Affordable Prices 901-757-8322[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML Parser Question
On 12 Sep 2002 at 0:13, OrangeHairedBoy wrote: Yeah...i should have mentioned I had thought of that...but I really don't want to :) It just doesn't look right when it's a math expression. Know a permenant solution? I want to be able to handle the tag mytag value=xy/, but the parser keeps telling me that it's not formed correctly (because of the in the quotes). mytag ![CDATA[xy]] /mytag But lt; will most probably be displayed as in the example the other person gave you, only the source view shows lt; Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PreCaching Db into Variables Slows it down?!??
On 12 Sep 2002 at 1:35, M1tch wrote: Just spent ages (well, 2hours) on a precaching system for my PHP code that didn't work out! Hang on, I'll backtrack a bit... My website is using a php engine that picks at snippets of html from the database, and builds them up to form the page. A typical page may use 5 of these html snippets, each at maybe 5kb in size. I was sat thinking, looking at the debug-timer, and saw that the templates were one of the more time consuming aspects. So I said, I know, I'll save the db a bit, and at the start of the script, read all the templates that I'll need into a global variable, and call them from that. Simple, 5 db calls put into 1, and templates taken out of memory. So why, oh why, has the time taken actually increased??? Does anyone have sufficient working knowledge of PHP to give me a hint at why this has happened? I bet someone would have to look at the code. Are you writing your own code or just gluing modules together? I'm using the Smarty template system which I really like, it caches templates. Personally I think you are going overboard in trying to optimize at this point. I assume that your system is working, and so you need only tweak it. But it sounds as if you are still working out what the system is. I have not done much work on High Traffic sites. One site was a skater site and big food producer was running a promo and had TV ads ... site performed fine even though it was just plain cgi scripts hitting mysql at least 5 times for just about every page (I did not write the site but I had to modify,watch it). Another site was marked as troublesome, big book publisher. They just threw hardware at it and all was well. Now Yahoo ... or Google ... that would be interesting. Why create a solution for no problem? I'd suggest looking at your templating system. Which one are you using? You didn't create your own did you? Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Anyone use DB_DataObject
Hi, I'm trying to use Pear stuff but don't know if I should post to that list as just a user. I'm lost when it comes to Auto Building. It has an example of that and I tried to do it on a local linux box where I'm root but it failed all to undefined function: getstaticproperty and I found something via Google that did not help at all. It *SEEMS* I have to create a config file for each table. Personally, I admit it, I generate that stuff automatically in other languages, I did do the config file to represent a database schema but change happens so much that I just did not want to bother updating the config file all the time so I just generated it dynamically from then on. Anyhow, I think I know where to put those config files, where I put the path for: schema_location but now do I put one file with all the tables defined by the example given in the docs? Or do I create a file for each table? What do I name these files? I'm lost. I got as far as this: dataobjects_users Object ( [__table] = user_config [_DB_DataObject_version] = 1.0 [N] = 0 [_database_dsn] = [_database_dsn_md5] = [_database] = [_condition] = [_group_by] = [_order_by] = [_limit] = [_data_select] = * [_link_loaded] = [_lastError] = ) Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] register_globals off or on, why on
Hi, I'm working on a site where I'm using geeklog http://geeklog.sourceforge.net/ It has the requirement that Geeklog needs the register_globals variable turned on in order to work. Since PHP 4.2.0, the default for register_globals is off. To fix it, simply add the following line to your php.ini file Is this not *wrong*. It sounds to me like fake laziness. Nothing drives me bonkers more than trying to track down a variable that is inherited from who knows where. Perhaps I'm missing something. I've recently worked on a lot of PHP code written by others and it's a nightmare trying to track down where a variable is defined and where it's value might be changed. Perhaps there is some tool I can use to trace this. I dunno. Am I correct in my aversion to globals or I am I missing their true value and perhaps some tools I could use when working on apps that have more than 50 php files floating all over the place and no documentation. Peter --- Reality is that which, when you stop believing in it, doesn't go away. -- Philip K. Dick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP IDEs
On 21 Aug 2002 at 8:55, Michael Egan wrote: I know similar threads have come up on this in the past but I suspect it's a constantly changing picture. I recently saw a favourable review of Zend Studio 2.5 but wondered, out of curiosity, what sort of tools people use to develop PHP scripts and MySQL databases, tables and queries. Up until now, in an attempt to try and get to grips with these packages, I've been using a variety of text editors from VI to Kwrite. But I'm wondering whether it might speed up development times if I start to use one of the tools out there for working with PHP and MySQL. This should really go in a FAQ. I don't know if there is a live FAQ for PHP based on this list. ? Anyhow, this is one of my pet peeves. Nothing gives me the shudders more when I encounter a *developer* who ONLY knows a GUI. Any conscientious person should always seek better ways to do what they do. So I always go out and try these IDEs and so far I've always returned to Textpad and the really good developers I know who use unix/linux for a workstation use emacs and vi. A naïve user might find this odd. But you must understand that we also have scripting tools (usually Perl) coupled with an ability to type (above 60wpm) and at hand knowledge of the language. I and others also extensively use code libraries so we don't re-invent the wheel and consequently overbill. The only IDE that has impressed me, up until now, was the M$ stuff but I don't do VB, Visual C++ etc. But now I just downloaded this one: http://www.phpedit.com/ PHPEdit is a full featured PHP IDE for Windows. It has code insight, code completion, syntax-highlighting, integrated debugger, code browser, keyboard templates, and even more. Most IDEs make the simple simple or worse, difficult and nearly always difficult to later edit by hand. PHPEdit RECOGNIZES the the *classes* that you use in your scripts. It loads them. You can acccess them via the code browser. It recognizes all the methods in your file (according to class) and lists them for easy movement. This IDE has great potential imho. It's just the sort of thing that I have been looking for. It doesn't not try to help me do the simple things. It helps me organize and access my code. I don't think this would help the developer who doesn't know anything. It doesn't seem 100%. It has a nice feature where I can plug in documentation which gets loaded in the HELP browser window. This isn't working for me. It could be my fault. I have not investigated that much, but such a thing is quite, quite good, I still don't know PHP well enough to just write from brain to keyboard. BTW, other tools I use in development: Treepad (organize all sorts of data easily, http://www.treepad.com/ I use the free version) Of course I have my own Perl scripts for s/r but I also use this a lot (primarily just for the search): http://www.funduc.com/search_replace.htm CuteFTP (I really hate this program for the stupid things it does but it's still the best I've found, I detest using my mouse and I can do a lot with cuteftp from the keyboard, but it's braindead and the developers don't respond to my suggestions for improvement, it might be I need to rethink my development model). WinTelnet, I don't use the ftp app it comes with. I only use this because it SAVES all the servers I login to. At one time I had over 50 and I wasn't going to remember all the usernames/passwords and type the login all the time. This app logs me in and gets me to the command line. Oddly, it's not rated high here: http://cws.internet.com/telnet.html SSH Secure Shell 2.3, when I gotta use SSH. This could be a lot better. but it's okay. TextPad (for those of us who have not learned emacs or vi well enough :) http://www.textpad.com/ cygwin (get all those great linux tools on your windows box. I've got KDE running in another window :) Perl (knowledge of a scripting language is a great tool, I've never used PHP from a cli as I started as a Perl programmer) Opera, IE, Mozilla (mozilla and Opera make it easier to turn cookies on/off and view them and lots of other things) http://validator.w3.org/ (make sure the code adheres to a standard, I use the referrer as my html is never whole until you request a page) Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UPS Ship Rates avail? XML?
On 21 Aug 2002 at 17:55, Shane wrote: Anyone know if there is a place I can query US shipping rates from say UPS or FedEx? Possibly through Amazon's API? I'm surprised on one has sold access to these. Back in the days when I did ecommerce:) I had carts that would use something like curl I guess and parse the remote files to get rates but I setup tables in mysql with data you can get from the UPS and from FedEx. UPS will send you a floppy disk (what they did to me) and you can reorganize or use the data structure as is (oh forgot, that was the USPS that did that). UPS: http://www.ups.com/using/software/currentrates/rates_in_us.html#zones USPS http://postcalc.usps.gov/Zonecharts/ Not too helpful but they'll sell you (about US$35.00 I think) a floppy with a matrix of all that stuff or you can just get the data for your shipping point of origin(s) Try this: http://postcalc.usps.gov/ FEDEX http://www.fedex.com/servlet/RateFinderServlet?orig_country=USlanguage= english has a link to download rates: http://www.fedex.com/us/rates/downloads/?link=2 The problem with putting these rates in a database is that they will change and how will you know? I think Amazon has done a real good thing here that might wake up some other companies. All this stuff was available years ago. Who's working at these big companies. Here is a site with lots of shipping info: http://shipping.langenberg.com/ Peter -- http://www.coremodules.com/ PETER J. SCHOENSTER (901)-652-2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] progress bar for uploading files
On 16 Aug 2002 at 23:40, electroteque wrote: hi guys i was wondering if there was anyway to have a progress bar for uploading images ? TMTOWDI, but here is a way I did something similar. I was spidering remote sites and to get user's data and store in a database and the user could not continue until the spider spun it's web. I accpeted the data I needed and then returned a page with the HTTP-REFRESH tag in it with something like this meta http-equiv=Refresh content=10; URL=http://yoursite.com/verify_upload?process_id=Xamp;action=check_uploadamp;timer=X So it refreshes every 10 seconds and checks to see if process X has finished, if so then redirect to the next step, if not then just return but upgrade the timer so you can increase your counter (perhaps a percentage in a table cell). Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: progress bar for uploading files
On 16 Aug 2002 at 12:38, Philip Hallstrom wrote: This wouldn't work for uploading files however since the long part of the process is the act of uploading the file and until that completes your save.php (or whatever) isn't called. So in regards to file uploading it has to be done with Javascript. What you do below is great for scripts that just take a long time though. Yes, heck, I forgot about that. I fork the other script ... I don't see how I can do that with the file upload as it is the script itself being called ... umm I don't see off the top of my bald head how to do that fork with the file-upload. But there is a mod_perl module which does this. It might give some clues to someone who will pursue this (not me :) http://theoryx5.uwinnipeg.ca/CPAN/data/Apache-UploadMeter/UploadMeter.html Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whois...
On 12 Aug 2002 at 20:48, Christian Ista wrote: Hello, I'd like to implement on my web site an whois to know the information about a domain name (.com, org, ) Could you tell me how to do that ? http://promoxy.mirrors.phpclasses.org/search.html?words=whoisgo_search=1 http://promoxy.mirrors.phpclasses.org/browse.html/package/360.html The Whois class uses one simple method for looking up almost all domain names accross the globe There you go. Register with phpclasses.org, costs nothing for now. Take a look at how the guy did his. If it works, be happy. If you reckon it could be better you might want to enter into a dialogue with the author. Try to avoid spinning your own wheels when others have already done so. And here is another one: http://pear.php.net/package-info.php?pacid=13 The PEAR::Net_Whois class provides a tool for querying Whois Servers Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Matchmaking site
On 9 Aug 2002 at 0:59, Oficina Digital wrote: Hello, I am new to the list and don't know how kind you are helping complete beginners in PHP. I intend to set a personals matchmaking site for people interested in entheogens (http://singlemates.yage.net) I don't know where to begin, I have some PHP cookbooks handy and am looking to do it the easy way but have no idea how much work and knowledge is needed. What I want is for people to log in (using sessions?), post and modify profile with uploading photos and search for personals based on location, desired place to live, age, kind of relationship, etc. I intend to do it it by steps adding features as my php knowledge increase but would appretiate very much some tips and hints on where to begin and how to design this project. Some tips on where and what I shall learn for this project would be of great help. Well I think you've made a good first step by asking others. Iike the idea of a core. If you cannot create an application that can grow then imho you did not do it right. So the idea that you can start with a limited set of features and grow your application is, imho, a good idea that is possible. Think. Sketch. Write don't code anything. Map it out in your mind, your imagination and on paper. It just so happens that I'm working on a singles type site; it is going to be one of those hot or not type sites. I've got the same idea you have. I'll start with something that people will find useful and then I'll grow it. If you were to do it in Perl I could get you started rather quickly as I have an architecture for Perl apps but I don't, not yet, for PHP apps. Mind you, I develop in a virtual environment and so I cannot use a lot of established archtitectures which requires more than one usually gets on a virtual server. Anyhow, think of the core of who your audience is and what they will do. Audience People will register login logout change preferences set preferences upload image(s) People have name age preferences etc. ... build up a data model here. Just think of them and what they will do and what you will need to know about them for them to do those things. I'm just thinking of the top of my head here. BY ALL MEANS do not re-write something someone else already wrote. Look into using modules from Pear and look for modules you can find here: http://pear.php.net/ Oh heck, I was looking in my bookmarks to recommend some links and I found this: http://www.cyber.com.au/users/clancy/phplib.html I need to read that myself. The are saying the right thing here. Lots of classes at this site: http://www.phpclasses.org/mirrors.html?page=%2Findex.html At least read, just read so later, in a few years perhaps, you will have only yourself to blame when you go back to code that was written on the wind: http://pear.php.net/manual/en/standards.php Whatever you do, don't just start coding. I'm working on someone else's PHP application right now. Files everywhere, tricks used to source differen files, I think the original programmer (seems that at least 2 had a hand in it) just gave up. I've refused to work on some old stuff I wrote. Better to re-write it I said. Not so much a rewrite as a reorganize. If you spend time thinking how to organize your code in the beginning you will find that growing your app will be a pleasure rather than a nightmare. Peter http://www.coremodules.com/ Web Development and Support at Affordable Prices 901-757-8322[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to become a good PHP coder?
On 31 Jul 2002 at 11:38, Martin Towell wrote: The best way to become proficient in programming (or anything, come to that) is with _lots_ of practice. ...snip Personally, I don't bog myself down in code from the start. I think in sorta pseudo-code, then once I have a solution, I then implement in language-specific code. I whole-heartedly agree with the above. It's all to easy to just start spinning out code and weaving things together and before you know it you've got something. But then come the inevitable changes, how will your code handle it? I would suggest reading some Steve McConnell. http://www.amazon.com/exec/obidos/ASIN/1556154844/ref=ase_stevemcconnelconA/103-2560652-4298245 That's the author's affiliate id, doesn't hurt to help them make more money. It links to Code Complete. As one reviewer says: Code Complete showed me that it's a lot more than that, beginning by designing your program, not just starting to write code right away, up to topics like naming conventions for variables, how to determine what code to put into a routine or how to make your program easier to debug. I cannot emphsize enough to follow some sort of standard. At least to read through the standard once. http://pear.php.net/manual/en/standards.php Pragmatic Programmer is also quite good: http://www.amazon.com/o/ASIN/020161622X/ref=cm_custrec_gl_acc/103-2560652-4298245 Anyone with 3/4 a brain can throw together some code to do something. You've got thousands of examples and you might stumble across some of mine. It is another thing entirely to write code that will form a basis for evolution. The web is all about evolution. We always have to get the latest project done yesterday and then before we've even tested it we've got changes coming in ... thinking about what you are going to do and how you are going to grow it and test it are very important. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Close A Databse Connection
Hi, The question was about the use of mysql_close. Use it or not (not when to use it or when not to). So far: Agreed... you should always clean up after yourself. PHP will close the connection automatically will be closed and all information cleared. I advised a newbie to always use mysql_close() to close the connection to the database. It's good form and will cover any ills where the database connection fails to close for some other reason (say the user stops the page from loading after the connection is made). 2 says use it 1 says no. From my read of docs I'd say not to use it. I use the Perl DBI with Apache::DBI and it simply overrides the DBI disconnect so calling a disconnect is only a waste of minimal time and typing when using it. So, in PHP there are also 2 types of connections: mysql-pconnect mysql_connect Well if you are using mysql-pconnect then you would rarely use mysql_close() as the docs say Using mysql_close() isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution. See also freeing resources. __end quote Okay, so when, when using a persistent connection would I use mysql_close()? http://www.php.net/manual/en/function.mysql-pconnect.php says Second, the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use (mysql_close() will not close links established by mysql_pconnect()). See the above url for information from user comments about cutting down idle connections. I think it's safe to say one would not use mysql-close() when using mysql-pconnect, although I wonder about the cost of doing that. http://www.php.net/manual/en/function.mysql-close.php says Using mysql_close() isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution. It seems to me better to err on the side of caution and use mysql_close(). If you are using a persistent connection then the call to mysql_close() should be overridden but I've got no clue if it's done that way. Seems to be related to opening and closing a file. In Perl the file will close when the script exits and that's fine for quick stuff but once a script begins to grow it allows for bugs. I vote to suggest use of mysql_close(). Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Paying Job...
On 25 Jul 2002 at 11:46, Gerard Samuel wrote: Basically, someone is looking to get a database driven site built, and Ive never written code for money before. Im looking for advice, as to how the experienced coders in here charge for their work. Do you charge by the page, script or by the hour (that would be nice). Not talking about what to charge but how to charge. Good question. I've travelled quite a bit and in a lot of countries a price is how much do you want to pay. Seriously, when you ask the price the answer is usually that, sometimes excactly that or other times what the seller considers you might pay based on his quick evalution of you. Now, are software companies much different than that? I don't think so. Try to get a price on some software products. Not as easy as it seems. What are you really selling? You are not selling packaged software. You are selling a service. Most, not all, services get priced by time. I worked at an ad agency and I had to account for 7.75 hours per day. I would attach my time to jobs and the account execs would bill the clients periodically (and sometimes they reduced the time I spent). Often there was the thought to bill for value provided rather than time which is tricky if not also walking an ethical borderline, imho. I love the people who bill by the project. They will spend all of 10 minutes to know a project and bid. I guess most of them hope to whine later to get more money. I would bet that this method has the most success. But then you would make more money selling drugs than providing software solutions so success is probably not measured by money or acceptance. Personally, if it's a small thing like fixing something broken in software I understand or just doing something that's pretty generic I will provide an estimate of time, as in from 4 - 8 hours. The client must trust me and be willing to pay the high figure if need be. I will usually not bill more than the high figure if I've underestimated. If it's a project (more than 15 hours) then I prefer to try and get a blueprint going so I can determine what it is I'm going to build before I agree to build it at a price. This worked for me three times, for FedEx and for an Architectural Firm and a monster type job company. Usually this method fails because your client will balk at paying for what is so obvious :) and when other developers will also agree that it's so obvious. So, imho, it is a question of who you are to determine how to charge. Best bet, imho, is to try to understand the project as much as possible and give them a decent range. Be prepared to spend a lot more time on it than you budget. Try to get the job especially since it sounds like it's your first. If they want a fixed price for something which isn't even fixed yet, heck, give it, plenty of others will. Experience helps, understanding the nature of the client helps ... I'd suggest do whatever you have to do to get the job, you want the experience more than the money (possibly). Peter http://www.coremodules.com/ Web Application Software and Support at Affordable Prices -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OT project dev prroces was .. Paying Job...
On 25 Jul 2002 at 12:12, Matt Babineau wrote: When first speaking with a client, would you charge an initial constation fee for lets say conference calls? How would you invoice stuff like this? on a monthly basis? Or every two weeks? Hi, I apologize for adding some noise but I really don't know of a good list for these things. I keep planning on putting my smartarchitectures.com site to use for this as so many problems are non langauge specific but we always ask in our favorite language list. Anyhow, Here is how I have done and prefer to do a project (but TMTOWDI of course) Initial meeting is free. This has usually be filtered by sales or some other means. But I always think talking ideas is worth time. I'm a bit cautious about giving out any really good ideas in this meeting. Try to see if client is serious. From this meeting I then work up an estimate of the followin ... oh heck here is a proposal I did (my first proposal since I become a free-lancer): http://www.coremodules.com/customer/memphisworks_proposal.php The client did not accept me :(. They went with someone else. I did mention to the client, are you ready, that they use HR XML standards so seekers and suppliers of jobs can talk to the site via XML .. that means that you the job seeker would not have to repeate the same old thing (if you have your resume in a database like your dear friend) but could just upload the XML file of your resume and thus populate all the fields and that the supplier could upload job offers via XML and not pay some drone to create typos in forms. Even though the client was in the HR business she had never heard of XML. Oh well. I go into more detail about what the proposal above refers to here: http://www.coremodules.com/process/doc_process.php Yes, some of that comes from some Proejct Management books I've read. I believe a system, even if flawed, is better than no system at all. NOTE, yes, I know some links are broken from that page. BTW, at the ad agency I worked at, we billed on a regular schedule. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Tips for better PHP, wish I read yesterday
Hi, Awhile back I was asking for just what I'm reading here: http://www.php9.com/index.php/section/articles/name/PHP%20Guidelines Some snippets to give you an idea what you will find on that page: Another mistake I see around a lot is people writing scripts that will not work if register_globals is off. In the next release of PHP register_globals will be off by default, so you need to start writing your scripts with this in mind. ?php $name = 'Bill'; echo table align=\center\trtdMy name is $name/td/tr/table; ? No, don't do that. ?=$name? This is a short-hand in PHP for: ?php echo $name; ? I have come across some of this in the documentation but not in your face like it is here (and should be). Does anyone have any more links to articles like that? Thanks, Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Of Jobs and Certs
On 17 Jul 2002 at 12:55, Miguel Cruz wrote: On Wed, 17 Jul 2002, Martin Clifford wrote: I'd like to get everyone's input on Jobs and Certs. I know there are a couple Certifications for web developers out there, such as the CIW and CWP certifications. I don't know if this is what you want to hear, but I can tell you that as a rule, I don't hire people who advertise certifications on their resume. I've found that they correlate pretty strongly with incompetence, to the point where nothing saves me more time when filtering through resumes than first throwing away the ones covered with acroyms starting with C or MC. People who have the skills, demonstrate it through their work experience, walking through their sample code with me, and their ability to explain how they would perform a task. People who trumpet certifications overwhelmingly seem to be people who were unable to advance their careers based on the strength of their skills, and so chose to resort to a paper method instead. I'm not saying anything about you here, just suggesting that you consider alternate means of impressing employers. :) ... this is a laugh. There must be one Miguel for 10,000 other managers. What Miguel said above is what any rational, competent manager would do. I cannot tell you how many times I send my resume but I put a link to my code (they can download entire apps so they can see not only snippets but how I organize or disorganize my code). No one, not one, has ever bothered to look at my code and questioned me. I interviewed with Jeffrey Friedl of regex fame and even he did not look at my code (although when I said I did not know something he laughed and said he did not know either, that's why we have reference books). I think getting the CERTS is not bad. Certainly the smart person will do as Miguel suggests, but I think he's in the VAST minority. I know a guy who has a consulting firm. It's a M$ shop. They BLAST their M$ certs everywhere. The software business is too new imho. Most people who should know better will be bamboolzed by CERTS. One manager sent out an email to everyone who responded to an ad. He offered general suggestions to everyone. I thought that was a dern good thing. He suggested people send Brainbench exam results. I'm sure certs would have helped as well. Even though this guy was nice I doubt he could get around code. imho, there are just far, far too few people who can judge someone by their code. I say get the certs. Personally, I could never work for someone who needed that so I don't bother, but if you want a job, I can't see that it hurts AT ALL. Heck, I'm gonna rant if I keep going ... ever have someone ask you if you know FTP :) ... like a smart person could not show another smart person about that in 15 minutes. It's just amazing what passes for competence in the IT world. I had a boss who I swear sincerely said he could double click a mouse. The guy was serious. I did not last at that job :) Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Search Page question
On 16 Jul 2002 at 10:51, Mark McCulligh wrote: I have newbie question. I am building a search page that will return any number of records and want to display only 30 at a time say. Then have one of though Page 1 of 3 [1] [2] [3] Next on top of the record list. What is the best way to do this. I was looking at using the LIMIT feature in MySQL, but the MySQL manual said that if you use ORDER BY with LIMIT in the same SELECT it does the LIMIT before the ORDER BY. Therefore it does the limit then orders the limit list only, not order the entire list then returns the limit from that. Is this true? -OR- This it better to retrieve the entire record list, then jump to a starting position. Say on Page 2 start displaying at record 31. If I use the second method, is there a PHP/MySQL function of move to a certain record. I know there is probably many different solution to this problem, but what are some of them. I was going to use my last option but if I have a 1000+ records loading each time the performance may be slow. As common as this is I should have some template for it at least ... I did try that once. Here is an example I recently used. It's in Perl but since it's primarily SQL it's still a good example I reckon. (note, thank god, in Perl we don't have to quote literals in a hash, I hate doing that) if($input{next}) { $sql = qq|SELECT * FROM images WHERE location = ? AND image_id $input{next} ORDER BY born DESC LIMIT $input{spread}|; }elsif($input{previous}) { $sql = qq|SELECT * FROM images WHERE location = ? AND image_id $input{previous} ORDER BY born LIMIT $input{spread}|; } else { $sql = qq|SELECT * FROM images WHERE location = ? ORDER BY born DESC LIMIT $input{spread}|;# } Explanation: SELECT * FROM images WHERE location = ? AND image_id $input{next} ORDER BY born DESC LIMIT $input{spread} $input{next} is the ($input{spread} + current position) so if my spread is 5 I will have 1-5 6-10 11-15 and $input{next} will always be 10,15,20, etc. Now from here: http://www.mysql.com/doc/L/I/LIMIT_optimisation.html If you use LIMIT # with ORDER BY, MySQL will end the sorting as soon as it has found the first # lines instead of sorting the whole table. Umm ... my system worked. I don't think though that the above line indicates it would. You can see the snippets I show from above here: http://www.memphisart.com/superframes/index.cgi I set the spread to 2 so you can see it working and I uploaded a few images. The guy who wanted that wanted to sort by last in first up. There are probably many more ways of doing this. Hope we see some more responses. I never thought to use the LIMT X,Y option. I will test that later. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] pros and cons of ezpublish
Hi, Someone wants to know what I can do with ezpublish and so I've downloaded it. Wow ... just looking at it now. What a package. ezpublish. I'd like to test this on a virtural server (can't afford my own box on the net) and I have a host where I can modify my apache conf files ... but I wonder. I've even got access to imagemagick but I have to call it direct. Anyone with some experience or advice on ezpublish? It's about 14 meg uncompressed. Bloatware or is it worth the effort? Thanks, Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Classes vs. Functions
On 17 Jul 2002 at 12:43, Michael Hall wrote: There is no simple answer here. I have started using classes where I find I am writing a lot of related functions that share similar parameters. Database connection and queries are a good example. Authentication is another. Yeah. I have another class that builds forms, because I just hate the tedium of coding HTML forms by hand. It is really just a collection of functions, though, and could work fine as such. This is a gray area imho. I'd leave all html to the person who cares what it looks like, not what it does. I usually also use a code generator to create html and their forms but they are a separate layer. I use templates, wish a lot more php people would as well although I've seen some weird stuff where in this one bb they store templates in the database. That's interesting. I'm still learning/exploring ... I am always guided by the principle that whatever makes less work for me (but achieves the same result) is probably a good thing. IMHO classes are best for more universal code that really can be used in many different places. My functions tend to be more application specific. Yeah, can't say too much more than that. There is the style of coding where one application is completely independent of another. Then you begin to realize, gee ... I could just cut and paste this code. And then there's always the funny repetion of the exact same code every 30 lines or so (depending on memory of programmer I guesss). Eventually you begin to realize gee ... could I put this stuff in a library. A CLASS after all is just a collection of functions with a data model. But ... there is modular and then there is OO imho. I'm a die hard modular programmer who is trying to think in a more OO way. But of course when you just gotta get something done, do it. The value in spending a bit more time going the modular/OO route is that your application will be easier to evolve and debug. Peter-- http://www.readbrazil.com/ Answering Your Questions About Brazil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] integrating usenet into http? how is this done???
On 15 Jul 2002 at 14:55, Andy wrote: I just found a site where they have integrated a usenet forum into their own forum. I am wondering how this is technicaly done? The postings seem to be pretty up to date ( I did compare them with the usenet ones) Here is the link: Has anybody an idea how they do this. I think the forum software is phpbb. But they do not provide such a function as far as I know. All the data inside phpbb comes out of a db usually. How is this done with copyrights anyway? Think about the datamodel for a usenet post. Each has a unique id and from there you are good to go. http://www.workbrazil.com/admin/kb.php That's a copy of a site I'm working on. I happen to use a Perl script that is run by cron and connects to a few newsgroups and uses filters to select messages (essentially email) and store them in a mysql table. That script could easily be written in PHP I guess. So you get the message and you re-arrange to fit the datamodel of your database and insert it. About the copyrights. I looked into this a bit and I'm not lawyer but I found nothing that said what I was doing would be wrong. I certainly reject any copyrighted material which is often posted but all that guy seems to be doing is to be reposting. In my case I'm actually culling data to repurpose and if I use chunks of posts from someone I give them credit. Here is the table I use to store data. I did this quickly and need to pare this down to the essentials. CREATE TABLE news ( Content_Disposition varchar(20) default NULL, Content_Transfer_Encoding varchar(20) default NULL, Content_Type varchar(50) default NULL, Reply_To varchar(50) default NULL, Subject varchar(100) default NULL, X_Accept_Language varchar(20) default NULL, X_Admin varchar(20) default NULL, X_Complaints_To varchar(20) default NULL, X_MSMail_Priority varchar(20) default NULL, X_Mailer varchar(20) default NULL, X_MimeOLE varchar(20) default NULL, X_Newsreader varchar(20) default NULL, X_No_Archive varchar(20) default NULL, X_Priority varchar(20) default NULL, X_Received_Date varchar(20) default NULL, X_Server_Date varchar(20) default NULL, X_Trace varchar(20) default NULL, X_UserInfo1 varchar(20) default NULL, Xref varchar(20) default NULL, MIME_Version varchar(20) default NULL, Message_ID varchar(20) NOT NULL default '', NNTP_Posting_Date varchar(20) default NULL, NNTP_Posting_Host varchar(20) default NULL, XFrom varchar(200) default NULL, Born varchar(20) default NULL, Distribution varchar(20) default NULL, XLines varchar(20) default NULL, Newsgroups varchar(50) default NULL, Organization varchar(20) default NULL, XReferences varchar(100) default NULL, body text, article_id int(11) default NULL, mysql_born date default NULL, tz char(3) default NULL, hour timestamp(14) NOT NULL, Name varchar(50) default NULL, this_group varchar(50) default NULL, visibility tinyint(4) default NULL, editor int(11) default NULL, PRIMARY KEY (Message_ID) ) TYPE=MyISAM; Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Trying to build intelligent query from question
Hi, I may be doing this all the wrong way :) so feel free to let me know, thanks. I've been developing a q/a database. I don' want to search on what I consider common words. Certainly there must be a list of these. Anyhow, I explode the question string into words and then iterate as such: foreach($words as $Key=$Value) { if($ignoreWords[strtolower($Value)]) { continue; } Here is my $ignoreWords array: $ignoreWords = array('brazil'=1,'like'=1,'the'=1,'this'=1,'that'=1,'why'=1,'are'=1,'there'= 1,'where'=1,'find'=1,); What do you think? Do I just build up $ignoreWords like I'm doing or this there another way I've missed? Also, does someone have a list of common words to ignore? Thanks, Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trying to build intelligent query from question
foreach($words as $Key=$Value) { if($ignoreWords[strtolower($Value)]) { continue; } You would be better off using array_diff(). Jason, Thanks, that works except that it doesn't account for case. I want to ignore case as it doesn't apply here. But I was able to get rid of the associative array. So I reckoned it best to LC the question and copy it because I want to return the original question as is back to the browser. $_string = strtolower ($Config['input']['question']); $words = explode( ,$_string); $ignoreWords = array('brazil','like','the','this','that','why','are','there','where','find',); $FindTheseWords = array_diff($words, $ignoreWords); Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP, JAva history
On 14 Jul 2002 at 13:42, Saci wrote: I would like to see from where visitor come from mypage i need a function who return the last visited page prior to mine. I didn't found any function on php for that purpose and I'm thinking in mix Java and php for that purpose, using the browser history, Can someone show-me how can I do that. Sounds like you want the REFERER, misspelling on purpose. Take a look here: http://www.php.net/manual/en/reserved.variables.php http://www.php.net/manual/en/ref.url.php Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and geographic maps
On 11 Jul 2002 at 16:42, Lowell Allen wrote: A client wants a database-driven site that records information about real estate properties and includes geographic maps of property locations (throughout the US). The client has seen a presentation of a JavaScript-powered, Windows-only product that doesn't seem to fit well with my preference for PHP/MySQL. I've been Google-searching info on GIS and GPS and GMT, but thought it might be worthwhile to ask this discussion list for input. Can anyone direct me to info on PHP presentation of geographic maps -- tied to a database with locating coordinates? Well heck, you've peaked my interest. I don't see how javascript makes any difference. The power of the app MUST be some server-side app otherwise it would work in any Browser (or please correct me in any way). I'd like to hear more details about this. What kind of maps do they produce? I once worked with on a map site called pixxures.com and they had MANY servers that were SPECFICALLY designed to process requests and return images (ran on linux and solaris and might have worked on windows as the app itself was in java I believe). We only had to provide coordinates from the web form to these apps and they'd return a slice of an image. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and geographic maps
Was written: Using coordinates to accomplish this seems possible, but overly complex. You'll literally be creating a 3D world and that means At pixxures.com the client just entered their ADDRESS. Then the backend (probably a bit too much for javascript) would return a sattelite view of that address. I believe they were using Russian data or something. But as I mentioned before, they had serverS that only took requests, cut out images, returned images. Oh heck, they are still in business, take a look: http://www.pixxures.com/ But I can't wait for them to serve up any images as they are dreadfully slow. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Development Tools
On 10 Jul 2002 at 18:07, Uwe Birkenhain wrote: I think that - on windows - nothing is better than textpad (www.textpad.com). Simply the best editor the world has seen so far! What makes development tools better than a good editor? (serious question) Well let me get my 2 cents in. It's a religious question. But oh well. I recently had a lot of trouble with someone at work about this, so I'm gonna rant. I too use TextPad and have been since I'm too lazy to get really good at vi or emacs. I also know and use Perl extensively as a code generator. Someone talked about the work in creating a form, just give me the keys and boom form is done and read to be handed to the designers to ruin in their special way. You could use Ruby or Rebol or even Python I guess or PHP on the command line but I can't imagine anyting being faster than a Perl script (to write). I keep trying these IDE tools. I type about 70+ wpm, so you can imagine I'm not a fan of my hand speding half it's time in the air between keyboard and mouse. I also try never to repeat the same code twice so I don't cut and paste ... I put common functions in modules and use them but few IDEs that I've used easily allow me to use those or I haven't seen how. If anyone wants to create a great IDE for Perl I'd love to help. It should work for PHP as well. I also separate my programming from my view and since I'm a programmer and not a designer the visual view is not paramount to me and can always be done later or at the same time by me or someone else. I have a feeling that most PHP programmers also do their own design and that's a reason for so much PHP stuff to have html strewn all over the place. In any case I always think in terms of a theme and since I've got most of my html code abstracted into boxes it's just a question of my program to manipulate and supply the proper data to the template. So for me, the best development tools are: 1. Imagination 2. Knowledge of your tools (language, PHP, HTML, CSS, etc. in this case) 3. Knowledge of the computer and it's potential (I use NT as desktop but have cygwin and use unix command tools and lots and lots of perl scripts to aid in development) 4. A good text editor (there are lots, they all have macros, revision control, keyboard commands for as much as possible). Personally, I've never worked with a programmer who taught me anything who used Dreamweaver or FrontPage etc ... all the good ones I know use vi, emacs, textpad, etc. I'd suggest using a text editor and then moving to an IDE or more advanced GUI and knowing that it is faster for you as opposed to starting with an IDE or GUI because you'll probably end up like most people and begin to think possiblities are what your tool allows you. Peter -- http://www.readbrazil.com/ Answering Your Questions About Brazil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Postal / Zip Code Proximity Search
On 9 Jul 2002 at 10:39, Ray Hunter wrote: One suggestion is to use the geo functionality of Postgres We use postgres to calculate city, state, and/or country by using the geo functions in postgresql. - Original Message - From: Brandon Pearcy [EMAIL PROTECTED] I have a couple of questions with respect to creating a postal / zip code proximity search that is remotely accurate. The system I am using now is OK for small distances, but is terrible at calculating large distances. Not only does it need to find the establishments, it needs to calculate the distances (straight line, of course). I don't know what you mean by straight line. AFAIK all of this will be as the crow flies. The following came from Jann Linder of cgi-list fame and it worked for me. Odd, I used it in PostgreSQL not knowing that there was something homegrown. SELECT /*+FIRST_ROWS */ o.zip, (3956 * (2 * ASIN(SQRT( POWER(SIN(((z.latitude-o.latitude)*0.017453293)/2),2) + COS(z.latitude*0.017453293) * COS(o.latitude*0.017453293) * POWER(SIN(((z.longitude-o.longitude)*0.017453293)/2),2) dist FROM zipcodes z, zipcodes o WHEREz.zip=94112 AND (3956 * (2 * ASIN(SQRT( POWER(SIN(((z.latitude-o.latitude)*0.017453293)/2),2) + COS(z.latitude*0.017453293) * COS(o.latitude*0.017453293) * POWER(SIN(((z.longitude-o.longitude)*0.017453293)/2),2) 5 order by dist; CREATE TABLE zipcodes ( recordid int(11) unsigned NOT NULL auto_increment, zip varchar(5) NOT NULL default '', state char(2) NOT NULL default '', city varchar(50) NOT NULL default '', longitude double NOT NULL default '0', latitude double NOT NULL default '0', sure tinyint(3) unsigned NOT NULL default '0', PRIMARY KEY (recordid), KEY idx_zip(zip), KEY idx_state(state), KEY idx_city(city), KEY idx_latitude(latitude), KEY idx_longitude(longitude), KEY idx_sure(sure) ) TYPE=MyISAM; More stuff about this here: http://mathforum.org/library/drmath/view/51711.html http://www.movable-type.co.uk/scripts/LatLong.html http://earth.uni-muenster.de/~eicksch/GMT-Help/msg00147.html Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] hiding submitted variable values in location bar of browser !
On 9 Jul 2002 at 22:09, [EMAIL PROTECTED] wrote: Is there any way to hide my form submitted variables (like passwords etc) in the location bar http://somedomain.org/checkpassword.php? password=mypassword or atleast show in an encypted form n the location bar. But why bother? Certainly you would not think it secure. Use https for security, anything else is a mirage afaik. There is a module in Perl that encrypts and unencrypts post/get data intended for hidden fields. I guess it uses a checksum as well. I personally prefer to just create a session and keep it on the server side. Oh heck, but now as I read your email closer I guess you are asking how it can be done from a form the first time. Perhaps with javascript but then use post instead of get and of course make it via a secure connection if security is a concern. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Commit/Roll Back Transaction in PHP/mySQL
On 9 Jul 2002 at 22:07, Thomas Edison Jr. wrote: why the transaction is interrupted, i would like the transaction to roll back.. that is, all the records entered before the interruption SHOULD NOT remain in the database, they should get deleted or something, so that the transaction can begin Fresh from next time. How can i make such a function that will see this happens, in my PHP/mySQL. Well be sure that your MySQL supports transactions. InnoDB or something. In perl it's just a case of eval {sql here} if($ ) {rollback}else commit, the $ is empty unless the eval created an error. Now, let me see how PHP does this, Google, where are you? http://www.google.com/search?sourceid=navclientq=mysql+php+rollback Might want to be sure your MySQL supports transactions and is configure appropriately or you can drive yourself nuts. http://www.mysql.com/doc/I/n/InnoDB_transaction_model.html And then some ideas about how to do it with PHP: http://www.php.net/manual/en/ref.mysql.php (wow, right from php.net) http://hotwired.lycos.com/webmonkey/02/11/index4a_page3.html?tw=backend I've never used mysql for anything but a data store so I have no examples myself. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] seeking experienced PHP programmer in Houston, TX (no telecommuting)
Hello, I'm posting this ad for the company looking for a PHP programmer. I have no clue if the company is good or not. Do your due dilligence. __BEGIN JOB POST We are a Houston, Texas based company in need of 1-2 VERY GOOD AND EXPERIENCED PHP programmers for 4-6 weeks to build a new web site. This project will be very exciting and involves many very challenging and elaborate programming feature-sets. ABSOLUTELY NO TELECOMMUTING. All programming for the scope of this project must be performed in our office Monday - Friday from 8AM - 5PM Central Standard Time. We would prefer programmers who currently live in the Houston area opposed to programmers willing to relocate to the Houston area for the duration of the 4-6 week development period but we will consider all options. This opportunity could possibly lead to fulltime permanent employment following completion of the initial development. All experienced PHP programmers interested should email Evan Esnard at [EMAIL PROTECTED] or call during regular business hours at 832-264-1001. The web site will include a MySQL database backend, e-commerce shopping cart-style ad submission form on front-end with real-time credit card authorization through CardService International, several other ad submission forms on both front-end and back-end, and an extensive back-end Web Admin Control Panel for us to control various features and components of the web site. We will be happy to share further details on the feature-sets with any interested programming candidates for this project. __END JOB POST -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best Content Management METHOD...
On 9 Jul 2002 at 11:54, Justin French wrote: I'm a firm believer in option 1. 750,000 page views per month is only 1 page every 3.4 seconds (ish) on average, so I don't believe you'd see any server load even in peak periods. If there IS server load, you can have an option 3, which basically combines option 1 and 2. Keep the raw article data in a database which is there forever. Then run a program which batch-creates 'HTML' pages from templates and the database, and publish a static website (as per option 2). I'm with Justin on this. Here is a very good article that goes into depth on the subject by a guy who seems to have disappeared: http://philip.greenspun.com/internet-application-workbook/content-management Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] is their a jobs mailing list?
Hi, I was here first: http://www.php.net/manual/en/faq.mailinglist.php#faq.mailinglist.guideline Before you post to the list please have a look in this FAQ But I found nothing about a jobs mailing list. I'm really a Perl programmer and we have jobs.perl.org which has a list which does a really good job. A person from Houston, TX asked me if I knew of any PHP people in Houston. I advertise on Google and Overture as a developer for hire. I don't sugget he post to this list as I'm not sure of the etiquette and I've never seen jobs posted to this list; I know they are accepted heartily on the mod_perl list. Anything simple but effective like this site for PHP? http://jobs.perl.org/ Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] checking date is not greater than today
On 30 Jun 2002 at 22:31, Timothy J. Luoma wrote: I am trying to compare a given date string (i.e. June 30, 2002 is 20020630). I want to make sure that the input string that is given is not greater than today (i.e. if today is June 30, and you ask for 20020701, I want to be able to throw an error). I'm a newbie, so I'm not sure the best way to do this. My thought was that if I take the year () and add on the day-of-year (i.e. Feb 10 = 041) then I would be able to compare them as you would any other numbers. [...] snipped I ignored the rest as it was beyond me. I'm also a newbie to PHP but I looked into dates in Perl. I quickly began using a module from CPAN as I realized this was more complicated than meets the eye and you seem to indcate that when you mention leap years. I would question why you accept input as a particular format. It's certainly easier to work with timestamps than arbitrary representations of dates. I would not be so quick to assume you have to accept input as is. Or at least have it fixed to a format ... but the Perl modules I've worked with are liberal with what they receive :) Anyhow, I'd just find a PHP module ot handle this. I found this: http://www.phpbuilder.com/columns/akent2610.php3 but I'd just want a class (guess you call it that in PHP). And then this looks real interesting: Date/Time Processing with PHP By The Disenchanted Developer March 19, 2002 http://zope1.devshed.com/zope.devshed.com/Server_Side/PHP/DateTime/page1.html In Perl I happen to use this moduel for date manipulation: http://search.cpan.org/doc/STBEY/Date-Calc-5.0/Calc.pod There must be something similar in PHP but since I too am a newbie (and lazy to boot) I don't know what it is. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Keeping Secrets in PHP Files
On 28 Jun 2002 at 17:54, Jonathan Rosenberg wrote: -Original Message- From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] Subject: Re: [PHP] Keeping Secrets in PHP Files With shell access, you can't see each others files. This is where the permissions come into play, because you are logged into the box as a specific user, you can only access your files. If I change the permissions on my files, you can't see them. I've been thinking some more about the issue of keeping PHP source files secure in a shared hosting environment. I've now convinced myself that there is simply no way to protect these files, even if safe_mode is turned on, as long as other users can have telnet (or ssh) access to the box. snip I hope wrong. Can anyone find the hole in my reasoning? Yeah, you are assuming an environment that does not necessarily have to be. Why must one Apache server serve all users? Simply because that's the easiest way to do right out of the box? You have 2 scenarios as I see it: 1. Your own box -- no troubles other than the obvious 2. Virtual Server - One Apache for all users ... seems insecure 3. Virtual Server - One Apache for EACH user ... seems quite secure and experience confirms. http://www.freevsd.org/ freeVSD is an advanced web-hosting platform for ISPs, educational institutions and other large organisations. It allows multiple Virtual Servers to be created on a single hosting server, each with a truly separate and secure web-hosting environment. This reduces an ISP's hardware outlay and also lowers the cost of support due to delegated administration. Distributed under the GPL, freeVSD comes complete with a documented administration protocol and an open-source web-based administration system. That pretty much describes the server I've used at the company once known as iserver which was bought by Verio and Verio used much of their website but renamed it to viaverio.com (was iserver.com). It looks like they've done the same thing with Oracle. The above people have done it with Linux. I've only used iserver for 7 years now at 3 different companies but that freeVSD really looks good. If someone is using Joe's 4.95 a month hosting solution ...well, what the heck do they expect. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Seperating presentation from logic
On 25 Jun 2002 at 17:40, Jean-Christian Imbeault wrote: Some of the issues are things like how to make it painless for both the designers and me if one day, out of the blue, a designers decides that the background colour should be changed, or the graphics changed. Or even worse the two column layout should be a three column layout. But to start off with simple things like: Designer: - on this page a dynamic table will be generated according to the search criteria entered by the user - lines will have alternating colours I can code this easily, but what if the designer then decides that he wants each *third* line to alternate colour, or he wants to use three colours instead of two (a pattern 1,2,3,1,2,3 instead of 1,2,1,2). How can I make it so that he can do these changes without coming to see me to change the code that outputs the data used in the table? Simple things like that ;) There was a recent thread on the mod_perl list related to this concept: MVC. http://st-www.cs.uiuc.edu/users/smarch/st-docs/mvc.html I have an image gallery app in Perl. There are controllers (cgi, mod_perl handler, script) which call functions in the models which simply or not perform functions and return data in hashes and arrays and arrays of hashes of arrays ... :) then the controller calls the viewer it wants to use (works with HTML::Template or Template::Toolkit) and sends the results back to the client making the request (and depeneding on that client, one or other view would be used). I rebelled when my boss wanted me to write an app for a handheld ... oh sure ... I'll just cut and paste and ... what a mess you will get into. You can see that here: http://www.memphisart.com/gallery/ I am in the process of applying some themes from this site: http://www.oswd.org/ Takes about 10 minutes to 1 hour depending on how the theme is written. The same concepts apply to PHP. I have 2 php sites and I've kind of tried to avoide a mishmash of html and PHP code all over the place. I used the concept of the Wrapper from Template::Toolkit for with a port of HTML::Template to PHP here: http://www.coremodules.com/ http://www.coremodules.com/talent/index.php A page calls which wrapper it wants to use. So in the case of talent it uses a one table body whereas most other pages use the 3 column wrapper. The pages simply gather the content ... the design of the page (for the site as a whole therefore) is done in one location. BUT, BUT ... now that I've seen this site: http://www.interakt.ro/products/Krysalis/ I'm going to try and scrap my PHP hack above and use the above. I was never able to use cocoon because I always use virtual hosts. If I can get the above to work on my PHP sites then I might use PHP a lot more. I have a good Perl system but I've only played with PHP for now. Anyone can write the spagetti code which is 90% of what I see in PHP. Most Perl programmers I know write their own template system ... just a common sense sort of thing and usually it starts from ignorance of a good existing templating system ... I've worked at a few different companies and I much prefer to find code that follows a standard than code that follows the whims of the programmer who happened to string it all together. Oh one more thing. The best projects I've worked on have an html guy. This guy is in between a programmer and a designer. We get the designer to do their stuff in photoshop or similar and the html guy converts that into the screen shots we need with our data model and template tags. Of course most companies think they can get those 2 and someone to answer the phone all in one package for double minimum wage ... oh well ... If your designers use GUIs and think they know what they are doing ... well I don't know. Maybe M$ has a solution that works for that environment. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] why doesn't $books[$val][display] show the value
Hi, I've got an array like the following: $books = array( 1572316217 = array( category= 'tech', display = 'Steve McConnell\'s Software Project Survival Guide', href= 'http://www.amazon.com/exec/obidos/ASIN/1572316217/readbrazil07-20', title = 'Steve McConnell\'s Software Project Survival Guide', width = '71', height = '90', src = '/images/1572316217.01.TZZZ.jpg', vspace = '3', alt = 'Steve McConnell\'s Software Project Survival Guide', hspace = '3', comments= , ), $books = $AfiliateLinkBuilder-get_books(); srand ((float) microtime() * 1000); $rand_keys = array_rand ($books, 2); while (list ($key, $val) = each ($rand_keys)) { $display = $books[$val][display]; Why do I have to do this: $display = $books[$val][display]; rather than $html.= Yaddda yadda $books[$val][display]; $books[$val][display] in the double quotes only shows display. I thought that within double quotes I don't use double quotes for elements ... ? What's the rule on this. I could do the above in Perl. Thanks, Peter -- http://www.readbrazil.com/ Answering Your Questions About Brazil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: why doesn't $books[$val][display] show the value
On 9 May 2002 at 15:25, Philip Hallstrom wrote: It has to do with precedence (I think). When inside a double quoted string PHP evalutes $books[$val] *first* and doesn't catch that there's more to it... You can do this: $html.= Yaddda yadda . $books[$val][display]; And I think this (or something close to it): $html.= Yaddda yadda {$books[$val][display]}; Yes, I remember someone writing about how good it was to do that: $html.= Yaddda yadda . $books[$val][display]; personally I hate it :) ... I use Template::Toolkit in Perl and I never muck about with html anything in my Perl. Someone once showed a template system in PHP but it required more than I was willing to try to do on my virtual server (had to install some Pear stuff on my local linux box and move it to my freebsd virtual server and hope :) Anyhow, thanks for the clues .. here is what I'm finding now: http://www.php.net/manual/fi/language.operators.string.php On the above page someone mentions what you do as well: your choice is {$array['user']['choice']} odd thought that he single quoted the key names. I would have thought not since everything was in double quotes. Superflous? or necessary? Odd, imho. He also talks about better to single quote keys than double quote owing to bypassing the need to parse between the single quotes. He says: Generally programmers are better to use ' when ' is applicable to avoid parse overhead. For example, use $array['item'] rather than $array[item]. Your script will be executed a bit faster. I find leads here: http://www.php.net/manual/en/language.types.string.php#language.types. string.parsing Where I see this example (in complex syntax section): // This is wrong for the same reason // as $foo[bar] is wrong outside a string. echo This is wrong: {$arr[foo][3]}; there is no wrong reason above that example. Note the single quote for the literal. I myself prefer{} and I'll single quote all literals contained therein. And then this is a nice page which kind of goes over the problem. I've got a dense head and don't fully understand it all. http://www.zend.com/zend/tut/using-strings.php Just following up with comments and links in case someone else gets bothered by this (got me for about 15 minutes before I just did what I did to get it to work) Peter -- http://www.readbrazil.com/ Answering Your Questions About Brazil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to sort by value in associative array
Hi, I have the array below and I want to sort on language. Can't figure it out. Below the array is what I tried $ArrayOfNewsLinks = array( http://dailynews.yahoo.com/fc/World/Brazil/; = array( title = 'Yahoo Brazil News', category = 'news', language = 'English', ), http://news.bbc.co.uk/hi/english/world/americas/default.stm; = array( title = 'BBC News', category = 'news', language = 'English', ), ); function cmp ($a, $b) { if ($a[2] == $b[2]) return 0; //return strcmp ( $a[2], $b[2]); // thought this would work return ($a[1]$b[1])?1:-1; } uksort ($ArrayOfNewsLinks, cmp); But then I do this: while (list ($key, $val) = each ($ArrayOfNewsLinks)) { $NewsLinks .= p class=\CompactLinks\ a href=\$key\ title=\$val[language] $val[title]\ target=\new\$val[title]/a /p ; } And the order is not by language. Peter http://www.readbrazil.com/ Answering Your Questions About Brazil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: how to sort by value in associative array
On 6 Apr 2002, at 14:38, Chris Adams wrote: On Sat, 6 Apr 2002 10:36:18 -0600, Peter J. Schoenster [EMAIL PROTECTED] wrote: $ArrayOfNewsLinks = array( http://dailynews.yahoo.com/fc/World/Brazil/; = array( title = 'Yahoo Brazil News', category = 'news', language = 'English', ), ... function cmp ($a, $b) { if ($a[2] == $b[2]) return 0; //return strcmp ( $a[2], $b[2]); // thought this would work return ($a[1]$b[1])?1:-1; } uksort ($ArrayOfNewsLinks, cmp); Try changing those subscripts to keys: if ($a[language] == $b[language]) etc. You should have a ton of PHP warnings generated from the code above, as numeric elements won't exist. Not running with warnings on that server (bad thing I know). I tried the above. uksort ($ArrayOfNewsLinks, SortByValue); function SortByValue ($a, $b) { if ($a[language] == $b[language]) return 0; return ($a[language] $b[language]) ? 1 : -1; } or this function SortByValue ($a, $b) { return strcmp ( $a[language], $b[language]); } Doesn't work. Peter http://www.readbrazil.com/ Answering Your Questions About Brazil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to use PHP on command line in windows
Hi, I use NT for development and I like to write snippets of code and test them on my local box I can do this in Perl How can I do that in PHP without installing a webserver etc etc I guess I can install a version of PHP and just make sure I've got the path in my env Thanks, Peter http://wwwreadbrazilcom/ Answering Your Questions About Brazil -- PHP General Mailing List (http://wwwphpnet/) To unsubscribe, visit: http://wwwphpnet/unsubphp
[PHP] must I use var
HI, I was reading the docs and I see this: /* This is how it should be done. */ class Cart { var $todays_date; var $name; var $owner; var $items; function Cart() { $this-todays_date = date(Y-m-d); $this-name = $GLOBALS['firstname']; /* etc. . . */ } I don't see the point in doing var $todays_date; and $this-todays_date = date(Y-m-d); The latter works without the need for the var. Why should i use var? Thanks, Peter http://www.readbrazil.com/ Answering Your Questions About Brazil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: must I use var
On 17 Feb 2002, at 23:20, Raymond Lilleodegard wrote: The var $somevariable means that the variable is defined. You only need to use var in classes. So if you only write ordinary scrpits, you dont need to use it. Raymond, Thanks. Someone else said it just helped to see what your class variables where (but I can see this easily enough). I don't NEED to use var even in classes. I'm writing a class right now without it. But perhaps there is a SHOULD that I am not aware of (just helping me see .. well I don't need that). Peter http://www.readbrazil.com/ Answering Your Questions About Brazil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] zend studio 2.0
On at , Unknown wrote: i write in php about 1.5 years. from the beginning i use macromedia homesite and i`m quite content of it. but...debugger, environment not optimized for php developers etc. so i wanted to try zend studio, i i`ve read this (http://www.byte.com/documents/s=6975/byt1013213009328/) article and now i look different on all of this. so - what`s your opinion - is it good or bad tool. should i try again or wait for next version? Well I was hoping that article was interesting. It wasn't. I should have known when I saw the use of homesite as an alternative. The article had this one interesting line: Like many open-source languages, the biggest problem with PHP up until recently has been a lack of tools. I guess knowledge and imagination doesn't count as tools. I could be wrong. I've been developing websites for the last 7 years. I still use TextPad (coupled with Perl, and UNIX/LINUX) yet I develop on a windoze platform with cygwin installed. I'd suggest using Perl to improve your productivity which I assume is the real question at hand. Will Zend make your more productive than homesite? Now I may be completely wrong. It's just that I've worked with people who use these GUI centric tools and they spend half their time in the air, waiting for their hand to move to and from mouse to keyboard. Learn Perl, not to write cgi (god forbid, even I prefer PHP for this) or necessarily for mod_perl (very good) but just to generate code for yourself. Perl is an excellent tool but you can't get it with a GUI. You use text editors for which there is keyboard command for 99% of the actions you do. If you already KNOW PHP then Perl will be simple. Peter http://www.readbrazil.com/ Answering Your Questions About Brazil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] zend studio 2.0
On 17 Feb 2002, at 16:12, Chris Lott wrote: I hope we aren't going to get another chest-pounding real coders type of argument going here. Homesite *IS* a text editor. It provides Yeah, my bad. an amazing number of shortcuts to tasks, including mouse-based tasks, many of which I guarantee you I can get done faster with a mouse than anyone can typing. It also offers a lot of pseudo-time-saving features Well, as you said, no point in arguing. Just that I think if someone really wants to develop they should learn some better tools than a GUI but it's a question of balance. Peter Despite considerable evidence that it doesn't work, many projects seem to rely on telepathy as the mechanism for communicating requirements from users to developers. --Karl E. Wiegers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] Updating Database at a specified time
On 17 Feb 2002, at 21:01, Jennifer Downey wrote: Would someone please help? I have looked everywhere and can not find how to update a database at a certain time. I am trying to get this to update at midnight instead of every time the browser refreshes. My hosting service has cron jobs but I don't understand how to set them up. Is there a way to set this code up to do what I need? I don't know how to run php code as a freestanding executable but it can be done. For cron, heck, I never remember the syntax either and my gui is no help so I always go this page that my host put up: http://www.viaverio.com/support/virtual/admin/unix/cron.cfm Rule is not to run anything at a give time. So the following should probably at set to a different time. See above link for breakdown of fields (what they mean etc.). Be sure that the time you think it is is actually the time it will run. My server for instance runs on GMT not my CST or even the EST where the server is located. # Execute the vnukelog command at 12:00 midnight (0 0) on August 19 # (8) (aug). 0 0 19 8 * /usr/local/bin/vnukelog You can always do a man cron to see info for your system. Any hosting company worth anything will help you with at least once. I'm not sure where STDOUT goes, I always have it sent to me via email by putting my email at the top of the cronfile (see above url of info on that). You seem to be printing to STDOUT in the PHP snippet you sent. I think you only want to do the update in your PHP script. I'm sure someone will show you how to do this via PHP, I don't know, I use Perl for this stuff. Here's how I'd do it in Perl (MyDBI is a private module). I suggest you check to make sure that your cron job runs properly (you'll be suprised at the number of times something happens where it doesn't). use strict; use MyDBI; eval { my $dbh = MyDBI-new( data_source = 'dbi:mysql:database=x;host=x', username= '', password= ''', ); my $sql = SELECT Subject,body,article_id,Born FROM news WHERE visibility is NULL ORDER BY article_id LIMIT 500; my $sth = $dbh-{dbh}-prepare($sql); $sth-execute(); }; if($@) { print This script no go: $@; } exit; Peter http://www.readbrazil.com/ Answering Your Questions About Brazil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The ASP application object in PHP?
On 16 Feb 2002, at 8:37, michael kimsal wrote: I don't believe the original poster you quote really had/has a firm grasp on what it actually does. The tried and true example is a hit counter. No matter who hits a page, if that page increases an application variable called counter for example, the counter keeps going up. You hit it and it has a value of 1. Then I hit the page and it has a value of 2. The bob hits it and it has a value of 3. And so on. There's no messaging from one session to another, though I don't doubt you could architect some code to operate like that. It's like a 'session' state that's not specific to any one user - a 'commons' area, if you like. Does that help? Also, a second draft of this info, along with a bit of code example in PHP, is in a PDF at http://demo.logicreate.com/index.php/filemgt/main/event=view/pkey=6/ph pfaq.pdf Yes, I responded to quickly as after reading someone else's response to one of your emails it became clear the original poster was mistaken. Thanks for the clarification. Peter http://www.readbrazil.com/ Answering Your Questions About Brazil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] good practice
On 15 Feb 2002, at 17:04, Philip J. Newman wrote: WHo really cares, if it works it don't matter what they call it. In response to: On that same topic, *why* do people name files with both .inc and .php? Your .inc file has PHP code in it, right? Why not just call it .php and spare the server reconfiguration. If knowing which files are Heck, I've seen inc,cls,html,php3,php4 In the last 7 years I've worked for 4 companies in role of web developer. I've also done some consulting here and there. I've had to work with a lot of applications, using that term VERY loosely, written by other people. I've even been suprised by some of my older code :) In Perl no self-respecting programmer writes anything that takes more than 5 minutes without using 'strict'. You can write Perl in stream of consciousnsess and you can use OO. If no one is every going to look at your code again, do it however you want. But if there is that odd chance that your script might become an application or at least evolve then it behooves you to do more than just make sure it works. Spolsky has an interesting, somewhat related, article here: http://www.joelonsoftware.com/articles/fog000348.html I'm certainly not without sin myself. It's all to easy to just banging away at the keyboard. If you are going to do anything that lasts then consider thinking about it before doing it. I had a case where a programmer wrote a script to be run by cron for one reason or another. He needed to use a lot of code written in a cgi script but he put the cron script in his root directory. Rather than include that script properly (should have been a module) he just copied that script to the root directory. It worked. But gosh ... when we evolved that cgi script we did not know that there was another copy out there. It was a real fun bug to track down. The database was getting screwed up from that old script but no one recalled that this had been done and that old script was doing funky things (now that it had evolved). Peter http://www.readbrazil.com/ Answering Your Questions About Brazil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The ASP application object in PHP?
On 15 Feb 2002, at 14:43, Bendik Simonsen wrote: I have however, noticed one feature that ASP has that I have not found an equal for in PHP: the application object. For those of you not familiar with ASP, the lowdown is this: The application object acts like a global session. You assign it variables and values like you would a session, but those variables are available to all instances and sessions. It is for example very useful to track different users at the same time, or to send messages from one session to another, or the likes. Anything like this in PHP, or will I have to find a workaround for it, or *ick* do that little sniplet in ASP? Well how does it work? Is it advertised as M$ magic in the class? Is http not stateless? I don't follow your description and I don't believe in magic. Is it using cookies? If not what? It must be using something? I bet it's using cookies. Sounds a lot like what you normally do with sessions. I don't follow the send message from one session to another ... is this not just normal course for sessions? I'd like more explanation before I believe that this is any more than just a module. Peter http://www.readbrazil.com/ Answering Your Questions About Brazil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Looking for optimal coding
On 14 Feb 2002, at 22:18, Phillip S. Baker wrote: This is not a big thing. But I am looking at this thinking there is a way to make the code take up even less lines. Just want to stick this in my cap for future reference. for($i=01;$i=50;$i++) { if (!empty($content)) { if ($row[$content]==$states[$i]) echo option value=\$states[$i]\ selected$nstates[$i]\n; else echo option value=\$states[$i]\$nstates[$i]\n; } else{ if ($dstate == $states[$i]) echo option value=\$states[$i]\ selected$nstates[$i]\n; else echo option value=\$states[$i]\$nstates[$i]\n; } } Basically I want to check for two possible conditions to make an item selected. If the first one is valid then do not check for the other. Hi, I'm not sure about the two possible conditions. Seems arbitrary but you could do it with my suggestion by just passing an array with one value rather than more than one. Warning, I've only programmed in PHP for about a month now. What I would do if you, what I do when programming, is ask myself if I can abstract the code I'm writing. Might I reach out of the particular instance and see if there is something common in what I'm doing here. It can take a little longer initially but you can then use what you've created over and over again. What you wanted to do sounds like something I've done in Perl so I just re-wrote it in PHP. I have a module of common routines I nearly always use in forms and I have the function below in that module (in Perl). I put it all in a php contstruct so you could test it in your browser. Pardon all the data. I would not have used the values as the key for the $states array but it did not work unless I put something there. You can use this for any 2 sets of arrays (states, cities, colors, sizes, etc). I have common sets of arrays in my module as well. ?php $states = array('mt'=array(display='Montana',value='mt',),'mi'=array(displ ay='Michigan',value='mi',),'md'=array(display='Maryland',value= 'md',),'tx'=array(display='Texas',value='tx',),'nm'=array(display ='New Mexico',value='nm',),'ut'=array(display='Utah',value='ut',),'pa'= array(display='Pennsylvania',value='pa',),'ne'=array(display='Ne braska',value='ne',),'az'=array(display='Arizona',value='az',),'mp '=array(display='Mariana Islands',value='mp',),'wy'=array(display='Wyoming',value='wy',), 'ia'=array(display='Iowa',value='ia',),'ar'=array(display='Arkans as',value='ar',),'la'=array(display='Louisiana',value='la',),'id'=arr ay(display='Idaho',value='id',),'al'=array(display='Alabama',valu e='al',),'co'=array(display='Colorado',value='co',),'ma'=array(di splay='Massachusetts',value='ma',),'nc'=array(display='North Carolina',value='nc',),'ny'=array(display='New York',value='ny',),'dc'=array(display='District Of Columbia',value='dc',),'ca'=array(display='California',value='ca',) ,'vt'=array(display='Vermont',value='vt',),'mo'=array(display='M issouri',value='mo',),'tn'=array(display='Tennessee',value='tn',),' or'=array(display='Oregon',value='or',),'sc'=array(display='Sou th Carolina',value='sc',),'wa'=array(display='Washington',value='w a',),'in'=array(display='Indiana',value='in',),'ks'=array(display=' Kansas',value='ks',),'oh'=array(display='Ohio',value='oh',),'hi'= array(display='Hawaii',value='hi',),'nv'=array(display='Nevada',va lue='nv',),'nh'=array(display='New Hampshire',value='nh',),'wv'=array(display='West Virginia',value='wv',),'wi'=array(display='Wisconsin',value='wi',),' nj'=array(display='New Jersey',value='nj',),'ak'=array(display='Alaska',value='ak',),'mh'= array(display='Marshall Islands',value='mh',),'fm'=array(display='Micronesia',value='fm',) ,'as'=array(display='American Samoa',value='as',),'mn'=array(display='Minnesota',value='mn', ),'ct'=array(display='Connecticut',value='ct',),'me'=array(display ='Maine',value='me',),'de'=array(display='Delaware',value='de', ),'sd'=array(display='South Dakota',value='sd',),'ok'=array(display='Oklahoma',value='ok',),' il'=array(display='Illinois',value='il',),'gu'=array(display='Guam', value='gu',),'nd'=array(display='North Dakota',value='nd',),'va'=array(display='Virginia',value='va',),'ky' =array(display='Kentucky',value='ky',),'ri'=array(display='Rho de Island',value='ri',),'ms'=array(display='Mississippi',value='ms',),' pw'=array(display='Palau',value='pw',),'ga'=array(display='Geo rgia',value='ga',),'fl'=array(display='Florida',value='fl',),); // what you would get from the form or use as a default $value_array = array(al,az); $a = SelectSelect($value_array,$states); sort($a); // let's test it echo formselect name=state multiple; while (list ($key,$row) = each ($a) ) { echo HTML option value=$row[value]
Re: [PHP] The ASP application object in PHP?
On 15 Feb 2002, at 23:12, michael kimsal wrote: Tom Rogers wrote: Hi It uses cookies and only cookies and it seems that sessions are started on every access but can be turned off on individual pages if required. Tom Sorry Tom, but the application object has nothing to do with cookies. It is a 'global' session, for lack of a better term, and doesn't need to concern itself with cookies or other means of identifying specific users, because nothing in the application object is specific to users - it is data specific to the total application itself. Hope that helps. The original guy wrote: to all instances and sessions. It is for example very useful to track different users at the same time, or to send messages from one session to another, or the likes. Well it started from the above where some guy said this magic could track users. I assumed the cookies and if it's tracking users it uses a session id in the url or a cookie, I know of no other way and would really appreciate the education. Tom Rogers wrote: - it is data specific to the total application itself. But how does it carry from one click to the next? Peter http://www.readbrazil.com/ Answering Your Questions About Brazil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] good practice
On 14 Feb 2002, at 11:09, James Taylor wrote: Can someone recommend a better method for doing something like the following? All of my programs are written like this, but it's really poor form considering I'm not predeclaring my variables, etc. Only thing I can really think of is to assign a value in the form a number like 1 or something, then do a if $value == 1 {do something} but that seems kinda hokey. Here's an example of something I'd do: if ($submitdata) { dosomething; exit; } echo form name=\form\ action=\$PHP_SELF?\\n; echo input type=\text\ name=\data\\n; echo input type=\submit\ name=\submitdata\ value=\ Submit \\n; echo /form\n/body\n/html; Yeah, seems hokey doesn't it :) ... I think about the same thing in the code I use with PHP but I think it's the nature of the beast. But a Best Practices sounds like a great idea that has passed me by or I forgot if I've seen it. I've been doing PHP for about a month now and here's how what I'm doing: ?php include_once ( ./CONFIG.inc); // Config file global $Config; $question_search_snippet = $Config[Snippets]-Get(question_search_snippet); $AskUs = $Config[Snippets]-Get(AskUs); $Slow_question_search_snippet = $Config[Snippets]-Get(Slow_question_search_snippet); $body = HTML Data Here /p HTML; $Config[PageBuilder]-Build($PHP_SELF,$body); ? Most pages are either like modules/cgi-script or a just a page like this one. I really hate globals so I cheat and make an array global :). My CONFIG.inc makes connections to all classes , sets paths etc. Here is how I handle my input date (not my confusion with for references): $input = ProcessFormData($GLOBALS); function ProcessFormData($GLOBAL_INPUT) { $FormVariables = array(); $input = $GLOBAL_INPUT[HTTP_GET_VARS] ? $GLOBAL_INPUT[HTTP_GET_VARS] : $GLOBAL_INPUT[HTTP_POST_VARS]; foreach($input as $Key=$Value) { if(is_array($Value)) { foreach($Value as $SubKey=$SubValue) { $FormVariables[$Key.$SubKey] = $SubValue; } }else { $FormVariables[$Key] = $Value; } } # End of foreach($input as $Key=$Value) return $FormVariables; } # End of function DisplayArrayVariables Peter http://www.readbrazil.com/ Answering Your Questions About Brazil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] good practice
On 14 Feb 2002, at 16:26, J Smith wrote: Using global in the global scope (i.e. global $Config;) does nothing. If something is declared in the global scope of a file and then included into another file, it's still global. You don't need to actually say global $whatever unless you're in a function. Thanks. I've been coding and learning, coding and learning. Also, if you're including a file named CONFIG.inc from the same directory as the script itself, please, please tell me you have your web server set up not to serve CONFIG.inc to the outside world. (i.e. you have a .htaccess file or something to send DENY to a request for CONFIG.inc or something.) Otherwise somebody could just grab http://example.com/CONFIG.inc and see it's contents without restriction. Guilty as charged. Not that CONFIG.inc has anything of value in it but nonetheless I've just made it off limits. Peter http://www.readbrazil.com/ Answering Your Questions About Brazil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] good practice
On 14 Feb 2002, at 16:40, Michael Kimsal wrote: On that same topic, *why* do people name files with both .inc and .php? Your .inc file has PHP code in it, right? Why not just call it .php and spare the server reconfiguration. If knowing which files are include files (long time since I've made that distinction!) just prepend them with inc_ or put them all in an includes/ directory. Heck, I've seen inc,cls,html,php3,php4 Whoever started this thread was on the right track. Where are the global coding conventions for PHP? http://www.linuxdoc.org/HOWTO/PHP-HOWTO-12.html http://utvikler.start.no/code/php_coding_standard.html Any othes out there? I know I have my pet peeves about Perl but Perl, as hard as it may seem, appears more rigid than PHP :) Peter http://www.readbrazil.com/ Answering Your Questions About Brazil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] why AddType not working for me as expected?
Hi, Given that it doesn't seem I can use PHP as a wrapper, I tried the following: AddType application/x-httpd-php .htm .html And oddly that did not work (seems to become an unknown type, gives me the option to download). This worked AddType application/x-httpd-php .ghtm .ghtml And of course phtml is set as an option in my httpd.conf file. I want to control just one directory. I'm sure this is not a PHP question as much an Apache question. Anyone have some clues? Thanks Peter --- Reality is that which, when you stop believing in it, doesn't go away. -- Philip K. Dick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Work in New York
On 12 Feb 2002, at 13:30, George PHP wrote: So you want to say that PHP is going nowhere in the States? Maybe we should be doing ASP! You should probably be doing Java, but oh well. Java on M$ with Oracle. I've been hitting the job boards and those are the jobs that are jumping out. If you do PHP you should also be doing Photoshop and Dreamweaver and all sorts of other generally incompatible things :( I just moved to NYC from Germany and I'm looking for job here. Where would be a good place to look? George, Get a list of all the consulting/temp offices in NYC. Put your resume, sign up, etc. with all of them. http://www.panix.com/~grvsmth/redguide/tips/register.html That redguide seemed like a real good idea but it doesn't look like it has kept up but the above article is good. I don't live in NYC but I just did a quick search and found this: http://manhattan.about.com/cs/employment/ Don't sit at home and work the internet (do that at night perhaps). You really have to make contact with people and build up those networking skills. I've been looking for a job for about 4 months now but I've only been using the web. I get a little work from the local RHIC office. My skills are Perl/PHP (and only with a month of PHP but I scored higher on that test than Perl which I've been using for 7 years:) ... Demand is in Java. And of course demand is in that which doesn't exist and so be prepared to bullshit. Were I you I'd take just about any job that is related just to get out and make contacts. Only reason I'm not doing this yet is because I'm working on ... gosh ... on creating a website that will make me money :):) ... I think I've got a good idea and if I make 1/3 of my previous incomes then I'd be happy as I could work from anywhere (like where costs are 1/5 of where I'm living now). I have found no luck at online freelance programming even though I did manage to pull in over US$500 a month doing this in my free time a few years ago. Now ... nothing. Incredible. Hit the pavement. See if there is some local PHP group (like a Perl mongers group) or a linux users group if you're into that. Talk to people. Peter --- Reality is that which, when you stop believing in it, doesn't go away. -- Philip K. Dick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] can I sandwich html docs with PHP
Hi, With mod_perl I can set a handler to handle any documents so it's quite easy to dump a database where each select output is saved to a file. I can have my handler take any file in the output directory and create the html page on the fly (where the contents of the file can be manipulated, used to determine nature of page wrapper, etc.). How can I do this with PHP? I want the urls to be like: http:://www.mydomain.com/page.html http:://www.mydomain.com/page2.html http:://www.mydomain.com/page3.html etc. One motive is to be sure that no search engines are discouraged from indexing my site plus I'm going to create pages and nav snippets with links to all those pages. Peter --- Reality is that which, when you stop believing in it, doesn't go away. -- Philip K. Dick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] can I sandwich html docs with PHP
On 11 Feb 2002, at 19:30, Michael Sims wrote: I'm not sure I really know what you're asking, but if you are asking if you can use PHP code within HTML files (with *.html extensions) then the answer is yes. If you're running Apache, add the following to your httpd.conf: Please disregard if this is not what you were asking... :) No, thanks. It tells me I wasn't clear. Using mod_perl I can write a module for any phase that Apache goes through while handling a request. Based upon any variables I want, I can tell Apache to have my module handle one of those phases. So when you request this url for example: http://www.mydomain.com/joe.html My module can take joe.html and insert it as the body of a template and then return that to your browser or if you request something else like http://www.mydomain.com/image_of_joe.gif then my module just declines to handle that and apache continues through it's phases. Here is an example (bad execution of an example though) http://161.58.230.66/images/ I have the following .htaccess file in that directory: SetHandler perl-script PerlHandler Apache::Schoenster_Gallery PerlSetVar DOCROOT /usr/local/etc/httpd/htdocs/images PerlSetVar URL_PATH /images I can stick this .htaccess file in any directory (only makes sense where I have images) and it uses those 2 variables above to determine where to read for images and where to write the files which produces the frame-set that you see (the module looks in that file for templates to parse so I can have different looks in different places wihout changing the module). I say it's a bad execution because I'm using imagemagick to resize (regardless of original size). If I add new images it will automatically create a thumbnail (which can currently be larger than the original :) of that. I use a db file to cache thumbnails already created but it does check file modification date to see if it should resize the image or not. But what I want to do is to do this with html files where I'll have a few templates (header,footer,navigation,boxes) that will be created on the fly depending upon variables when a client requests an html file and I want to know if I can do this in PHP without rewriting the url (which is not such a bad option perhaps). Peter --- Reality is that which, when you stop believing in it, doesn't go away. -- Philip K. Dick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Phatt MySQL entry
On 10 Feb 2002, at 14:30, Liam MacKenzie wrote: I have a form, with 196 fields that I need entered into a database. But the form and it's contents need to be changed every day, and I That distracts me. Does the form change? I think not. It looks like a data entry form and the only thing that would change would be the DATE. I would think the form remains the same. I did not notice any hidden field to indicate the date though. need to store the old data in an archive so it can be accessed at a later date. Me, in a hurry, I'd just store one more column in your table: DATE. I don't see it. I add that. When they want a previous date they just say select all where date = date they want. That means that after a week, I'm going to have a tonne of data. Umm ... this seems to indicate that maybe the form does change ??? I'm thinking maybe you might have different users. If so I'd add a userid column. Catch is, this form will be used every day for about 3 years. I'm pretty certain MySQL can handle it, but I need to know, what would be the best way to store this data? There might be better ways to store the data but I don't usually think about those things. I'd ask some old fogey who worked in the days of 640K :) ... seriously ... but I think you'll end up going to trouble for no reason. Memory, storage is cheap. A friend was moaning that his app was slow (plain cgi/perl so I suggested mod_perl/fastcgi) and they just threw a hardware upgrade and all was well (but imho should still do mod_perl/fascgi). I've set up a calendar, that will take the user to a different version of the form every day. Accesible here: I don't see the reason for a different version of the form for every day. Isn't the date the only difference? http://www.fernwoodwhc.com/shit/calendar.php And the form I'm talking about is here: http://www.fernwoodwhc.com/tech.php Well about how you would do it. It seems that PHP is in many ways like the old one form, one cgi method of development. Were I you I would not make my connection to the database in that script. I'd do that in only one place. Odd how things tend to evolve and before you know it you have 232 scripts all using username/password/db/host and then you want to change that. I'd look at something like metabase were I you. http://phpclasses.upperdesign.com/browse.html/package/20/ Peter --- Reality is that which, when you stop believing in it, doesn't go away. -- Philip K. Dick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Interest in Project
On 10 Feb 2002, at 17:23, Viper wrote: Hi every one I am going to be working on a site that will contain hopefully a single point where people can get php class files, Sorce code help, and MySQL database help, Plus a kind of comunity for PHP. I know there are other site such as this but I would like to create a 1 place for all type site. It will be done in PHP and use a MySQL backend if any one is interested in getting in on this project please E-mail me at [EMAIL PROTECTED] I think it would be a great project. Well I have no end of such places to find. I'm new to PHP. What interests me much more is how to go about organizing my project. I have such a system using mod_per/Perl. Perl also has Mason/AxKit etc. ... I use my own which revolves around HTML::Template. I was recently told about smarty as a templating system and I'm going to give it a shot. I'm going to recreate my method in PHP which I use in Perl as I just really, really don't like having these php pages with programming in them all over the place. I like things to be consolidated. I would suggest you start a site which is about THE WAYS of DESIGNING solutions with PHP and MySQL (but why, why in the world don't you just do it with PHP/RDBMS). There is more than one way and yet I rarely in fact hardly ever find a site DISCUSSING this. There are a lot of sites that say this is our way but most of them don't even do that .. they just say download XYZ and there is no question or discussion of their way. Now, perhaps I've missed these sites, if so please bombard me with the urls. Othewise, consider a site which does this. I have no end of bookmarks for sites with the tactical questions. Peter -- http://www.coremodules.com/ PETER J. SCHOENSTER (901)-652-2002 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Interest in Project
On 10 Feb 2002, at 21:17, Viper wrote: I may have worded this wrong. The site will focus on PHP and the use of Databases with PHP, (Oracle, Postgres, MySQL, others...). I was typing fast and just threw MySQL out :) I do quite a bit of development in PHP and MySQL so I am most familiar with it. I am also very familiar with Oracle. I have yet to find a PHP help site that focuses on Databases and Code Repositorys Related specificaly to PHP and it's use with them. The main thing I want the site to be is a Community where people can come to get help and read articles about the Use Of PHP in the real world. That sound more interesting? :) Yes and No :) If you search say google for php/oracle/mysql/rdbms you'll have no end of sites to visit. Everywhere I go I see small snippets of how to do this or that. I'm thinking more on along these lines: Smart Architectures in PHP Tim Perdue http://www.phpbuilder.com/columns/tim20001010.php3 although I think a site could go beyond that and just be smart architectures and then show/discuss etc. in Perl/PHP ... But heck, I think there is always room for more good sites. If you did more databases then it might be interesting to show the differences between them. Mysql is evolving fast and it's been the one I used most but I've also used postgresq and oracle. I've not used triggers or stored procedures AT ALL but I'm familiar with them and as a data model grows in complexity it really seems easier to me to use such tools rather than doing all the work in my programming language. I don't see this stuff discussed much. I'd like to see these kinds of things. How you do X in Oracle but is done like Y in MySQL, etc. I'm a little scared of your reference to code repositories. I like CPAN for Perl and I guess Pear for PHP but I haven't gotten into it much as I'm still learning PHP. imho the OO approach with classes as black boxes is much better than the scripting nature of Perl/PHP. code repositories bring to mind cut and paste and I try and avoid that at all costs. Just my thoughts. I'd certainly like to know when your site goes live. I'm too busy to help with anything myself. Unemployed and spending all my time trying to find work :) except I can't break my email habits :) Peter --- Reality is that which, when you stop believing in it, doesn't go away. -- Philip K. Dick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why does heredoc fail in this instance?
Hi If I use $snippet = ; and escape the quotes in the block then it works. But if I use it as is below, it fails with no useful error message. Why? Thanks, Peter function GetAddCommentSnippet($args) { $topic_id = $args[id]; $return_page = $args[return_page]; $snippet = EOS form action=$this-this_cgi method=post brYour First Name: input type=text name=FirstName value= brYour Last Name: input type=text name=LastName value= brYour Email Address: input type=text name=EmailAddress value= brYour Comments: br textarea cols=40 rows=4 name=Comments/textarea br input type=submit value=submit now input type=hidden name=action value=AddComment input type=hidden name=response_to_id value=$topic_id input type=hidden name=r value=$return_page /form EOS; return $snippet; } // END GetAddCommentSnippet --- Reality is that which, when you stop believing in it, doesn't go away. -- Philip K. Dick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and XML
Hi, I'd appreciate any pointers you recommend to good sources of information on how to use PHP and XML. Thanks, Peter --- Reality is that which, when you stop believing in it, doesn't go away. -- Philip K. Dick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] improve turning urls into links routine
Hi, I did a quick search for something like this below but did not find it. Would you please criticize it. Thanks. function MakeUrls($data) { $words = explode( , $data); $new_data = ; while (list ($key,$row) = each ($words) ) { if (preg_match (/^http:\/\//, $row)) { // should just be the url here $new_data .= a href=\$row\$row/a ; continue; } if (preg_match (/http/, $row)) { // catch on the line break which I did not explode on $row = preg_replace (/(http[^\s]+)/,a href=\\\1\\\1/a, $row); } $new_data .= $row ; } return $new_data; } # End Get Peter --- Reality is that which, when you stop believing in it, doesn't go away. -- Philip K. Dick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] what's equivalent of DBI quote
Hi, Seems mysql_escape_string will just escape, seems like addslashes and quotemeta. quote in DBI will escape and quote if passed value is not an integer (don't know about float). Peter --- Reality is that which, when you stop believing in it, doesn't go away. -- Philip K. Dick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP to another language
On 20 Jan 2002, at 20:15, Andrew V. Romero wrote: I was wondering if there are any tools to convert PHP to another scripting language? scripting langauge? I designed this 2000 script and then learned that our information systems people would feel a lot more comfortable using a language that they are already familier with. I originally designed Have they looked at what your wrote? Have they given PHP ANY thought and a little attention to PHP?? I've been a Perl programmer for the last 6 years. Just about a month ago someone asked me to do something for him in PHP. I gave it a shot. A couple of weeks after I took a test at a consulting company and I scored higher on PHP than Perl :( But beyond the above, I would never use Perl for cgi. I still prefer mod_perl for large applications but I'd certainly argue to use PHP for anything involving a few screen shots. If your technical people are worth anything they ought to look at PHP. Even though I did not program in PHP for those 6 years I did encourage a talented html guy to learn PHP and he did a site for us using PHP (he and the designer worked on it without my intervention). I guess because he never knew about cgi programming in Perl he did not argue for all of us to do more in PHP. BTW, if anyone has used the Perl HTML::Template module and knows a PHP templating module that is as good or better, please let me know. I might have missed it but I shudder at most of the PHP template systems I see in comparison. Thanks, Peter --- Reality is that which, when you stop believing in it, doesn't go away. -- Philip K. Dick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] anyone with a usenet editor
Hi, I'm building a database of usenet postings for soc.culture.brazil. This was easy enough (with exception of handling mime in the postings); I'm just dumping the body of the message into the database. I plan to allow a person to select a thread, perhaps a user or whatever and then get all relevant/selected posts and enter them into a textarea box for insertion into another table which I'm thinking to organize by question/answer. I imagine the heavy use of a frames and javascript to make this as easy to use as possible. I'm wondering if anyone who reads the above might say hey .. this sounds like ... You can see my beginning of this here: http://www.readbrazil.com/ Thanks, Peter --- Reality is that which, when you stop believing in it, doesn't go away. -- Philip K. Dick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Newbie database question
On 13 Jan 2002, at 12:51, Dean Ouellette wrote: I am entering info from form into database, is there a way to check say firstname, lastname and address to see if it is a duplicate to what is already in database and if it is then just enter any new information they may enter and not create a new entry If using mysql you can use REPLACE rather than insert (if you also pass a unique key/value with your statement). Of course you have some means of identifying a record. Perhaps it is a combo of firstname, lastname and address but that's not very good. I recall having this situation appear for me in the past ... I think it may be an error in design when one cannot be sure if it's an INSERT for a new record or an UPDATE to an existing record. Perhaps you could dissuage me otherwise with your example. Peter --- Reality is that which, when you stop believing in it, doesn't go away. -- Philip K. Dick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Invalid Email Characters
On 13 Jan 2002, at 21:43, DL Neil wrote: Alexis, Could anybody confirm exactly which characters, if any, are NOT valid in an email address. =such rules of the Internet are laid out in documents called RFCs (initially they are Requests for Comment but once adopted become ...) You are looking for RFC822 (although there are others pertinent to email). Try http://www.freesoft.org/CIE/RFC/822/ =unfortunately beware, the 'rules' are honored as much in the breach as the observance...! You might want to look at the regular expression constructed by Jeffrey Friedl as described here: http://builder.cnet.com/webbuilding/pages/Programming/Scripter/05 2098/ss01.html Approaches range from simple to complex. On the high end, Jeffrey Friedl, in his book Mastering Regular Expressions (1997, O'Reilly Associates), presents an 11-page explanation of his 4,724-byte email-validation script. But in the interest of sanity, this regular expression will suffice for most situations And the rest of that page seems like a good, practical intro to validation. afaik, this is the book for regexes: Mastering Regular Expressions Powerful Techniques for Perl and Other Tools http://www.oreilly.com/catalog/regex/ I would reckon it and the RFC are the places to go for full understanding of the matter. Peter --- Reality is that which, when you stop believing in it, doesn't go away. -- Philip K. Dick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] counting with dates (help!)
On 7 Feb 2002, at 23:21, Sander Peters wrote: Hello, This is my problem: $today = date(Ymd, mktime(0,0,0, date(m),date(d),date(Y))); $last_week = date(Ymd, mktime(0,0,0, date(m),date(d)-7,date(Y))); echo ($today - $last_week); The result is a number like 8876 (20020107-20011231 = 8876) But in date thinking it should be 7! How can I let php count in real days/month/years in stead of numbers? Sanders, I've not prorammed PHP much (Perl), but I looked in the docs and could not find anything. I tested your above code and on my FreeBSD box with PHP Version 4.0.6 it returned 7. Peter Good Perl5/mod_perl/Apache/RDBMS/Unix developer seeking work call 901-652-2002 or email [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] 2 images, merge, make one transparent
Hi, I've looked here: http://download.php.net/manual/en/function.imagecolortransparent.p hp I've read this: http://www.wdvl.com/Authoring/Languages/PHP/BeginningPHP4/tra nsparent.html But they lose me when they suddenly jump to PNG. I got their code but it doesn't work for me. I have all the libraries, can do just about any image manipulation but this transparency thing has escaped me. Does anyone have a good tutorial on this that doesn't start with jpeg and images they shouldn't use. Peter --- Reality is that which, when you stop believing in it, doesn't go away. -- Philip K. Dick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How to check if a session exists
On 20 Dec 2001, at 17:34, Alex Shi wrote: If a sesson_id is known, how can check if the session exists? I think this answers the question (function.session-id.html) session_id (PHP 4 = 4.0.0) session_id -- Get and/or set the current session id Description string session_id ([string id]) session_id() returns the session id for the current session. If id is specified, it will replace the current session id. The constant SID can also be used to retrieve the current name and session id as a string suitable for adding to URLs. Peter --- Reality is that which, when you stop believing in it, doesn't go away. -- Philip K. Dick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]