RE: [PHP] session management
There's a sessions tutorial on phpfreaks.com that outlines the basics of using sessions. I'm not 100% sure what you mean when you say you don't want to do url rewriting. Without either cookies or passing a url param, there is no way to determine if the request comes from someone who has an active session. As for session classes, there are many. Try the usual places... google, sourceforge, freshmeat, phpclasses etc. -Original Message- From: ajay [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 9:56 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] session management hi! well i do have a MySQL database. The scenario is this, i dont want to use cookies or do any URL rewriting. i'm looking for something that mirrors J2EE's Session object that contains information about the user, their security level(user/admin etc) and this information can then be verified before each request. There would ofcourse be an expiry on the object. Is there a prewritten framework/class to handle this? thanks regards -- ajay --- Who Dares Wins - This mail sent through IMP: www-mail.usyd.edu.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Am I missing Something
Greetings all, I am running version 4.3.4 of PHP. Fairly recently. I am trying to call a pretty basic programming tool. Maybe I am just really tired, or something but I am not getting what is going on. Is there something I am missing. I am pulling a SQL call on a date to get the month. I am using Date_format and the %c to get the Month in numeric format. The I plug it into a variable and my intention is to call it as the index of an array. Nothing prints. When I turn on all notices I get a notice that it is an undefined index. What the heck is going on?? Thanks Phillip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session management
Handling Session with PHP 4 http://www.zend.com/zend/tut/session.php (Feb 15, 2000) Session Authentication http://www.zend.com/zend/spotlight/sessionauth7may.php (May 15, 2001) Custom Session Handling http://www.zend.com/zend/spotlight/code-gallery-wade8.php (April 30, 2003) === Maintaining State On The Web - An overview http://www.zend.com/zend/art/maintainingstate.php (November 8, 2001) Beginner's Guide to URL Rewriting http://www.sitepoint.com/article/910 (October 22nd 2002) Forums de WRI - URL Rewriting et .htaccess http://www.webrankinfo.com/forums/forum_12.htm (... in French) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why are my style sheets all listed on one line?
I'm still fairly new to PHP, so there may be a simple fix for my relatively trivial complaint. I'm using an included page as a head section. It works fine, except that when preview a page and view the source, all the style sheets are displayed on one long line, like this: /scriptlink href=../../css/ref.css rel=stylesheet type=text/csslink href=../../css/na/a1.css rel=stylesheet type=text/css /link href=.css rel=stylesheet type=text/css /link href=../../css/nations.css rel=alternate stylesheet type=text/css title=Nations / It looks like they won't scroll across THIS page, so here's a more clear example: stylesheet1stylesheet2stylesheet3stylesheet4 What I want is a normal style sheet display, like this: stylesheet1 stylesheet2 stylesheet3 stylesheet4 Do you know what causes this and if there's a fix? I posted some code from the head section and main page below. Thanks! * * * * * * * * * * HEAD SECTION (included page; ../../includes/ref/head.php) ?php $todayDate = date(m-d-Y); echo 'titleFreedomware gt; ' . $myname . '/title'; echo 'meta name=description content=' . $myname . ' versus Microsoft /'; echo 'meta name=keywords content=' . $myname . ' versus Microsoft /'; echo 'meta name=mssmarttagspreventparsing content=true /'; echo 'meta http-equiv=content-Type content=text/html; charset=iso-8859-1 /'; echo 'meta name=author content=David Blomstrom /'; echo 'script src=' . $periods . 'js/swapclass.js type=text/javascript/script'; echo 'script language=JavaScript src=' . $periods . 'js/sort.js/script'; echo 'script language=JavaScript src=' . $periods . 'js/ss.js/script'; echo 'script language=JavaScript type=text/JavaScript !-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //-- /script'; echo 'link href=' . $periods . 'css/ref.css rel=stylesheet type=text/css'; if($includea1 == TRUE){ echo 'link href=' . $periods . 'css/' . $continentcode . '/a1.css rel=stylesheet type=text/css /'; } echo 'link href=' . $mycss . '.css rel=stylesheet type=text/css /'; echo 'link href=' . $periods . 'css/nations.css rel=alternate stylesheet type=text/css title=Nations /'; echo 'link href=' . $periods . 'css/themes/peace.css rel=alternate stylesheet type=text/css title=Peace /'; echo 'link href=' . $periods . 'css/themes/war.css rel=alternate stylesheet type=text/css title=War /'; echo 'link href=' . $periods . 'css/themes/pat' . $countrycode . '.css rel=alternate stylesheet type=text/css title=Patriotism /'; echo 'link href=' . $periods . 'css/themes/nationalism.css rel=alternate stylesheet type=text/css title=Nationalism /'; echo 'link href=' . $periods . 'css/themes/corporate.css rel=alternate stylesheet type=text/css title=Corporate /'; echo 'link href=' . $periods . 'css/themes/conspiracy.css rel=alternate stylesheet type=text/css title=Conspiracy /'; echo 'link href=' . $periods . 'css/themes/media.css rel=alternate stylesheet type=text/css title=Media /'; echo 'link href=' . $periods . 'css/themes/atlantic.css rel=alternate stylesheet type=text/css title=Atlantic /'; echo 'link href=' . $periods . 'css/themes/indian.css rel=alternate stylesheet type=text/css title=Indian /'; echo 'link rel=SHORTCUT ICON href=../../../../us/aaa/favicon.ico /'; ? * * * * * * * * * * MAIN PAGE !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head ?php $myname = 'Alaska'; $mynickname = 'Land of the Midnight Sun'; $mycode = 'ak'; $mywebring = '/world/na/us/ak/'; $myregion = 'north'; $mycountry = 'United States'; $mycontinent = 'North America'; $countrycode = 'us'; $continentcode = 'na'; $periods = '../../'; $tlperiods = '../'; $includea1 = TRUE; include (../../includes/ref/head.php); ? link rel=stylesheet type=text/css media=screen title=User Defined Style href=?php echo (!$sitestyle)?'aaa':$sitestyle ?.css / script language=JavaScript src=../../../js/ss.js/script link href=../../../xss/nations.css rel=stylesheet type=text/css link href=../../../css/nations.css rel=alternate stylesheet type=text/css title=Nations / /head -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why are my style sheets all listed on one line?
At 03:16 AM 1/30/2004, Freedomware wrote: I'm still fairly new to PHP, so there may be a simple fix for my relatively trivial complaint. I'm using an included page as a head section. It works fine, except that when preview a page and view the source, all the style sheets are displayed on one long line, like this: /scriptlink href=../../css/ref.css rel=stylesheet type=text/csslink href=../../css/na/a1.css rel=stylesheet type=text/css /link href=.css rel=stylesheet type=text/css /link href=../../css/nations.css rel=alternate stylesheet type=text/css title=Nations / It looks like they won't scroll across THIS page, so here's a more clear example: stylesheet1stylesheet2stylesheet3stylesheet4 You need a \n at the end of each line inside the quote like echo stylesheet\n; \n is newline -Dave What I want is a normal style sheet display, like this: stylesheet1 stylesheet2 stylesheet3 stylesheet4 Do you know what causes this and if there's a fix? I posted some code from the head section and main page below. Thanks! * * * * * * * * * * HEAD SECTION (included page; ../../includes/ref/head.php) ?php $todayDate = date(m-d-Y); echo 'titleFreedomware gt; ' . $myname . '/title'; echo 'meta name=description content=' . $myname . ' versus Microsoft /'; echo 'meta name=keywords content=' . $myname . ' versus Microsoft /'; echo 'meta name=mssmarttagspreventparsing content=true /'; echo 'meta http-equiv=content-Type content=text/html; charset=iso-8859-1 /'; echo 'meta name=author content=David Blomstrom /'; echo 'script src=' . $periods . 'js/swapclass.js type=text/javascript/script'; echo 'script language=JavaScript src=' . $periods . 'js/sort.js/script'; echo 'script language=JavaScript src=' . $periods . 'js/ss.js/script'; echo 'script language=JavaScript type=text/JavaScript !-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //-- /script'; echo 'link href=' . $periods . 'css/ref.css rel=stylesheet type=text/css'; if($includea1 == TRUE){ echo 'link href=' . $periods . 'css/' . $continentcode . '/a1.css rel=stylesheet type=text/css /'; } echo 'link href=' . $mycss . '.css rel=stylesheet type=text/css /'; echo 'link href=' . $periods . 'css/nations.css rel=alternate stylesheet type=text/css title=Nations /'; echo 'link href=' . $periods . 'css/themes/peace.css rel=alternate stylesheet type=text/css title=Peace /'; echo 'link href=' . $periods . 'css/themes/war.css rel=alternate stylesheet type=text/css title=War /'; echo 'link href=' . $periods . 'css/themes/pat' . $countrycode . '.css rel=alternate stylesheet type=text/css title=Patriotism /'; echo 'link href=' . $periods . 'css/themes/nationalism.css rel=alternate stylesheet type=text/css title=Nationalism /'; echo 'link href=' . $periods . 'css/themes/corporate.css rel=alternate stylesheet type=text/css title=Corporate /'; echo 'link href=' . $periods . 'css/themes/conspiracy.css rel=alternate stylesheet type=text/css title=Conspiracy /'; echo 'link href=' . $periods . 'css/themes/media.css rel=alternate stylesheet type=text/css title=Media /'; echo 'link href=' . $periods . 'css/themes/atlantic.css rel=alternate stylesheet type=text/css title=Atlantic /'; echo 'link href=' . $periods . 'css/themes/indian.css rel=alternate stylesheet type=text/css title=Indian /'; echo 'link rel=SHORTCUT ICON href=../../../../us/aaa/favicon.ico /'; ? * * * * * * * * * * MAIN PAGE !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; ?php $myname = 'Alaska'; $mynickname = 'Land of the Midnight Sun'; $mycode = 'ak'; $mywebring = '/world/na/us/ak/'; $myregion = 'north'; $mycountry = 'United States'; $mycontinent = 'North America'; $countrycode = 'us'; $continentcode = 'na'; $periods = '../../'; $tlperiods = '../'; $includea1 = TRUE; include (../../includes/ref/head.php); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: locking to domain
Ryan A wrote: Hey all, I have a rather simple need that I am sure a lot of you must have gone through, I need a bit of code so that the script can run only at something.com..I am generating a MD5 license key based on that... Problem that I am having is.. wont I need 2 keys to see if the domain is with a www (eg www.something.com) or is being run without the www (eg: http://something.com) ? I'm pretty sure it can be done with one keybut how? Maybe i've misunderstood the question, but U can check variable $_SERVER['HTTP_HOST'] and make decisions according to it. Hope that helps. :) -- Pavel a.k.a. Papi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why are my style sheets all listed on one line?
David Obrien wrote: You need a \n at the end of each line inside the quote like echo stylesheet\n; \n is newline -Dave Thanks for the tip. However, I must be doing something wrong. \n didn't work, so I searched Google for PHP + new line and found a page that said you have to use \r\n if you're working on a Windows platform. But that doesn't seem to work, either. (If you do use a special new line for a Windows computer, then publish your website to a Linux server, will that cause problems?) Do I need to modify the new line code because my echo statements are enclosed in single quotes (' '), rather than double quotes ( )? I pasted my entire include page code below. Thanks! ?php $todayDate = date(m-d-Y); echo 'titleFreedomware gt; ' . $myname . '/title'; echo 'meta name=description content=' . $myname . ' versus Microsoft /'; echo 'meta name=keywords content=' . $myname . ' versus Microsoft /'; echo 'meta name=mssmarttagspreventparsing content=true /'; echo 'meta http-equiv=content-Type content=text/html; charset=iso-8859-1 /'; echo 'meta name=author content=David Blomstrom /'; echo 'script src=' . $periods . 'js/swapclass.js type=text/javascript/script'; echo 'script language=JavaScript src=' . $periods . 'js/sort.js/script'; echo 'script language=JavaScript src=' . $periods . 'js/ss.js/script'; echo 'script language=JavaScript type=text/JavaScript !-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //-- /script'; echo 'link href=' . $periods . 'css/ref.css rel=stylesheet type=text/css'; if($includea1 == TRUE){ echo 'link href=' . $periods . 'css/' . $continentcode . '/a1.css rel=stylesheet type=text/css /'; } echo 'link href=' . $mycss . '.css rel=stylesheet type=text/css /'; echo 'link href=' . $periods . 'css/nations.css rel=alternate stylesheet type=text/css title=Nations /\r\n'; echo 'link href=' . $periods . 'css/themes/peace.css rel=alternate stylesheet type=text/css title=Peace /\r\n'; echo 'link href=' . $periods . 'css/themes/war.css rel=alternate stylesheet type=text/css title=War /\r\n'; echo 'link href=' . $periods . 'css/themes/pat' . $countrycode . '.css rel=alternate stylesheet type=text/css title=Patriotism /\r\n'; echo 'link href=' . $periods . 'css/themes/nationalism.css rel=alternate stylesheet type=text/css title=Nationalism /\r\n'; echo 'link href=' . $periods . 'css/themes/corporate.css rel=alternate stylesheet type=text/css title=Corporate /\r\n'; echo 'link href=' . $periods . 'css/themes/conspiracy.css rel=alternate stylesheet type=text/css title=Conspiracy /\r\n'; echo 'link href=' . $periods . 'css/themes/media.css rel=alternate stylesheet type=text/css title=Media /\r\n'; echo 'link href=' . $periods . 'css/themes/education.css rel=alternate stylesheet type=text/css title=Education /\r\n'; echo 'link href=' . $periods . 'css/themes/911.css rel=alternate stylesheet type=text/css title=911 /\r\n'; echo 'link href=' . $periods . 'css/themes/bush.css rel=alternate stylesheet type=text/css title=Bush /'; echo 'link href=' . $periods . 'css/themes/campaign.css rel=alternate stylesheet type=text/css title=Campaign /\r\n'; echo 'link href=' . $periods . 'css/themes/na.css rel=alternate stylesheet type=text/css title=NA /\r\n'; echo 'link href=' . $periods . 'css/themes/sa.css rel=alternate stylesheet type=text/css title=SA /\r\n'; echo 'link href=' . $periods . 'css/themes/europe.css rel=alternate stylesheet type=text/css title=Europe /\r\n'; echo 'link href=' . $periods . 'css/themes/asia.css rel=alternate stylesheet type=text/css title=Asia /\r\n'; echo 'link href=' . $periods . 'css/themes/mideast.css rel=alternate stylesheet type=text/css title=Mideast /\r\n'; echo 'link href=' . $periods . 'css/themes/africa.css rel=alternate stylesheet type=text/css title=Africa /\r\n'; echo 'link href=' . $periods . 'css/themes/aus.css rel=alternate stylesheet type=text/css title=Australia /\r\n'; echo 'link href=' . $periods . 'css/themes/pacific.css rel=alternate stylesheet type=text/css title=Pacific /\r\n'; echo 'link href=' . $periods . 'css/themes/atlantic.css rel=alternate stylesheet type=text/css title=Atlantic /\r\n'; echo 'link href=' . $periods . 'css/themes/indian.css rel=alternate stylesheet type=text/css title=Indian /\r\n'; echo 'link rel=SHORTCUT ICON href=../../../../us/aaa/favicon.ico /'; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why are my style sheets all listed on one line?
Freedomware wrote: David Obrien wrote: You need a \n at the end of each line inside the quote like echo stylesheet\n; \n is newline -Dave ... Do I need to modify the new line code because my echo statements are enclosed in single quotes (' '), rather than double quotes ( )? newline-character should be inside double quotes (\n). For example: instead of: echo 'link href=' . $periods . 'css/nations.css rel=alternate stylesheet type=text/css title=Nations /\r\n'; use: echo 'link href=' . $periods . 'css/nations.css rel=alternate stylesheet type=text/css title=Nations /'.\n; Hope that helps. :) -- Pavel a.k.a. Papi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP timeout
Hi all I have a winXP machine on a network running IIS (PHP and MySQL is installed) I have recently moved from one machine to another and after setting up IIS and the rest and try to run few PHP scripts they just run forever or timeout. I believe the problem is with the security permission on ... somewhere, since I've been doing the same setup in several machines and it works fine (not in this network). Now, the funny thing is that most simple php script run fast after playing with the permissions but more complicating scripts or the phpMyAdmin just timesout. Does anyone know what the hell is going on? Mario -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Social Software
Anybody know of any PHP based Social Software projects? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why are my style sheets all listed on one line?
Got it. It took me a while to home in on the period. Thanks for the tips! Pavel Jartsev wrote: newline-character should be inside double quotes (\n). For example: instead of: echo 'link href=' . $periods . 'css/nations.css rel=alternate stylesheet type=text/css title=Nations /\r\n'; use: echo 'link href=' . $periods . 'css/nations.css rel=alternate stylesheet type=text/css title=Nations /'.\n; Hope that helps. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OOP methodology
This is a long one - I'm trying to get to grips with my understanding of OOP. I'm not sure that I understand object oriented programming as well as I could to benefit from using it in PHP. Although I've used it to produce working applications, of the few objects I've produced nearly all have carried too much weight and functionality (one object for both HTML generation and DB interaction etc) and several have been extensions of the others. I was hoping someone might be able to check my logic. One of the main functions of the application I'm working on at the moment, my first use of OOP in PHP, is to iterate through a hierarchy of retail outlets and extract information from a database based on each location in the hierarchy. A template SQL statement is parsed and parts are replaced with information from the hierarchy. This query is then executed, and the results are placed in a table within a static HTML file stored in a directory structure which mirrors the structure of the retail outlet hierarchy. I've done it this way because the traffic to the site is expected to be high and the information changes infrequently, so static pages will ensure good performance. The way I've written the application isn't up to much IMO, using objects in a primitive way akin to a PC newbie using the CD ROM drive as a coffee cup holder - ie. does the job but it's not quite how it was intended to be used. I've got one big object (treeMapper) that does everything, which includes (over and above the database functions, file input and output, HTML generation and string formatting). It has two main methods. Process() and taskMaster(). The first method iterates one unit through the hierarchy and then calls taskMaster() which takes values Process() has changed in the object and uses them to query the database and to format the results into an HTML table and output to a file (as described above). In the code for the class, taskmaster() is empty. When I want to use the class, I create a new class which extends treeMapper and then overrides the taskMaster function. In this way I get an object which I can reuse for any report which needs to be made for every store. It works and it's fast, but this method seems really WRONG! I started developing this six months ago as a first project in OOP in PHP, and am starting to see it's limitations - for instance, I need to use the DB functions for other small tasks on the site, which involves instantiating a new treeMapper (which is highly inefficient as I won't need the other 20 methods.). I've also got some handy string manipulation routines which can't be used without instantiating a treeMapper. So I want to break it up into smaller chunks, smaller objects which can talk to each other. From what I've read, I think I should be using an iterator pattern to design an object which JUST does the iteration, a database object which JUST does queries from the database, another iterator object which JUST does iteration through database results and another object which draws graphs based on results from the database. My question is (I know you've been waiting) how best to connect up these objects, as I only really need one instance of each object for my application. PHP 5 objects seem easier to deal with (none of this incomprehensible notation) and I want to know whether the following is a good way of doing it and how other people might go about this. class dbObj { var $results; function dbObj() {//set up DB con} function execQuery() {//ODBC query exec - results put in $this-results} } class iterator { var $currentPos function iterator() {//loads data into iterator} function reset() {//Resets pointer} function next() {//steps forward one item, changes $this-currentPos to whatever.} } class HTMLGenerator { function HTMLGenerator($dbObj, $iterator) { $this-dbObj = $dbObj; $this-iterator = $iterator; } function MakeHTML() {// as you'd expect. // refers to $dbObj and $iterator (objects passed by reference in // PHP 5) // $iterator-currentPos used to parse SQL query // eg. $dbObj-execQuery(select...); // eg. $dbObj-results used to make HTML; // } function outputToFile() {//Saves to File} } The main application would then do this: $q = new dbObj; $x = new iterator; $y = new HTMLGenerator($q, $x) while ($x-next()) { $y-MakeHTML(); $y-outputToFile(); } Anyone got any thoughts about whether this is a good way to do it? I was wondering whether instantiating objects should be done within other objects that need them - if this can be done - but I would only do that in cases where (for instance) an HTMLGenerator object is instantiated without any parameters, in which case some logic could be added to do this. Thanks! Chris -- PHP General Mailing List (http://www.php.net/)
Re: [PHP] Am I missing Something
Phillip S. Baker wrote: I am running version 4.3.4 of PHP. Fairly recently. I am trying to call a pretty basic programming tool. Maybe I am just really tired, or something but I am not getting what is going on. Is there something I am missing. I am pulling a SQL call on a date to get the month. I am using Date_format and the %c to get the Month in numeric format. The I plug it into a variable and my intention is to call it as the index of an array. Nothing prints. When I turn on all notices I get a notice that it is an undefined index. What the heck is going on?? Sorry, left my mind reading helmet at home today. How about sharing some code. -- Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP timeout
Mario, Please don't reply to a message when you want to ask a question compose a new thread instead. Anyway from what you have described it sounds like you have a firewall that's blocking the mysql port. Somefirewalls just drop the packets instead of denying the connection. That way the script just hangs an eternit waiting for a packet that never arrives. Try stopping your firewall completely . Mario wrote: Hi all I have a winXP machine on a network running IIS (PHP and MySQL is installed) I have recently moved from one machine to another and after setting up IIS and the rest and try to run few PHP scripts they just run forever or timeout. I believe the problem is with the security permission on ... somewhere, since I've been doing the same setup in several machines and it works fine (not in this network). Now, the funny thing is that most simple php script run fast after playing with the permissions but more complicating scripts or the phpMyAdmin just timesout. Does anyone know what the hell is going on? Mario -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Why are my style sheets all listed on one line?
On 30 January 2004 08:55, Freedomware wrote: David Obrien wrote: You need a \n at the end of each line inside the quote like echo stylesheet\n; \n is newline -Dave Another way you could go, as this is mostly HTML with some PHP values thrown in, is to write it as such -- then all your newlines are present exactly as they appear. This would look something like: ?php $todayDate = date(m-d-Y); ? titleFreedomware gt; ?php echo $myname ?/title meta name=description content=?php echo $myname ? versus Microsoft / meta name=keywords content=?php echo $myname ? versus Microsoft / meta name=mssmarttagspreventparsing content=true / meta http-equiv=content-Type content=text/html; charset=iso-8859-1 / meta name=author content=David Blomstrom / script src=?php echo $periods ?js/swapclass.js type=text/javascript/script script language=JavaScript src=?php echo $periods ?js/sort.js/script' script language=JavaScript src=?php echo $periods ?js/ss.js/script script language=JavaScript type=text/JavaScript !-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //-- /script link href=?php echo $periods ?css/ref.css rel=stylesheet type=text/css ?php if($includea1){ ? link href=?php echo $periods ?css/?php echo $continentcode ?/a1.css rel=stylesheet type=text/css / ?php } ? link href=?php echo $mycss ?.css rel=stylesheet type=text/css / echo 'link href=' . $periods . etc. etc. By the way, the test if($includea1 == TRUE) should be written as just if($includea1) It has exactly the same outcome, but is both more readable (if you've named your variables suitably) and more efficient (since you've saved the redundant comparison operation). Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP methodology
Hi Chris, Sounds to me like you are pretty much on the right track bearing in mind that PHP is not the bes language to learn OOP. Even your taskmanager sounds good, i wouldn't bother with reading up on design patterns just yet. They are indeed very important and you should definitely study them, however having spent an year or more doing OOP helps you understand them better. (others will disagree). Don't worry about classes become too big either if all the code belongs in one class it can't be helped. If you look at a fairly large java program you will find classes that range from 20-30 lines to 2000+ lines. Chris Neale wrote: This is a long one - I'm trying to get to grips with my understanding of OOP. I'm not sure that I understand object oriented programming as well as I could to benefit from using it in PHP. Although I've used it to produce working applications, of the few objects I've produced nearly all have carried too much weight and functionality (one object for both HTML generation and DB interaction etc) and several have been extensions of the others. I was hoping someone might be able to check my logic. One of the main functions of the application I'm working on at the moment, my first use of OOP in PHP, is to iterate through a hierarchy of retail outlets and extract information from a database based on each location in the hierarchy. A template SQL statement is parsed and parts are replaced with information from the hierarchy. This query is then executed, and the results are placed in a table within a static HTML file stored in a directory structure which mirrors the structure of the retail outlet hierarchy. I've done it this way because the traffic to the site is expected to be high and the information changes infrequently, so static pages will ensure good performance. The way I've written the application isn't up to much IMO, using objects in a primitive way akin to a PC newbie using the CD ROM drive as a coffee cup holder - ie. does the job but it's not quite how it was intended to be used. I've got one big object (treeMapper) that does everything, which includes (over and above the database functions, file input and output, HTML generation and string formatting). It has two main methods. Process() and taskMaster(). The first method iterates one unit through the hierarchy and then calls taskMaster() which takes values Process() has changed in the object and uses them to query the database and to format the results into an HTML table and output to a file (as described above). -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Style Switchers - Recommendations?
I've been using JavaScript style switchers combined with alternate style sheets, allowing users to control the appearance of my web pages. However, I recently read that you can make style switchers with PHP - which are allegedly superior to JavaScript style sheets. Then I found a PHP style switcher at http://www.contrastsweb.com/switcher/v2/example.php that has an added advantage; you can apparently choose several style sheets independently of one another. For example, you can change the background color, then change the font. I'm working on some complex tables that I'd like to control with such a multi-style switcher. Suppose I have five style sheets, named One, Two, Thtee, Four and Five. I'd like to set it up so that a visitor can view the page with any one of these style sheets, or with a combination thereof, such as One, Three and Four or Four and Five. At any rate, I couldn't get the PHP style switcher above to work. (See, also, http://www.contrastsweb.com/switcher/v2/) I just wondered if anyone on this list has worked with PHP style switchers and can recommend other tutorials or different strategies. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] OOP methodology
Here is my advice, check out the pear code, it will help you dearly get the grips of how to setup classes. IMHO i feel pear is a standard, i use most of the standard but i dont particularly write classes for pear but structure it similar, but am thinking of porting my error code around pear. Classes are purely packages which are reusable within projects, try not to get simple functions with complete classes mixed up, it may not be needed to make a class at all. Hope this helps. -Original Message- From: Chris Neale [mailto:[EMAIL PROTECTED] Sent: Friday, January 30, 2004 8:42 PM To: [EMAIL PROTECTED] Subject: [PHP] OOP methodology This is a long one - I'm trying to get to grips with my understanding of OOP. I'm not sure that I understand object oriented programming as well as I could to benefit from using it in PHP. Although I've used it to produce working applications, of the few objects I've produced nearly all have carried too much weight and functionality (one object for both HTML generation and DB interaction etc) and several have been extensions of the others. I was hoping someone might be able to check my logic. One of the main functions of the application I'm working on at the moment, my first use of OOP in PHP, is to iterate through a hierarchy of retail outlets and extract information from a database based on each location in the hierarchy. A template SQL statement is parsed and parts are replaced with information from the hierarchy. This query is then executed, and the results are placed in a table within a static HTML file stored in a directory structure which mirrors the structure of the retail outlet hierarchy. I've done it this way because the traffic to the site is expected to be high and the information changes infrequently, so static pages will ensure good performance. The way I've written the application isn't up to much IMO, using objects in a primitive way akin to a PC newbie using the CD ROM drive as a coffee cup holder - ie. does the job but it's not quite how it was intended to be used. I've got one big object (treeMapper) that does everything, which includes (over and above the database functions, file input and output, HTML generation and string formatting). It has two main methods. Process() and taskMaster(). The first method iterates one unit through the hierarchy and then calls taskMaster() which takes values Process() has changed in the object and uses them to query the database and to format the results into an HTML table and output to a file (as described above). In the code for the class, taskmaster() is empty. When I want to use the class, I create a new class which extends treeMapper and then overrides the taskMaster function. In this way I get an object which I can reuse for any report which needs to be made for every store. It works and it's fast, but this method seems really WRONG! I started developing this six months ago as a first project in OOP in PHP, and am starting to see it's limitations - for instance, I need to use the DB functions for other small tasks on the site, which involves instantiating a new treeMapper (which is highly inefficient as I won't need the other 20 methods.). I've also got some handy string manipulation routines which can't be used without instantiating a treeMapper. So I want to break it up into smaller chunks, smaller objects which can talk to each other. From what I've read, I think I should be using an iterator pattern to design an object which JUST does the iteration, a database object which JUST does queries from the database, another iterator object which JUST does iteration through database results and another object which draws graphs based on results from the database. My question is (I know you've been waiting) how best to connect up these objects, as I only really need one instance of each object for my application. PHP 5 objects seem easier to deal with (none of this incomprehensible notation) and I want to know whether the following is a good way of doing it and how other people might go about this. class dbObj { var $results; function dbObj() {//set up DB con} function execQuery() {//ODBC query exec - results put in $this-results} } class iterator { var $currentPos function iterator() {//loads data into iterator} function reset() {//Resets pointer} function next() {//steps forward one item, changes $this-currentPos to whatever.} } class HTMLGenerator { function HTMLGenerator($dbObj, $iterator) { $this-dbObj = $dbObj; $this-iterator = $iterator; } function MakeHTML() {// as you'd expect. // refers to $dbObj and $iterator (objects passed by reference in // PHP 5) // $iterator-currentPos used to parse SQL query // eg. $dbObj-execQuery(select...); // eg. $dbObj-results used to make HTML; // } function outputToFile() {//Saves to File} } The main
RE: [PHP] parsing variables inside a variable?
On 29 January 2004 14:56, jimbo wrote: Hi, I have a query regarding variable parsing. I have some text in a MySQL database in which I have included some variable names. Eg (but w/o quotes): thankyou $name for registering on our web site. I query and use mysql_fetch_array to get the data into an associative array. I then build a string and output it like this: echo blah blah .$row[thecolumn]. blah blah; However, the output is simply: blah blah thankyou $name for registering on our web site blah blah - i.e. $name does not get parsed. I have tried wrapping $name with curly brackets in the database but that doesn't help and I have also tried using both addslashes and removeslashes on $row[thecolumn] and I have also tried this: echo blah blah $row['thecolumn'] blah blah - again both with and without curly brackets. Nothing seems to work. Is what I am trying to do possible? Yes, but you need to force PHP to re-evaluate the string you retrieve from the database -- normally, PHP just uses values retrieved at runtime as-is and doesn't do any special interpretation on them. The function you need to do this is eval() (http://www.php.net/eval), and one possible way of using it to achieve your desired result is (off the top of my head, untested): eval('echo blah {$row[\'thecolumn\']} blah;'); Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] OOP methodology
Yes i think java would be the best to learn proper OO, i've nevr done it, but coming the other way knowing php OO, java became more familiar to me, i'm gonna do it this year. With PHP5 coming out that all may change slightly. May i ask though, what is the point of a destructor and is it really good to add it in, does it work in php4 ? -Original Message- From: Raditha Dissanayake [mailto:[EMAIL PROTECTED] Sent: Friday, January 30, 2004 9:19 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] OOP methodology Hi Chris, Sounds to me like you are pretty much on the right track bearing in mind that PHP is not the bes language to learn OOP. Even your taskmanager sounds good, i wouldn't bother with reading up on design patterns just yet. They are indeed very important and you should definitely study them, however having spent an year or more doing OOP helps you understand them better. (others will disagree). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP timeout
thanks for the reply Raditha. I don't have a firewall setup on this PC Is there a chance it's a permissions problem? And why do few simple scripts run fine though? Thanks Mario - Original Message - From: Raditha Dissanayake [EMAIL PROTECTED] To: Mario [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, January 30, 2004 12:14 PM Subject: Re: [PHP] PHP timeout Mario, Please don't reply to a message when you want to ask a question compose a new thread instead. Anyway from what you have described it sounds like you have a firewall that's blocking the mysql port. Somefirewalls just drop the packets instead of denying the connection. That way the script just hangs an eternit waiting for a packet that never arrives. Try stopping your firewall completely . Mario wrote: Hi all I have a winXP machine on a network running IIS (PHP and MySQL is installed) I have recently moved from one machine to another and after setting up IIS and the rest and try to run few PHP scripts they just run forever or timeout. I believe the problem is with the security permission on ... somewhere, since I've been doing the same setup in several machines and it works fine (not in this network). Now, the funny thing is that most simple php script run fast after playing with the permissions but more complicating scripts or the phpMyAdmin just timesout. Does anyone know what the hell is going on? Mario -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP timeout
Well the situation you have described are the typical symptoms of a firewall eating up packets. (Simple scripts running fine and those that connect to networking timing out) How about installing both the php engine and mysql on the same machine for testing? Mario wrote: thanks for the reply Raditha. I don't have a firewall setup on this PC Is there a chance it's a permissions problem? And why do few simple scripts run fine though? Thanks Mario - Original Message - From: Raditha Dissanayake [EMAIL PROTECTED] To: Mario [EMAIL PROTECTED] -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why are my style sheets all listed on one line?
Wow, thanks for the tips. That makes life a lot simpler! Mike Ford wrote: Another way you could go, as this is mostly HTML with some PHP values thrown in, is to write it as such -- then all your newlines are present exactly as they appear. This would look something like: By the way, the test if($includea1 == TRUE) should be written as just if($includea1) It has exactly the same outcome, but is both more readable (if you've named your variables suitably) and more efficient (since you've saved the redundant comparison operation). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP timeout
both php and mysql is on the same machine. even running the following timesout: ?php if (!($mylink = @mysql_pconnect(localhost,*,**))) print h3Problem connecting to the database server/h3\n; exit(); } mysql_select_db(xxx) or die (h3Problem connecting to the database/h3brDescription: . mysql_error()); ? - Original Message - From: Raditha Dissanayake [EMAIL PROTECTED] To: Mario [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, January 30, 2004 1:01 PM Subject: Re: [PHP] PHP timeout Well the situation you have described are the typical symptoms of a firewall eating up packets. (Simple scripts running fine and those that connect to networking timing out) How about installing both the php engine and mysql on the same machine for testing? Mario wrote: thanks for the reply Raditha. I don't have a firewall setup on this PC Is there a chance it's a permissions problem? And why do few simple scripts run fine though? Thanks Mario - Original Message - From: Raditha Dissanayake [EMAIL PROTECTED] To: Mario [EMAIL PROTECTED] -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP timeout
Hi, Make sure the mysql service is started and make sure that there isn't anything else competing for the same port (3306) beyond that i am afraid i cannot help as i am not a windows expert. Mario wrote: both php and mysql is on the same machine. even running the following timesout: ?php if (!($mylink = @mysql_pconnect(localhost,*,**))) print h3Problem connecting to the database server/h3\n; exit(); } mysql_select_db(xxx) or die (h3Problem connecting to the database/h3brDescription: . mysql_error()); ? -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] OOP methodology{O|T} kinda'
[snip] Yes i think java would be the best to learn proper OO, i've nevr done it, but coming the other way knowing php OO, java became more familiar to me, i'm gonna do it this year. [/snip] Why not start with the king of OOP, C++? Currently C++ is the most robust implementor of OOP design issues. From there it is easier to come to grips with PHP, JAVA and any other language in which you may need or want to use OOP. I heartily recommend that JAVA is NOT the way to learn OOP. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: parsing variables inside a variable?
Thanks Justin I was aware of that method but wanted to avoid it if possible, however another person explained to me that eval() can be used to force PHP to evaluate (i.e. parse) the variables, just thought I'd let you know for your future reference. James -- www.jholt.co.uk : affordable business website solutions www.htpshareware.com : software for the disorganized You don't needs eyes to see, you need vision - Maxi Jazz Justin Patrin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jimbo wrote: I query and use mysql_fetch_array to get the data into an associative array. I then build a string and output it like this: echo blah blah .$row[thecolumn]. blah blah; What you need to understand is that the string parsing for variables only happens when the string is actually in your script. When you dynamically create a string (or get it from a DB) it's just a string of characters in memory and is *not* parsed. To do something like this, you would have to use one of a few things. The first would be to use some kind of search and replace to replace those variables with what you really want. $text = str_replace('$name', $name, $text); That's fairly simple and could even be done for multiple variables. foreach(array('name', 'price') as $varName) { //yes, the $$ is correct $text = str_replace('$'.$varName, $$varName, $text); } You could also use a regular expression if you *really* wanted to, but what's above is easier. -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parsing variables inside a variable?
Great - thanks v. much Mike. I don't know why there was no mention of eval() in the section of the manual on Variable Parsing. James -- www.jholt.co.uk : affordable business website solutions www.htpshareware.com : software for the disorganized You don't needs eyes to see, you need vision - Maxi Jazz Mike Ford [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 29 January 2004 14:56, jimbo wrote: Hi, I have a query regarding variable parsing. I have some text in a MySQL database in which I have included some variable names. Eg (but w/o quotes): thankyou $name for registering on our web site. I query and use mysql_fetch_array to get the data into an associative array. I then build a string and output it like this: echo blah blah .$row[thecolumn]. blah blah; However, the output is simply: blah blah thankyou $name for registering on our web site blah blah - i.e. $name does not get parsed. I have tried wrapping $name with curly brackets in the database but that doesn't help and I have also tried using both addslashes and removeslashes on $row[thecolumn] and I have also tried this: echo blah blah $row['thecolumn'] blah blah - again both with and without curly brackets. Nothing seems to work. Is what I am trying to do possible? Yes, but you need to force PHP to re-evaluate the string you retrieve from the database -- normally, PHP just uses values retrieved at runtime as-is and doesn't do any special interpretation on them. The function you need to do this is eval() (http://www.php.net/eval), and one possible way of using it to achieve your desired result is (off the top of my head, untested): eval('echo blah {$row[\'thecolumn\']} blah;'); Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] tourico
Does anyone have any experience connecting with the new Tourico Holidays system via xml with php? I need help if so. -- Diana Castillo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] locking to domain
Hey, Sorry, when I posted this yesterday it was towards the end of my day and I was not thinking straight, by the time I got up today I had it figured out :-) Thanks anyway to everyone who replied. Cheers, -Ryan On 1/30/2004 7:38:27 AM, Justin French ([EMAIL PROTECTED]) wrote: On Friday, January 30, 2004, at 02:13 PM, Ryan A wrote: I have a rather simple need that I am sure a lot of you must have gone through, I need a bit of code so that the script can run only at something.com..I am generating a MD5 license key based on that... Problem that I am having is.. wont I need 2 keys to see if the domain is with a www (eg www.something.com) or is being run without the www (eg: http://something.com) ? I'm pretty sure it can be done with one keybut how? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] session management
Here's how I do it. User table in mysql UserID, username, password, admin, read, write 1001, John, *#(@(@, 0, 1, 0 1002, betty, KD)#(S, 1, 1, 1 Create a login form. Get their username and password, Run a query to pull the record where username and password match If the username is in the table and the password is correct then $_SESSION['userid'] = UserID (pulled from db query) $_SESSION['admin'] = admin $_SESSION['read'] = read $_SESSION['write'] = write Then create a function to check permissions based on the session variable. For instance if a page has a form for editing information, before loading the form check to see if the Current $_SESSION['write'] variable is set to '1', if so load the form, if not then don't. May not be the best way of doing things but it works well for me. Jeff McKeon IT Manager Telaurus Communications LLC [EMAIL PROTECTED] (973) 889-8990 ex 209 ***The information contained in this communication is confidential. It is intended only for the sole use of the recipient named above and may be legally privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication, or any of its contents or attachments, is expressly prohibited. If you have received this communication in error, please re-send it to the sender and delete the original message, and any copy of it, from your computer system. Thank You.*** -Original Message- From: ajay [mailto:[EMAIL PROTECTED] Sent: Friday, January 30, 2004 12:56 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] session management hi! well i do have a MySQL database. The scenario is this, i dont want to use cookies or do any URL rewriting. i'm looking for something that mirrors J2EE's Session object that contains information about the user, their security level(user/admin etc) and this information can then be verified before each request. There would ofcourse be an expiry on the object. Is there a prewritten framework/class to handle this? thanks regards -- ajay --- Who Dares Wins - This mail sent through IMP: www-mail.usyd.edu.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP timeout
it looks like it has nothing to do with MySQL and just with php I'm running a simple script like $x=23; echo $x; and it displays the number 23 properly, but the page keeps loading like there is something else to load too. - Original Message - From: Raditha Dissanayake [EMAIL PROTECTED] To: Mario [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, January 30, 2004 1:33 PM Subject: Re: [PHP] PHP timeout Hi, Make sure the mysql service is started and make sure that there isn't anything else competing for the same port (3306) beyond that i am afraid i cannot help as i am not a windows expert. Mario wrote: both php and mysql is on the same machine. even running the following timesout: ?php if (!($mylink = @mysql_pconnect(localhost,*,**))) print h3Problem connecting to the database server/h3\n; exit(); } mysql_select_db(xxx) or die (h3Problem connecting to the database/h3brDescription: . mysql_error()); ? -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: OOP methodology
# [EMAIL PROTECTED] / 2004-01-30 09:41:53 +: I'm trying to get to grips with my understanding of OOP. snip / Looks like you might enjoy reading Design Patterns by Gamma et. al. (ISBN: 0201633612). It's not easy reading, but will quite likely open your eyes. I've had many forehead-slapping moments since I started studying it. It's somewhat C++-centric, but the patterns are usable in other languages as well (and PHP can be seen as a dumbed down version of C++). -- FreeBSD 4.9-STABLE 2:21PM up 4 days, 23:06, 17 users, load averages: 0.13, 0.03, 0.01 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] phpCollab on shared server?
Burhan, Thanks for your kind offer of help. I was able to get it up and running with no problems. Best, Marc A. Garrett [EMAIL PROTECTED] -Original Message- From: Burhan Khalid [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 11:47 AM To: 'Marc A. Garrett' Subject: RE: [PHP] phpCollab on shared server? Marc A. Garrett wrote: Has anyone installed phpCollab on a shared server? I have a php account with MediaTemple and was hoping to find a few pointers. -- Marc A. Garrett since1968.com I have installed it a few times on shared hosting accounts without any problems. Nothing exotic to do either. Email me offlist if you get stuck. -- Burhan -- phplist[at]meidomus[dot]com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Size of Arrays
Hi at all, Indeed. The following script had my machine happily swapping like crazy at 320,000 array items (each being 1k, task manager showed 640meg total memory in use on this development machine with 512meg RAM running WinXP). ?php while (@ob_end_flush()); $data = Array(); while (true) { $data[] = str_repeat('#', 1024); print count($data).\n; } ? To the OP, why do you need to store all the items in memory at the same time? Can't you read some, process them then read the next lot, process them, read the next lot etc? No I couldn't because we have to use 1,6 Mio values direktly. If we read them each for each it will take a lot of time. We discover we can use an Array with 2.000.000 Values - if higher the server (Intel 1 GHz, 32 Bit, 1 GB RAM) gives up. Ciao, Sandro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Am I missing Something
You have: select date_format('%c', date_column) You need: select date_format('%c', date_column) AS date_column Else the column name in the result is date_format('%c', date_column). Phillip S. Baker wrote: Greetings all, I am running version 4.3.4 of PHP. Fairly recently. I am trying to call a pretty basic programming tool. Maybe I am just really tired, or something but I am not getting what is going on. Is there something I am missing. I am pulling a SQL call on a date to get the month. I am using Date_format and the %c to get the Month in numeric format. The I plug it into a variable and my intention is to call it as the index of an array. Nothing prints. When I turn on all notices I get a notice that it is an undefined index. What the heck is going on?? Thanks Phillip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Size of Arrays
Gandolf wrote: To the OP, why do you need to store all the items in memory at the same time? Can't you read some, process them then read the next lot, process them, read the next lot etc? No I couldn't because we have to use 1,6 Mio values direktly. If we read them each for each it will take a lot of time. Without testing I can't be sure, but my past experience suggests that working with several smaller sets of data one at a time would be more efficient than working with one big one if that's possible. I could of course be wrong since I don't know the internals of PHP too well, but I'd be surprised if I was. -- Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Request for files
Hello Sorry for bothering you with that 'question'. There was an article about an authentication-system in the German version of the magazin 'php solutions' issue October/November 2003. Unfortunately, my CD that was provided with the magazin has got a lot of CRC-errors (scratches). Could somebody that got this cd e-mail me the files concerning the mentioned article, please? Thanks a lot in advance! -- Regards Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Transferring an initiated Session to a Browser !!
Hi all, I Need to access certain data in a Page protected by user login. I have written a script with socket functions which connect to port 80 and automates what any browser does. That's Ok .. Now I have the Data What I wanted in a variable. But I am also in need of a Mechanism where I can transfer an Initiated session to the User's Browser ... ( Not Just OutPutting the above variable .. But actually Transferring the Session to the User's Browser ) Any Hacks ??? .. /Chandu
Re: [PHP] OT, Maybe: Question Re: Apache/Macintosh Platform
What you have is fine, but I think (I don't do it that way) this means each user will have completely separate code. That might be A Good Thing, or you might be the only user anyway. An alternative is to use /Library/WebServer/Documents/ Any pages placed there can be called with either 127.0.0.1/yourpage.php or localhost/yourpage.php (127.0.0.1 and localhost do not appear to be completely interchangeable; I've found places where one works and the other doesn't). An advantage of using /Library/WebServer/Documents/ is that you can set up virtual hosts in httpd.conf (/private/etc/httpd/httpd.conf). I have several development sites set up - www.xxx.dev, www.yyy.dev etc - paralleling the live sites. I can switch between development sites as quickly as between live sites. You can find instructions for this at http://www.listsearch.com/lassotalk.lasso?id=119795-session=listsearch_lass otalk:D4202A04032cc100BEIikJ25BACD HTH Roddie Grant [EMAIL PROTECTED] on 29/1/04 3:18 am, [EMAIL PROTECTED] at [EMAIL PROTECTED] wrote: PHP/MySQL textbook I'm using says to copy its sample apps to the root directory. What it says is: [o]n Apache this folder is usually named htdocs by default. Not only can't I find a folder named htdocs, but I've been using--and I'm certain I remember reading in another book to use this--the Sites folder within my username folder, which is within the Users folder of my hard drive. Now the code samples run fine from there; but I still need to know whether this is somehow not the correct place, and whether I need to create a folder named htdocs. Any thoughts? Thank you. Steve Tiano mail2web - Check your email from the web at http://mail2web.com/ . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why are my style sheets all listed on one line?
Freedomware wrote: I'm still fairly new to PHP, so there may be a simple fix for my relatively trivial complaint. I'm using an included page as a head section. It works fine, except that when preview a page and view the source, all the style sheets are displayed on one long line, like this: It sounds like you have figured out the problem, however I thought I would share another method that I like to use in similar situations. ?php $todayDate = date(m-d-Y); printEND titleFreedomware gt; $myname /title meta name=description content= $myname versus Microsoft / meta name=keywords content= $myname versus Microsoft / meta name=mssmarttagspreventparsing content=true / meta http-equiv=content-Type content=text/html; charset=iso-8859-1 / meta name=author content=David Blomstrom / script src= $periods js/swapclass.js type=text/javascript/script script language=JavaScript src= $periods js/sort.js/script script language=JavaScript src= $periods js/ss.js/script script language=JavaScript type=text/JavaScript END; ? there is one pit fall on this method that I run into sometimes. If your code is indented like it should be that moves the END; away from the beginning of the line and it won't work. So this wouldn't work, while(for a while){ if(this){ do stuff; printEND bunch of stuff here END; do more stuff; } end of while } The END; must be the first text on the line, so it has to be like this, while(for a while){ if(this){ do stuff; printEND bunch of stuff here END; do more stuff; } end of while } Chris W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Transferring an initiated Session to a Browser !!
snip But I am also in need of a Mechanism where I can transfer an Initiated session to the User's Browser ... ( Not Just OutPutting the above variable .. But actually Transferring the Session to the User's Browser ) /snip not sure I understand 100% what you mean. You could send a cookie or form field to the browser with the session id. You could serialize the $_SESSION array and send that to the browser. There are a bunch of options. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: tourico
If you refer to the gilboa/galileo reservation system, I've had a project on it for a Greece-based travel company. It involved XML messaging with the Gilboa server. Lucian COZMA Diana Castillo [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Does anyone have any experience connecting with the new Tourico Holidays system via xml with php? I need help if so. -- Diana Castillo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] parsing variables inside a variable?
On 30 January 2004 12:35, jimbo wrote: Great - thanks v. much Mike. I don't know why there was no mention of eval() in the section of the manual on Variable Parsing. Possibly because they didn't want to get into the security issues involved. It sounds like you're ok there, as you only intend putting very controlled values into the database. The problem comes if you're potentially eval()-ing user-supplied values that have been insufficiently validated. Just suppose, for example, that it was possible for a user to somehow get a value such as 'system(rm /etc/passwds)' inserted into the database in a field that you then eval()... Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Document Management and publishing
Might anyone be able to recomend a PHP based (or Java/Perl/Python) based document management system? I'm looking to being a LARGE collection of PDF documetns online. The focus of this application isn't necessarily publishing articles but equally managing files and assiciating certain informaiton. Looking at PHP-nuke and the like it didn't quite fit the bill. Any suggestions? -j -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] diff between script_filename, path_translated
After reading the manual entry on $_SERVER predefined variables, I'm unclear on the difference between 'SCRIPT_FILENAME' and 'PATH_TRANSLATED'. Results from a test script, run from a few different locations on my webserver, were always the same for these two variables. I'm especially confused by the Filesystem- (not document root-) based path comment for 'PATH_TRANSLATED'. On a pseudo-related topic: what should you use to find the absolute path from root to your application directory when you need to include a file? For example, I'm writing an application that has a function library in 'app/lib/'. From any file in the application, at any directory level, I want to be able to include specific files from the library. What's the best way to find '/absolute/path/from/root/' from '/absolute/path/from/root/app/*/any_file.php'? Since the path you get from 'DOCUMENT_ROOT' isn't necessarily where the executed file is (e.g., user directories), should that be avoided for this type of task? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: parsing variables inside a variable?
Jimbo wrote: Thanks Justin I was aware of that method but wanted to avoid it if possible, however another person explained to me that eval() can be used to force PHP to evaluate (i.e. parse) the variables, just thought I'd let you know for your future reference. James -- www.jholt.co.uk : affordable business website solutions www.htpshareware.com : software for the disorganized You don't needs eyes to see, you need vision - Maxi Jazz Justin Patrin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jimbo wrote: I query and use mysql_fetch_array to get the data into an associative array. I then build a string and output it like this: echo blah blah .$row[thecolumn]. blah blah; What you need to understand is that the string parsing for variables only happens when the string is actually in your script. When you dynamically create a string (or get it from a DB) it's just a string of characters in memory and is *not* parsed. To do something like this, you would have to use one of a few things. The first would be to use some kind of search and replace to replace those variables with what you really want. $text = str_replace('$name', $name, $text); That's fairly simple and could even be done for multiple variables. foreach(array('name', 'price') as $varName) { //yes, the $$ is correct $text = str_replace('$'.$varName, $$varName, $text); } You could also use a regular expression if you *really* wanted to, but what's above is easier. -- paperCrane Justin Patrin Well, I would have mentioned eval(), but you have to put PHP code in there instead of just strings. For example, Hello $name. would have to become. 'return Hello $name.'; or 'return \'Hello \'.$name.\'.\''; If you eval a string with Hello $name. in it, you will get a parse error. For readability, I would think that using str_replace to replace specific variables would be better. Actually, it would be even better if you used a templating system to do this kind of thing, such as Smarty. That way you don't have to worry about variable replacement, but your strings can still be easily edited. -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] textimage
Hey, I have one problem, i can't use 'text mode' exp: echo blah; end 'image function'? exp: imagepng($rys); Any idea? -- Maciek Hofstede PGP: http://www.demon.pl/max/max.pgp pgp0.pgp Description: PGP signature
Re: [PHP] diff between script_filename, path_translated
From: John Schulz [EMAIL PROTECTED] After reading the manual entry on $_SERVER predefined variables, I'm unclear on the difference between 'SCRIPT_FILENAME' and 'PATH_TRANSLATED'. Results from a test script, run from a few different locations on my webserver, were always the same for these two variables. I'm especially confused by the Filesystem- (not document root-) based path comment for 'PATH_TRANSLATED'. Not sure what to say on this one other than, yeah, they're the same. :) On a pseudo-related topic: what should you use to find the absolute path from root to your application directory when you need to include a file? For example, I'm writing an application that has a function library in 'app/lib/'. From any file in the application, at any directory level, I want to be able to include specific files from the library. What's the best way to find '/absolute/path/from/root/' from '/absolute/path/from/root/app/*/any_file.php'? Since the path you get from 'DOCUMENT_ROOT' isn't necessarily where the executed file is (e.g., user directories), should that be avoided for this type of task? Not sure if this will help either, but this is what I use to determine where I'm at in scripts I write. //System path to program $this-CONF['path'] = dirname($_SERVER['PATH_TRANSLATED']); //Determine protocol of web pages if(isset($_SERVER['HTTPS']) strcasecmp($_SERVER['HTTPS'],'ON') == 0) { $this-CONF['protocol'] = 'https://'; } else { $this-CONF['protocol'] = 'http://'; } //HTML address of this program $dir_name = dirname($_SERVER['SCRIPT_NAME']); if($dir_name == '\\') { $dir_name = ''; } $this-CONF['html'] = $this-CONF['protocol'] . $_SERVER['SERVER_NAME'] . $dir_name; //Determine web address of current page $this-CONF['current_page'] = $this-CONF['protocol'] . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME']; Then, if all of my methods, I use $this-CONF['path'] to include files relative to the file system and $this-CONF['html'] to include files relative to the HTML root. //Include a library file include($this-CONF['path'] . '/includes/db.inc'); //Path to image img src=?=$this-CONF['html']?/images/picture.gif Hope that helps. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: parsing variables inside a variable?
From: Justin Patrin [EMAIL PROTECTED] What you need to understand is that the string parsing for variables only happens when the string is actually in your script. When you dynamically create a string (or get it from a DB) it's just a string of characters in memory and is *not* parsed. To do something like this, you would have to use one of a few things. The first would be to use some kind of search and replace to replace those variables with what you really want. $text = str_replace('$name', $name, $text); That's fairly simple and could even be done for multiple variables. foreach(array('name', 'price') as $varName) { //yes, the $$ is correct $text = str_replace('$'.$varName, $$varName, $text); } You could also use a regular expression if you *really* wanted to, but what's above is easier. For a regular expression example of how to do this: ?php $str = 'this is $name a $test'; $name = 'John'; $test = 'foobar'; $evaled_str = preg_replace('/\$([a-z0-9_]+)/ie','\$\1',$str); echo $evaled_str; ? Where $str is what's retrieved from the database with the variables in it. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textimage
From: Maciek Hofstede [EMAIL PROTECTED] I have one problem, i can't use 'text mode' exp: echo blah; end 'image function'? exp: imagepng($rys); Any idea? I've had my coffee now and I'm still confused. What are you trying to do? I'm going to try more coffee. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Transferring an initiated Session to a Browser !!
From: Admin - CpanelPlus [EMAIL PROTECTED] I Need to access certain data in a Page protected by user login. I have written a script with socket functions which connect to port 80 and automates what any browser does. That's Ok .. Now I have the Data What I wanted in a variable. But I am also in need of a Mechanism where I can transfer an Initiated session to the User's Browser ... ( Not Just OutPutting the above variable .. But actually Transferring the Session to the User's Browser ) You want your PHP script to connect to a password protected page, retrieve information, and then pass the sucessful authentication back to the browser? So you basically want your PHP script to log in for the user, on another site, and send the resulting session, from the other site, back to the browser? If I'm understanding you correctly, I don't think you're going to be able to do this. You can't set a session cookie on behalf of the other site. You could take a look at cURL, but I don't think it'll do this. If I'm confused, please correct me. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textimage
On Fri, 30 Jan 2004, Maciek Hofstede wrote: I have one problem, i can't use 'text mode' exp: echo blah; end 'image function'? exp: imagepng($rys); You have to use the font rendering functions to put text into an image. I have used imagettftext() to do this. See: http://www.php.net/manual/en/ref.image.php -- Aj. Sys. Admin / Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] diff between script_filename, path_translated
John W. Holmes wrote: Not sure what to say on this one other than, yeah, they're the same. :) Ah, spiffy. ;) Not sure if this will help either, but this is what I use to determine where I'm at in scripts I write. Very helpful, thank you! :) I realized after sending that I should probably keep my application/library files out of the world-viewable directory, what with the passwords and all. ;) But the method of finding the path from root is easily adaptable for that consideration. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textimage
On Fri, 30 January 2004 at 11:53:14 -0500, John W. Holmes wrote: From: Maciek Hofstede [EMAIL PROTECTED] I have one problem, i can't use 'text mode' exp: echo blah; end 'image function'? exp: imagepng($rys); Any idea? I've had my coffee now and I'm still confused. What are you trying to do? I'm going to try more coffee. i'm writing a host monitor. image it's diagram generate from mysql, if i use imagestring or imagettftext web is too big, there is about 150 - 170 hosts, and i have generate image and put html descriptions: image host alive: ble ble ble ble ble ble (statistic) ps.sorry for my english ;( -- Maciek Hofstede PGP: http://www.demon.pl/max/max.pgp pgp0.pgp Description: PGP signature
Re: [PHP] textimage
On Fri, 30 Jan 2004, Maciek Hofstede wrote: i'm writing a host monitor. image it's diagram generate from mysql, if i use imagestring or imagettftext web is too big, there is about 150 - 170 hosts, and i have generate image and put html descriptions: image host alive: ble ble ble ble ble ble (statistic) ps.sorry for my english ;( You can easily test for and adjust the size of the text. You can use various functions to get the font metrics and see if they fit in your image - if not, you can decrease the size and try again. If you write it as a loop with a flag, you can have it automatically size the text to the bounding box. Its not as hard as it sounds... -- Aj. Sys. Admin / Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] textimage
Hi, Sounds to me like you could be killing your server with so many images being dynamically generated. How about keeping a set of pre generated images and use your php script to embed them into html (depending on whether the server is up or down). You can for example create a large image in any graphic editing software (i use the GIMP) and cut it up into pieces and your php script and decide which server where shoudl have the active image and which server should have the dead images. hope this doesn't sound too confusing best regards raditha Maciek Hofstede wrote: On Fri, 30 January 2004 at 11:53:14 -0500, John W. Holmes wrote: From: Maciek Hofstede [EMAIL PROTECTED] I have one problem, i can't use 'text mode' exp: echo blah; end 'image function'? exp: imagepng($rys); Any idea? I've had my coffee now and I'm still confused. What are you trying to do? I'm going to try more coffee. i'm writing a host monitor. image it's diagram generate from mysql, if i use imagestring or imagettftext web is too big, there is about 150 - 170 hosts, and i have generate image and put html descriptions: image host alive: ble ble ble ble ble ble (statistic) ps.sorry for my english ;( -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: OOP methodology
Wow, that's a lot of stuff in one class. Personally, I've started using the MVC (Model, View, Controller) architecture. Basically what it does is seperates Data logic from Display logic and Control logic. Here's how I've been using it. Model: Holds and deals with all data for the program, such as database connections / queries, session data, data consistency. I am currently using classes which use PEAR DB_DataObject for DB connections, querying, and data storage. View: Deals with displaying of data from model. ONLY does displaying, no processing. Very minimal logic only associated with outputting. Currently, I am using Smarty entirely for the view. Little no no PHP code, only Smarty. The View in this case is just a smarty template file. Controller: Handles requests from the browser. Instantiates Model and View, calls functions in Model to alter its state (updating from $_REQUEST vars, for instance). Chooses a view and then tells the view to display. For me, this is all home-grown PHP. This architecture can be much more complicated in, say, a C++ program, but the Server/Client pattern built into web programs makes it much more simple. The reason that I use this particular architecture is that it factors all of the pieces of your program very nicely. Later, if you do things right, you can use a single screen from one program in another with minimal editing. Here's a few pages that discuss MVC: http://ootips.org/mvc-pattern.html http://st-www.cs.uiuc.edu/users/smarch/st-docs/mvc.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP methodology{O|T} kinda'
Jay Blanchard wrote: [snip] Yes i think java would be the best to learn proper OO, i've nevr done it, but coming the other way knowing php OO, java became more familiar to me, i'm gonna do it this year. [/snip] Why not start with the king of OOP, C++? Currently C++ is the most robust implementor of OOP design issues. From there it is easier to come to grips with PHP, JAVA and any other language in which you may need or want to use OOP. I heartily recommend that JAVA is NOT the way to learn OOP. Hehe, and here is where we start a holy war. I would have to disagree. While it may be possible to implement good OOP in C++, it does not nearly implement OOP as well as many other languages. It also has many other design problems that hinder the learning of OOP. However, if you know C++ already it may be easier to learn good OOP in C++ (it has much more full OOP than PHP4). -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] OOP methodology{O|T} kinda'
[snip] Hehe, and here is where we start a holy war. [/snip] Bring it. [snip] I would have to disagree. While it may be possible to implement good OOP in C++, it does not nearly implement OOP as well as many other languages. It also has many other design problems that hinder the learning of OOP. [/snip] I respect your opinion and all, but how do you come to this conclusion? Which of the many other languages implement OOP better? And what other design problems do you speak of? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP methodology{O|T} kinda'
Which of the many other languages implement OOP better? Smalltalk, for one. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Comparing multiple Mysql tables to find duplicates
Hello everyone, I am trying to write a function that would compare one table to a number of other tables in Mysql and remove any duplicates found. This is for tables of email addresses where I want to remove any dups found. Example: Master list - compare to list1, list2, list3, and so on and remove matches found from list1, list2, list3 etc. *not* from Master list. Does anyone know of any such beast before I set out to reinvent it? Thanks. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comparing multiple Mysql tables to find duplicates
Hi, If you are using mysql 4 you can use subselects to delete from where in (select) the select itself can be a multi table join. if you are on mysql 3.xx you can use PHP to mimic a subselect. Chris Bruce wrote: Hello everyone, I am trying to write a function that would compare one table to a number of other tables in Mysql and remove any duplicates found. This is for tables of email addresses where I want to remove any dups found. Example: Master list - compare to list1, list2, list3, and so on and remove matches found from list1, list2, list3 etc. *not* from Master list. Does anyone know of any such beast before I set out to reinvent it? Thanks. Chris -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comparing multiple Mysql tables to find duplicates
Mysql 3.23.54. My first thought was to load the output from the tables into an array and they use a foreach and in_array to create a list of dups, but I wanted to see if there was an easier way. -- Chris Bruce [EMAIL PROTECTED] Idextrus E-Business Architects http://www.idextrus.com 3282 Wilmar Cres. Mississauga, ON L5L4B2 CA 905.828.9189 On Jan 30, 2004, at 12:54 PM, Raditha Dissanayake wrote: Hi, If you are using mysql 4 you can use subselects to delete from where in (select) the select itself can be a multi table join. if you are on mysql 3.xx you can use PHP to mimic a subselect. Chris Bruce wrote: Hello everyone, I am trying to write a function that would compare one table to a number of other tables in Mysql and remove any duplicates found. This is for tables of email addresses where I want to remove any dups found. Example: Master list - compare to list1, list2, list3, and so on and remove matches found from list1, list2, list3 etc. *not* from Master list. Does anyone know of any such beast before I set out to reinvent it? Thanks. Chris -- Raditha Dissanayake. --- - http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar.
RE: [PHP] OOP methodology{O|T} kinda'
On Fri, 30 Jan 2004, Jay Blanchard wrote: I would have to disagree. While it may be possible to implement good OOP in C++, it does not nearly implement OOP as well as many other languages. It also has many other design problems that hinder the learning of OOP. I respect your opinion and all, but how do you come to this conclusion? Which of the many other languages implement OOP better? Python, Ruby...? Of course, I've never done any OOP in C++. My guess is part of the reason he said this is because you've got to learn C++ before you're going to do much successful OOP with it. Not exactly a small learning curve. Other languages dispense with a lot of the formalities found in C++ (a good or bad thing, depending on your perspective). I found Python to be a great language to learn OOP, since it forces good habits on you. -- Kelly Hallman // Ultrafancy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comparing multiple Mysql tables to find duplicates
From: Chris Bruce [EMAIL PROTECTED] I am trying to write a function that would compare one table to a number of other tables in Mysql and remove any duplicates found. This is for tables of email addresses where I want to remove any dups found. Example: Master list - compare to list1, list2, list3, and so on and remove matches found from list1, list2, list3 etc. *not* from Master list. Does anyone know of any such beast before I set out to reinvent it? DELETE FROM list1 USING master_list, list1 WHERE list1.email = master_list.email Repeat for other tables. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Comparing multiple Mysql tables to find duplicates
My first thought was to load the output from the tables into an array and they use a foreach and in_array to create a list of dups, but I wanted to see if there was an easier way. -- If you're not using MySQL 4, then yeah, that's probably the best way. Just realize that this isn't going to be the fastest script in the world. If it's a one-off or very infrequently run script, then that's not a big deal. -M -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comparing multiple Mysql tables to find duplicates
From: Chris Bruce [EMAIL PROTECTED] Mysql 3.23.54. My first thought was to load the output from the tables into an array and they use a foreach and in_array to create a list of dups, but I wanted to see if there was an easier way. Ah, in that case, my other query won't work. :) This should: ?php $query = SELECT list1.email FROM master_list, list1 WHERE master_list.email = list1.email; $result = mysql_query($query) or die(mysql_error()); while($r = mysql_fetch_assoc($result)) { $email_list .= '{$row['email']}',; } $email_list = substr($email_list,0,-1); //remove last comma $query = DELETE FROM list1 WHERE email IN ($email_list); $result = mysql_query($query) or die(mysql_error()); ? Repeat for other tables. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comparing multiple Mysql tables to find duplicates
This will work for Mysql 3.23.54? -- Chris Bruce [EMAIL PROTECTED] Idextrus E-Business Architects http://www.idextrus.com 3282 Wilmar Cres. Mississauga, ON L5L4B2 CA 905.828.9189 On Jan 30, 2004, at 12:48 PM, John W. Holmes wrote: From: Chris Bruce [EMAIL PROTECTED] I am trying to write a function that would compare one table to a number of other tables in Mysql and remove any duplicates found. This is for tables of email addresses where I want to remove any dups found. Example: Master list - compare to list1, list2, list3, and so on and remove matches found from list1, list2, list3 etc. *not* from Master list. Does anyone know of any such beast before I set out to reinvent it? DELETE FROM list1 USING master_list, list1 WHERE list1.email = master_list.email Repeat for other tables. ---John Holmes...
Re: [PHP] Comparing multiple Mysql tables to find duplicates
Cool, thanks John, I'll give it a shot. Sorry for the last email, I sent it before you sent this one :) -- Chris Bruce [EMAIL PROTECTED] Idextrus E-Business Architects http://www.idextrus.com 3282 Wilmar Cres. Mississauga, ON L5L4B2 CA 905.828.9189 On Jan 30, 2004, at 12:54 PM, John W. Holmes wrote: From: Chris Bruce [EMAIL PROTECTED] Mysql 3.23.54. My first thought was to load the output from the tables into an array and they use a foreach and in_array to create a list of dups, but I wanted to see if there was an easier way. Ah, in that case, my other query won't work. :) This should: ?php $query = SELECT list1.email FROM master_list, list1 WHERE master_list.email = list1.email; $result = mysql_query($query) or die(mysql_error()); while($r = mysql_fetch_assoc($result)) { $email_list .= '{$row['email']}',; } $email_list = substr($email_list,0,-1); //remove last comma $query = DELETE FROM list1 WHERE email IN ($email_list); $result = mysql_query($query) or die(mysql_error()); ? Repeat for other tables. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Comparing multiple Mysql tables to find duplicates
Did you mention cofee John? now why did i suggest subselects when good old joins seem to do the tricks. Yikes! John W. Holmes wrote: From: Chris Bruce [EMAIL PROTECTED] I am trying to write a function that would compare one table to a number of other tables in Mysql and remove any duplicates found. This is for tables of email addresses where I want to remove any dups found. Example: Master list - compare to list1, list2, list3, and so on and remove matches found from list1, list2, list3 etc. *not* from Master list. Does anyone know of any such beast before I set out to reinvent it? DELETE FROM list1 USING master_list, list1 WHERE list1.email = master_list.email Repeat for other tables. ---John Holmes... -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] OOP methodology{O|T} kinda'
On Fri, 30 Jan 2004, Kelly Hallman wrote: Other languages dispense with a lot of the formalities found in C++ (a good or bad thing, depending on your perspective). I found Python to be a great language to learn OOP, since it forces good habits on you. C++ is a very large unwieldly language - it has too many constructs and too much syntax. Experience has chown that smaller simpler languages are easier to learn and apply than larger ones. This is why C is still the language of choice for a lot of systems coding (among other reasons). While purists will no doubt damn me to hell, I know a lot of people would put C++ at the bottom of their list of OOP coding languages of choice. -- Aj. Sys. Admin / Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Document Management and publishing
Hello Jon, On 30 Jan 2004 at 10:57, Jon Shoberg wrote: Might anyone be able to recomend a PHP based (or Java/Perl/Python) based document management system? I'm looking to being a LARGE collection of PDF documetns online. The focus of this application isn't necessarily publishing articles but equally managing files and assiciating certain informaiton. Looking at PHP-nuke and the like it didn't quite fit the bill. Any suggestions? I developed a file library application a while ago for my previous employer and it's been in use for a couple of years now, so it's pretty stable. It uses a MySQL backend and stores all files in the database, which I thought was brilliant at the time but now know not to be the best solution if the use is intensive. At the time I was getting started on OOP, so the code is not the most elegant (sometimes far from it), but it works. If you want, you can have the code for free (I retained the rights over it). You'll probably need to edit a few things here and there to suit your specific needs, but it may save you a lot of time. Cheers, Erik P.S. If you need to e-mail me privately about this, include the list's e-mail address in the FROM field of your message, or else it'll be automatically expunged by my spam filters. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do you guys do this?
Hey all, I needed to make a simple upload script so users could upload their images but had a small extra requirment, after searching google, hotscripts and all the other usual places and downloading code, i realized its better to write the whole damn thing myself, so i did. Now that the little history lesson is over.I have run into a problem which i am sure you guys must have too, when you take the uploaded pic of the user...how do you save it? I dont mean saving onto disk, i can do that, i mean the name of the file...I am having all the pics upload to one common directory (member_pics) so what do you suggest I name the pictures? eg: username.jpg? first_last_name.jpg? random_number_username.jpg? etc etc (for this example i wrote only jpg, i will be having png and gif too) The reason I didnt want to use the user's username as his pic name is coz then if someone wanted to break into his account they already know the username and they could try to bruteforce the password... if i use first and last name...there is a _small_ possibility of 2 members having the same first and last name... so.back to the subject of my email.How do you guys do this? Another question related to this, I am restricting the uploaded files to be jpg,png and gif for security..anything else you suggest for security's sake? This is my first working upload script...I dont know everything and trying not to screw up so any and all help appreciated. Thanks, -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How do you guys do this?
The reason I didnt want to use the user's username as his pic name is coz then if someone wanted to break into his account they already know the username and they could try to bruteforce the password... if i use first and last name...there is a _small_ possibility of 2 members having the same first and last name... You can always use an md5() of the username. -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How do you guys do this?
Ryan A mailto:[EMAIL PROTECTED] on Friday, January 30, 2004 10:09 AM said: common directory (member_pics) so what do you suggest I name the pictures? eg: username.jpg? first_last_name.jpg? random_number_username.jpg? how about timestamp_originalfilename.jpg? Someone uploads breadbox.jpg you save it as 1010342461_breadbox.jpg. Or if the traffic will not be insanely high you can just call it 1010342461.jpg. hth, Chris. * Unless more than one person is uploading a picture within the same second you won't have any problems with duplicate names. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Logging on to a web based application
Hi, We are trying to develop a web based system where users a charged per office. I would be grateful to hear anyone's experience in creating such applications and how the users are managed. Our main concern is how we stop a client paying for one office use and distributing their password to other offices... Many thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] The PHP Problem
Hi, I am totally new to PHP and dont know a thing. I tried looking through the articles but they were of no use. My Question is: How can I just write php in a text editor, save it as a .php, and view it in internet explorer, offline? I have tried everything and it just wont work. I tried the code: ?php echo Hi, I'm a PHP script!; ? in a .php file and nothing happened. Nothing will work, help! I dont have a website, I just want to write and use the code. Tnaks from Ashley Williams -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The PHP Problem
On Friday 30 January 2004 10:51 am, Ash wrote: How can I just write php in a text editor, save it as a .php, and view it in internet explorer, offline? you have to install php. http://www.php.net/manual/en/installation.php gabe. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The PHP Problem
You need to test this page on a webserver. I assume you are on a Win system .configure IIS to understand php and then place all your scripts in C:/Inetwin/ folder and u shud be set. hth ps On Friday, January 30, 2004, at 01:51 PM, Ash wrote: Hi, I am totally new to PHP and dont know a thing. I tried looking through the articles but they were of no use. My Question is: How can I just write php in a text editor, save it as a .php, and view it in internet explorer, offline? I have tried everything and it just wont work. I tried the code: ?php echo Hi, I'm a PHP script!; ? in a .php file and nothing happened. Nothing will work, help! I dont have a website, I just want to write and use the code. Tnaks from Ashley Williams -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The PHP Problem
Ash wrote: Hi, I am totally new to PHP and dont know a thing. I tried looking through the articles but they were of no use. My Question is: How can I just write php in a text editor, save it as a .php, and view it in internet explorer, offline? I have tried everything and it just wont work. I tried the code: ?php echo Hi, I'm a PHP script!; ? in a .php file and nothing happened. Nothing will work, help! I dont have a website, I just want to write and use the code. Tnaks from Ashley Williams At the bare minimum, you need to install php (if you just want to run it from the command line). If you want to view it through a browser, it has to be parsed by php via a webserver. You can install one of those on your machine pretty easy (Apache), or you can use someone else's (search Google for 'free php hosting'). -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The PHP Problem
Hello Ashley, On 30 Jan 2004 at 18:51, Ash wrote: Hi, I am totally new to PHP and dont know a thing. I tried looking through the articles but they were of no use. My Question is: How can I just write php in a text editor, save it as a .php, and view it in internet explorer, offline? I have tried everything and it just wont work. I tried the code: ?php echo Hi, I'm a PHP script!; ? in a .php file and nothing happened. Nothing will work, help! I dont have a website, I just want to write and use the code. I'm afraid things are not quite that simple. A PHP script requires a processor to interpret the code and do whatever needs to be done, so you'll need to have the processor on your computer. If you don't really know what you're going to be doing with PHP and just want to play around with a scripting language without having to install a web server and a PHP interpreter, try JavaScript. One of a million sources of introductory info on JavaScript: http://www.w3schools.com/js/js_intro.asp More info on obtaining and installing PHP here: http://www.php.net/manual/en/installation.php Good luck, Erik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do you guys do this?
From: Ryan A [EMAIL PROTECTED] I am having all the pics upload to one common directory (member_pics) so what do you suggest I name the pictures? uniqid() and md5() would come in handy here. Another question related to this, I am restricting the uploaded files to be jpg,png and gif for security..anything else you suggest for security's sake? Maybe .jpeg, also. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] OOP methodology{O|T} kinda'
[snip] Experience has chown that smaller simpler languages are easier to learn and apply than larger ones. [/snip] Obviously. :) I'd be curious as to how many cam to PHP from a programming background? Likewise, how many start with PHP and go on to other languages? And what those languages are either direction? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Logging on to a web based application
- Original Message - From: Shaun [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, January 30, 2004 1:38 PM Subject: [PHP] Logging on to a web based application Hi, We are trying to develop a web based system where users a charged per office. I would be grateful to hear anyone's experience in creating such applications and how the users are managed. Our main concern is how we stop a client paying for one office use and distributing their password to other offices... Many thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You can base it on thier ip address if it's static limiting to that one addy, or only allow them so many connections per day, or let them access no matter what and record their IP address and charge them more if they access from more than one location. just some ideas Jake -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] exec cURL to pass custom MIME headers
Hi, Normally I wouldn't do this but the cURL list seems to be in severe hibernation, ie. no activity. I'm in a bit of a jam w/ this and so here goes How do I get cURL to pass headers properly? It is ignoring my -H headers and sending its own default or whatever set of headers. One example, it submits as x-www-urlencoded-form or whatever but I want it to just send -H my headers!. Can anyone point me in the right direction? I know I probably just need to change something simple here.. see below: ? $mime_headers=POST /AUTHORIZE HTTP/1.0\nMIME-Version: 1.0\nContent-type: application/X1; $xml_content={some XML - use your imagination here}; exec(/usr/local/bin/curl -m 120 -H \$mime_headers\ -d \$xml_content\ $merchant_URL:$merchant_PORT -L, $return_message_array, $return_number); ? So any ideas!?!??? Also, is cURL abandoned or what? I thought their list would be active to at least some degree. Thanks in advance for any help. Kris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP methodology{O|T} kinda'
On Jan 30, 2004, at 2:19 PM, Jay Blanchard wrote: I'd be curious as to how many cam to PHP from a programming background? Likewise, how many start with PHP and go on to other languages? And what those languages are either direction? Probably a strange mix, but... I came to PHP from an AppleScript/JavaScript/very-basi-C background. While I was beginning to learn PHP, I took 2 C++ classes at college (this was beginning over a year ago), and have since moved on to Objective-C. -- Chris Garaffa [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do you guys do this?
Ryan A wrote: Hey all, I needed to make a simple upload script so users could upload their images but had a small extra requirment, after searching google, hotscripts and all the other usual places and downloading code, i realized its better to write the whole damn thing myself, so i did. Now that the little history lesson is over.I have run into a problem which i am sure you guys must have too, when you take the uploaded pic of the user...how do you save it? I dont mean saving onto disk, i can do that, i mean the name of the file...I am having all the pics upload to one common directory (member_pics) so what do you suggest I name the pictures? eg: username.jpg? first_last_name.jpg? random_number_username.jpg? etc etc (for this example i wrote only jpg, i will be having png and gif too) Depends if the images are freely accessible to anyone or you want to protect them so they must be served by php script. If the former I like to keep the original name that usualy has some meaning. If image of that name already exists (e.g. john.jpg), I append 2, 3, 4 etc. (e.g. john2.jpg). You need to lock the script somehow so it does not run into race condition, I use mysql GET_LOCK function for this. So the whole process looks like: /* wait 30 seconds to get the lock, then the function fails and returns 0, you should take care of this error */ SELECT GET_LOCK('upload_image', 30); $image_name = $_FILES['name']['fileinput']; $i = 2; while(file_exists('userimages/'.$image_name)) { $image_name = // append $i here } move_uploaded_file($_FILES['tmp_name']['fileinput'], 'userimages/'.$image_name); // update database // release lock SELECT RELEASE_LOCK('upload_image'); If you serve the files by a php script, it does not matter what name you give the file on the filesystem, you can use uniqid() for example. Store the real name in the database, this gives you the advatage that you can have the same names. Still you should use the above lock and loop to make sure the script won't overwrite another file. HTH, Marek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] file separator...
Hi Everyone, Hoping someone can shed a light on this. I have to send a file separator in a string that I piece together to a remote system. I've been told this is x'1C' ASCII or x'22' HEX. I have no idea what to really send. I've tried several things. Can someone tell me what it is they're looking for? -Dan Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] OOP methodology{O|T} kinda'
On Fri, 30 Jan 2004, Jay Blanchard wrote: I'd be curious as to how many cam to PHP from a programming background? Likewise, how many start with PHP and go on to other languages? And what those languages are either direction? I started serious coding in perl. When I found PHP, I realized I was killing myself trying to do CGI with perl, and quickly migrated. That transition was easy, and my life got better. After a couple of years coding in PHP I made a foray into Python. I learned OOP with Python and was able to work that knowledge into my PHP programming easily. Using OO with PHP simplified a lot of problems I'd had trying to do more complex tasks with a procedural/functional approach. I still use perl to whip up a sysadmin script here and there, but after using Python I began to regard perl as a syntactic mess. -- Kelly Hallman // Ultrafancy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Size of Arrays
Should anyone be planning experiments or projects with large arrays, use a for() loop instead of a foreach() loop when working with your array. And be sure to count the array, stick that result into a variable, then compare against the variable instead of running the count() again. On huge arrays (hundreds of thousands of elements, three dimensions, several megabytes) the performance impact is huge! The downside is you'll probably have to use numeric keys instead of associative, but for big arrays, numeric keys will probably also keep more memory free and improve performance a bit. Good luck with your arrays! -Galen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Size of Arrays
Galen mailto:[EMAIL PROTECTED] on Friday, January 30, 2004 12:35 PM said: On huge arrays (hundreds of thousands of elements, three dimensions, several megabytes) the performance impact is huge! The downside is you'll probably have to use numeric keys instead of associative, but for big arrays, numeric keys will probably also keep more memory free and improve performance a bit. And here's another optimization (for the anal type). $yCnt = -1; $array_size = count($array); while(++$yCnt $array_size) { // do your stuff } Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The PHP Problem
I have several web sites that I use PHP/mySQL with. I pay approximately $9 per month for a gigabyte of space and unlimited data transfer. I use CodeWright from Starbase as my editor. It detects PHP code and colorizes the code as you type i.e. reserved words are blue, comments are green, literals are red, etc.. This helps with the initial syntax checking. It does this with just about every language. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, January 30, 2004 2:09 PM Subject: Re: [PHP] The PHP Problem Hello Ashley, On 30 Jan 2004 at 18:51, Ash wrote: Hi, I am totally new to PHP and dont know a thing. I tried looking through the articles but they were of no use. My Question is: How can I just write php in a text editor, save it as a .php, and view it in internet explorer, offline? I have tried everything and it just wont work. I tried the code: ?php echo Hi, I'm a PHP script!; ? in a .php file and nothing happened. Nothing will work, help! I dont have a website, I just want to write and use the code. I'm afraid things are not quite that simple. A PHP script requires a processor to interpret the code and do whatever needs to be done, so you'll need to have the processor on your computer. If you don't really know what you're going to be doing with PHP and just want to play around with a scripting language without having to install a web server and a PHP interpreter, try JavaScript. One of a million sources of introductory info on JavaScript: http://www.w3schools.com/js/js_intro.asp More info on obtaining and installing PHP here: http://www.php.net/manual/en/installation.php Good luck, Erik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and XML.
Odd problem. I have written a small script that processes some XML, it runs on a few FreeBSD boxes I admin over. On one of the boxes (the only one) .. if I run this script through apache, The xml_set_element_handler and xml_set_character_data_handler functions return a 1 error (out of memory) If I run the scripts from the Command lime they work fine ! anyone got any ideas? Mark -- Mark Ackroyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Related links embedded in pages....
Hey all, I'm sure you must have visited sites where articles on a page have links to place that explain what that word means.. eg: This is an article about a computer programming language called php which is taking web development to a different. in the above snip of the article computer programming would be a link to some page that explains that, php could point to php.net or maybe have a dhtml popup that explains what P.H.P stands for etc etc Doing the above in a static .htm page is pretty easy, but doing this on a dynamically generated page is a bit hard.. as first you get the content from the DB, search for the words that match your (probably) array of link words, replace the word with the code to generate a link or dhtml popup Thats putting it in the rawest sense...anybody know of any class, free piece of code, example functioning code etc that does this? Thanks, -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Logging on to a web based application
I use a DB table to manage my users, I do not have to worry about locking it down to one user, however one thought is to track the user into a temporary DB, if the user name is there and the sessionID does NOT match the one in the DB, then the user is not granted permission to access the programs. If they have logged out, then the logout page will go in and delete the user from the DB field. As each page is loaded it checks the DB against the user's cached data. If there is an issue, the DB is treated as correct and the user is dropped. Once that happens a few times to someone logged into a critical app and they lose data (it should check the data before storing information) then that will essentially for the users to have their own user/pw combo. HTH, Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Exectution Time?
Is there a way to find out the execution time of php program? Thanks _ Check out the coupons and bargains on MSN Offers! http://shopping.msn.com/softcontent/softcontent.aspx?scmId=1418 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP methodology{O|T} kinda'
Jay Blanchard wrote: [snip] Experience has chown that smaller simpler languages are easier to learn and apply than larger ones. [/snip] Obviously. :) I'd be curious as to how many cam to PHP from a programming background? Likewise, how many start with PHP and go on to other languages? And what those languages are either direction? Here's my progression: BASIC - Turbo Pascal - C - C++ - PHP. Yes, I came to PHP from C++, having learned OO in C++. But honestly, I've learned a lot more good OO practices in PHP than I ever did in C++. -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Am I missing Something
At 09:54 AM 1/30/2004 +, Stuart wrote: Phillip S. Baker wrote: I am running version 4.3.4 of PHP. Fairly recently. I am trying to call a pretty basic programming tool. Maybe I am just really tired, or something but I am not getting what is going on. Is there something I am missing. I am pulling a SQL call on a date to get the month. I am using Date_format and the %c to get the Month in numeric format. The I plug it into a variable and my intention is to call it as the index of an array. Nothing prints. When I turn on all notices I get a notice that it is an undefined index. What the heck is going on?? Sorry, left my mind reading helmet at home today. How about sharing some code. $sql = SELECT CONCAT(DATE_FORMAT(initiation_date, '%b '), initiation_day, ',' , DATE_FORMAT(initiation_date, ' %Y')) AS weekend, DATE_FORMAT(initiation_date, '%c ') AS month, initiation_day FROM center, initiation WHERE initiation_date = CURRENT_DATE AND initiation_center = center_id AND center_id = $g_cen ORDER BY initiation_date ASC; $wkends = new MySQL($sql); while ( $rec = $wkends - fetchRow () ) { list($sday, $eday) = explode('_', $rec['initiation_day']); if ( $sday == '29' || $sday == '30' || $sday == '31' ) { $somevalue = $rec[1]; echo $g_dates .= $somarray[$somevalue]; } } Through testing, if I echo out $rec[1] I get to correct value (3) If I echo out $somevalue I get the correct value (3) However $somarray[$somevalue] prints out nothing. Again if I display all notices then what I get is that there is an undefined index on the lines that has echo $g_dates .= $somarray[$somevalue]; And $somarray[ has more than four values. Blessings Phillip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exectution Time?
From: Mike Mapsnac [EMAIL PROTECTED] Is there a way to find out the execution time of php program? If you start a task at 10:00 and finish at 10:15, how long did it take? ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php