[PHP] Wanted: php-volunteer
Hi there For the further automation of our site, Cutting Edge (cuttingedge.be) is looking for a php-volunteer to aid our php-master. On Cutting Edge our voluntary crew of some 50 people explore popular culture in every way possible. The site reaches up to 1500 unique visitors daily. If you're interested to be an essential part of this project, please contact me. Kind regards. Kevin Major Hoofdredacteur CuttingEdge.be Messcherp door cultuur en media CuttingEdge.be is een initiatief van Cutting Edge vzw
[PHP] Re: PDF Generator
Rick Lim wrote: What is the best FREE pdf generator for PHP? i used FPDF without any problems. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] need session_start() to recall session data.
Matt Monaco wrote: Yes, I actually changed the destructors to handle the session as you indicated a few minutes after I posted, however I still have no clue as to why I would need to do a session_start() to get data from the session. How else would php know you want session started? You can turn session.auto_start on, but then you don't have control over session parameters. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Count and Preg_Replace Using Version 4.4.1
form'.$count.'... You can use preg_replace_callback or the e pattern modifier to let you run php code for the replacement: http://us3.php.net/manual/en/function.preg-replace-callback.php http://us3.php.net/manual/en/reference.pcre.pattern.modifiers.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PDF Generator
I have a TON of forms that I have to populate, can I make a PDF file using Acrobat Professional, and then use PHP to populate those forms and have text inserted into the pre-made text fields that I made using Acrobat? And if so, what is the best tool for that? I'd prefer to do it for free, but spending $$ is fine too. Thanks Dan Rick Lim wrote: What is the best FREE pdf generator for PHP? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] test
test
[PHP] Exception
Hello Is it good to use exception handling for error handling or I should use only for exceptions? For example: Is it good to throwing user input errors with throw new Exception(). Thanks
[PHP] Problem with pdf_show_boxed()
Hello, Sir: I just installed PHP with pdflib : PHP-4.4.1 pdflib PDFlib GmbH Version 6.0.2 pdflib PECL Version 2.0.3 apache 1.3.34 in Liunx FC1. -- When I run the script , I got the error messages as following: - Fatal error: pdf_show_boxed(): [2102] PDF_show_boxed: Function not supported for 'CID' in /home/apache/htdocs/004.php on line 8 - Some thing wrong with this function at the 8th parameter, I think: pdf_show_boxed($pdf,$text,50,650,150,100,'right',''); if I remove the 8th parameter, It would tell me : - Warning: pdf_show_boxed() expects exactly 8 parameters, 7 given in /home/apache/htdocs/004.php on line 8 - What should I do? Thanks form Any help. ### The code: ### $pdf = PDF_new(); pdf_open_file($pdf,); pdf_begin_page($pdf,595,842); //a4 $font = pdf_findfont($pdf,MSung-Light,ETen-B5-H,0); pdf_setfont($pdf,$font,12); $text=MY TEST WORD; pdf_show_boxed($pdf,$text,50,650,150,100,'right',''); pdf_end_page($pdf); pdf_close($pdf); $buffer=pdf_get_buffer($pdf); $leng = strlen($buffer); header (Cache-Control: must-revalidate, post-check=0, pre-check=0); header(Content-type: application/pdf; charset: big5); header(Content-Length: $leng); header(Content-Disposition: inline; filename=hello.pdf); print($buffer); pdf_delete($pdf); ___ 最新版 Yahoo!奇摩即時通訊 7.0,免費網路電話任你打! http://messenger.yahoo.com.tw/
Re: [PHP] Exception
I would recommend keeping error handling and exceptions separate. On 12/4/05, mr php [EMAIL PROTECTED] wrote: Hello Is it good to use exception handling for error handling or I should use only for exceptions? For example: Is it good to throwing user input errors with throw new Exception(). Thanks -- Anas Mughal
Re: [PHP] Exception
On Sun, Dec 04, 2005 at 08:07:48PM +0330, mr php wrote: Hello Is it good to use exception handling for error handling or I should use only for exceptions? For example: Is it good to throwing user input errors with throw new Exception(). I'm not sure if I understand how you mean by this but it sounds to me that your asking if you should use exception catching vs if statments: try { is_valid_username($username); catch (Exception $e) { $errors[] = $e-errorMessage; } imo, programming like that doesn't make sense, exceptions are more designed for errors in assumed succesfull code. Consider: ?php try { $dbh = new PDO('mysql:host=localhost;dbname=test', '', ''); $dbh-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = select bar from foo; $stmt = $dbh-prepare($sql); $stmt-execute(); } catch (PDOException $e) { echo $e, \n; exit(); } // some code to use the valid $stmt object ? There are two places where that code will issue an exception: 1. if a connection to the db fails, which it shouldn't 2. if the column bar doesn't exit of table foo doesn't exist which should exist (unless the DBA decides to rename the table or column. After the catch statement, I know that $stmt is going to be valid and can check for valid results or not. The use of the try catch is to ensure that something that is suppose to happen 100% of the time succesfully, if it doesn't we have an exceptional case and should bail out in a friendly manner. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Exception
mr php wrote: Hello Is it good to use exception handling for error handling or I should use only for exceptions? For example: Is it good to throwing user input errors with throw new Exception(). Thanks Hello, I would also go by keeping them separate; it helps both in logic-flow, and maintenence. Not to mention, exception handlers are design to do just that - handle exceptions. Regards, Christian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Count and Preg_Replace Using Version 4.4.1
On Sun, Dec 04, 2005 at 07:00:00PM -, Shaun wrote: comex [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] form'.$count.'... You can use preg_replace_callback or the e pattern modifier to let you run php code for the replacement: http://us3.php.net/manual/en/function.preg-replace-callback.php http://us3.php.net/manual/en/reference.pcre.pattern.modifiers.php Hi Comex, Thanks for your reply, I have modified the code so I have a call back function: echo = preg_replace_callback( '/p[^]*(.*?)\/p/ms', callback, file_get_contents($_GET['file']) ); function callback($matches){ return 'form name=form target=_parent ... But I still can't see how I can increment a value in each return string? function callback($matches) { static $i = 0; // -- maintains counter within function scope $i++; return form name=form$i/form; } btw, i've been meaning to mention this in the last few posts of yours, but have you considered using DOM to make this happen. When ever I see a regex solution for parsing an html document, it makes me cringe. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How would you write this?
On Sat, Dec 03, 2005 at 10:00:14PM -0500, Michael B Allen wrote: The following code works but I'm a little new to PHP and I'd like to know if there are better ways to achive the same thing. In the below form example, if the user supplies one or more fields but not all that are required, the form is redisplayed but fields that were supplied are prepopulated and the ones that are required but are missing are highlighted in red. Can anyone recommend a better technique or elighten me about features of the language that I've missed? Mike html body ?php $set = 0; $username = ; $password = ; if (isset($_POST['username'])) { $username = trim($_POST['username']); if (strlen($username) 0) { $set |= 0x01; } } if (isset($_POST['password'])) { $password = trim($_POST['password']); if (strlen($password) 0) { $set |= 0x02; } } if (($set 0x03) == 0x03) { echo Logging in with: . $username . ':' . $password; } else { ? form action=login.php method=post table trtd colspan=2Login:/td/tr trtdUsername:/td ?php if ($set != 0 ($set 0x01) == 0) { echo td bgcolor=\#ff\; } else { echo td; } echo input type=\username\ name=\username\ value=\ . $username . \/; ? /td/tr trtdPassword:/td ?php if ($set != 0 ($set 0x02) == 0) { echo td bgcolor=\#ff\; } else { echo td; } ? input type=password name=password/ /td/tr trtd colspan=2input type=submit value=Login//td/tr /table /form style .errored { color: #FF; } /style ?php $set_class = array(0 = '', 1 = 'errored'); define('SET_USERNAME', 0x01); define('SET_PASSWORD', 0x02); define('SET_ALL', SET_USERNAME SET_PASSWORD); $set = 0; $username = ; $password = ; if (isset($_POST['username'])) { $username = trim($_POST['username']); if (strlen($username) 0) { $set |= SET_USERNAME; } } ... if (($set SET_ALL) == SET_ALL) { echo Logging in with: . $username . ':' . $password; } else { ? form action=login.php method=post table trtd colspan=2Login:/td/tr trtdUsername:/td ?php $class = $set_class[ $set SET_USERNAME ]; echo td class=$class echo input type=\username\ name=\username\ value=\ . $username . \/; ... It might be a bit overkill for such a simple thing.. but heck.. i was bored :) Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail SMTP settings
On Sat, Dec 03, 2005 at 10:17:59PM -0700, Dan wrote: Yes that does work but the return path and my mail headers still show the main domain. My point is that PHP should be acessing my SMTP server specified but it is using the default local host instead. If you note at php.net/mail that the SMTP setting is only for windows. Under *nix only as current installed MTA like sendmail can be used. you can set your sendmail_path to pass parameters like : /sbin/sendmail -f [EMAIL PROTECTED] Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions, Expire-headers and Firefox's back button
On Fri, Dec 02, 2005 at 07:21:43PM -0500, Chris Shiflett wrote: Hi Peter, When I begin session with session_start() PHP sets an Expired-header. I suppose that's fine for the sake of unwanted caching. Unfortunately, Firefox seem to reload a page that's expired when using the browser's Back navigation instead of showing the page as it was as the user left it. You might find this article helpful: http://shiflett.org/articles/guru-speak-nov2004 I don't really fault Firefox for abiding by the no-store directive, nor do I fault Internet Explorer for ignoring it. iirc, Firefox 1.5 has improved its caching system, in paticular to the back button drama. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] why php not running ?
On Fri, Dec 02, 2005 at 11:53:13AM +0200, Mehmet Fatih AKBULUT wrote: hi all. i installed php5_extensions on my system (Freebsd5.4) please look the lines below and tell me where i am doing something wrong. [EMAIL PROTECTED] - [~]#php /*hit the tab*/ php php-config phpize [EMAIL PROTECTED] - [~]#php a simple php code: [EMAIL PROTECTED] - [~]#cat first.php %php echo Hello World!; % [EMAIL PROTECTED] - [~]# /* chmod a+x first.php*/ when trying to run the code : [EMAIL PROTECTED] - [~]#php first.php PHP Warning: Method panda::__set() must take exactly 2 arguments in Unknown on line 0 According to the code you cat'ed there is no panda object that is defined so my first assumption is that you have a file that is set in your php.ini: auto_prepend_file=/some/panda.php Segmentation fault (core dumped) Even at that, this core dump shouldn't be happening. I'm assuming you installed this via ports. There are two thing i can think of that should be checked before getting a backtrace: 1) are you uptodate on your ports? have you done a cvsup recently? 2) what does 'php -v' say? Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Count and Preg_Replace Using Version 4.4.1
Curt Zirzow [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sun, Dec 04, 2005 at 07:00:00PM -, Shaun wrote: comex [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] form'.$count.'... You can use preg_replace_callback or the e pattern modifier to let you run php code for the replacement: http://us3.php.net/manual/en/function.preg-replace-callback.php http://us3.php.net/manual/en/reference.pcre.pattern.modifiers.php Hi Comex, Thanks for your reply, I have modified the code so I have a call back function: echo = preg_replace_callback( '/p[^]*(.*?)\/p/ms', callback, file_get_contents($_GET['file']) ); function callback($matches){ return 'form name=form target=_parent ... But I still can't see how I can increment a value in each return string? function callback($matches) { static $i = 0; // -- maintains counter within function scope $i++; return form name=form$i/form; } btw, i've been meaning to mention this in the last few posts of yours, but have you considered using DOM to make this happen. When ever I see a regex solution for parsing an html document, it makes me cringe. Curt. -- cat .signature: No such file or directory Hi Curt, Thanks for your reply. So basically I do something like: $doc = new DOMDocument(); $doc-loadHTML($file); $p = $doc-getElementsByTagName('p'); How would then wrap the following around each p tag: form name=form target=_parent action=/index.php?action=edit_paragraphfile='.$_GET['file'].' method=post input type=hidden name=old_html value='.htmlentities($matches[0]).' pa href=javascript:; onclick=document.form.submit();'.$matches[1].'/a/p /form BTW if its not obvious I am trying to create a CMS that lets users edit anything within a p tag! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] why php not running ?
hi Curt. for the first question : yes i always do the things below: #portupgrade -arR and #cvsup -g -L 2 /etc/por... i mean yes my ports up to date. and for the second : [EMAIL PROTECTED] php -v Segmentation fault (core dumped) [EMAIL PROTECTED] php-config --version 5.0.5 [EMAIL PROTECTED] dont know how to solve this troublesome problem.
Re: [PHP] How would you write this?
On Sun, 4 Dec 2005 11:44:12 -0800 Curt Zirzow [EMAIL PROTECTED] wrote: style .errored { color: #FF; } /style ?php $set_class = array(0 = '', 1 = 'errored'); define('SET_USERNAME', 0x01); define('SET_PASSWORD', 0x02); define('SET_ALL', SET_USERNAME SET_PASSWORD); $set = 0; $username = ; $password = ; if (isset($_POST['username'])) { $username = trim($_POST['username']); if (strlen($username) 0) { $set |= SET_USERNAME; } } ... if (($set SET_ALL) == SET_ALL) { echo Logging in with: . $username . ':' . $password; } else { ? form action=login.php method=post table trtd colspan=2Login:/td/tr trtdUsername:/td ?php $class = $set_class[ $set SET_USERNAME ]; echo td class=$class echo input type=\username\ name=\username\ value=\ . $username . \/; ... It might be a bit overkill for such a simple thing.. but heck.. i was bored :) Interesting. This gives me some ideas. I'm also happy to know I wasn't too far off :- Thanks, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PDF Generator
Why not use JavaScript? It's supported well in Acrobat Professional. Jud. Original Message: - From: Dan Harrington [EMAIL PROTECTED] Date: Sun, 4 Dec 2005 09:12:51 -0700 To: php-general@lists.php.net Subject: [PHP] Re: PDF Generator I have a TON of forms that I have to populate, can I make a PDF file using Acrobat Professional, and then use PHP to populate those forms and have text inserted into the pre-made text fields that I made using Acrobat? And if so, what is the best tool for that? I'd prefer to do it for free, but spending $$ is fine too. Thanks Dan Rick Lim wrote: What is the best FREE pdf generator for PHP? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php mail2web - Check your email from the web at http://mail2web.com/ . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Could you help me to solve this problem?
hi, After uploading file to web server with php upload script in http://us3.php.net/features.file-upload, I can't access the file with web browser. I get error message as 403 Forbidden or You are not authorized to view this page. However, there is no such problem when i using FTP to upload files. Please help, Thanks a lot. Ran -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Could you help me to solve this problem?
When you upload you also need to change the permissions on the file that you uploaded. chmod(/somedir/somefile, 0755) More info : http://us3.php.net/chmod On 12/4/05 6:35 PM, CHEN RAN [EMAIL PROTECTED] wrote: hi, After uploading file to web server with php upload script in http://us3.php.net/features.file-upload, I can't access the file with web browser. I get error message as 403 Forbidden or You are not authorized to view this page. However, there is no such problem when i using FTP to upload files. Please help, Thanks a lot. Ran -- Stephen Johnson The Lone Coder http://www.ouradoptionblog.com *Join us on our adoption journey* [EMAIL PROTECTED] http://www.thelonecoder.com *Continuing the struggle against bad code* -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Exception
I don't know about PHP, however, in other languages, exception throwing and catching is expensive. As Curt put it, exception handling should be reserved for truly exceptional cases: - DB connection failure - SOA connectivity failure General errors like the user not completing a form, should be handled as regular error conditions. Hope this helps. On 12/4/05, Christian Herrnbock [EMAIL PROTECTED] wrote: mr php wrote: Hello Is it good to use exception handling for error handling or I should use only for exceptions? For example: Is it good to throwing user input errors with throw new Exception(). Thanks Hello, I would also go by keeping them separate; it helps both in logic-flow, and maintenence. Not to mention, exception handlers are design to do just that - handle exceptions. Regards, Christian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anas Mughal
Re: [PHP] Re: PDF Generator
I used this in the past: http://www.ros.co.nz/pdf/ Fully self-contained. My only frustration was that didn't support multiple tables on one row. Maybe I was asking too much... ;) On 12/4/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Why not use JavaScript? It's supported well in Acrobat Professional. Jud. Original Message: - From: Dan Harrington [EMAIL PROTECTED] Date: Sun, 4 Dec 2005 09:12:51 -0700 To: php-general@lists.php.net Subject: [PHP] Re: PDF Generator I have a TON of forms that I have to populate, can I make a PDF file using Acrobat Professional, and then use PHP to populate those forms and have text inserted into the pre-made text fields that I made using Acrobat? And if so, what is the best tool for that? I'd prefer to do it for free, but spending $$ is fine too. Thanks Dan Rick Lim wrote: What is the best FREE pdf generator for PHP? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php mail2web - Check your email from the web at http://mail2web.com/ . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Anas Mughal
[PHP] using curl to peform post
Hi all I have need to simulate the role of a web browser by submitting the following code. form name=form1 action=propsearch.pl method=post textarea rows=12 cols=70 name=msgGREENc/textarea input type=submit value=Submit /form Heres my PHP code that got from the curl function. ?php $url = www.example.com; $page = /cgi-bin/ecco/scripts/h2h/glo/propsearch.pl; $post_string = msg=GREE01; $header = POST .$page. HTTP/1.0 ; $header .= MIME-Version: 1.0 ; $header .= Content-type: application/PTI26 ; $header .= Content-length: .strlen($post_string). ; $header .= Content-transfer-encoding: text ; $header .= Request-number: 1 ; $header .= Document-type: Request ; $header .= Interface-Version: Test 1.4 ; $header .= Connection: close ; $header .= $post_string; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 4); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header); $data = curl_exec($ch); if (curl_errno($ch)) { print curl_error($ch); } else { curl_close($ch); } print $data; ? Any assistant would gratefully be appreciated. Kind Regards Brent Clark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Performance question
I've been spending some time to find performance pros and cons, but so far haven't had any real luck. Can someone on this list say which is better than the other, and also why, when it comes to these kinds of syntax: 1. php code ? html statements?= $variable ?/end tag tag?= $var2 ?/end tag ? more php code 2. php code echo tag$variable/end tag; echo tag$var2/end tag; more php code In both cases, some processing is done, not that 'echo' uses a lot of cpu time, but still... On the other hand, there are more jumps in and out for the interpreter in the first example... I'd love some thoughts on this. -- Anders Norrbring Norrbring Consulting -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OpenDocument .odt to .xhtml Parser
With the release of OpenOffice.org 2 came the ability to export .odt to .xhtml. As most probably know, the OOo .odt native file format is basically gzipped XML. Also OOo comes with .xsl files which are used to transform the .odt file to .xhtml files when they are exported. Does anyone know of any projects being worked on which use the OOo .xsl XSLT files to transform .odt files to .xhtml files? The type of code I'm specifically looking for would be an API written in PHP 5 that can basically take any .odt file and spit out a .xhtml file using the .xsl files that ship with OOo (can be found in share\xslt\export\xhtml in the root install dir on a Windows install, not sure about Linux). Does anyone know if any code is out there to do this, or if any projects exist to address this need. I've done a little Google research on this topic, but haven't found much, so I figured someone on this list might know where to point me for more info, or can point me to people who are working on this. If no one is doing something like this is anyone interested in working on the with me? Thanks for any replies. I'm not an XML whiz, and frankly don't want to be one, so I'm hoping there is some code out there that already addresses this.