Re: [PHP] need some regex help to strip out // comments but not http:// urls
On 28.05.2013 23:17, Daevid Vincent wrote: I'm adding some minification to our cache.class.php and am running into an edge case that is causing me grief. I want to remove all comments of the // variety, HOWEVER I don't want to remove URLs... You need a negative look behind assertion ( http://www.php.net/manual/en/regexp.reference.assertions.php ). (?!http:)// will match // only if it isn't preceded by http:. Bye, Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Boolean type forced on string assignment inside if statement
Volmar Machado qi.vol...@gmail.com wrote: When the one of the operators were 2, the cases with returns 2 otherwise returns 0 (Or 1 when any operator is 1). And if the operators are 1 and 2, return 0 too. Its curious for me. is the bitwise and operator. You have to look at the binary representation of the numbers to see what is happening: 2 decimal is 0010 binary 1 decimal is 0001 binary 2 1 == 0010 0001 == == 0 In your other examples you had 2 3 == 0010 0011 == 0010 == 2 and 4 3 == 0100 0011 == == 0 Does this help? Bye, Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unexpected behavior of max() function
On 11.12.2012 07:48, Рогулин С.В. wrote: I encountered with unexpected behavior of max() function. When i pass a parameter ['100', '110,453351020813', '9'], this function gives answer '9' var_dump( max(array('100', '110,453351020813', '9')) ); // will output: // string(1) 9 As the output tells you, you are comparing strings and the character '9' is greater than the character '1' (at the beginning of the two other strings). Bye, Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regexp novice
On 2012-05-17 22:37, Jim Giner wrote: Trying to validate an input of a time value in the format hh:mm, wherein I'll accept anything like the following: hmm hhmm h:mm hh:mm in a 12 hour format. My problem is my test is ok'ing an input of 1300. Here is my test: if (0 == preg_match(/([0][1-9]|[1][0-2]|[1-9]):[0-5][0-9]/,$t)) return true; else return false; Can someone help me correct my regexp? /([0][1-9]|[1][0-2]|^[1-9]):[0-5][0-9]/ The third part of your alternate expressions matches 3:00 from the string 13:00 (it ignores the 1 at the beginning). Using ^ avoids this because now only one digit is allowed before the :. Bye, Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP, PDO and MS-SQL ?
Hi, could someone tell me what I need to install and how to configure everything so that I can connect with PHP and PDO to a MS-SQL server? I have an OpenSuse 11.4 installation. I added the Apache-PHP repository and upgraded to PHP 5.3.8. php-mssql, -php-odbc, libfreetds and the freetds-tools are installed. Do I need all this or anything else? phpinfos() reports the odbc and mssql modules are loaded. I can't find config files, though. The aim is to connect to a ms-sql server using PDO without a system dsn if possible. Is there a detailed description for people who don't know everything about this stuff, yet? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Common way to store db-password of open session?
Am 03.12.2011 23:54, schrieb Tamara Temple: If you give every application user a unique set of database access permissions, that means that any one of those users can access your data base WITHOUT going through your application if they manage to get access to your data base server. Is that clearer? Your application's users should not be able to access the data base directly. The application should be the thing to manage the data base. You may want to have different data base credentials for different user *roles* (plain, privileged, admin roles, etc), but to give *every* application individual data base unique credentials is not only unnecessary, but also a security risk. OK, then where or how is the most advisable place to store the application's credentials. One way is to have it as constants in an seperate php-file somewhere within the doc-root so php can easily access it as include. An application that is to be put on an outside hoster's server has to do it like this, I guess. Mine will stay on a server within the LAN for now, so I've got root access. This way the web-server could display it in the probaply unlikely case someone guesses the url to it AND the php-interpreter fails to process it first. More likely a local user could read it, though. So how would I store it and restrict access to it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Common way to store db-password of open session?
Am 29.11.2011 23:54, schrieb Tamara Temple: As I read it, the OP may be confusing application user logins and the credentials used by the application to access the data base. Individual application users should *NOT* have access directly to the data base by having their individual credentials in the db access list. The application should have a unique set of credentials for accessing the database, and the only way users can gain access to the database should be through the application. Do NOT store data base credentials anywhere in the session or in cookies, either, as that can give people access to your database as well. Actually the OP is trying to figure out, why it is a good thing to have just one set of db credentials for the application instead of individual credentials for every user. The DBMS has a fine grained permission control system in place. The issue about thuis is I need to keep the users dbuser and password in a session or cookie because I need it for every connection to the DB. On the other hand a common way seems to be to check the users credentials and store just some kind of LoggedIn = TRUE and use the credentials of the application for queries. But this way I had to reinvent the access control system within the application. I'm rather leaning to the 1'st way with individual credentials because I haven't seen convincing arguments against it, yet. Right now we are talking about a web server that has just a very limited set of local users that might get the idea to snoop in /tmp for session files. AFAIK according to default settings the garbage collection runs not very ofthen on low frequented sites so stale session files could stay in /tmp for months. That is not very comfortable, though. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Common way to store db-password of open session?
Hi, is threre a most advisble way to store db-passwords of an open user-session? As far as I get it, a common login strategy is to let the user login by namepassword, check it, store a login=TRUE as php-session variable and later use a common dbuser+pw to query data provided login is TRUE. This way one wouldn't have to store the users pw or actually the user wouldn't have a real db-account but rather an application account. Is this really better or equal than using real db-accounts? Should I rather store the db-credentials in a session or cookies? Session is vulnerable as any host-user could look into /tmp. This would generally be a trusted few though. On the other hand cookies could be manipulated by the user or at least be spied upon on the way between user and web-host everytime the credentials are needed for a query. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is there a decent design app ?
Hi Is there a decent design app that can automatically update links within the pages of a php site whenever a referred file gets moved or renamed? Like you have /foo.css and for some reason or another you move it to /lib/css and rename it to bar.css. Now it'd be nice if an IDE was aware of all the references within a site and update the affected urls. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Howto detect the hostname of the server?
Hi, how could I identify the server the script runs on? I've got a testserver on Windows and a remote system on Linux that need a couple of different settings like IP and port of db-server or folder to store logfiles. I'd like to do something like: if ( $_SERVER['some_key'] = 'my_test_box' ) { $db_host = '1.1.1.1'; $db_port = 1234; } else { $db_host = '2.2.2.2'; $db_port = 4321; } I looked into phpinfo() but haven't found anything helpful, yet. Have I overlooked something or is there another way to identify the server? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Tutorial for the structure of an php-app ?
Hi again, is there a tutorial for the structure of an php-app? There are more than enough books and online docs that teach the basics of PHP and of course the native mysql commands. I'd now rather need a help to figure out how to pull up a wee bit more complex app. I know how to connect to a DB even though it might not be mysql. I can select stuff and dump it into a HTML table. Actually I prefer PDO and PostgreSQL. Is there a tutorial that teaches how to construct a app with a 2-column design. E.g. a menue frame on the left and a bigger content area on the right. So a click on a menue item would dynamically display a form or a list in the content area. What is a good way to glue everthing together between login and logout. I know cookies and sessions and I suspect those were a way to do it. How would I integrate a template system like smarty? It weren't bad if there were clues about AJAX, too. I'm in search of a way to extend the knowledge about bricks, tubes and cables to the wisdom to actually build a house out of those things. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Howto detect the hostname of the server?
Am 26.11.2011 01:35, schrieb Simon J Welsh: On 26/11/2011, at 1:14 PM, Andreas wrote: how could I identify the server the script runs on? php_uname('n'); http://php.net/php_uname Great, that even works on a ssh-tunnel. I got derailed by the fact that my tunnel maps the remote server to localhost:80 so $_SERVER['SERVER_ADDR'] and $_SERVER['SERVER_NAME'] wouldn't help. On the other hand for everyone on the remote LAN $_SERVER['...'] would work ok, though I didn't realise that before. Thanks :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dealing with multiple form submissions
Am 25.08.2011 11:01, schrieb John Black: True, a SESSION can be reset by closing the browser but I am not trying to deny a user from submitting different information again. I want to prevent them from submitting the same data again by accident (back button or refresh). what about storing an md5 of the message body in the db? that way you could check if the mail is exactly the same. probaply you could let the md5 stay in the db for hours so that nobody could use 2 browser windows to send mail1, mail2, mail1, it wouldn't even be necessary to store the identity of the sender since its highly inprobable that 2 100% identical messages contain anything worth bothering about. http://php.net/manual/en/function.md5.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to catch an irregular end of an application?
Hi, what is the best practice to catch an irregular end of an application? The browser might crash or the user closes accidently the browser window decides to jump away to his favourite bloq without loging out of my application. Is there some way to let an javascript event trigger some ajax to store an exit time into my DB or make it mandatory to at least visit the logout.php before someone can surf away? regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how catch a warning by file_put_contents() ?
Hi, I wrote stuff with file_put_contents() in a try{} catch{} and it worked. Then I'd like to check what happens when some error occurs so I writeprotected the targetfile. Instead of getting my own message by the catch{} block I got a standard warning in the browser. Can't I catch those warnings, too? And why does this function rise a warning when it can't acomplish it's task? Samplecode: try { $msg = date (d.m.Y H:i:s) . 'This should be stored in the file.'; file_put_contents( '/tmp/exceptions.txt', $msg . \n, FILE_APPEND); } catch ( Exception $e ) { $msg = Exception . $e-getCode() . / . $e-getMessage(); echo p$msg/p; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can't create new projects with Netbeans as nonadmin
Hi, Netbeans 7.0.1 on WinXP. I can't create new projects with Netbeans without being logged in as administrator. When I call file-new project I only get the category Samples. The category PHP with the empty projects only appears when I'm logged in as Administrator. How can I create projects as normal user? regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie question. What is the best structure of a php-app?
Hi, I'm fairly new to PHP but not to programming as such. Currently I sat up XAMPP with xdebug, Netbeans and Eclipse to get a feeling. I can write and run php-files but I am wondering how I should construct a more complex application that runs over several pages between a login and a logout. How would I structure such an application so that it is possible to run it in the debugger from the beginning? E.g. as a simple example I may build an index.html that has a menue with links to 3 php-files. 1) login.php 2) enter_data.php 3) list_data.php as html-links within an ul-list. The user should at first click on login where user/password gets entered an a session starts. Then the application comes back to index.html. Now he might click 2) ... Is it possible to run the whole application from the start on? index.html is no php so xdebug won't process it and therefore the IDEs may start index.html but can't show the stage where the page is just waiting e.g. for a click on login and later branch for the other options. Even if I write an index.php that shows the menue eventually the script just dumps the html that'll wait for the following clicks. Those following steps are far more likely in need to be debugged. Is it neccessary to debug those subpages separately even though they need prior steps like login.php that store some infos in a session or cookie that later scripts need to rely on? Can I somehow watch what is going on from the index.html on? Until now I just found documentation that explains the php language. Thats good too but I'd need to get an idea about the web-app-thinking that consist of just pages where the designer has to hope that the user stays within the applicationflow instead of clicking unexpectedly on the back-button or just jumping off to some other site if he likes to. In contrast to this desktop-apps seem to be less demanding because I know where a user can navigate from a certain stage within the app and I could step from program start to stop with the debugger if I feel the need to. Is there a tutorial that explains how to build consistent web-apps beyond the details of php language? regards... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] dependency check
Hallo, I have a PHP application made of many files ( php, images etc. ) I have a strong suspicion that many of the files in the application directory are no more in use, because of changes made on the application. Is there a tool that, starting from the entry point of the application, scans the files recursively for included/used files and lists them ? With this list I could delete the remaining files. Thanks Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] concatenating with . or ,
hi, here it is described in detail: http://blog.libssh2.org/index.php?/archives/28-How-long-is-a-piece-of-string.html Govinda schrieb: easy to find our about concatenating with . in the docs... but not so with , what is the difference? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
AW: [PHP] scalable web gallery
in 1 year, there going to be more than 1000 photo uploaded or more. That isnt really much. A directory can held much more than a few thousand files. They use more than one Server because 1 Server can't handle the load. The dont do that because of limited File system. But the file system may get slower if you have thousands of files in one dir. So maybe make dirs like c/a/cartoon.jpg to get not too much files in one dir. If you need several Servers for this depends on how many visitors you have. -Ursprüngliche Nachricht- Von: paragasu [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 10. Juli 2008 09:47 An: php-general@lists.php.net Betreff: [PHP] scalable web gallery i am planning to create a web photo gallery. i know there is a lot available out there, but i really want to create my own. the problem is not about creating the photo gallery. i want it to be scalable. the plan is saving the image metadata in the database and keep the original files in a folder. while it work perfectly, i afraid how many files 1 directory can keep. in 1 year, there going to be more than 1000 photo uploaded or more. sure it bring problem to maintain thus files. when i see big2 website out there like friendster, photobucket. the url for the image change like pic-1.domain.com/images/filename.jpg pic-2.domain.com/images/filename.jpg etc. they seems to put the image in different subdomain. Just wan't to ask anyone who did create a big-big web gallery like this. How did you do it? thanks -- 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] XMLRPC and file_get_contents
Hi all, I'm writing an XML-REC client in PHP, based on the following example: ?php $request = xmlrpc_encode_request(method, array(1, 2, 3)); $context = stream_context_create(array('http' = array( 'method' = POST, 'header' = Content-Type: text/xml, 'content' = $request ))); $file = file_get_contents(http://www.example.com/xmlrpc;, false, $context); $response = xmlrpc_decode($file); if (xmlrpc_is_fault($response)) { trigger_error(xmlrpc: $response[faultString] ($response[faultCode])); } else { print_r($response); } ? If the XMLRPC call takes longer than say 30 seconds, the file_get_contents method doesn't returns null, and the script finishes. However, the XMLRPC server is not finished with the computation and gets a broken pipe since the client has already closed the connection. Is there some timeout? Am I doing something wrong? Kind regards, Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XMLRPC and file_get_contents
Stut wrote: Andreas Schlicker wrote: Hi all, I'm writing an XML-REC client in PHP, based on the following example: ?php $request = xmlrpc_encode_request(method, array(1, 2, 3)); $context = stream_context_create(array('http' = array( 'method' = POST, 'header' = Content-Type: text/xml, 'content' = $request ))); $file = file_get_contents(http://www.example.com/xmlrpc;, false, $context); $response = xmlrpc_decode($file); if (xmlrpc_is_fault($response)) { trigger_error(xmlrpc: $response[faultString] ($response[faultCode])); } else { print_r($response); } ? If the XMLRPC call takes longer than say 30 seconds, the file_get_contents method doesn't returns null, and the script finishes. However, the XMLRPC server is not finished with the computation and gets a broken pipe since the client has already closed the connection. Is there some timeout? Am I doing something wrong? There could be several timeouts at work here. First you can set a timeout in the context[1]. Second the PHP request time limit[2]. And finally your web server (assuming this is running through a web server) will have its own timeout - check the documentation for whatever server you're using for details. [1] http://php.net/wrappers.http [2] http://php.net/set_time_limit Hi Stut, I already used the set_time_limit to set a script running timeout. Looks like the problem was the timeout in the context. Thanks very much for you help. Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] LDAP and character encoding
Hej! I'm running PHP 5.1.2 on Suse 10. The LDAP server is openldap 2.3.19 I've problem with swedish characters and DN. DN: cn=åäö,dc=example,dc=com $res = ldap_search($ds, 'dc=example,dc=com', '(objectClass=*)'); $dn = ldap_get_dn($ds,$res); == $dn is cn=\C3\85\C3\84\C3\96,dc=example,dc=com How do I convert $dn to a readable format? I've tried utf8_decode, but it doesnt work. utf8_decode works on the entries returnd by ldap_get_attributes. /Andreas This message was sent using IMP (http://www.horde.org). Running on PHP 5.1.2, Apache 2.0.55, Ubuntu Dapper. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how should MS Access DATETIME be handled in PHP?
Hi! Bing Du wrote: Excellent! Yes, it now does give me a clue to see what's actually in the object. print_r($rec[0]) shows: stdClass Object ( [year] = 2005 [month] = 8 [day] = 31 [hour] = 0 [minute] = 0 [second] = 0 [fraction] = 0 ) I've never dealt with object in PHP. Something new learnt today. I'm now able to use get_object_vars($rec[0]) to extract the info from the object. You don't need get_object_vars(), you can simply use $rec[0]-year; Perhaps have a look at the docs: http://de3.php.net/oop5 And perhaps the following example is useful for you: http://odbtp.sourceforge.net/timetable.html#list regards Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Extending a class with a static constructur (like PEAR::DB)
[EMAIL PROTECTED] wrote: Ahhh! I'd kept thinking what connect() returned was a db object, but it does look like it returns varying objects depending on which database you're using. correct Maybe I'd want to extend DB_common instead of DB_mysql, so that the methods would be inhereted by any object? But DB_mysql will not inherit from your object! Look at the source: class DB_mysql extends DB_common {...} If you inherit from a class, the parent class will not inherit your (the child classes) methods. If a class should inherit from your object, it must explicitly inherit from that class. Best regards Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Extending a class with a static constructur (like PEAR::DB)
Chris wrote: You'll need to: $dbtoy = new DBToyExt(); $dbtoy-connect() $dbtoy-testext('testing'); But you cannot do: $dbtoy = new DBToyExt(); $dbtoy-connect() $dbtoy-testext('testing'); $result = $dbtoy-query('SELECT...'); //[...] You have to do something like this: $dbtoy = new DBToyExt(); $db = $dbtoy-connect() $dbtoy-testext('testing'); $result = $db-query('SELECT...'); //[...] If you want to avoid that, you have to write a wrapper around DB. best regards Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: create xml root-element with xmlns and xsd link (using DOM)
Rob wrote: That's how namespaced attributes, which is nothing more than you are creating, are supposed to be created in DOM. OK, thank you! best regards Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: simplify DOM api
Rob Richards wrote: You can also look at using xmlwriter, when creating serialized trees, that automatically does escaping for you. Hm, AFAIK latest xmlwriter versions provide an OO API. Do you know about any documentation for it? The only code I've seen so far is: http://cvs.php.net/viewcvs.cgi/pecl/xmlwriter/examples/xmlwriter_oo.php?view=markuprev=1.1.2.2 And that's not too much (but promising) ;-) Or do you know about some more complex examples? Btw. I need to validate my created documents against an XML schema, I doubt this is possible with xmlwriter. Best regards Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: DOMElement::setAttribute() manual example question
Hi Rob! Rob wrote: ?php $doc = new DOMDocument(1.0); $node = $doc-createElement(root); $node-setAttribute(align, left); $doc-appendChild($node); echo $doc-saveXML(); ? Both ways are perfectly valid. $node and $newnode refer to the same object. It was written the 1st way to demonstrate the return value of appendChild(), because in many cases people create the element differently. i.e. $newnode = $doc-appendChild($doc-createElement(root)); or $newnode = $doc-appendChild(new DOMElement(root)); Thank you very much for confirming that! I was not sure if it's really the same. Also, in the event $node is created using the new DOMElement syntax: $node = new DOMElement(root); the node is read only and must be appended into the tree before it can be modified, so the example just tries to be neutral here regarding the syntax used. $node = new DOMElement(root); is read only, while $node = $doc-createElement(root); is not? Why? btw., I think this: http://news.php.net/php.internals/22117 is a very, very, very good idea! I hope the patch will make it into core soon! best regards Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] simplify DOM api
Hi Rob! Rob wrote: $node = new DOMElement(root); In this case the element is not associated with a document. In DOM, you really aren't supposed to have a node not associated with any document, but this syntax allows the DOM classes to be extended in PHP. Once the node is associated with a document, you then have full editing capabilities. Again, very helpful information - thanks a lot! I have to do something like: ?php $array_of_book_objects = array('...'); $doc = new DOMDocument('1.0'); $books = $doc-appendChild(new DOMElement('books')); foreach($array_of_book_objects as $book_data) { $book = $books-appendChild(new DOMElement('book')); $book-setAttribute('isbn', xml_entity_encode($book_data-isbn)); $book-appendChild(new DOMElement('title', xml_entity_encode($book_data-title))); $book-appendChild(new DOMElement('description', xml_entity_encode($book_data-description))); $author = $book-appendChild(new DOMElement('author')); $author-appendChild(new DOMElement('name', xml_entity_encode($book_data-author_name))); } echo $doc-saveXML(); ? Because my script is by far more complex (but does not use more advanced DOM features), I'd like to simplify the DOM api a little bit more. With extending DOMElement I think I have found a nice way: ?php class SimpleDOMElement extends DOMElement { function addChild($name, $value=NULL) { if (is_null($value)) { return $this-appendChild(new SimpleDOMElement($name)); } else { return $this-appendChild(new SimpleDOMElement($name, xml_entity_encode($value))); } } function addAttribute($name, $value) { return $this-setAttribute($name, xml_entity_encode($value)); } } class Books extends DOMDocument { private $books_element; function __construct() { parent::__construct('1.0'); $this-books_element = $this-appendChild( new SimpleDOMElement('books')); } function addBook($book_object) { $book = $this-books_element-addChild('book'); $book-addAttribute('isbn', $book_object-isbn); $book-addChild('title', $book_object-title); $book-addChild('description', $book_object-description); $author = $book-addChild('author'); $author-addChild('name', $book_object-author_name); } } $array_of_book_objects = array('...'); $books = new Books; foreach ($array_of_book_objects as $book_data) { $books-addBook($book_data); } echo $books-saveXML(); ? I think this should be OK, or shouldn't I do it this way? Perhaps you have seen that I've used a xml_entity_encode() function. This function works like htmlspecialchars(), but replaces ' with apos; and not #039;. Or do all of you use htmlspecialchars()? Does it work with Unicode strings? best regards Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] create xml root-element with xmlns and xsd link (using DOM)
Hi! The XML-Code I have to create (http://news.php.net/php.general/231486), needs a root-element, with xmlns and XML schema link, something like that: Test xmlns=http://example.com/test; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://example.com/test test.xsd Does DOM provide any means to add a XML schema link to the doc? Now I'm doing it this way (which seems to work): ?php $doc = new DOMDocument; $root = $doc-appendChild(new DOMElement('root', NULL, 'http://example.com/test')); $root-setAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', 'http://example.com/test test.xsd'); echo $doc-savexml(); ? Does DOM provide nothing else? Does anybody see any problems with this approach? Best regards Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] DOMElement::setAttribute() manual example question
Hi! I've a question regarding the example in DOMElement::setAttribute() chapter of the PHP manual: http://de3.php.net/dom-domelement-setattribute There, an attribute is added to an element this way: ?php $doc = new DOMDocument(1.0); $node = $doc-createElement(root); $newnode = $doc-appendChild($node); $newnode-setAttribute(align, left); echo $doc-saveXML(); ? $doc-createElement() returns the created DOMElement, $doc-appendChild() returns the appended DOMNode. Isn't this the same object? Is it a reference? I'm asking, because the following works too: ?php $doc = new DOMDocument(1.0); $node = $doc-createElement(root); $node-setAttribute(align, left); $doc-appendChild($node); echo $doc-saveXML(); ? I like the 2nd example more, because first you create an object (DOMElement), add some attributes to the object and after that append it somewhere to the DOM tree. The 1st example creates a new DOMElement object, appends it to the DOM tree, and adds the attributes not to the created object, but to another object (the DOMNode appended to the tree), which seems to be a reference to the original object. Why does the manual prefer the (IMO less intuitive) 1st way? Is there a problem with the 2nd way? best regards Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Coding Practice: Use global $var or pass in by refernce
Hi Gustav! Gustav Wiberg wrote: My oponion is that is insane to use global variables. The main drawback with global variables is that is very easy to mix up variables, and keep track of what variable belongs to what. So an advice: Don't use it! Ok, so what's your recommendation to solve the problem with using a DB class in many other objects/methodes? Think of a DB class: class DB {...} And a lot of classes which want to use the DB class: class Foo { function saveChangesInDb() {...} } class Bar { function saveChangesInDb() {...} } - You can use a global $db = new DB... and pass it to every class/methode, - you can make $db global in each methode, - you can create a new instance (new DB) in every methode (but you usually only want a single DB-connection per script, and where do you pass config-data to access the DB?) or - use a factory/singleton, which is not so much better than a global variable (and again, what about config-data?). So what's the way you'd recommend and why? best regards Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML-RPC problem with long running times
Hi all, I'm using Apache/1.3.33 (Unix), PHP/5.0.3, mod_ssl/2.8.22, OpenSSL/0.9.6a. I wrote a dummy script that is called by a Java program via XML-RPC, waits for some time and replies the start and end times. ?php set_time_limit(500); $xmlServer = xmlrpc_server_create(); function process() { $result = ini_get('max_execution_time') . \n; $result = $result . date(H:i:s) . \n; sleep(0); $result = $result . date(H:i:s) . \n; return $result; } xmlrpc_server_register_method($xmlServer, 'process', 'process'); $xmlRequest = $HTTP_RAW_POST_DATA; $xmlResponse = xmlrpc_server_call_method($xmlServer, $xmlRequest, NULL); #$log = fopen($filename, 'a'); #fwrite($log, $xmlResponse); #fflusch($log); #fclose($log); echo $xmlResponse; xmlrpc_server_destroy($xmlServer); ? If the script sleeps for up to 5 minutes, it works perfectly fine. However, I my real application will run probably an hour or so. If the script takes more than 5 minutes to execute, the client receives an empty response, even the header is missing. If I try to write the $xmlResponse to a file, the client receives a null message. I wrote a small script without XMLRPC that acted the same way when called by a browser. This worked perfectly (I tested it up to 20 minutes waiting time) even if I used set_time_limit(5) and sleep(500). Does anybody have an idea how to solve this problem? Thanks in advance. Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML-RPC problem with long running times
Of course, fflusch($log); should be fflush($log); I just found out that $xmlResponse really is empty. However, connection_status() returns 0, so I assume that the script is not interrupted by a timeout. Why does xmlrpc_server_call_method($xmlServer, $xmlRequest, NULL) return nothing if the call takes longer than 5 minutes and there is no interrupt? Is there some special XMLRPC timeout? Any idea? Andreas Andreas Schlicker schrieb: Hi all, I'm using Apache/1.3.33 (Unix), PHP/5.0.3, mod_ssl/2.8.22, OpenSSL/0.9.6a. I wrote a dummy script that is called by a Java program via XML-RPC, waits for some time and replies the start and end times. ?php set_time_limit(500); $xmlServer = xmlrpc_server_create(); function process() { $result = ini_get('max_execution_time') . \n; $result = $result . date(H:i:s) . \n; sleep(0); $result = $result . date(H:i:s) . \n; return $result; } xmlrpc_server_register_method($xmlServer, 'process', 'process'); $xmlRequest = $HTTP_RAW_POST_DATA; $xmlResponse = xmlrpc_server_call_method($xmlServer, $xmlRequest, NULL); #$log = fopen($filename, 'a'); #fwrite($log, $xmlResponse); #fflusch($log); #fclose($log); echo $xmlResponse; xmlrpc_server_destroy($xmlServer); ? If the script sleeps for up to 5 minutes, it works perfectly fine. However, I my real application will run probably an hour or so. If the script takes more than 5 minutes to execute, the client receives an empty response, even the header is missing. If I try to write the $xmlResponse to a file, the client receives a null message. I wrote a small script without XMLRPC that acted the same way when called by a browser. This worked perfectly (I tested it up to 20 minutes waiting time) even if I used set_time_limit(5) and sleep(500). Does anybody have an idea how to solve this problem? Thanks in advance. Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Convert fake Unicode to real UTF-8
Thanks for the tip! htmlentities() didn't work, as it just converted the in the string to amp;. However, following the trail I did get it working the other way round, using: html_entity_decode($row['text'], ENT_NOQUOTES, UTF-8) After this call, I had a real unicode text in my output file. About the question where I saw it - both in phpMyAdmin and in my own PHP script. It seems to be really stored as an ASCII text in the DB, as a substr($row['text'], 0, 1) also simply outputs . Thanks for your help, Andreas Minuk Choi schrieb: Have you tried feeding that through htmlentities()? e.g. echo htmlentities(#1043;#1072;); see if that outputs what you want on the page. -Mk Andreas Jakl wrote: I've been searching for quite some time now and tried several functions, but didn't find a solution. I hope somebody can point me in the right direction. The problem: Russian text is entered through a web form. It's a rather badly administrated external webserver with old versions of everything, so I can not set the table to UTF-8. In the MySQL-Table the text gets converted to something like #1043;#1072; as an ASCII text. Using PHP I need to get the text out into a plain text file, as a real UTF-8 string. How can I convert this? All the conversion methods from PHP that I tried failed, as the text seems to really consist of the individual ASCII chars like , #. Therefore, a normal to-unicode-conversion doesn't change anything. Thanks in advance, Andreas Jakl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Convert fake Unicode to real UTF-8
I've been searching for quite some time now and tried several functions, but didn't find a solution. I hope somebody can point me in the right direction. The problem: Russian text is entered through a web form. It's a rather badly administrated external webserver with old versions of everything, so I can not set the table to UTF-8. In the MySQL-Table the text gets converted to something like #1043;#1072; as an ASCII text. Using PHP I need to get the text out into a plain text file, as a real UTF-8 string. How can I convert this? All the conversion methods from PHP that I tried failed, as the text seems to really consist of the individual ASCII chars like , #. Therefore, a normal to-unicode-conversion doesn't change anything. Thanks in advance, Andreas Jakl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Compiling PDO statically into PHP 5.0.4
Hi! I would like to compile PDO + PDO_sqlite statically into PHP 5.0.4. First I downloaded PDO-0.3.tgz and PDO_SQLITE-0.3.tgz and extracted them to /my/phpsrcdir/ext. I renamed the directories from PDO-0.3 to pdo and from PDO_SQLITE-0.3 to pdo_sqlite. I tried to follow these instructions: http://www.php.net/manual/en/install.pecl.static.php so from /my/phpsrcdir I executed: ./buildconf --force But after this I tried ./configure --help | grep -i pdo without any results. So I did not know which ./configure parameters where necessary, so I extracted these .tgz-files to another location (not in /my/phpsrcdir) and used phpize to find out which ./configure parameters I need. So I found out that I have to use --enable-pdo --with-pdo-sqlite I did not expect it to work, but I tried to execute the following ./configure command: ./configure \ --prefix=/my/phpbindir/ \ --enable-pdo \ --with-pdo-sqlite \ --enable-memory-limit It did not fail, but after make make install there is no pdo-support compiled in. What is going wrong here? What can I do? kind regards Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Tomcat and php in Suse 9.2
I have installed tomcat and added php-support with help of the php-servlet but it seem like php cant find any of the extensions installed. Like mysql. I have the php4-mysql package installed. If i run php -i from the commandline its telling me that I have mysql-support and a small php-script runned from the commandline verifies this. But if i run phpinfo() from a php-page under tomcat there is no support for mysql (or anyother extension). It tells me that its using /etc/php.ini and I have enabled the mysql extension in it. Anyone who knows why tomcat failes to find the php-extensions? /Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.net bug tracking tool?
Curt, thank you. I like Mantis, too but wanted to check the php thing. I was confused there is no reference to it anywhere, as it's used by e.g. MySQL, too. Thanks, Andreas Curt Zirzow [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] * Thus wrote Andreas Goetz: Which bug tracking tool is php.net using? I know it sounds stupid, but even as I can look at the source on php.net, I can't find any documentation- is this package available for download somewhere? you can checkout the code from cvs: cvs -d :pserver:[EMAIL PROTECTED]:/repository checkout php-bugs-web see: http://cvs.php.net/php-bugs-web http://www.php.net/anoncvs.php you might be better off finding a more generic bug tracking system. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php.net bug tracking tool?
Which bug tracking tool is php.net using? I know it sounds stupid, but even as I can look at the source on php.net, I can't find any documentation- is this package available for download somewhere? Thanks, Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php5: domDocument source encoding?
I'm confused and google couldn't answer :( I'm parsing XML files using domDocument and XPath in php5. Works like a charm. But- how do I know if I need to apply and utf8decode to the data returned from the domDocument? Unlike xml_parser_create the domDocument does not seem to offer an parameter for source encoding. Any ideas? Thanks a lot, Andi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php5: domDocument source encoding?
Excellent, thank you. So I should read the document, the do a $doc-encoding = 'ISO-8859-1' before reading any nodedata values to obtain ISO characters?! As documentation hasn't caught up with $doc-encoding, how could I've found out myself? Thanks again for the quick help, Andreas Christian Stocker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi On Mon, 26 Jul 2004 16:31:38 +0200, Andreas Goetz [EMAIL PROTECTED] wrote: I'm confused and google couldn't answer :( I'm parsing XML files using domDocument and XPath in php5. Works like a charm. But- how do I know if I need to apply and utf8decode to the data returned from the domDocument? Unlike xml_parser_create the domDocument does not seem to offer an parameter for source encoding. if you're using -save or saveXML() it should use the initial encoding (and state that in the ?xml header). Otherwise (eg. $element-nodeValue) it's always utf-8. You can also read and write the attribute $doc-encoding to change the output encoding (or to read the input encoding). But as a general rule. Except for the load (where it uses the value in the ?xml header) and save methods , it's always UTF-8. chregu Any ideas? Thanks a lot, Andi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 1 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | [EMAIL PROTECTED] | gnupg-keyid 0x5CE1DECB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to use reflection API?
I'm trying to use theh reflection API but can't seem to start: $func= new Reflection_Function('counter'); Fatal error: Class 'Reflection_Function' not found in C:\htdocs\reflection.php on line 34 According to http://sitten-polizei.de/php/reflection_api/docs/language.reflection.class.reflection_function.html this should already work. Any ideas? Thanks, Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Take post values
How I take te post values ? $_POST['field_name'] php.net is your friend... http://ch2.php.net/manual/en/language.variables.predefined.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Conditional Include
Hello When I want to include a php file only conditionally, I use include instead of require. At the moment I am trying to solve the following problem. I haven't found anything in the news archive, perhaps I searched with the wrong phrase... code snippet- ?php $includefiles=1; if(...) { ... //some nested if statements. ... //in some cases $includefiles is set to 0 } if($includefiles==1) { include('incfile.php'); } ? end code- In this code, the include file is always parsed, even if $includefiles is set to 0. Even the files which are 'required()' inside incfile.php are parsed (observed with the program Filemon, which registers file access). I tried various ways to nest the if statements, but none helped. Any suggestions to have incfile.php parsed only if needed? I am using PHP Version 4.3.4 as Module, Apache/2.0.48, on Windows 2000. Thanks a lot for any suggestions! Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session expires
John W. Holmes [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Andreas Magnusson wrote: Hi, I wonder if anyone knows of a way to detect if a session has expired (when your session.cookie_lifetime != 0). I've tried to see if the session-vars are unset, but that doesn't seem to be the case, still everythings seems to be lost. My problem is that I have a page which the user must log in to in order to access it (I use sessions for this). This page contains a form which may take some time to fill in. Now the session may expire during this time and all data will be lost. My plan is to allow the user to login again without losing the data but this requires me to know if the session has expired. If you set $_SESSION['user'] and at some point it's not set anymore, then the session expired. Start a new one, throw the form data into the session ($_SESSION['post'] = $_POST), allow the user to log in and redirect back to form processing page, extract post data ($_POST = $_SESSION['post']), and process the form. Yup, that's basically what I do. Anyway the problem was that I did something stupid (as always). I do a redirect at the end of the page if the headers are not sent, because I have a lot of tests (if:s) and for each fail and some of the successful ones I want to redirect the user back to the main-page. So I trusted that if I wrote some HTML, the headers would've been sent and no redirect performed. No need to say that that was a bad thing to trust. Now I do an exit after emitting HTML instead. Thanks for your help! Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session expires
Hi, I wonder if anyone knows of a way to detect if a session has expired (when your session.cookie_lifetime != 0). I've tried to see if the session-vars are unset, but that doesn't seem to be the case, still everythings seems to be lost. My problem is that I have a page which the user must log in to in order to access it (I use sessions for this). This page contains a form which may take some time to fill in. Now the session may expire during this time and all data will be lost. My plan is to allow the user to login again without losing the data but this requires me to know if the session has expired. Thanks in advance! Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Welcher Bugtracker in/für PHP?
Hi! Suche nen netten/einfachen Bugtracker für ein PHP-Projekt. Welchen könnt Ihr empfehlen? Grüße Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: which Bugtracker for a PHP-project?
Andreas Korthaus wrote: Suche nen netten/einfachen Bugtracker für ein PHP-Projekt. Welchen könnt Ihr empfehlen? Oh sorry, I it wasn't the german list ;-) But perhaps it's also a question for this group: I am looking for a nice/easy Bug-Tracker for my PHP-Project. What would you recommend? regards, Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HTTP headers, IE and downloading
Thank you for your reply! AFAIK the headers sent here are: 'Content-Type' = 'application/x-octetstream', (perhaps other) 'Cache-Control' = 'public', 'Accept-Ranges' = 'bytes', 'Connection'= 'close' [snip] Did you try something like this: ?php header(Content-Type: application/pdf); header(Content-Disposition: inline; filename=foo.pdf); header(Accept-Ranges: bytes); header(Content-Length: $len); header(Expires: 0); header(Cache-Control: private); // header(Pragma: no-cache);//don't send this header!! ? What headers are sent at this moment? Could you post them? For a normal file (not through PHP) the headers are: Accept-Ranges: bytes Connection: Close Content-Length: 25600 Content-Type: application/msword Date: Tue, 23 Dec 2003 09:51:19 GMT ETag: 08f72d578c3c31:8d0 Last-Modified: Tue, 16 Dec 2003 02:03:44 GMT Server: Microsoft-IIS/5.0 And through PHP (my script) it is: Accept-Ranges: bytes Cache-Control: private Connection: Close Content-Disposition: inline; filename=testdoc.doc Content-Length: 25600 Content-Type: application/msword; name=testdoc.doc Date: Tue, 23 Dec 2003 10:03:35 GMT Expires: 0 Pragma: public Server: Microsoft-IIS/5.0 X-Powered-By: PHP/4.2.2 It seems whatever I try to set the headers I have control over, it doesn't work... Is there anyway one can stop PHP from sending the Pragma at all? If you send the same headers and the same data - there _can_not_ be any difference. How should your client recognize any difference? There _must_ be a difference! Use a very small file to test it, so you can compare the whole HTTP-Header + Body easily. Yes, there is a difference, I didn't say there wasn't, just that I couldn't see how that (to me) small difference would actually make such a big difference... Thank you very much! /Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HTTP headers, IE and downloading
Hi! Andreas Magnusson wrote: For a normal file (not through PHP) the headers are: Accept-Ranges: bytes Connection: Close Content-Length: 25600 Content-Type: application/msword Date: Tue, 23 Dec 2003 09:51:19 GMT ETag: 08f72d578c3c31:8d0 Last-Modified: Tue, 16 Dec 2003 02:03:44 GMT Server: Microsoft-IIS/5.0 And through PHP (my script) it is: Accept-Ranges: bytes Cache-Control: private Connection: Close Content-Disposition: inline; filename=testdoc.doc Content-Length: 25600 Content-Type: application/msword; name=testdoc.doc is this defined? I have never seen/used this. I only use: Content-Type: application/msword Date: Tue, 23 Dec 2003 10:03:35 GMT Expires: 0 Pragma: public Server: Microsoft-IIS/5.0 X-Powered-By: PHP/4.2.2 It seems whatever I try to set the headers I have control over, it doesn't work... Is there anyway one can stop PHP from sending the Pragma at all? You could look at http://de3.php.net/session_cache_limiter http://de3.php.net/manual/en/ref.session.php#ini.session.cache-limiter Perhaps you should try none? I use private. But at the moment I don't know exactly which headers are effected here, you should try out. You can find more comments about this topic here: http://de3.php.net/header Kind regards, Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: HTTP headers, IE and downloading
John W. Holmes [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Andreas Magnusson wrote: And through PHP (my script) it is: Accept-Ranges: bytes Cache-Control: private I've had the cache-control header cause problems with IE in the past. It's sent by starting a session, not something you manually send. You can change it using the session functions, though. Try setting it to none. Thanks, I tried that and it actually worked!...once...so since the number of bytes that IE downloads from my file seems to vary each time, I guess it was just a flux of luck that it downloaded the whole file this once sigh... It drives me nuts to think about it, it's just so weird... /Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HTTP headers, IE and downloading
Hi! Andreas Magnusson wrote: I'm writing a script to view/download an email-attachment. If the file happens to be an MS Word document and the browser IE (only tried with 6.0), then the download fails. If I choose to download (Content-Disposition: attachment; filename=whatever.doc) then only a part of the file (2/3) is saved to disk. Of course viewing the file doesn't work either. It doesn't seem to matter what I set the Content-Type to since IE seems to ignore that anyway, however I've tried application/msword, application/octet-stream and some others. I've tried all the things said in the comments to the header-function in the online-docs at php.net. I know my Content-Length header is correct and the whole procedure works great with Netscape 7.0 and if the attachment is a zip-file or a jpeg-image it also works in both IE and Netscape. Have a look at: http://pear.php.net/package/HTTP_Download And the first comment of: http://www.php.net/manual/en/function.session-cache-limiter.php Perhaps you should not use ouput-compression, and look at the headers generated by PHP What headers are sent? Do you use sessions? you can see this using Mozilla + Live Headers, Ethereal, http://schroepl.net/cgi-bin/http_trace.pl ... Regards, Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HTTP headers, IE and downloading
Thanks for your reply! Have a look at: http://pear.php.net/package/HTTP_Download I looked at it and it's hard to see what it does differently from what I do... And the first comment of: http://www.php.net/manual/en/function.session-cache-limiter.php Thanks, I've read that and I'm not using output compression. Perhaps you should not use ouput-compression, and look at the headers generated by PHP What headers are sent? Do you use sessions? I use sessions, and I've tried to send the same headers as the webserver sends if I download a file directly (rather than through PHP). It doesn't work... Maybe I should just create a temporary file and relocate the browser to it in case the browser is IE... you can see this using Mozilla + Live Headers, Ethereal, http://schroepl.net/cgi-bin/http_trace.pl ... Thanks, I've written my own HTTP header tracer in C++, but it hasn't been able to help me since the headers looks good to me... /Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HTTP headers, IE and downloading
Hi! Andreas Magnusson wrote: Have a look at: http://pear.php.net/package/HTTP_Download I looked at it and it's hard to see what it does differently from what I do... Use Ethereal or your own tracer to find out! And compare to a direct request to a real file! AFAIK the headers sent here are: 'Content-Type' = 'application/x-octetstream', (perhaps other) 'Cache-Control' = 'public', 'Accept-Ranges' = 'bytes', 'Connection'= 'close' And the first comment of: http://www.php.net/manual/en/function.session-cache-limiter.php Thanks, I've read that and I'm not using output compression. Did you try something like this: ?php header(Content-Type: application/pdf); header(Content-Disposition: inline; filename=foo.pdf); header(Accept-Ranges: bytes); header(Content-Length: $len); header(Expires: 0); header(Cache-Control: private); // header(Pragma: no-cache);//don't send this header!! ? What headers are sent at this moment? Could you post them? Perhaps you should not use ouput-compression, and look at the headers generated by PHP What headers are sent? Do you use sessions? I use sessions, and I've tried to send the same headers as the webserver sends if I download a file directly (rather than through PHP). It doesn't work... Maybe I should just create a temporary file and relocate the browser to it in case the browser is IE... If you send the same headers and the same data - there _can_not_ be any difference. How should your client recognize any difference? There _must_ be a difference! Use a very small file to test it, so you can compare the whole HTTP-Header + Body easily. you can see this using Mozilla + Live Headers, Ethereal, http://schroepl.net/cgi-bin/http_trace.pl ... Thanks, I've written my own HTTP header tracer in C++, but it hasn't been able to help me since the headers looks good to me... Oh, I could not know ;-) Kind Regards, Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [posibleOT] Forcing entering te site thru index.php
There are several ways to do this. The most obvious is with cookies. Set up your index.php to initially create a cookie that authorizes a user to look in the site. On the rest of your PHP pages, check that this authorization cookie exists. If not, redirect to index.php. Thanks for the response. No, this way don't do it: once the cookie is set up in the client's browser, there is no way for me to prevent the client to type the url pointing to another page, and the cookie will be valid on that page. What i'm trying to do is to force the client to travel pages in the order expected, forbidding him/her to access a page out of sequence, wich take him to an error message (because, for example, for abscense of POST data or something). So i'm stuck. Thenak you. You can use the Referer header found in $_SERVER['HTTP_REFERER'] to check from which page the user comes from. /Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTTP headers, IE and downloading
I'm writing a script to view/download an email-attachment. If the file happens to be an MS Word document and the browser IE (only tried with 6.0), then the download fails. If I choose to download (Content-Disposition: attachment; filename=whatever.doc) then only a part of the file (2/3) is saved to disk. Of course viewing the file doesn't work either. It doesn't seem to matter what I set the Content-Type to since IE seems to ignore that anyway, however I've tried application/msword, application/octet-stream and some others. I've tried all the things said in the comments to the header-function in the online-docs at php.net. I know my Content-Length header is correct and the whole procedure works great with Netscape 7.0 and if the attachment is a zip-file or a jpeg-image it also works in both IE and Netscape. Let's just say I'm stumped and I have googled for a solution for a long time and would be very happy if someone had one... Thanks in advance /Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Magic Quotes
Now I'm guessing that magic_quotes_runtime is the one I need to have on, but is that so? I'm also guessing that aside from using addslashes() and stripslashes(), I could prob'ly turn on magic_quotes in php_ini. But perhaps because of how I've heard turning register_globals on via php.ini is a security hazard, I'm leery of messing with php.ini at all. Magic Quotes is not a security hazard (quite the opposite) so turning it on shouldn't be dangerous. I don't suppose the book tells you why you should always use magic-quotes or addslashes when dealing with databases? If you do not use form-data in a database-query you generally won't need magic-quotes or addslashes(). I guess that's the reason some of those magic_quotes_xyz are not enabled in the php.ini. It's easy enough to check whether you have the magic quotes you need. Write a simple form-page that simply displays what was posted, then post something like: I'll be back If the page displays: \I\'ll be back\ then you're safe and don't need to use addslashes(). /Andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] /etc/passwd
Hi, if the make script ? if($id) include($id); ? and then just write test.php?id=/etc/passwd , they see all the file. Well, FreeBSD provides a way to jail webservers: Jails 8-) http://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/jail.html with best regards -- Andreas Mendyk [EMAIL PROTECTED] - mobile +49 172 7111512 Uhlandstr. 7 D-73271 Holzmaden http://www.mendyk.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Ticketing System?
Hello List :) Is there any usefull ticketing system (Hotline/Support/etc.) written in PHP? I have found some on hotscripts.com, but I don't know which one is really got or not.. Any suggestions? Cheers, Andreas Cahen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Opening remote files with fopen
Hello together! I've got problems with opening some remote files, but I really don't understand why this doesn't work (with mostly all it works)! This is one of them the fopen-function don't open: $fp = fopen(http://www.cornutopia.charitydays.co.uk/software/arcangel.xml;, r); But is also don't send an error: just trys and trys, ... What's special about this file? Why can't this one be opened and mostly other can? I also can't see any redirections from the server which might be a problem and when trying to get the file in a browser it work's fine... Hope, you can help! Thank you very much in advance Andreas Andreas Breitschopp - Softwareentwicklung und -vertrieb Leopoldstraße 116, D-80802 München; E-Mail: [EMAIL PROTECTED] Tel.: +49 89 38898588, Fax: +49 89 38898589 http://www.ab-tools.de, http://www.ab-soft.de, http://www.ab-archive.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Rather complex regular expression for the preg_match_all function
Hi, I'm trying to construct a regular expression to find HTML open tags without closing tags up to another of the same HTML open tag or a closing tag of a different type that's no enclosed in the implied closing tag optional HTML tag (for example p doesn't require a closing tag. The closing tag is implied and so is its body). For example, the HTML snippet: htmlheadtitleTest HTML/title/head body pfontThis tag is okbr/font/p fontpI want to find this p tagbr and up to the next opening p tagbr btestbr/b/font pI want to find this one too /body I don't want to find p tags with a complete structure. ex: pThis is a lt;pgt; tag with a complete structure/p Instead, I want to find the p tag with no closing tag, up to the next p tag or a closing tag of any type that doesn't have an opening tag after the initial p found (not including this orphaned closing tag) Andreas Sheriff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Creating Extensions DLL with Delphi
Don't know if this is the right place to ask this. I need to write a little extensions DLL in Delphi for PHP where can i find inforamtion for this ? thanxs in advance snoopy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Creating Extensions DLL with Delphi
Don't know if this is the right place to ask this. I need to write a little extensions DLL in Delphi for PHP where can i find inforamtion for this ? thanxs in advance snoopy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with sessions and Internet Explorer
Hi, We have added some new features to a SiteShield protected website which makes it neccessary to use sessions. Although creating the session and the appropriate variables is a server side process there seem to be problems with IE (tested with version 6 on Win2000 Pro and WinXP Pro). If I access the site with IE I will see the following error message at the bottom of the page: Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/home/globstag/tmp) in Unknown on line 0 However if I access the site with any other browser writing the session data works. But this isn't all yet. I can't replicate the problem on any other machine I have access to. On all other machines I have access to the site works fine. First I thought that it might have been a problem with the PHP version because the server runs on PHP 4.0.6 and my notebook runs on PHP 4.2.1. Upgrading the server to 4.2.1 unfortunately didn't solve the problem. I have then deployed the site to my private dedicated server which runs PHP 4.0.6 on SuSE 7.2. Even on that machine I can't replicate the error. The main difference between the other servers and the server in NewYork is that only the server in NewYork is protected with SiteShield. Which leads me to the conclusion that there might be a problem related to the combination of SiteShield, IE and PHP. If you have any ideas feel free to share your thoughts with me. Cheers, Andreas -- Andreas Otto [EMAIL PROTECTED] Using PHP on Windows? www.php4win.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with sessions and Internet Explorer
Hi Ernest, On Friday 22 November 2002 15:05, Ernest E Vogelsinger wrote: The message you see looks disturbing to me - is the session.save_path value actually set to /home/globstag/tmp? Does Apache (or else) have all necessary rights to this directory? _MAYBE_ you're using some mod_rewrite rules on the target server, depending on the user agent, so IE's would end up in a defunct installation? I'd check for this inn the first place. Well, guess what I did before writing this eMail ;-) At the end of my original eMail I said: On Friday 22 November 2002 14:24, Andreas Otto wrote: The main difference between the other servers and the server in NewYork is that only the server in NewYork is protected with SiteShield. Which leads me to the conclusion that there might be a problem related to the combination of SiteShield, IE and PHP. So what we have is a set of web servers to which access is controlled by a (proxy) server. The software that is used to manage access rights is called SiteShield and is developed by a company called Tempest. Every request to the server I experience this strange problem at has to pass the SiteShield server. The question is now: Has anyone heard about or had problems with the combination of PHP SiteShield and InternetExplorer? Cheers, Andreas -- Andreas Otto [EMAIL PROTECTED] Using PHP on Windows? www.php4win.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with sessions and Internet Explorer
Hi Ernest, On Friday 22 November 2002 16:11, Ernest E Vogelsinger wrote: Is it possible to have SiteShield log what its doing? The question is now: Has anyone heard about or had problems with the combination of PHP SiteShield and InternetExplorer? I don't know anything about SiteShield - can anyone else chime in please? I'd also try to holler at the guys at Tempest... I have been trying that, but it looks like I have to run the query through our office in NewYork where the servers are hosted. My colleagues in NewYork will have the right support details. Cheers, Andreas -- Andreas Otto [EMAIL PROTECTED] Using PHP on Windows? www.php4win.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] right name for IfModule bla.c
Em Tue, Sep 24, 2002 at 08:59:54AM +0100, Chris Hewitt escreveu: It looks fine to me (I'm no expert), but maybe its case sensitive? You have /Ifmodule rather than /IfModule. Otherwise perhaps remove the IfModule completely for a test to see if it is the /IfModule causing the problem. It's not the IfModule, already tried that :) Someone at the apache list told me that the name would be sapi_apache2.c, because that's where the STANDARD20_MODULE_STUFF define is used. But sapi_apache2.c didn't work either. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] right name for IfModule bla.c
Em Tue, Sep 24, 2002 at 11:08:06AM -0400, Paul Nicholson escreveu: What exactly is not working? The directives inside the IfModule branches are being ignored. Thus the include path is not being modified and my application doesn't work. I know, I can change the application to include the right path, but it's not mine and I want as few patches as possible. This means that either the module is not loaded (but it is), or I'm checking it with the wrong name (that's what I think it is). If I but blablabla inside the IfModule no error happens. But, just for testing, if I change mod_php4.c to mod_ssl.c (for example), which is also being loaded, then apache won't start because of the blablabla. So, I still think it's the name that is wrong. Did you check to see if the engine is turned on? It is on, the module is loaded. The application runs, but can't find its include files. If it is not then try php_admin_flag engine on. Why are you turning the engine on? Is it disabled everywhere else? The include path should have Yes, it's disabled by default for the whole documentroot here. I only enable it where I expect PHP scripts to run. double quotes surrounding it and the paths in directory should not. HTH! Thanks, will give it another try with these variations. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] right name for IfModule bla.c
Em Tue, Sep 24, 2002 at 08:53:16PM +0100, Chris Hewitt escreveu: Andreas Hasenack wrote: Someone at the apache list told me that the name would be sapi_apache2.c, because that's where the STANDARD20_MODULE_STUFF define is used. But sapi_apache2.c didn't work either. Ah, I didn't know you meant Apache 2 and windows? I'm going on Apache 1.3.x and linux. No, it's apache-2.0.41-dev, php-4.2.3 and linux. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] right name for IfModule bla.c
What is the right name to use in apache's (2.0.41-dev) IfModule directive to test if the php4 module is loaded? I'm including the file below via httpd.conf's Include statement but the part between the IfModule is being completely ignored: Directory /srv/www/default/html/acid AllowOverride None order deny,allow Deny from all Allow from 127.0.0.1 IfModule mod_php4.c php_flag engine on php_value include_path '.:/srv/www/default/html/acid/config' /Ifmodule /Directory Directory /srv/www/default/html/acid/config order deny,allow deny from all /Directory I'm using php-4.2.3 (compiled with apxs2) and apache-2.0.41-dev. The PHP module *is* being loaded in another included file, but it doesn't matter if I put the above in an external file or in httpd.conf itself. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] read all files in directory
Hi! How can I read all files in a directory, when I don't know which files are there? Sincerely Andreas Indahl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: error-catching
use or die (DB-server down); at the end of you line. Gert Mellak [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... Hi! When I open a database connection and i. e. the db-server is down, I get a very long, long error message telling me that the server is down. What I want to do is just echo a text, i. e. DB-Server down and leave out the error message. Does anyone have an idea how to manage this? I'd be grateful for any information! TIA, Gert. [EMAIL PROTECTED] http://mellak.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] include text from a html-file online
I want to include text from a html-file that is online at another website. To be more precise: I want to include my seti-stats from http://setiathome.ssl.berkeley.edu/ on my own homepage. Can I do this with PHP? Sincerely Andreas Indahl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP-script in MySQL-table
Not sure if this is exactly what you are looking for, but you might want to take a look at the Eval function. (http://www.php.net/manual/en/function.eval.php ) /a Michael Cronström said: Hi all, I would like to enter ?php include (doc.php);? directly into MySQL-table. How do I escape? the above so that the script is executed? Is it possible? Web inventor Michael Cronstrom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Andreas Stehn http://www.stehn.com I do not read or respond to mail with HTML attachments. Statement concerning unsolicited e-mail according to Swedish law: http://www.stehn.com/email ACK and you shall receive. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyway to open a PHP file and view its code in the browser?
then do a symbolic link On Thursday 14 February 2002 22:34, Kevin Stone wrote: I'm glad you posted this. It's great to know. Unfortunately it's not what I need to do. I'm uploading and updating my scripts all the time. So I need to offer code views of *active* scripts. Changing the file name to phps makes the scripts inactive. Any other ideas? -Kevin -Original Message- From: SHEETS,JASON (Non-HP-Boise,ex1) [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 14, 2002 1:38 PM To: 'Kevin Stone' Subject: RE: [PHP] Anyway to open a PHP file and view its code in the browser? Rename the file you want to display as PHP code to .phps (php source) instead of .php. This will also activate PHP's built in source code highlighting. Jason -Original Message- From: Kevin Stone [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 14, 2002 1:26 PM To: [EMAIL PROTECTED] Subject: [PHP] Anyway to open a PHP file and view its code in the browser? How can I open a local PHP script and view its code to the browser? The Readfile() method appears to parse and execute the code. The Fopen() method appears to parse and then not execute the code, leaving a blank screen, or at the very least displaying any non-PHP text existing in the script. This is obviously rare question because I can't find any references on this list or on Usenet. Is there a trick to this? Or is it simply not possible. Much Thanks, Kevin Stone [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] compiling modues
hi, i am looking for a good documentation how i can build the standard php-modules like mysql or like postgres as loadable extensions on linux-systems. Just doing make in the appropriate directories just gives .la files which are not loadable like the normal .so files. Can you point me at a documenation? I was not able to find a good one that worked for me. thanx andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP not able to send email
On Mon, Dec 17, 2001 at 11:48:13PM +0800, Peter wrote: Dec 17 12:59:16 ns sendmail[14686]: NOQUEUE: SYSERR(webuser): queuename: Cannot create qfMAA14686 in /var/spool/mqueue Your sendmail-setup is b0rked, check permissions on /var/spool and fix sendmail, there's nothing wrong with PHP (read: this is offtopic). -- Andreas D Landmark / noXtension When I was in school, I cheated on my metaphysics exam: I looked into the soul of the boy sitting next to me. -- Woody Allen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Online editor that edits all pages
On Fri, Dec 14, 2001 at 12:11:14AM -0800, R. Lindeman wrote: sorry for the inconvieniance but i have to restate my question i'm looking for a online editor that is able to edit pages that are not on the same host as the editor is. And how is it supposed to do that? ftp/ssh/frontpage-ext ? Can't think of a ootb solution that does what you want... -- Andreas D Landmark / noXtension On Monday mornings I am dedicated to the proposition that all men are created jerks. -- Avery -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Online editor that edits all pages
At 13.12.2001 11:30, George Pitcher wrote: I'm using EditPlus to edit files on my server, from my laptop, but that accesses the files via the NT network, which might not be what yopu are looking for. And EditPlus is hardly an online editor, and I *don't* want a cc of a thread I didn't start as I am subscribed to the list (how would I otherwise been able to reply?) -- Andreas D Landmark / noXtension Real Time, adj.: Here and now, as opposed to fake time, which only occurs there and then. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Get Hours/Mins/Secs between two timestamps?
On Wed, Dec 12, 2001 at 11:31:25AM -, Jon Farmer wrote: Is there a function in PHP that will output the difference between two timestamps (hours/mins/secs), similar in the way that getdate() extracts the date of a timestamp? Thank you. How about subtracting the one timestamp from the other and then devide by 3600, with the remainder divided by 60 and the remainder is your seconds. Since you asked, i guess you're not familiary with the % operator (modulus). Read the operator section of the manual, and you'll see how modulus is your friend... But a better way, is to subtract one from the other and then use gmdate() on the difference, that way you don't have to worry about differences in excess of 60 secs... -- Andreas D Landmark / noXtension Time flies like an arrow, but fruit flies like a banana. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Class in PHP
On Wed, 5 Dec 2001 10:41:53 -0500 Wee Chua [EMAIL PROTECTED] wrote: Hi all, How many extension of subclass can PHP have? Can I extend subclass to more different subclass? Do you mean how deep a inheritance you can have? e.g. A \ B | \ C D | \ E F There is nothing wrong with doing Class F extends D (which then in turn inherits it's stuff from class b, etc.) -- Get your firstname@lastname email for FREE at http://Nameplanet.com/?su -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Feauture request/proposal: import
Hi All, What do you guys think of a import feauture for php. This allows developers to use packages and a package trees for including files. We're using a php written import for the binarycloud app framework with grat success. It's extremly handy, easy to use, clear and straight forward. We currently have the following syntax if we want to include a file. import(binarycloud.core.Request); The import method now does the following: Look up global import map, if package already included return else include(PACKAGE_BASE./binarycloud/core/Request.php); Set binarycloud.core.Request = true in the global import map. The benefits are outstanding. You don't have to mess around with path names and the package-path's can be logically structured. Ok, you can achive this with include too, but import seems more flexibe and abstracted from the filesystem. So somehting like binarycloud.db.Template could be something within a database or ldap or whatever in the future. I don't know the interna of php but I think a native and basic implementation in C will be a matter of some hours because this is based on include. I thought of also having a php.ini setting like: import_bases=./:/path/to/base1:/path/to/base/2 or something like that. The syntax itself should be the same as with include: import package.File; and import(package.File); This might also be interesting for PEAR to have a more clear structure: import php.pear.PEAR import php.pear.Cache ... The only drawback I currently see is that you can't use dots in filenames. But that's also useful for people who love it clear ;-) For the binarycloud implementation of import see: http://binarycloud.tigris.org/source/browse/binarycloud/r2/binarycloud/base/ init/prepend.php?rev=1.6content-type=text/x-cvsweb-markup What do you think? Andi -- www.thyrell.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Feauture request/proposal: import
Hi All, What do you guys think of a import feauture for php. This allows developers to use packages and a package trees for including files. We're using a php written import for the binarycloud app framework with grat success. It's extremly handy, easy to use, clear and straight forward. We currently have the following syntax if we want to include a file. import(binarycloud.core.Request); The import method now does the following: Look up global import map, if package already included return else include(PACKAGE_BASE./binarycloud/core/Request.php); Set binarycloud.core.Request = true in the global import map. The benefits are outstanding. You don't have to mess around with path names and the package-path's can be logically structured. Ok, you can achive this with include too, but import seems more flexibe and abstracted from the filesystem. So somehting like binarycloud.db.Template could be something within a database or ldap or whatever in the future. I don't know the interna of php but I think a native and basic implementation in C will be a matter of some hours because this is based on include. I thought of also having a php.ini setting like: import_bases=./:/path/to/base1:/path/to/base/2 or something like that. The syntax itself should be the same as with include: import package.File; and import(package.File); This might also be interesting for PEAR to have a more clear structure: import php.pear.PEAR import php.pear.Cache ... The only drawback I currently see is that you can't use dots in filenames. But that's also useful for people who love it clear ;-) For the binarycloud implementation of import see: http://binarycloud.tigris.org/source/browse/binarycloud/r2/binarycloud/base/ init/prepend.php?rev=1.6content-type=text/x-cvsweb-markup What do you think? Andi -- www.thyrell.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] session class driving me nuts
hi , gallerie.php: --- session_start(); class ABCD { function add_pic($picture,$galerie) { code here } } $artego = new ABCD; $artego-add_pic(Santiego,Humstein); -- line XX . more code when i run this script i get: Fatal error: Call to a member function on a non-object in /home/sites/site76/web/galerie/shop.php on line XX if i remove session_start(); THEN IT WORKS ! but i need the session WHATS GOING ON ? thank you andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] (RW) PHP installation problems
At 27.09.2001 03:34, David Robley wrote: gcc -o conftest -g -O2 -Wl,-rpath,/usr/local/mysql-3.22.32-pc-linux-gnu-i686//lib/mysql -L/usr/local/mysql-3.22.32-pc-linux-gnu-i686//lib/mysql conftest.c -lmysqlclient -lpng -lz -lgd -lresolv -lm -ldl -lcrypt -lnsl -lresolv 15 /usr/bin/ld: cannot find -lmysqlclient collect2: ld returned 1 exit status Obviously, it's not finding the mysql client library (libmysqlclient) in the place its told to look, usr/local/mysql-3.22.32-pc-linux-gnu-i686//lib/mysql. However, that seems an odd location. Perhaps something about default locations in DeadRat? In the first instance, if you aren't using _anything_ else that requires the mysql client library, try recompiling using just the --with-mysql flag, without a path, to use the inbuilt (in PHP) mysql client. Apart from the double slash it's not an entirely strange location as mysql has always stored it's header|libs|etc under it's own directory rather than in /usr/local/lib, the result is that libmysqlclient isn't found by ld because it's not in ld's config file (usually /etc/ld.so.conf)... But unless you have some reasons for not using the built in support, (bleeding-edge or whatever pleases you) go with the built in support... -- Andreas D Landmark / noXtension Real Time, adj.: Here and now, as opposed to fake time, which only occurs there and then. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] WEB LOG
On Monday 24 September 2001 16:04, Jeffrey Paul wrote: Well. If you check the HTTP_REFERER on the target-site it would work and give you at least some security. However it is still not really secure. At 07:08 AM 9/24/2001, Chris Herring wrote: OOPS, again, elseif isn't what needs to be done. Ok, here we go. if $pwd == $real_pwd { header (Location: http://therealsite;); } else { header (Location: http://badsite;); } For the record, that won't stop someone from going to the destination page if the password doesn't match, which is what the person asked about. All this will do is send them a redirect to an error page if the password doesn't match, it doesn't prevent anyone at all from hitting, in your example, http://therealsite. -j Jeffrey Paul [EMAIL PROTECTED] (877) 748 3467 ICQ: 14295546 AIM: kw34hd1 NXTL/DC: 130*21*16749 PGP: 0xF50BB9D7 A21AFD828C30EC77545DA0B3F501F50BB9D7 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] WEB LOG
This is the reason why i wrote it is just some security. On Monday 24 September 2001 16:15, Jeffrey Paul wrote: At 10:09 AM 9/24/2001, Andreas Gietl wrote: Well. If you check the HTTP_REFERER on the target-site it would work and give you at least some security. However it is still not really secure. Wrong. Many browsers don't send the Referer: header, not to mention it's downright trivial to spoof it. This doesn't afford any more security at all. -j Jeffrey Paul [EMAIL PROTECTED] (877) 748 3467 ICQ: 14295546 AIM: kw34hd1 NXTL/DC: 130*21*16749 PGP: 0xF50BB9D7 A21AFD828C30EC77545DA0B3F501F50BB9D7 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Getting IP address
On Wednesday 19 September 2001 11:37, Andrew Semark wrote: $addr = getenv('REMOTE_ADDR'); Can anybody tell me how to get the IP address of the remote machine looking at the web page. I have two versions of PHP 4 On the box with version 4.0.1 I can use $HTTP_SERVER_VARS[REMOTE_ADDR], but on the other server running 4.0.0 this don't work. Is there another way of doing this as it's not possible to upgrade this server. Thank Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] user auth
On Friday 14 September 2001 17:01, you wrote: if you want to work with the passwords that originally are in the shadow-file your webserver needs to have read-permissions for the shadow-file, which is no good idea. you could parse out the passwords from the shadow-file and write them into an extra password-file only readable for the webserver, which is no good idea neither. Or you could use a patched pam-modul which checks the passwords for you, which is the best solution i can think of. But if you want to do a webmail, you actually don't need to check the password. Your imap/pop-server will do that for you. BTW: There already are lots of webmails in php, just check nocc.sourceforge.net for example and there are many others. Hello all! I a relatively newbie in PHP, so my question may appear silly: Please tell me if anyone has knowledge of authenticating a user based on his username and password from Linux system (shadow or anything). I want to make a php WebMail. Also, i want to make a ssh virtual web client for the registered user. Any help would be appreciated. Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Unable to find stream pointer
On Tuesday 11 September 2001 19:00, Andreas Gietl wrote: why is it that nobody answers my question? Does nobody know an answer? Hi PHP-Users, I am having problems with php and imap now for several days on several servers. I just get the following Error: Warning: Unable to find stream pointer in file on line line This error does not occur in every execution, but only sometimes. I read a lot about this error on the internet, but i still don't know what is the reason for this error and how to work around it. Does anybody of you know where this error originates? thanx andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: WELCOME to php-general@lists.php.net
i have a small problem. ?php include(http://www.sbg.ac.at/home.htm;); ? Warning: php_network_getaddresses: getaddrinfo failed: Name does not resolv to supplied parameters; neither nodename nor servname were passed. in /usr/INFO/web-docs/test.php on line 3 Warning: Failed opening 'http://www.sbg.ac.at/home.htm' for inclusion (include_path='.:/php/includes:/usr/INFO/web-docs/unineu/search:/usr/INFO/web-docs/unineu/classes') in /usr/INFO/web-docs/test.php on line 3 when using: ?php fopen(http://www.sbg.ac.at/home.htm;, r); ? Warning: php_network_getaddresses: getaddrinfo failed: Name does not resolv to supplied parameters; neither nodename nor servname were passed. in /usr/INFO/web-docs/test.php on line 3 Warning: fopen(http://www.sbg.ac.at/home.htm,r;) - Bad file number in /usr/INFO/web-docs/test.php on line 3 please help me :) andreas sartorihellbrunnerstrasse 34 Datenbankadministration unix support 5020 salzburg, austria zid - universitaet salzburgtel: +43 (662) 8044-6731 http://www.sbg.ac.at/zid/people/sartori/sartori.htmfax: +43 (662) 629842
[PHP] database
hi, where can i get a database with the postal codes from germany ? i need to doublecheck the entries posted on our website andre
[PHP] Unable to find stream pointer
Hi PHP-Users, I am having problems with php and imap now for several days on several servers. I just get the following Error: Warning: Unable to find stream pointer in file on line line This error does not occur in every execution, but only sometimes. I read a lot about this error on the internet, but i still don't know what is the reason for this error and how to work around it. Does anybody of you know where this error originates? thanx andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Problem with session controiler files in PHP on Roxen
Hello! We installed php 4.0.6 in a Roxen 2.1.625 web server on Solaris 7. Now we have a problem with temporary session files. The session_start() command will abort with the following error message: Warning: open(/tmp/sess_e8771af1171a6cbdf51eebdba5199d25, O_RDWR) failed: m (0) in [path/file.php] on line 78 Warning: open(/tmp/sess_e8771af1171a6cbdf51eebdba5199d25, O_RDWR) failed: m (0) in Unknown on line 0 Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0 The thing is that session.save_path is correct. It points to /tmp, where the web server and php has write permissions. The session controller can read and write existing files. The problem occurs only when session_start() has to create a _new_ session control file. If we use fopen(), we can read and write files in /tmp. If we create a file with the name of the supposed session control file (sess_..., the name stated in the error message from session_start()) with fopen() and then reload the page, session_start() will execute correctly, using the file we just created for it. Then php will access the file correctly, writing and reading session variables just as it is supposed to. So, again, the problem occurs only when session_start() has to create a _new_ session control file. Shouldn't a file be created automatically if it doesn't exist? The only strange thing with the installation of PHP on Roxen was that no binary file was created. We can't find the stand-alone program to execute php files from the shell. This happened even though no error message was given at the time of installation. The roxen installation was made as the config script suggested. Does anyone have a clue why this problem occurs? Best regards, Andreas Lundgren mailto:[EMAIL PROTECTED] Andreas Lundgren Magistratsvägen 55P:405 226 44 Lund 046-320250, 0708-960717, ICQ:1430437 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP ext
At 09.08.2001 13:17, B. van Ouwerkerk wrote: Where in php.ini do you set it so that .html files will also run php? You don't. httpd.conf is the place to look. It says something about what Apache has to do with .php and .php3 .. so.. add .html Bye, AddType application/x-httpd-php .php .html (this line should be there already, so don't add it, update it!). (substitute x-httpd-php with x-httpd-php3 for php3) Further you might want to modify your DirectoryIndex statement to include index.php (and/or index.php3). This is more related to php-install than php-general though, keep in mind for the future... -- Andreas D Landmark / noXtension Real Time, adj.: Here and now, as opposed to fake time, which only occurs there and then. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [Re: [PHP] user's ip]
At 07.08.2001 13:06, Renze Munnik wrote: Ahh see, that wasn't clear in the question. Yeah... that's true. Pain in the ass those proxies. They're also realy useful while testing your (dynamic) site. NOT!!! Hey, what's this? I thought I'd realy changed that error. How's this possible?, Didn't I just change the background-color? Why is it still the same? BECAUSE THE DAMN PROXY DOESN'T WANT TO SHOW YOU THE NEW VERSION. No... cache, cache, cache... Damn things always come up with pages that are (way) to old! 1) proxies should cache dynamic content 2) proxies should not retrieve from cache if the request is a force-refresh 3) proxies should not cache any content which URL includes ? Sounds like you've got yourself a poor proxy there, I've certainly never seen any problem with developing through my proxy, apart from those pesky doubleclick ads seem to disappear wonder why... -- Andreas D Landmark / noXtension Real Time, adj.: Here and now, as opposed to fake time, which only occurs there and then. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Traceroute without traceroute command!
At 07.08.2001 21:12, James Crowley wrote: Hi, I would like to perform a traceroute with PHP. However, my ISP has disabled the traceroute command normally available in /usr/sbin/traceroute. Is there any other way? Regards, - James The easiest one, byfar, is to grab a binary suitable for the system in question and shove it in your own homedir owned by you and executable by you. They might not be too pleased if you're not supposed to run stuff like that, but if you need it, do it... -- Andreas D Landmark / noXtension Real Time, adj.: Here and now, as opposed to fake time, which only occurs there and then. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: syntax help~~~
At 06.08.2001 10:31, you wrote: Hi.. I just wanna laugh really want to laugh WUWUAHAHAHAHAHA I have figure out the solution amazingly! here will be the code I am running LoL it works without separating the code if you add the ; at the end of the $temp = $username.watch line... ? mysql_connect('localhost','coconut','tkming') or die (Unable to connect to SQL Server); mysql_select_db('helpwatch') or die (Unable to select database); $temp = $username.watch ? ? $watchlist_query = mysql_query( Create Table .$temp. ( WId int auto_increment not null, QId int not null, Primary Key (WId) ) ) or die (Error! Cannot create table ! . mysql_error() ); ? -- Andreas D Landmark / noXtension Real Time, adj.: Here and now, as opposed to fake time, which only occurs there and then. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]