php-general Digest 27 Oct 2006 21:01:23 -0000 Issue 4425 Topics (messages 243734 through 243768):
Re: File extension for PHP's serialization format?
243734 by: Hamish Lawson
243735 by: Stut
243737 by: Alister Bulman
243762 by: Richard Lynch
Re: <OPTION
243736 by: Robert Cummings
243740 by: Jochem Maas
Re: Running a Java Program
243738 by: Roman Neuhauser
243755 by: Richard Lynch
Problem with manual running PHP script
243739 by: Rosen
243741 by: Dotan Cohen
243742 by: Dave Goodchild
243744 by: Dotan Cohen
243745 by: Miles Thompson
243746 by: Jochem Maas
243754 by: Richard Lynch
Re: PHP 5 Hosting
243743 by: Dotan Cohen
243763 by: Richard Lynch
Re: Problem compiling PHP 4.4.2 with mcrypt
243747 by: Myron Turner
Re: session id contains illegal characters
243748 by: Chris Shiflett
243749 by: Patrick Aljord
243750 by: Dave Goodchild
243757 by: Richard Lynch
Re: heredoc usage [WAS: <OPTION]
243751 by: tedd
243752 by: tedd
243766 by: Paul Novitski
http://sourceforge.net/projects/dfo/
243753 by: Gert Cuykens
243760 by: Gert Cuykens
Re: How does the Zend engine behave?
243756 by: Richard Lynch
243761 by: Richard Lynch
Re: natsort()
243758 by: Richard Lynch
243767 by: Sandy
Re: counting records in db
243759 by: Richard Lynch
243764 by: afan.afan.net
Memcached Question
243765 by: Sancar Saran
[funny] The state of Java Development
243768 by: Daevid Vincent
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---Hello Romanthere's no standard filename extension for PHP-serialized data, I'd just use txt or something... .psdf or whatever..ser is used for serialized Java objects and I've found .jser also being used (though less frequently) for that. On the analogy of the latter I'll plump for .pser. Hamish
--- End Message ---
--- Begin Message ---Hamish Lawson wrote:I have a web application (not written in PHP) that can return data in various formats, including JSON and PHP's serialization format. At the moment my URL scheme looks like this:staff/engineering?format=json but I'd like to switch to using a file extension to denote the format: staff/engineering.jsonBut what file extension should I use for PHP's serialization format? Obviously it can't be .php - aside from being inaccurate (it's not PHP code), using this extension would probably trigger the web server into trying to run a (nonexistent) PHP script.Given that file extensions are purely for association purposes and no application I am aware of knows what to do with PHP serialised data, personally I would use .dat. Or, if I wanted it to be more descriptive, something like .phpdata. But to be perfectly frank it doesn't matter.Small suggestion though... rather than falling back to the evils of mod_rewrite, enable multiviews and you can have URLs such as...staff/engineering/data.json Or whatever filename you want. -Stut
--- End Message ---
--- Begin Message ---On 27/10/06, Stut <[EMAIL PROTECTED]> wrote:Hamish Lawson wrote: > I have a web application (not written in PHP) that can return data in > various formats, including JSON and PHP's serialization format. At the > moment my URL scheme looks like this: > staff/engineering?format=json > but I'd like to switch to using a file extension to denote the format: > staff/engineering.json Given that file extensions are purely for association purposes and no application I am aware of knows what to do with PHP serialised data, personally I would use .dat. Or, if I wanted it to be more descriptive, something like .phpdata. But to be perfectly frank it doesn't matter.I know of one website (Livejournal) that has /url.../data/rss or /data/atom etc. /data/php, /data/wddx or /data/json are pretty obvious extensions to that. That said, since all are them are designed for a script to consume, and not a person, I'd call them entirely 'clean' and obvious enough for the task, though ultimately, it's about having a pretty URL, as the program that reads it won't care what the extension is, if any, and people won't be typing it in regularly anyway. Alister
--- End Message ---
--- Begin Message ---.phps is taken for PHP Source, so using it for PHP Serialized would be Bad. Perhaps phpd for PHP Data would suit you. You could make it anything you want, as far as I know. Actually, you could make it be .php and use ForceType in .htaccess to do what you describe, but that's probably not a Good Idea for clarity sake. I take that back -- you wouldn't need the .htaccess and all that, as you are already doing that with the 'staff' file and 'engineering' is just part of your $_SYSTEM['PATH_INFO'] On Thu, October 26, 2006 11:30 am, Hamish Lawson wrote: > I have a web application (not written in PHP) that can return data in > various formats, including JSON and PHP's serialization format. At the > moment my URL scheme looks like this: > > staff/engineering?format=json > > but I'd like to switch to using a file extension to denote the format: > > staff/engineering.json > > But what file extension should I use for PHP's serialization format? > Obviously it can't be .php - aside from being inaccurate (it's not PHP > code), using this extension would probably trigger the web server into > trying to run a (nonexistent) PHP script. > > Thanks, > Hamish Lawson > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---On Thu, 2006-10-26 at 22:44 +0200, Jochem Maas wrote: > Robert Cummings wrote: > > On Thu, 2006-10-26 at 15:31 +0200, Jochem Maas wrote: > >> bunch of space wasters ;-) > >> > >> <?php foreach (range(1, 31) as $d) echo '<option value="',$d,'"',($d = > >> $selDay?' > >> selected="selected"':''),'>',$d,'</option>'; ?> > > > > Specifically: > > > >> range(1, 31) > > > > Memory waster ;) > > any idea as to what the damage is as compared to the classic for loop? Given that a variable probably costs X and that any variable cane be stored as Y in an array, and an array would cost Z where the Z = X * Y _ 1 (Y element + 1 for the array container itself). Then the range format would cost 31 + 1 (the array itself + 31 entries) whereas the for loop would cost 1 + 1 (cost to store i + cost to store endpoint comparison. Thus the damage is about 15*. Given general computer science consideration, this is a constant and thus practically neglible. Cheers Rob (ps. the above may be completely incoherent since I'm completely drunk atm after celebrating two friends birthdays tonight). -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'
--- End Message ---
--- Begin Message ---Robert Cummings wrote: > On Thu, 2006-10-26 at 22:44 +0200, Jochem Maas wrote: >> Robert Cummings wrote: >>> On Thu, 2006-10-26 at 15:31 +0200, Jochem Maas wrote: >>>> bunch of space wasters ;-) >>>> >>>> <?php foreach (range(1, 31) as $d) echo '<option value="',$d,'"',($d = >>>> $selDay?' >>>> selected="selected"':''),'>',$d,'</option>'; ?> >>> Specifically: >>> >>>> range(1, 31) >>> Memory waster ;) >> any idea as to what the damage is as compared to the classic for loop? > > Given that a variable probably costs X and that any variable cane be > stored as Y in an array, and an array would cost Z where the Z = X * Y _ > 1 (Y element + 1 for the array container itself). > > Then the range format would cost 31 + 1 (the array itself + 31 entries) > whereas the for loop would cost 1 + 1 (cost to store i + cost to store > endpoint comparison. Thus the damage is about 15*. Given general > computer science consideration, this is a constant and thus practically > neglible. > > Cheers > Rob (ps. the above may be completely incoherent since I'm completely > drunk atm after celebrating two friends birthdays tonight). not a bad explainantion then ;-) it's only the last bit I didn't quite follow :-)
--- End Message ---
--- Begin Message ---# [EMAIL PROTECTED] / 2006-10-27 06:28:15 +0600: > Ray, > > Nope - I cannot have the program running all the time because the port that > it this program will connect to will be accessed by other programs too. So it > needs to run only when the user is online and logged into the system. > > Any ideas? Give it a port that other services don't listen(2) on. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991
--- End Message ---
--- Begin Message ---On Thu, October 26, 2006 6:48 pm, Prathaban Mookiah wrote: > I have a situation where, when the user logs into the system (Apache > 2/PHP > 5.1/Win XP) the php script should activate a Java program to run in > the > background. This program will keep running in the background while > everytime > the user requests something, the subsequent php scripts communicates > with > this Java program on a preassigned port. (This is for controlling a > robot I > descibed in on of my earlier mails) > > My questions are: > > 1. How do I make the Java program to keep running even after the PHP > script > terminates. In Linux I would have easily done using '&' - how about > windows? > > 2. What is the safest way to do it? You can use PHP to instantiate a Java thingie, but, honestly, if you want real-time interaction with the browser and a robot, I think you probably should just be using Java. >From my (probably WRONG) understanding of the state of the world, Java is the solution that is best-suited to what you want to do. I'm not saying it CAN'T be done with PHP wedged into it somewhere; Just that you're shoe-horning something into a shoe that doesn't fit. Select the correct weapon. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---Hi, I have scheduled php script, which runs with "c:\php\php.exe php test.php", i.e. without browser. I give working dir the directory of the script. When I start it from the browser all is ok. But when I start manualy sctipt with "c:\php\php.exe text.php >ll.txt" the script gives me an error( in ll.txt): "Call to undefined function: ocilogon() in ...." This is function for connect to Oracle database. When I try to connect to MySQL database with the same script ( just for test) , there in no problem. Can someone help me ? Thanks in advance, Rosen
--- End Message ---
--- Begin Message ---On 27/10/06, Rosen <[EMAIL PROTECTED]> wrote:Hi, I have scheduled php script, which runs with "c:\php\php.exe php test.php", i.e. without browser. I give working dir the directory of the script. When I start it from the browser all is ok. But when I start manualy sctipt with "c:\php\php.exe text.php >ll.txt" the script gives me an error( in ll.txt): "Call to undefined function: ocilogon() in ...." This is function for connect to Oracle database. When I try to connect to MySQL database with the same script ( just for test) , there in no problem. Can someone help me ? Thanks in advance, RosenAt the top of your script, are you calling php with the q flag: #!/usr/bin/php -q That's the only way I can get php to run from the command line on linux boxes. Dotan Cohen http://what-is-what.com/what_is/linux.html http://lyricslist.com/lyrics/artist_albums/19/adams_bryan.php
--- End Message ---
--- Begin Message ---No, it's running otherwise he wouldn't even see the function error message. I run php scripts on Fedora all the time - all -q does is suppress HTTP headers. The Oracle extension may not be installed?
--- End Message ---
--- Begin Message ---On 27/10/06, Dave Goodchild <[EMAIL PROTECTED]> wrote:No, it's running otherwise he wouldn't even see the function error message. I run php scripts on Fedora all the time - all -q does is suppress HTTP headers. The Oracle extension may not be installed?It's most likely installed as he doesn't get the error when running the script in a browser. Unless he means that he's running the test script in a browser on another server. Dotan Cohen http://nanir.com http://technology-sleuth.com/question/what_is_hdtv.html
--- End Message ---
--- Begin Message ---At 08:22 AM 10/27/2006, Rosen wrote:Hi, I have scheduled php script, which runs with "c:\php\php.exe php test.php", i.e. without browser. I give working dir the directory of the script. When I start it from the browser all is ok. But when I start manualy sctipt with "c:\php\php.exe text.php >ll.txt" the script gives me an error( in ll.txt): "Call to undefined function: ocilogon() in ...." This is function for connect to Oracle database. When I try to connect to MySQL database with the same script ( just for test) , there in no problem. Can someone help me ? Thanks in advance, RosenRun a phpinfo.php, with one function in it: phpinfo(). Do this from the command line to check that PHP, from the command line, has the module necessary to connect to Oracle. Sounds like it doesn't.I've not worked much with PHP on Windows, so I guess you would make certain you have the .dll for Oracle and enabled it in PHP.The browser and the command line are two completely different environments. Miles -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.408 / Virus Database: 268.13.14/501 - Release Date: 10/26/2006
--- End Message ---
--- Begin Message ---Rosen wrote: > Hi, > I have scheduled php script, which runs with "c:\php\php.exe php test.php", > i.e. without browser. I give working dir the directory of the script. > When I start it from the browser all is ok. > But when I start manualy sctipt with "c:\php\php.exe text.php >ll.txt" the > script gives me an error( in ll.txt): "Call to undefined function: > ocilogon() in ...." > This is function for connect to Oracle database. > When I try to connect to MySQL database with the same script ( just for > test) , there in no problem. > > Can someone help me ? sounds like the CLI is loading a different ini file than the webserver SAPI ... and that the CLI php.ini file does not load the oci extension (where are the ini file for the webserver SAPI does load it). > > Thanks in advance, > Rosen >
--- End Message ---
--- Begin Message ---On Fri, October 27, 2006 6:22 am, Rosen wrote: > I have scheduled php script, which runs with "c:\php\php.exe php > test.php", > i.e. without browser. I give working dir the directory of the script. > When I start it from the browser all is ok. > But when I start manualy sctipt with "c:\php\php.exe text.php >ll.txt" > the > script gives me an error( in ll.txt): "Call to undefined function: > ocilogon() in ...." > This is function for connect to Oracle database. > When I try to connect to MySQL database with the same script ( just > for > test) , there in no problem. > > Can someone help me ? You need to use the -c flag of php.exe to find the same php.ini as the working version. You're not using the same php.ini, or you're using NO php.ini on the one that works. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---On 25/10/06, Ed Lazor <[EMAIL PROTECTED]> wrote:Hi, I wanted to give some feedback on PHP 5 hosting in case it helps someone. I signed up with DreamHost last Thursday. I also signed up with OCS Solutions to compare the two services. I also maintain a server with CalPop. When I signed up with Dreamhost, I discovered that you have to fill out a form and fax it to them, along with a rubbing of your credit card. Personally, I found that part rather annoying. They say it's for added security, but I've never had to do that with any other online transactions that I've done. OCS Solutions had me pay for a year up front, which always makes me nervous when checking out a new provider, but they do offer a money back guarantee. Actually, both providers offered a money back guarantee. DreamHost's is 97 days. That's pretty good.They require that you fax them a rub or your credit card?!? I certainly wouldn't do that!Cost-wise, both companies were fairly inexpensive. I ran a Google search for "DreamHost Coupon" and found a coupon that eliminated a majority of the up front cost. Actually, I was pretty surprised. They give you a free domain registration that includes private whois for free. After the coupon, I paid $9.90 and covered the start-up fee (normally $45), the first month of service, and the domain registration. It feels like I paid for a domain registration and got free hosting for a month.Nice!My account with DreamHost was created on Monday. Technically, it took 5 days to get my account set up. That's the longest set up delay I've ever experienced with any host provider. OCS Solutions called me an hour after signing up and had my account setup shortly thereafter.That's all it should take.I also registered a domain when signing up with OCS Solutions. The whois was wrong. Somehow it ended up showing as registered to one of their employees, but I called and they quickly fixed it. The account was set up under the wrong username, but they fixed that quickly, along with problems with cpanel when it doesn't handle the name change correctly. Mistakes were made, but I was really pleased with how easy it was to get help and I was really happy with how much people obviously cared about helping out. After signing up with DreamHost, the domain that I'd registered with them wasn't working. I was exploring their control panel to figure out the problem when I came upon a DNS management page. The page automatically identified and fixed the problem. That was impressive. Also, I started exploring the DreamHost forums after signing up, something I almost wish I'd done beforehand. I found a lot of posts from very disgruntled customers. It sounds as if they've been running into problems lately on their servers. People complain A LOT about the lack of phone support from DreamHost... you have to submit a trouble ticket for everything. If your account subscription is high enough, they offer a limited number of call backs. The worst part was reading debates between the really happy and the really unhappy DreamHost clients. A lot of the discussions boiled down to verbal attacks between customers. I'm honestly surprised DreamHost didn't intervene. One last thing with OCS, the plan I started on turned out to be insufficient for my needs. I talked with them and they came up with a new plan that does everything I want and just charged me a little more to cover the difference. End result so far... CalPop: I've always had problems with the initial set up of servers at CalPop. Talking with their tech support on the phone is a nightmare; there's something wrong with their phone lines (seems like a really bad voice over IP solution). It usually takes way too many emails to resolve problems. I've also experienced a lot of hardware failures, which makes me wonder about the quality of parts they purchase. Once the server works though, everything seems to settle down until the next problem shows up. DreamHost: Best prices, low service. It seems like DreamHost is run by and tailored toward experienced techies. That's fine, I can work with that. I'm willing to try working with limited phone support. I'm really only concerned with delays I might experience when a problem shows up in something that's mission critical. Beyond that, there are a lot of features available here that aren't elsewhere. I'm getting great value for my money. OCS Solutions: Good prices, but you have to pay up front. Best customer service I've experienced from an ISP so far. I feel a lot more comfortable using them for anything mission critical.Dotan http://what-is-what.com/what_is/java.html http://lyricslist.com/lyrics/artist_albums/345/metallica.php
--- End Message ---
--- Begin Message ---On Fri, October 27, 2006 7:18 am, Dotan Cohen wrote: > On 25/10/06, Ed Lazor <[EMAIL PROTECTED]> wrote: >> When I signed up with Dreamhost, I discovered that you have to fill >> out a form and fax it to them, along with a rubbing of your credit >> card. Personally, I found that part rather annoying. They say it's > They require that you fax them a rub or your credit card?!? I > certainly wouldn't do that! I *think* they do this only when the credit card does not sail through automatically. Like if you give a shipping address different from your home, or your cell-phone instead of home phone, and then the ultra-stringent CC checks they have turned on kick back the transaction as suspect. Or so they explained it to me, when I had the same reaction. At that point, I suspect you'd be faster to start over and be more careful about matching up your CC input with what the bank has "on file" PS A Sharpie does not make a good rubbing tool, no matter how gently you try to press. :-) -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---Found this on Google: http://marc2.theaimsgroup.com/?l=php-install&m=108030891925096&w=2 Then Goto: http://mcrypt.hellug.gr/mcrypt/index.html where it says: The 2.6.x versions of mcrypt do not include Libmcrypt The 2.6.x versions of mcrypt need Libmhash 0.8.15 or newer It has a download facility. Tom Ray [Lists] wrote:I have to get a temporary server in place under a tight time frame and am using a pre-existing server that wasn't configured really for hosting websites. I've upgraded all the services on it like going from Apache 1.3.x to Apache 2.0.59 and PHP from it's old version to 4.4.2 however I need to have mcrypt compiled with PHP and I'm running into a problem.If I compile PHP without mcrypt I can install PHP without issue. However, when I try to compile PHP with --with-mcrypt=/usr/local/mcrypt I get the following error:main/internal_functions.lo -lcrypt -lcrypt -lmcrypt -lltdl -lresolv -lm -ldl -lnsl -lcrypt -lcrypt -o libphp4.la /usr/lib/gcc-lib/i486-suse-linux/3.2/../../../../i486-suse-linux/bin/ld: cannot find -lltdlcollect2: ld returned 1 exit status make: *** [libphp4.la] Error 1Now I went back and compiled without mcrypt and looked for that line and this is what was there:main/internal_functions.lo -lcrypt -lcrypt -lresolv -lm -ldl -lnsl -lcrypt -lcrypt -o libphp4.laI see that along with -lmcrypt not being there neither is -lltdl is there something I'm missing? Do I need to have something else installed on the box? Normally I haven't had this problem with this. But this is an old suse 8.x box that is being used due to time frame issues.Like I said I can compile PHP without mcrypt, but the project requires mcrypt so any help on this would be appreciated.Thanks!-- _____________________ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/
--- End Message ---
--- Begin Message ---Patrick Aljord wrote: > I'm moving my page from php4 to php5 and I get this error: > Warning: Unknown: The session id contains illegal characters, > valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on > line 0 Can you check to see what session identifier the browser is sending when you get this error message? PHP's session identifiers should only contain hexadecimal characters (a subset of alphanumerics). This check was added to protect against people trying to use the session identifier as an attack vector, sending a malicious payload instead of a real session identifier. Hope that helps. Chris -- Chris Shiflett http://shiflett.org/
--- End Message ---
--- Begin Message ---On 10/27/06, Chris Shiflett <[EMAIL PROTECTED]> wrote:Patrick Aljord wrote: > I'm moving my page from php4 to php5 and I get this error: > Warning: Unknown: The session id contains illegal characters, > valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on > line 0 Can you check to see what session identifier the browser is sending when you get this error message?how can I check the session identifier the borwser is sending?
--- End Message ---
--- Begin Message ---Also, why are you assigning the result of session_id() into a variable that is then passed into $_SESSION. Seems overcomplex and redundant - why not just call session_id() when you need it? Just a thought.
--- End Message ---
--- Begin Message ---On Thu, October 26, 2006 6:19 pm, Patrick Aljord wrote: > $_SESSION['user_id']=$user_id; > $_SESSION['user_login']=$user_login; > $_SESSION['user_pass']=$user_pass; > $_SESSION['user_level']=$user_level; > $_SESSION['session_bool']="true"; > $sessionid = session_id(); echo "The sessionid sent to me is: $sessionid<hr />\n"; > $_SESSION['session_id']= $sessionid; > $user_real_id=$_SESSION['user_id']; > $user_real_login=$_SESSION['user_login']; > > $realsessionid = $_SESSION['session_id']; > > any idea what's wrong? Whatever you've been cramming into session_id(), you shouldn't have done that. A username should be ENCOURAGED to have at least one non-alphanumeric character. session_id()s are NOT ALLOWED to have any non-alphanumeric characters. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---At 10:23 AM -0700 10/26/06, Paul Novitski wrote:At 10/26/2006 08:24 AM, tedd wrote:I think a <div> would work just as well -- <span> seems so old-world to me. :-)By default, div is a block element and span is inline, so span seemed like the natural fit for a sentence fragment. I don't think there's anything old-world (!) about spans, Tedd, they're just tags. I use both in my markup with a clear conscience.My bad -- spans just remind me of the old "How do we slip things in" days instead of figuring out a way to work around it. I realize that they are both tags, but as Stut reminded me, one is block and the other is line element.However, if you used preg_match_all, I think you could do away with the spans all together by matching FIRSTNAME to your first name variable. That way your document would simply read:Hello FIRSTNAMEThat's true, and in tighly-defined micro-contexts that might work just fine. For a robust general CMS, though, I want a completely unambiguous demarcation of replacable content. All-caps tags will work in some circumstances but certainly won't in others.If you want "a completely unambiguous demarcation" then use xml with a defined schema. I don't think you can get any more defined than that, right?Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---At 1:09 PM -0400 10/26/06, Robert Cummings wrote:On Thu, 2006-10-26 at 11:24 -0400, tedd wrote:At 1:04 AM -0700 10/26/06, Paul Novitski wrote: >At 10/25/2006 11:24 PM, Robert Cummings wrote: >>I use a tag based template system, there's no PHP in my content so my >>content files for the most part just look like more HTML. > >This is a different topic, but also one close to my heart. Yes, I >too use my own selector-based templating system. It does allow me >to embed PHP variables into the template if I want, but the primary >merge between plain HTML template and MySQL content happens through >CSS-style selectors. I also embed php variables inside css -- it gives it more functionality.I embed them in the CSS template, which is compiled to a CSS stylesheet file and so the variables become static after compilation. This is useful if you're not determining values by any PHP logic, since then your stylesheet can be served up as a static document while retaining the flexibility of using variably defined values to generate the stylesheet. Cheers, Rob.Rob:I think that's the only way it can be done except doing things with Ajax. If so, then styesheets can become "dynamic" -- but when served, they are static.For me, I just provide a header at the beginning of the css file and a .htaccess rule to treat css suffix files as php documents.tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---At 10:23 AM -0700 10/26/06, Paul Novitski wrote:For a robust general CMS, though, I want a completely unambiguous demarcation of replacable content.At 10/27/2006 09:01 AM, tedd wrote:If you want "a completely unambiguous demarcation" then use xml with a defined schema. I don't think you can get any more defined than that, right?Yes, I find XHTML markup sufficiently specific for my CMS. Cheers,Paul
--- End Message ---
--- Begin Message ---I wrote my own phpmyadmin from scratch, so far i got this http://sourceforge.net/projects/dfo/ and i was wondering what i needed to change so other people would like it too ? I only have tested it on firefox so for now IE probably doesnt like dfo at all, sorry i will fix it later for IE 7. And i also forgot to put the start page in the readme http://localhost/db/htm/datagrid.htm :)
--- End Message ---
--- Begin Message ---Ok, What specific documentation do you want i start with ? i was hoping it would just work on every firefox and php 5< mysql 5< server with one small change to the php.ini to disable magic quotes see http://php.net/manual/en/security.magicquotes.disabling.php Using it should be quit simple if not i failt to do so. It should work like point on the field do what you want to do with the field and if you are ready to upload, push on the green V. The only thing that maybe could be a bit strange in the begining is the login. I created a cookie database that remebers all your servers and you need to select on using the select options to go to the databases bij pushing on the V button after you selected your server. Thats it download check the ini and goto startpage http://localhost/db/htm/datagrid.htm On 10/27/06, Leonard Burton <[EMAIL PROTECTED]> wrote:Hi, > I wrote my own phpmyadmin from scratch, so far i got this > http://sourceforge.net/projects/dfo/ and i was wondering what i needed > to change so other people would like it too ? When you get more Documentation I will check it out. Thanks, -- Leonard Burton, N9URK [EMAIL PROTECTED] "The prolonged evacuation would have dramatically affected the survivability of the occupants."
--- End Message ---
--- Begin Message ---On Fri, October 27, 2006 12:11 am, Sean Pringle wrote: >> The Caching systems such as Zend Cache (not the Optimizer), MMCache, >> APC, etc are expressly designed to store the tokenized version of >> the >> PHP script to be executed. >> >> Note that their REAL performance savings is actually in loading from >> the hard drive into RAM, not actually the PHP tokenization. >> >> Skipping a hard drive seek and read is probably at least 95% of the >> savings, even in the longest real-world scripts. > > Interesting. If PHP tokenization is such a small cost, what makes a > special caching system better than the OS for caching files in memory > after the first disk read? Your OS caching system doesn't know the difference between data files that may or may not get re-used, and PHP scripts, like your homepage, that are getting the crap beat out of them when you get slash-dotted. The OS caching can build up a history of oft-used files and if you have, say, a hit-song MP3 that's getting downloaded 1000 X a second, is probably the way to go. But if your goal is to get your codebase into RAM so that it can load up what seems like a random distribution of data, a code cache is the way to go. If you're not sure what the hell you're doing, use both and play with the parameters until it's fast enough, then focus on something else. Disclaimer: I am making this answer up with zero real-world experience, no benchmarks, and little theoretical proof. Test it yourself if you want to be certain. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---On Thu, October 26, 2006 8:28 pm, [EMAIL PROTECTED] wrote: > Richard Lynch wrote: >> On Wed, October 25, 2006 11:58 am, [EMAIL PROTECTED] wrote: >>> Are included files ever unloaded? For instance if I had 3 include >>> files >>> and no loops, once execution had passed from the first include file >>> to >>> the second, the engine might be able to unload the first file. Or >>> at >>> least the code, if not the data. >>> >> >> I doubt that the code is unloaded -- What if you called a function >> from the first file while you were in the second? >> > I agree it's unlikely, but it's feasible if coded is loaded whenever > required. Especially if data and code are separated by the engine, and > that's quite likely because of the garbage collection. It's really not that practical to do that separation and unload code objects, when the user could call any function at any time. Particularly with: http://php.net/eval $function = 'myprint'; function myprint ($foo) { print $foo; } $function('Hello World'); > Thanks - that's really useful - I didn't realise that the bulk of the > saving wasn't in tokenising. It is a very common misconception. I think MOST people actually get this "wrong" on their first encounter of a code cache. >> Yes, without a cache, each HTTP request will load a "different" >> script. >> > Do you know if, when a cache is used, whether requests in the same > thread use the same in-memory object. I.e. Is the script persistent in > the thread? Almost for sure, the in-memory tokenized version is not only shared within a thread, but across all threads. Otherwise, your cache would be loading hundreds of copies of each script for all the Apache children. The dispatcher may "copy" the tokenized script in order to run it with a clean slate, but the "source" it uses is probably shared RAM. At least, so I presume... >>> Fifthly, if a script takes 4MB, given point 4, does the webserver >>> demand >>> 8MB if it is simultaneously servicing 2 requests? >>> >> >> If you have a PHP script that is 4M in length, you've done something >> horribly wrong. :-) >> > Sort of. I'm using Drupal with lots of modules loaded. PHP > memory_limit > is set to 20MB, and at times 20MB is used. I think that works per > request. All the evidence points to that. So 10 concurrent requests, > which is not unrealistic, it could use 400MB + webserver overhead. And > I > still want to combine it with another bit of software that will use 10 > to 15MB per request. It's time to think about memory usage and whether > there are any strategies to disengage memory usage from request rate. Almost for sure, that 20MB is never actually about the Drupal code itself. Loading in and manipulating an IMAGE using GD, or sucking down a monster record-center from a database, or slurping down a bloated web-page for web-scraping and converting that to XML nodes and ... It's not the CODE that is chewing up the bulk of your 20MB. It's the data. I may rant about OOP code-bloat, but I don't think it's THAT bad :-) -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---On Thu, October 26, 2006 4:05 pm, Sandy wrote: > <code> > $d = '/somedir/subdir'; > $od = opendir($d); > if ($od) { > $dl = scandir($d); > natsort($dl); > } > </code> > > The sorted array is available through print_r(). > How can I obtain a natsorted array that can be listed using : > > while ($i <= $array_count){print $dl[$i]} foreach($dl as $i => $file){ echo "$i: $file<br />\n"; } -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---Thanks Dave > foreach($dl as $filename){ > print $filename;
--- End Message ---
--- Begin Message ---Your idea to use 'COUNT(Username)' is just about the ONLY part of that script that you are doing correctly... :-) Start reading here: http://phpsec.org/ And the header("Location: ...") requires a full URL. And you should have better error-checking, probably. [Though maybe you have a custom error handler not apparent] And your DB password should probably be a hash/crypted value. And it looks like maybe you are using register_globals "on" which is bad. Once again, start reading: http://phpsec.org/ On Thu, October 26, 2006 1:16 pm, [EMAIL PROTECTED] wrote: > Would it be ok to use the same code to check if customer is loged in? > > $query = mysql_query(" > SELECT COUNT(Username) as NoOfRecords > FROM customers > WHERE Username = '$Username' AND Password = > '$Password'"); > if (mysql_result($query, 0) == 0) > { > echo 'Please try again'; > } > else > { > header('location: index.php); > exit; > } > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---> Your idea to use 'COUNT(Username)' is just about the ONLY part of that > script that you are doing correctly... > > :-) :D > And the header("Location: ...") requires a full URL. Why? > And you should have better error-checking, probably. > [Though maybe you have a custom error handler not apparent] Right. I skipped that part to not "waste" space in post. $_POST values are checked first and then used. > And your DB password should probably be a hash/crypted value. Correct. I use this, of course. > And it looks like maybe you are using register_globals "on" which is bad. Nope! globals are off. :D > Once again, start reading: > http://phpsec.org/ I'm Shiflett's fan! :) -afan
--- End Message ---
--- Begin Message ---Hi, Recently I discoverd Memcache daemon for sessions, I'm very pleased its performance. I want to use memcache other than $_SESSION For example, I have an array, it has language definitions. Normally on each page load I have to include that file. So I want to put that array into Memcached and access from each different SESSIONID, I believe this will reduce memory usage and gives performance boost. I found (and use) SESSION examples for Memcached usage. Does anyone has any other examples for memcached usage. Regards. Sancar
--- End Message ---
--- Begin Message ---"The state of Java Development"
A friend snapped this picture at the Barnes & Noble in Woodinville, WA...
--- End Message ---
