Re: [PHP] Form Already Filled Out
Hmmm looks like you saved the password and your browser or OS may be filling it for you. Em 04/08/2011 01:42, wil prim wilp...@me.com escreveu: Hello, S i created a simple login system, and I am using sessions. Everything seems to work fine, however; when I upload my files to my server and type my domain name my index.php page comes up and the form is automatically filled out with a username and password. How do i make it empty when I initially enter the site, and yes I did create a logout.php file that destroys a session. Please help, it is hard to explain this when I cant show it in person. Thanks in advance! Here is the login.php code, i didn't md5() the password yet: ?php if ($_SESSION['user']) { header(Location: error.php); exit(); } include('connect.php'); if ($_POST['login']){ $user=$_POST['user']; $pass=$_POST['pass']; $sql=SELECT * FROM members WHERE username='$_POST[user]' and password='$_POST[pass]'; $result=mysql_query($sql, $con); $count=mysql_num_rows($result); if ($count==1){ $_SESSION['user'] = $user; header('location: home.php'); } else echo p style='color:red'Wrong Username or Password/p; } ? html head title/title link href=style.css rel=stylesheet type=text/css / /head body div id=main div id=menu ul li a href=#Home/a /li li a href=#Topix/a /li li a href=#Mission/a /li /ul /div div id='content' form method='post' action='index.php' Username: br/ input type='text' name='user' maxlength='30'/br/ Password: br/ input type=password name='pass' maxlength='30'/br/ input type=submit value=Log In! name=login/ /form a href=register.html Register? /a /div /body /html
Re: [PHP] Fw: Spoofing user_agent
Quit top posting. On Mon, Nov 29, 2010 at 9:55 PM, Ron Piggott ron.pigg...@actsministries.org wrote: My issue with the user agent is unresolved. I need to do more research to see how AWSTATS distinguishes between a robot crawling the site and a web page user and set the user-agent accordingly. Ron, AWSTATS probably users a knowledge base for known bots, I'm not sure. If that's the case, you can just set your User-Agent to a known and see how that goes. Look for Googlebot, Majestic, Ask.com (now dead - probably a good pick), MSNBot here: http://www.user-agents.org/ As for setting the User-Agent in your request, I like to use this cUrl snippet (based on a note at curl's manual page): ?php $sUrl = 'www.example.com/'; $sUserAgent = 'Googlebot/2.1 (+http://www.googlebot.com/bot.html)'; $hCurl = curl_init(); curl_setopt ($hCurl, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt ($hCurl, CURLOPT_URL, $sUrl); curl_setopt ($hCurl, CURLOPT_CONNECTTIMEOUT, 120); curl_setopt ($hCurl, CURLOPT_TIMEOUT, 120); curl_setopt ($hCurl, CURLOPT_USERAGENT, $sUserAgent); $sContent = curl_exec($hCurl); ? Cheers, Thiago Henrique Pojda +55 41 8856-7925
Re: [PHP] Suppressing error from displaying
On Wed, Nov 24, 2010 at 5:13 PM, Ron Piggott ron.pigg...@actsministries.org wrote: I am using this syntax to check for a valid e-mail address list($userName, $mailDomain) = split(@, $buyer_email); if (checkdnsrr($mailDomain, MX)) { if no domain is provided ( ie e-mail address is something like “ron” with no @ ) the following error is displayed: Warning: checkdnsrr() [function.checkdnsrr]: Host and type cannot be empty Can I suppress this from displaying so *just* my error message displays? Ron Just add @ before checkdnsrr: list($userName, $mailDomain) = split(@, $buyer_email); if (@checkdnsrr($mailDomain, MX)) { But you shouldn't use @ as it will make a PITA to find errors in your code when maintaining it. You should not display Warnings on production too, at least not for users but instead log those. Cheers, Thiago Pojda
[PHP] Apache mod_pagespeed
Guys, Google announced this morninghttp://googlewebmastercentral.blogspot.com/2010/11/make-your-websites-run-faster.htmltheir mod_pagespeed http://code.google.com/speed/page-speed/docs/module.html to improve Apache's performance. It really looks promising, what do you guys think? Me and Daniel Brown will be running some tests with it, let us know if you'd like to join us. :) Google mentions 2x faster loading times, but they don't mention CPU cost. What do you think it will break? Cheers, Thiago Henrique Pojda +55 41 8856-7925
Re: [PHP] php bug from 2003 still alive?!
On Mon, Mar 30, 2009 at 12:42 PM, Merlin Morgenstern merli...@fastmail.fmwrote: Some postings say that I have to compile php with --enable-zend-multibyte. HOwever those postings are very old (2003!). http://bugs.php.net/bug.php?id=22108 Did you see what Derick said abut this in the last comment? * [22 Aug 2005 6:35pm UTC] der...@php.net* This will come with Unicode support in PHP 6.0 Is this still necessary with the newest php build? Looks like it. If yes, do you believe I will run into trouble on sites that are saved in ansi? I'm not sure, you should probably wait for someone else to reply :) Regards, Thiago Henrique Pojda http://nerdnaweb.blogspot DOT com
Re: [PHP] [News] Affordable Independent Web Developer - Search Engine Optimization Services - March 19th, 2009
On Fri, Mar 20, 2009 at 3:23 PM, Ginkga Studio, LLC webdes...@ginkga.comwrote: IF YOU WERE MY HUSBAND I WOULD SPANK YOUR ASS SO HAR YOU'D NEVER TALK BACK ANY WOMAN EVER AGAIN !!! Oh, gee. Thanks for filters, Gmail. -- Thiago Henrique Pojda http://nerdnaweb.blogspot.com
Re: [PHP] /home/{user}/directory
On Tue, Mar 17, 2009 at 10:42 AM, George Larson george.g.lar...@gmail.comwrote: In my scripts, I usually define a boolean constant DEBUG. True looks for local copies of includes and echoes queries as they're used. My question is: Is there any way for me to reflect the actual home folder of the person running the script? So it will be /home/george/foo when I run it but, for another user, it would be /home/their-username/foo? Just checking, you're running PHP on CLI then, right? If it's running on normal apache setup the user would always be the user which apache is running. Thiago Henrique Pojda http://nerdnaweb.blogspot DOT com
Re: [PHP] Non-traditional software accessing my website
On Mon, Jan 26, 2009 at 4:13 PM, Robert Cummings rob...@interjinn.comwrote: On Mon, 2009-01-26 at 13:04 -0600, R B wrote: Hello, Is there a way to be sure that a website is going to be accessed only by traditional browsers and not from another software that send to the server the same headers of any of the traditional browsers? For example, supose that i only want to give access to my site users from firefox, ie, chrome and safari, because i know that the users can´t download the copyright information of the website to the temporary files with anyone of this browsers. How can i be sure that someone that develop a mini-browser or a software can´t access my site sending the same header information of traditional browsers? In this case, the validation of HTTP_USER_AGENT isn´t a solution. You can't... get over it. I was just answering this with a long response, but you beat me with that simplicity ;) Cheers, Rob. Thiago Henrique Pojda http://nerdnaweb.blogspot DOT com
Re: [PHP] Server cannot send emails
On Fri, Jan 16, 2009 at 10:36 AM, Sergio Jovani lese...@gmail.com wrote: Hi! I have working at SourceForge.net project web space Drupal as CMS. I have many modules installed related with email like Contact, Notify... This modules never worked and I tried send an email from email php function. I did it with: ?php $to = myem...@gmail.com; $subject = Hi!; $body = Hi,\n\nHow are you?; if (mail($to, $subject, $body)) { echo(pMessage successfully sent!/p); } else { echo(pMessage delivery failed.../p); } ? This does not work too. Is there any issue with email sending from SourceForge.net? Looks like you're missing the From: part of the email. That's probably your issue. I never used sourceforge, but I know many hostings require you to specify a sender. from http://php.net/manual/en/function.mail.php ?php $to = 'nob...@example.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmas...@example.com' . \r\n . 'Reply-To: webmas...@example.com' . \r\n . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ? Thiago Henrique Pojda http://nerdnaweb.blogspot DOT com
Re: [PHP] (auto) session expire
On Mon, Jan 5, 2009 at 12:05 PM, Shiplu shiplu@gmail.com wrote: This is a very common issue. I searched and found many sites talking about this. but no good solution. Well the problem is I want to set my session will expire after 10 minutes of inactivity. Just like an banking site. When user is inactive for 10 minutes the session will expire. In fact the browser will delete the cookie. The browser will delete the cookie because it was told by the server. I used these lines Don't trust client-side actions. Never. session_cache_expire(APP_SESSION_TIMEOUT); session_set_cookie_params(APP_SESSION_TIMEOUT*60); ini_set(session.gc_maxlifetime, APP_SESSION_TIMEOUT * 60); session_start(); It runs at the very beginning of my application. APP_SESSION_TIMEOUT has value 10 which is in minutes. The problem is it works good in FF3. But not in IE. Any Idea how to resolve it? or any standard way to fix it? I'm not sure if there is any standard way to fix it. What I do is just compare current time with the last action time. If it's bigger than my timeout, session_destroy(). If anyone has any other ideas, I'd like to hear it. :) -- Blog: http://talk.cmyweb.net/ Follow me: http://twitter.com/shiplu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Thiago Henrique Pojda http://nerdnaweb.blogspot DOT com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Since I speak with some of you more than people I see in person....
[top-posting] Congratulations guys, take good care of those new little persons! This has been a great year, probably the best year for me. Learnt a lot with you here and I hope I helped giving something back to the community. Keep up the good work, it's been great! I wish I'll get married somewhere between next year and the year after, let's see how things go. :) (if you're not religious, you can stop reading here) This year I found about the great love of Jesus and how good He's been to me. Thanks to His love, everything's been so good I can't even express myself. If you still haven't, try fiding about Him. You'll not regret it. :) Best wishes to everyone, Thiago Henrique Pojda http://nerdnaweb.blogspot DOT com On Wed, Dec 31, 2008 at 10:32 AM, Dotan Cohen dotanco...@gmail.com wrote: 2008/12/30 Bastien Koert phps...@gmail.com: Congrats on the new critter to be...they are a lot of fun after the first year of eating sleeping and pooping ;-) Sleeping? Why don't mine do that? I am of the opinion that the first year they are little more than a crying digestive system :) To the OP: congrats! You will enjoy this! -- Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת ا-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه-و-ي А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я ä-ö-ü-ß-Ä-Ö-Ü
Re: [PHP] retrieve result of a query
You can return (echo) a JSON or a XML with those results. That way it doesn't store the file anywhere. :) (I'd go for JSON + jquery) Regards, Thiago Henrique Pojda On Sun, Dec 28, 2008 at 11:32 AM, Alain Roger raf.n...@gmail.com wrote: Hi, basically i have a php file with several parameter received in GET or POST. this PHP page execute a db query and should return a specific amount of records and columns. however i do not want to display those records like that... i have a web page with javascript and the javascript should read those records/quesry result and display them. how can javascript read those result ? i do not want php file to create a temporary file on server, i would like to read those data on fly. so how can i do that ? i mean how or what should i do from php side ? thx. -- Alain --- Windows XP x64 SP2 / Fedora 10 KDE 4.2 PostgreSQL 8.3.5 / MS SQL server 2005 Apache 2.2.10 PHP 5.2.6 C# 2005-2008 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Read Form values prior to submit?
On Sun, Dec 28, 2008 at 12:41 PM, Tim Rude tim_r...@yahoo.com wrote: Using PHP, is there a way for me to read the values that a user has entered into the text fields of a FORM prior to the user clicking the submit button? If the user doesnt press the submit button PHP has no idea what's going on there. That's client-side and you should use JavaScript for that. Essentially what I want to do is make sure the user has filled in all three text fields on my form before allowing it to be submitted [to a third party website]. In case you have a specific business logic in that field and don't want the user to know about it, you should use AJAX. But this sounds simple, a small JS should help you. The JS can submit the form, if it's okay. Or you can add a action to form's onsubmit event. (you can return false if the validation fails). Hope this helps! Regards, Thiago Henrique Pojda nerdnaweb.blogspot DOT com -- Tim Rude [PHP newbie] -- 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] HTTP Authentication
Guys, I have to access a WS that uses HTTP auth directly with PHP. I've tried using the usual http://user:[EMAIL PROTECTED]/ but I couldn't get it working. I believe it has something to do with the password containing a # (can't change it) and the browser thinks it's an achor or something. All I've seen were scripts to implement HTTP Auth in PHP, nothing about actually logging in with PHP. Is it possible to send the authentication headers the first time I access the link? I could send all necessary headers to the page I'm trying to access and retrieve it's content at once. Thanks, -- Thiago Henrique Pojda
Re: [PHP] HTTP Authentication
On Wed, Nov 19, 2008 at 11:34 AM, Craige Leeder [EMAIL PROTECTED] wrote: Thiago H. Pojda wrote: Guys, I have to access a WS that uses HTTP auth directly with PHP. I've tried using the usual http://user:[EMAIL PROTECTED]/ but I couldn't get it working. I believe it has something to do with the password containing a # (can't change it) and the browser thinks it's an achor or something. All I've seen were scripts to implement HTTP Auth in PHP, nothing about actually logging in with PHP. Is it possible to send the authentication headers the first time I access the link? I could send all necessary headers to the page I'm trying to access and retrieve it's content at once. Thanks, Why don't you let yourself in regardless of the credentials and print them out to make sure they're being evaluated as you expect. - Craige I can' t change the WebService, it's not mine. If it were, I could manage to test some stuff but now all I can do is type it's address in my browser, login and see the content I want my app to see. Thanks, -- Thiago Henrique Pojda
Re: [PHP] HTTP Authentication [ SOLVED ]
On Wed, Nov 19, 2008 at 12:15 PM, Andrew Ballard [EMAIL PROTECTED] wrote: On Wed, Nov 19, 2008 at 9:26 AM, Thiago H. Pojda [EMAIL PROTECTED] wrote: Guys, I have to access a WS that uses HTTP auth directly with PHP. I've tried using the usual http://user:[EMAIL PROTECTED]/ but I couldn't get it working. I believe it has something to do with the password containing a # (can't change it) and the browser thinks it's an achor or something. All I've seen were scripts to implement HTTP Auth in PHP, nothing about actually logging in with PHP. Is it possible to send the authentication headers the first time I access the link? I could send all necessary headers to the page I'm trying to access and retrieve it's content at once. Thanks, -- Thiago Henrique Pojda You're passing the username and password as part of a URL, so shouldn't the username and password be urlencoded? I'm thinking it will work if you replace the '#' sign with %23. Andrew I only tried thworing urlencode on everything, which obviously didn't work. Both ways worked, using %23 for '#' and the snippet from Nathan. Thanks a lot everyone, I was about to build all the headers and stuff :P Regards, -- Thiago Henrique Pojda
Re: [PHP] HTTP Authentication [ SOLVED ]
On Wed, Nov 19, 2008 at 2:49 PM, Boyd, Todd M. [EMAIL PROTECTED] wrote: -Original Message- From: Thiago H. Pojda [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2008 11:47 AM To: Andrew Ballard Cc: PHP-General List Subject: Re: [PHP] HTTP Authentication [ SOLVED ] On Wed, Nov 19, 2008 at 12:15 PM, Andrew Ballard [EMAIL PROTECTED] wrote: On Wed, Nov 19, 2008 at 9:26 AM, Thiago H. Pojda [EMAIL PROTECTED] wrote: Guys, I have to access a WS that uses HTTP auth directly with PHP. I've tried using the usual http://user:[EMAIL PROTECTED]/ but I couldn't get it working. I believe it has something to do with the password containing a # (can't change it) and the browser thinks it's an achor or something. All I've seen were scripts to implement HTTP Auth in PHP, nothing about actually logging in with PHP. Is it possible to send the authentication headers the first time I access the link? I could send all necessary headers to the page I'm trying to access and retrieve it's content at once. Thanks, -- Thiago Henrique Pojda You're passing the username and password as part of a URL, so shouldn't the username and password be urlencoded? I'm thinking it will work if you replace the '#' sign with %23. Andrew I only tried thworing urlencode on everything, which obviously didn't work. Both ways worked, using %23 for '#' and the snippet from Nathan. Thanks a lot everyone, I was about to build all the headers and stuff :P All the headers, meaning 2? :) Glad to hear you've solved your problem, anyway.. // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Haha, yes, 'all' those :) I thought there were many more, thankfully it only needed Basic and the other - which I forgot now. Thank you too :) -- Thiago Henrique Pojda
[PHP] PHP Startup: Unable to load dynamic library
Guys, I switched PCs and now when I load PHP I get this weird error. It claims it can't find the specified library, but in the lib is in the path given by the message. Any ideas? My extension_dir is okay (it has spaces, but has ) and I gave Everyone access to it. I'm in WinXP using apache 2.2. Thanks, -- Thiago Henrique Pojda
Re: [PHP] PHP Startup: Unable to load dynamic library
On Wed, Nov 12, 2008 at 1:56 PM, Thiago H. Pojda [EMAIL PROTECTED]wrote: On Wed, Nov 12, 2008 at 1:54 PM, Stut [EMAIL PROTECTED] wrote: On 12 Nov 2008, at 16:53, Thiago H. Pojda wrote: I switched PCs and now when I load PHP I get this weird error. It claims it can't find the specified library, but in the lib is in the path given by the message. Any ideas? My extension_dir is okay (it has spaces, but has ) and I gave Everyone access to it. Which extension? This message usually indicates that it can't find a DLL the extension depends upon. http://stut.net/ I removed all of them and let only php_mysql.dll and still get this error. Does this extension depend on anything? -- Thiago Henrique Pojda CC'ing php-general...
Re: [PHP] PHP Startup: Unable to load dynamic library
On Wed, Nov 12, 2008 at 2:03 PM, Stut [EMAIL PROTECTED] wrote: On 12 Nov 2008, at 16:58, Thiago H. Pojda wrote: I switched PCs and now when I load PHP I get this weird error. It claims it can't find the specified library, but in the lib is in the path given by the message. Any ideas? My extension_dir is okay (it has spaces, but has ) and I gave Everyone access to it. Which extension? This message usually indicates that it can't find a DLL the extension depends upon. http://stut.net/ I removed all of them and let only php_mysql.dll and still get this error. Does this extension depend on anything? It's pretty useless without libmysql.dll. -Stut -- http://stut.net/ Yeah, I just found this out. Strange the win32 installer didn't add this. The error message could be clearer :) Thanks Stut! -- Thiago Henrique Pojda
Re: [PHP] PHP Startup: Unable to load dynamic library
On Wed, Nov 12, 2008 at 2:21 PM, Thodoris [EMAIL PROTECTED] wrote: Although I don't develop under windows and I should say that this OS has been developing my allergies I would suggest to use WAMP. Which is Windows-Apache-MySQL-PHP enviroment that you might find very useful and it might make things easier for you. -- Thodoris Thodoris, I don't like developing on windows either, but I find it to be worse when using WAMP. When I first started developing PHP I used to use WAMP and also tried EasyPHP. Although things were easier at first, IMO they add too much stuff in conf files that make things confuse when you need to make some specific changes. Thanks for your suggestion :) -- Thiago Henrique Pojda
Re: [PHP] Missing DLLs
On Wed, Nov 12, 2008 at 2:31 PM, [EMAIL PROTECTED] wrote: So, that error message about a missing DLL, when it's really a sub DLL that is missing... Is that something in PHP source that could be fixed to specify WHICH dll is really missing? Or is that just Windows being stupid? Mr. Spock has calculated that a quick hack change to that error message to be more specific would save approximately 3,141.59 man-hours per week... :-) I'm happy to put it in bugs.php.net as a feature request, if it's actually IN php, but don't want to waste the resources to mark it as junk if there's no way PHP could do that. I haven't seen such stuff in Linux, so maybe it's just Windows throwing weird messages. But hopefully someone with more experience will answer to this :) If it's not possible to tell exacly what's wrong, maybe just adding a or one of it's depencies would help. Thanks, -- Thiago Henrique Pojda
Re: [PHP] Php4 = Php5
On Fri, Oct 3, 2008 at 11:42 AM, Operacion Control [EMAIL PROTECTED] wrote: Hi Lists, I am planning to migrate from Php4 to Php5 in a few days. Do anyone know which applications/services are upset with the migration? I dont have enough servers to instalt each using Php4 and then install Php5 to test. I mean sendmail, qmail, joomla, egroupware, hordeetc Thanks in advance Carlos Good evening Carlos, I believe this page could help you out. http://docs.php.net/manual/en/faq.migration5.php About the applications you're talking about, you have to check in their manuals and upgrade them if necessary. Regards, -- Thiago Henrique Pojda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: SESSION array problems UPDATE
Much as it pains me to ask this, you don't have REGISTER_GLOBALS on, do you? Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php It must be. I just ran tedd's example in both scenarios. With register_globals = Off it works like a charm. With register_globals = On I get the same output tedd does. register_globals = on: Problem Step 2 -- Cable Diane Ron Big Dirt Joe 0 Cable Diane 1 a i 2 register_globals = Off: Step 2 -- Cable Diane Ron Big Dirt Joe 0 Cable Diane 1 Ron Big 2 Dirt Joe Cable Diane Ron Big Dirt Joe -- Thiago Henrique Pojda Forgot my blog url, php list doesn't like it :) -- Thiago Henrique Pojda Okay, gmail must be playing with me... 3rd email rejected by spammy url -- Thiago Henrique Pojda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Robert Cummings
On Tue, Sep 30, 2008 at 3:12 PM, Daniel Brown [EMAIL PROTECTED] wrote: All: What was pointed as a passing mention in one thread I thought was worth note in a thread of its own. As quoted by Rob: BTW, while we're off topic... my wife delivered our third child (second boy) 3 minutes after midnight yesterday :) I'd say that deserves a round of congratulations. Many - most, probably - of you know Rob from here, and have seen his help and dedication - as well as his annoying wit ;-P - offered to any and all on this list. Quite often, it's offered when you don't especially want it. Nonetheless, it's great news, and I think we should all take a moment and wonder: why the hell aren't you at the hospital with your wife and newborn son, Rob? ;-P Congrats to the Cummings family! That's great news - perhaps now he won't have much time for emails ;) Congratulations!! -- /Daniel P. Brown -- Thiago Henrique Pojda
[PHP] Re: Unicode problems
Hello, On Fri, Sep 26, 2008 at 9:07 AM, Daniel Jaeger wrote: I had similar problems, I cant get the whole situation out of what you wrote but here are two hints. If you got SSH Access you can try to import the DB by following command I don't have SSH access :/ Otherwise if you can't access the server on this way you can set the whole DB connection on the PHP application to the wanted charset by using following function mysql_set_charset - but as this one just works on PHP 5.2.3 you can do the same (not recommendet way) over the Set names MysqlQuery - this Query just needs to be run after the connection has been established (mysql_connect()). Tried without success. Just have a look at the doc of the mysql_set_charset function there you see on the third comment a implementation of this function for all who have an earlier PHP Version than 5.2.3 ( http://de3.php.net/manual/de/function.mysql-set-charset.php) Hope I could help. Actually all the responses did help. While I was researching I figured some weird stuff. I tried MySQL 4.0 examples for CAST() and CONVERT() and all I got were syntax errors. This DB is broke. Cheers Daniel I did the following: 1) Extract the DB script from the working one; 2) Manually added CHARSET=utf8 for each create table; 3) Converted this script to UTF8 and opened with a ANSI reader and all the accented chars got funny. Great! That's what I wanted. 4) Applied the script into the database and more frustration. *Some* lines were in utf8 and some in latin1. I can only imagine the hosting is forcing this kind of behaviour so the client has to switch DBMS. (I don't see how, but well). I'm still trying and researching. If anyone else have any idea, please reply. Thanks everyone! -- Thiago Henrique Pojda
Re: [PHP] Re: Unicode problems - solve
Sorry to bother you all, I just did the whole process again using only phpmyadmin and notepad++ (yes, I'm under windows) I could import the database successfully. The whole thing was converted to UTF8. @Richard: I'm using both, META and header. I didn't know IE6 had issues with header(), learning somehing new every day :) About UTF8, if you have text in ISO (latin1) and tell the browser it's a UTF8 it doesn't work 100%. Not the accented chars. Thanks for all the help, -- Thiago Henrique Pojda
[PHP] Unicode problems
This is slightly OT but I honestly don't know what else I can do. I was asked to migrate a website from diff hosts. Okay, pretty easy, right? Well, as usual, it wasn't. Site pages content type was ISO-8559-1 and it was developed for a MySQL5 database that used latin1 as charset and InnoDB as storage system. Pretty normal and ran smoothly. The client database is a old 4.0 MySQL that (I'm not sure if they're just disabled but it) doesn't have InnoDB and latin1. So I'm stuck with MyISAM and UTF8. No, they can't change it - their hosting want them to migrate to MSSQL and they can't switch hosts for whatever reason. After I uploaded the files and ran it, my HTML files displayed correctly but all accented chars that came from DB were displayed with weird chars, as I imagined it would. I then set my html content type to UTF-8 and I also had problems, but in backwards this time - DB values were OK and website content was bad. I couldn't find any good function/script to convert all my files to UTF-8 and then I built my own. It uses iconv and works like a charm. But unfortunately I still can't get all pages to work. I have no idea why or how, but *some* queries return the text in ISO-8859-1. I even dropped the table and recreated them explictly saying it's a UTF8 table but some rows are in ISO and others in UTF-8 (that or some mysql_fetch_* functions converts them). It's been 2 days and I still can't see a solution. I even thougth of adding utf_decode on all of mysql_fetch* results, but I didn't build this website so I don't feel like adding that in *every* call (it doesn't have a wrapper for mysql_* functions). So, I'm here to humbly ask for your help. What can be wrong? PHP Version is 4.4.8 Thanks, -- Thiago Henrique Pojda http://nerdnaweb.blogspot.com
Re: [PHP] Don't understand what is this $arr['N']['#']
Hello, On Wed, Sep 24, 2008 at 2:51 PM, It flance [EMAIL PROTECTED] wrote: Hi, I am working on the code of a former employee and I don't understand what this $arr['N']['#'] refers to. I'm not sure you can do that (can't test atm), but looks like a valid position as it's in ' '. I wonder if that wouldn't comment the rest of the line... I know it is a multidimensional associative array but the # i don't what this means. Thank you Thank you for bringing this up, it's a good question (at least I think so) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Thiago Henrique Pojda http://nerdnaweb.blogspot.com
Re: [PHP] Re: __toString friends
http://bugs.php.net should help you out. In the bug reporting page there's a Feature request item (It's the 3rd item in the Type of bug select). Btw, I liked this idea :) On Fri, Sep 19, 2008 at 8:58 AM, Leurent Francois [EMAIL PROTECTED]wrote: Is there any feature submission process were we could discuss of this subject ? Colin Guthrie [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] Nathan Rixham wrote: concurred; I recently made a class that turn's all objects into XML; and implented it in my __toString()'s :) In that case rather than __toBool() __toInt() etc. it should really support a magic __cast() method or similar. This method would contain a single argument that represents the type (e.g. a class name or a builtin type function __cast($type) { switch ($type) { case 'string': return 'Foo'; case 'array': return array('Foo'); case 'DomDocument': // etc. } } And if you did: $foo = new MyClass; $xml = (DomDocument)$foo; It would return the result of __cast called with $type == 'DomDocument'. That would be nice and generic. I could see that being quite useful (tho' arguably, itmplementing a cast() method is not that hard: $xml = $foo-cast('DomDocument'); It's not as neat tho' :) col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mandriva Linux Contributor [http://www.mandriva.com/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Thiago Henrique Pojda
Re: [PHP] tedd's back from vacation
On 9/10/08, Jason Pruim [EMAIL PROTECTED] wrote: On Sep 10, 2008, at 9:40 AM, tedd wrote: At 10:05 PM -0400 9/9/08, Dan Joseph wrote: Look, just because we let you out of your cage, doesn't mean you have to go breaking your bones! No more vacations! BTW, was that dance in response to MSU winning 2 games in a row? -- -Dan Joseph Dan: I only root for two schools: One is MSU and the other is any school who plays against U of M. However, when I go on vacation there is no communication with the outside world whatsoever. No radio, no TV, no Internet, no email, no cell phone, absolutely nothing. I vacation on Beaver Island in the middle of Lake Michigan -- yes really, Beaver Island. :-) The only thing I do is sit back and read php books. I finished two of them, namely Wicked Cool PHP and Webbots, Spiders, and Screen Scrapers -- that's my entertainment and relaxation. However, I wasn't aware that MSU won anything -- but no matter if they did or not. If they win, everyone goes wild -- if not, then that's expected. So in both cases if you're a MSU fan, you win. :-) Hail! to the victors valiant Hail! to the conqu'ring heroes Hail! Hail! to Michigan The leaders and best! Hail! to the victors valiant Hail! to the conqu'ring heroes Hail! Hail! to Michigan, The champions of the West! ;) -- Jason Pruim I'm not sure what this is all about but welcome back, tedd. :) Those toe-breaking dances are wild ;) Regards, -- Thiago Henrique Pojda
Re: [PHP] comments function being spammed, how do I stop it?
Captcha? On 8/25/08, Barnaby Walters [EMAIL PROTECTED] wrote: Hi there! my comments function for my website (at www.waterpigs.co.uk/php/phpTest.php) is being spammed, what would be your sugguestions of a way to deal with it? I was thinking of something to do with searching the strings of comments contained in the database for rude words, etc, but I'm unsure as to how to do it. Any help would be appreciated greatly. Thanks, Barnaby _ www.waterpigs.co.uk [EMAIL PROTECTED] -- Thiago Henrique Pojda
Re: [PHP] Displaying files
On 8/15/08, Dan Shirah [EMAIL PROTECTED] wrote: Okay, I'm perplexed! If I put the exact same value into a javascript function and open a window the document comes up perfectly fine. But, when trying to readfile() copy() or fopen() in PHP I get the failed to open stream: error. Any idea why the exact same link would open fine using a HTML link or a javascript function, but will not work using PHP? I'm not sure I understand this... Can you provide some new code? :) -- Thiago Henrique Pojda
Re: [PHP] Displaying files
On 8/15/08, Dan Shirah [EMAIL PROTECTED] wrote: Thiago, HTML WORKS a href=\\server\folder\file.xls target=_blankOpen/a Javascript WORKS function openWin(folder,file) { var LeftPosition = (this.screen.width) / 2; var TopPosition = (this.screen.height) - this.screen.height; var Height = (this.screen.height) - 90; var Width = (this.screen.width) /2 - 10; MyWin = window.open(server\\+folder+\\+file+\.xls,ViewImage,scrollbars=yes, status=yes, resizable=no,top=+TopPosition+,left=+LeftPosition+,width=+Width+,height=+Height+); MyWin.focus(); } You JavaScript works because it's opening a Window and pointing it's URL to a directory your BROWSER has access, that's client-side. If I run your JS (or your HTML) code, it will not work as I don't have access to that \\server share. PHP (and your HTTP server) are on server-side, and they're not having access to your file. PHP DOESN'T WORK $filename = server\\.$folder.\\.$file..xls; header(Content-Type: application/x-msdownload); readfile($filename); I put all three of these examples into the exact same page. The HTML and Javascript open the file without any problems, but PHP cannot open it. -- Thiago Henrique Pojda
Re: [PHP] Displaying files
On 8/15/08, Dan Shirah [EMAIL PROTECTED] wrote: Wow, I think it finally clicked. Sorry that took so long. That's fine, sorry if I sounded rude or something. I didn't mean it. The whole point behind using PHP was to try and copy or call the file from the server side so the user does not see the path to the document. Using HTML and Javascript it is extrememly easy to just view source and see the path. Whereas using PHP it would take the regular user a bit more work to view the path which is why I wanted to go that route. But having to grant the anonymous internet account access to the server would be just as bad if not worse. My guess is worse. :) My application retrieves a list of docments that the user can view based on search criteria. When the user clicks on the document I wanted to somehow mask the location the document is being pulled from. HTML and Javascript are so easy to circumvent, even to the everyday user that I wanted to do something with PHP since it's code is not viewable when you view source since it is run on the server. Have any of you attempted something like this? You can have a php file called something like getFile.php where you pass parameters like getFile.php?file=123 and it returns the file (with proper headers). But that way you'd have to map all file paths to a database. Then you could access them thru codes, but remember to check user permissions before handling him the file as you'd have a serious problem. Aside of that, at the moment I can't figure another way of serving files for a user hiding them the path for it. I'd be happy to see what others have in mind. :) -- Thiago Henrique Pojda
[PHP] XML Encoding
Guys, I'm building a XML in a PHP Script. Everything works fine until I add accented (ISO-8859-1) characters into it. As far as I can see, there's no way to change DOMDocument's encoding from UTF-8, right? Thanks, -- Thiago Henrique Pojda
[PHP] XML Encoding - with examples
Okay, After much iconv, headers and workarounds I figured I can't use DOMDocument for XMLs when under ISO-8859-1 encoding without messing accented chars. The idea is simple: get a query result and turn into a XML. Using mysql_fetch_object is the best way for this task. If I just do nothing: get iso text, insert into the XML and not set the encoding, the XML loads (w/o xml content type in header) but it's a bad thing to do (not all browsers like this). Anyone have any ideas why the following doesn't work or how to fix it? The right thing to do, which doesn't work. ?php header('Content-type: text/xml; charset = ISO-8859-1'); $unidades = listarUnidadesSetor(58,1); //returns a stdClass - mysql_fetch_object $doc = new DOMDocument(1.0, 'ISO-8859-1'); //setting XML Encoding to ISO breaks in the first accented char $doc-formatOutput = true; //Figured this does nothing $xml = $doc-createElement( unidades ); //root element $doc-appendChild( $xml ); foreach ($unidades as $unidade) { $valores = get_object_vars($unidade); //all object atributes (row name/value in mysql table) $unidade = $doc-createElement( unidade ); foreach ($valores as $atributo=$valor){ //$valor = iconv('ISO-8859-1','UTF-8',$valor); // iconv messes with accented chars $node = $doc-createElement( $atributo ); $node-appendChild( $doc-createTextNode( $valor ) ); $unidade-appendChild( $node ); } $xml-appendChild( $unidade ); } $doc-appendChild( $xml ); echo $doc-saveXML(); ? The wrong thing, which correctly gives me the xml file with correct encoding and everything (just built it myself as a string, no DOM functions are used): ?php header('Content-type: text/xml; charset = ISO-8859-1'); $unidades = listarUnidadesSetor(58,1); $xml = ?xml version=\1.0\ encoding=\ISO-8859-1\?\n; $xml .= unidades\n; foreach ($unidades as $unidade){ $xml .= unidade\n; $valores = get_object_vars($unidade); foreach ($valores as $atributo=$valor){ $xml .= $atributo $valor /$atributo; } $xml .= /unidade\n; } $xml .= /unidades\n; echo $xml; ? Regards, -- Thiago Henrique Pojda
Re: [PHP] XML Encoding - with examples
On Tue, Jul 29, 2008 at 4:20 PM, Andrew Ballard [EMAIL PROTECTED] wrote: On Tue, Jul 29, 2008 at 2:33 PM, Thiago H. Pojda [EMAIL PROTECTED] wrote: babling and code -- Thiago Henrique Pojda Are you sure the accented characters you are using are part of ISO-8859-1 and not UTF-8? I don't have your data set, but I ran your code with a list of country names some of which include accented characters. It worked fine if I set the XML document encoding to UTF-8. (It even worked fine if I used the iconv line you have commented out, but I'm any XML reader that tries to use the ISO-8859-1 encoding to read the file will spit out the first character that doesn't belong to the set.) Try this word: descrição (description, in Portuguese). I couldn't get it to show correctly in Firefox and other browsers, even after sending the proper header. Is there any reason in particular that you MUST use ISO-8859-1 rather than UTF-8? The former is a subset of the latter, so I would think you'd save yourself the headache if you just used UTF-8 for everything. I need to see accented characters, I don't mind how it's going to work atm. I know UTF-8 is better, but ISO seem to suit my needs better. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Thank you for your time, -- Thiago Henrique Pojda
Re: [PHP] XML Encoding - with examples
On Tue, Jul 29, 2008 at 4:59 PM, Andrew Ballard [EMAIL PROTECTED] wrote: On Tue, Jul 29, 2008 at 3:52 PM, Thiago H. Pojda [EMAIL PROTECTED] wrote: That's weird. I just changed it to convert everything to UTF and things appear ok on IE and messy in Firefox. I guess firefox isn't been nice to my headers after all. It keeps saying the content is in ISO. Thanks for your hints and your time. I'll move this to firefox list, as the XML loads fine in IE (everything set to UTF, even the iconv is uncommented). Did you change the header call too? The header in your original example was ISO too: snip Andrew Here's the new code. Loads fine in other viewers, but firefox still think it's a ISO file and loads accented chars incorrecly. ?php header('Content-type: text/xml; charset = UTF-8'); $unidades = listarUnidadesSetor(58,1); $doc = new DOMDocument(1.0, 'UTF-8'); $doc-formatOutput = true; $xml = $doc-createElement( unidades ); $doc-appendChild( $xml ); foreach ($unidades as $unidade) { $valores = get_object_vars($unidade); //var_dump($atributos); $unidade = $doc-createElement( unidade ); foreach ($valores as $atributo=$valor){ $valor = iconv('ISO-8859-1','UTF-8',$valor); $node = $doc-createElement( $atributo ); $node-appendChild( $doc-createTextNode( $valor ) ); $unidade-appendChild( $node ); } $xml-appendChild( $unidade ); } $doc-appendChild( $xml ); echo $doc-saveXML(); ? -- Thiago Henrique Pojda
Re: [PHP] Code beautifier
On Thu, Jul 24, 2008 at 8:34 AM, Christoph Boget [EMAIL PROTECTED]wrote: Anyone know of an unintrusive code beautifier written specifically with in mind? I know of what proprietary software that does it very good: polystyle. (As usual, I'm not related to software creator or anything. I just use and like it) Regards, -- Thiago Henrique Pojda
Re: [PHP] Code beautifier
On Thu, Jul 24, 2008 at 3:07 PM, mike [EMAIL PROTECTED] wrote: On 7/24/08, Richard Heyes [EMAIL PROTECTED] wrote: Anyone know of an unintrusive code beautifier written specifically with in mind? just be prudent (and anal retentive) when you code :) That doesn't work when you get code from someone else that wasn't prudent enough ;) (or even removed code indents *sigh*) -- Thiago Henrique Pojda
Re: [PHP] Code beautifier
On Thu, Jul 24, 2008 at 3:14 PM, mike [EMAIL PROTECTED] wrote: On 7/24/08, Thiago H. Pojda [EMAIL PROTECTED] wrote: sadly, I still go and reformat other coworker's code anyway, heh. Yeah, I'm -that bad- That's why I looked for a tool like that months ago. Big project from someone else, do you feel like reformatting hundreds of files with hundreds (thousands?) of lines manually? I didn't :) -- Thiago Henrique Pojda
Re: [PHP] After INSERT form submit - Data doesn't refresh!
Code, please? :) On Tue, Jul 22, 2008 at 9:33 AM, Rahul S. Johari [EMAIL PROTECTED] wrote: Hmm, interesting. In my case, $file does indeed output dynamic data. I did try with the modified time but it still doesn't work. I still have to hit refresh on the browser, after submitting the form, in order for the inserted record to appear. Not sure what to do - it's rather annoying. Novice users of the page would assume the entry didn't get inserted or something happened. One alternate is to submit Data to a different page and let that page redirect to the Original page - but I do find it hard to believe that there is no solution to this caching. Thanks guys! On Jul 22, 2008, at 8:26 AM, Yeti wrote: The Last-Modified header tells the browser when the requested page was last modified. Now I don't know how you get the date in your case but here is an example: browser requests /test/test.php which is a simple php file without any includes etc. in this case $file = '/test/test.php'; This wont work if $file outputs dynamic data, so only use it if the content only changes when you change the file. Now if you are using templates etc. obtaining the Last-Modified time is a bit more complicated. If you use server side caching then you can chose the cached file else you have to figure it out yourself. And the RFC 2616 header specification says: An origin server MUST NOT send a Last-Modified date which is later than the server's time of message origination. In such cases, where the resource's last modification would indicate some time in the future, the server MUST replace that date with the message origination date. So do not send a future date! On Tue, Jul 22, 2008 at 2:11 PM, Rahul S. Johari [EMAIL PROTECTED] wrote: I tried with just the first three header() statements you gave, but it didn't work. Let me try the modification date ... which file is being referred to in $ffile? Also, I'm using Firefox, if it's of any consequence. Thanks! On Jul 22, 2008, at 7:30 AM, Bernhard Kohl wrote: I'm pretty sure this is a cache issue .. To disable caching: header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Pragma: no-cache'); But if you have the modification date then use $time = filemtime($ffile); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT'); On Tue, Jul 22, 2008 at 1:14 PM, Rahul S. Johari [EMAIL PROTECTED] wrote: Ave, I'm wondering if there's a PHP solution to this, I could be in the wrong place. I have an INSERT form which submits to the same php page, which also displays the records from the mySQL database the INSERT form submits to. When the form submits and the page returns, the added record does not show up unless you Refresh the page. I'm imagining even after form submit, the Browser is caching the data and displaying data from the Cache. Is there a solution to this? Is there anything PHP can do to instruct the browser not the cache the data? Thanks! --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com --- Rahul Sitaram Johari Founder, Internet Architects Group, Inc. [Email] [EMAIL PROTECTED] [Web] http://www.rahulsjohari.com -- Thiago Henrique Pojda
Re: [PHP] After INSERT form submit - Data doesn't refresh!
On Tue, Jul 22, 2008 at 9:48 AM, Rahul S. Johari [EMAIL PROTECTED] wrote: Here's what it is: I have a php page, a.php, which contains these three things: - SELECT statement to display records from a mySQL Table - HTML Form for inserting data into the mySQL Table - INSERT statement to insert that row into the mySQL Table I understand that but I don't see any caching issue yet. That's why I asked for your code, can you provide an example? :) The HTML Form submits to the same, a.php Once the user submits the Form, a.php is called which INSERT's the row into the mySQL Table. However, the row does not appear in the SELECT statement table data unless I hit refresh on the page. (The INSERT function is executed before the SELECT in the page). And does the row appear in MySQL? Regards, -- Thiago Henrique Pojda
Re: [PHP] Trailing Spaces Problem
On Fri, Jul 18, 2008 at 11:41 AM, Wei, Alice J. [EMAIL PROTECTED] wrote: Hi, Is there some way that I can have it so that it can print out: 1: 1 2:0 3: 70.208 4. 61.613 5. 1.424 I tried using \s for trailing spaces, but It all gave me output of everything in the single line. Have I missed something here? You're just removing every space there is, letting none for values separation. Just replace every \s\s with \s until there's no more \s\s. Probably some regex would be better, but that's not my area :) Regards, Thiago Thanks in advance. Alice == Alice Wei MIS 2009 School of Library and Information Science Indiana University Bloomington [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Thiago Henrique Pojda
Re: [PHP] Login without cookies enabled help
Yes, again, STFW before posting here. Google PHPSESSID. Call to undefined function Google(); -- /Daniel P. Brown :) -- Thiago Henrique Pojda
Re: [PHP] Keeping POST values when paging
On Tue, Jul 8, 2008 at 4:11 PM, Philip Thompson [EMAIL PROTECTED] wrote: On Jul 8, 2008, at 12:32 PM, tedd wrote: At 4:18 PM +0100 7/8/08, Mayer, Jonathan wrote: In the end I decided the simplest way of coding the functionality was to do something similar to what Eric said, and have some extra submit buttons in the form, called Next, Previous and Jump. When clicked, they each submitted the form again with a different flag set. Along with a session variable storing the current page, I was able to code a reasonably neat solution deciding which results to show without having to rewrite any sections of my code. Because these submit buttons are tied to a form at the top of the page, this has limited me to only having the navigational buttons at the top of the results table rather than at the bottom too, but that is perfectly fine in my situation. Jon: Actually, you don't need to use sessions, post, nor get to pass variables between scripts. Here's an example: http://www.webbytedd.com/bb/tedd/index.php Of course, the smart ones on this list will figure it out pretty quickly. I guess I'm not smart. =( If it's fairly obvious, then I'm not seeing it... ~Phil Me neither. I'm guessing: either it's using a file to transfer vars (cookie or server-written file), or... I don't know :P Regards, Thiago Cheers, tedd PS: Daniel, please don't offer hints to show how easy this is. I would like to see what others say. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Thiago Henrique Pojda
[PHP] Fwd: [PHP-DOC] ftp help
Forwarding to correct list. -- Forwarded message -- From: Dan [EMAIL PROTECTED] Date: Fri, Jul 4, 2008 at 1:56 PM Subject: [PHP-DOC] ftp help To: [EMAIL PROTECTED] I am using a php script to connect to an ftp server. However, the server requires a password change every 90 days. Any ideas on how to handle this? -- Thiago Henrique Pojda
[PHP] Re: [PHP-DOC] Network Interface Card Name
Forwarding to correct list. On Mon, Jul 7, 2008 at 10:25 AM, Kapil Kapil [EMAIL PROTECTED] wrote: No, I want the name of network interface cards of server, not of client. Thanks regards Kapil On Mon, Jul 7, 2008 at 6:38 PM, Thiago H. Pojda [EMAIL PROTECTED] wrote: That's client-side you're probably not going to do that w/o any client-side software. You should be asking this on php-general. Regards, Thiago On Mon, Jul 7, 2008 at 8:19 AM, Kapil Kapil [EMAIL PROTECTED] wrote: Hi ! I want to get the name of network interface card, like - VIA Rhine I Fast Ethernet Adapter. Is there any function in php for this or perhaps a way to find it out? Thanks Kapil -- Thiago Henrique Pojda -- Thiago Henrique Pojda
Re: [PHP] Re: [PHP-DOC] Network Interface Card Name
No, there isn't. It's a system-related info and doesn't affect how PHP works. And, IMHO, it's good that PHP is not aware of these stuff. Use exec(), `, or system() to run these commands. Regards, Thiago On Mon, Jul 7, 2008 at 2:51 PM, Kapil Kapil [EMAIL PROTECTED] wrote: This is a way, I know but does there any function in php specific to this. Thanks Kapil On Mon, Jul 7, 2008 at 10:16 PM, Thiago H. Pojda [EMAIL PROTECTED] wrote: Forwarding if you're not on this list. -- Forwarded message -- From: Shawn McKenzie [EMAIL PROTECTED] Date: Mon, Jul 7, 2008 at 12:30 PM Subject: Re: [PHP] Re: [PHP-DOC] Network Interface Card Name To: php-general@lists.php.net Per Jessen wrote: Thiago H. Pojda wrote: On Mon, Jul 7, 2008 at 8:19 AM, Kapil Kapil [EMAIL PROTECTED] wrote: Hi ! I want to get the name of network interface card, like - VIA Rhine I Fast Ethernet Adapter. Is there any function in php for this or perhaps a way to find it out? Not really a PHP question, but the answer is 'lspci'. Here's some sample output: 00:0c.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 26) 04:0a.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 26) /Per Jessen, Zürich Windows you can use: ipconfig /all Ethernet adapter Local Area Connection: Connection-specific DNS Suffix . : localdomain Description . . . . . . . . . . . : Intel(R) PRO/1000 PL Network Connection -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Thiago Henrique Pojda -- Thiago Henrique Pojda
Re: [PHP] Inspiration for a Tombstone.
trigger_error('B-bye'); On Thu, Jun 26, 2008 at 12:45 PM, tedd [EMAIL PROTECTED] wrote: Or unlink('tedd'); Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Thiago Henrique Pojda
[PHP] array_diff()?
Guys, Perhaps I'm missing something or just trying with the wrong tools... But the thing is, I have two arrays and want to know what values are in one that aren't in the other. They're very long arrays (label files for translation) -- Thiago Henrique Pojda
[PHP] array_diff()?
*accidentally sent* Guys, Perhaps I'm missing something or just trying with the wrong tools... But the thing is, I have two arrays and want to know what values are in one that aren't in the other. They're very long arrays (label files for translation) and the array_diff() is returning null, even if I force a difference. What's up? ?php $file1 = 'label_es.ini'; $file2 = 'label_pt.ini'; $fh1 = fopen ($file1,'r'); $fh2 = fopen ($file2,'r'); $file1 = array(); $file2 = array(); while (($line = fgets($fh1))) { $label = explode(=,$line); $array1[] = $label[0]; } while (($line = fgets($fh2))) { $label = explode(=,$line); $array2[] = $label[0]; } $missingLabels= array_diff($array1,$array2); var_dump($labelsFaltantes); // returns nothing var_dump($array1); // returns a lot of stuff var_dump($array2); // returns a lot of stuff ? -- Thiago Henrique Pojda -- Thiago Henrique Pojda
Re: [PHP] array_diff()?
Actually that was a miss when I was translating var names. Here follows the code again, untouched this time: ?php $arquivo1 = 'label_es.ini'; $arquivo2 = 'label_pt.ini'; $fh1 = fopen ($arquivo1,'r'); $fh2 = fopen ($arquivo2,'r'); $array1 = array(); $array2 = array(); while (($linha = fgets($fh1))) { $label = explode(=,$linha); $array1[] = $label[0]; } while (($linha = fgets($fh2))) { $label = explode(=,$linha); $array2[] = $label[0]; } $labelsFaltantes = array_diff($array1,$array2); var_dump($labelsFaltantes); var_dump($array1); var_dump($array2); ? File _pt has ~2300 lines while file _es has ~1700. Not a chance of them having the same labels :) On Wed, Jun 25, 2008 at 5:18 PM, Boyd, Todd M. [EMAIL PROTECTED] wrote: -Original Message- From: Thiago H. Pojda [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2008 3:10 PM To: php-general@lists.php.net Subject: [PHP] array_diff()? *accidentally sent* Guys, Perhaps I'm missing something or just trying with the wrong tools... But the thing is, I have two arrays and want to know what values are in one that aren't in the other. They're very long arrays (label files for translation) and the array_diff() is returning null, even if I force a difference. What's up? ?php $file1 = 'label_es.ini'; $file2 = 'label_pt.ini'; $fh1 = fopen ($file1,'r'); $fh2 = fopen ($file2,'r'); $file1 = array(); $file2 = array(); while (($line = fgets($fh1))) { $label = explode(=,$line); $array1[] = $label[0]; } while (($line = fgets($fh2))) { $label = explode(=,$line); $array2[] = $label[0]; } $missingLabels= array_diff($array1,$array2); var_dump($labelsFaltantes); // returns nothing var_dump($array1); // returns a lot of stuff var_dump($array2); // returns a lot of stuff ? Umm... Is $missingLabels supposed to be what you're var_dump()ing later in the code? Cuz you call it $labelsFaltantes almost immediately after, which has not been defined (by what I can see). Todd Boyd Web Programmer -- Thiago Henrique Pojda
Re: [PHP] array_diff()?
I just hit tab and space at once and gmail just sent it ;) Well, I'm not reaching that size, hehe. Btw, PHP Version 5.2.6 On Wed, Jun 25, 2008 at 5:19 PM, Daniel Brown [EMAIL PROTECTED] wrote: On Wed, Jun 25, 2008 at 4:08 PM, Wolf [EMAIL PROTECTED] wrote: So, where is your code that isn't working right? Yeah, come on, Thiago, show code. You know better than that! ;-P And by the way, I *believe* that as long as your arrays are = 65,355 entries - while it will be slow and may time out - it should work. So don't necessarily worry about very long arrays. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- Thiago Henrique Pojda
Re: [PHP] array_diff()?
Ok, forget everything... it was just a user (programmer) problem.. while in translation process, labels_es became a copy of labels_pt :P Sorry about the noise. PS: Hoorray: again in list _o/ On Wed, Jun 25, 2008 at 5:24 PM, Thiago H. Pojda [EMAIL PROTECTED] wrote: I just hit tab and space at once and gmail just sent it ;) Well, I'm not reaching that size, hehe. Btw, PHP Version 5.2.6 On Wed, Jun 25, 2008 at 5:19 PM, Daniel Brown [EMAIL PROTECTED] wrote: On Wed, Jun 25, 2008 at 4:08 PM, Wolf [EMAIL PROTECTED] wrote: So, where is your code that isn't working right? Yeah, come on, Thiago, show code. You know better than that! ;-P And by the way, I *believe* that as long as your arrays are = 65,355 entries - while it will be slow and may time out - it should work. So don't necessarily worry about very long arrays. -- /Daniel P. Brown Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just $59.99/mo. with no contract! Dedicated servers, VPS, and hosting from $2.50/mo. -- Thiago Henrique Pojda -- Thiago Henrique Pojda