RE: [PHP] A stupid question?
Regards, Shelley -Original Message- From: Eric Butera [mailto:[EMAIL PROTECTED] Sent: Saturday, January 19, 2008 12:03 AM To: Jochem Maas Cc: php-general@lists.php.net Subject: Re: [PHP] A stupid question? On Jan 18, 2008 10:49 AM, Jochem Maas [EMAIL PROTECTED] wrote: Eric Butera schreef: On Jan 18, 2008 9:31 AM, Jochem Maas [EMAIL PROTECTED] wrote: Eric Butera schreef: On Jan 17, 2008 9:54 PM, Shelley Shyan [EMAIL PROTECTED] wrote: Hi all, Maybe this is a somehow stupid question. I want to know how php could know whether session_start() has been called, that is, whether session has been started. I Googled, but got little help. Thank you for help! Any tip is greatly appreciated. Regards, Shelley One other thing is you won't be able to start a session if headers have been sent. It is a good idea to use output buffering to help aid with this. no it's not a good idea to use output bufferin to 'help aid' this. instead write code that is logically structured so that the initialization of your pages/app/scripts occurs BEFORE any output is generated. to avoid spurious output of whitespace avoid including the trailing '?' is included php[-only] files. (and ignore whatever Tedd says on the subject ;-) If headers have been sent you'll get a nasty warning. if (headers_sent()) { echo oops!; } use code to avoid warnings. It can be a php.ini setting or you can simply call ob_start() on the first line of your script. I agree with you that it is ideal to do what you're saying but it isn't always 100% practical. Sometimes the stuff we work on is handed down and in our purist world we'd like to change it, but can't. So I think that you should recommend best practices for future creations, but blindly shooting down all alternatives isn't right. My solution would get the job done rather than the OP refactoring the pages and not getting paid for it. It would work and over time things could be tidied up on future revisions over time. still, it's not a good idea because that implies a concept that you are wanting to apply. you don't want to use output buffering if you can help it. output buffering to overcome output being created before headers are [conditionally] sent in badly written code is a viable hack given certain budgetary and/or time constraints. what I'm saying is it's a viable solution to a immediate problem for which you don't have the time/money to fix properly - it's more than fine to enlighted the OP as such, I just don't think calling it a good idea is the right thing to do - it gives the impression that your giving it the seal-of-good-coding-practice-approval, and the OP might just take your word for it. Also, if you do what you've said and created your logic 100% perfectly, there should never be any use for headers_sent(), right? Headers shouldn't have been sent until you've specifically sent them. true, and they are not - but if you want to be sure to avoid cruft in the output and/or shit in the logs you program defensively for those occasions where somebody [else?] makes a mistake of some kind. Fair enough, you win! :) Thank you all. Thank you very much. :-) -- 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] Word Wrap on highlight_file
One solution I can think of is: $showCode = highlight_file($fileWithPath, true); echo str_replace('br /', br /\n, $showCode); It may not be the best one. But it's not recommanded to use echo wordwrap($showCode, 70); Because you may break br / into something like br / Regards, Shelley -Original Message- From: Tom Chubb [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 16, 2008 9:02 PM To: PHP General List Subject: [PHP] Word Wrap on highlight_file Can anyone tell me how to wrap the results of highlight_file so it doesn't mess up the size of my table div? I tried the following and doesn't work! if ($ext == phps) { $showcode = highlight_file($pathtoscripts . $_GET['file']); echo wordwrap($showcode, 70); } else { echo Nice try, but you are not authorised to view the source of files with a $ext extension! ;)\n; } Thanks, Tom -- 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] A stupid question?
Hi all, Maybe this is a somehow stupid question. I want to know how php could know whether session_start() has been called, that is, whether session has been started. I Googled, but got little help. Thank you for help! Any tip is greatly appreciated. Regards, Shelley
RE: [PHP] MSSQL
Did you check that you have enabled MSSQL extension? That is, On XP system, you should have this line 'extension=php_msql.dll' in php.ini file and the leading ';' be removed. On Ubuntu, you should also install mssql extension, which is a little more complex. There should be no problem once you have managed mssql. It talks to sql server 2005/2000 quite well. Regards, Shelley -Original Message- From: Alexis [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 09, 2008 6:07 AM To: php-general@lists.php.net Subject: [PHP] MSSQL Hi, I am pulling my hair out trying to set up PHP to connect to SQL Server. The office server, running Server 2003, has SQL Server on it. One of my computers is running XP with Apache 2.2 and PHP 5.2.3. Another one has Ubuntu Gusty Gibbon, Apache 2.2 and PHP 5.2.3 Ideally I would like to get the Linux box to connect to the main server, but I can't even get it to recognise the server, let alone create a MSSQL link, so I'll start off with the windows box. I have read all the various comments in http://ca3.php.net/mssql and have tried all the relevant ones but still no joy. It just will not connect. I have tried the ADO approach but get the following error: Fatal error: Uncaught exception 'com_exception' with message 'bSource:/b Microsoft OLE DB Provider for SQL Serverbr/bDescription:/b [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.' in D:\Apache2.2\htdocs\includes\mssqlinfo.inc:9 Stack trace: #0 D:\Apache2.2\htdocs\includes\mssqlinfo.inc(9): com-Open('Provider=SQLOLE...') #1 D:\Apache2.2\htdocs\mssql.php(3): include('D:\Apache2.2\ht...') #2 {main} thrown in D:\Apache2.2\htdocs\includes\mssqlinfo.inc on line 9 Does anyone have a definite and easy to understand set of instructions as to how to get PHP to talk to SQL Server please? Cheers Alexis -- 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] Which file called the function?
Richard is right. If you want to get where __FILE__ is exactly in, __FILE__ is the option. Else, use $_SERVER['PHP_SELF']. (And this should be what you expected) Regards, Shelley -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christoph Boget Sent: Thursday, December 20, 2007 10:37 PM To: PHP General Subject: [PHP] Which file called the function? Let's say I have the following 3 files global.php ? function myFunc() { echo __FILE__; } ? one.php ? include( 'global.php' ); echo 'You are in file: '; myFunc(); ? two.php ? include( 'global.php' ); echo 'You are in file: '; myFunc(); ? In each case, what is echoed out for __FILE__ is global.php. Apart from analyzing the debug_backtrace array, is there any way that myFunc() would display one.php and two.php respectively? thnx, Christoph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] convert hex message to ascii msg, How?
Hi all, How could I convert a hex msg to ascii msg? Is there a php function or sth? Thanks. Regards, Shelley
[PHP] howto get .tar.gz content's filenames
Hi all, It may not be a php question, but I want to get the filename lists that a .tar.gz file contains and give it to an array. How can I manage that? Thank you very much for your consideration. Regards, Shelley -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Input field
1.Probably that's because the function mysql_real_escape_string() is turned on. You can check that in your php.ini configuration. 2. If you want to display them as you wanted, you can use stripcslashes() on your output contents. 3. Maybe phpmyadmin automatically stripped that out. And 1. Any user input should be escaped before they went to database. You can use htmlentities(), addslashes(), strip_tags(), etc... 2. You can encapsule those functions in a function, and use it for each user input. 3. No sure. Probably they do. Anybody any ideas? Regards, Shelley -Original Message- From: Ronald Wiplinger [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 14, 2007 9:52 AM To: PHP General list Subject: [PHP] Input field I added just into a input field 19 enclosure which was displayed from the database as: 19\ enclosure That gives me some questions: 1. where the protecting slash comes from? 2. how can I get it away when I want to display that field? 3. The slash is not to see in phpmyadmin, why not? and: 1. what else do I need to take care with input fields and if they are going to a mysql database? 2. can I use a function for that kind of protection for each field - or even better just flag it in php to protect? 3. is HTTP_REFERER session-id enough to make sure that no variables can be injected? bye Ronald -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP ide?
It has, but you should install them manually... Try help- Software updates - Find and install... Regards, Shelley -Original Message- From: Peter Ford [mailto:[EMAIL PROTECTED] Sent: Monday, November 12, 2007 5:24 PM To: php-general@lists.php.net Subject: Re: [PHP] PHP ide? I've tried to use Eclipse PDT, and it's just generally horrible - the All-in-one has no Subversion support and no SSH support for deploying to the server properly. The debugging support worked well on the windows version, but I couldn't get it to work from Linux (with the same web server...) And the look and feel is so crowded and over-complicated. Yuck. Quanta+ can do this (mostly) right, although I have had some trouble Quanta+ with debugging. [EMAIL PROTECTED] wrote: Andrew Peterson wrote: I'll try installed it again with none of the other nonsense. PDT has the so called ALL-IN-ONE thing, however I don't really trust it. I would suggest the following - a) Be sure you have the latest Java. b) Get the normal, traditional Eclipse. c) Update it (Help Software updates Find and install Search for updates of the currently installed features). Repeat if needed. d) Go to Help Software updates Find and install Search for new features to install and add the PDT site (http://download.eclipse.org/tools/pdt/updates/). Check the PDT site and the Europa Discovery Site and click Finish (I haven't done it for a while, so could be something has changed there). When you get the result, the Update manager might complain that PDT depends on something. In this case unfold the Europa Discovery Site result (by clicking the +, if you do not unfold it the next step might not work) and click the Select Required button. This should select the minimum you need. Let me know if you run into a trouble and I'll try to send you reproducible steps. And again, Eclipse is Java, so you need a decent machine. Iv -- 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] Creating PDF files with more than one font?
I often see that it uses .afm files, can it use .ttf format files? If yes, how to? Thank you very much. Regards, Shelley -Original Message- From: George Pitcher [mailto:[EMAIL PROTECTED] Sent: Friday, November 09, 2007 3:38 PM To: Shelley Shyan; php-general@lists.php.net Subject: RE: [PHP] Creating PDF files with more than one font? I want to create a pdf file with several fonts. Which tool is better, pdflib, ezpdf, ? Any suggestions? I can't say which is better, but I use ezpdf and have been able to do multi-font stuff so that I can match corporate styles. George in Edinburgh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP ide?
Zend Studio or PHPEd Regards, Shelley -Original Message- From: Hulf [mailto:[EMAIL PROTECTED] Sent: Thursday, November 08, 2007 6:02 PM To: php-general@lists.php.net Subject: [PHP] PHP ide? Just wondering if anyone uses an IDE and if so what ones? Ta, H. -- 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] Creating PDF files with more than one font?
Hi all, I want to create a pdf file with several fonts. Which tool is better, pdflib, ezpdf, ? Any suggestions? Regards, Shelley -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php