[PHP] vpopmail Functions
Hello, I have read on php.net that the vpopmail functions are available in 4.0.5 and later. However, I have not been able to successfully use then on 4.0.6 or 4.1.0. Is this something that needs to be enabled, or am I doing something incorrectly? Pete~
[PHP] Is there an MSSQL limit function?
I want to run a query like: select * from table order by rand() limit 3 in MySQL it would work but I need to run it in MSSQL. I've been searching for a limit function in MSSQL and I can't find a way to do it. I'm experienced with MySQL but know nothing about MSSQL. If someone could point me in the right direction I would really appreciate it! Thanks, Dean
Re: [PHP] Is there an MSSQL limit function?
On Saturday 16 February 2002 17:14, Dean Householder wrote: I want to run a query like: select * from table order by rand() limit 3 in MySQL it would work but I need to run it in MSSQL. I've been searching for a limit function in MSSQL and I can't find a way to do it. I'm experienced with MySQL but know nothing about MSSQL. If someone could point me in the right direction I would really appreciate it! I think it's TOP in MSSQL. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* Let's remind ourselves that last year's fresh idea is today's cliche. -- Austen Briggs */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] vpopmail Functions
On Saturday 16 February 2002 16:47, Pete Bekisz wrote: Hello, I have read on php.net that the vpopmail functions are available in 4.0.5 and later. However, I have not been able to successfully use then on 4.0.6 or 4.1.0. Is this something that needs to be enabled, or am I doing something incorrectly? PHP needs to be compiled with the vpopmail option. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* The less a statesman amounts to, the more he loves the flag. -- Kin Hubbard */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there an MSSQL limit function?
Is anyone familiar with how exactly to use the TOP command in MSSQL? Is it in it's own SQL query or built into the select query? I'm looking at the help and it doesn't seem very helpful... Dean - Original Message - From: Jason Wong [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, February 16, 2002 2:28 AM Subject: Re: [PHP] Is there an MSSQL limit function? On Saturday 16 February 2002 17:14, Dean Householder wrote: I want to run a query like: select * from table order by rand() limit 3 in MySQL it would work but I need to run it in MSSQL. I've been searching for a limit function in MSSQL and I can't find a way to do it. I'm experienced with MySQL but know nothing about MSSQL. If someone could point me in the right direction I would really appreciate it! I think it's TOP in MSSQL. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* Let's remind ourselves that last year's fresh idea is today's cliche. -- Austen Briggs */ -- 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] Is there an MSSQL limit function?
On Saturday 16 February 2002 17:48, Dean Householder wrote: Is anyone familiar with how exactly to use the TOP command in MSSQL? Is it in it's own SQL query or built into the select query? I'm looking at the help and it doesn't seem very helpful... It's been a while since I last used MS dbs. But I think it goes something like: SELECT * FROM table TOP 5; In fact I checked the help of Access and it is detailed there. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* The primary requisite for any new tax law is for it to exempt enough voters to win the next election. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there an MSSQL limit function?
I figured it out! For benefit of all I'm posting the answer: select top 3 * from table This query will return the top three rows of the table but now I want to them to be random. Once again, in MySQL you could just say order by rand() but that doesn't work in MSSQL. Does anyone know how to do this? Dean - Original Message - From: Jason Wong [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, February 16, 2002 2:54 AM Subject: Re: [PHP] Is there an MSSQL limit function? On Saturday 16 February 2002 17:48, Dean Householder wrote: Is anyone familiar with how exactly to use the TOP command in MSSQL? Is it in it's own SQL query or built into the select query? I'm looking at the help and it doesn't seem very helpful... It's been a while since I last used MS dbs. But I think it goes something like: SELECT * FROM table TOP 5; In fact I checked the help of Access and it is detailed there. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* The primary requisite for any new tax law is for it to exempt enough voters to win the next election. */ -- 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] Is there an MSSQL limit function?
At 05:54 PM 2/16/2002 +0800, Jason Wong wrote: On Saturday 16 February 2002 17:48, Dean Householder wrote: Is anyone familiar with how exactly to use the TOP command in MSSQL? Is it in it's own SQL query or built into the select query? I'm looking at the help and it doesn't seem very helpful... It's been a while since I last used MS dbs. But I think it goes something like: SELECT * FROM table TOP 5; Actually it's SELECT TOP 5 * FROM table; I've had some recent experience attempting to find an equivalent to the LIMIT clause in MSSQL. No one method is really ideal, but here are a couple of ways: 1. Use subselects One method is to use a mixture of the TOP clause along with subselects to get a certain record range out. Let's say that you have a result set and you want to get rows 30-39 (assuming the first row is zero). This is one way: select * from (select top 10 * from (select top 40 * from ... where ... order by ... desc) as ax order by ...) as aa order by ... desc This is pretty odd, but basically what it does is select the top 40 records in reverse order, then from that result set it selects the top 10 (getting records 39-30). The outermost select statement reverses the order again so you get records 30-39. The problem with this method is that it gets slower the higher up in the result set you go. It always has to select as least as many rows as the highest row number you want to get. If your full result set contains 1000 rows, and you need rows 550-560, your statement still has to select at least 560 rows to work. 2. Used a temp table inside a stored procedure This is probably the better solution. Basically what you do is create a stored procedure that selects all of your results into a temp table with an row counter column (field type IDENTITY), and then select the results out of the temp table where (Row = @Start) AND (Row = @End). There is a nice article that explains this method in detail here: http://www.15seconds.com/Issue/010308.htm This isn't really related to paging, just more of a general tip: I have found Sybase's Transact-SQL User's Guide on their website to be very helpful in working with MSSQL. For the most part the syntax is exactly the same, and the site is easy to navigate IMHO. Call me crazy, but I've found it generally more helpful than the Books On-Line. YMMV: http://manuals.sybase.com/onlinebooks/group-as/asg1250e/sqlug/@Generic__BookView -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] modular programming
Dear Steven and Kunal, Agreed with what you had to say. In my experience, 'modular coding' is entirely a process of evolution. It's impossible to sit down and design software on paper. Every piece of code I write is under constant evaluation. Each time a weakness is exposed, I rethink my strategy. Often there is no 'perfect' solution, since each presents a different set of compromises. Devoting yourself to endlessly rewriting and structuring your code will, in the long term, yield better code than anyone can advise in a book or paper. This para gives an impression that modular programming is an iterative process (maybe not Steven's intention). An iterative approach would certainly enable you to improve the quality of your code - at some expense to rethink/re-implement, and such improvements may well occur through changes to the modularisation/interfaces between modules. Modular programming as a philosophy though, starts at the program design stage, not at version two! 'Modular programming' as a concept is quite old (in computer/doggie years). Then there was the whole confusion/absortption/improvement of philosoophies into 'structured programming' - which some will argue is the same and others maintain a difference (I... - who cares!?). The real 'excitement' was stirred up by a paper (which became very famous) called 'GOTO statement considered harmful' and a massive debate erupted as to whether one could write programs without using GOTOs - is there a GOTO command in PHP? The guru at the time was Jackson, and if you plug Jackson structured programming into Google (or your favorite SE) you will be inundated with 'stuff'. He wrote a fairly thin and most readable book on the subject, but I doubt it is still in print (check Amazon etc). In those days it was also known as JSP. Unfortunately that acronym has been also taken for something else more recently. The design process, and if you want them, the pretty diagrams, have been refined and 'improved' over the years, so there's plenty of material about. Most likely it is built into every 'introduction to programming' text (that is, programming as a process, not learning a specific language!) These days of course, much of the philosophy of splitting up a monolithic program into a series of smaller, inter-communicating modules has been absorbed into the object-oriented approach (and various other 'bits' grafted on to make it bigger, brighter, and better - as they have become implemented (and made practical to use) in various programming languages/systems). Unfortunately PHP is designed to output HTML and that is a very procedural process, so PHP has limited OO facilities. Reading up about classes and encapsulation will pretty much take you through modular/structured design theory and if you use other 'modern' (programming) languages then that might be a good move for you (us 'old dogs' can handle the concepts, but seem to have fundamental difficulties with the mechanics of the 'new tricks'). Which brings us back to Steven's third point - that such things can be overdone. Structure (of whichever flavor) is designed to make the coding/debugging/come back and extend/'improve' it later, processes of development more efficient. This is quite separate from execution efficiency. However there is no way one can improve one, and neglect the other - nor should vice-versa be allowed to become an excuse for slapdash coding practices! Some people associate the word 'module' with (in PHP) 'function'. So they think of modular programming as a code that is divided up into a series of subroutines, ie functions/calls. This is overly simplistic. Each WHILE loop (for example) is also a 'module'. It has a particular purpose, contains a set/module of functionality, and has definable beginning and end-points/conditions. Deciding how to best structure your code to suit the process is a question that appears here quite often - how often are we asked something like: 'I have a database listing a series of ... and I want to copy these out to an HTML table with n-columns across the screen' and the neophyte coder is quite confused and wants to know how to handle the (exceptions of) situation? The problem is one of 'structure': the database yields a one-dimensional list of 'whatevers', but the output screen is a table divided into n-columns - and worse, the complication is (handling the exception conditions, for example) that we don't know if the number of db-rows divides evenly between the number of screen-columns. So most start coding and take their 'structure' from the database call, ie a list, and then try to 'share out' the rows across the screen - and get into trouble when it doesn't all fit together neatly (without 'exceptions'). Structured programming suggests that one examines (diagramming) the structure of the input and compare that with the structure of the output format. These two structures should then be 'aligned'. In doing
[PHP] Problem in a user auth script. Advice please.
Hi, After the help given on my last script I got a bit more advanced. I am trying to write a user auth script and start sessions. I wrote this script and ran it and I am getting an error on line 4. Once again I cannot see any problems. I would appriciate you experienced guys casting your eyes over it and pulling up any errors you see in the functionality. Thanks, Matt. script attatched in file user_auth.txt ?php include(../dbconnect.php); include(../functions/common_functions.php): session_start(); if (!isset($login_username)) { ? HTML HEAD META NAME=GENERATOR Content=vi META NAME=Author Content=Matthew Darcy TITLEBathJobs.com User Login/TITLE /HEAD BODY BGCOLOR=#ff LINK=#00 ALINK=#00 VLINK=#00 FONT FACE=Arial Size=4 Color=black P FORM METHOD=post ACTION=?=$PHP_SELF? BRCENTER BathJobs.com Login BRBR TABLE BGCOLOR=#ff BORDER=0 TR BGCOLOR=#191970 TD BGCOLOR=#191970 width=30 height=30 BFONT color=#ff9900UserName/FONT /B /TD TD BGCOLOR=#191970 width=30 height=30 INPUT NAME=login_username SIZE=8 /TD /TR TR TD BGCOLOR=#191970 width=30 height=30 BFONT color=#ff9900Password /FONT /B /TD TD BGCOLOR=#191970 width=30 height=30 INPUT NAME=login_password SIZE=8 /TD /TR /TABLE BR INPUT TYPE=hidden NAME=user_login_submit_button VALUE=submit_login INPUT TYPE=submit NAME=submit_login_details VALUE=Login BR /FORM Pnbsp;/P/CENTER/FORM/FONT /BODY /HTML ?php exit; } session_register(login_username); session_register(login_password); $sql_authorisation = SELECT * FROM account_details WHERE account_name='$login_username' AND account_password=PASSWORD('$login_password'); $sql_authorisation_result = mysql_query($sql_authorisation); if (!$result) { error(A Database Error Occurred while trying to authorise login details \\nIf this problem persists, please contact [EMAIL PROTECTED]); } if (mysql_num_rows($sql_authorisation_result) == 0) { session_unregister(login_username); session_unregister(login_password); ? HTML HEAD TITLE Access Denied /TITLE /HEAD BODY BGCOLOR=white H1 Access Denied /H1 P Your user ID and Password could not be verified. This could be an incorrect username or password, or you are not a registered user on this site. Try logging in again checking your details, or enter the signup process to join bathjobs.com/P /BODY /HTML ?php exit; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] user auth script update.
Found 1 schoold box error AGAIN I ended line 4 with : not ; I am now getting the parse error on line 64 Can anyone review this script and tell me where I am going wrong. Thanks, Matt. SCRIPT START-- ?php include(../dbconnect.php); include(../functions/common_functions.php); session_start(); if (!isset($login_username)) { ? HTML HEAD META NAME=GENERATOR Content=vi META NAME=Author Content=Matthew Darcy TITLEBathJobs.com User Login/TITLE /HEAD BODY BGCOLOR=#ff LINK=#00 ALINK=#00 VLINK=#00 FONT FACE=Arial Size=4 Color=black P FORM METHOD=post ACTION=?=$PHP_SELF? BRCENTER BathJobs.com Login BRBR TABLE BGCOLOR=#ff BORDER=0 TR BGCOLOR=#191970 TD BGCOLOR=#191970 width=30 height=30 BFONT color=#ff9900UserName/FONT /B /TD TD BGCOLOR=#191970 width=30 height=30 INPUT NAME=login_username SIZE=8 /TD /TR TR TD BGCOLOR=#191970 width=30 height=30 BFONT color=#ff9900Password /FONT /B /TD TD BGCOLOR=#191970 width=30 height=30 INPUT NAME=login_password SIZE=8 /TD /TR /TABLE BR INPUT TYPE=hidden NAME=user_login_submit_button VALUE=submit_login INPUT TYPE=submit NAME=submit_login_details VALUE=Login BR /FORM Pnbsp;/P/CENTER/FORM/FONT /BODY /HTML ?php exit; } session_register(login_username); session_register(login_password); $sql_authorisation = SELECT * FROM account_details WHERE account_name='$login_username' AND account_password=PASSWORD('$login_password'); $sql_authorisation_result = mysql_query($sql_authorisation); if (!$sql_authorisation_result) { error(A Database Error Occurred while trying to authorise login details \\nIf this problem persists, please contact [EMAIL PROTECTED]); } if (mysql_num_rows($sql_authorisation_result) == 0) { session_unregister(login_username); session_unregister(login_password); ? HTML HEAD TITLE Access Denied /TITLE /HEAD BODY BGCOLOR=white H1 Access Denied /H1 P Your user ID and Password could not be verified. This could be an incorrect username or password, or you are not a registered user on this site. Try logging in again checking your details, or enter the signup process to join bathjobs.com/P /BODY /HTML ?php exit; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] modular programming
Hey, The entire concept of OOP was based on the data and not the processing :) But, no one has yet addressed the core of my question. How can I make any application plugable? I am trying to create a standard which will work with every other language. A simple example of what I am attempting to do is : I have a guestbook A. I have features in it a. allow public viewing of records b. dont allow publiv viewing of records Now, this is very simply, I could just store the on/off value and then validate agianst that. But when it comes to bigger applications, and more complex situations, where you have to make choices like, allowing the data to be written to a dbase or no, wether it should get processed or no. How does one handle such situations? Regards, Kunal Jhunjhunwala Minds think with ideas, not information. No amount of data, bandwidth, or processing power can substitute for inspired thought. - Clifford Stoll - Original Message - From: DL Neil [EMAIL PROTECTED] To: Kunal Jhunjhunwala [EMAIL PROTECTED]; Steven Walker [EMAIL PROTECTED] Cc: php-list [EMAIL PROTECTED] Sent: Saturday, February 16, 2002 4:10 PM Subject: Re: [PHP] modular programming Dear Steven and Kunal, Agreed with what you had to say. In my experience, 'modular coding' is entirely a process of evolution. It's impossible to sit down and design software on paper. Every piece of code I write is under constant evaluation. Each time a weakness is exposed, I rethink my strategy. Often there is no 'perfect' solution, since each presents a different set of compromises. Devoting yourself to endlessly rewriting and structuring your code will, in the long term, yield better code than anyone can advise in a book or paper. This para gives an impression that modular programming is an iterative process (maybe not Steven's intention). An iterative approach would certainly enable you to improve the quality of your code - at some expense to rethink/re-implement, and such improvements may well occur through changes to the modularisation/interfaces between modules. Modular programming as a philosophy though, starts at the program design stage, not at version two! 'Modular programming' as a concept is quite old (in computer/doggie years). Then there was the whole confusion/absortption/improvement of philosoophies into 'structured programming' - which some will argue is the same and others maintain a difference (I... - who cares!?). The real 'excitement' was stirred up by a paper (which became very famous) called 'GOTO statement considered harmful' and a massive debate erupted as to whether one could write programs without using GOTOs - is there a GOTO command in PHP? The guru at the time was Jackson, and if you plug Jackson structured programming into Google (or your favorite SE) you will be inundated with 'stuff'. He wrote a fairly thin and most readable book on the subject, but I doubt it is still in print (check Amazon etc). In those days it was also known as JSP. Unfortunately that acronym has been also taken for something else more recently. The design process, and if you want them, the pretty diagrams, have been refined and 'improved' over the years, so there's plenty of material about. Most likely it is built into every 'introduction to programming' text (that is, programming as a process, not learning a specific language!) These days of course, much of the philosophy of splitting up a monolithic program into a series of smaller, inter-communicating modules has been absorbed into the object-oriented approach (and various other 'bits' grafted on to make it bigger, brighter, and better - as they have become implemented (and made practical to use) in various programming languages/systems). Unfortunately PHP is designed to output HTML and that is a very procedural process, so PHP has limited OO facilities. Reading up about classes and encapsulation will pretty much take you through modular/structured design theory and if you use other 'modern' (programming) languages then that might be a good move for you (us 'old dogs' can handle the concepts, but seem to have fundamental difficulties with the mechanics of the 'new tricks'). Which brings us back to Steven's third point - that such things can be overdone. Structure (of whichever flavor) is designed to make the coding/debugging/come back and extend/'improve' it later, processes of development more efficient. This is quite separate from execution efficiency. However there is no way one can improve one, and neglect the other - nor should vice-versa be allowed to become an excuse for slapdash coding practices! Some people associate the word 'module' with (in PHP) 'function'. So they think of modular programming as a code that is divided up into a series of subroutines, ie functions/calls. This is overly simplistic. Each WHILE loop (for example) is also a 'module'. It has a particular purpose, contains a set/module of functionality, and has
[PHP] not really a php question but can't hurt to ask.
I have apache compiled and working %100. I have www.mydomain.com when I visit thie domain apache loads index.html for my by default - wo my browser displays www.mydomain.com - but the page viewed is www.mydomain.com/index.html I updated index.html (did not touch any apache configuration) added some text etc Now when I visit www.mydomain.com I get page not found however if I visit www.mydomain.com/index.html I get the updated page. I go to my linux server and view www.mydomain.com and it works fine ?? Any ideas ? thanks, Matt. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] user auth script update.
I am now getting the parse error on line 64 $sql_authorisation = SELECT * FROM account_details WHERE account_name='$login_username' AND account_password=PASSWORD('$login_password'); You're missing the closing on the last line above. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Generating PDF documents
Hi, is there someone who can give me some tips to rotate a text-box with pdf-lib functions? I've tried with pdf_rotate(...), but i've been not able to write a thing in other ways than horizontal. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] not really a php question but can't hurt to ask.
got the apache thing sussed. For some reason windows using ie takes doesn't see changed on the apache webserver as quick as linux ??? -Original Message- From: Matthew Darcy [mailto:[EMAIL PROTECTED]] Sent: 16 February 2002 11:58 To: PHP developers Subject: [PHP] not really a php question but can't hurt to ask. I have apache compiled and working %100. I have www.mydomain.com when I visit thie domain apache loads index.html for my by default - wo my browser displays www.mydomain.com - but the page viewed is www.mydomain.com/index.html I updated index.html (did not touch any apache configuration) added some text etc Now when I visit www.mydomain.com I get page not found however if I visit www.mydomain.com/index.html I get the updated page. I go to my linux server and view www.mydomain.com and it works fine ?? Any ideas ? thanks, Matt. -- 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] not really a php question but can't hurt to ask.
Turn caching off in IE while you're developing ... or hit refresh so you get the new page. - Original Message - From: Matthew Darcy [EMAIL PROTECTED] For some reason windows using ie takes doesn't see changed on the apache webserver as quick as linux ??? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] user auth script update.
never mind Matt, I noticed the missin ); on line 65 Thanks for your help. Matt. -Original Message- From: Matt [mailto:[EMAIL PROTECTED]] Sent: 16 February 2002 12:05 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] user auth script update. I am now getting the parse error on line 64 $sql_authorisation = SELECT * FROM account_details WHERE account_name='$login_username' AND account_password=PASSWORD('$login_password'); You're missing the closing on the last line above. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] zipping files on the fly
Hey, I am trying to zip an entire directory and its contents on the fly. Any tips or codes snippets for doing something like this? The one at zend doesnt seem to be working for me :( Regards, Kunal Jhunjhunwala Minds think with ideas, not information. No amount of data, bandwidth, or processing power can substitute for inspired thought. - Clifford Stoll -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions that last for ever
By default, a session (created with session_register) seems to last just as long as the user has their browser open. If a user quits the browser, the session is automatically destroyed. I want a session to last indefinitely (or until my program destroys it). There are some hints about how this could be done with cookies in the documentation, but not a clear recipe. What sequence of PHP statements should I use to achieve this? Thanks for any help, Nigel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] modular programming
Hey Kunal, The entire concept of OOP was based on the data and not the processing :) No, this seems too much of a simplification. In the 'good old days' we used to design a program by using a flowchart. Such is an entirely procedural/code-based approach. Each of the philosophies that followed/developed from there, suggested that we should pay (more) attention to the data (and its structure/characteristics). However none is exclusively based on the data and not the processing. You need to consider both and not one at the expense of the other... This point was emphasised by an earlier correspondent! But, no one has yet addressed the core of my question. What do you mean? Here is the original question: - does anyone know of any good papers on modular programing? I have been able to make my code modular, but I am not satisfied with it. I am trying to make my program work the plug in way.. where i can just add more modules on the fly... any tips? :) - Which bits were addressable by someone else, and which parts are very much restricted by knowledge only in your head? The add more modules on the fly was such a mixture of terminology/buzz-words as to sound Superman-futuristic!? (include files possibly?) Two suggestions: - do the reading and sort out your approach, then roll forward into the specific application/review its design/modularity etc - address a specific situation (as below) by describing your objectives for it, the necessary parameters, what you have done so far, etc Don't muddle the entire process of LEARNING about a philosophy/approach, with 'fixing' a specific piece of code. How can I make any application plugable? I am trying to create a standard which will work with every other language. A simple example of what I am attempting to do is : I have a guestbook A. I have features in it a. allow public viewing of records b. dont allow publiv viewing of records Now, this is very simply, I could just store the on/off value and then validate agianst that. But when it comes to bigger applications, and more complex situations, where you have to make choices like, allowing the data to be written to a dbase or no, wether it should get processed or no. How does one handle such situations? What's wrong with your 'guestbook' solution? If you're not satisfied, start a new conversational thread (ie with a more descriptive title) because there are many experienced 'guest bookers' on the list, who will be more than capable/happy to share ideas/experience. The philosophies behind modular programming, structured programming, and object-oriented programming all unite in the realisation that bigger applications and more complex situations can be rendered to be collections of smaller and less complex 'units' that can be individually programmed (and tested) as 'simple solutions', and then combined together to provide size, complexity, and power. (and so we're back to doing a bit of reading up on/absorbing the subject!) Regards, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The ASP application object in PHP?
Peter J. Schoenster wrote: to all instances and sessions. It is for example very useful to track different users at the same time, or to send messages from one session to another, or the likes. Well it started from the above where some guy said this magic could track users. I assumed the cookies and if it's tracking users it uses a session id in the url or a cookie, I know of no other way and would really appreciate the education. Tom Rogers wrote: - it is data specific to the total application itself. But how does it carry from one click to the next? I don't believe the original poster you quote really had/has a firm grasp on what it actually does. The tried and true example is a hit counter. No matter who hits a page, if that page increases an application variable called counter for example, the counter keeps going up. You hit it and it has a value of 1. Then I hit the page and it has a value of 2. The bob hits it and it has a value of 3. And so on. There's no messaging from one session to another, though I don't doubt you could architect some code to operate like that. It's like a 'session' state that's not specific to any one user - a 'commons' area, if you like. Does that help? Also, a second draft of this info, along with a bit of code example in PHP, is in a PDF at http://demo.logicreate.com/index.php/filemgt/main/event=view/pkey=6/phpfaq.pdf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 16 Feb 2002 13:34:08 -0000 Issue 1175
php-general Digest 16 Feb 2002 13:34:08 - Issue 1175 Topics (messages 84990 through 85029): Re: The ASP application object in PHP? 84990 by: Michael Sims 84994 by: Tom Rogers 84995 by: michael kimsal 84997 by: Joshua Hoover 84998 by: Tom Rogers 85004 by: Peter J. Schoenster 85029 by: michael kimsal Re: scheduled tasks 84991 by: Michael Sims PHP phone consultations :) 84992 by: michael kimsal extract nouns 84993 by: Heiko Spallek modular programming 84996 by: Kunal Jhunjhunwala 85001 by: Steven Walker 85003 by: Kunal Jhunjhunwala 85005 by: Eugene Lee 85006 by: Peter Janett 85016 by: DL Neil 85019 by: Kunal Jhunjhunwala 85028 by: DL Neil Re: COOKIE HEADER 84999 by: Michael Sims suscribir 85000 by: MAURICIO Sessions and templating help 85002 by: Justin Deutsch Outputing XML to browser??? 85007 by: Jim Hankins vpopmail Functions 85008 by: Pete Bekisz 85011 by: Jason Wong Is there an MSSQL limit function? 85009 by: Dean Householder 85010 by: Jason Wong 85012 by: Dean Householder 85013 by: Jason Wong 85014 by: Dean Householder 85015 by: Michael Sims Problem in a user auth script. Advice please. 85017 by: Matthew Darcy user auth script update. 85018 by: Matthew Darcy 85021 by: Matt 85025 by: Matthew Darcy not really a php question but can't hurt to ask. 85020 by: Matthew Darcy 85023 by: Matthew Darcy 85024 by: Matt Generating PDF documents 85022 by: Alberto Pirovano zipping files on the fly 85026 by: Kunal Jhunjhunwala Sessions that last for ever 85027 by: Nigel Gilbert Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- At 02:21 PM 2/15/2002 -0500, Michael Kimsal wrote: I've been here all along! :) Seriously, we cover some of this in our class as well, and at our monthly PHP user group meetings. I'm actually writing up a small paper on this and other topics. If you're interested in it, let me know. I can also be reached at 734-480-9961 if you've questions that might be faster talking about than emailing, and my AIM is 'mgkimsal' is you're on that and need some help. That goes for anyone else on the list too... OMG you may end up regretting that. I'm putting you on my speed dial right now... :-P Yeah, it's not toll-free but as They say it's free if you call from work ---End Message--- ---BeginMessage--- Hi It uses cookies and only cookies and it seems that sessions are started on every access but can be turned off on individual pages if required. Tom At 07:44 AM 2/16/02, Peter J. Schoenster wrote: On 15 Feb 2002, at 14:43, Bendik Simonsen wrote: I have however, noticed one feature that ASP has that I have not found an equal for in PHP: the application object. For those of you not familiar with ASP, the lowdown is this: The application object acts like a global session. You assign it variables and values like you would a session, but those variables are available to all instances and sessions. It is for example very useful to track different users at the same time, or to send messages from one session to another, or the likes. Anything like this in PHP, or will I have to find a workaround for it, or *ick* do that little sniplet in ASP? Well how does it work? Is it advertised as M$ magic in the class? Is http not stateless? I don't follow your description and I don't believe in magic. Is it using cookies? If not what? It must be using something? I bet it's using cookies. Sounds a lot like what you normally do with sessions. I don't follow the send message from one session to another ... is this not just normal course for sessions? I'd like more explanation before I believe that this is any more than just a module. Peter http://www.readbrazil.com/ Answering Your Questions About Brazil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- Tom Rogers wrote: Hi It uses cookies and only cookies and it seems that sessions are started on every access but can be turned off on individual pages if required. Tom Sorry Tom, but the application object has nothing to do with cookies. It is a 'global' session, for lack of a better term, and doesn't need to concern itself with cookies or other means of identifying specific users, because nothing in the application object is specific to users - it is data specific to the total application itself. You may be thinking of sessions themselves - the
[PHP] php blocking functions
Hello everyone, I am searching for an alternate way to accomplish user synchronization. I would like two or more users to block on the read of some stream, so that when one person writes to it, the other person(s) will read it. The only way I currently know to do this is with the socket functions. However, this poses a small problem. If I use the socket functions, I have to keep a script running on the server at all times. I would really like to have users block at the end of a file until new information is appended. I certainly don't want to have all my clients sit in infinite while loops, and I'm sure my isp doesn't either. I may be shit out of luck anyway, if they are killing processes that run for too long. I appreciate any and all suggestions. If someone knows exactly which functions block, aside from the socket functions, could you please tell me? Thank you. Respectfully, Chad
[PHP] Text editor for linux
Anyone know of a good text editor for linux, WITH syntax highlighting for php/html + other languages? - TOrkil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] LINUX distrib of PHP different to windows?
Hi there, I just installed my first linux box and I have problems on configuring php for my needs. It does not matter what I do to php.ini, nothing is changing. And yes, I did restart apache. I thought php4.1.1 comes with gd2.0 build in, like on windows distrib. but it does not. I compiled php4.1.1 with mysql support and thought thats it. But no! There is no gd version. So I did compile the one from boutel.com and put it into the propper dir changed php.ini but still the same! Thanx for any help Cheers Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] modular programming
Hey DN, The Guestbook was an example of what im trying to do. I am NOT coding a guest book... Regards, Kunal Jhunjhunwala Minds think with ideas, not information. No amount of data, bandwidth, or processing power can substitute for inspired thought. - Clifford Stoll - Original Message - From: DL Neil [EMAIL PROTECTED] To: Kunal Jhunjhunwala [EMAIL PROTECTED]; php-list [EMAIL PROTECTED] Sent: Saturday, February 16, 2002 6:17 PM Subject: Re: [PHP] modular programming Hey Kunal, The entire concept of OOP was based on the data and not the processing :) No, this seems too much of a simplification. In the 'good old days' we used to design a program by using a flowchart. Such is an entirely procedural/code-based approach. Each of the philosophies that followed/developed from there, suggested that we should pay (more) attention to the data (and its structure/characteristics). However none is exclusively based on the data and not the processing. You need to consider both and not one at the expense of the other... This point was emphasised by an earlier correspondent! But, no one has yet addressed the core of my question. What do you mean? Here is the original question: - does anyone know of any good papers on modular programing? I have been able to make my code modular, but I am not satisfied with it. I am trying to make my program work the plug in way.. where i can just add more modules on the fly... any tips? :) - Which bits were addressable by someone else, and which parts are very much restricted by knowledge only in your head? The add more modules on the fly was such a mixture of terminology/buzz-words as to sound Superman-futuristic!? (include files possibly?) Two suggestions: - do the reading and sort out your approach, then roll forward into the specific application/review its design/modularity etc - address a specific situation (as below) by describing your objectives for it, the necessary parameters, what you have done so far, etc Don't muddle the entire process of LEARNING about a philosophy/approach, with 'fixing' a specific piece of code. How can I make any application plugable? I am trying to create a standard which will work with every other language. A simple example of what I am attempting to do is : I have a guestbook A. I have features in it a. allow public viewing of records b. dont allow publiv viewing of records Now, this is very simply, I could just store the on/off value and then validate agianst that. But when it comes to bigger applications, and more complex situations, where you have to make choices like, allowing the data to be written to a dbase or no, wether it should get processed or no. How does one handle such situations? What's wrong with your 'guestbook' solution? If you're not satisfied, start a new conversational thread (ie with a more descriptive title) because there are many experienced 'guest bookers' on the list, who will be more than capable/happy to share ideas/experience. The philosophies behind modular programming, structured programming, and object-oriented programming all unite in the realisation that bigger applications and more complex situations can be rendered to be collections of smaller and less complex 'units' that can be individually programmed (and tested) as 'simple solutions', and then combined together to provide size, complexity, and power. (and so we're back to doing a bit of reading up on/absorbing the subject!) Regards, =dn -- 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] Text editor for linux
there is a way of using vi/vim to highlight syntax with PHP and HTML. I am playing with it at the moment. Matt, -Original Message- From: Torkil Johnsen [mailto:[EMAIL PROTECTED]] Sent: 16 February 2002 13:45 To: [EMAIL PROTECTED] Subject: [PHP] Text editor for linux Anyone know of a good text editor for linux, WITH syntax highlighting for php/html + other languages? - TOrkil -- 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: Sessions that last for ever
I think changing a setting in php.ini will do it, I'm just not sure which one. session.cache_expire seems like it might do something, or maybe session.gc_maxlifetime. Look them up in the manual -Original Message- From: Nigel Gilbert [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 16, 2002 7:44 AM To: [EMAIL PROTECTED] Subject: Sessions that last for ever By default, a session (created with session_register) seems to last just as long as the user has their browser open. If a user quits the browser, the session is automatically destroyed. I want a session to last indefinitely (or until my program destroys it). There are some hints about how this could be done with cookies in the documentation, but not a clear recipe. What sequence of PHP statements should I use to achieve this? Thanks for any help, Nigel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Sessions and templating help
Hi Justin, are you using ?php session_start(); ? at the top of every page you want to keep the session? Cheers, Joe :) Justin Deutsch [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi All, I am running Apache with PHP4 as a module. I have also written a script (template.php) that sets up the default envrionment, like the CSS and navigation etc. The script also reads in a file, as defined by the ?path= of the URL. The file it reads in must have the sections (includes, header and body, as defined by /*** ***/ and /*** end ***/ pairs). The file is the split into these sections and along with the templated bits of the page compile into a single string which is the executed using the eval(). Now this all works fine, but I also want to use sessions. The first session from the index.html file, which is first acessed as a login page, stores the player class fine, but when I go to the next page (player_login.html) I seem to loose the session. You might ask why I don't just use an existing templating system, well it's because I think that you should only have to write the template once and not have to touch it again. The templating systems I have come across force you to include a file at the top and bottom of the code you are writing. The one down side to the way I am doing it is that I have had to force the other file into a include, header and body section, but this is a trivial formatting issue. Is there something I'm missing? I have included the code for the three scripts below. template.php ?PHP /* * This script is the basis for a templaing engine. The engine uses the * rewrite feature of the web server to capture the Virtual URL that the * user wants and maps it to this script with a paraeter. This script * then sets up the template and includes the content from the file * indicated by the user. * * A directory structure containing tall of the content is required, and * with Apache a directory to map from. */ /* Put setup here */ require_once(site-config.php); require_once(html_header.php); require_once(html_footer.php); require_once(misc_function.php); /* Set up some defaults */ $title = ; $body = ; $page = ; $file_read = false; $file_content = ; unset($content_header); /* Read the contents of a file into a string */ function read_file($filename) { global $file_read; global $file_content; $file_content = ; $file_read = false; //print $filename\n\nbrbr; if(file_exists($filename)) { $page_code = file($filename); foreach ($page_code as $line) { $file_content .= $line; } //print $file_content; $file_read = true; } else { $file_content = ' h1File Not Found/h1 pCould not find ?=$filename?, please let the Web Administrator know/p '; } } /* Get the index information */ read_file($NAV_COLUMN); $navigation = $file_content; /* * garentee that if the user gives no file name then they will get the * index file */ if(strcmp(basename($path), ) == 0) { if(!preg_match(/\/$/, $path)) { $path .= /; } $path .= index.html; } /* Get the Header information and the content of the body */ $file_name = $CONTENT_PATH/$path; read_file($file_name); if($file_read) { //print $file_name; /* Grab the HTTP header stuff from the file. This includes any * session information. * * The header section is defined by * *** header *** and *** end header *** at the start of the * file. */ $section = preg_split(/\s*\*{3}\s*end\s*header\s*\*{3}\s*/im, $file_content, 2 ); if(count($section) == 2) { $content_header = $section[0]; $content_header = preg_replace(/\*{3}\s*header\s*\*{3}/im, , $content_header, 1 ); $body = $section[1]; /* get the includes section */ $section = preg_split(/\s*\*{3}\s*end\s*includes\s*\*{3}\s*/im, $content_header, 2 ); if(count($section) == 2) { $include_files = $section[0]; $include_files = preg_replace(/\*{3}\s*includes\s*\*{3}/im, , $include_files, 1 ); $content_header = $section[1]; } } else { $body = $section[0]; } } else { $body = $file_content; } if(isset($include_files)) { $page .= $include_files.\n; } $page .= '?PHP /* * Start of Template code */ /* include state management here in an if to see if it is wanted */ if(defined($KEEP_STATE) $KEEP_STATE) { session_start(); } /* Set up the headers and footers */ header(Expires: Mon, 26 Jul 1997 05:00:00 GMT); header(Last-Modified: . gmdate(D, d M Y H:i:s) . GMT); header(Cache-Control: no-store, no-cache, must-revalidate); header(Cache-Control: post-check=0, pre-check=0, false); header(Pragma: no-cache); /* keep state = '.$KEEP_STATE.' */ ? '; if(isset($content_header)) { $page .= $content_header.\n; } $page .= ' ?PHP /* * Start of Template code section */ $header = new html_header($title); $footer = new html_footer(); $header-display() ?'.\n; //$header-display(); //print h1:$title/h1; /* print
Re: [PHP] scheduled tasks
Is currently anyway of doing scheduled tasks with PHP (without using crontab)? What's wrong with using cron? I'm building an OSS site where the PostgreSQL data base maintenance, email sending, stats gathering, number crunching and graph plotting needs to be automated. My target audience will need things as simple as possible. I am under the impression that it would be a hassle and cost more to get a web host to install a cron script for Postgres. (Or have php as an executable binary instead of shared object.) What I do so far is look at a serial number from a data base table. If it is divisible by 20, I fill up a graph plotting que. If divisible by 50, another que is filled, etc. The footer has a script that checks a table with each que status and then does does a few things out of the highest priority que. I figure the user will not notice a few small scripts running after all the text is displayed. If there is a better way, let me know!! Thanks, Jeff
[PHP] Re: Sessions that last for ever
Hi Nigel, you could set a cookie once they enter your site, and check at the top of each page you want accessible with this variable to see if they have it or not. Joe :) Nigel Gilbert [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... By default, a session (created with session_register) seems to last just as long as the user has their browser open. If a user quits the browser, the session is automatically destroyed. I want a session to last indefinitely (or until my program destroys it). There are some hints about how this could be done with cookies in the documentation, but not a clear recipe. What sequence of PHP statements should I use to achieve this? Thanks for any help, Nigel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] My Session don't expire
Hi list, I'm using IE5 on Mac with MacOS 9.2.2. I've made a script that use session_register(), but even when I quit the browser the values registered with session still there. Ex: I run the script, quit the browser, reopen it and do an echo($myvar) and, the value is there, didn't expire. How can I correct this??? Thank's in advance Rodrigo Peres -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] scheduled tasks
At 06:41 AM 2/16/2002 -0800, [EMAIL PROTECTED] wrote: Is currently anyway of doing scheduled tasks with PHP (without using crontab)? What's wrong with using cron? I'm building an OSS site where the PostgreSQL data base maintenance, email sending, stats gathering, number crunching and graph plotting needs to be automated. My target audience will need things as simple as possible. I am under the impression that it would be a hassle and cost more to get a web host to install a cron script for Postgres. (Or have php as an executable binary instead of shared object.) If the web host gives you access to a shell account then you could setup the script...you wouldn't need them to do it. You could build a copy of PHP as an executable in your home directory and run it from there, no need to get the host to do it. Or there are a few ways that you could schedule the task remotely...use a cron job from another server that either runs the PHP script locally, connecting to the SQL database remotely, or you can use a cron job and lynx to call a remote PHP page that will run your script. Of course, this requires your script to be in your web servers directory tree, but if security is a concern you could always setup a .htaccess file to challenge for credentials then use the -auth switch to lynx in your remote script. It's not the most secure thing in the world, but it's better than nothing... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] My Session don't expire
Maybe the content of the page is cached. Try to reload/to clear the cache of the browser. Best regards, Andrey Hristov - Original Message - From: Rodrigo Peres [EMAIL PROTECTED] To: PHP [EMAIL PROTECTED] Sent: Saturday, February 16, 2002 4:50 PM Subject: [PHP] My Session don't expire Hi list, I'm using IE5 on Mac with MacOS 9.2.2. I've made a script that use session_register(), but even when I quit the browser the values registered with session still there. Ex: I run the script, quit the browser, reopen it and do an echo($myvar) and, the value is there, didn't expire. How can I correct this??? Thank's in advance Rodrigo Peres -- -- 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: Outputing XML to browser???
Hello! From my understanding of your question, I'd say that you'll have to configure Apache so that it calls PHP for XML-files, too. You can set this up in your either .htaccess files or in your Apache config file (- see the docs, I don't know exactly 'cos I'm using IIS/5.0 with Win2k). This is what I use for on my ISPs virtual web server: AddType x-mapp-php4 .xml AddType x-mapp-php4 .xhtml DirectoryIndex index.xml index.xhtml IndexIgnore .htaccess .htpasswd The ?php [...] ? - tags should then be processed _before_ the browser. An alternative to using XML is using XHTML 1.0 (either transitional or strict) in your .html - files: ?xml version=1.0 encoding=utf-8? !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en head/head body/body /html Don't forget to end your empty tags with / instead of , like this: br / Hope it helps, regards, -- Christian Blichmann _ don't hesitate - email me with your thoughts: e-mail: [EMAIL PROTECTED] - please remove the .nospam from address. _ do you want to know more? web:http://www.blichmann.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Outputing XML to browser???
Whoops, sent you a wrong .htaccess - file, here's what I really use (the other one was old): AddType application/x-httpd-php .php .php4 .htm .html .xml .xhtml DirectoryIndex index.xml index.xhtml IndexIgnore .htaccess .htpasswd -- Christian Blichmann _ don't hesitate - email me with your thoughts: e-mail: [EMAIL PROTECTED] - please remove the .nospam from address. _ do you want to know more? web:http://www.blichmann.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Text editor for linux
I am using Komodo from Active State. http://www.activestate.com It runs in windows and Linux. On Sat, 2002-02-16 at 09:17, Matthew Darcy wrote: there is a way of using vi/vim to highlight syntax with PHP and HTML. I am playing with it at the moment. Matt, -Original Message- From: Torkil Johnsen [mailto:[EMAIL PROTECTED]] Sent: 16 February 2002 13:45 To: [EMAIL PROTECTED] Subject: [PHP] Text editor for linux Anyone know of a good text editor for linux, WITH syntax highlighting for php/html + other languages? - TOrkil -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems with Cookies
Rite, a user logs in at http://localhost/employers/login.php and PHP sets a cookie, eusername, that has his username, funnily enough. then he clicks on to the /employers/search.php, submits his query and clicks on the page of http://localhost/freelancers/some_guy/index.php When I have a bit of PHP code at the top of /some_guy/index.php that check if an employer is looking at this site. ? if ($eusername ){ do this; } ? But PHP keeps telling me that eusername IS equal to and no employer is logged in, when they're definately is. WHY?? Has it something to do with the scope of cookies?? Because when I check if eusername exists in a page in the employers directory, it works fine. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problems with Cookies
email me if you dont understand something about my question. I read it back to myself, and it all sounds so complicated! TIA Georgie Casey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Rite, a user logs in at http://localhost/employers/login.php and PHP sets a cookie, eusername, that has his username, funnily enough. then he clicks on to the /employers/search.php, submits his query and clicks on the page of http://localhost/freelancers/some_guy/index.php When I have a bit of PHP code at the top of /some_guy/index.php that check if an employer is looking at this site. ? if ($eusername ){ do this; } ? But PHP keeps telling me that eusername IS equal to and no employer is logged in, when they're definately is. WHY?? Has it something to do with the scope of cookies?? Because when I check if eusername exists in a page in the employers directory, it works fine. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Tricky variable question! Impossible??
Hi guys, I am not sure if this is possible. Not on my knowledge, but maybe someone is smarter than I am :-) I want to pass an icon to a function. Therefore I am putting all the html into a var called icon. Inside this html their is another variable with an array which value is set inside the function. How can I pass this html thing and ensure that the variable is gonna be set? Take a look at the code underneath. Like that it is just printing out $picture_id[$i] $icon_1 = a href=\index.php?fuseaction=editaction=deleteid=%s\ onclick=\return confirm('Are you sure you want to delete picture no: $picture_id[$i]');\ img src=\../app_global/pics/delete.gif\ width=20 height=20 border=0 alt=\delete\ /a; Can anybody help on this? Thanx for any help Cheers Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The ASP application object in PHP?
On 16 Feb 2002, at 8:37, michael kimsal wrote: I don't believe the original poster you quote really had/has a firm grasp on what it actually does. The tried and true example is a hit counter. No matter who hits a page, if that page increases an application variable called counter for example, the counter keeps going up. You hit it and it has a value of 1. Then I hit the page and it has a value of 2. The bob hits it and it has a value of 3. And so on. There's no messaging from one session to another, though I don't doubt you could architect some code to operate like that. It's like a 'session' state that's not specific to any one user - a 'commons' area, if you like. Does that help? Also, a second draft of this info, along with a bit of code example in PHP, is in a PDF at http://demo.logicreate.com/index.php/filemgt/main/event=view/pkey=6/ph pfaq.pdf Yes, I responded to quickly as after reading someone else's response to one of your emails it became clear the original poster was mistaken. Thanks for the clarification. Peter http://www.readbrazil.com/ Answering Your Questions About Brazil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] LINUX distrib of PHP different to windows?
On Sat, 2002-02-16 at 05:55, Andy wrote: Hi there, I just installed my first linux box and I have problems on configuring php for my needs. It does not matter what I do to php.ini, nothing is changing. And yes, I did restart apache. I thought php4.1.1 comes with gd2.0 build in, like on windows distrib. but it does not. I Well, we don't distribute *nix binaries, so nothing comes 'built in' per se--you have to select which extensions to build at configure time. The GD extension source is included, though. compiled php4.1.1 with mysql support and But not with GD support, I take it? shanna% ./configure --help | grep gd --with-gdbm[=DIR] Include GDBM support --with-gd[=DIR] Include GD support (DIR is GD's install dir). --enable-gd-native-ttfGD: Enable TrueType string function. Granted, this should be in the docs. Torben thought thats it. But no! There is no gd version. So I did compile the one from boutel.com and put it into the propper dir changed php.ini but still the same! Thanx for any help Cheers Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Torben Wilson [EMAIL PROTECTED] http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tricky variable question! Impossible??
Well, as long as you use double quotes: the variables will be parsed inside you statement... single quotes however mean the exact string... example: $icon = 1.jpg; $str = this is the image $icon; $str2 = 'this is the image $icon'; print $str; // returns: this is the image 1.jpg print $str2; // returns: this is the image $icon Greets, Edward - Original Message - From: Andy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, February 16, 2002 6:03 PM Subject: [PHP] Tricky variable question! Impossible?? Hi guys, I am not sure if this is possible. Not on my knowledge, but maybe someone is smarter than I am :-) I want to pass an icon to a function. Therefore I am putting all the html into a var called icon. Inside this html their is another variable with an array which value is set inside the function. How can I pass this html thing and ensure that the variable is gonna be set? Take a look at the code underneath. Like that it is just printing out $picture_id[$i] $icon_1 = a href=\index.php?fuseaction=editaction=deleteid=%s\ onclick=\return confirm('Are you sure you want to delete picture no: $picture_id[$i]');\ img src=\../app_global/pics/delete.gif\ width=20 height=20 border=0 alt=\delete\ /a; Can anybody help on this? Thanx for any help Cheers Andy -- 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: Outputing XML to browser???
Christian, never mind, my fault. It's working beauthifully now. Thanks so much for the help! Save my weekend! Jim Jim Hankins [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Christian, when I changed the AddType to include .htm .html .xml and .xhtml now even if I don't have any php content in the file, it displays as plain text instead of xml, the files have an xml ext. Any ideas? Christian Blichmann [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Whoops, sent you a wrong .htaccess - file, here's what I really use (the other one was old): AddType application/x-httpd-php .php .php4 .htm .html .xml .xhtml DirectoryIndex index.xml index.xhtml IndexIgnore .htaccess .htpasswd -- Christian Blichmann _ don't hesitate - email me with your thoughts: e-mail: [EMAIL PROTECTED] - please remove the .nospam from address. _ do you want to know more? web:http://www.blichmann.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Help Requested
Hello =) I have a template stored in a database which contains variables. Then, in a separate file, I have the variables set, and I call the template and run it through eval(). Unfortunately, it only is parsing a few of them. Could somebody take a look and give me some input? Thanks -- Script: http://penfieldsocrates.org/test.php -- Script Source: http://penfieldsocrates.org/test.txt -- Template: http://penfieldsocrates.org/from_db.txt (need to view source)
[PHP] Re: Outputing XML to browser???
OK so it's not working. I was having cache issues, so it now displays as text instead of xml but does process the ?php ? commands. I'm close, any ideas what I need to do? Do I need to now place some kind of header in all my xml files or is there some type of apache config that needs changing? Now all xml displays as text even if I don't use php commands. I assume because of the ext is getting process before the mime type text/xml line or something? Jim Hankins [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Christian, never mind, my fault. It's working beauthifully now. Thanks so much for the help! Save my weekend! Jim Jim Hankins [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Christian, when I changed the AddType to include .htm .html .xml and .xhtml now even if I don't have any php content in the file, it displays as plain text instead of xml, the files have an xml ext. Any ideas? Christian Blichmann [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Whoops, sent you a wrong .htaccess - file, here's what I really use (the other one was old): AddType application/x-httpd-php .php .php4 .htm .html .xml .xhtml DirectoryIndex index.xml index.xhtml IndexIgnore .htaccess .htpasswd -- Christian Blichmann _ don't hesitate - email me with your thoughts: e-mail: [EMAIL PROTECTED] - please remove the .nospam from address. _ do you want to know more? web:http://www.blichmann.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Change gif image with php
Hi list I have some buttons made in photoshop in .gif format. This buttons have round corner, feather, multiple colors etc. There's a way to open it with php and write some text to it. I know that is possible to create images, but what about to change them??? I need to do this because the text that will fill the buttons come from mysql and change everyday. Thank's in advance Rodrigo ps: If someone want to see the button I'm talking look in http://www.celebnet.com.br/home.php under the AS ++. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions that last for ever
On Saturday, February 16, 2002, at 07:43 AM, Nigel Gilbert wrote: By default, a session (created with session_register) seems to last just as long as the user has their browser open. If a user quits the browser, the session is automatically destroyed. I want a session to last indefinitely (or until my program destroys it). There are some hints about how this could be done with cookies in the documentation, but not a clear recipe. What sequence of PHP statements should I use to achieve this? I don't have the answer you're looking for (maybe it's a php.ini setting), but I suspect that it might be a dangerous idea. The longer a session ID is hanging about, the easier it is for a cracker to hijack it and use it for evil intent. Remember, every time a page is requested within any given session, either a cookie variable or a GET variable is being sent along with the HTTP headers. Keeping a session going for more time than needed means that the variable representing the session ID is leaving footprints all over the place. Erik -- who has become overcautious lately upon learning how HTTP works Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] scheduled tasks
On Friday, February 15, 2002, at 03:03 PM, Rodney Davis wrote: Is currently anyway of doing scheduled tasks with PHP (without using crontab)? For example, using an email script to send out e-mail reminders every Monday or something like that? One way to do it (stole this from my 'Beginning PHP' book [Wrox]): Store the current timestamp into a file. Read this file every time some commonly-used feature of your site is executed. Then, when X number of seconds has passed beyond the timestamp, execute some other code: $countfile = ./countfile.txt; $fp = fopen($countfile, 'r+'); $oldtime = fread($fp); if ((time()) = ($oldtime + 24 * 60 * 60 * 7)) { // a week has passed since the last time the file was written to // execute the code (mail or whatever) } rewind($fp); fwrite($fp, time()); fclose($fp); or something like that. NB this code is definitely untested, so it probably won't work, but the theory is there. Also, be sure to take into account the security issues of having a file writeable by your web server -- I'm assuming you already have experience with this. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Change gif image with php
button.php ?php Header(Content-type: image/gif); $string=str_replace(%20, , $string); $theimage = images/ . $button ..gif; $im = imageCreateFromgif($theimage); $white = ImageColorAllocate($im, 255, 255, 255); $font = /fonts/VERDANAB.TTF; $box = imagettfbbox ( 12, 0, $font, $string); $th=$box[7]-$box[3]; $th= $th + 2; $py = (imagesy($im) -$th)/2; $px = (imagesx($im) -($box[2]-$box[0]))/2; $size = 12; ImageTTFText ($im, $size, 0, $px, $py, $white,$font,$string); Imagegif($im); ImageDestroy($im); ? fot this to work you need to upload VERDANAB.TTF to a folder called 'fonts' and you call the image like this: to draw 'hello' on a button called 'mybutton.gif' stored in 'images' folder img src=button.php?string=hellobutton=mybutton - Original Message - From: Rodrigo Peres [EMAIL PROTECTED] To: PHP [EMAIL PROTECTED] Sent: Saturday, February 16, 2002 7:49 PM Subject: [PHP] Change gif image with php Hi list I have some buttons made in photoshop in .gif format. This buttons have round corner, feather, multiple colors etc. There's a way to open it with php and write some text to it. I know that is possible to create images, but what about to change them??? I need to do this because the text that will fill the buttons come from mysql and change everyday. Thank's in advance Rodrigo ps: If someone want to see the button I'm talking look in http://www.celebnet.com.br/home.php under the AS ++. -- 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] Sessions that last for ever
But very many commercial sites, including Apple and Amazon to name two, do exactly this. When you re-enter the site they 'remember' who you are using a cookie. In my case, I'm building a multi-player strategy game and while I want the players to go through an initial briefing the first time they ever join the game, thereafter they should be able to get straight into the game if they are still using the same PC. But as I said, the specifics of my use aren't so important - lots of sites leave permanent cookies around and the results don't seem to be catastrophic. The question is still: how to do it? Nigel On Saturday, February 16, 2002, at 07:52 PM, Erik Price wrote: On Saturday, February 16, 2002, at 07:43 AM, Nigel Gilbert wrote: By default, a session (created with session_register) seems to last just as long as the user has their browser open. If a user quits the browser, the session is automatically destroyed. I want a session to last indefinitely (or until my program destroys it). There are some hints about how this could be done with cookies in the documentation, but not a clear recipe. What sequence of PHP statements should I use to achieve this? I don't have the answer you're looking for (maybe it's a php.ini setting), but I suspect that it might be a dangerous idea. The longer a session ID is hanging about, the easier it is for a cracker to hijack it and use it for evil intent. Remember, every time a page is requested within any given session, either a cookie variable or a GET variable is being sent along with the HTTP headers. Keeping a session going for more time than needed means that the variable representing the session ID is leaving footprints all over the place. Erik -- who has become overcautious lately upon learning how HTTP works Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] __ Professor Nigel Gilbert, FREng, AcSS, Pro Vice-Chancellor and Professor of Sociology, University of Surrey, Guildford GU2 7XH, UK. +44 (0)1483 689173 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Change gif image with php
ya its completly possible.. I've never done it, but I'm sure I read how to over at phpbuilder.com Andrew - Original Message - From: Rodrigo Peres [EMAIL PROTECTED] To: PHP [EMAIL PROTECTED] Sent: Saturday, February 16, 2002 7:49 PM Subject: [PHP] Change gif image with php Hi list I have some buttons made in photoshop in .gif format. This buttons have round corner, feather, multiple colors etc. There's a way to open it with php and write some text to it. I know that is possible to create images, but what about to change them??? I need to do this because the text that will fill the buttons come from mysql and change everyday. Thank's in advance Rodrigo ps: If someone want to see the button I'm talking look in http://www.celebnet.com.br/home.php under the AS ++. -- 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] Change gif image with php
Rodrigo, I've been struggling with this for some time, so here goes: The php4 builds do not support .gif files, you'll need to change your files to .jpg or .png format, or use php3 (I can't change to php3). I use imagecreate() func. before imagecreatefromjpeg() func. because if I didn't do this, the added text would be gray regardless of the desired color. The mysql portion is solid and yields the desired results. However, I'm having trouble with something related to the imagecreatefromjpeg() func., I get a server error (500) on some images regardless of their size. This is the only error produced by the func. and it is maddening. From experimentation, I believe that there's something wrong with the .jpg files, the .jpg file upload, or the phase of the moon. Good luck, Hugh ?php header(content-type: image/jpg); $font=fonts/arial.ttf; $font2=fonts/wingding.ttf; $im_size = GetImageSize($image_file); $imWidth = $im_size[0]; $imHeight = $im_size[1]; $image=ImageCreate($imWidth,$imHeight); $black=imagecolorallocate($image,0,0,0); $white=imagecolorallocate($image,255,255,255); $red=imagecolorallocate($image,255,100,100); $orange=imagecolorallocate($image,255,200,0); $yellow=imagecolorallocate($image,233,233,0); $green=imagecolorallocate($image,80,255,80); $lt_blue=imagecolorallocate($image,180,180,255); $blue=imagecolorallocate($image,120,120,255); $dk_blue=imagecolorallocate($image,0,0,200); $purple=imagecolorallocate($image,200,100,200); $brown=imagecolorallocate($image,190,160,150); $image2=imagecreatefromjpeg($image_file); imagecopy ($image, $image2, 0, 0, 0, 0, $imWidth, $imHeight); $db=data_base_name; $pass=password; $link=mysql_connect(localhost,,$pass); if (! $link) die(Can't log in at this time); mysql_select_db($db,$link) or die (Can't log in at this time); $query=mysql query ; $results=mysql_query($query); if (!$results) die(mysql_error()); mysql_close($link); while ($landmark=mysql_fetch_array($results)) { $coordinate_x=$landmark['x']; $coordinate_y=$landmark['y']; $plant=$landmark['plant']; if ($plant==flowering) $var_color=$red; if ($plant==conifer) $var_color=$orange; if ($plant==palm) $var_color=$yellow; if ($plant==other) $var_color=$lt_blue; imagettftext($image, 5, 0,$coordinate_x-3, $coordinate_y-4, $black, $font2, l); imagettftext($image, 19, 0,$coordinate_x-7, $coordinate_y+4, $black, $font2, l); imagettftext($image, 17, 0,$coordinate_x-6, $coordinate_y+2, $black,$font2,l); imagettftext($image, 17, 0,$coordinate_x-6, $coordinate_y+2, $var_color, $font2, l); imagettftext($image, 5, 0,$coordinate_x-3, $coordinate_y-4, $white, $font2, l); } imagejpeg($image,./new/$image_file,100); ImageDestroy($image); ImageDestroy($image2); header(location: finished.php); ? - Original Message - From: Rodrigo Peres [EMAIL PROTECTED] To: PHP [EMAIL PROTECTED] Sent: Saturday, February 16, 2002 11:49 AM Subject: [PHP] Change gif image with php Hi list I have some buttons made in photoshop in .gif format. This buttons have round corner, feather, multiple colors etc. There's a way to open it with php and write some text to it. I know that is possible to create images, but what about to change them??? I need to do this because the text that will fill the buttons come from mysql and change everyday. Thank's in advance Rodrigo ps: If someone want to see the button I'm talking look in http://www.celebnet.com.br/home.php under the AS ++. -- 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] scheduled tasks
What do people think about making a cron job call a page by doing a lynx http://www.site.com/automatedtasks.php every hour? -Original Message- From: Michael Sims [mailto:[EMAIL PROTECTED]] Sent: February 16, 2002 9:59 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] scheduled tasks At 06:41 AM 2/16/2002 -0800, [EMAIL PROTECTED] wrote: Is currently anyway of doing scheduled tasks with PHP (without using crontab)? What's wrong with using cron? I'm building an OSS site where the PostgreSQL data base maintenance, email sending, stats gathering, number crunching and graph plotting needs to be automated. My target audience will need things as simple as possible. I am under the impression that it would be a hassle and cost more to get a web host to install a cron script for Postgres. (Or have php as an executable binary instead of shared object.) If the web host gives you access to a shell account then you could setup the script...you wouldn't need them to do it. You could build a copy of PHP as an executable in your home directory and run it from there, no need to get the host to do it. Or there are a few ways that you could schedule the task remotely...use a cron job from another server that either runs the PHP script locally, connecting to the SQL database remotely, or you can use a cron job and lynx to call a remote PHP page that will run your script. Of course, this requires your script to be in your web servers directory tree, but if security is a concern you could always setup a .htaccess file to challenge for credentials then use the -auth switch to lynx in your remote script. It's not the most secure thing in the world, but it's better than nothing... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] scheduled tasks
What do people think about making a cron job call a page by doing a lynx http://www.site.com/automatedtasks.php every hour? -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: February 16, 2002 3:02 PM To: Rodney Davis Cc: [EMAIL PROTECTED] Subject: Re: [PHP] scheduled tasks On Friday, February 15, 2002, at 03:03 PM, Rodney Davis wrote: Is currently anyway of doing scheduled tasks with PHP (without using crontab)? For example, using an email script to send out e-mail reminders every Monday or something like that? One way to do it (stole this from my 'Beginning PHP' book [Wrox]): Store the current timestamp into a file. Read this file every time some commonly-used feature of your site is executed. Then, when X number of seconds has passed beyond the timestamp, execute some other code: $countfile = ./countfile.txt; $fp = fopen($countfile, 'r+'); $oldtime = fread($fp); if ((time()) = ($oldtime + 24 * 60 * 60 * 7)) { // a week has passed since the last time the file was written to // execute the code (mail or whatever) } rewind($fp); fwrite($fp, time()); fclose($fp); or something like that. NB this code is definitely untested, so it probably won't work, but the theory is there. Also, be sure to take into account the security issues of having a file writeable by your web server -- I'm assuming you already have experience with this. Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Change gif image with php
Rodrigo, I've been struggling with this for some time, so here goes: The php4 builds do not support .gif files, you'll need to change your files to .jpg or .png format, or use php3 (I can't change to php3). This is not true. GIF support depends solely on the version of the GD library PHP is linked against. GIF support was not removed from PHP. It was removed from later versions of the GD library. Simply grab an older version of GD which has GIF support and link PHP against that. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FREE webspace with NO ADS!! (also PHP included!)
Hi! You can find details at the next link: http://endi.go.ro/ml.htm __ Do You Yahoo!? Yahoo! Sports - Coverage of the 2002 Olympic Games http://sports.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ftp_rawlist() info
Hello, Everything works with the FTP connection...but I have a problem with the address at ftp_rawlist. I tried / to see the root directory and it didn't accepted it... What is rong? Artemis Mendrinos. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Test please ignore
Test please ignore Just a test to see if I am on the list yet. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] pdf_place_image size not scale
Is there a way to fake adding images with a constrained size as appose to a scale? I am trying to build a dynamic catalog, but I want all images the same size and not scaled. I am sure the response will be to make them all the same size before using pdf_place_image, but the items change regularly and I want a one stop solution. Any ideas??? Paul |--| |Paul Fowler |Zgtec, Inc. |P.O. Box 11199 |Aspen, CO 81612 |[EMAIL PROTECTED] |http://www.zgtec.com |--| -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Where To Find Resources About Programming Style (my bleedin' code is so darn ugly)
I am looking for a good manual or introduction on how to write readable, extensible code (in any programming language). To give you an example, this bit looks pretty darn horrible and I just don't know how to rephrase it to make it more concise and readable: - snip - if ( ($var0) ( (strlen($var)==strlen(intval($var))) or ((strlen($var)-1)==strlen(intval($var))) ) ) { do stuff; } - snap - (actually, depending on how you've configured your mail reader, or how your terminal is set, this boolean expression may acually not appear in one line . . . which is a problem in itself) I am not sure why, but one problem that I happen to run up against is that I write expressions (boolean) which get very long and because you can't split them (what with them being conditionals in if clauses) - or can you? - they stretch off the screen which makes my code pretty much unreadable (I noticed that good-looking code tends to stick with, like, 70 or something characters in width). But that's just one problem. The stuff that I do always works, but I always have difficulties understanding it once I come back to it after a while (the fact that I am also lazy at commenting is not the issue - it is my belief that well-written code should be readable as well as functional). There must be some kind of canonical text on the subject matter, just as there are canonical texts on SQL (Codd, Celko), C (Kernigan, Ritchie), Perl (Wall), epistemology (Kant), the laws of motion (Newton), general relativity (Einstein), psychoanlysis (Freud) . . . you name it. Regards, Frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions that last for ever
But very many commercial sites, including Apple and Amazon to name two, do exactly this. When you re-enter the site they 'remember' who you are using a cookie. In my case, I'm building a multi-player strategy game and while I want the players to go through an initial briefing the first time they ever join the game, thereafter they should be able to get straight into the game if they are still using the same PC. But as I said, the specifics of my use aren't so important - lots of sites leave permanent cookies around and the results don't seem to be catastrophic. The question is still: how to do it? If each user has a unique user id, then make a table called seen_briefing: create table seen_briefing ( id int(11) unsigned not null default '0', primary key (id) ) Make an entry once a user has seen whatever they need to. Then, on their next login, do a join against the seen_briefing table, check for an entry... -- Greg Donald -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Where To Find Resources About Programming Style (my bleedin' code is so darn ugly)
At 12:26 AM 2/17/2002 +0100, Frank Joerdens wrote: I am looking for a good manual or introduction on how to write readable, extensible code (in any programming language). To give you an example, this bit looks pretty darn horrible and I just don't know how to rephrase it to make it more concise and readable: - snip - if ( ($var0) ( (strlen($var)==strlen(intval($var))) or ((strlen($var)-1)==strlen(intval($var))) ) ) { do stuff; } - snap - This is all just IMHO, because I'm still a bit of a beginner. I have always been tempted to write code in the fewest lines possible. But sometimes this is a Bad Thing, because it can make it very difficult to figure out what you were thinking when you wrote it. I think readability is more important, especially in PHP apps where you are not trying to squeeze out every last bit of performance (don't get me wrong, speed is important, but let's face it, we're not designing low level device drivers or real time kernels here...) Anyway, not really knowing what you are trying to accomplish above, I would rewrite it like so: $strlength = strlen($var); $intlength = strlen(intval($var)); if($strlength == $intlength || $strlength - 1 == $intlength) { $length_ok = true; } if($var 0 $length_ok) { do stuff; } Yes, that is 6 more lines of code than your example, but I believe it is much clearer and easier to read. Also, the above is actually self documenting IMHO. If I was going to use your example in my code, I would definitely have to comment it to remind myself of it's purpose later, where my example I believe doesn't require comments as it's easier to read. Don't have any specific book recommendations...maybe someone else will jump in and suggest something... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Help Requested
I have a template stored in a database which contains variables. Then, in a separate file, I have the variables set, and I call the template and run it through eval(). Unfortunately, it only is parsing a few of them. Could somebody take a look and give me some input? Here's what my template table looks like: CREATE TABLE templates ( id tinyint(4) unsigned NOT NULL auto_increment, name varchar(16) NOT NULL default '', template text NOT NULL, PRIMARY KEY (id), UNIQUE KEY name (name) ) Then here is my template function that preps the data for use with eval(): function template($name, $set=main){ global $tb_templates; $sql = select * from $tb_templates where name = '$name' ; if($query = sql_query($sql)){ if(sql_num_rows($query)==1){ $array = sql_fetch_array($query); $template = str_replace(\\',',addslashes($array[template])); } else { $template = $name . template not found.; } } return $template; } Then here is how to use eval() properly: $template_name = template(template_name); eval(\$template_name = \$template_name\;); This will parse all your $vars you store in the templates. Greg Donald - http://destiney.com/ http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] exec on Windows
I am trying to develop a music scheduling system on Windows using the command line to fire off WinAMP. The first exec works fine, then it stops and says that program execution time has been exceeded. An example would be: exec (winamp.exe M01.mp3); a while loop kicks off the second. I tried to send the output to null winamp.exe null or nul and no luck. Anyone else try this on Windows? Thanks, -Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Text editor for linux
Anyone know of a good text editor for linux, WITH syntax highlighting for php/html + other languages? Vim - http://www.vim.org/ If you use X, then use gvim. Greg Donald - http://destiney.com/ http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Text editor for linux
Nedit, Bluefish are also good under X -Original Message- From: Greg Donald [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 16, 2002 7:22 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Text editor for linux Anyone know of a good text editor for linux, WITH syntax highlighting for php/html + other languages? Vim - http://www.vim.org/ If you use X, then use gvim. Greg Donald - http://destiney.com/ http://phprated.com/ | http://phplinks.org/ | http://phptopsites.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
[PHP] Help please
Im trying to control the way a new window opens when submiting a form. When I do it from a regular button, I use: p align=center a href="#pv" >rollbars=0,width=300,height=340,top=150,left=150');return true and it works, it opens the new window, but Im not transferring any values in here. What I want to do is that when I push the submit button of a form, it opens in the same window size as the prior example. I hope you can assist me. E.
php-general Digest 17 Feb 2002 01:40:02 -0000 Issue 1176
php-general Digest 17 Feb 2002 01:40:02 - Issue 1176 Topics (messages 85030 through 85076): php blocking functions 85030 by: Sofhian Mahat Text editor for linux 85031 by: Torkil Johnsen 85034 by: Matthew Darcy 85044 by: Jackson Miller 85074 by: Greg Donald 85075 by: Scott LINUX distrib of PHP different to windows? 85032 by: Andy 85049 by: Lars Torben Wilson Re: modular programming 85033 by: Kunal Jhunjhunwala Re: Sessions that last for ever 85035 by: SpamSucks86 85038 by: Joe Van Meer 85056 by: Erik Price 85059 by: Nigel Gilbert 85070 by: Greg Donald Re: Sessions and templating help 85036 by: Joe Van Meer Re: scheduled tasks 85037 by: flume33.yahoo.com 85040 by: Michael Sims 85057 by: Erik Price 85062 by: B Richards 85063 by: B Richards My Session don't expire 85039 by: Rodrigo Peres 85041 by: Andrey Hristov Re: Outputing XML to browser??? 85042 by: Christian Blichmann 85043 by: Christian Blichmann 85051 by: Jim Hankins 85052 by: Jim Hankins 85054 by: Jim Hankins Problems with Cookies 85045 by: Georgie Casey 85046 by: Georgie Casey Tricky variable question! Impossible?? 85047 by: Andy 85050 by: Edward van Bilderbeek - Bean IT Re: The ASP application object in PHP? 85048 by: Peter J. Schoenster PHP Help Requested 85053 by: Pete Bekisz 85072 by: Greg Donald Change gif image with php 85055 by: Rodrigo Peres 85058 by: Adrian Murphy 85060 by: Andrew Brampton 85061 by: hugh danaher 85064 by: Rasmus Lerdorf FREE webspace with NO ADS!! (also PHP included!) 85065 by: Balazs Laszlo ftp_rawlist() info 85066 by: Artemis Mendrinos Test please ignore 85067 by: Paul Fowler pdf_place_image size not scale 85068 by: Paul Fowler Where To Find Resources About Programming Style (my bleedin' code is so darn ugly) 85069 by: Frank Joerdens 85071 by: Michael Sims exec on Windows 85073 by: Scott Help please 85076 by: webmaster mbtradingco Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- Hello everyone, I am searching for an alternate way to accomplish user synchronization. I would like two or more users to block on the read of some stream, so that when one person writes to it, the other person(s) will read it. The only way I currently know to do this is with the socket functions. However, this poses a small problem. If I use the socket functions, I have to keep a script running on the server at all times. I would really like to have users block at the end of a file until new information is appended. I certainly don't want to have all my clients sit in infinite while loops, and I'm sure my isp doesn't either. I may be shit out of luck anyway, if they are killing processes that run for too long. I appreciate any and all suggestions. If someone knows exactly which functions block, aside from the socket functions, could you please tell me? Thank you. Respectfully, Chad ---End Message--- ---BeginMessage--- Anyone know of a good text editor for linux, WITH syntax highlighting for php/html + other languages? - TOrkil ---End Message--- ---BeginMessage--- there is a way of using vi/vim to highlight syntax with PHP and HTML. I am playing with it at the moment. Matt, -Original Message- From: Torkil Johnsen [mailto:[EMAIL PROTECTED]] Sent: 16 February 2002 13:45 To: [EMAIL PROTECTED] Subject: [PHP] Text editor for linux Anyone know of a good text editor for linux, WITH syntax highlighting for php/html + other languages? - TOrkil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ---End Message--- ---BeginMessage--- I am using Komodo from Active State. http://www.activestate.com It runs in windows and Linux. On Sat, 2002-02-16 at 09:17, Matthew Darcy wrote: there is a way of using vi/vim to highlight syntax with PHP and HTML. I am playing with it at the moment. Matt, -Original Message- From: Torkil Johnsen [mailto:[EMAIL PROTECTED]] Sent: 16 February 2002 13:45 To: [EMAIL PROTECTED] Subject: [PHP] Text editor for linux Anyone know of a good text editor for linux, WITH syntax highlighting for php/html + other languages? - TOrkil -- 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 ---End Message---
Re: [PHP] file reading and array's
Perfect! Thank you, my mind was out in left field somewhere. On Tue, 12 Feb 2002, DL Neil wrote: Hi Scott, In my constant effort to improve my perl conversion project, I have a question regarding file reading. I am taking two files and combining them in an array and then writing out a new file. Is there a way to: a)strip out the first line of the second file b)test for conditions based on what is on the next line on the file An example, I start the array on file one, then mid-way I start another array on the second file (this array within in the first). I need to check the next line in the file for a condition to exist. I have tried this, but run into the pointer resetting on each pass. Any thoughts would be appreciated. Thanks in advance. Use explicitly array pointers instead of the 'built-in' ones, then: your need to look-ahead becomes array[$ptr + 1] avoiding the first record becomes for ( $i=1; $i$last; $i ++ ) //instead of $i=0 Does that cover things? =dn -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Outputing XML to browser???
More info on my latest issue regarding the integrating of xml and php for dynamic xml documents Thanks for help, could use another assist if you have a moment. When I used the method of using the application it worked only the output is text not xml, ie it does update the dynamic information but formats it as text so I reverted back to the previous configuration of the line in the httpd.conf file which is IfModule mod_php4.c AddType application/x-httpd-php .php .php4 .php3 .phtml AddType application/x-httpd-php-source .phps /IfModule Now as I thought about this, there must be something that tells php that it's default type is text/html for output. I perused the php.ini file and low and behold I find something: ; As of 4.0b4, PHP always outputs a character encoding by default in ; the Content-type: header. To disable sending of the charset, simply ; set it to be empty. ; ; PHP's built-in default is text/html default_mimetype = text/xml I changed this to xml, now my xml works but of course I've now broke html formating. (I need both of course) Surely there is someway to tell either with an xml header or something within the beginning of a file which at this point could be either xml or php, really doesn't matter. I must be able to tell php either by content, or by location or something what format the file is to be displayed in so it works. Any ideas? Christian Blichmann [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Whoops, sent you a wrong .htaccess - file, here's what I really use (the other one was old): AddType application/x-httpd-php .php .php4 .htm .html .xml .xhtml DirectoryIndex index.xml index.xhtml IndexIgnore .htaccess .htpasswd -- Christian Blichmann _ don't hesitate - email me with your thoughts: e-mail: [EMAIL PROTECTED] - please remove the .nospam from address. _ do you want to know more? web:http://www.blichmann.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Breadcrumbs in PHP
Hi, I was trying out this breadcrumbs code found at evolt.org: http://www.evolt.org/article/Breadcrumbs_for_PHP_Lovers/17/4455/ and tried it on my site. The same problem as documented on that page exists on my page, being that it doesn't include any directories between the home and the current page, such as: home about us contact us. Instead it shows as home contact us I've made some changes as recommended by the postings below, such as changing SCRIPT_URL to PATH_INFO, but still no changes. Has anyone had any experience and workaroudn with this particular script, or if there's a better script that I can use for breadcrumbs? -- Laurie Landry [EMAIL PROTECTED] - email (604) 693-1120 - voicemail/fax -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] storing arrays
Two questions: 1) Is it possible to write an array to a file? 2) Is it possible to specify the name of the key to each item of an array when you get the array using file(). Thanks a lot. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help please
Since you're assuming Javascript anyway, you can use a input type=button instead of input type=submit and use the same javascript code as for the a href, just that you append a document.forms[0].submit(). HTH Bogdan webmaster mbtradingco wrote: I'm trying to contro l the way a new window opens when submiting a form. When I do it fro m a regular button, I use: p align=center a href=#pv onClick=window.open('php/resulta.php','1','sc rollbars=0,width=300,height=340,top=150,left=150');return true and it works, it opens the new window, but I'm not transferring any values in here. What I want to do is that when I push the submit button of a form, it opens in the same window size as the prior example. I hope you can assist me. E.
RE: [PHP] Help please
Thanks I hope you can assist me a little more. I put the text like this: input type=Button value=Enviar style=background-color: #E9B361 onClick=window.open('php/encuesta.php','1','scrollbars=0,width=300,heig ht=340,top=150,left=150',document.forms[0].submit());return true but it opens the new window (like it is supposed but it carries no data), and the main window changes like if no value was added. This is the third consecutive form in the page, and the form header is like this. form method=POST action=php/encuesta.php target=_blank onSubmit=submitonce(this) name=poll where submitonce(this) is a function that disables the button after one submission is made. Help please. Thanks The site is www.papelesdeviaje.com http://www.papelesdeviaje.com/ and is the poll in question. You can access below the enviar, and see what I need the submit button to do. Thanks. -Mensaje original- De: Bogdan Stancescu [mailto:[EMAIL PROTECTED]] Enviado el: Sábado, 16 de Febrero de 2002 20:43 Para: webmaster mbtradingco CC: [EMAIL PROTECTED] Asunto: Re: [PHP] Help please Since you're assuming Javascript anyway, you can use a input type=button instead of input type=submit and use the same javascript code as for the a href, just that you append a document.forms[0].submit(). HTH Bogdan webmaster mbtradingco wrote: Im trying to contro l the way a new window opens when submiting a form. When I do it fro m a regular button, I use: p align=center a href=#pv onClick=window.open('php/resulta.php','1','sc rollbars=0,width=300,height=340,top=150,left=150');return true and it works, it opens the new window, but Im not transferring any values in here. What I want to do is that when I push the submit button of a form, it opens in the same window size as the prior example. I hope you can assist me. E.
[PHP] Re: storing arrays
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Clark) wrote: 1) Is it possible to write an array to a file? http://php.net/serialize http://php.net/fopen http://php.net/fwrite 2) Is it possible to specify the name of the key to each item of an array when you get the array using file(). You can take the array returned by file() and manipulate its keys however you want. But beforehand...? No. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help please
Thanks I hope you can assist me a little more. I put the text like this: input type=Button value=Enviar style=background-color: #E9B361 onClick=window.open('php/encuesta.php','1','scrollbars=0,width=300,heig ht=340,top=150,left=150',document.forms[0].submit());return true but it opens the new window (like it is supposed but it carries no data), and the main window changes like if no value was added. This is the third consecutive form in the page, and the form header is like this. form method=POST action=php/encuesta.php target=_blank onSubmit=submitonce(this) name=poll where submitonce(this) is a function that disables the button after one submission is made. Help please. Thanks The site is www.papelesdeviaje.com http://www.papelesdeviaje.com/ and is the poll in question. You can access below the enviar, and see what I need the submit button to do. Thanks. -Mensaje original- De: Bogdan Stancescu [mailto:[EMAIL PROTECTED]] Enviado el: Sábado, 16 de Febrero de 2002 20:43 Para: webmaster mbtradingco CC: [EMAIL PROTECTED] Asunto: Re: [PHP] Help please Since you're assuming Javascript anyway, you can use a input type=button instead of input type=submit and use the same javascript code as for the a href, just that you append a document.forms[0].submit(). HTH Bogdan webmaster mbtradingco wrote: Im trying to contro l the way a new window opens when submiting a form. When I do it fro m a regular button, I use: p align=center a href=#pv onClick=window.open('php/resulta.php','1','sc rollbars=0,width=300,height=340,top=150,left=150');return true and it works, it opens the new window, but Im not transferring any values in here. What I want to do is that when I push the submit button of a form, it opens in the same window size as the prior example. I hope you can assist me. E.
[PHP] Apache.exe fails Java
Hi, I am learning how to use the PHP Java extension. I used the example script/codes found in the PHP Java documentation: ?php // get instance of Java class java.lang.System in PHP $system = new Java('java.lang.System'); // demonstrate property access print 'Java version='.$system-getProperty('java.version').' br'; print 'Java vendor=' .$system-getProperty('java.vendor').' br'; print 'OS='.$system-getProperty('os.name').' '. $system-getProperty('os.version').' on '. $system-getProperty('os.arch').' br'; // java.util.Date example $formatter = new Java('java.text.SimpleDateFormat', , dd, 'at' h:mm:ss a ); print $formatter-format(new Java('java.util.Date')); ? And I got the correct output: Java version=1.3.0 Java vendor=Sun Microsystems Inc. OS=Windows 2000 5.0 on x86 Sunday, February 17, 2002 at 3:28:42 AM Greenwich Mean Time However, the script also crashed Apache.exe each time it was run. It gave me the following error message: Apache.exe has generated errors and will be closed by Windows. You will need to restart the program. Does anyone know what is going on? Why Apache.exe kept crashing after runing this PHP script? Thanks, Zlutarch _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help please
You should make up your mind - do you want to use the form in order to carry the data (use submit()) or do you want to submit the data via URL (GET method - using window.open()). You can't use both! Bogdan webmaster mbtradingco wrote: Thanks... I hope you can assist me a little more. I put the text like this: input type=Button value=Enviar style=background-color: #E9B361 onClick=window.open('php/encuesta.php','1','scrollbars=0,width=300,heig ht=340,top=150,left=150',document.forms[0].submit());return true but it opens the new window (like it is supposed but it carries no data), and the main window changes like if no value was added. This is the third consecutive form in the page, and the form header is like this. form method=POST action=php/encuesta.php target=_blank onSubmit=submitonce(this) name=poll where submitonce(this) is a function that disables the button after one submission is made. Help please. Thanks The site is www.papelesdeviaje.com http://www.papelesdeviaje.com/ and is the poll in question. You can access below the enviar, and see what I need the submit button to do. Thanks. -Mensaje original- De: Bogdan Stancescu [mailto:[EMAIL PROTECTED]] Enviado el: Sábado, 16 de Febrero de 2002 20:43 Para: webmaster mbtradingco CC: [EMAIL PROTECTED] Asunto: Re: [PHP] Help please Since you're assuming Javascript anyway, you can use a input type=button instead of input type=submit and use the same javascript code as for the a href, just that you append a document.forms[0].submit(). HTH Bogdan webmaster mbtradingco wrote: I'm trying to contro l the way a new window opens when submiting a form. When I do it fro m a regular button, I use: p align=center a href=#pv onClick=window.open('php/resulta.php','1','sc rollbars=0,width=300,height=340,top=150,left=150');return true and it works, it opens the new window, but I'm not transferring any values in here. What I want to do is that when I push the submit button of a form, it opens in the same window size as the prior example. I hope you can assist me. E. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions that last for ever
On Sunday 17 February 2002 04:10, Nigel Gilbert wrote: But very many commercial sites, including Apple and Amazon to name two, do exactly this. When you re-enter the site they 'remember' who you are using a cookie. In my case, I'm building a multi-player strategy game and while I want the players to go through an initial briefing the first time they ever join the game, thereafter they should be able to get straight into the game if they are still using the same PC. But as I said, the specifics of my use aren't so important - lots of sites leave permanent cookies around and the results don't seem to be catastrophic. The question is still: how to do it? Try changing the value of session.cookie_lifetime in php.ini. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* Have a taco. -- P.S. Beagle */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] global variables accesible by any script started by any browser
Does anyone know if it is possible to have a script declare a variable and make it accesible by any script started by any browser?
[PHP] MySQL error checking/matching
Hello everyone, I have a problem. I have a test database (used to learn MySQL) with a table called customers and a field called email. The email field is set to be unique, so I know that by using: $query = select email from customers where email = $email; I will get one cell with the e-mail address that matches the email address specified by the variable $e-mail. Basically, I want to check to see if the e-mail address set in the variable $email matches the email address in the field named email. But I get an error at the end. Here's the source: Assumptions: - $email is set from a previous page - a database connection is open and the database to be used is selected - session settings will send $error back to the form page if result of if statement below is true $query = select email from customers // Check for duplicate entry . where email = $email; $query = stripslashes($query); $result = mysql_query($query); $num_results = mysql_num_rows($result); // Get the number of rows in database (integer) for ($i = 0; $i $num_results; $i++) { $row = mysql_fetch_array($result); // Return results in an associative array } if($row[email] == $email) { // Check to see if $email matches in database $error = $email has already been registered; header(Location: signup.php??=SID?); exit; } And this produces the following error: Warning: Supplied argument is not a valid MySQL result resource in e:\localhost/book-o-rama/admin/signup_do.php on line 34. What am I doing wrong? Any help would be appreciated... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] net send/WinPopup code - RFC
I'm working on some PHP code to make it possible for a PHP script to do net send messages. Here's what I have so far, I've been successful sending to localhost with it on a Windows machine. If folks could try this out and make suggestions on how to improve it, I'd be very appreciative... -Garth Code: ? function WinPopup($Target, $Message) { global $COMSPEC; if (isset($COMSPEC)) // Windows { /* Schedule the call to 'net send', because if 'net send' can't quickly resolve the computer name it can easily exceed PHP's allowed processing time, and besides don't want the user to wait */ $result = shell_exec(at .date(H:i, time()+60). net send \.$Target.\ .escapeshellarg($Message)); preg_match(/ID = ([0-9]+)$/,$result, $matches ); return $matches[1]; } // *nix with Samba $result = shell_exec(smbclient -M .escapeshellarg($Target). .escapeshellarg($Message). /dev/null); return 1; } ? pre form h4Winpopup / Net Send from PHP/h4 input type=text name=target value='?=gethostbyaddr($REMOTE_ADDR);?' input type=submit value='go!' ? // The Test ... if (isset($target)) { $x = WinPopup($target, PHP sent you a message at .date(H:i)); echo BR; echo date = .date(H:i); echo Br; echo x = [ $x ]; ? br if b?=$target?/b is a windows PC with some kind of net send / winpopup compatiable maillots running you should hopefully get a message in about a minute or two. /pre ? if ($COMSPEC) { $at = shell_exec(at); echo at = [ textarea nowrap rows=10 cols=100.$at./textareaBr]; } else { phpinfo(); } } ? /form -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help please
I'm sorry but I cant seem to make it work. The form instruction is now: form method=get onSubmit=submitonce(this) The Button Instruction is now: input type=Button value=Enviar style=background-color: #E9B361 onClick=document.forms[1].submit();window.open('php/encuesta.php','1',' scrollbars=0,width=300,height=340,top=150,left=150');return true Still when the new window opens is stops cause it does not have any values with it. What am I doing wrong here, if I add an action statement in the form, then it opens the php procedure in the same window an works. If I add a _blank target it also works, but the new window never works. Thanks. -Mensaje original- De: Bogdan Stancescu [mailto:[EMAIL PROTECTED]] Enviado el: Sábado, 16 de Febrero de 2002 21:51 Para: webmaster mbtradingco CC: [EMAIL PROTECTED] Asunto: Re: [PHP] Help please You should make up your mind - do you want to use the form in order to carry the data (use submit()) or do you want to submit the data via URL (GET method - using window.open()). You can't use both! Bogdan webmaster mbtradingco wrote: Thanks... I hope you can assist me a little more. I put the text like this: input type=Button value=Enviar style=background-color: #E9B361 onClick=window.open('php/encuesta.php','1','scrollbars=0,width=300,hei g ht=340,top=150,left=150',document.forms[0].submit());return true but it opens the new window (like it is supposed but it carries no data), and the main window changes like if no value was added. This is the third consecutive form in the page, and the form header is like this. form method=POST action=php/encuesta.php target=_blank onSubmit=submitonce(this) name=poll where submitonce(this) is a function that disables the button after one submission is made. Help please. Thanks The site is www.papelesdeviaje.com http://www.papelesdeviaje.com/ and is the poll in question. You can access below the enviar, and see what I need the submit button to do. Thanks. -Mensaje original- De: Bogdan Stancescu [mailto:[EMAIL PROTECTED]] Enviado el: Sábado, 16 de Febrero de 2002 20:43 Para: webmaster mbtradingco CC: [EMAIL PROTECTED] Asunto: Re: [PHP] Help please Since you're assuming Javascript anyway, you can use a input type=button instead of input type=submit and use the same javascript code as for the a href, just that you append a document.forms[0].submit(). HTH Bogdan webmaster mbtradingco wrote: I'm trying to contro l the way a new window opens when submiting a form. When I do it fro m a regular button, I use: p align=center a href=#pv onClick=window.open('php/resulta.php','1','sc rollbars=0,width=300,height=340,top=150,left=150');return true and it works, it opens the new window, but I'm not transferring any values in here. What I want to do is that when I push the submit button of a form, it opens in the same window size as the prior example. I hope you can assist me. E. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Could this be a configuration directive?
I get a parse error using my CGI version of PHP on the following line: $message = $$this-func_name($string); However, the same above line works fine with my ISP's CGI version of PHP. The first thing that jumps to my mind is that my ISP's CGI version could have been compiled with some different configuration directive. However, I am not able to figure it out. Could someone please advise. Oh, another thing, my CGI version is PHP 3.0.12. The ISP CGI version is PHP 4.0.3pl1. Is the above syntax not supported in PHP3? Thanks for your quick response. = Anas Mughal [EMAIL PROTECTED] [EMAIL PROTECTED] Tel: 973-249-6665 __ Do You Yahoo!? Yahoo! Sports - Coverage of the 2002 Olympic Games http://sports.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Could this be a configuration directive?
At 11:22 PM 2/16/2002 -0800, Anas Mughal wrote: I get a parse error using my CGI version of PHP on the following line: $message = $$this-func_name($string); However, the same above line works fine with my ISP's CGI version of PHP. That is strange. Just for kicks, try using curly braces to make the statement less ambiguous. Is the variable part just the object name, or is it the entire method? See if it works like this: $message = ${$this}-func_name($string); or like this: $message = ${$this-func_name($string)}; Depending on which one you mean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Could this be a configuration directive?
Thank you very much... This worked: $message = ${$this-func_name($string)}; and, this worked: (I am going to stick with this) $message = ${$this-func_name}($string); However, this did NOT work: $message = ${$this}-func_name($string); Lesson learned: I need to enclose the function name variable in curly braces. Thanks. --- Michael Sims [EMAIL PROTECTED] wrote: At 11:22 PM 2/16/2002 -0800, Anas Mughal wrote: I get a parse error using my CGI version of PHP on the following line: $message = $$this-func_name($string); However, the same above line works fine with my ISP's CGI version of PHP. That is strange. Just for kicks, try using curly braces to make the statement less ambiguous. Is the variable part just the object name, or is it the entire method? See if it works like this: $message = ${$this}-func_name($string); or like this: $message = ${$this-func_name($string)}; Depending on which one you mean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = Anas Mughal [EMAIL PROTECTED] [EMAIL PROTECTED] Tel: 973-249-6665 __ Do You Yahoo!? Yahoo! Sports - Coverage of the 2002 Olympic Games http://sports.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php