Re: [PHP] pdf
Hi all , I am using PHP 4.3.2 and MYSQL database. I need to convert the sql query to Adobe PDF format. Any one have any suggestion how to do this? I have search phpclasses , found SQL2PdfReport classes , however it gave error message as shown below : Error in opening pdf Lookup the code in the SQL2Report class , it did not support pdf 7.0 and above. Thanks I would recommend you looking into pdflib, this is a professional package which supports all versions of PDF, and really whatever you need. The other class people mentions are free, but far from as advanced as pdflib. Grab it here : http://www.pdflib.com/ regards, Kim Steinhaug http://www.steinhaug.no/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Files passing through
I'm using this method, works fine with 50mb+ files : if( $fd = fopen ($filepath, 'r')){ while(!feof($fd)) { $buffer = fread($fd, 2048); print $buffer; } fclose ($fd); exit; } Regards, Kim Steinhaug - - - - - - - - - www.easycms.no - Original Message - From: Evert | Rooftop [EMAIL PROTECTED] To: PHP-Users php-general@lists.php.net Sent: Monday, August 22, 2005 9:30 PM Subject: [PHP] Files passing through Hi People, I want to use a PHP script to pass through a file to the browser [ right after some processing ]. What is the fastest way to do this? I know echo(file_get_contents('myfile')); is not a good idea ;) Is fpassthrough the right choice? maybe virtual, so it won't go through php but apache does the job? there's also readfile Another question, how seriously does this affect the performance in comparison to let apache handle it. Is the difference big at MB+ files? or only significant when dealing with a lot of tiny files? Thanks for your help! Evert -- 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] Looking for CMS advice
You are referring to this page : http://www.opensourcecms.com/ Regards, Kim Steinhaug - - - - - - - - - - - - - http://www.easywebshop.no/ - Original Message - From: Richard Lynch [EMAIL PROTECTED] To: Erik Gyepes [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Tuesday, August 23, 2005 9:28 AM Subject: Re: [PHP] Looking for CMS advice On Mon, August 22, 2005 3:48 am, Erik Gyepes wrote: Zachary Kessin wrote: I am about to start on a project that seems like it would be right for a CMS system. It will be about 80% rather boring stuff with about 20% custom database work. I have looked at XOOPS and a few others. However I can not seem to find one rather important thing about XOOPS. I understand how to use a module that someone else wrote, but I have not found any documentation on how to build my own blocks or application components. I am not yet committed to XOOPS, so if there is different system that would be better that could work as well There is a pretty cool site out there that lets you kick the tires on a BUNCH of different PHP/MySQL CMS products/projects. opencms.org or something like that. I always have a tough time finding it with Google and whatnot, but it's there. Anyway, they basically installed a couple dozen CMS systems, and you can set yourself up with your own sandbox install on THEIR server with just a click of a button, then administer it and play with it, and then they wipe it out in about 2 hours. So you get a chance to play with it to see if you like each CMS, and you've got 2 hours to check it out -- Or more, since you can start over with a new sandbox. They just don't want you to try to run your site through theirs. I doubt that it will actually let you write/upload arbitrary PHP for the missing 20%, but they MIGHT have some examples or user comments on their site on these issues, and at least you can play with the 80% to see if the features you need for that part are there. HTH -- Like Music? http://l-i-e.com/artists.htm -- 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] session_start(), Pragma and Cache-control headers
Hello, I'm working on a downbload script which serves M3U files (Winamp playlist files) through a PHP file like this : somepath/download.m3u.php?id=2 Then in the PHP script I generate the M3U file, and serve up the headers I want. Swell so far, but a little problem appears. The downloads are for members only, and therefor I need to check if the user is logged in, I do this by sessions and therefore I add a session_start() at the start of my file. When I do this some headers are added to the file, namely : Set-Cookie: PHPSESSID=xxx; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Theese headers are not needed, and I dont want them either, exept I cant seem to get rid of them since I need the session_start() in the beginning of the file. Sure, I could wish for a function unset_potensial_header(pragma); I guess there are no way to remove theese unwanted headers? Yesterday I had to give up another problem, but luckily I found the answer here : http://bugs.php.net/bug.php?id=33057 So to sum it up : How can I remove the Cache-Control and Pragma headers? And Im not looking for this answer : header('Pragma: '); header('Cache-control: '); The headers are still sendt, exept they are empty, doesnt look like a nice sollution for a production environment. Kind regards, Kim Steinhaug - - - - - - - - - www.steinhaug.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session_start(), Pragma and Cache-control headers
I solved the problem after a while, seems it had been reacently debated in the bug pages within php, to remove headers which are added by the session_start(); you can add the following : ini_set('session.use_cookies', false); session_cache_limiter(''); Kind regards, Kim Steinhaug - - - - - - - - - www.steinhaug.com - Original Message - From: Kim Steinhaug (php list) [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Monday, August 22, 2005 7:01 PM Subject: [PHP] session_start(), Pragma and Cache-control headers Hello, I'm working on a downbload script which serves M3U files (Winamp playlist files) through a PHP file like this : somepath/download.m3u.php?id=2 Then in the PHP script I generate the M3U file, and serve up the headers I want. Swell so far, but a little problem appears. The downloads are for members only, and therefor I need to check if the user is logged in, I do this by sessions and therefore I add a session_start() at the start of my file. When I do this some headers are added to the file, namely : Set-Cookie: PHPSESSID=xxx; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Theese headers are not needed, and I dont want them either, exept I cant seem to get rid of them since I need the session_start() in the beginning of the file. Sure, I could wish for a function unset_potensial_header(pragma); I guess there are no way to remove theese unwanted headers? Yesterday I had to give up another problem, but luckily I found the answer here : http://bugs.php.net/bug.php?id=33057 So to sum it up : How can I remove the Cache-Control and Pragma headers? And Im not looking for this answer : header('Pragma: '); header('Cache-control: '); The headers are still sendt, exept they are empty, doesnt look like a nice sollution for a production environment. Kind regards, Kim Steinhaug - - - - - - - - - www.steinhaug.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AJAX coding and Sesisons
I have done this quite a few times lately, you shouldn't worry. Just have your session_start() and login security on the pages that you access with javascript aswell, they will have the same security as any other page. The sessionID is used for all requests to the server from the webbrowser, also from within a page from javascript. Which again means that you can use your validation scheeme on theese files aswell. As a side note, if your on a page the user spends much time on, having some Ajax functionality accually works like a little heartbeat / pulse, resetting the session time so that the user infact can spend more time on the same webpage without having to do some movement, :D regards, Kim Steinhaug - - - - - - - www.steinhaug.com - Original Message - From: Bret Walker [EMAIL PROTECTED] To: PHP-Users php-general@lists.php.net Cc: Ivan Meyers [EMAIL PROTECTED] Sent: Monday, August 22, 2005 9:57 PM Subject: [PHP] AJAX coding and Sesisons I'm authoring a web app, and I want to use some AJAX functionality. The users log in via PHP, and they are verified page to page by a session variable (which stores their username). I want to write some PHP that alters a database, but I want to be sure that only authorized users can access the page, and that they can only delete items associated with their username (in the table). I want to have javascript asynchronously call the php page, but I don't know how to protect this page. I don't think I can rely on my session variable, because the user won't be directly calling the page. I don't want user A to be able to submit a request to delete an item belonging to user B. How can I secure this setup while still using AJAX? Thanks, Bret
[PHP] matching system - anyone seen any?
I wonder if anyone have come across a script/system that already has this feature, else I would need to do it all over again. The scenario is this : I want people to select the movies they have seen and rate them 1/10. Movies not available in the polling system they can add, and rate them. This way the database is constantly growing, and ratings are constantly added. You can rate as many films you want, or noen if you like. Then, after you have rated you can match your ratings to find other people that match your selections. More like matching a profile really. There would be some sort of system inside here which could build a form of profile based on your ratings, and then compare theese profiles. I havnt really started planning how this would work, or should work, but first mainly if anyone has seen such a system around. Looking for existing wheels... :D -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Upload problems
Just a quick question, Did you alter the upload_max_filesize to 500MB and the post_max_size to say 510MB and you succesfully upload 500MB files from one machine to the server? I never testes with filesizes that large, but It would be nice to hear if it accually works without tweaking to much. I would also think that the general 30sec timout would need to be altered as moving a 500MB file from /var/ to the users homedirectory and then do some filechecking on it and such would easilly need some extra seconds. Not to think of the overhead if many people upload large files at a time. Ok, its a vague post this, just looking for some input here, :D Its like the needle and the haystack, dont know what im exatcly looking for here, but you never know. I work with large files myself on some systems, and its always nice to get feedback whatever it is from other people working with the same stuff. -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: dropdown box displays empty rule
Well, seems you have some confusing logic here, since you print out the option before you check if it should be checked. To top it off, when its accually checked you write out an empty value, which really doesnt make any sence at all. A quick rewite would be : while($rowu=mysql_fetch_object($result1)){ if ($selected==$rowu-naamreis) echo option SELECTED value=\$rowu-naamreis\ . $rowu-naamreis . /option\n ; else echo option value=\$rowu-naamreis\ . $rowu-naamreis . /option\n ; } -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no - www.webkitpro.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using Post like Get
Since you are on the same server, I hope you mean the same domain. If not the session variable wouldnt work very well. But if you infact are on the same domain, you should look into the session variable and store everything you need. From what I know there are now limits on how much you can store in a session, that said I wouldt pump several megabytes into it... Several good answers here, but it looks like most of us agree on the session. Cookies can ofcourse also be used, but this also means that you require all your clients to have them enabled. Anyways, even when using cookies I always use session as the main system - cookies only works as a saved session in my systems. (Meaning, instead of having to logg onto the system again, the username and passowrd are stored in a cookie, this way the user can choose the famous remember me setting many of us enjoy). -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - Dennis Gearon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] What I'm trying to achieve is to have the same cookie IDENTIFY a user on different (or same) applications (on the same server), but require them to log in for each application, and get a different session.. Basically, to keep separate 'user trails and in process variables' for different tabs or windows in a browser. www.scotttrade.com does it somehow, and I see no GET variables on the URL. John W. Holmes wrote: Dennis Gearon wrote: With get varaibles, it's possible to always have get variables on a page, even without a form, by simply appending the Get variables to the end of the URL. Is there anyway to do the same with Post variables? For instance, a javascript that onUnload submit, or something? You can't just include POST variables in a link, if that's what you're going for. Perhaps some clunky javascript submitting a hidden form on an onclick method would get you close, but why even bother? Maybe you should just say what you're actually trying to achieve and why, then we could offer better alternatives. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] String compare of 7 text strings
* Ed Lazor wrote : Nice solution =) My thoughts exatly, :D -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP logic - Whats going on here?
Ive stumbled onto a rather strange problem, atleast I cant see why this is happening. Im using phpMailer to send mails, and I have the following straight forward code : $mail = new phpmailer(); $mail-IsSendmail(); $mail-From = '[EMAIL PROTECTED]'; $mail-FromName = 'From Name'; $mail-AddAddress('[EMAIL PROTECTED]'); $mail-Subject = $header; $mail-Body = $body; Then to send the mail we use this : if(!$mail-Send()) { echo $lang_error['mailer_error'] . br\n; } As you see above, Ive dropped the what if all goes well loop, since I believe that the $mail-Send() is initiaded in the first statement For some reason the above results in a blank mail, no $body at all, rest is fine. However, if I include a dummy for if all goes well : if(!$mail-Send()) { echo $lang_error['mailer_error'] . br\n; } else { // Why do I need this one??? } What I dont understand is why do I need the last else statement? Isnt the result of $mail-Send() completed if I only check for !$mail-Send()? Maby it would be better to write like this : if(!$mail-Send()) { echo $lang_error['mailer_error'] . br\n; } else if ($mail-Send()){ // Why do I need this one??? } The above would in my belief send two mails, atleast my logic tells me that. The strange part is that when looking at examples from phpmailer.sourceforge.net they use my initial loop aswell, not the Why do I need this one??? part. Im beginning to wonder if there are something mystical going on with either my code or our servers. ?? Hope someone understand what Im wondering about here, hehe. -- -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP logic - Whats going on here?
Thanks for your reply, it all seems logical when you think of it, still I also think it sounds logical without the extra ELSE statement since the function has to executed for the first IF to do the comparison, meaning that the email should be sendt in the first place. (If it didnt how could it state FALSE or TRUE, unless PHP only simulates the function if it falls outside the initial IF statement) However, no reason to argue the obvious, :D On the other hand, this would also mean that the exmaples from phpmailers homepage are wrong : [ SNIP FROM http://phpmailer.sourceforge.net/extending.html ] $mail-Body= $body; $mail-AltBody = $text_body; $mail-AddAddress($row[email], $row[full_name]); $mail-AddStringAttachment($row[photo], YourPhoto.jpg); if(!$mail-Send()) echo There has been a mail error sending to . $row[email] . br; [ /SNIP] This is probably why I in the first place removed the extra ELSE statement, since I didnt see any reason for it. But in future Ill always include it it seems, :D -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: JavaScript Enabled?
Indeed an old thread this one, but I still would like to know if someone have some input on some ways of solving this dilemma. Surely it is easy to detect javascript when its enabled, but what to do when it's not enabled is a much more interesting approach. I have several systems online which (maby from old habits) heavily depends on javascript functionality. Surely I could easily remove all javascript and do all processing and validation serverside, but in my honest opinion I see no practical reason to ignor javascript in any application. The benefits of using java is far greater than the problems. SOLLUTION 1 - DETECTING THE CLIENT I would think that if we set a meta refresh to the noscript.htm and an onload javascript to switch to script.htm we could from theese pages set some session variables if the user has script or not. However this redirecting of pages is kinda silly I think, and I would like to think that there are other ways of doing this? Let us not forget that search engines would just love this sollution on our frontpage... Surely we could add this code and refresh the same page with ?jave=false or ?java=true, but for some reason I dont like this sollution. Meta refresh is bad. ALTERNATIVE SOLLUTION - POSSIBLE? Hoping someone has already solved this Im throwing some thoughts here. Since I use the session variable on all my pages, I could also create a fake gif spacer from a php script (eg. spacer.gif.php, which eventually spits out the gif but lets me do some stuff meanwhile at first). This gif could be called from javascript document write. A 1x1 spacer, which if I call this gif would mean that javascript would work, and if this script is triggered I could update the session with eg. script=true; Which would make me know if the user has it enabled or not? Atleast this sounds logical in my head, aslong as I dont need to alert the user at once if hes got enabled java or not. This approach would mean that I can alert the user with whatever HTML code from PHP I would want after eg. 3 pageviews, since he would surely have the triggered the dopcument.write by then. (Ofcourse if he has deactivated images aswell we have problems but hey... ) Alot of nothing here really, but maby someone have some thoughts on the matter. -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - Richard Davey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all, Can anyone suggest a suitable means for detecting if a client browser has JavaScript enabled or not? I know this isn't exactly PHP related, but I need to make sure my PHP script offers an alternative in a friendly way and not a JS error, but I just wondered if there was a foolproof method of doing this? -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: encryption needed?
if there is a system of your id's, like 1.. 2... 3... 4.. and such, you should consider obfuscating the id's. Especially if you dont have any form of login system that serve the client the id they want. What you really should consider is having a login system that after the user is logged in you serve the user the correct content, and all from what is stored in the session. Meaning you dont need client side javascript or hidden forms at all. If the id's are unguessable however I wouldt care that much, on the other hand - is the information in mention sensitive? If so you are back to the login system again. -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - Klaus [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all, I am to set up a service where users can view news of companies. To identify the company selected an easy way is to use the company-id. The id is not displayed but stored in the client browser as JS-variable. Question: Is it ok to use the company-id or do I have to encrypt the id using mcrypt (takes some time)? Thanks in advance Klaus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Opinion: PHP Sessions or Cookies
Sessions are the best thing to use, cookies are nice as a supplement. If you want your users to be able to auto-login cookies are just the thing to use, but apart from this cookies are not my favourite. Another thing is that many browsers nowaydays have turned cookies all off.. I remember a friend of mine did a supportsystem where the loggin system was pure cookies... Man - did their staff get a lot of support from people who didnt manage to logg into the system... As mentioned - this were users with cookies turned off As the other users mentioned, the /tmp folder might be out of space, however your provider might also have some custom setup on that server which screws up the /tmp folder here and there. I know for a fact one large provider here in Norway who has this problem on one of their servers due to a heavy site which from time to time sucks up resources resulting in the /tmp folder getting messed up. If you still havnt solved your problem, get your provider to move you to another of his servers (physically!), or change provider. You shouldnt be having theese problems. -- -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - Ed Lazor [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'm using PHP sessions for user tracking. My host provider's server is dropping session data. He swears it's my scripts and says I should be using cookies for better security. That goes completely opposite to my understanding, so I'd like to run it by you guys. Which is more secure: PHP sessions or cookies? In case you're curious, more details on the specifics of the problem I'm experiencing: I have a prepend file that executes start_session. The script assumes the user is a guest if $_SESSION[UserID] is not set. All guests route to the login screen. Successful authentication sets $_SESSION[UserID] and sends you to the original requested page. It seems fairly straight forward to me. People are able to login and start using the site, but the login screen displays randomly after they've already authenticated successfully. It sounds like PHP session data is being lost on the server. I've also seen error messages on web pages that report PHP / MySQL as having trouble reading from the temp directory. Here's the extact message: ERRORError writing file '/tmp/MYiYcf7q' (Errcode: 28). Anyway, those are the details. I look forward to hearing what you think. -Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and Excel
I might be wrong, but if your client are using all the functions available in Excel Im pretty sure you wont get this to work. Ive tested a few of the Excel converters for PHP and they all work nice with simple Excel spreadsheets, but once you start doing it Excel style... Your on your own... If youre on a Win32 platform you might solve this nicely, since this gives you alot of possibilities with exec and such. But I wouldt spend to much time on this if the system is to run on a *nix system. I hope someone proove me wrong here, but theese are my findings. Possible there are some nasty good proprietary Excel systems out there? Anyone? -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - Arnold [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I want to use a large Excel sheet in a website. The Excel sheet exists of lots of functions and the developer of it is a financial person who is used to programmning in Excel, not in other programming languages. How can i: insert the data that's filled in in several forms on web pages (i guess the spreadsheet Excel Writer package), let Excel do the work and produce the output information, in PHP? Or is there an easier way to use an Excel sheet together with web pages? Arnold -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Benchmarking a script
If you have an apache webserver setup you should look into the ab, apache benchmark suite. This will give you a very good tool to benchmark your files in its correct environment without altering your code. If youre on a windows plattform and cant locate the ab.exe tool please tell me and I'll email it to you, I remember I spent some time finding it. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Anguz [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I have a script I am optimizing and want to compare the before and after in speed. So I wrote a few lines to loop this script but I have a problem. In the script I'm optimizing there's some function definitions and when the script starts the second iteration it throws an error because the function already exists. How can I modify my benchmark code to make it work? This is what I have: ?php $bench_n = 1000; for($bench_i=$bench_n; --$bench_i=0; ){ ob_start(); $bench_time1 = array_sum(explode(' ', microtime())); // script start // script... // script end ** $bench_time0 += array_sum(explode(' ', microtime())) - $bench_time1; while(@ob_end_clean()); } echo 'preTot Time: ' , $bench_time0 , 'br /Loops:' , $bench_n , 'br /Avg Time: ' , ($bench_time0 / $bench_n) , '/pre'; ? Thank you very much in advance. Cristian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: bad programming?
Could be something about the server environment, you could try changing to : $_SERVER[REQUEST_METHOD] Run a phpinfo() and see what variables are active on your new server. I know that IIS webservers lack alot of the variables we take for granted mostly. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Amanda Hemmerich [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] We just moved a bunch of code from one web hosting company to another. Now, one of the pages no longer works. I have been sort of starting from scratch, and the first line is still not working. Am I using something that I shouldn't be? Here is a code snippet: if ($REQUEST_METHOD=='POST') { for(reset($HTTP_POST_VARS); $key=key($HTTP_POST_VARS); next($HTTP_POST_VARS)) { $this = addslashes($HTTP_POST_VARS[$key]); $this = strtr($this, , ); $this = strtr($this, , ); $this = strtr($this, |, ); $$key = $this; } } The part that's not working is the $REQUEST_METHOD=='POST' line. If I replace that with if ($login) (and $login is the name of the submit button on the form), it works fine. I am leary of using $login...any other suggestions? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Encryption Question
Do you really need to use stripslashes when retrieving the data? Wouldnt stripslashes only affect magic quotes or already added slashes, I mean when you addslashes to the SQL the slashes are indeed removed when inserted in the table. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Justin Patrin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jay Blanchard wrote: Good morning gurus! I am encrypting some data on one server and now I am attempting to decrypt on another server using mcrypt_encrypt and mycrypt_decrypt (using same key and initialzation vector). It is almost working but I seem to still have a little problem, that data is missing the last character which still seems to be encrypted. I am putting the data in the database with addslashes, and retrieving with stripslashes, but I get things like this; 45221141¤Þ,]¹9Ñ 7775ÿåZ|z while($arrEncInfo = mysql_fetch_array($dbGetSub)){ $stripDataA = stripslashes($arrEncInfo['dataA']); $stripIV = stripslashes($arrEncInfo['iv']); $dataA = mcrypt_decrypt($encAlg, $encKey, $stripDataA, $encMode, $stripIV); echo $dataA . \n; } Has anyone seen this? Could there be a difference between the PHP installs? Both are version 4.3.7. Thanks! Jay You should probably use mysql_escape_string or mysql_real_escape_string instead of addslashes and stripslashes. IMHO addslashes and stripslashes are pretty much useless. -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: is there any application , by using i can produce php exe files in windows ?
That is thrue, but there are some experiments with compiling the scripts into self running exe's. There are a nice tutorial available somewhere made by probably the only one who has managed to do this, :) Anywho, I remember one can use his precompiled files to create ones own EXE setups. Still, the problem at the time I experimented with it was that you get an extra DOS window which lies on the taskbar. This was a year ago, maby things have happened since then. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Marek Kilimajer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Kim Steinhaug wrote --- napísal:: Well, You could have a look at this one, http://gtk.php.net/ Though I never had the lucury of getting anywhere with it, it has the possibility to create standalone EXE. There is (Atleast the last time i checked) still a problem with the EXE opening an extra command prompt window, which makes it look abit unprofessional if your thinking of applying somthing for your business customer. That extension does not create exe files, they are normal php scripts that use gtk functions. The window issue can be solved, there is some kind of wrapper available. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: comparing timestamps
Well, Since the current timestamt is now, and 5 minutes equals 60seconds * 5 minutes = 300, this would give you your range as : $range = time() - 300; If you are working with time() in your database your select would be something like : select * from table where timestamp = $range -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Chris Mach [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I want to compare a timestamp in my database with the current time. I want to be able to tell if the timestamp is within 5 mins of the current time. How would I do this? Please? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.708 / Virus Database: 464 - Release Date: 18-Jun-2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: is there any application , by using i can produce php exe files in windows ?
Well, You could have a look at this one, http://gtk.php.net/ Though I never had the lucury of getting anywhere with it, it has the possibility to create standalone EXE. There is (Atleast the last time i checked) still a problem with the EXE opening an extra command prompt window, which makes it look abit unprofessional if your thinking of applying somthing for your business customer. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Ravi [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] HI, is there any windows application , by using we can produce standalone php .exe files ? --- knowledge is power share it --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Mysql fetch_row()
Whatabout : mysql_fetch_array() or mysql_fetch_object() Both gives you both the results and the names of the coloumns. Maby I didnt get the question right but since nobody else mentioned it, .) -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Gerben [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] when I call mysql_fetch_row() I get an array, but this Array doesn't have the fieldnames as array-keys. I've seen several codes from others where they use something like print $row['key']; This doesn't work on my server. Is this because my server-software is too old or am I using the wrong function? PHP Version 4.3.4 mySQL version: 3.23.54 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Can I detect size of files which are too large to upload?
Well, there is really a short answer for this one. NO! I guess you want to inform the user that a 30MB file is to much to handle for the default 2MB barrier of PHP. Uploading the 30MB file to inform the user that 2MB is what we can handle is kinda to late.. Ive been looking several times for systems that can tell me the filesize before I upload the files / images. Javascript doesnt have the rights, maby some javaapplet where the user accepts the applet could do it. The best function Ive seen so far is the image upload applet from the Gallery team, ther are very close to being able to confront this problem. If you find a sollution be sure to inform me, I would love to know it. Happy hunting! -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com --¨ Pablo Gosse [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi folks. I'm just tweaking the file manager portion of my CMS, and am wondering if there is any way I can identify the size of an uploaded file which exceeded the upload_max_filesize? I'd like to be able to tell the user the size of the file they tried to upload, in addition to telling them the allowable maximum size. It would seem logical to me that I would not be able to do this, since if the file exceeds the limit set by upload_max_filesize then the upload should not continue past that point. Is this an accurate assumption? Cheers and TIA. Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: array_rand() not random
Well, I must admit Im gotten abit to familiar with the use of MySQL lately, though it might be abit overkill - but what the heck. The database is there to be used and we shouldnt worry to much. For those really worrying there are several file based sql alternatives out there. Ok, I would use and update statement against the SQL database, soething like : update my_stats_table set counter=counter+1 where id=1 All you need is to fire this query on every page, well, you might have different counters for different pages I just used the ID=1 as an example, it might aswell be page='frontpage' If you need a more dynamic sollution, meaning you have contents that you want logged that change from time to time - and you do not want to prepare the database all the time you could do it like this, remember I use a DB extraction layer function named query, so whenever I write query I really mean mysql_query... Assuming your counting banners query(update my_stats_table set counter=counter+1 where id= . md5($bannername)); if(!mysql_affected_rows) query(inserted my_stats_table (id, counter) VALUES (' . md5($bannername) . ',1)); You see the logic with the mysql_affected_rows. Now your still stuck with doing some nifty stats generating from the data you have in your table - but now you have numbers in the database and you have several options. One that suddenly comes to mind, is always showing the one with the smallest impressions. $result = query(select * from my_stats_table where order by counter limit 1); You would here need to add more information, probably might aswell include the entire banner in the database. Well, BTW, hope this helps you. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- on Sun, 13 Jun 2004 01:15:20AM +0200, Kim Steinhaug insinuated: Hmm... Ive been having same problems with mysql and picking random numbers, I ended up having to program a rather more sofisticated system to eliminate the stats you were referring to. You could, not that it will be any better, try another approach : Something like : $count = count($your_data_array); $random = rand(0, $count); echo $your_data_array[$random]; PHP is maby using the same random function for both the array_rand and rand for all I know but its worth a go. yeah, since they use the same thing i'm not sure it'd be worth the effort. The harder way would be to include an internal counter for your elements you want to be randomized, so that when an item is selected you count it. Then the next time you calculate the random element you take the accual hits into meassure. There are like a 1000 ways to do this so use your imagination. that would be cool. but how do you maintain the value of a counter from reload to reload? would i have to open an external file, read its variable, increment it, write to it, and close it every time? or is there a way to do that in the code of a single php page? thanks again, /nori -- .~. nori @ sccs.swarthmore.edu /V\ http://www.sccs.swarthmore.edu/~nori // \\ @ maenad.net /( )\ www.maenad.net/jnl ^`~'^ ++ Sponsor me as I run my SECOND marathon for AIDS: ++ ++ http://www.aidsmarathon.com/participant.asp?runner=DC-2844 ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Best Lossless Hi-Res Photo Storage with PHP
Hei, Regarding the jpg compression, we did some testing along with our customers press buereu's (I think thats the name, the ones that do all the prints and designs the logoes and such). Here we did som testing on the images and the quality. What we experienced was that if we converted the images to JPG with a quality of 10 it was good enough for most people. I however still use 11 just to be safe. (We are ofcourse talking about 300DPI images) So there you have it, quality 10 is still good enough quality for print. However - be aware of another stupid fact - people expecting high resolution downloads wont download a 4-5mb jpg image, since it cant (?) be good enough quality... They are simply expecting a 50MB tif image since this is what they are working with normally. This is infact a huge problem! So much depending on you customers, but saving as a jpg should be just fine. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Galen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Jun 12, 2004, at 4:36 PM, Kim Steinhaug wrote: well, there are formats that have impressed me. The Mpg-4 format which requires plugins all over the place is really amazing, from e-vue. They also provide a plugin atleast for IE to browse the images. I dont know if you can compress images outside the windows platform however. That's a key problem. I don't touch Windows unless I have to, so I don't primarily run it at home and my servers _never_ run it, so this format is totally out of the running - I need to be able to compress/decompress on *nix based machines. If your looking for supreme quality however, you would need to stay away from the lossy formats and probably go for TIFF which is a great format and is also supported by any major software. PNG however is abit strange, woudnt sendt PNG images to a publisher... You could ZIP the TIF images on the HD to same space, you often get good results on this. This would also make the downloads better for the user, and since all the browsing online would use thumbnails you dont need to waste CPU do depack the images, since you all users can depack a ZIP file (thats the least you would expect from a user that purchase a High resolution image). I've experimented, PNG is notably better than ZIP for compressing image material. PNG retains 100% quality and offers the smallest file sizes around in a file that can be read by almost any system (i.e. all half-recent browsers, photoshop, most other graphics applications, etc). There's no reason I can't also offer a TIFF file, but I'll primarily route the user to the PNG file because it's simply the smallest download yet retains 100% quality and is a completely free format. Ive created such systems myself, and my sollution was another : Plug in a new harddrive. We save the images as jpg, tif, eps, ai or whatever the original image was created as, and create thumbnails at various resolutions in high compressed jpg for fast browsing. Often I tend to ZIP the lossless images aswell, but then again I dont need to since HD isnt a problem atleast in my case. I have a similar system implemented with thumbnails and caching and all sorts of things. Works great. But hard drive space is a major concern, so I have to be more conservative with the hi-res versions. Hope this helps. Well, it's good to know that somebody else works with this sort of thing. Although I was really hoping to hear from someone who's worked with JPEG 2000 lossless (much higher than PNG image compression ratio!) via ImageMagick or something similar to that. Or perhaps any other interesting solutions people have come up with that beat PNG for compression. More thoughts anybody? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: export from mysql to csv file
You are also probably using PHPMyAdmin, if not you should be using this. Exporting to CVS is fairly simple, and if your used to quering the databsae you should be able to do this very easilly yourself if your looking for a sollution you can do from scripts. Basically what you do is simply do a select * from table, which will give you every coloumn of the database, Thereafter loop through the entire dataset and use the mysql_fetch_array function, then use this : foreach ($temp AS $key=$value){ // $key = coloumn name // $temp[$key] = coloumn value if(!is_numeric($key)) echo $key . : . $temp[$key] . br; } Where $temp is the $temp = mysql_fetch_array($dataset_from_query); If your into 100.000 entries in the database you will need to do some smart quering, or alter the php.ini to handle more than the standard 30 sec timout. Basically you could also go in rounds of limit 0,5 thereafter limit 5,5 but that wasnt your question. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Dustin Krysak [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Can anyone point me to an existing script or tutorial to learn this? Thanks in advance! d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Header target?
Steve Douville had a long answer, the short answer : no -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Bob Lockie [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is it possible to specify the target frame in a Header call? I have a form that submits in one frame and I want it to redirect to another frame in some cases. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: array_rand() not random
Hmm... Ive been having same problems with mysql and picking random numbers, I ended up having to program a rather more sofisticated system to eliminate the stats you were referring to. You could, not that it will be any better, try another approach : Something like : $count = count($your_data_array); $random = rand(0, $count); echo $your_data_array[$random]; PHP is maby using the same random function for both the array_rand and rand for all I know but its worth a go. The harder way would be to include an internal counter for your elements you want to be randomized, so that when an item is selected you count it. Then the next time you calculate the random element you take the accual hits into meassure. There are like a 1000 ways to do this so use your imagination. One way could be to use some sessions, and when a user hits the page you precalculate the random sort for all your elements, and store that in the session. Then for each and every visit form that visitor you just go along with the pre-randomed data. This way your user will get a truly randomized experienced, and youll be showing off all the elements even if the random function in itself is abit non-random. Im sure there also exists a mathematical approach calculating a sort of the elements based on the earlier views (meaning that we count each view). -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Nori Heikkinen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Best Lossless Hi-Res Photo Storage with PHP
well, there are formats that have impressed me. The Mpg-4 format which requires plugins all over the place is really amazing, from e-vue. They also provide a plugin atleast for IE to browse the images. I dont know if you can compress images outside the windows platform however. If your looking for supreme quality however, you would need to stay away from the lossy formats and probably go for TIFF which is a great format and is also supported by any major software. PNG however is abit strange, woudnt sendt PNG images to a publisher... You could ZIP the TIF images on the HD to same space, you often get good results on this. This would also make the downloads better for the user, and since all the browsing online would use thumbnails you dont need to waste CPU do depack the images, since you all users can depack a ZIP file (thats the least you would expect from a user that purchase a High resolution image). Ive created such systems myself, and my sollution was another : Plug in a new harddrive. We save the images as jpg, tif, eps, ai or whatever the original image was created as, and create thumbnails at various resolutions in high compressed jpg for fast browsing. Often I tend to ZIP the lossless images aswell, but then again I dont need to since HD isnt a problem atleast in my case. Hope this helps. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Galen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'm working on a photo site and most of it is working. The intent is to store original high-resolution photos that will only be accessed when purchased, and then a variety of thumbnails that will be accessed when viewing. Because they're high-resolution, I need maximal image compression but I can't sacrifice image quality. With hundreds (or more) of many megapixel images, space requirements quickly soar. I am currently using PNG, but that's not all that great for lossless photo compression. JPEG 2000 is significantly better in terms of file size, but I haven't ever used that with PHP (and it seems I'll have to use it via ImageMagick or something). Are there any other (free) formats for high image compression out there that I can use (maybe even just via the shell) with PHP? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Decompressing files via php
There is some ZIP classes on phpclasses.org that work very well, you dont need to install anything on the server aswell as all code is included in the class. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Gerard Samuel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Friday 21 May 2004 04:44 pm, Justin Patrin wrote: Gerard Samuel wrote: Looking for libraries that are capable of decompressing files, such as those in zip or tar format. Im aware of PCL(Tar/Zip), and was wondering if there were any others out there. Just want to see whats out there before I settle on one of them. Thanks http://pear.php.net/package/Archive_Zip I was aware of Archive_Zip. I thought it was the same as PCLZip, as it was created by the same author. But thanks... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: sessions pls help
Well, What you need to do is start all pages with the session_start(); variable, like this : ?php session_start(); ? This would make you ready for handling logins and such further down the page. What you also need to do is two things, 1. Create a login which registers a new session. 2. Create a validation function which validates the logged user on each page. Example, login page : ?php session_start(); if(($_GET[username]==thename) ($_GET[password]==thepass)){ $u-username=$_GET[username]; $u-password=$_GET[password]; session_register(u); } ? The above code would mean that a) You enable the session for the page. b) If the username and passord is valid, you se the sessionobject, in the example u to the username and passord. Further you need the page to validate if you have a valid login, a simple way would be to just validate if the u object is something at all, since if you havnt logged in there isnt any value here. Example : // check if user logged in if(!$u-username){ // Not logged in, lets throw a header or something to send the user to login page } The best should be to look up the username from $u-username against your database to be sure that the username infact is valid. Final script page would be : ?php // start session session_start(); // Login, register session object if(($_GET[username]==thename) ($_GET[password]==thepass)){ $u-username=$_GET[username]; $u-password=$_GET[password]; session_register(u); } // check if user logged in if(!$u-username){ // Not logged in, lets throw a header or something to send the user to login page header(location: login.php); exit; } // The rest of page comes here ? This is a brief explernation which should give you what you need to get going on your session handling. You also might want to add more variables into the prosess, like IP, browseragent and such to prevent session hijacking from proxy servers, just to be on the secure side. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Robi [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I need some info about sessions in php, to clarify my knowledge and usage. So lets imagine that I am building a web site where I can log in and log off, it is without db. How do I use sessions, am I right use the start_session() and its a value to PHPSID as cookie, so if make link to another page I will check against phpsesid which is cookie against the id what I have in link?right? pls help troby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: session
You could do add an extra value/parameter to your session, lastactive. Each time you have some activity from the current session you update your database with a timestamp. This way you could easily delete everything from your database which is older that say 30 minutes. Having a session database which grows out of proportions is kinda waste of space. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Mrs [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi How can I check if speciffic session is alive having session id? Or how can I delete data from MySQL belong to dead session? (I hope somebody understend what I wrote) MrS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Carrying Variables
You could ofcourse also use sessions. If you need to store alot of values, this would be the way to go. If its only a couple of short ones, ofcourse some GET variables is the simplest and fastest way to go. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Ronald The Newbie Allen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] How would I carry a variable from one page to another Here is what I mean I have a send.php page and this is sent to insert_into_database.php where the values of the previous page are inserted into the database. I then use a meta=refresh to go to another page and evaluate the variable. The problem is that I do remember how to carry the variable. I believed that I used the meta before to carry it, but unsure. Any help would be appreciated! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reversing a string?
hehe, Reading the manual is somewhat not so bad after all... -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Robert Cummings [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Thu, 2004-05-13 at 17:27, Kristian Rasmussen wrote: Hi all, I need a script for reversing a string (hello world becomes dlrow olleh). I have tried the following: --- $length = strlen($i); $g = ; while ($length 0) { $g = $i[$length] . $g; $length--; } echo $g; The following will work: $length = strlen( $i ); $g = ; while( $length 0 ) { $g .= $i{--$length}; } echo $g; But in all honesty the following is superior: $g = strrev( $i ); echo $g; 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
[PHP] Re: Reversing a string?
Hehe, managed to do it on first try. This should do it : ?php $string = hello world; $length = strlen($string); if($length1){ $reversed = ; for($i=0;$i$length;$i++){ $reversed .= substr($string,$length-$i,1); echo substr($string,$length-$i,1) . br; } $reversed .= substr($string,0,1); echo substr($string,0,1) . br; echo $reversed; } else echo $string; ? I added some errochecking if the string is only 1 character, since there should be no use in running the for loop then. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Kristian Rasmussen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all, I need a script for reversing a string (hello world becomes dlrow olleh). I have tried the following: --- $length = strlen($i); $g = ; while ($length 0) { $g = $i[$length] . $g; $length--; } echo $g; --- With, obviously, no success. Is this the way or could array_reverse() somehow be used? Kristian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP graphing tool?
You will find a couple on phpclasses.org, also a few on sourceforge.net Some googling and youll find a few more. Ive been down the same road, finally youll see that accually there are no free ones usable for your project (atleast I had a real hard time finding some). There are some really great flash graphs out there, and the last year the pricing has dropped to a reasonable one aswell so you might aswell look at the comercial sollutions out there, they have become real good. Well, thats one day worth of work summed up for you in one handy little reply, :) -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Amanda Hemmerich [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is there a PHP tool or module out there that would be good for creating line or bar graphs? I'm looking for something I can pass numbers to and it will just graph those numbers. Any recommendations? Thanks! Amanda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] page_title
Is it me or is the sollution here incredible simple? ?php $page_title = Welcome; ? head title?=$page_title?/title -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- John W. Holmes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Erik Gjertsen wrote: head title/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body ?php $page_title = Welcome; Hmmm... you're title doesn't show up? Are you using sessions? Is safe_mode on or off? Is html_title_mode on or off in your php.ini file? -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Resequencing logic
Well, this is much the same as any CMS system where you are able to sort the contents by your own, in your case song titles. One way to solve this is by using form fields together with your listings so that you have some sort of link to the posts in your database. You also need a field in the database that keeps track of the sort. You also need abit of javascript. EG. ID, SONG TITLE, SORTER Lets have some data, 1, Limbo, 5 2, Bimbo, 6 3, Cimba, 1 This will be presented : Cimba (1) Limbo (5) Bimbo (6) When you print out the HTML I would include some hidden form fields for each item so that I know what to sort / move up / down. Eg. hidden name=data[item][$i] value=ID/ Cimba (hidden ID=3) hidden name=data[item][$i] value=ID/ Limbo (hidden ID=1) hidden name=data[item][$i] value=ID/ Bimbo (hidden ID=2) Each line would need some sort of javascript command, like javascript=moveup($i) Assign this moveup() variable to anything, eg. hidden name=check value=** so we can access it from PHP. Your javascript will then submit the form with ALL variables mentioned above. So do we now know? 1. We have a complete array of all the records from the HTML page in $_POST[data][item] 2. We also know what database ID each item has with the twin array $_POST[data][id] If we were to move something up, now we have a way of doing so, since : Say you entered moveup(2), which the javascript assigned the 2 to a variable check which we now know as $_POST[check]. Moving 2 (Which is 3 since we start counting from 0) we know that 2 is supposed to switch places with 1, meaning the SORTER will be switched. so we know the following : $data = $_POST[item]; $sourceID = $data[item][$_POST[check]]; $destinationID = $data[item][$_POST[check]-1]; The rest would be to do the SQL queries for the SORTER field, A=C, B=A, C=B meaning : tempA = select sorter from blabla wher id = source tempB = select sorter from blabla wher id = destination update blabla set sorter=destination where id = source update blabla set sorter=source where id = destination This was all abit quick'n'dirty as I call it, but I hope you got the general idea on how to do it. You need ofcourse alot more debugging and such for the final code (Like you cand moveUP the first row, since that would make the array go from 0 to -1 which doesnt make sence). -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Matt Grimm [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I apologize if this message is a repeat; I've had trouble posting with Thunderbird. I'm interested in how you folks would approach the following issue: You have a list of data, in a user-defined sequence. For instance, a list of song titles that can be rearranged on a web page in any order. I don't think I have the best grasp of the logic involved, and as such, the problem is a real pain for me. I use this approach: -If adding, records after or equal to the new (requested) spot are incremented -If moving up, records before the current spot and after or equal to the new spot are incremented -If moving down, records after the current spot and before or equal to the new spot are decremented -If deleting, records after or equal to the current spot are decremented Is there some MySQL or PHP function that will handle this sort of reordering business, or is there possibly a simpler logic I could use? Thanks, Matt [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: form submission logic
Well, I would include another hidden field and name it something like ACTION. I would also include a checkbox on every item you want to do something with like this : input type=checkbox name=item[] value=?=$databaseID? Then use javascript on your actions to set the action to whatever mode you need, for example delete. On the PHP side you get a very nice workflow now, as you will recieve an array on all the items which are selected and you can perform multiple tasks at once. Example, publish n articles in one go, or delete all at once. Remember to valiudate the $_POST[item] as an array! Remember, all the values in this array will be the onces you should $_POST[action]. Have fun! -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Aaron Wolski [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all, Was wondering if someone had any idea's on this logic and if it'd work, before I tried to implement it: Within the form/form tags I have my buttons - Publish, Unpublish, New, Edit and Delete. Next I have a table of that displays a list of records from a database with a checkbox to select a particular record. Once a record has been selected they click one of the top buttons to perform their desired action. WILL this work OR do the buttons HAVE to go at the bottom? Thanks! Any help is appreciated. Regards, Aaron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Website Architecture
Well if you really want to do it the perfect way, I would recommend using only one PHP file to generate the whole site. Or if you like, have one file with all the functions. You should also read into classess and create most of the functions as classess. To do the error handling there are many ways to go, but the best way would be to use output buffering. If an error occurs you can store the entire buffer if you like into a database and present an entire different page to the user informing that samoething went wrong. The old alternative is to present a 50/50 page with some error handling here and there. Its really all up to you, there isnt a perfect way in doing this. But my advice again, use classess (OOP) as its very reusable and look at output buffering for total control. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Paul Higgins [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all, I have a question regarding website design with PHP. Is it better to have a single PHP script produce different content or have a separate PHP script for every action. For example, if an error occurs, should I have the same PHP script produce an error page or have a separate PHP script produce the error page. I'm asking in reference to performance. Thanks! _ Is your PC infected? Get a FREE online computer virus scan from McAfee® Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Installing GD library
put the DLL file in your PHP DLL file directory, uncomment the line in php.ini referring to it. Restart apache if running, IIS doesnt need to be restarted. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Phpu [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I've downloaded the GD library. Can someone tell me how do i install it on a windows system? I found in internet a few articles but i don't quite understand. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: auto saving data in forms
Well shouldnt be a problem. Hook up an iframe on your page, use a javascript timer to send all data to the iframe every n seconds and submit the form inside the iframe. This will give the user a perfect workflow in the window he is working in, since the refreshing and such is done inside the iframe (which can be hidden), Sure you could use javaapplets and such, but there really shouldnt be any need for it. Surely such an autosave function shoudl use a temp database /table to store the data, just as word uses temp files for autosaves. Have fun! -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, i'm currently designing a website in which i have some forms with data saved in database. My customer wants that when he add or modify some datas in these forms, changes will be made immediately in database. I really don't know how to do it and don't know if it is possible. Is there anyone who have fijnd a solution to solve that problem and who can help me. I accept solutions in other langages than PHP like JAVA + XML. thanks, Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: form submission logic
I dont agree however, if your creating a system which should be user friendly I would absolutely demand from my users to have JS enabled. If they dont have JS enabled, then - well, to bad for them... We have created several web applications and have alot of customers (B2B), and they have all JS enabled. The friendslyness and functionality you can do with JS makes the total experience far better than not using JS. And you alse can save alot of reloading of the pages with confirmation dialogs and such. Anyway, its all a matter of opinion. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Torsten Roehr [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Kim Steinhaug [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Well, I would include another hidden field and name it something like ACTION. I would also include a checkbox on every item you want to do something with like this : input type=checkbox name=item[] value=?=$databaseID? Then use javascript on your actions to set the action to whatever mode you need, for example delete. On the PHP side you get a very nice workflow now, as you will recieve an array on all the items which are selected and you can perform multiple tasks at once. Example, publish n articles in one go, or delete all at once. I would not recommend using Javascript here because then you are reliant on the client having JS enabled. Just use different names for your submit buttons and then check them: if (isset($_POST['new'])) { ... } elseif (isset($_POST['delete'])) { ... } ...and so on Regards, Torsten Remember to valiudate the $_POST[item] as an array! Remember, all the values in this array will be the onces you should $_POST[action]. Have fun! -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Aaron Wolski [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all, Was wondering if someone had any idea's on this logic and if it'd work, before I tried to implement it: Within the form/form tags I have my buttons - Publish, Unpublish, New, Edit and Delete. Next I have a table of that displays a list of records from a database with a checkbox to select a particular record. Once a record has been selected they click one of the top buttons to perform their desired action. WILL this work OR do the buttons HAVE to go at the bottom? Thanks! Any help is appreciated. Regards, Aaron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Include from another URL?
You could always use this : $text = ; $fd=fopen($url,r); while ($line=fgets($fd,1000)) { $text.=$line; } fclose ($fd); echo $text; -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Nik [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi there, I'm new to these groups so forgive me if I'm asking at the wrong place (tell me where then :) Ok, I'm not PHP guru but I need to create a simple script that would do this: Include a content from another URL into the current output. I have done something like this: -- code start ?php include 'http://myotherurl.com:8080'; ? -- code end and it seems to work with one exception: it produces a warning message saying something like Warning: main(): stream does not support seeking in .../web-root/index.php on line 9 where line #9 is: include 'http://myotherurl.com:8080'; from above code. It then shows a message from 'http://myotherurl.com:8080' Thanks!!! Nik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: gifs, icons etc
At sourceforge you will find several icon paks available under different licenses. However if your software is proprietary you will have trouble using any of theese (Atleast the ones worth using). I myself have been searching the net for such but ended up doing the work myself. Atleast thats how my story went, :) -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Brent Clark [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all I would like to know if any body has a url for free some icons and, or small pics that can be used in a site \ page development. I was looking at a project call dotproject. And I noticed a lot of kewl small pics. I dont want to infringe on any licenses etc Kind Regards Brent Clark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] reversing an IF statement
Often I end up using a dumb IF statement which to me seems that it could have been done some other way. Example : if( ($_GET[id]==1) or ($_GET[mode]==home) or ((!isset($_GET[item])) ($_GET[mode]==news)) ) { // Here we do nothing } else { // This is where we do it } If we translate the above to simpler reading we could say : if(statement) // skip else // Do the stuff I'm ofcourse looking for this if(!statement) // Do the stuff Problem is, when using more statements I never seem to find the way of doing it without having an empty {} in it, dont know if you see my problem here however, its the best I can exmplain. For all I know it has to be like this. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Rporting tool - CVS?
Scenario : Im working on several large projects, all which have several users. Each user has a personal innstallation. Each of my projects are in constant development, and often the updates from version to version are only in a few files. Is there a tool out there who can compare two folders, and generate a report on what files are new, removed and updated? Usually I just upload all the project files all over, since all settings are in the database or settings file. But when projects have over 500 files, and you have 50 customers it would be nice to just upload the files which are updated. I have a feeling CVS would maby be the trick here, but im not sure. Still I could manually do this, it isnt that hard, but you know - maby there already is such a system out there and in that case it would fit me perfectly. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: function for backing up mysql
Take a look at phpclasses.org Last week there also came another class especially made for backups aswell if I recall. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Victor spång arthursson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi! Wonder if anyone knows if there somewhere out there are any good functions that streams out data from mysql as a sql-file, like phpmyadmin does? The best would be one which I told which database and which tables to dump, and which directly stared streaming the data Sincerely Victor= -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Read file backwards
Anyone have a script that reads a file backwards? Im looking for a way to trace a log file, say the last 30 lines each time I run the script. I havnt found any DOS tools so I guess doing it in PHP will be just as fine, and Im on a Win32 platform. I could however read the entire file, and count the files and show the last lines, but this wouldnt really read it backwards and would work very foolishly on large files I would think. If there isnt a way of doing this Ill have to do the above, but you never know. Ill google in the meantime. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Read file backwards
Got a tip by email, Might look here and modify it if needed ... http://tailforwin32.sourceforge.net/ Thanks, this is atleast much better than switching windows and refershing the files in Textpad which I do at the moment. tail was ofcourse the word I was looking for, not the trace word. Thanks for the tip, Kim Steinhaug Kim Steinhaug [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Anyone have a script that reads a file backwards? Im looking for a way to trace a log file, say the last 30 lines each time I run the script. I havnt found any DOS tools so I guess doing it in PHP will be just as fine, and Im on a Win32 platform. I could however read the entire file, and count the files and show the last lines, but this wouldnt really read it backwards and would work very foolishly on large files I would think. If there isnt a way of doing this Ill have to do the above, but you never know. Ill google in the meantime. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Extension problem
In other words you could say that if youd like the HTML files to be parsed as PHP files you would need to change the mapping on the server, eg. AddType application/x-httpd-php .php AddType application/x-httpd-php .html the second line would tell apache to run html files as php files. You could also, to do some sneaky things do this : AddType application/x-httpd-php .png or AddType application/x-httpd-php .myDocumentType Url . http://www.mydomain.com/index.myDopcumentType This can usually also be done in the .htaccess file, you need some googling for this as I dont recall the syntax. The PHP and HTML extension are nothing more than a way of cataloging / seperating the files. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Duncan Hill [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Monday 05 April 2004 10:37, Enrico Comini wrote: I use php without problem, but my file is processed by php only if the extension is .php , why ? If I have for example a index.html with ?php at the beginning , this file is not parsed by php and I have to rename in index.php Thanks, Enrico Apache (and other webservers) have a config option that maps file extensions to parsers (ie, .php to mod_php). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Weird variable issue encountered... help needed!
My first thought is that some dynamic code on this page has an error. Typical like this : input type=var value=?=$var?' ^^ Or maby a quote is missing? Looking at your examples it looks like there are different parts of the HTML code comming into your var, which would typically be the case with broken quotes. On the other hand it looked like there was a session ID aswell in there, but mainly I would run my code through the W3 validator just to double check. You could also, just in case check that the get_magic_quotes_gpc hasnt changed. There could also be some quotes in some variables messing up your code again. Going from magic_quotes to no_magic can be annoying - I did that experience with my database application some weeks ago... Hope this is of any help. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] This problem only seems to be happening on one of the virtual hosts on this system, and I cannot seem to figure out just what it is. I have a simple form posting to search.php, with a text input field, with a name of 'search'. And since this site is an internal site, register globals are on, as we are not worried about anyone misuing any of the variables in use. In any even, this problem was noticed about a week ago, and it did not exist before. After inputting some text into the search box, in this example, 'var', sans quotes, and i hit submit... on the next page, I am just having it return just $search for testing, and, it comes back sporadically with: 'var', but most of the time, it comes back with: var^!#ndda/form or var4194092d098240928d12ed or var#c0c0c0 or varput type=text etc. etc. it seems soemthing is somehow corrupting the variables, and I cannot seem to figure out what it might be. This has been working fine until about the past week, and I cannot think of any major changes that may have happened within the past week that could have caused this... and as I mentioned above, it only seems to be this one virtual host. And ai also compared with backups of all of y included files at the beginnings and ends of each script from before this problem started happening, and I can see no major changes in any of them. And, this is happening around all php scripts on the site... I am running 4.3.4, with apache 2, FreeBSD 4.8, and the data is all stored on a vinum partition. The server has been rebooted, a fresh install of php... tried setting output buffering on and flushing it at the end of the script(s), however, they seem to get hacked up when doing that, so I stay away from that band-aid fix...I am using sessions as well, as a few scripts within the site store session variables... and also using SMBAuth to do authentication from our domain controller... I've been pulling out my hair for 4 days straight on this issue, and I am all out of ideas, any help would be *GREATLY* appreciated! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Suddenly some errors are coming
1) Have your ISP upgraded PHP lately? 2) Are you including files from another server? Meaning, your on www.domain1.com including files from www.domain2.com? Ive encountered this problem earlier when 1) and 2) was the case. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Manisha Sathe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I am having a login page which goes to login process file. I have a include file which connects to database. Till now all was ok suddenly it started showing following --- Warning: main(): stream does not support seeking in /home2/www/members/login-px.php on line 6 This line is nothing but where i included my file for database connection. My client got very upset, i am also not understanding why suddenly this popped out when for last 6 months nothing was wrong. I did not change anything neither my client. I tested db connection separately - it is ok. Then what can be the problem? The environment is Apache / MySQL / Linux / PHP. Thanks in advance, regards manisha -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: web statistics
Hmm.. Several good sollutions out there, but if you are looking for some of the best you might look into Deepmetrix LiveStats. This has to be the best system Ive come across. http://www.deepmetrix.com/ Then again if money is a factor, you might look for other sollutions like aw-stats, which I would say gives the best presentation of the statistics from the availavle sollutions out there. http://awstats.sourceforge.net/ Regards, Kim Steinhaug www.steinhaug.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - På jakt etter en bra netbutikk løsning, som er på norsk ? http://www.easywebshop.no/ - Nettbutikk med krefter i massevis! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP alternative to Browser Hawk?
Well, youre probably looking for the full monty, all I got is this to help you out. Its only some detection schemes for the browser. There is another really cool browser detection available aswell from dynamicdrive.com developed by brothercake. This javascript is really good and is actively developed the last years so its nice and updated. ? // // SourceForge: Breaking Down the Barriers to Open Source Development // Copyright 1999-2000 (c) The SourceForge Crew // http://sourceforge.net // // $Id: tim2821.php3,v 1.2 2001/05/22 19:22:47 tim Exp $ unset ($BROWSER_AGENT); unset ($BROWSER_VER); unset ($BROWSER_PLATFORM); function browser_get_agent () { global $BROWSER_AGENT; return $BROWSER_AGENT; } function browser_get_version() { global $BROWSER_VER; return $BROWSER_VER; } function browser_get_platform() { global $BROWSER_PLATFORM; return $BROWSER_PLATFORM; } function browser_is_mac() { if (browser_get_platform()=='Mac') { return true; } else { return false; } } function browser_is_windows() { if (browser_get_platform()=='Win') { return true; } else { return false; } } function browser_is_ie() { if (browser_get_agent()=='IE') { return true; } else { return false; } } function browser_is_netscape() { if (browser_get_agent()=='MOZILLA') { return true; } else { return false; } } //echo $HTTP_USER_AGENT . br; if (ereg( 'Opera.([0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version)) { $BROWSER_VER=$log_version[1]; $BROWSER_AGENT='OPERA'; } else if (ereg( 'MSIE ([0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version)) { $BROWSER_VER=$log_version[1]; $BROWSER_AGENT='IE'; } elseif (ereg( 'Mozilla/([0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version)) { $BROWSER_VER=$log_version[1]; $BROWSER_AGENT='MOZILLA'; } else { $BROWSER_VER=0; $BROWSER_AGENT='OTHER'; } //echo $BROWSER_AGENT . br; if (strstr($HTTP_USER_AGENT,'Win')) { $BROWSER_PLATFORM='Win'; } else if (strstr($HTTP_USER_AGENT,'Mac')) { $BROWSER_PLATFORM='Mac'; } else if (strstr($HTTP_USER_AGENT,'Linux')) { $BROWSER_PLATFORM='Linux'; } else if (strstr($HTTP_USER_AGENT,'Unix')) { $BROWSER_PLATFORM='Unix'; } else { $BROWSER_PLATFORM='Other'; } //debug code echo br\n\nAgent: $HTTP_USER_AGENT; echo br\nIE: .browser_is_ie(); echo br\nMac: .browser_is_mac(); echo br\nWindows: .browser_is_windows(); echo br\nPlatform: .browser_get_platform(); echo br\nVersion: .browser_get_version(); echo br\nAgent: .browser_get_agent(); echo br; if (browser_get_agent()!=IE){ } if ((browser_get_version()5.5)(browser_get_agent()==IE)){ } if (browser_get_platform()==Mac){ } ? -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Zend Optimiser -- wide spread??
As other people mention here PHP Zend Optimizer is usually NOT installed on any systems unless they have encountered a customer which needed it. Were selling a shoppingcart system and *every* host were encountered did not have it installed. Another sollution comes up, since a lot of the hosting companies for some reason dont want to install this, IonCube. Purchasing this is much more affordable prize aswell. The IonCube loader however can be included and loaded at runtime, meaning you dont have to install anything on the server, :) I have yet to meet a server that doesnt support the runtime loader by default. You should check it out, www.ioncube.com -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Justin French [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all, I'm close to releasing my first widely distributed (I hope) PHP application, and I wish to protect the source with Zend Encoder. Seems easy enough. However, this is a low-cost app that was intended to work on basic installs of PHP, running on almost any server -- it uses no external libraries, and required no special compiles. Is Zend Optimiser (required to run encoded PHP files) part of a base installation, or at the very least, is it widely spread in use (available on most hosts)? Seems like there's no point encoding if only half of the servers out there can run the scripts. I know optimiser is available on *my* host, but that's not enough in this case! --- Justin French http://indent.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Comparing 2 files
Visit sourceforge and look for winmerge, a really excellent software that does just what you want. Thrust me - install this software and never look for anything else, :) Altleast if your on a windows environment. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Jens Schmeiser [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dear list. I want to compare two text files and print the differences. The text files contain the structure of a database, so they are very big (6000 lines). The file looks like that: TABLENAME#COLUMNNAME#DATATYPE#DATALENGTH#DATAPRECISION#NULLS ... I only check if the datatype and nulls are different. If so, then the two lines of the files will be printed. I tried to do that and it works excellent if there aren't many differences, but if there are many diffs, it takes time and time. What I do now is to read the to files to an array and get the differences with array_diff $array1=file('file1.txt'); $array2=file('file2.txt'); $result1 = array_diff($array1,$array2); $result2 = array_diff($array2,$array1); After that I do the following: foreach ($result1 as $line1) { foreach ($result2 as $line2) { // compare the two lines and show the differences; continue; } } Is there a better way to do that (and of course faster)? Regards Jens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problem uploading large files via PHP (20+ MB)
Im not completely sure, but have you gone throught the settings in the IIS server aswell? I know altleast for the CGI IIS has its own timeout which overrides the php.ini file. It could be something here aswell, but you probably have done this. Kim Steinhaug Schonrock III [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] All, I am attempting to upload a large file via PHP to a web server running Windows XP Pro IIS 5.1 and I am having some problems. I have been trying to find the right combination of settings in the php.ini file and elsewhere to get large files to upload properly, but I keep getting a DNS error in Internet Explorer 6 that shows up after about 12MB or 12.5MB of a 21.7MB file has been transferred. When I looked at the IIS website connection timeout it was set at 900 seconds. I have tried many different variations in the php.ini settings file with little success. I have tried using the 8M format and also the full out Byte count for size fields in the php.ini file. I can upload files that are smaller that 10 MB (I tested with one that was 9MB earlier) with no problem. Here are my most recent relevant settings in my php.ini file (that I know of): max_execution_time = 3600 max_input_time = 3600 memory_limit = 104857600 post_max_size = 104857600 upload_max_filesize = 104857600 Does anyone have any ideas? Am I missing something else? If you need any more information that I left out please let me know. My code for the php files is located below this message. Any help is greatly appreciated! Thanks, Keith -Sending php file: html body center bThis is a test document/b p form enctype=multipart/form-data action=upload2.php method=post Send this file: input name=userfile type=file / input type=submit value=Send File / /form /body /html -Receiving php file: html body ?php $uploaddir = 'c:\\new\\out\\'; $uploadfile = $uploaddir . $_FILES['userfile']['name']; print pre; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { print File is valid, and was successfully uploaded. ; print Here's some more debugging info:\n; print_r($_FILES); } else { print Possible file upload attack! Here's some debugging info:\n; print_r($_FILES); } print /pre; ? /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pspell Functions!! problem I explain in English
Hello, I completed the innstallation for the PSPELL on my Windows2000 on Apache. What you need to do is : 1. Download the win32 port from aspell.net 2. Download the dictionaries you need 3. Install the win32 port 4. Install the dictionaries 5. Edit the php.ini and comment out the extension=php_pspell.dll (Be sure its present in your extension directory!) 6. Copy the Aspell .dll's into your system32 folder. 7. Restart Apache Now your PSPELL should be working, however you probably end up with another problem. You cant load the dictionaries... Ive spent like 4 hours now on the topic without any sollutions, it just seems that the pspell dll doesnt work well on windows. However another user at the php site on a winXP SP1 has made it work, atleast he states such. I havnt heard or found any users on the net that confirms this, so Im not convinced. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Antonio J. Hdez. Blanco [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi Adams, Reading the manual[1] on pspell I notice at the top it says this function is not supported in windows. I have read the manual several times, and also usr contributed notes where Elizabeth, explains the installation in w2k. I does she explained, but no work. However if you really do have a pspell library for windows that somehow came with 4.3.3 and isn't working with 4.3.4 you may be able to change your php.ini file to load the extension[2] but I doubt it. But the problem persists, since comprobe the dinamic load by means of the function print_r(get_loaded_extensions()); and it shows that library php_pspell.dll is loaded, and this to me means that php.ini this good. By that as is not the problem, if continuous will prove in * nix. thank you very much antonio, PD: you said the very TRUE We may not speak many languages but the php manual does :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Request domain name
Try this one : $_SERVER[HTTP_HOST] It will do the trick for you, it will give you the root domain in the URI of your browser. -- -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Age Bosma [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I would like to be able to request the domain name. How can this be achieved without hardcoding it? $_SERVER['REQUEST_URI'] doesn't provide me the domain name, it just provides me /index.php?page=2000 instead of e.g. www.blaat.com/index.php?page=2000 I can't seem to find anything on the php site to get the domain name as well. I prefer using absolute URI's. The reason why this is a problem for me is besause I'm working on a site which has two different URI's but both display the exact same site. Cheers, Age Bosma -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: replace ' with
Depending on the use you might also want to look at this one : htmlentities() If working with mySQL inserts consider this aswell : mysql_escape_string() And finally, javascripts in HTML doesnt like either the ' or the equivilant htmlentities. I just wash them away direkt if i need to output something into a javascript statement, eg. a href=javascript: dome('typicaltext'); The above example caused me alot of headaches when the text inside ' contained either ' or , and even the entities also messed up. -- Kim Steinhaug -- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. -- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com -- Diana Castillo [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] How do I replace all single quotes with double quotes in a string for echoing it with the double quotes? -- Diana Castillo Global Reservas, S.L. C/Granvia 22 dcdo 4-dcha 28013 Madrid-Spain Tel : 00-34-913604039 ext 214 Fax : 00-34-915228673 email: [EMAIL PROTECTED] Web : http://www.hotelkey.com http://www.destinia.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sort multidimensional array - ARGH!
I have been messing around now for some hours and Im going mad! Im pulling some heavy data from mySQL with count and grouping, after this I have to calculate som values and then sort the outcome. Therefore Im not able to let mySQL do the accuall sort. So i stuff it into an array, and I need to sort the array and thats where the problem occures. 1. I declare an array : $stats_unsorted = array(); for loop start ... 1. fetch mySQL data 2. calculate values array_push($stats_unsorted,$sum,$user); // Eks. array_push($stats_unsorted,10,Ola); // Eks. array_push($stats_unsorted,-5,Kaare); // Eks. array_push($stats_unsorted,203,Nils); // Eks. array_push($stats_unsorted,-20,Lars); for loop end ... We now have, e.g. this : Array ( [0] = Array ( [0] = 10 [1] = Ola ) [1] = Array ( [0] = -5 [1] = Kaare ) [2] = Array ( [0] = 203 [1] = Nils ) [3] = Array ( [0] = -20 [1] = Tone ) ) - - - - - - - - - - - - - - - - - - - - Then comes the sorting part, I want to sort by this : $stats_unsorted[x][0] meaning the numbers, ofcourse I would surely like to know how to sort by the names aswell, $stats_unsorted[x][1], but I would think that is easy if I could figure out the main command to sort this in the first place. Ive tried several times with array_multisort(); but I cant get this to work, :( Help would be appretiated! $stats_SORTED = ???; Thanks in advance! -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Sort multidimensional array - ARGH!
OK, typically when finally biting the dust and asking for help the answer comes falling down from above... I figured out that a simple : sort($stats_unsorted); This would infact sort the first field of the subarrays. This would mean by throwing the results back and forth between several arrays I would in the end be able to sort whatever I would need. I could also insert back into the SQL and sort it by a select statement, but I feel Arrays are there for a reason, and there should not be any reason to bother the SQL for such a trivial thing as sorting. If any of you have another sollution I would sure love to know it, since my array infact is multidimensional, and the sort() isnt, though it for some reason solved the problem aslong as Im sorting the first field. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I protect downloadable files?
I would go for the 3rd alternative. There are several ways to stream the file with the use of headers. This way you can validate the user securely with your logon system, and you can place the files outside the viewable web content. Typically oputside your www / public_html folder. I use this myself in an application I use, streaming files at 50MB does not use alot of resources at all, atleast not the way I use. My use for the script is to serve high resolution images to several customers, often TIF images up to 50MB and larger. Heres the code I use : $distribution= filepathonserver; if ($fd = fopen ($distribution, r)){ $size=filesize($distribution); $fname = basename ($distribution); header(Pragma: ); header(Cache-Control: ); header(Content-type: application/octet-stream); header(Content-Disposition: attachment; filename=\.$fname.\); header(Content-length: $size); while(!feof($fd)) { $buffer = fread($fd, 2048); print $buffer; } fclose ($fd); exit; } -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Apz [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tue, 30 Dec 2003, news.php.net wrote: Creating unique symlinks would be easier but my development machine is Windows and my server is FreeBSD and I can't create file links under Windows. Plus, my FreeBSD server is not near me so remote development is difficult. 1) windows has symlinks since win2000, however they are named Junctions. I would recommend visiting sysinternals.com and getting junctions tool (win2k/xp/2k3 - miscalenous). Hey, it even comes with source! 2) another way is to make a redirect, so you do: getFile.php?file=something.zip and in your code you do: ? include _mylibs.php if (userLoggedIn()) header Location: .$_REQUEST[file]; else echo Only Valid People Can Login; ? 3) final way is to pass through the file yourself. Safest way, but potentially more resource hungry than the two above in your code you do: ? include _mylibs.php if (userLoggedIn()) { header(Content-type: application/octet-stream); header(Content-Disposition: attachment; . filename=.$_REQUEST[file]); readfile($_REQUEST[file]); } else echo Only Valid People Can Login; ? recommended reads: http://www.php.net/manual/en/function.header.php further recommended things to checkout: freshmeat , and search for anti leecher scripts. /apz, bringing joy to the world -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I protect downloadable files?
However I forgot to mention, all theese header tricks are real swell indeed, but you should get hold of a friend on a macintosh. The method I use doesnt work on the macintosh, so for the mac users we just serve the files as is, meaning they accually dont get protected... The other methods aswell should be tested on macintosh systems just to be sure. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Kim Steinhaug [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I would go for the 3rd alternative. There are several ways to stream the file with the use of headers. This way you can validate the user securely with your logon system, and you can place the files outside the viewable web content. Typically oputside your www / public_html folder. I use this myself in an application I use, streaming files at 50MB does not use alot of resources at all, atleast not the way I use. My use for the script is to serve high resolution images to several customers, often TIF images up to 50MB and larger. Heres the code I use : $distribution= filepathonserver; if ($fd = fopen ($distribution, r)){ $size=filesize($distribution); $fname = basename ($distribution); header(Pragma: ); header(Cache-Control: ); header(Content-type: application/octet-stream); header(Content-Disposition: attachment; filename=\.$fname.\); header(Content-length: $size); while(!feof($fd)) { $buffer = fread($fd, 2048); print $buffer; } fclose ($fd); exit; } -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Apz [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tue, 30 Dec 2003, news.php.net wrote: Creating unique symlinks would be easier but my development machine is Windows and my server is FreeBSD and I can't create file links under Windows. Plus, my FreeBSD server is not near me so remote development is difficult. 1) windows has symlinks since win2000, however they are named Junctions. I would recommend visiting sysinternals.com and getting junctions tool (win2k/xp/2k3 - miscalenous). Hey, it even comes with source! 2) another way is to make a redirect, so you do: getFile.php?file=something.zip and in your code you do: ? include _mylibs.php if (userLoggedIn()) header Location: .$_REQUEST[file]; else echo Only Valid People Can Login; ? 3) final way is to pass through the file yourself. Safest way, but potentially more resource hungry than the two above in your code you do: ? include _mylibs.php if (userLoggedIn()) { header(Content-type: application/octet-stream); header(Content-Disposition: attachment; . filename=.$_REQUEST[file]); readfile($_REQUEST[file]); } else echo Only Valid People Can Login; ? recommended reads: http://www.php.net/manual/en/function.header.php further recommended things to checkout: freshmeat , and search for anti leecher scripts. /apz, bringing joy to the world -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Selecting between using letters
Im on my way to bed so short do it yourself answer, but you should look up the regex part of mySQL. I think you can match the beginning and end of a coloumns entry. And using the power of the regex function you could make a WHERE statement for somethink like [a-e] if it was a-e you were looking for. Remember ofcourse that you wuld need to use the regex syntax. The page on mySQL covering the topic has a lot of examples. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Doug Parker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] How would I create a select statement in MySQL that would return a range of records from the LastName field where the value starts with a designated letter - for example, returning the range where the first letter of LastName is between A and E... Any help would be greatly appreciated. http://www.phreshdesign.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: sql query and some math
Your first query, could it be that you dont have any reference between the two tables? You should have a link between them, like where t1.id=t2id Or else you do not have any reasonable way of predicting the outcome of the query. Atleast this is what I know from my own experience. Especially if t2 has more entries for each entry in t1, your query will result in unpredictable manner. Hope this helps. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Patrik Fomin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, q1) i got a database with 2 diffrent tables, i want to take out all the information that arent duplicated from on of the tables, like this: $sql = SELECT t1.rubrik, t1.info, t2.priser FROM table1 AS t1, table2 AS t2 WHERE t1.arkiv = '0' ORDER BY t1.rubrik; the problem is that i got alot of duplicates (its for another purpose), so i need to filter out the duplicates in the rubrik field to get just one match each, like: id - rubrik - info 0 - - some info 1 - - some info 2 - - some info 3 - - some info 4 - - some info would print out 0 - - some info 1 - - some info 2 - - some info 3 - - some info q2) i got like 100 matches from a database into a $num variable, then i want to devide that by 3 aslong as it can be done, eg: while ($num != 0) { ïf ($num / 3 = true){ some code to display some fields from a database $num = $num - 3; } else { some other code to display $num = 0; } } basicly i want the if statement to check if its more then 3 posts left to print out, if not its gonna print out the remaining last 1 - 2 post in a diffrent way (for the looks) regards patrick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Opening large file problem - fopen
I found that the script accually breaks on this line : [Mon Jul 14 12:17:26 2003] [error] PHP Notice: INSERT INTO tbl_news (band_id, date, heading,heading_eng, ingress,ingress_eng, body,body_eng) VALUES (-1,2003-07-14,TESTAMENT endelig til Norge!!!, Spiller p Rock in - spesial treat for the fans!, , , Testament + support spiller pe Rock In onsdag 30.juli. Grunnet opptatte strre spillesteder ensket Testament likevel gj/re Norge, med en kveld dedikert til fansen som har mttet vente pt Norgesbesket i su mange r.. Rock In blir garantert utsolgt, sr her er det bare hamstre billett ss fort s mulig!! Billetter pl billettservice/posten Bill.pris 250,-+avg. - Drene cpner 19.00,) in /home/xxx/public_html/admin/news_send.php on line 27 [Mon Jul 14 12:17:26 2003] [error] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/xxx/public_html/admin/news_send.php:2) in /home/pilotman/public_html/admin/news_send.php on line 34 --- Hope this helpls. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Kim Steinhaug [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello Im having real problems working with large files in PHP. At the moment Im trying to parse an error_log file, and it works like a charm, except that the scipt stopps after parsing around 70.000 lines, or around 8MB of data. Im using this : $file= error_log; // 280MB file if($fp=fopen($file, r+)) { while($line=trim(fgets($fp))) { // Do the business } } Surely this is not the way to work with e.g. a 280MB file. I solved the sollution by chopping the file into 7MB files, and adding a fileopen loop around the script above which solves my problem. But - How do I parse the 280MB file all in 1 go? I have plenty of timeout and plenty of RAM in the php.ini file, so the problem isnt here. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Opening large file problem - fopen
I found out that what the script accually does is choke on \n\n, empty lines. I havnt found a way to solve this with the script, What I do now is use TextPad and just replace all occurencies of \n\n with \n-\n or something and it works all nice. But this is a bad way of doing it, since the script still doesnt accually work... -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Kim Steinhaug [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I found that the script accually breaks on this line : [Mon Jul 14 12:17:26 2003] [error] PHP Notice: INSERT INTO tbl_news (band_id, date, heading,heading_eng, ingress,ingress_eng, body,body_eng) VALUES (-1,2003-07-14,TESTAMENT endelig til Norge!!!, Spiller p Rock in - spesial treat for the fans!, , , Testament + support spiller pe Rock In onsdag 30.juli. Grunnet opptatte strre spillesteder ensket Testament likevel gj/re Norge, med en kveld dedikert til fansen som har mttet vente pt Norgesbesket i su mange r.. Rock In blir garantert utsolgt, sr her er det bare hamstre billett ss fort s mulig!! Billetter pl billettservice/posten Bill.pris 250,-+avg. - Drene cpner 19.00,) in /home/xxx/public_html/admin/news_send.php on line 27 [Mon Jul 14 12:17:26 2003] [error] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/xxx/public_html/admin/news_send.php:2) in /home/pilotman/public_html/admin/news_send.php on line 34 --- Hope this helpls. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Kim Steinhaug [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello Im having real problems working with large files in PHP. At the moment Im trying to parse an error_log file, and it works like a charm, except that the scipt stopps after parsing around 70.000 lines, or around 8MB of data. Im using this : $file= error_log; // 280MB file if($fp=fopen($file, r+)) { while($line=trim(fgets($fp))) { // Do the business } } Surely this is not the way to work with e.g. a 280MB file. I solved the sollution by chopping the file into 7MB files, and adding a fileopen loop around the script above which solves my problem. But - How do I parse the 280MB file all in 1 go? I have plenty of timeout and plenty of RAM in the php.ini file, so the problem isnt here. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Opening large file problem - fopen
Hello, Thanks for you reply. The first approach works, I succesfully imported 1.903.541 entries into my mySQL database, phew! Problem was that as mentioned I had to massage the data beforehand, which with TextPad didnt take to much time but again I love my scripts to be complete and be standalone. Back to the 2) option, I tried another approach, just to see how far the script woul accually go. There are ~2,1 million lines in the error_log so I would like to see a result for the $i in this range. But this script also chokes. $file= error_log; $handle = fopen ($file, rb); $contents = ; do { $data = fread($handle, 8192); if (strlen($data) == 0) { break; } $contents = $data; $temp = explode(\n,$contents); $i = $i + count($temp); if($i%1000==0) // Spit out every 1000 lines count echo $i . br; } while(true); fclose ($handle); echo $count; exit; Do you have an example, or link to a site discussing the issue, of buffering the data? -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Eugene Lee [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tue, Dec 16, 2003 at 01:30:14PM +0100, Kim Steinhaug wrote: : : I found out that what the script accually does is choke on \n\n, : empty lines. I havnt found a way to solve this with the script, : : What I do now is use TextPad and just replace all occurencies : of \n\n with \n-\n or something and it works all nice. But this : is a bad way of doing it, since the script still doesnt accually work... You have two options: 1) massage your data beforehand so that your script works properly 2) buffer your input lines so that you process them only after you have read a complete entry, since one entry may span multiple lines in your error_log. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Opening large file problem - fopen
Attached is a little textfile on 4 lines, it will choke afte 1 line due to the \n\n problem. I use this loop to parse it : $file= error_log.txt; if($fp=fopen($file, r+)) { while($line=trim(fgets($fp))) { echo $line . br; } } -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Kim Steinhaug [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, Thanks for you reply. The first approach works, I succesfully imported 1.903.541 entries into my mySQL database, phew! Problem was that as mentioned I had to massage the data beforehand, which with TextPad didnt take to much time but again I love my scripts to be complete and be standalone. Back to the 2) option, I tried another approach, just to see how far the script woul accually go. There are ~2,1 million lines in the error_log so I would like to see a result for the $i in this range. But this script also chokes. $file= error_log; $handle = fopen ($file, rb); $contents = ; do { $data = fread($handle, 8192); if (strlen($data) == 0) { break; } $contents = $data; $temp = explode(\n,$contents); $i = $i + count($temp); if($i%1000==0) // Spit out every 1000 lines count echo $i . br; } while(true); fclose ($handle); echo $count; exit; Do you have an example, or link to a site discussing the issue, of buffering the data? -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Eugene Lee [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tue, Dec 16, 2003 at 01:30:14PM +0100, Kim Steinhaug wrote: : : I found out that what the script accually does is choke on \n\n, : empty lines. I havnt found a way to solve this with the script, : : What I do now is use TextPad and just replace all occurencies : of \n\n with \n-\n or something and it works all nice. But this : is a bad way of doing it, since the script still doesnt accually work... You have two options: 1) massage your data beforehand so that your script works properly 2) buffer your input lines so that you process them only after you have read a complete entry, since one entry may span multiple lines in your error_log. begin 666 error_log.txt M6U-U;B!*=6P@(#8@,34Z,3Z-30@,C P,[EMAIL PROTECTED]FY=($YA;656:7)T=6%L M2]S= V,BXW,XP+C$P-SHX,!H87,@;[EMAIL PROTECTED]'5A;$AOW1S#0I;4W5N M($IU; @-B Q-3HQ-SHU- R,# S72!;=V%R;[EMAIL PROTECTED]G1U86Q(;W-T M(#8R+CP+C [EMAIL PROTECTED] @:%S(YO(%9IG1U86Q(;W-TPT*6U-U;B!*=6P@ M(#8@,34Z,3Z-30@,C P,[EMAIL PROTECTED][EMAIL PROTECTED],RXR-R H56YI MD@;6]D7V)W;EM:71E9\Q+C @;6]D7VQO9U]B71ER\Q+C(@4$A0+S0N M,RXR($9R;VYT4%G92\U+C N,BXR-3$P(UO9%]SVPO,BXX+C$T($]P96Y3 M4TPO,XY+C9B(-O;[EMAIL PROTECTED]@F5S=6UI;F@;F]R;6%L(]P97)A M=EO;G,-[EMAIL PROTECTED]( V(#$U.C$W.C4T(#(P,#-=(%MN;W1I8V5=('-U M15A%0R!M96-H86YI[EMAIL PROTECTED] H=W)A'!E[EMAIL PROTECTED]B]L;V-A;]A M%C:4O8FEN+W-U97AE8RD-[EMAIL PROTECTED]( V(#$U.C$W.C4T(#(P,#-= M(%MN;W1I8V5=($%C8V5P=!M=71E#H@WES=G-E;2 H15F875L=#H@WES M=G-E;2D-[EMAIL PROTECTED]( V(#$U.C(P.C4Y(#(P,#-=(%MEG)O[EMAIL PROTECTED] M:65N= Q.30N,C,P+C(T-2XQ,C1=($9I;[EMAIL PROTECTED]]ER!N;[EMAIL PROTECTED]W0Z(]H M;VUE+W!R;VUE]P=6)L:6-?:'1M;]%;6%I;$-A;7!A:6=N+TQA6]U=%\P M,2YJ-[EMAIL PROTECTED]( V(#$U.C(P.C4Y(#(P,#-=(%MEG)O[EMAIL PROTECTED] M:65N= Q.30N,C,P+C(T-2XQ,C1=($9I;[EMAIL PROTECTED]]ER!N;[EMAIL PROTECTED]W0Z(]H M;VUE+W!R;VUE]P=6)L:6-?:'1M;\T,#0NVAT;6P-[EMAIL PROTECTED]( V M(#$U.C(P.C4Y(#(P,#-=(%MEG)O[EMAIL PROTECTED]:65N= Q.30N,C,P+C(T-2XQ M,C1=($9I;[EMAIL PROTECTED]]ER!N;[EMAIL PROTECTED]W0Z(]H;VUE+W!R;VUE]P=6)L:6-? M:'1M;]%;6%I;$-A;7!A:6=N+TQA6]U=%\P,BYJ-[EMAIL PROTECTED]( V M(#$U.C(P.C4Y(#(P,#-=(%MEG)O[EMAIL PROTECTED]:65N= Q.30N,C,P+C(T-2XQ M,C1=($9I;[EMAIL PROTECTED]]ER!N;[EMAIL PROTECTED]W0Z(]H;VUE+W!R;VUE]P=6)L:6-? M:'1M;\T,#0NVAT;6P-[EMAIL PROTECTED]( V(#$U.C(P.C4Y(#(P,#-=(%ME MG)O[EMAIL PROTECTED]:65N= Q.30N,C,P+C(T-2XQ,C1=($9I;[EMAIL PROTECTED]]ER!N;W0@ M97AIW0Z(]H;VUE+W!R;VUE]P=6)L:6-?:'1M;]%;6%I;$-A;7!A:6=N [EMAIL PROTECTED]@N:G!G#0I;4W5N($IU; @-B Q-3HR,#HU.2 R,# S72!;97)R;W)= M(%MC;EE;G0@,3DT+C(S,XR-#4N,3(T72!:6QE(1O97,@;F]T(5X:7-T M.B O:]M92]P[EMAIL PROTECTED]'5B;EC7VAT;6PO-# T+G-H=UL#0I;4W5N($IU M; @-B Q-3HR,#HU.2 R,# S72!;97)R;W)=(%MC;EE;G0@,3DT+C(S,XR M-#4N,3(T72!0F5M871U[EMAIL PROTECTED](]F('-CFEP=!H96%D97)S.B O:]M M92]P[EMAIL PROTECTED]'5B;EC7VAT;6PO8V=I+6)I;B]E;6%I;$-A;7!A:6=N+V5M M86EL=FEE=RYC9VD-[EMAIL PROTECTED]( V(#$U.C(P.C4Y(#(P,#-=(%MEG)O M[EMAIL PROTECTED]:65N= Q.30N,C,P+C(T-2XQ,C1=($9I;[EMAIL PROTECTED]]ER!N;[EMAIL PROTECTED] MW0Z(]H;VUE+W!R;VUE]P=6)L:6-?:'1M;\U,# NVAT;6P-EM3=6X@ M2G5L( V(#$U.C(P.C4Y(#(P,#-=(%MEG)O
[PHP] racing NO domain names problems! (For nordmenn!)
To solve this problem you need a norwegian keyboard so I might aswell type the whole question in norwegian, sorry gyez! --- Jeg har støtt på noen problemer når det gjelder å konvertere domenenavn mot Norids egen ACE konverter. Jeg har prøvd med både POST metoder og GET metoder men resultatet blir uansett det samme. Jeg sender en henvendelse til Norids side, og ønsker å parse resultatet, problemet er bare at Norids side nekter å godta selve bokstavene æøå av en eller annen grunn. En metode er eks. ? $page ='http://www.norid.no/domenenavnbaser/ace/?action=Convertname=blåbær.no'; $fd=fopen($page,r); while ($line=fgets($fd,1000)) { echo $line; } fclose ($fd); ? Som du ser på det som kommer ut godtaes ikke ÆØÅ. Jeg har prøvd å sende blåbær som bl%E5b%E6r.no men samme problem. Jeg tenkte kanskje det er en begrensning med GET eller at de har lagt inn en sperre på GET for å bare bruke POST, men den gang ei. POST med sockets gir samme resultat, uanhengig om man benytter å eller %E5. Blir POST data kodet annerledes en GET data, altså å=%E5? -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] racing NO domain names problems! (For nordmenn!)
Finally! The answer was this : $url = utf8_encode('http://www.norid.no/domenenavnbaser/ace/?action=Convertname=bl åbær.no'); And it all finally works, :) -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Stig Venaas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tue, Dec 16, 2003 at 07:30:09PM +0100, Kim Steinhaug wrote: To solve this problem you need a norwegian keyboard so I Nah, you can just cut and paste (: might aswell type the whole question in norwegian, sorry gyez! --- Jeg har støtt på noen problemer når det gjelder å konvertere domenenavn mot Norids egen ACE konverter. Jeg har prøvd med både POST metoder og GET metoder men resultatet blir uansett det samme. Jeg sender en henvendelse til Norids side, og ønsker å parse resultatet, problemet er bare at Norids side nekter å godta selve bokstavene æøå av en eller annen grunn. En metode er eks. ? $page ='http://www.norid.no/domenenavnbaser/ace/?action=Convertname=blåbær.no'; $fd=fopen($page,r); while ($line=fgets($fd,1000)) { echo $line; } fclose ($fd); ? Som du ser på det som kommer ut godtaes ikke ÆØÅ. Jeg har prøvd å sende blåbær som bl%E5b%E6r.no men samme problem. Jeg tenkte kanskje det er en begrensning med GET eller at de har lagt inn en sperre på GET for å bare bruke POST, men den gang ei. POST med sockets gir samme resultat, uanhengig om man benytter å eller %E5. Blir POST data kodet annerledes en GET data, altså å=%E5? In the document with the form, it says: form method=post action=/domenenavnbaser/ace/ enctype=application/x-www-form-urlencoded so I guess it will work if you use this encoding. But the document is also in UTF-8, so you may have to do UTF-8 encoding first and then URL encode that perhaps. It works with e.g. mozilla, I guess you could also try to see what exactly it sends. Someone non-Norwegian might have suggestions regardig UTF-8 documents and URL-encoding. I think browser sends post data with same charset as the main document... Stig -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Opening large file problem - fopen
Hello Im having real problems working with large files in PHP. At the moment Im trying to parse an error_log file, and it works like a charm, except that the scipt stopps after parsing around 70.000 lines, or around 8MB of data. Im using this : $file= error_log; // 280MB file if($fp=fopen($file, r+)) { while($line=trim(fgets($fp))) { // Do the business } } Surely this is not the way to work with e.g. a 280MB file. I solved the sollution by chopping the file into 7MB files, and adding a fileopen loop around the script above which solves my problem. But - How do I parse the 280MB file all in 1 go? I have plenty of timeout and plenty of RAM in the php.ini file, so the problem isnt here. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Dealing with large classes over several files
umm... It all looks good except this one : function foo::f () This is where you get the T_ error. Dont know what you are trying to do here, but thats the error anyways, :) Your first example is all correct, // myclass.inc.php class foo { // constructor and destructor function f () {} } Dont know if it helps you though. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Callum Urquhart [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] This may well have come up before as it is an obvious problem/question. Coming from a C++ background, I define a class in a header file and define the functions for that class in a seperate source file. Now the question: is this possible in PHP4? I have tried the obvious: // myclass.inc.php class foo { // constructor and destructor function f () {} } // myclass.php function foo::f () { // define here } This gives me an error: unexpected T_PAAMAYIM_NEKUDOTAYIM Is this possible in PHP4, and if not, why not? It's an obvious problem, namely for code management. -Callum Urquhart www.pastecode.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Upload issue - The 2MB barrier...
As the default setting for file upload is set to 2MB, we usually get a problem since we cant always access the php.ini on every server our scripts should be run from. After looking in the php.ini file on one of my webhosting partners I noticed an interesting (in my opinion) thing with the post settings which read : (And to make it clear, I could easilly change the php.ini file, but due to the other clients on this webserver I cant... Im not alone here ) post_max_size = 55M Since the other setting would easilly accept say 5 MB I wonder, would it be possible to upload an image as a POST? Or something like this? Maby this is a pointless idea to investigate further ? -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upload issue - The 2MB barrier...
Hmm 1. We can rule out the ini_set() 2. We can now rule out the .htaccess Tried the following : .htaccess php_value upload_max_filesize 5M testfile.php print 'upload_max_filesize = ' . ini_get('upload_max_filesize') . \n; The testfile succesfully states the new value, but it doesnt work. Obviously, the documentation on php.net already told me so, so the fact that I really tested this is kinda stupid... hehe. That leaves me with the httpd.conf settings which is supposed to work, also according to the PHP documentation. Just need to locate this file first... -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Richard Davey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello Kim, Tuesday, December 2, 2003, 12:34:22 PM, you wrote: KS As the default setting for file upload is set to 2MB, we usually get KS a problem since we cant always access the php.ini on every server KS our scripts should be run from. Can you modify the httpd.conf for your site? If so you can over-ride the upload_max_filesize setting in that without messing up any other user on the server. -- Best regards, Richardmailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upload issue - The 2MB barrier...
I found the file, but since im on a Cpanel server I do have to do some checking with the admin so that I dont mess up for other users. I wouldnt want my experimenting resulting in an unstable server for other users, :) It looks like this is the only way to alter the settings. Thanks for replies. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Marek Kilimajer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Kim Steinhaug wrote: That leaves me with the httpd.conf settings which is supposed to work, also according to the PHP documentation. Just need to locate this file first... $ locate httpd.conf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: House for rent - Good price
Fix your clock! Post like theese really screws up the layout in my newsreader! -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- O J P P [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello all mailing list, House for rent - Good price, :), bye. URL : http://www.geocities.com/rapogo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Translate web site language
Fix your clock! Post like theese really screws up the layout in my newsreader! -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Orlando Pozo [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I think that PHP have libraries to translate one language into another, if you have information about it, please, give me a hand, thanks, bye. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Associative vs normal arrays
Fix your clock! Post like theese really screws up the layout in my newsreader! -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Joe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is there a way to determine if an array is associative or not? Maybe something similar to the is_array() function ?? Thanks, JOE -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] The clock issue in this forum!
Im using Outlook Express reading theese messages and I think the newsreader works just fine. But what do I do when theese people post with wrong dates. Is there any way in Outlook Express I can remove theese posts, or do I have to see them topping the list every time I check the lists? Ive tried several ways now, but I cant seem to fix them. Any help would be appritiated? Maby I should change newsreader? -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Print..
Fix your clock! Post like theese really screws up the layout in my newsreader! -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Daniel Antonio De Lima [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Good Morning I am working with PHP 4.0.6, and I do not obtain to send given of the page for the printer. I use function PRINTER_OPEN() , I make the manual in accordance with, exactly thus it gives an error to me of indefinite function. What it can be? Fatal error: Call you undefined function:printer_open() $print = printer_open(); $print = printer_open(LPT1 ); printer_write($print, Test of printer ); printer_write($print, Test of printer ); printer_write($print, Test of printer ); $print = printer_close(); e this error it even gives to me with function PRINTER_WRITE() , could give tips of that he can be happening. Yours truly. Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Count online users question
Cookies, or browsersession. I found the latter to be very easy to work with. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Al [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I am trying to figure an accurate way to calculate how many users are viewing a site, at any particular time. This task is very simple except for one part - How do you determine when a person has left the site...apache hasn't served anymore requests from a particular ip for xx minutes ?? Hi Mike, There is no surefire way to measure the exact time a user leaves your site. The most accurate way I can think of would be to use a hidden frame on all your pages that refreshes itself every X seconds. When a user has not requested that special tracking page for more than X seconds, you can assume they have 'left' the site. However this solution seems like overkill for most purposes: you'll be wasitng server resources and slowing down your users' experience on your site. In response to your proposed method, most advertising associations (including the US-based Internet Advertising Bureau) and web analytics companies (such as Red Sherrif, Nielsens and Hitwise) define the end of a user session on a website when there is 30 minutes without a further request for a page from the site. And while you may be tempted to track only IP numbers, remember that many users are behind shared IP numbers (e.g. firewalls) which may skew your stats. You would be better off using cookies on user's machines to identify them and log their accesses to a DB. Hope that helps, Al -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing vars w/refresh w/register globals off?
Well first off all it is possible to post and get at the same time. Dont know why you want to, but its kinda easy really : Example : form name=myform action=myscript.php?get1=aget2=b method=post input type=hidden name=jalla value=balla /form You can submit this form several ways, with ordinary submit button, or with javascrip submit. If you really want to keep serving variables that shouldnt be visble in the browser or in the html kode I guess the only way would be using cookies. But if the variables are defined by the users input / behavior there is surely the need of showing the variables one place or another. You mentioned that there were up to a 100 variables to be passed here. Was that pr user or in total? Sending like a 100 variables with GET would be a bad idea all together, since there are limits on how many caracters the URL can hold. Some years ago alot of browsers had a limit on 128 characters, this is imporved by the years but still the only way to feed long sets of data is through post. If all your variables can be stored on the server, assigning a unique ID to the session would make you able to store everything in the database as someone mentioned earlier. This wasy all you need is pass the ID within the browser. By checking the ID against the unique session on the server you will also eliminate tampering with the data. Webpages that has like a 100 hidden fields doesnt look very professional, but hey - it works. The other thing is that forms can also talk with eachother nicely, what I mean is that you can share the informastion with the help of javascript. Storing all the information you need for later in a form somewhere in the html page, then when you build the refresh url you just pick out the data you want to use from the different form elements (document.form.variable.value). I still havnt quite understood what you are accually asking for here, but hey, it seems like you dont know yourself, hehe -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Floyd Baker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Fri, 18 Jan 2002 18:13:50 +0800, you wrote: On Friday 18 January 2002 04:11, Floyd Baker wrote: Yes. I was using the url to pass variables without a form. It looks like the javascript idea would cover that now that you remind me. I've used it before to refresh two frames at once. But even so I'd rather not go that way if at all possible. I'd like to stay within php's ability. Not being able to POST and GET is a 'limitation' of HTTP not PHP. Not knowing what I'm talking about for sure but is there no way of putting a variable into the 'post' status or condition, prior to being redirected, without actually using a form? Only be using a form will you be able to POST. Thanks for the idea though. It'll work if nothing else. :-) Up to now we (I?) still don't know exactly what you're trying to do. Maybe if you could tell us what you're doing and if appropriate post some code, then we could see if there is another solution to your problem. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* I am just a nice, clean-cut Mongolian boy. -- Yul Brynner, 1956 */ This should be fairly standard. Filling out a form and using a recursive call and if/then, to bring the variables around to a case switch for routing to desired pages according to form input data. if 'completed = y ( switch case get to go here case get go there ) else ( post to /this page form submit ) This draft does work but I don't like the visible url variables. Of course in addition we have all the fields passed by the form post that were used as required on switch case and receiving pages... Now we need to REQUEST every one. That's fine for the sake of the security but now it's beneficial to get into arrays, etc. to keep script shorter and easier to maintain. More learning. Always good. 4.1 is pushing me. :-) The solutions look more involved than my poor coding has been til now. We need to put more things into function form maybe, instead of passing between separate pages. I'm probably still out in left field with a lot of this *visualizing* but it's coming. And always good to talk it out. Can you tell me if it's possible to run 4.03 and 4.1 *both* on the same machine? I'm thinking the old script would be php3 and the new stuff php4. Is that something that could be done until the old scripts are upgraded? Floyd -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Change Date
Is it me or are everyone responding how to give a the date in here? The timestamp is still time() and not date() isnt it? Timestamp works in seconds, so 1 hour is : 60 seconds * 60 minutes. $hour = 60*60; $day = 24*$hour; timestamp for 125 days into the future would then be, $futuretimestamp = time() + ($day*125); time() returns the current timestamp, this very second. All you do is calculate all the seconds there is in 125 days and add it up. If you want to go back to the future, you subtract it from time(). Then, when you want the date to be entered for the screen or somthing use the date() command. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Sadeq Naqashzade [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, How can I find time stamp for example 125 next days. or 03:30 hours next? Regards, S. Naqashzade PS: Sorry for my bad english :-( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Max File Size exceeded
You are probably referring to 2mb filesize. The default setting in php.ini for uploads are 2 MB. As far as I know there isnt any good way of checking the filesize client-side. You could however use some sort of java-applet I would think for the upload system - this would be able to validate the filesize I guess. The other, and probably the only sollution, would be to modify php.ini on the server to handle larger files. If your on a server with other customers you will probably have a hard time getting your provider to do this as most people have no use for larger files. On the other hand he most likely would love to sell you a dedicated server (so would I, :). -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Unknown Sender [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi All, I've written a script that accepts an uploaded image, it sets the MAX_FILE_SIZE hidden variable as specified. However, when a file that is too large is uploaded the script doesn't get a chance to show its own error message, instead the warning outputed: Warning: Max file size exceeded - file [form_data] not saved in Unknown on line 0 How can I prevent this error occuring and handle the condition myself? Thanks, Shaun -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Arrays and performance
Something Ive wondered about as I started working with XML. Importing huge XML files, and converting theese to arrays works indeed very well. But I am wondering if there are any limits to how many arrays the PHP can handle when performance is accounted for. Say I create an array from a XML with lots of childs, say we are talking of upto 10 childs, which would give 10 dimensional arrays. Say we then have 10.000 records, or even 100.000 records. Will this be a problem for PHP to handle, or should I break such a prosess into lesser workloads (meaning lesser depth in the array)? Anyone with some experience on this? -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Arrays and performance
Thanks for your reply! Im going to use this for a backup system for our webstore system, where some of our customers have *alot* of products. Given the structure of the database with categories and images 5000 unique products quickly gives 3x = 15000 arrays. But again, how often would the client need to revert the backup? Ive never needed to do it for now, but I still want to do this backup system in XML (Looks kinda up to date, :), and at the same time know that it will eventually work - even for the customers that infact has alot of products in their system. The alternative, would be that customers with x products would only have access to mySQL dump. Or to have a script that evaluates the XML file and prompts the user that this file is to large for automatic import / revert. a) From what I understand of your answer you're telling me that PHP itself will not have any problems working with 1.000.000.000 arrays, aslong as there are enough ram and processing power available, and that the timeout is extended. Or would the PHP die a painfull death as soon as it gets to much data? Could we coclude the follwing, XMLfile 200 MB = No PHP! b) I should do some benchmarking, to find the magic marker for how much XML data that is affordable to grab when done on a webserver with other clients to prevent angry customers or failures due to factory timeout setting to 30 secs. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Raditha Dissanayake [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I belive PHP should be able to handle it but it's a bad idea. The reason being your app will not scale. Because if you script consumes 2mb of memory on average, 100 users accesing it at the same time will be 200Mb. Of course if you expect only a small number of users it does not matter. The biggest XML job i have handled with PHP is parsing the ODP RDF dump which is around 700MB. Obviously arrays are out of the question in such a scenario, even though only one user will be accessing the script at a given moment. the ODP dump has a couple of million records Kim Steinhaug wrote: Something Ive wondered about as I started working with XML. Importing huge XML files, and converting theese to arrays works indeed very well. But I am wondering if there are any limits to how many arrays the PHP can handle when performance is accounted for. Say I create an array from a XML with lots of childs, say we are talking of upto 10 childs, which would give 10 dimensional arrays. Say we then have 10.000 records, or even 100.000 records. Will this be a problem for PHP to handle, or should I break such a prosess into lesser workloads (meaning lesser depth in the array)? Anyone with some experience on this? -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unzip a file.
Hello! This one : http://www.phpclasses.org/browse.html/package/870.html I remember doing the zip research a while ago and tested several classes and methods, but this class was the one that worked flawlessly! Ive installed and used this class myself, and it works on both linux and windows. This can zip down a directory of 1GB of data (tested), and depack it to another directory (tested). You can also extract single files out of the directory. If you havnt found a sollution you should try this one. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Vincent M. [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Kim Steinhaug wrote: on phpclasses.org there is a ZIP class that does all you need to do. Havnt got the time to give you the url right now, but look there. All I found are classes to extract tar/gzip files: http://www.phpclasses.org/search.html?words=zipgo_search=1restrict=method=andsort=score Is there any I couldn't see ? Thanks, Vincent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Storing images for photo album?
Yes, What system are you using for generating the thumbs for your images? ImageMagick or GD? If you are able to choose you should by all means choose ImageMagick since its much more powerfull than GD. Ive been using both (meaning, I use GD as a second sollution where Image Magick isnt available, for extra compability) and never run into memory problems. Only thing to remember when batching many Hi-Res images that the default timeout is 30 seconds, but aslong as you are processing 1 image into several others this should never be a problem. Give us some specs and we might be able to help you! -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- David T-G [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't fetch HTTP POST data in PHP?
I dont see the problem here at all, here is my test : CutNpaste into your own environment ans save as .php file . All I did was remove the php_info() so that variables dont get messed up (apparently), and removed the error_reporting. Result gives this : array(3) { [username]= string(3) 123 [email]= string(3) 123 [submit]= string(10) Submit me! } - !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html head titleUntitled/title /head body ?php //error_reporting(E_ALL); echo pre\n; //phpinfo(); echo /pre\nbr/; var_dump($_POST); ? form action=?=$PHP_SELF? method=POST Your name: input type=text name=username/br/ Email: input type=text name=email//br input type=submit name=submit value=Submit me! /form /body /html -- -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- David T-G [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: thanks for the summary (was Re: [PHP] Can't fetch ...)
Alrighty! That sheds some more light on this. How exactly can I replicate this scenario then, using my mobile phone? I have a Nokia 3610i i think, with MMS capabilituies and GPRS WAP. Ive never accually thought of expanding website possibilities with this use, how excatly do I post from my mobile? It might be a dumb question, but when I know this I might be able to look further into the problem. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- David T-G [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Alternet row colors
Thanks for this tip, i used to use this when I programmed Perl. But I didnt know it worked here aswell, hehe. Absolutely true that this is much better code practise, and it eases up the lines in the code. Great tip! -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Keith Greene [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] It's so much easier to use the mod (%) operator: using the mod operator, you can check if a variable is divisible by some other number without leaving a remainder. For this example, we want to change every other row, so we would compare our $count against 2 to see if it leaves a remainder: $bg = ($count%2==0) ? #00 : FF; What this line does is FIRST, it checks to see if $count/2 leaves no remainder. If this is true, it sets the $bg var to #00 If it is false, it sets $bg to #FF It only requires the addition of one line of code, and to replace your row background color with a php variable. Also, you don't need to use printf(), since you aren't specifying any formatting. See code below: code:--- $result = mysql_query(SELECT * FROM albums where id 15); $Count = @mysql_num_rows($result); echo table border=1 cellpadding=3 cellspacing=0 bordercolor='#00'\n; echo trtd bgcolor='#66'ID/tdtd bgcolor='#66'ARTIST/tdtd bgcolor='#66'TITLE/tdtd bgcolor='#66'LABEL/tdtd bgcolor='#66'PRICE/td/tr\n; for ($count = 0; $count $Count; $count++) { // Extract post details from database $myrow = mysql_fetch_array($result); $id = $myrow ['id']; $artist = $myrow ['artist']; $title = $myrow ['title']; $label = $myrow ['label']; $price = $myrow ['price']; $bg = ($count%2==0) ? #00 : FF; echo tr bgcolor='.$bg.'td$id/tdtd$artist/tdtd$title/tdtd$label/td td£$price/tr\n; } echo /table\n; At 01:08 PM 11/15/2003, you wrote: Well, first of all Ill just scrap you script since this one is so easy its better to do it from scratch. OK, somewhere in your script you have the code that accually aoutputs the tables you are working with. Im refferring to lines here, and Im meaning the bottom of this document which is the scipt you posted, and I have numbered the lines. Overview of your script. Line 5 - we print out the table header Line 11 - 23 is the loop which prints out all the lines, or rows. Line 24 closes the table. So what we have to do? First we need to declare the values we want to use as backround colours, lets use logical names : (fig a) $backcolor1=#fafafa; $backcolor2=#c0c0c0; $backcolor=$backcolor1;// we assign color 1 This code has to be written before the loop starts, so somewhere before line 11. In the loop (11-23) we need to switch between the colours where we write the colour of the tr. So we write something like : (fig b) echo 'tr style=background-color:' . $backcolor . ';'; // continue with the rest of td... /td/tr here // which is - your code. This will print out the first background color, nice. Now we need it to switch color, so we need to add a little logic. This will be inserted right before the loop ends (infact, you can put it where ever you like aslong as its in the loop). (fig c) if($backcolor=backcolor1) $backcolor=$backcolor2; else $backcolor=$backcolor1; As you see above the logic is quite simple, if the color is 1 - we set it to 2, else we set it to 1. If you think of it, if you process this logic over and over again you will infact get 1, 2, 1, 2, 1, 2, 1, 2 all the time, :) Nice! There you have it, and I hope you got the hang of it. To take your code and implement my colorswither all you need to do is, 1. On line 21 replace #00 width $backcolor 2. Insert the logic (figc), all lines, into line 19 3. Place fig a in line 4. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- The code for return the top ten result is : 1 $result = mysql_query(SELECT * FROM albums where id 15); 2 3 $Count = @mysql_num_rows($result); 4 5 echo table border=1 cellpadding=3 cellspacing=0 6 bordercolor='#00'\n; 7echo trtd bgcolor='#66'ID/tdtd 8 bgcolor='#66'ARTIST/tdtd bgcolor='#66'TITLE/tdtd 9 bgcolor='#66'LABEL/tdtd bgcolor='#66'PRICE/td/tr\n; 10 11 for ($count = 0; $count $Count; $count++) { 12 // Extract post details from database 13$myrow = mysql_fetch_array($result); 14 $id = $myrow ['id']; 15 $artist = $myrow ['artist']; 16 $title = $myrow ['title']; 17 $label = $myrow ['label']; 18 $price = $myrow
[PHP] Re: Table statistics
Well, Im about to create some statistics systems myself and havnt really starter thinking of the optimal way of doing such calculations so this thread will be much interesting. I would suggest the following : As you have already pulled out all the data from that month, we need to prosess this. I would create a 2 dimensional array for every Screen_ Name, // Initiate array $count = array(); // Loop through your data and assign all the users like this $count[$Screen_ Name] = 0; This will give you an array of all the users, then you could loop through the data again and add 1 for each instance of the user to meassure the counts : $count[$Screen_ Name]++; Finally you sort the array and print out the first 5. (The 2 last steps should be put together since its no use going through the data twice) -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Daniel Harik [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I have table with messages, and i have users table, the are linked via PK UserID - UserID, what i need is to select Messages for current month and calculate top 5 posters list for current month. I have create following query but it's not complete: SELECT Handle, Screen_Name from MBoard where Message_Date='2003-11-00' ORDER BY Handle; this gets me all messages posted this month ordered by userid Thank You. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Table statistics
By the way, while I write the message I forgot to correct the 2 dimentional array to array... Context is everything, :) -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Kim Steinhaug [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Well, Im about to create some statistics systems myself and havnt really starter thinking of the optimal way of doing such calculations so this thread will be much interesting. I would suggest the following : As you have already pulled out all the data from that month, we need to prosess this. I would create a 2 dimensional array for every Screen_ Name, // Initiate array $count = array(); // Loop through your data and assign all the users like this $count[$Screen_ Name] = 0; This will give you an array of all the users, then you could loop through the data again and add 1 for each instance of the user to meassure the counts : $count[$Screen_ Name]++; Finally you sort the array and print out the first 5. (The 2 last steps should be put together since its no use going through the data twice) -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Daniel Harik [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I have table with messages, and i have users table, the are linked via PK UserID - UserID, what i need is to select Messages for current month and calculate top 5 posters list for current month. I have create following query but it's not complete: SELECT Handle, Screen_Name from MBoard where Message_Date='2003-11-00' ORDER BY Handle; this gets me all messages posted this month ordered by userid Thank You. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unzip a file.
on phpclasses.org there is a ZIP class that does all you need to do. Havnt got the time to give you the url right now, but look there. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- John Nichel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Vincent M. wrote: Hello, Is there an easy way to unzip a zipped file which contains files (images), using a function from the zlib or any. To something like that: exec(unzip zipfile.zip -d /path/to/images) ; But without using the exec function. Thanks, Vincent. You may want to check here http://www.php.net/manual/en/ref.zip.php The functions are read only. I don't know if this will do it, but it seems that if you can /read/ an entry in the zip file, you should be able to write it somewhere. However, if you just want to execute the command line app on the OS and not use exec(), just enclose your statement in backticks `unzip zipfile.zip -d /path/to/images`; -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Storing images
Well as far as I can see you have 2 options. a) Store them directly on disc b) Store them in a database (eg. mySQL) I would think that a) is the best way without doubt, since it doest use any extra processing power to serve the images to your visitors as its only the webserver doing the usuall stuff. The b) option has a better advantage regarding the backup function, as its easier backuping a database than backing up a directory with scripts anyway. (Unless you are thinking FTP, but right now im thinking automatied scripts) On the otehr hand I have succesfully installed ZIP ability with PHP, which makes backing up directories no problem. So all in all it depends on where you stand if you know what I mean. The database sollution puts extra demand on the database as it constantly has to query the database to get the images all the time. So if you are thinking about the health of your server, and how quick you want your site to accessible for your visitors I would stick to a) I dont think it good practise to store images into the database either. -- Kim Steinhaug --- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. --- Paul Marinas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, i was wondering which is the best way to store images. I'm using an upload section for my site and i'm using a script to put those images from the upload section on a diferent section of the site. 10x Paul GnuPG Key http://sgi.rdscv.ro/~paulm/paulm.PGP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php