Re: [PHP] dbase_get_record_with_names; Very slow search!!!
Ashley Sheridan wrote: > I would assume that any indexes created on any tables would be > referenced automatically by the dbms and wouldn't need to be explicitly > referenced from within PHP. This is dBase (.dbf) he is asking about. There is no such thing as a DBMS in dBase. The program / driver that accesses the data must handle everything. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dbase_get_record_with_names; Very slow search!!!
Rahul S. Johari wrote: > Quite right. > > Unfortunately there doesn't seem to be any available ODBC Drivers for > FoxPro available for Mac OS X either!! I'm hitting a brick wall no > matter what direction I take. Convert to SQLite and don't look back ;) Unless your DBF files are still in use in another application of course. If that use is not simultaneous you could at least trivially write an import/export routine. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wiki recommendation?
Jonathan Tapicer wrote: > I also recommend dokuwiki (with a k, not c :) ): > http://www.dokuwiki.org/ I will add just my 2 cts to that. I have used several wikis but I always come back to DokuWiki. Among other things that I like about it, like plugins, is the fact that it is file based. It can be nice sometimes to be able to make certain changes to your pages with a normal editor, search and replace tool or whatever. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Can I get the IP address from a visitor?
Lars Kristiansson wrote: [..] > My goal is to create purchase-orders written on unique files, and to > separate them my idea was to baptize files with the IP addresses, which > would ive each visitor an unique purchase-order... > > Any hints to a newbie? Yes. Do NOT use IP adresses as identifiers. Just forget about it. People share connections, e.g. when they are in the same building or when they are using the same proxy. People use domestic/consumer internet connections that have dynamic IP addresses. Identifying people by their IP address is therefore stupid. If it is just to have a key to some data, you could try using a GUID. And check when you generate one that it doesn't already exist (though the chance is extremely small, it is not zero). Or just use some serial number like everyone else does ;) It may look boring to make files like order0001, order0002 etc. But it works. Any reason you are not storing your orders in a database? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POLL: To add the final ?> or not...
Paul M Foster wrote: > I leave it off. I don't want to have to worry about which editor I'm > using or whether I accidentally left some whitespace where it shouldn't > be. I also use different editors in different situations, both terminal based and GUI. For instance I find Midnight Commander's internal editor quite comfortable to use but unfortunately it does leave whitespace all over the place. This discussion made me think. From now on, I will probably also leave the closing ?> off in include files. If something isn't really needed then there is no rational reason to insist on using it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Content Management System in php
I have been looking into some of the CMS' that the php community provides. Now I wonder what the common thoughts about these are. Are they fit for deployment into professtional organisations or simply still on a "idealistic-website" level? I made a trial installation of php-nuke and frankly i'm very impressed on some matters, like its sceduled posting and admin interface. However it lacs some features in the ability to apply a own design, its forum has something left to desire so on. It might work for a site like /., but I doubt it would work very well on a corporate nework. PostNuke might even look a bit better and dynamic. Am I wrong about this? Do anyone got any experiences with eZ publish? What interests me in a CMS, are subjects like: -Ability to use role/group-based access. -Forum options (access/theading/moderation s.o.) -Ability to easily make a design/theme that fits a strict and "ready-set" design. -Ability to incorporate existing web-modules/pages/sites I would very much like to hear your thoughts of this... Olav Bringedal jaggu.org __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] bscub() under tru64 UNIX (64bit)
I get : "Fatal error: Call to undefined function: bcsub() in .." when using bcsub(). Could there be a problem running PHP on a 64-bit system? Cheers, Olav -- 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] Time calculation after UNIX
Hi I have a database that is supposed to last more than 30 years Could someone advice me how to calculate (add and subtract) time in a maner that willl be correct after 2030 when Unix Time stop working? ragards [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] PhP 4.2.1 (and various)
Hi! I've recently upgraded to 4.2.1, but i have gotten a lot of problems with it. First of all my pbpBB 2.0 forums stopped working (http://utge.dyndns.org/phpbb2/index.php). When you try to log in i get an error, malfomed header request? (im not on the actual machine now :)). I also have problems with logins to my site (jaggu.org). After messing a lot to get sessions working again, I have tracked down the consisten problem to the Header () function. A comment in the manual says "@" should be put in front of all function calls before header(). I tried that, to no use. So my question is, why has that changed, and what do we do now to authenticate users and redirect them to anothe page? And what the hell is this "@" thingy, i cant see to find anything on it in the manual, and search doesnt work for chars like that. I hope you guys can clarify this for me. Sincerely Olav Bringedal jaggu.org __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] More 4.2.1 (Note to myself:think before pressing send!)
Sorry about this, but i forgot one thing in my last post. With 4.2.1 (as opposed to 4.2.0), gd2 stopped working. When i run the server I get "could not find freetype.dll(? Still not on the actual machine)" and then "gd2.dll(?) module could not be found". phpinfo at http://jaggu.org/info.php I tried to search both my config files and via google for freetype.dll, but could not find anything of slightest enlightenment. Thanks in advance! Olav Bringedal Jaggu.org = Raistlin M041999031 __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PhP 4.2.1 (and various)
--- Vincent Oostindie <[EMAIL PROTECTED]> wrote: > Not only that: if you are running a production > server, you will probably > want to log your error messages to a file (or > syslog, or whatever), > instead of printing them. So 'display_errors' should > be off. If that is > the case, you don't need to use @ anymore, because > there will be no HTML > output even in case of problems. The advantage of > this is that you can > use the exact same code on a development server > (with display_errors = > on) and a production server. > > Vincent > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > That is all well, but if php 4.2.1 interprets any output (as errors not only screen errors) as something that is sent before a header in a redirect, there is no other way (that i'm aware of) around it. Like this: $user=$Session["user"]; if(!$Authorized) { header ("Location: http://jaggu.org";); } this will not work, you have to write: @$user=@$Session["user"]; @if(@!$Authorized) { header ("Location: http://jaggu.org";); } To actually get the redirect. On http://jaggu.org/info.php, you can see that display_errors = off In any case, I think you are onto something. I will try to narrow down logging, to see if that might be the problem. Thanks for helping! Olav Bringedal jaggu.org __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie - Spot the error
--- Josh Edwards <[EMAIL PROTECTED]> wrote: > if I have $time = 21 then > > $timespread > =array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); > if ($time = = "21") > $timespread[22]=($timespread[22]+1); > echo $timespread[22] ; > > I get 0 > It might be "= =" which should be "==". If not, try: $timespread =array (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); if ($time == "21") { echo "before:".$timespread[22]."" ; $timespread[22]=($timespread[22]+1); echo "after:".$timespread[22]."" ; } else { echo "time is not 21" ; } Then you can at least establish where things go wrong. = Olav Bringedal jaggu.org __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PhP 4.2.1 (and various)
--- Analysis & Solutions <[EMAIL PROTECTED]> wrote: > Olav: > > On Wed, May 15, 2002 at 11:53:06AM +0100, Olav > Bringedal wrote: > > > $user=$Session["user"]; > > > > if(!$Authorized) > > { > > header ("Location: http://jaggu.org";); > > } > > As I was saying before, write your code in a way > that doesn't generate error > messages. For example, the above passage would be > error free if you did this... > > if( empty($Authorized) ) { > header ('Location: http://jaggu.org'); > } else { > $user = $Session['user']; > } > > Enjoy, > > --Dan > > -- >PHP classes that make web design > easier > SQL Solution | Layout Solution | Form > Solution > sqlsolution.info | layoutsolution.info | > formsolution.info > T H E A N A L Y S I S A N D S O L U T I O N S > C O M P A N Y > 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 > f: 718-854-0409 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Thanks for the reply, but it didnt help :) The code is without errors. What I submitted was written on the fly to illustrate what i tried to do. Here is the actual code... $playername=$_GET['player']; if (!$playername) { ..print HTML form code... } else { if ($playername) { $_SESSION['playername']=$playername; header('Location: http://'.$_SERVER['HTTP_HOST'].'/UTGE/index.html'); } else { die ("something gone wrong! Do it properly"); } } I also tried with ~all in logging and without logging at all. = Olav Bringedal jaggu.org __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PhP 4.2.1 (and various)
--- Analysis & Solutions <[EMAIL PROTECTED]> wrote: > Olav: > Perhaps because you're ignoring what I said. > This will generate an error message if there's no > player variable in the > request string and you have error reporting set high > enough. Evaluate > for "empty($_GET['player'])" > > > > Why are you testing for playername again? You > already know it's there > because your'e in the else after the "if > (!$playername)" statement. > > > Hmm... You're sticking playername into the Session > array. I haven't > used PHP's session handling, but some things seem > odd here. Where did > you start the session? Also, how is your relocated > page going to know > about the session? I don't see any code here that > performs those tasks. > > Enjoy, > > --Dan > > -- >From the manual: With $_SESSION or $HTTP_SESSION_VARS, there is no need to use session_register()/session_unregister()/session_is_registered() functions. Users can access session variable like a normal variable. I'm pretty sure the sessioning works perfectly. And it is not the problem. The problem is Header(), which fails without any error or other output. You can only look at the other mails posted on this subject, that it is a major problem in v 4.2.1. Until it is solved, I'll work on something else... Thanks for your time. = Olav Bringedal jaggu.org __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Transfer variable to next web-page
I just started.. How do you transfer a variable from one web-page to another I try to use a form like this: text for button "); ?> and catch it injoin2.phpby: $phpVariableName=htmlVariableName; echo"$phpVariableName"; This do not work. Can anyone tel me what should be done Neither books, php-manual nor HTML-specification does tel me. Olav -- 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] How to get mysql-result into a php variable
This is perhaps elementary, but I cannot find solution in the documentation I want to transfer to a php variable wheter I find a matching firstname in a group from mysql db function lookupFirstname ($fname, $gr, $conection) { $sql = "SELECT firstname AS matches "; $sql .= "FROM persons "; $sql .= "WHERE firstname = '$fname' AND group='$gr';"; if (!$sql_result = mysql_query($sql,$connection) ) {echo "query: "; echo mysql_error(); } $store = mysql_store_result($conn); $result = mysql_num_rows($store); IF ($result > 0) {return 'match' ;} ELSE {return 'nomatch';} } I get error message that funcion mysql_stor_result() is not defined How shall I use thees two funcions? Thank you Olav -- 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] query works in mysql, but not from php
Hi $sql = "SELECT user FROM persons WHERE user = '$firstName' and domain = '$domainName' ; "; $result = mysql_query($sql,$connection ) or die(mysql_error()); Calling above lines from php returns: You have an error in SQL syntax near ';' at line 1 Issuing the command SELECT user FROM persons WHERE user = 'fred' AND domain = 'company.net' ; in mysql give a proper result. Can anyone explain what might be causing the error??? regards Olav -- 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] Header location, redirection loses parameters,
I have several URLs that I want to point to the same site with a different parameter. I try to do this by redirecting all to the same location, by http://mysite.com/index.php?var1=value1&var2=value2";); exit; ?> The redirection is done properly, but variables are not sent. Can anyone say what should be done? (some init settings ??) Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Header Location redirection parameters fail to redirect
I want url mysite.no to redirect to mysite.com with parameters lang=no and ctry=no, but the parameters do not follow the redirection. mysite.no/index.php is http://mysite.com/index.php?lang=no&ctry=no' ) ; exit; ?> mysite.com/index.php is mysite.com Homepage "; $lang = $_REQUEST['lang']; $ctry = $_REQUEST['ctry']; echo "Country= $ctry Language= $lang"; ?> When I browse mysite.no mysite.com homepage is shown with lang and ctry as blank When I browse mysite.com/index.php?lang=no&ctry=no parameters lang and ctry are set to no as I wish I have the server on my own laptop where I also do the browsing. I use PHP 4.2.2 I kindly got some answers yesterday that do not seem to solv the question so I have made myself more specific. Do anyone have a clue why the parameters are stripped from the redirection? (I am not very trained, but as far as I know the parameters should be redirected??!!) Thanks Olav -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] isset($a->b) even if $a->b = null
how do i test if a property of a stdclass object is set, even if its value is null, similar to how array_key_exists() works for arrays. the following method fails: $a->b = null; if(isset($a->b)) echo "yes"; and property_exists() seems only to work for defined objects. hope someone can help. thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: isset($a->b) even if $a->b = null
the solution has been found. array_key_exists() can actually be used on objects, and yields the correct result. http://no.php.net/array_key_exists thanks to dordea cosmin for pointing this out. On 17/08/07, Olav Mørkrid <[EMAIL PROTECTED]> wrote: > the test i need should give the following results: > > - FALSE when $a->b does not exist at all > - TRUE when $a->b = null > - TRUE when $a->b = > > empty() gives true for both $a->b = null and not setting any value, so > that's no good. > > borokovs suggestion seems to miss the purpose. > > anyone else? > > On 17/08/07, Colin Guthrie <[EMAIL PROTECTED]> wrote: > > Olav Mørkrid wrote: > > > how do i test if a property of a stdclass object is set, even if its > > > value is null, similar to how array_key_exists() works for arrays. > > > > > > the following method fails: > > > > > > $a->b = null; > > > if(isset($a->b)) > > > echo "yes"; > > > > > > and property_exists() seems only to work for defined objects. > > > > > > hope someone can help. thanks! > > > > You can try: > > unset($a-b) > > > > Or change isset() to empty(). > > > > empty() catches more than isset() e.g. '' (empty string), false, 0 etc. > > are considered "empty". Depending on your logic it can still be very > > useful. It is a language construct rather than a function so it's also > > efficient. > > > > Col > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: isset($a->b) even if $a->b = null
yes, but that assumes you have a defined class. if $a comes from mysql_fetch_object() for instance you have just a stdobject, and this method will produce an error. On 17/08/07, Michael Preslar <[EMAIL PROTECTED]> wrote: > Found something. > > For class variables.. > > http://us.php.net/manual/en/function.property-exists.php > > class a { > var $b; > } > > if (property_exists('a','b')) { > print "yes\n"; > } > > > On 8/17/07, Olav Mørkrid <[EMAIL PROTECTED]> wrote: > > the test i need should give the following results: > > > > - FALSE when $a->b does not exist at all > > - TRUE when $a->b = null > > - TRUE when $a->b = > > > > empty() gives true for both $a->b = null and not setting any value, so > > that's no good. > > > > borokovs suggestion seems to miss the purpose. > > > > anyone else? > > > > On 17/08/07, Colin Guthrie <[EMAIL PROTECTED]> wrote: > > > Olav Mørkrid wrote: > > > > how do i test if a property of a stdclass object is set, even if its > > > > value is null, similar to how array_key_exists() works for arrays. > > > > > > > > the following method fails: > > > > > > > > $a->b = null; > > > > if(isset($a->b)) > > > > echo "yes"; > > > > > > > > and property_exists() seems only to work for defined objects. > > > > > > > > hope someone can help. thanks! > > > > > > You can try: > > > unset($a-b) > > > > > > Or change isset() to empty(). > > > > > > empty() catches more than isset() e.g. '' (empty string), false, 0 etc. > > > are considered "empty". Depending on your logic it can still be very > > > useful. It is a language construct rather than a function so it's also > > > efficient. > > > > > > Col > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: isset($a->b) even if $a->b = null
the test i need should give the following results: - FALSE when $a->b does not exist at all - TRUE when $a->b = null - TRUE when $a->b = empty() gives true for both $a->b = null and not setting any value, so that's no good. borokovs suggestion seems to miss the purpose. anyone else? On 17/08/07, Colin Guthrie <[EMAIL PROTECTED]> wrote: > Olav Mørkrid wrote: > > how do i test if a property of a stdclass object is set, even if its > > value is null, similar to how array_key_exists() works for arrays. > > > > the following method fails: > > > > $a->b = null; > > if(isset($a->b)) > > echo "yes"; > > > > and property_exists() seems only to work for defined objects. > > > > hope someone can help. thanks! > > You can try: > unset($a-b) > > Or change isset() to empty(). > > empty() catches more than isset() e.g. '' (empty string), false, 0 etc. > are considered "empty". Depending on your logic it can still be very > useful. It is a language construct rather than a function so it's also > efficient. > > Col > > -- > 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] what is my dns ip address
is there a function in php that will return the ip address of the dns server on the system? eg. $dns_ip = get_dns_ip_address(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what is my dns ip address
the source of the problem is gethostbyaddr(). it seems to have a 4,5 second timeout, so some lookups time out after 4,5 seconds, while most of them are resolved in < 0.1 second; a radically performance difference. the user written gethostbyaddr_timeout() on the gethostbyaddr man page overcomes this problem, but unlike gethostbyaddr() requires a specific dns address, which seems unavailable from php at the moment. parsing nslookup and similar things seems like a workaround. where does one propose a dns_ip() function which returns the system's default dns ip address? or better yet, to add a timeout value to gethostbyaddr(), or in some other way ensure that lookups return quickly, whether they have an answer or not. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what is my dns ip address
yeah but i assume this assumes you are on a unix machine and have administrator rights. it would be nice to be able to look up ip addresses swiftly and automatically on any machine and any operating system running php. On 03/09/07, Per Jessen <[EMAIL PROTECTED]> wrote: > Olav Mørkrid wrote: > > > the source of the problem is gethostbyaddr(). it seems to have a 4,5 > > second timeout, so some lookups time out after 4,5 seconds, while most > > of them are resolved in < 0.1 second; a radically performance > > difference. > > You can change the timeout be amending the options statement > in /etc/resolv.conf: > > options timeout: 2 (2 seconds). > > See 'man resolv.conf'. > > > > /Per Jessen, Zürich > > -- > 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] how do i get a printout of original multipart post data
hello how can i get a raw and untouched printout of a multipart/form-data POST? i need this to analyze what certain user agents do wrong when uploading files. what happens is that php just fails to put files into $_FILES, and gives no way of seeing the original posting and exactly what is wrong with it. according to the manual, neither "always_populate_raw_post_data" nor work for multipart/form-data. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] partial upload & no file errors
hello under what EXACT circumstances does UPLOAD_ERR_PARTIAL and UPLOAD_ERR_NO_FILE occur? ...NO_FILE, does it happen ONLY if the user submits a form without choose a file to upload, or can this one also cover corrupt file data that php could not parse? ...PARTIAL, does it happen if the user presses STOP in his browser while uploading or he pulls out his network cable? if so, then he will never see any error message served upon this error... or does is it this one that covers corrupt mime data in the post? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how do i get a printout of original multipart post data
what is the thought behind php not providing access to original post data? this removes any chance of analyzing corrupt upload data, which is often the case with mobile browsers. can future versions of php please include a way of viewing raw server requests in full? On 26/11/2007, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > If you're with linux try netcat (nc) at listening mode. > > > > how can i get a raw and untouched printout of a multipart/form-data > > POST? i need this to analyze what certain user agents do wrong when > > uploading files. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: how do i get a printout of original multipart post data
thanks, but that won't work. i need to see post data from other people out there, not my own data. still a mystery to me why php doesn't let developers see incoming raw data. On 01/12/2007, Dan <[EMAIL PROTECTED]> wrote: > ""Olav Mørkrid"" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > hello > > > > > > how can i get a raw and untouched printout of a multipart/form-data > > POST? i need this to analyze what certain user agents do wrong when > > uploading files. > > > > what happens is that php just fails to put files into $_FILES, and > > gives no way of seeing the original posting and exactly what is wrong > > with it. > > > > according to the manual, neither "always_populate_raw_post_data" nor > > work for multipart/form-data. > > Go get Ethereal http://www.ethereal.com/ start the program, set which > network card you want to use (you probably only have one), start capture. > You'll now see all the packets going down the wire. Go ahead and do the > post and you'll be able to see the post data. > > - Dan > > -- > 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] utf-8 in $_POST
hello does php have any built-in functions to convert post data from whatever format it arrives in to whatever format i wish? example: i use iso-8859-1 internally, and even specify accept-charset=iso-8859-1 in my html, but some browsers (phones) send utf-8 anyway. do i have to manually check if CONTENT_TYPE says "utf-8" and then convert the $_POST array elements one by one, or does php have any built-in functions to ease this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] utf-8 in $_POST
i specify iso-8859-1 in both header and body: if two different people post the norwegian phrase "Godt nytt år" (happy new year), it may appear in the following variations: [CONTENT_TYPE] => application/x-www-form-urlencoded;charset=iso-8859-1 $_POST["input"] = "Godt nytt år" [CONTENT_TYPE] => application/x-www-form-urlencoded;charset=utf-8 $_POST["input"] = "Godt nytt Ã¥r" i was just wondering if php had some setting or function that would make it auto-convert $_POST data into one specific encoding. otherwise i seem forced to do something like this in the beginning of my php script: if(ereg("utf-8", $_SERVER["CONTENT_TYPE"])) { foreach($_POST as $key => $value) $_POST["key"] = convert_utf8_to_iso8859($value); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] utf-8 in $_POST
the user agents in question are various mobile phones, which as you might guess are premature technology and have their own ways with things. here is an example posting from a Samsung D600 which insists on posting form data in UTF-8 even though i serve it ISO-8859-1 and it claims to support all character sets. [_POST] => Array ( [message] => Norwegian characters: øá ) [_SERVER] => Array ( [HTTP_ACCEPT_CHARSET] => * [CONTENT_TYPE] => application/x-www-form-urlencoded; charset=utf-8 [HTTP_USER_AGENT] => SAMSUNG-SGH-D600E/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Browser/6.2.3.3.c.1.101 (GUI) MMP/2.0 ) i would consider switching to utf-8 if i knew how make the windows version of emacs work fine with utf-8 text files (and still work with iso-8859-1 files as well). On 08/01/2008, Per Jessen <[EMAIL PROTECTED]> wrote: > Olav Mørkrid wrote: > > > i specify iso-8859-1 in both header and body: > > > > > accept-charset="iso-8859-1"> > > Have you checked 1) what the webserver sends in the header and 2) what > the browser actually uses? I'm pretty certain I've had issues where > the meta tags were fine, but the server overrode me settings in the > header. > > > /Per Jessen, Zürich > > -- > 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] crc check for JPEG file exists
hello is crc32() an acceptable way of managing whether a JPEG file exists (in a database or similar collection)? i mean doing a crc32() on the binary data of the JPEG file, and then check the database if there is already another entry with the same CRC. the database has relatively few images (some thousands). is there any chance of collision (two different JPEG images generating the same CRC) that is anywhere near likely, or is this extremely remote? advice would be appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] getting timestamp for first day of current week
hello how do i get the TIMESTAMP for the FIRST DAY of the CURRENT WEEK (ie. monday 00:00:00)? i tried using strtotime("monday"), but: - when i use it on a monday, i get monday THIS WEEK - when i use it on tuesday thru sunday, i get monday NEXT WEEK i tried "last monday", "monday this week", "this monday", etc. but nothing helps. this code proves the issue (2 july is a monday, 8 july is a sunday) for($d=2; $d<=8; $d++) { $time = strtotime("$d july 2007"); $date = date("Y-m-d", strtotime("monday", $time)); echo "$date\n"; } is this a bug, or a locale issue? at any rate, how do i get monday 00:00:00? thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting timestamp for first day of current week
On 03/07/07, Robert Cummings <[EMAIL PROTECTED]> wrote: If that's ALWAYS the case then it sounds like you have all the information you need to get the Monday you want :) what do you mean? php clearly makes a mistake in giving monday of the current week. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting timestamp for first day of current week
what i need is that "monday" means "monday this week", regardless of whether i ask on monday, tuesday, wednesday, thursday, friday, saturday or sunday. the way php works now, i have to something like this: if(date("l") == "monday") $from = date("Y-m-d"); // if today if monday, just give today's date else $from = date("Y-m-d", strtotime("last monday")); // when asking on tuesday thru sunday it would be nice if strtotime understood the form "monday this week". On 04/07/07, Robert Cummings <[EMAIL PROTECTED]> wrote: On Wed, 2007-07-04 at 22:14 +0200, Olav Mørkrid wrote: > On 03/07/07, Robert Cummings <[EMAIL PROTECTED]> wrote: > > > If that's ALWAYS the case then it sounds like you have all the > > information you need to get the Monday you want :) > > what do you mean? > > php clearly makes a mistake in giving monday of the current week. I don't see how you figure "clearly makes a mistake". For instance the following script illustrates a VERY clear behaviour that doesn't seem mistaken to me, it seems more like a design choice: You'll notice that it always presents the first such date from TODAY ONWARDS. With that in mind it is trivial to get the date YOU want. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] duration of mp3 file
http://arrozcru.no-ip.org/ffmpeg_builds/ On 11/07/07, Andrei <[EMAIL PROTECTED]> wrote: Or you could use ffmpeg executable to get details about the media file. You will have to parse the response of the executable. The only thing is that you must have exec function or an execution function available and ffmpeg installed. This is for linux machines tho... Don't know if ffmpeg is available for windows too. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] getting the "next" element of an associative array
let's say we have the following associative array: $array = array( "red" => "ferrari", "yellow" => "volkswagen", "green" => "mercedes", "blue" => "volvo" ); then we have a current index into the array: $index = "yellow"; $current = $array[$index]; now: how do i get the key of the next array element (in this case "green")? $next = ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting the "next" element of an associative array
chris for your suggestion to work, the internal array pointer of $array would first have to be set to point to the current element ($index). but how do you do this? this may seem like childs play, but i actually can't find any documented php function for this. it would be something like: array_set_internal_pointer($array, $index); On 12/07/07, Chris <[EMAIL PROTECTED]> wrote: Olav Mørkrid wrote: > let's say we have the following associative array: > > $array = array( > "red" => "ferrari", > "yellow" => "volkswagen", > "green" => "mercedes", > "blue" => "volvo" > ); > > then we have a current index into the array: > > $index = "yellow"; > $current = $array[$index]; > > now: how do i get the key of the next array element (in this case "green")? > > $next = ? Funnily enough: $next = next($array); http://www.php.net/manual/en/function.next.php -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting the "next" element of an associative array
yep, a for loop is the fallback i use now. any reason why there isn't a built-in function for this? any plans for it in future versions of php? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] double output from trigger_error from command line
if i do a trigger_error() when running php scripts from the command line, each error is echoed twice. this is annoying. does anyone know how to make each error display only once? c:\>php -r "trigger_error(\"hello\");" PHP Notice: hello in Command line code on line 1 Notice: hello in Command line code on line 1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] repetition of tedious references
consider the following statement: $language = isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]) && $_SERVER["HTTP_ACCEPT_LANGUAGE"] != "" ? $_SERVER["HTTP_ACCEPT_LANGUAGE"] : "*"; when using strings in arrays that may be non-existing or empty, you have to repeat the reference *three* times, which gets excessive and unreadable. is there any way to only have to write $_SERVER["HTTP_ACCEPT_LANGUAGE"] only once? i know it's possible to supress "is not set" with @, but that just seems wrong in case there really is an error in the statement. i love php, but this is one of my pet peeves. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] repetition of tedious references
if the string is not set, you will get an "undefined index" error when calling isused(). that's just the problem. you can't reference an unset string without doing isset first, so putting isset inside the function is simply too late. On 18/07/07, C.R.Vegelin <[EMAIL PROTECTED]> wrote: Hi OLav, what about this ? $language = isused($_SERVER["HTTP_ACCEPT_LANGUAGE"]); echo "language is " . $language; function isused($variable) { return isset($variable) && $variable != "" ? $variable : "*"; } HTH, Cor - Original Message - From: "Olav Mørkrid" <[EMAIL PROTECTED]> To: "PHP General List" Sent: Wednesday, July 18, 2007 1:24 PM Subject: [PHP] repetition of tedious references > consider the following statement: > > $language = > isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]) && > $_SERVER["HTTP_ACCEPT_LANGUAGE"] != "" ? > $_SERVER["HTTP_ACCEPT_LANGUAGE"] : "*"; > > when using strings in arrays that may be non-existing or empty, you > have to repeat the reference *three* times, which gets excessive and > unreadable. > > is there any way to only have to write > $_SERVER["HTTP_ACCEPT_LANGUAGE"] only once? > > i know it's possible to supress "is not set" with @, but that just > seems wrong in case there really is an error in the statement. > > i love php, but this is one of my pet peeves. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] repetition of tedious references
rob, yes i thought of this, you could possible even do function magic($array, $name, $default=null ) { return isset($array[$name]) && $array[$name] ? $array[$name] : $default; } $string = magic($_SERVER, "HTTP_ACCEPT_LANGUAGE", "*") however i wish php would have some built-in support to solve the issue. On 18/07/07, Robert Cummings <[EMAIL PROTECTED]> wrote: function getServerVar( $name, $default=null ) { return isset( $_SERVER[$name] ) ? $_SERVER[$name] : $default; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] repetition of tedious references
i didn't know about empty. thanks! do you have a link to this new php 6 ? : convention? it would be great if php 6 could have a solution for this. php is sweet when it's compact! On 18/07/07, Arpad Ray <[EMAIL PROTECTED]> wrote: You can use empty() to take one of them out, since "0" is presumably also not a desired input: $language = empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? "*" : $_SERVER['HTTP_ACCEPT_LANGUAGE']; There's a new ?: operator in PHP 6 which will make that even shorter, however unlike empty(), it currently throws a notice with unset operands. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] double output from trigger_error from command line
sorry. still get it twice. c:\>php -r "error_reporting(E_ALL ^ E_NOTICE); trigger_error(\"hello\", E_USER_ERROR);" PHP Fatal error: hello in Command line code on line 1 Fatal error: hello in Command line code on line 1 - if i do error_reporting(0) then i get NO lines at all. and if i do error_reporting(E_NOTICE) and then trigger_error("hello", E_NOTICE) i get two again. so there must be some setting beside error_reporting. On 17/07/07, Instruct ICC <[EMAIL PROTECTED]> wrote: My error_reporting level was at 2039 and I did not see the double messages. But I think you need to manipulate the error_reporting level. Maybe something like: php -r "error_reporting(E_ALL ^ E_NOTICE); trigger_error(\"hello\", E_USER_ERROR);" "Show me every report except E_NOTICE, and then trigger an E_USER_ERROR which says 'hello'" Sorry, I didn't reply to the list the first time. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php