[PHP] Re: Static and/or Dynamic site scraping using PHP
On Thu, Apr 30, 2009 at 3:33 AM, 9el le...@phpxperts.net wrote: I just got a project to do on PHP of scraping the body items from static sites or just html sites. Could you experts please suggest me some quick resources? I have to make an WP plugin with the data as well. Any expert there yet? Was looking for urgent advices on accomplishing the task. Thanks Lenin www.twitter.com/nine_L -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Static and/or Dynamic site scraping using PHP
I just got a project to do on PHP of scraping the body items from static sites or just html sites. Could you experts please suggest me some quick resources? I have to make an WP plugin with the data as well. Regards Lenin www.twitter.com/nine_L -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] inexplicable behaviour SOLVED
Thats why I used a (?) after exactly. PJ didn't have a need for the value. ;)
Re: RES: [PHP] inexplicable behaviour SOLVED
$Count = $Count + 1; is *exactly(?)* same as $Count++; Â or ++$Count But not exactly same. Â PostFix notation adds the value after assigning . PreFix notation adds the value right away. But optimized programming argues about how machine is coded nowadays. Thanks Mike for clarifying this much. Butt I already said those in brief I marked them in red now :) Lenin www.twitter.com/nine_L
Re: [PHP] utf-8 ?
I think you should switch to utf8-general-ci all the way.
[PHP] Re: utf-8 ?
I looked at http://developer.loftdigital.com/blog/php-utf-8-cheatsheet which suggests this: ALTER DATABASE db_name CHARACTER SET utf8 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT COLLATE utf8_general_ci ; ALTER TABLE tbl_name DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ; or I could do it with phpMyAdmin, right? and the only difficulties would appear to be fixing any accent stuff (don't know yet just what) and that would only be time consuming. I guess I'm just looking for reassurance that I don't muck up anything and then have to do tortured acrobatics to redress things again. :-) Changing to UTF8 is time consuming but if programming can be used it would ease the effort. I have seen a WP plugin for that as well. And in phpmyAdmin you'll have to set the collation for all fields and tables one by one. :) Regards Lenin www.twitter.com/nine_L
Re: RES: [PHP] inexplicable behaviour SOLVED
Thanks for the clarification, Mike. In my ignorance, I was under the impression that the right side of the equation was only for the use of the left part. How stupid of me. So what I should have been doing was $Count1 = $Count + 1; right? $Count = $Count + 1; is exactly(?) same as $Count++; or ++$Count But not exactly same. PostFix notation adds the value after assigning. PreFix notation adds the value right away. But optimized programming argues about how machine is coded nowadays. Anyway, I don't need that statement anymore as I found the error of my ways and have corrected it. And behold, the light came forth and it worked. :-) Regards Lenin www.twitter.com/nine_L www.lenin9l.wordpress.com
Re: [PHP] Re: utf-8 ?
I think some time ago I used combination of mysqldump and iconv, some minor editing, and then pumped it back into the database. I think if the dump is not too big your trick will yield good results. What do you do for really large DB cases? Regards Lenin www.twitter.com/nine_L www.lenin9l.wordpress.com
[PHP] Re: utf-8 ?
I just converted all, or thought I did. phpMyAdmin: in the structure view of the db show Collation as latin_swedish_ci ??? in the individual table structure views the fields show utf-8 general ??? I don't see any difference on Firefox running on FreeBSD but it show correctly on Wimpy XP ??. In the web page the accent for French shows as a ? within a white diamond on FBSD. In the database the entry is the French chatacter with the accent. I'm now trying to figure out how to enter the accents on FBSD in Firefox. Nuts! This is torcher. How does one become truly international? Without much argument you should just follow What Robert has told Just dump your db and you can replace the collate to desired one and then put back in DB server et voila!
Re: [PHP] Re: utf-8 ?
On Tue, Apr 28, 2009 at 1:50 AM, Tom Worster f...@thefsb.org wrote: On 4/27/09 11:17 AM, PJ af.gour...@videotron.ca wrote: phpMyAdmin: in the structure view of the db show Collation as latin_swedish_ci ??? maybe a phpmyadmin feature? check it with the mysql client. when i did the conversion* it came out looking just right in phpmyadmin. *i followed instrunctions here: http://dev.mysql.com/doc/refman/5.0/en/alter-table.html Hey Tom Also share your findings plz :) regards Lenin www.twitter.com/nine_L
Re: RES: [PHP] inexplicable behaviour
I have pagination set up and the number for pages next has a link but the next does not. I have experimented with all sorts of configurations of the code but the only thing that works (and this is totally off the wall) is to do this *$Count* = *mysql_num_rows($results);* $Count1=*$Count++;* // without this, the next does not do the link--- but there is no other $Count1 in the code either in the original page or the include page. the script should work even if u replace $Count1 = $Count++; with $Count++; There's a NICE video tutorial available on pagination over the internet. You should watch it. You are counting the number of rows of a result. And you are asking to increase the count by 1. :D Thats not realistic. pagination is done with the help of mySQL's * LIMIT recNUMBER, count* * Look for Pagination with PHP + MySQL and watchit http://www.google.com/url?sa=tsource=webct=rescd=10url=http%3A%2F%2Fwww.bestechvideos.com%2F2008%2F07%2F02%2Fsampsonvideos-php-pagination-part-2ei=ohn0SdnlL8KLkAWQrNTbCgusg=AFQjCNEGKOIG3791BpgeVqCiiq5-cikbRA Dont miss this SampsonVideos . PERIOD *Regards Lenin www.twitter.com/nine_L www.lenin9l.wordpress.com
Re: [PHP] How can I detect an exception without using try/catch?
What would be nice is a function like get_current_exception() that would either return the current exception object, or return false if there is no exception. I guess the try catch pair works like this: you try to run a part of script which you know it could be under errors You tell your boy to play(but a bulley comes often): try { Go boy try to play } catch (street_bulley_came) { do not cry or dont swear at the bulley dont be afraid } Lenin www.twitter.com/nine_L
Re: [PHP] error with hosting
On Fri, Apr 24, 2009 at 7:41 PM, Jan G.B. ro0ot.w...@googlemail.com wrote: 2009/4/24 Andrew Ballard aball...@gmail.com: On Tue, Apr 21, 2009 at 1:20 PM, Jan G.B. ro0ot.w...@googlemail.com wrote: Do yourself a favour: * remopve that 1337 hax0r name - it makes you look like a dumbass This coming from someone whose e-mail address is ro0ot.w...@? Sounds a little ironic. ;-) Got me. ;) But try to find any free google-name like Jan, etc.. I was looking for something with root in the address. and actually this is only the address, not my NAME. HAHAHAHA you gotta look at this :D http://tr.im/jxK7
Re: [PHP] Re: unzip a file - destination folder wrong
snip $fp = fopen(dirname($filename) . '/' . zip_entry_name($zip_entry), w); thank you this worked. How come the . '/' . zip_entry_name($zip_entry) is needed? Looks like a double file name, but the result is ok. Could you explain this line? /snip read carefully, you'll understand too. :) its extracting the directory name with the dirname($filename) then concatenation with the name of zip file only :) regards Lenin www.twitter.com/nine_L
Re: [PHP] @$_POST[...]
Rather than looking for cheatsheets you should read the ZCE preparation guide book and PHP manual. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ! and !=
On Thu, Apr 23, 2009 at 4:30 AM, George Langley george.lang...@shaw.ca wrote: Hi all. Maybe I'm just getting confused by all the languages I'm trying to work with! But, isn't: if(!$var1 == $var2){ Means if (NOT($var1) == $var2) the same thing as if($var1 != $var2){ means $var1 NOTEQUALS $var2 #1 doesn't work, #2 does. :) Lenin www.twitter.com/nine_L -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unable to send mail from PHP to ATT e-mail address
Does ini_set actually change the php.ini file in any way ? The reason I ask is that after putting in: Yes it does. :)you should have refered to the manual before using the line. Did you write your own myem...@myserver.com? or you kept that exactly like in code? ini_set('sendmail_from', 'myem...@myserver.com'); into a new script which I tested out against, the 'mail' function now continues to work but no e-mail is received no matter what the recipient e-mail is. Even is I go back to using my old script which does not have the 'ini_set' in it, no e-mail actually gets receoved even though 'mail' succeeds when called. So I have gone from bad to worse and the ini_set seems to have affected all calls to 'mail' in this way for PHP scripts on the server. Can I correct but somehow stopping PHP ( or may Apache ) and restarting it again to bring back the original php.ini setting ? For now you can go back to set the php.ini to default with the ini_set function. You can use ini_get to retrieve data from the php.ini configs a phpinfo() will show you all the current settings. Regards Lenin www.twitter.com/nine_L -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] @$_POST[...]
On Thu, Apr 23, 2009 at 5:26 AM, PJ af.gour...@videotron.ca wrote: 9el wrote: Rather than looking for cheatsheets you should read the ZCE preparation guide book and PHP manual. That's a lame duck response. I'm not stupid enough to not search and try to find answers on G and in the manuals tutorials. They are not always obvious so I often rely on the great guys on this list to clear things up. And I have no ide what ZCE is nor do I really care. I'd call you a lame duck just for now. Cause, you could have asked Google what ZCE is. And if you should like programming in PHP you should care about the ZCE as well. ZCE means Zend Certified Engineer. And I refered to that book because that book helped me preparing for that exam. Which covers really important best practices PHP Developers should be aware of. I am not giving you more info as you said you can use Google. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is wrong with this code
But in practice. I mean in real life you'll find the mail() function is disabled in most servers :)
Re: [PHP] php isn't displaying mysql query correctly
On Fri, Apr 17, 2009 at 10:23 PM, Shawn McKenzie nos...@mckenzies.netwrote: Adam Williams wrote: Shawn McKenzie wrote: No. How about: while ($row = mysqli_fetch_array($mysqli_get_support_types_result)) { echo option.$row['types']; } thanks, now that you provided that, I see that I left out the $row variable! And for the explanation, you set $mysqli_get_support_types = Select types from support_types order by types; So when you echoed $mysqli_get_support_types[types], and it wasn't an array and PHP didn't know what types was, it gave you the 0 index of the string which is S. And next time before complaining if you do echo print_r($variable) or echo var_dump($variable) would save you lots of headaches :) Lenin www.twitter.com/nine_L
Re: [PHP] Let me google that for you.
If you play with jQuery its easy. And if you talk about JavaScript's urlencode functionality you wont ask about 'how to remove the + sign' I'm not very good yet on jQuery or else I would have shown you the codes.
Re: [PHP] Need Your Help :) I'm Just About Creating File Uploading Service
Its Amazon S3 service. Which takes care of your CPU and scaling needs of bandwidth. Good for CSS, JS and Image storing.
Re: [PHP] $_GET verses $_POST
One thing you should know is that when you use $_GET, you'll be sending a little information about the particular page to the browser and therefore it would be displayed in the address bar so for example if you're using get on a login page, you'll be showing user id and passwrod in the address bar. $_POST does the exact opposite of $_GET in that aspect and it's ideal. $_REQUEST does both. Its also important to know that some critical information like multipart meta data cant be sent via get. And GET method is not safe too. Large chunks of data are sent via POST method. $_REQUEST is not advised to use for security reasons.. there are senior and experienced programmers here who will elaborate more onto this :)
[PHP] Suggestion on .htaccess
This is a .htaccess for a MU blog the index file is kept at : public_html/ And main blog is kept at: public_html/blog It is causing severe cache issue. SuperCache plugin is not working. The blog is running out of memory most of times and consuming huge CPU. Any suggestions? # BEGIN WPSuperCache IfModule mod_rewrite.c RewriteEngine On RewriteBase /blog/ AddDefaultCharset UTF-8 RewriteRule ^(.*) /blog/wp-content/cache/%{HTTP_HOST}/blog/$1/index.html.gz [L] RewriteCond %{REQUEST_URI} !^.*[^/]$ RewriteCond %{REQUEST_URI} !^.*//.*$ RewriteCond %{REQUEST_METHOD} !=POST RewriteCond %{QUERY_STRING} !.*=.* RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress|wp-postpass_).*$ RewriteCond %{HTTP:Accept-Encoding} gzip RewriteCond %{DOCUMENT_ROOT}/blog/wp-content/cache/%{HTTP_HOST}/blog/$1/index.html.gz -f /IfModule # END WPSuperCache #uploaded files RewriteRule ^(.*/)?files/$ index.php [L] RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L] RewriteCond %{REQUEST_URI} !.*wp-content/plugins.* # add a trailing slash to /wp-admin RewriteCond %{REQUEST_URI} ^.*/wp-admin$ RewriteRule ^(.+)$ $1/ [R=301,L] RewriteRule . - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] RewriteRule .* /blog/index.php [L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d IfModule mod_security.c Files async-upload.php SecFilterEngine Off SecFilterScanPOST Off /Files /IfModule
Re: [PHP] Random php
On Sun, Apr 12, 2009 at 1:32 AM, Gary gwp...@ptd.net wrote: I had been on that site before, but seems like it is a breeding ground for spam and links to free commercial sites. Ran into a few bad or broken links, several listings as different scripts only to take you to the same best price hosting company with no scripts at all. Is this common, is that site on its way out? Would you have another suggestion? Well, I also browsed through that site.. yes what you claimed is true. Facility/Opportunity comes with a price. So, you can go through the ads/sponsors but there are working examples/free code snippets as well. Just googling with that random quote php could yield you a lots of practical results. Regards Lenin www.twitter.com/nine_L
Re: [PHP] Additional support for your family!
2009/4/12 Forest Bennett tha...@psv.com.vn Good day, Dear Mr. or Ms! Are you in need for money but you don't have the time and nerve for a secondary job? Here is your chance to be part of a program that is taking traditional marketing research in a brand new direction, with the ease of the Internet technologies! Our participants are always rewarded for their precious opinion. Here is what amounts you can earn: - From $5 to $100 per online survey - From $50 to $200 for an online focus group discussion - From $30 to $120 per product and service evaluation Please excuse us if this letter is unwanted for you or we have disturbed you in some way, but this inquiry is serious and sincere! Please reply to 1485keenan.sm...@gmail.com for further information. Join us now because the places are limited! Best regards, Consumer Opinion Administration -- This email has been written and proved to be in compliance with the recently established can-spam act law in US. We are not provoking or forcing any person in any way to participate in our programs. To participate is your own decision and you carry the responsibility of taking further part in this promotion. Anyway, if you don't want to receive more good offers from us, you can simply Unsubscribe by sending us a notification email to out_of_the_l...@yahoo.com with a mail-subject and text Unsubscribe me, and we will get your email out of our list within 10 days. This message is STRICTLY CONFIDENTIAL and is solely for the individual or organisation to whom it is addressed. It may contain PRIVILEGED and CONFIDENTIAL information. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication and its contents is strictly prohibited. If you are not the intended recipient you should not read, copy, distribute, disclose or otherwise use the information in this email. Email may be susceptible to data corruption, interception and unauthorised amendment, and we do not accept liability for any such corruption, interception or amendment or the consequences thereof or your reliance on any information contained therein if you are not the intended recipient. If you are not interested in the offered promotions, please just don't answer. If you think you have received this message and its contents in error, please delete it from your computer, or follow the unsubscribing procedure shown above. -- Ah! could you just pay in my paypal? bluh!
Re: [PHP] wana join ur group
Welcome Sabrina, you are already in the giant php mailing listin the world. Enjoy Questioning here. Regards Lenin www.twitter.com/nine_L -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] codeigniter 'secure, non-secure content' pop up message in IE7
On Thu, Apr 9, 2009 at 6:56 PM, Jan G.B. ro0ot.w...@googlemail.com wrote: 2009/4/9 Yannick Mortier mvmort...@googlemail.com: 2009/4/9 9el le...@phpxperts.net: -- Forwarded message -- From: Sabrina Akter lizzeel...@gmail.com Date: Thu, Apr 9, 2009 at 1:12 AM Subject: codeigniter 'secure, non-secure content' pop up message in IE7 To: phpexpe...@yahoogroups.com Hello Experts, I badly need your help. My developed site's some pages are HTTPS, and other parts are HTTP. When I try to access the HTTPS page in IE it comes up with secure non-secure content warning. I search on google to find out the solution. but almost every site suggest to change the IE setting. But, its not wish way to tell every visitor's to change the IE setting. So, I want to stop this message with some coding. while searching, I found some advice to make all image to HTTPS, for https pages, I followed that, but still i am getting this same pop up warning. Is there any other way to solve my problem? Any one can help me on it? Please do reply. With Regards Sabrina Akter Web App. Developer 'IBACS' - www.ibacs.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Look at the generated source code and try to find any files that are included by absolute URL (search for http://) those have to be eliminated. Make sure everything uses relative paths or comes over SSL. Yes. or absolute paths without protocoll and host. ;) works: src=/foo.bar src=./foo.bar src=https://otherserver/foo.bar; And also be on the lookout for blank src= attributes like in a iframe iframe src= id=foo A bug in IE will show the mentioned popup when you have such code. Solution: src=javascript:void(0) Bye Great ! making all img, CSS, js to https solved it :)
Re: [PHP] Am I being hacked?
On Wed, Apr 8, 2009 at 8:04 PM, Bob McConnell r...@cbord.com wrote: On Behalf Of Richard Heyes I set up a simple form to save comments on my webpage, and after just one day of going live, i'm getting weird comments up like this declare @q varchar(8000) select @q = 0x57414954464F522044454C4159202730303A30303A313027 exec(@q) I don't recognise this code - is this an attempt to do something nefarious, or nothing I should worry about? Looks like it may be. As long as you escape you SQL correctly using mysql_real_escape_string() or the equivalent, you should be OK. Let me see if I got this right. The data you got from the form tries to set up a local variable, assigns it a hex string as a value, then tries to execute it. That definitely looks like an attempt to crack your server. It looks like the semi-colons were removed somewhere, so none of it actually runs. But you would probably need a set of dis-assemblers to find out what CPU that code was written for and what it actually does. Next question: You said there are multiple comments like this. How do they differ, if they do? Possibly they are trying code for different CPUs. Did you trace these back to the logs to see if they all come from one IP or subnet? Is there anywhere to report these attempts that would actually do any good, or should you just ban that IP. But this one goes into my journal as something to be prepared for. I think the danger these codes have should be discussed well. And how to resist such attacks in your server and apps should also be discussed in greater depth. regards Lenin www.twitter.com/nine_L
[PHP] codeigniter 'secure, non-secure content' pop up message in IE7
-- Forwarded message -- From: Sabrina Akter lizzeel...@gmail.com Date: Thu, Apr 9, 2009 at 1:12 AM Subject: codeigniter 'secure, non-secure content' pop up message in IE7 To: phpexpe...@yahoogroups.com Hello Experts, I badly need your help. My developed site's some pages are HTTPS, and other parts are HTTP. When I try to access the HTTPS page in IE it comes up with secure non-secure content warning. I search on google to find out the solution. but almost every site suggest to change the IE setting. But, its not wish way to tell every visitor's to change the IE setting. So, I want to stop this message with some coding. while searching, I found some advice to make all image to HTTPS, for https pages, I followed that, but still i am getting this same pop up warning. Is there any other way to solve my problem? Any one can help me on it? Please do reply. With Regards Sabrina Akter Web App. Developer 'IBACS' - www.ibacs.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP and Send Mail
On Thu, Apr 9, 2009 at 7:19 AM, Shawn McKenzie nos...@mckenzies.net wrote: Alejandro Esteban Galvez wrote: Hi!, I am making a web system and i need known how send a mail using PHP Hi, Use PHPmailer or PEAR:mail() And I'm Lenin Bye :) www.twitter.com/nine_L -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best Practices for Hiding Errors
Intead of displaying errors to page. Its better to use error log file. And as @ error suppressors are expensive its always better if you can avoid using them. I'd also suggest the ZCE(Zend Certification Engineer) Exam Guide for this matter for best practices. Regards Lenin www.twitter.com/nine_L
Re: [PHP] PHP bandwidth control
I hate the bulky interface of Godaddy.com its too tough for slower connections to work with GoDaddy's control panels. Their domain charge seems bit high as well. But I'm liking www.umbrahosting.com it has good cPanel and controls are good. Their support are very sprint. Lenin www.twitter.com/nine_L
Re: [PHP] Newibie: fetch Obj question - data not showing.
On Sun, Apr 5, 2009 at 10:08 PM, MEM tal...@gmail.com wrote: Hello, 1) Ok, with mysqli, to fetch data from a database to a select drop down list, we would do something like this right? : ?php $result = $mysqli-query(SELECT id_cliente, nome_cliente FROM cliente); echo select id='listacliente' name='listacliente'; while($row = mysqli_fetch_assoc($result)) { echo option value=.$row['id_cliente']..$row['nome_cliente']./option; } echo /select; ? 2) What I’m trying to achieve? The same thing, but using PDO, the prepare/execute methods, and FETCH_OBJ method to fetch data. 3) Here is what I have done so far: For simplifying I’m just trying to echo: $queryh=$conn-prepare('SELECT id_cliente, nome_cliente FROM cliente'); $queryh-execute(); /*trys to access the method fetchObject of the PDOStatement generated by the execute() PDO method, and save it on $row variable:*/ $row=$queryh-fetchObject(); /*now I'm trying to echo the results. The 'id_cliente' and 'nome_cliente' are the column names of my database and, if I get it right, the fectchObject() method should allow me to access those names as anonymous properties. So: */ echo Id: .$row-id_cliente. - Nome: .$row-nome_cliente./ br; 4) Here is the issue that I’m getting: I’m getting no values from the database upon echo request. 5) Question: What is wrong with this code? :( There is something definitely wrong with your code. But why did you forget to use the debugging functions : print_r() and var_dump() for the results? So, you'll get some idea beforehand of posting the problem here. I am looking at the code in a hurry so I cant help you much right away. Lenin www.twitter.com/nine_L
Re: [PHP] Newibie: fetch Obj question - data not showing.
Because I’ve never debug on my entire life of programming (2 months). :D In the meanwhile, I will search how to debug using print_r and var_dump. ROFL ha hahaha echo 'pre', print_r($array),'/pre'; // here pre is used to keep the way its outputed in HTML echo 'pre', var_dump($array),'/pre'; please dont forget to study the online php manual and also the php_manual.chm version downloaded to your PC. Its never a good idea to not to debug.
Re: [PHP] PHP bandwidth control
On Mon, Apr 6, 2009 at 10:09 AM, Paul M Foster pa...@quillandmouse.comwrote: On Mon, Apr 06, 2009 at 03:58:45AM +, JD wrote: Hello, I am relatively new to PHP and am trying to make a video/image sharing site for my family to upload and share family videos and pictures. My concern is that because I'm hosting this site at my house, I will quickly exceed my bandwidth limitations each month if all the family members I think will use the site do actually end up using it. What I'd like to do is set up each family member with their own login and track how much bandwidth they use and cap it after a certain amount. The login stuff is easy and I have that figured out, but I haven't been able to figure out a good way to track the bandwidth used by each user that logs in. Is there a good way to do this with PHP? Modlogan, Awestats, webalizer these are some tools for measuring such. Also there's cPanel software which tracks per account. and why dont you use services like Youtube/Viddler for that purpose?
Re: [PHP] I'm new
Hello people, Is my first time that I try to do a web page with PHP and I don't have Idea how I can do, but I read something tutorial and I can see that is not difficult, I hope that I can do, what I need to work ??? with PHP and MYSQL ??? Where I can to get this software because I go to www.mysql.com and I download mysql for win 32 MSI and I install in my pc but I can't see nothing !!! only MYSQL 5.1 -- (mysql command line client) (mysql manual) and (mysql server instance config wizard) and How I can work with mysql ?? and I download the php for www.php.net and only install me in my all programs PHP 5 and inside I just only see License and PHP.ini O download and installer APACHE 2.11 1st- download APACHE and install it 2nd- download mysql and install it 3rd- donwload PHP and install it It is correct this way ?? I read a tutorial with this ways, but when I create a name.php page and put inside of apache server program files--apache--htdocs if I try to open with firefox, it shows me the source inside the page, and wioth internet explorer don't open me, it only show me a blank page, Anybody can help me please ?? I want to do web page and I have no idea. Download a full suite of PHP+MySQL+Apache and other tools bundled together from www.apachefriends.de watch the marvelous video tutorials from www.nettuts.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I'm new
snip Hi Roly, As previously advised, the best you can do to get started is to install a bundle http://www.apachefriends.org/en/xampp-windows.html If you are a native Spanish speaker (I'm guessing, because of your salu2) check the PHP-MySQL tutorials here http://www.illasaron.com/, you can find single lessons or full courses on the left sidebar here http://www.illasaron.com/html/ and a supporting forum here http://www.illasaron.com/phpBB2/viewforum.php?f=24. You'll need to register for accessing the direct downloads, registering is free (there are also .torrent downloads for the illasaron courses at thepiratebay.org) Regards, Rob /snip Rob, please keep the mail to the list. It came to me individually only! where as I didn't ask for the solution :)\ Well, yes ApacheFriend's XAMPP is one of the best suites ever with lots of things in there. And www.nettuts.com just last month released really nice tutorials for beginners on PHP so thats really recommended if anyone wants to start learning PHP + MySQL Regards Lenin www.twitter.com/nine_L -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ms-word reading from PHP on linux O.S
On Tue, Feb 24, 2009 at 1:38 PM, Per Jessen p...@computer.org wrote: Srinivasa Rao D wrote: Hi all, * How better, i can read ms-word doc files from PHP on LINUX OS*. [snip] *Is there are any other softwares that can fetch text from MS-WORD file?.* Word documents reading using COM in PHP have a look http://drewd.com/2007/01/25/reading-from-a-word-document-with-com-in-php Lenin www.twitter.com/nine_L
Re: [PHP] Oracle's dump to MySQL
On Fri, Apr 3, 2009 at 3:47 AM, Chris dmag...@gmail.com wrote: 9el wrote: I found this command from one guy for importing Oracle's dump to MySQL Shell mysql -uroot db_name -vvf oracle_dump.dmp But, v is for verbose and f is for force continuation. Anyone worked with Oracle and MySQL? Yep, and there's no way that will ever work except for the very simplest table and data. The datatypes are different (mysql doesn't have varchar2, timestamp formats are different though oracle lets you change that). You'll need to do a schema-only dump, convert it to the mysql format, then worry about converting the data. Yes, before writing the mail I had this confusion but as my max_packet_allowed was default to 16M I couldn't have been able to continue with 28M dump from Oracle. Now that I have the schema in MySQL already. What can I do to get data only from Oracle's DB? There are lots of software tools out there but I want to learn it from the base. I cant afford to buy any software either. -- Postgresql php tutorials http://www.designmagick.com/
Re: [PHP] Oracle's dump to MySQL
On Fri, Apr 3, 2009 at 5:21 PM, Phpster phps...@gmail.com wrote: Extract to csv/XML? My main goal is to import the data from Oracle DB to mySQL for a live site I wrote in php. I dont know a better way to do that.
Re: [PHP] Oracle's dump to MySQL
On Fri, Apr 3, 2009 at 8:56 PM, Bob McConnell r...@cbord.com wrote: On Behalf Of 9el The strategy depends on how complicated the database is. If it is single table, then Oracle can export that to a CSV file which MySQL can import. You simply have to make sure the column types match. If it is more complex, then you need to spend some time translating the relationships from the Oracle schema into a MySQL schema. There is no one to one correspondence here, in spite of the promises of the SQL standards. Once you have done that, you may still be able to use the CSV files, but will need to determine what order to import them and how to restore the relevant indexes. I think this idea solves it a lot. i have like 4 to 7 tables only and both database has the same schema. So, CSV would be a good idea. I just thinking of a better idea to eliminate manual tasks it involves here. And reading from CSV, that I can manage with phpCodes or using the params in MySQL. READ Local INFILE Bob McConnell
Re: [PHP] What is wrong with this code
*Note:* It is worth noting that the mail() function is not suitable for larger volumes of email in a loop. This function opens and closes an SMTP socket for each email, which is not very efficient. For the sending of large amounts of email, see the » PEAR::Mail, and » PEAR::Mail_Queue packages. * Note:* The following RFCs may be useful: » RFC 1896, » RFC 2045, » RFC 2046, » RFC 2047, » RFC 2048, » RFC 2049, and » RFC 2822. Copy from PHP Manual.
Re: [PHP] What is wrong with this code
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Sat, Apr 4, 2009 at 1:56 AM, Gary gwp...@ptd.net wrote: Peter I had the if ( isset( $_POST['submit'] ) ) { in there and it did not work. input name=submit type=button value=submit //form shouldn't this be submit? Ray notified you of this try it out :)
[PHP] Oracle's dump to MySQL
I found this command from one guy for importing Oracle's dump to MySQL Shell mysql -uroot db_name -vvf oracle_dump.dmp But, v is for verbose and f is for force continuation. Anyone worked with Oracle and MySQL?
Re: [PHP] Re: today i found the best function I've ever seen
It's in the upcoming retrograde release: PHP 3.11 (For Workgroups). Sweet! Will that improve security? What about right mouse button, will it remove it? Not sure about that, but I heard it should fix the bug with my new mouse and the center button tilt clicker thingy I think threads unless renamed, could misguide non-native ppl like me. Should rename it like : PHP Oddest jokes ever :P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form to pdf
On Wed, Mar 18, 2009 at 3:48 AM, Gary gwp...@ptd.net wrote: Is it possible to create an online form, that when filled out the fields will can be placed in a pdf form? Yes possible. But you wrote the query in a bit confused way. Trying to rephrase yours: you want a form which will let user choose a working form to be placed in a PDF to be generated? www.twitter.com/nine_L -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to catch fatal errors
On Mon, Mar 16, 2009 at 3:51 PM, Tanoor Dieng newstan...@gmail.com wrote: Hello every body, I'm currently working on a very high traffic web sites. I often get a fatal error in production about memory Allowed memory size of ... exhausted. Unfortunately, I can not reproduce this fatal error in developpement environment. Understandable why you cant reproduce the error. It gets generated when lots of queries has been done. Working on single environment is difficult to generate that. The main reason for that is that I don't know the php script which causes the error. You can do loadtesting or unit testing on the php scripts. Php only tell me on which file, the error has appeared, but I don't know the orginal php script which were called. I've tried some hacks, like the register_shutdown_function one. This hack allows me to catch almost all fatal errors, except one which says Allowed memory site of ... Any idea about how to catch this error? Would be a better idea to consult an experienced Web Application Architect who would sense the weaknesses of the codes and would suggest the reworks to make them optimized. Would be a hectic job for inexperienced developers. Lenin www.twitter.com/nine_L www.lenin9l.wordpress.com
Re: [PHP] left join does not work, why?
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Sun, Mar 15, 2009 at 7:02 PM, PJ af.gour...@videotron.ca wrote: Daniel Brown wrote: On Sat, Mar 14, 2009 at 19:51, PJ af.gour...@videotron.ca wrote: $sql1 = SELECT b.id, b.title, b.sub_title, b.descr, b.comment, b.bk_cover, b.copyright, b.ISBN, b.language, b.sellers, c.publisher, --- CONCAT_WS(' ', first_name, last_name) AS Author FROM book AS b LEFT JOIN book_author AS ab ON b.id = ab.bookID LEFT JOIN author AS a ON ab.authID=a.id LEFT JOIN book_publisher as abc ON b.id = abc.bookID // --- LEFT JOIN publishers AS c ON abc.publishers_id = c.id // --- ORDER BY title ASC ; $result1 = mysql_query($sql1, $db); $bookCount = mysql_num_rows($result1); For this and future problems of a similar nature, the quickest and easiest way to start debugging is to change the mysql_query() line to output the error. Like so: ?php // $result1 = mysql_query($sql1,$db) or die(SQL: .$sql1.\n.mysql_error()); // ? If the query fails on $sql1, PHP runs the 'or' as a failure fallback and dies by printing the SQL query given and MySQL's error response. Thank you for that. I had not used that as I thought that error_reporting(E_ALL); ini_set('display_errors', 1); would be enough. =-O The error reported now is to check the syntax near the commented out lines. So, what is going on here? I understood that when the lines are commented out they are not lprocessed. When I deleted the commented out lines the errors went away. :P This does not make sense and obviously could be very misleading in debugging. -- unheralded genius: A clean desk is the sign of a dull mind. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: 2 forms, same page, 1st is file upload - works in IE, 'dies' in non-IE browsers
It sounds like a script error rather than a PHP error. Use Firebug which will show you the HTML as it is updated by Javascript, so you can see where the problem is. I'm willing to bet that the Javascript code you are using is IE only. Yeah, php is never browser specific. It is rendered to HTML before browser can see it. So all browsers will react the same with PHP. But will differ on the client sides like JavaScript.
Re: [PHP] English Website That Can Display Some Chinese Text
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Sat, Mar 14, 2009 at 5:01 AM, revDAVE c...@hosting4days.com wrote: I have an English website done using PHP mySQL. In addition I would like to be able to store in mySQL and display/edit (php) some extra fields that have some basic Chinese text. I imagine I would have to update the main site to use English Chinese somehow... Q: Is something like this possible? If so how is this done...? Is there something special that needs to be done with PHP mySQL? Did you try UTF-8 for both HTML mode and MySQL -- Thanks - RevDave Cool @ hosting4days . com [db-lists 09] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] More PHP Includes
On Wed, Mar 11, 2009 at 6:16 AM, Gary gwp...@ptd.net wrote: Jochem Thanks for your reply, the project seven and DW was just for a point of information, same as if you have an issue with a computer you generally find it a good idea to list your operating system and other pertinent facts. What Jochem told is true, IDEs like DW is good for mainly designers but could be a feeder for a matured man (coder). For IDE I support using something like Netbeans PDT. I had coded the scripts and files by hand. The way you asked about the files you included reflects you have some basic lack of understanding of the way they should look like /organized(not intended any slightest offense). But this discussion would open your eyes. The file where your include other files is rendered as a single HTML file so, think in that way, it would be just easy to understand. The file was not on the server and it did not point back to my hard drive, it was hand coded and not uploaded to the server, which is why it was curious. Yes this curiosity is really helpful. As I mentioned about the intrusion probability this way. Try collecting the ZCE exam Guide and you can study the 'Security' Chapter there. Jochem Maas joc...@iamjochem.com wrote in message news:49b6fddd.20...@iamjochem.com... Gary schreef: I'm sorry you were not able to understand the questions, but thank you for trying. a few tips: 1. don't assume people know what 'projectseven PMM' 2. it's doubtful anyone worth their salt on this list uses or knows much about a mind-bending, soul-destroyer like DreamWeaver. 3. try your hand at building a page by hand using a simple text editor and copious ammounts of searching/reading about HTML structure ... doing it this way will help you to understand what goes wrong and why, when DW tries to 'help you'. The path to the include is not an absolute path. then it is on the server, somewhere on your php include_path. Jochem Maas joc...@iamjochem.com wrote in message news:49b6b6d8.7050...@iamjochem.com... Gary schreef: Thanks again for all the help. I created a simple page of all includes (header, menu, 3 columns). I mixed the file types up. The menu (projectseven PMM) I saved as a library item, works fine. Had an HTML file in there, but I am guessing that having 2 page declarations along with an extra set of head and body tags was playing havoc with the code, so I removed them. Same thing when I created a php page and saved it as filename.inc.php, so I removed all the declarations and tags, again seems to work fine. Also included a simple .txt file. I did get some strange results in that all of the tags were highlighted after the menu, and I had to remove and insert again to correct. So is this the best way, to create a php page, remove all of the html tags and page declarations and name it filename.inc.php? (I'm using DW CS3) I'm quite sure I don't understand any of that ... so I'd hazard a guess and so no it's not the best way Also, something I do not understand, I included a small txt file in a page of a customer and it shows fine, however this file is not on the server...is this normal? it's probably pointing to a file on your machine, e.g. file://C:/path/to/file.txt, that's something you see quite often with DW/FrontPage/insert WYSIWYG-PITA-editor here. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Working directory of PHP pages?
On Thu, Mar 12, 2009 at 11:47 AM, Clancy clanc...@cybec.com.au wrote: Something Stewart said the other day made me realise that there was a fundamental error in the way I was thinking about this question. I had been thinking that opendir (.) opened the root directory, and that paths such as Joe/Nurg.com were relative to the root directory, but I now realise that they are relative to the current directory, whatever that might be. (Yes; I should have known better, but there is an awful swamp of burnt out brain cells at the bottom of my brain.) a dot (.) denotes a current directory and double dot (..) denotes parent directory of the current in DOS/Windows/*nix File System. So the question I should have asked was When a web page is loaded, can I rely on the CWD being the directory containing index.php (or whichever file is actually loaded)? Thank you all for your assistance.
Re: [PHP] More PHP Includes
On Tue, Mar 10, 2009 at 7:59 PM, Gary gwp...@ptd.net wrote: Thanks again for all the help. I created a simple page of all includes (header, menu, 3 columns). I mixed the file types up. The menu (projectseven PMM) I saved as a library item, works fine. Had an HTML file in there, but I am guessing that having 2 page declarations along with an extra set of head and body tags was playing havoc with the code, so I removed them. Same thing when I created a php page and saved it as filename.inc.php, so I removed all the declarations and tags, again seems to work fine. Also included a simple .txt file. I did get some strange results in that all of the tags were highlighted after the menu, and I had to remove and insert again to correct. So is this the best way, to create a php page, remove all of the html tags and page declarations and name it filename.inc.php? (I'm using DW CS3) If you think of the whole layout you know how to place the tags. that is there cant be two html tags or two body tags etc. So, it should be maintained well, that tags dont break and the html gets valid and you do have working and expected output. Also, something I do not understand, I included a small txt file in a page of a customer and it shows fine, however this file is not on the server...is this normal? As mentioned, for security reasons its not wise to include files without .php extentions. you should include like myincludefile.inc.php or sometext.txt.php etc. As you said you are allowing the txt file from outside the server, it is another security risk as well. allow_url_fopen lets this to open others file. But lets say the file is at the hand of a bad guy, and he modifies that with malicious code to intrude into your server. Please read php Security issues to know about them in details. CSRF, XSS, ClickJacking, Phishing, Code-injections, SQL injections etc etc etc. http://shiflett.org/ for PHP Web Security issues is a must read. also http://phpsec.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] whoami explanation
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Wed, Mar 11, 2009 at 12:34 AM, Paul M Foster pa...@quillandmouse.comwrote: On Tue, Mar 10, 2009 at 12:00:16PM -0300, Eduardo wrote: Potatoes: The Instant Recipe RE: Robert Cummings Put a washed non peeled medium size potato per person over a oven-plate and take it to the oven. When almost done, slice longitudinally and add a piece of hard cheese. When cheese melts take the potates from the oven, add salt or whatever condiment you use, add a litle oil and you have your lunch! My mom tried to serve us a meatless meal when I was a kid. After the outrage of the three boys and dad, that was the last meatless meal she tried. I'm trying to find whoami here :D Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Spam on the list?
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- 2009/3/11 דניאל דנון danondan...@gmail.com From time to time, I usually get a message of earn money from home or things like that, and in the bottom, it says, This email has been written and proved to be in compliance with the recently established can-spam act law in US. We are not provoking or forcing any person in any way to participate in our programs. To participate is your own decision and you carry the responsibility of taking further part in this promotion. Anyway, if you don't want to receive more good offers from us, you can simply Unsubscribe by sending us a notification email to out_of_the_l...@yahoo.com with a mail-subject and text Unsubscribe me, and we will get your email out of our list within 10 days. Mailiing list / group does it immediately, but here it takes 10 human days to do so. out_of_the_list name is not identical to the format yahoo has for their groups. So, its a fooling way to get users mail in there and it will add the mailer's address to their permanent spam DB :P This message is STRICTLY CONFIDENTIAL and is solely for the individual or organisation to whom it is addressed. It may contain PRIVILEGED and CONFIDENTIAL information. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication and its contents is strictly prohibited. If you are not interested in the offered promotions, please just don't answer. If you think you have received this message and its contents in error, please delete it from your computer, or follow the unsubscribing procedure shown above. Can anyone explain, first, Why doesn't the usual PHP-MailingList-Footer appears? H, either they hack through the code to hide it or... what? Second, What is the out_of_the_list email thing all about? Will sending unsubscribe request there will really stop this spam? Thanks, Daniel
Re: [PHP] Re: Hi!! I Joined the PHP Mailing List
Welcome here as well :) www.twitter.com/nine_L www.lenin9l.wordpress.com
Re: [PHP] verify problem
On Sun, Mar 8, 2009 at 7:31 AM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Sat, 2009-03-07 at 06:23 -0800, Michael A. Peters wrote: Ashley Sheridan wrote: I'm more a fan of lining up opening and closing brackets so they are at the same indent level. It prevents one of the most popular errors caused by omitting a bracket, brace or other in the wrong place. A few extra line breaks in the code are not going to make a noticeable impact on the file size of the script! It's fairly easy to check for missing } with my method as well statementA { statementa1 statementa2 statementa3 statementB { statementb1 statementb2 } You can see the missing bracket for statementA by seeing that statementB doesn't have one above it. I also generally create my } as soon as I create the { so I can comment the } identifying what it closes. I don't always comment it, but when I don't there are times I did when trying to track down a logic issue in nested loops. But - how to indent - if it's your project, whatever floats your boat, if it's a group project, you conform to the group specification for indenting (almost nothing is worse than several different indentation methods in a source file edited by multiple people - especially mixing real tabs and spaces, unix line breaks and dos line breaks.) It's easy to check in that example, but imagine a case in the switch that spans many screens worth of content, with many multiple levels of indentation. It soon gets impossible to check with a quick glance. Yes, a good IDE does make this a non-issue,... but real coders use a standard text editor don't they? ;) Do the real coders make invent the first Wheel? Do they always type and never use Ctrl+C and Ctrl+V? I think a good IDE is a means of productivity multiplier. A coder can think of many other things which really matters. It can be compared with the Wild west gunmen versus AK-47 shooters or Bazooka Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Frameworks
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Mon, Mar 9, 2009 at 9:54 AM, HallMarc Websites m...@hallmarcwebsites.com wrote: First time caller; long time listener.. I have been looking at various PHP MVC frameworks; Limb3, Symphony, Mojavi, Navigator, WACT, etc. I'm looking for any input anyone might have regarding which framework seems to be the most promising? YII(Yes It Is) is claiming to be next best framework. Thanks, Marc
Re: [PHP] Unexplained Issue Using Regex
On Sat, Mar 7, 2009 at 2:37 PM, Jochem Maas joc...@iamjochem.com wrote: Nitsan Bin-Nun schreef: Hi lista, I have been trying to figure this out for the last couple of hours but I'm lack of luck. Take a look at these regex's, the string that was inputed into the preg_replace (using Uis modificators) and the results: (the lists have correspondence to each other) ORIGINAL STRING http://www.zshare.net/video/541070871c7a8d9c http://www.guba.com/watch/2000821351 http://www.veoh.com/videos/v4609719YfsCFpf REGEX USED (with Uis modificators) http:\/\/(www\.|)zshare\.net\/video\/([^\/]+) $3 http:\/\/(www\.|)guba\.com\/watch\/([0-9]+) $3 http:\/\/(www\.|)veoh\.com\/videos\/([^\/]+) THE RETURNED STRING 41070871c7a8d9c 000821351 4609719YfsCFpf If you will go through this carefully you will notice that the first character of each matching group is being deleted. The regex's and the replacements string are being fetched from the database (mysql) and goes straight to the preg_replace function with the original string. I have no idea why this happens. I'm looking forward for your opinions and suggestions. php -r ' var_dump(preg_replace(#http:\/\/(www\.|)zshare\.net\/video\/([^\/]+)#Ui, \\2, http://www.zshare.net/video/541070871c7a8d9c;)); ' string(16) 541070871c7a8d9c given the above test I don't see the problem with the regexp (but you don't actually show the code so it's hard to tell), I'd probably look else where for the char munching culprit. Well, yes if Nitsun is not sharing his piece of code we will have to guess wildly... but why? :) Regards, Nitsan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unexplained Issue Using Regex
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Sat, Mar 7, 2009 at 3:46 PM, Nitsan Bin-Nun nit...@binnun.co.il wrote: There is no reason to share the code because it happens with almost ALL the regex's I'm using :( But I worked this out using Todd's solution. Thank you all for trying to help. hahaha FUNNIEST ever . well we can conclude that you were wrong with your codes of regex. :D On Sat, Mar 7, 2009 at 11:06 AM, 9el le...@phpxperts.net wrote: On Sat, Mar 7, 2009 at 2:37 PM, Jochem Maas joc...@iamjochem.com wrote: Nitsan Bin-Nun schreef: Hi lista, I have been trying to figure this out for the last couple of hours but I'm lack of luck. Take a look at these regex's, the string that was inputed into the preg_replace (using Uis modificators) and the results: (the lists have correspondence to each other) ORIGINAL STRING http://www.zshare.net/video/541070871c7a8d9c http://www.guba.com/watch/2000821351 http://www.veoh.com/videos/v4609719YfsCFpf REGEX USED (with Uis modificators) http:\/\/(www\.|)zshare\.net\/video\/([^\/]+) $3 http:\/\/(www\.|)guba\.com\/watch\/([0-9]+) $3 http:\/\/(www\.|)veoh\.com\/videos\/([^\/]+) THE RETURNED STRING 41070871c7a8d9c 000821351 4609719YfsCFpf If you will go through this carefully you will notice that the first character of each matching group is being deleted. The regex's and the replacements string are being fetched from the database (mysql) and goes straight to the preg_replace function with the original string. I have no idea why this happens. I'm looking forward for your opinions and suggestions. php -r ' var_dump(preg_replace(#http:\/\/(www\.|)zshare\.net\/video\/([^\/]+)#Ui, \\2, http://www.zshare.net/video/541070871c7a8d9c;)); ' string(16) 541070871c7a8d9c given the above test I don't see the problem with the regexp (but you don't actually show the code so it's hard to tell), I'd probably look else where for the char munching culprit. Well, yes if Nitsun is not sharing his piece of code we will have to guess wildly... but why? :) Regards, Nitsan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unexplained Issue Using Regex
On Sat, Mar 7, 2009 at 4:10 PM, Nitsan Bin-Nun nit...@binnun.co.il wrote: Yes you can ;) and I'm using ubuntu :P There's a fun joke in My Mothertongue Bangla (5th most spoken in the world by about 300million). Anis dis na = Take but never giveaway Anis is a common arabic name but in Bangla Anis means 'you may/can bring/take in' dis = to give na = no :D On Sat, Mar 7, 2009 at 12:08 PM, 9el le...@phpxperts.net wrote: --- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Sat, Mar 7, 2009 at 3:46 PM, Nitsan Bin-Nun nit...@binnun.co.ilwrote: There is no reason to share the code because it happens with almost ALL the regex's I'm using :( But I worked this out using Todd's solution. Thank you all for trying to help. hahaha FUNNIEST ever . well we can conclude that you were wrong with your codes of regex. :D
Re: [PHP] Re: Sending out large amounts of email
On Sat, Mar 7, 2009 at 4:11 PM, Richard Heyes rich...@php.net wrote: thanks a thousand A thousand? That's a bit stingy - usually it's thanks a million... In this particular case I guess thousand is a larger value than million :D takes a longer to type :-) -- Richard Heyes HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: http://www.rgraph.net (Updated February 28th) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: if elseif elseif elseif....
They probably thought you couldn't handle the responsibility... and if you can't think for yourself then they may be right ;) Once we have goto, it's a short slide down a slippery slope to setjmp and longjmp. And thence, the apocalypse. ;-} Or maybe nirvana is just over the horizon! You can't know until you go there. As goto is unconditional it can make endless loop... but I think its been overcome'd already
Re: [PHP] Backend autodatabase update
cronjob or deamon to execute the php file On Sun, Mar 8, 2009 at 4:56 AM, Andrew Williams andrew4willi...@gmail.comwrote: Dear All, I have written a back end php program that update live stream database and this data is streamed 24 hours a day. Please, what is the best way to make sure this program execute or runs 24 hours day. Best Wishes Andrew Williams www.willandy.co.uk
Re: [PHP] Re: PHP script lag (5 secs) when declaring mime type.
On Fri, Mar 6, 2009 at 4:18 PM, Jsbeginner jsbegin...@monarobase.netwrote: Thankyou for the help, I will contact the script maintainer to ask him to work on this problem for future updates, and for the moment I've commented out the line that specifies the length. I suppose that it won't cause any problems with files that are sent through this script that are not gzipped (this script allows html, js, css (all compressed with gzip) as well as images that aren't compressed. From what I understand the best would be to detect if gzip is activated for each file and only allow the header to specify the length if the file is not planned to be compressed with gzip (images etc). As we discussed, the declaration of size of the file is COMPLETELY unnecessary in this case. Lenin www.twitter.com/nine_L Thanks again :) Nisse Engström a écrit : On Thu, 5 Mar 2009 19:14:20 +0100, Nisse Engström wrote: On Thu, 05 Mar 2009 15:45:35 +0100, Jsbeginner wrote: ?php header('Content-Type: application/x-javascript'); header('Content-Length: '.filesize('test.js')); readfile('test.js'); ? test.js is only a few lines long, and if I remove the header content type the file loads instantaniously do it's not a problem with readfile. I thought about zlib gzip taking maybe a long time to load but I've changed the compression level from 6 to 1 and the file still has a the same lag. Content-Length MUST NOT be sent when using a Transfer-Encoding (eg. gzip). See: http://tools.ietf.org/html/rfc2616#section-4.4 And I goofed: Transfer-Encoding is the stuff that says chunked. I was thinking of Content-Encoding. But the section I refered to also says: If a Content-Length header field (section 14.13) is present, its decimal value in OCTETs represents both the entity-length and the transfer-length. The Content-Length header field MUST NOT be sent if these two lengths are different [And a little further down, it mentions that the recipient can arse it. I'm not sure quite what to make of that. :-)] - - - Come to think about it, I've written some output handlers to convert utf-8 to utf-16 or -32, which uses either 'Content-Length' or 'Transfer-Encoding: chunked' depending on the size of the output. Perhaps I should change that to always 'chunked'... /Nisse
Re: [PHP] include_path
On Sat, Mar 7, 2009 at 3:13 AM, Eric Lease Morgan emor...@nd.edu wrote: My initial PHP script is not recognizing the values in my include_path. Why? I compiled and installed PHP yesterday: $ php -version PHP 5.2.9 (cli) (built: Mar 5 2009 15:33:55) I then installed a PHP script whose beginning looks like this: // Require System Libraries require_once 'PEAR.php'; require_once 'sys/Interface.php'; require_once 'sys/User.php'; When I fire up this script I get the following error: Warning: require_once(Smarty/Smarty.class.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/html/web/sys/Interface.php on line 21 Fatal error: require_once() [function.require]: Failed opening required 'Smarty/Smarty.class.php' (include_path='.:/usr/lib/php') in /var/www/html/web/sys/Interface.php on line 21 Ironically, Smarty/Smarty.class.php IS located under /usr/lib/php. So is PEAR.php. /usr/lib/php is not in the default scope of webroot ie. /var/www :) You have to allow apache to access /usr/lib/php location Why can't my PHP script find Smarty/Smarty.class.php when it is located in my path, especially if it finds PEAR.php? How do I diagnose this problem? -- Eric Lease Morgan University of Notre Dame -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] insert array values
On Sat, Mar 7, 2009 at 5:37 AM, PJ af.gour...@videotron.ca wrote: I've done some rethingking and this may be the direction to go: What I need to wind up with is something like this: $sql = INSERT INTO book_categories ( book_id, category ) VALUES( '$autoID', '$categoriesID[0]' ), ( '$autoID', '$categoriesID[1]' ), ( '$autoID', '$categoriesID[2]' ), ( '$autoID', '$categoriesID[3]' ) ( '$autoID', '$categoriesID[4]' ); Does it make sense? How do I pass the values to the query? You can run a php loop inside the insert clause. But if its already existing record then it woud be UPDATE clause.
Re: [PHP] Conclusion of use strict...
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Thu, Mar 5, 2009 at 4:35 AM, Jochem Maas joc...@iamjochem.com wrote: Hans Schultz schreef: Thanks for reply, I completely understood your answer even in previous thread, but you should understand few very simple things1. I am not working alone, so I can't make other people use tools I use (eclipse + PDT at the moment) 2. even if somehow I manage to do number 1 we also have some legacy code from where ocassionally popup some idiotic bug (like that I mentioned with typo in property name)I hope (because of 1 and 2) you can understand that eclipse + PDT is not answer to my problem. Now, since I need some way to do these checks for all code paths (and not just currently running one) that is why I am more interested for something able to do those checks in compile time (ie, my javac will report to me uninitialized variable if I have some code path that could miss initialization of variable I am using later); since almost everyone agreed that could be done by some compiler I found php compiler (that for fact really exist, and I even posted llnk to it), since I need to use windows for development and compiler has trial version for linux I was curious if someone used it and if it could help me with my problems.. So, question is NOT whether php is interpreted or compiled, or is there a compiler, question is rather is that compiler useful for my problem.Best regards 1. you should *try* to standardize everyone on a single IDE/tool-chain 2. a decent IDE will give warnings about vars that are [seemingly] uninitialized or used only once. 3. a compiler can't cover all situations (variable variables, vars defined in optional includes, etc) 4. there is no silver bullet. 5. try to compartmentalize code so that the scope of a var doesn't exceed the number of lines you can view in a single screen (makes it easier to spot typos, etc) 6. I am not a number. I completely agree with Hans, as PHP cant be directly compared to that of java's behaviour. All of your team should be using a single IDE or at least good IDEs like Zend Studio, Eclipse PDT, NetBeans PDT while Netbeans is currently the best. PHP is more of a loosely typed language you cant really rely on compile time or something like that to be able to detect old typo bugs etc. The other way is writing a separate engine to detect those sorts of bugs, but using IDE and checking them manually can only ensure the perfectness.
Re: [PHP] Conclusion of use strict...
do we need these extra bytes in every email? Extremely sorry about that :) I completely agree with Hans, as PHP cant be directly compared to that of java's behaviour. Hans is the OP, the one you thought got it all wrong., you're actually agree with me ... which is as natural as it is inevitable ;-) LOL, right :)
Re: [PHP] PHP script lag (5 secs) when declaring mime type.
On Thu, Mar 5, 2009 at 11:34 PM, Jsbeginner jsbegin...@monarobase.netwrote: Thankyou, I took application/x-javascript directly from the apache setup for my domain so this should be correct. However I've just deactivated gzip (zlib.output_compression OFF in php.ini) and that stopped the problem. I've given you a simplified version of the script that has the exact same problem (the original one gets the mime type automaticaly and has the same problem with any files that are gziped (css, html, javascript etc... but not images.). So the problem seems to have someting to do with this line : header('Content-Length: '.filesize('test.js')); and with gzip ... I think content-length is not a thing you have to mention. Only I have seen its required for image type data yet. I would like to be able to activate gzip again but I need to work out why I'm getting this bug first. Apache isn't installed with mod_deflate, should I look into doing this instead of turning zlib.output_compression on again ? Is there maybe a bug with PHP 5.2.9 that's causing this problem? Thankyou :) haliphax a écrit : On Thu, Mar 5, 2009 at 10:27 AM, Jsbeginner jsbegin...@monarobase.net wrote: Hello, Just to say that I've got a bit further in my search : ?php header('Content-Type: application/x-javascript'); //header('Content-Length: '.filesize('test.js')); readfile('test.js'); ? (Content-Length line removed) Has no lag... My guess is there is a problem with gzip or something that corrupts the content-length. So I'm still not sure if this is a PHP problem or an apache problem but any help would be great :) Thankyou Jsbeginner a écrit : Hello, I don't know for sure is this problem is only related to PHP so I hope I've posted in the right list. My problem is that with certain headers my script takes about 5 seconds before sending the page, no matter how small the file I try to load... My server : Centos Apache 2.2 PHP 5.2.9 Here's my code : ?php header('Content-Type: application/x-javascript'); header('Content-Length: '.filesize('test.js')); readfile('test.js'); ? test.js is only a few lines long, and if I remove the header content type the file loads instantaniously do it's not a problem with readfile. I thought about zlib gzip taking maybe a long time to load but I've changed the compression level from 6 to 1 and the file still has a the same lag. My server responds very fast for eveything else except this script. Do you have an idea what might be causing this lag ? Thanks in advance :) Well, have you tried using Content-Type: text/javascript as suggested? Is application/x-javascript absolutely necessary for whatever application is reading your script's output? As it has already been mentioned, Apache may be looking for your content type in some sort of lookup table, not finding it, and taking its sweet time returning control back to PHP while it grabs at straws to match.
Re: [PHP] Conclusion of use strict...
You got it all wrong. As explained, php dont have real compile time like other languages. And if you want to learn a language, you have to start the way it acts. the E_STRICT setting will tell you most of the errors possible from a php script. At production level programmers keep the errors away from visitors eyes by redirecting them all to log files. If you use PDT like NetBeans (which is regarded as the best one yet... there's one version of Visual PHP for Visual Studio developers as well) As you have got to check the errors for typos its the best way to get aid of the PDT IDEs. Thats my personal opinion. Lenin www.twitter.com/nine_L www.lenin9l.wordpress.com --- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Wed, Mar 4, 2009 at 4:03 PM, Hans Schultz h.schult...@yahoo.com wrote: Concluding, and one idea...I think I received satisfying advices on everything but first question (Detection of typos and other simple mistakes). And we were talking also about being able to catch them at compile time, then if php at all has compile time etc. Today one thing crossed my mind -- if there is compiler for php maybe it can catch these errors natively, like java compiler for java? Unfortunatelly there is no recent version available for windows so I can't test it myself ( http://www.roadsend.com/home/index.php?pageID=compiler). I am interesting if someone is using it, and if it can detect this simple mistakes (I am using eclipse + php plugin, but I feel there is something wrong in depending on editor to detect programming errors :-) ) Regards to all, --- On Thu, 2/26/09, Ovidiu Rosoiu ovidiu.ros...@gmail.com wrote: From: Ovidiu Rosoiu ovidiu.ros...@gmail.com Subject: Re: [PHP] use strict or similar in PHP? To: Hans Schultz h.schult...@yahoo.com Cc: php-general@lists.php.net Date: Thursday, February 26, 2009, 9:14 PM Hans Schultz wrote: Hello, I am beginner with PHP and prior to PHP I have worked with java for some time and with perl for very short period. I can't help to notice some things that are little annoyance for me with PHP, but I am sure someone more experienced can help me :-) Is there in PHP something like use strict from perl? I find it pretty annoying to need to run script over and over again just to find out that I made typo in variable name. Is there some way for PHP to cache some data on the page? I like very much PHP's speed but it would be even better to be able to cache some frequently used data from database? Also regarding databases, I liked a lot java's way of sending data to database using parameters (select * from user where username = ? and then passing parameter separately with database doing necessary escaping and everything). Is there something like PHPDBC similar to JDBC?
Re: [PHP] allow_url_fopen allow_url_include
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Wed, Mar 4, 2009 at 3:26 AM, Chris dmag...@gmail.com wrote: Kaushal Shriyan wrote: On Tue, Mar 3, 2009 at 12:21 PM, Kaushal Shriyan kaushalshri...@gmail.com mailto:kaushalshri...@gmail.com wrote: On Tue, Mar 3, 2009 at 11:52 AM, Chris dmag...@gmail.com - Show quoted text - mailto:dmag...@gmail.com wrote: Kaushal Shriyan wrote: Hi, I have enabled allow_url_fopen allow_url_include in php.ini file. is it a security issue ? allow_url_fopen means you can fetch pages: $page = file_get_contents('http://www.example.com'); This is ok to enable - all it does is fetch the page. It does not execute the code it retrieved. allow_url_include means you can remotely include code as if it was on your server: include('http://www.example.com/page.html' http://www.example.com/page.html%27); That means if http://www.example.com/page.html includes any php code, it will be executed on your server - this one definitely is a security consideration. If you enable allow_url_include be very careful about what you include. If you're still not sure, enable url_fopen, do not enable url_include. --Postgresql php tutorials http://www.designmagick.com/ Thanks Chris :-) Kaushal Hi Chris Can i use curl option to php to take care of the security issue so that i can disable both allow_url_fopen allow_url_include in php.ini file. allow_url_include is a security issue because it will actually execute the code returned from the url (like an 'include' or 'require' does locally). allow_url_fopen is not a security issue - it only returns the code, it does not execute it. But yes you can use curl instead of relying on allow_url_fopen. Well, allow_url_fopen is really a security issue. A renowned programmer ( http://hasin.wordpress.com) said it could even cause DoS(Denial of Service) for the running server. Read Chris Shiflett's blog http://shiflett.org/ http://sitepoint.com/article/php-security-blunders http://phpsec.org/projects/guide/ Regards Lenin www.twitter.com/nine_L -- Postgresql php tutorials http://www.designmagick.com/ - Show quoted text - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 0.T Java IDE
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Wed, Mar 4, 2009 at 4:38 AM, Boyd, Todd M. tmbo...@ccis.edu wrote: - Show quoted text - -Original Message- From: Almog Friedman [mailto:ter...@gmail.com] Sent: Tuesday, March 03, 2009 7:55 AM To: php-general@lists.php.net Subject: [PHP] 0.T Java IDE Since I know theres alot of Java progarammers in this list and I don't want to sign upo to another mailing list i ask it here I'm searching for a Java ide (not netbeans, I'm sick of netbeans) which does gui in swing the best(i come from C# with visual studio and i'm searching for something that is as easy and powerful as the visual studio gui editor) Having used Eclipse, Netbeans, JGrasp, Visual J#/J++, and Processing.org's notepad, I've got to say: Developing UIs is easiest in Netbeans. Sorry. :( Lots of people support NetBeans as the best IDE for Java and for PDT as well. // Todd
Re: [PHP] 500 Internal Server Error
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Mon, Mar 2, 2009 at 2:18 AM, VamVan vamsee...@gmail.com wrote: Hello All, What is the situation when we get internal server error 500 on PHP pages? From Internet I got some info like, you get it when : 1) If friendly urls are not supported by apache.(mod_rewrite) 2) If max_execution_time max's out. and some more related to apache. I got a weird situation where I do PHP eval() and if the parsed string is wrong, I get internal server error 500. So question is I was under the impression that PHP code errors will never result in a http response errors. Am I completely wrong here? Can anyone tell me from their experience what are the specific scenarios we get this error? Understandably 2) for the eval. Thanks, V
Re: [PHP] use strict or similar in PHP?
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Fri, Feb 27, 2009 at 3:08 PM, Hans Schultz h.schult...@yahoo.com wrote: On Thu, 26 Feb 2009 22:38:13 +0100, Shawn McKenzie nos...@mckenzies.net wrote: There is no compile time. PHP is interpreted so it is compiled and then executed. If you always want error reporting, then set it in php.ini. It is compiled in no time, so there is no compile time? LOL If you are a programmer you should know the difference between Compiler and Interpreter. PHP is interpretted. You are using term without knowing the meaning. Just like javascript is run in browser ... PHP is run at server while the page is being served to the visitor clear? Now tell us your question again. www.twitter.com/nine_L www.lenin9l.wordpress.com -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: use strict or similar in PHP?
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Fri, Feb 27, 2009 at 11:46 PM, Robert Cummings rob...@interjinn.comwrote: On Fri, 2009-02-27 at 09:28 -0700, LuKreme wrote: On Feb 27, 2009, at 6:12, Hans Schultz h.schult...@yahoo.com wrote: Hahahah,I was thinking the same thing The trouble is most people mean compile a source file to an executable binary when they sat compile. By this measure, PHP does not compile. I add the following to the top of my PHP shell scripts: #!/usr/bin/php -qC Then I do the following: chmod 775 script.php Then I run it as follows: ./script.php Look... and executable binary :) Don't say it's not binary. All data on a hard disk is binary (although I do know what you mean ;) Well you are running shell script style execution its not example of Compiled code or Binary The data in the file is ASCII or UTF text :) Compilation happens when its zendOptimized or OpCoded. Its then is converted into binary content file. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Development methods (was: use strict or similar in PHP?)
Also in place of Vi you should be looking for an IDE like Netbeans PDT which is one of the best for coding in PHP you can forget using TextPad for this. And to let your codes versioned use SVN=Subversion Using a framework lets you apply and abide by some conventions and lets you DRY=Dont Repeat Yourself .. which is very helpful for a large project. --- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Fri, Feb 27, 2009 at 10:27 PM, Boyd, Todd M. tmbo...@ccis.edu wrote: -Original Message- From: Bob McConnell [mailto:r...@cbord.com] Sent: Friday, February 27, 2009 9:56 AM To: PHP General list Subject: [PHP] Development methods (was: use strict or similar in PHP?) From: Boyd, Todd M. Well, take care of all of your logic before you display anything. It's not that difficult, to be honest... especially if you're already using an MVC design pattern/framework or a template system. That's an interesting string of buzzwords, but it carries no meaning for me. Would you care to elucidate further? As far as the code I am working with, I inherited over 160 files of mixed HTML and PHP, where the logic and presentation are intermingled (mangled) throughout. My initial toolset was TextPad4, WinSCP and Putty on a WinXP workstation, with Apache on RHEL 5 as the server. (The original coder used vi on a clone of the server until they took it away from him.) The chances of re-implementing the entire project are roughly equivalent to a zero with the edges rubbed out. I already have a six month to-do list just adding the new features already requested by current clients. * MVC = Model-View-Controller [1] * Template = Basically just the display (View) with variables injected [2] * Output Buffer = Output isn't sent to the browser until you deem it so [3] As far as inheriting more than 160 files with logic and presentation intermingled... I think you're pretty much SOL with regard to converting it to a framework or a new design pattern. It's possible, but that's going to be quite a bit of work. Links: 1. http://en.wikipedia.org/wiki/Model-View-Controller 2. http://www.smarty.net/ (just an example of one templating system) 3. http://www.php.net/ob_start HTH, // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What in Hades?
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- 2009/2/26 PJ af.gour...@videotron.ca Something is rotten here. Twist it any way you like and it just does not work. I am trying to figure out the working of SELECT LAST_INSERT_ID() and cannot get beyond the first $sql - But it works fine from command-line! ? include (lib/db1.php);// Connect to database $sql1 = INSERT INTO test (name, age) VALUES ('Joe Blow', '69'); $result1 = mysql_query($sql1,$db); if ( !$result) { At the above line $result1 ? echo(PError performing query: . mysql_error() . /P); exit(); } THIS IS WHERE IT STOPS WITH ERROR.$sql1 just refuses to work. db connection is fine and the INSERT works from xterm on remote puter. Can't figure this out. $sql = SELECT LAST_INSERT_ID() FROM test; $result = mysql_query($sql,$db); if (!$result) { echo(PError performing query: . mysql_error() . /P); exit(); } while ( $row = mysql_fetch_array($result) ) { echo(P . $row[id] . /P); } ? What am I missing here? Or how can I trace the error? -- Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: catch the error
But the question is PJ, have you got it out of errors yet? :) www.twitter.com/nine_L www.lenin9l.wordpress.com --- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- 2009/2/27 Ashley Sheridan a...@ashleysheridan.co.uk On Thu, 2009-02-26 at 13:34 -0500, Darryle Steplight wrote: Hi PJ, $db_host = 'biggie'; $db_user = 'root'; $db_pass = 'gu...@#$'; $db_name = 'biblane'; Everyone here is trying to help you and that's cool, but EVERYONE on this list may not be so nice. The above credentials is definitely the type of information you want to keep private, unless you don't mind people potentially accessing your database tables and doing whatever they like with them. I suggest doing something like $db_host = 'localhost; $db_user = 'foo'; $db_pass= ''bar; $db_name =''xx; if you are going to post it on the list. On Thu, Feb 26, 2009 at 1:22 PM, PJ af.gour...@videotron.ca wrote: Ricardo Dias Marques wrote: Hi PJ, On Thu, Feb 26, 2009 at 17:28, PJ af.gour...@videotron.ca wrote: What is wrond with this file? same identical insert works from console but not from this file :-( [snip] ? //include (lib/db1.php);// Connect to database mysql_connect('biggie', 'user', 'password', 'test') or die(Error connecting DB.mysql_error()); $sql1 = INSERT INTO example (name, age) VALUES ('Joe Blow', '69'); $result1 = mysql_query($sql1,$db) or die(PError performing 1st query: .mysql_error() . /P); ? I haven't coded in PHP for a long time, but I think that your problem is in this line: $result1 = mysql_query($sql1,$db); Up to that point, $db (that should point to a database link identifier) is not defined. You probably want to assign the mysql_connect result to that $db variable. So, I think that you will solve your problem by changing your mysql_connect line FROM the current form: mysql_connect('biggie', 'user', 'password', 'test'); .. TO this one: $db = mysql_connect('biggie', 'user', 'password', 'test'); Am I right? Partly. I had an error in the location of the include. Ashley corrected the rest but it only works with the include. Not as whown below ? //include (../lib/db1.php);// Connect to database $db_host = 'biggie'; $db_user = 'root'; $db_pass = 'gu...@#$'; $db_name = 'biblane'; $db_connect = mysql_connect($db_host, $db_user, $db_pass); $db_select = mysql_select_db($db_name, $db_connect); $sql1 = INSERT INTO test (name, age) VALUES ('Arnie Shwartz', '75'); $result1 = mysql_query($sql1,$db); if (!$result1) { echo(PError performing 1st query: . mysql_error() . /P); exit(); } ? -- Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=dstepli...@gmail.com I agree. I wouldn't trust me at all! ;) Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] use strict or similar in PHP?
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- 2009/2/27 Hans Schultz h.schult...@yahoo.com Hello, I am beginner with PHP and prior to PHP I have worked with java for some time and with perl for very short period. I can't help to notice some things that are little annoyance for me with PHP, but I am sure someone more experienced can help me :-) Is there in PHP something like use strict from perl? I find it pretty annoying to need to run script over and over again just to find out that I made typo in variable name. see error_reporting(E_ALL|E_STRICT);:) Is there some way for PHP to cache some data on the page? I like very much PHP's speed but it would be even better to be able to cache some frequently used data from database? Also regarding databases, I liked a lot java's way of sending data to database using parameters (select * from user where username = ? and then passing parameter separately with database doing necessary escaping and everything). Is there something like PHPDBC similar to JDBC? You can use sprintf(select * from `user` where `username`=%s,$user); Also you can look into the great frameworks of PHP like ZendFramework, CodeIgniter, CakePHP etc. TIA, Hans -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] use strict or similar in PHP?
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Fri, Feb 27, 2009 at 3:20 AM, Hans Schultz h.schult...@yahoo.com wrote: I was thinking more of something to fail at compile time if possible :-) regarding second, that solution with sprintf is vulnerable to SQL injection, that is why I wanted something with parameters, instead of escaping everything myself Well, you can use mysql_real_escape.. to avoid SQL injection possibilities. And ofcourse give a try with the mysqli functions, prepared statements and PDO. And with the frameworks you have less chance to do mistake. Thanks for your help anyway --- On *Thu, 2/26/09, 9el le...@phpxperts.net* wrote: Is there in PHP something like use strict from perl? I find it pretty annoying to need to run script over and over again just to find out that I made typo in variable name. see error_reporting(E_ALL|E_STRICT);:) Is there some way for PHP to cache some data on the page? I like very much PHP's speed but it would be even better to be able to cache some frequently used data from database? Also regarding databases, I liked a lot java's way of sending data to database using parameters (select * from user where username = ? and then passing parameter separately with database doing necessary escaping and everything).. Is there something like PHPDBC similar to JDBC? You can use sprintf(select * from `user` where `username`=%s,$user); Also you can look into the great frameworks of PHP like ZendFramework, CodeIgniter, CakePHP etc. TIA, Hans -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: catch the error
PJ you should be getting Warning errors the way you had the code. You definitely is a fun lover and enjoy moments. But while coding dont only think of fastness of coding but also code with logic. I was going to answer you about the $db but later I found lots response already came so didn't really dig to get the errors. Look back, see, I asked if you got rid of the errors :) Now, if you dont use the variable in the parameter it will look for the immediate opened database resource but if you use a variable. THEN it must contain that required resource thats just OBVIOUS reason. And, your error reporting should be reporting that. I haven't checked the code. A funny thing is you are making others think for the things you should be thinking. I dont say its bad. Its actually good for all of us having some drill on the basics :D Regards Lenin www.twitter.com/nine_L www.lenin9l.wordpress.com On Fri, Feb 27, 2009 at 6:37 AM, Chris dmag...@gmail.com wrote: Boyd, Todd M. wrote: -Original Message- From: Chris [mailto:dmag...@gmail.com] Sent: Thursday, February 26, 2009 4:16 PM To: Boyd, Todd M. Cc: PJ; PHP General list Subject: Re: [PHP] Re: catch the error In examples sent to you, people foolishly replaced your $db var with $db_connect ONLY FOR PART OF THE SCRIPT. You've defined your database connection as $db_connect in some versions of the source, but then you reference $db (without _connect) in your mysql_select call in that same source. $db = mysql_connect([option list here]); # -- this code instantiates a connection mysql_select_db([some name], $db); # notice how $db is here? $result = mysql_query([some query], $db); # it's here, too! $db becomes your resource link when you use mysql_connect. That resource link must then be passed to your mysql functions. Otherwise, they have no idea which database connection you are attempting to use. RTFM? If no connection is specified, the last one is used. It is an optional argument (only *really* needed when you have multiple connections in the same script). RTF E-mail I sent? He had used $db_connect instead of $db. $db_connect hadn't been set to anything. He was specifying a connection, but it was null. Unless it falls back to the last connection used in the case of an empty variable, then this was most likely (read: proven to be) the problem. The last two emails I saw (no I haven't read the whole thread) were: $db = mysql_connect($db_host, $db_user, $db_pass); mysql_select_db($db_name,$db); snip $result1 = mysql_query($sql1,$db); and $db = mysql_connect($db_host, $db_user, $db_pass); mysql_select_db($db_name,$db); which have the right variables. Plus I was picking on the you must do this - using the link identifier is an optional thing as I already said. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Web Development work
I guess you are interested about php. the freelancers work at www.scriptlance.com www.elance.com www.odesk.com www.joomlalancer.com www.getacoder.com www.getafreelancer.com and many more. I am a Web Developer at https://www.scriptlance.com/cgi-bin/freelancers/feedback.cgi?p=lenin9el with this id To be a web developer you dont need to be design oriented. You can stick to programming skills as well. Regards Lenin --- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Wed, Feb 25, 2009 at 11:16 PM, Ernie Kemp ernie.k...@sympatico.cawrote: I really need your insight. I’m a software developer who is wishing to do Web Development. I love to program and I’m learning more about Web Design but my main skills are in programming. How do you get work as a Web Developer? One could apply for a web developer job at a Web company but I wish to be on my own. How are the freelancer finding work and where? I have had my head buried in code too long to know where to find my new cheese. Any help would be appreciation. Thanks, Ernie Kemp ...man will occasionally stumble over the truth, but usually manages to pick himself up, walk over or around it, and carry on. Winston S. Churchill* *
Re: [PHP] Web Development work
Very wise words or wisdom Ken. And Ernie, I just gave you most of the renowned places where freelancers or even large companies bid for works. There are programmers like you and as Ken said, even thousand times better programmers than you who are going along the way. Its a wonder how you do not know those names. You just gotta be friends with the google. A software engineer doesnt mean that he is god. And web developer doesnt mean unemployed. I and my team is member with lot other freelancing sites and have local and overseas permanent clients for whom we working remotely. Starting from making a blog to making crawler or video upload/download site. Or, real-estate sales, rental with Map API integrated search results. Or, say Facebook applications or iPhone apps! We just need to learn fast the best of the technologies with the best of the methods and yet we have to be business oriented. Thanks Lenin www.twitter.com/nine_L --- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- 2009/2/26 phphelp -- kbk phph...@comcast.net Hello -- - Ernie -- -- - Consulting work is a business. Work doesn't fall from the sky. You have to figure out what you do. Not good enough to say I'm a programmer -- that and a dollar will get you half-a-cup of coffee at McDonalds. Figure out where your strengths are. Figure out where you have or can cultivate contacts. Spread the word. If you don't have a demonstrable portfolio of projects from your employer or clients that you can show or discuss with others, you had better develop one. Do you have an industry that you know more about than the average developer? Do you have graphics skills, too? Do you understand how a business works? Every unemployed programmer calls himself a Web Developer. Every unemployed graphic designer calls himself a Web Designer. People who have been doing one or both for *years* call themselves the same thing. Most potential customers have no clue who is good or bad. Can you do the design work, or just the programming work. This isn't a place to get work; (based on the nature of your questions) there are 100s of folks here with more experience and savvy than you, and I bet every one of the independents have room for more clients. I have been in this business for 20 years. If you are flailing around asking naive questions like this, you probably are better off with a job. Maybe 10 years ago, someone with mid-level skills and no business acumen could be a successful web developer just because the industry was growing so fast and there were so few people with real skills. Now the situation is the opposite: there are lots and lots of people with skills. There are still jobs around, but you have to work harder to get them. If you want to be in business, you need to think like a business person (who just happens to have a technical set of skills). Good luck, Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help installing phpDocumentor
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Tue, Feb 24, 2009 at 7:51 PM, Bob McConnell r...@cbord.com wrote: From: Jim Lucas I may be wrong, but I heard short tags were going the way of the Dodo bird as of PHP6. This is not surprising. With the advent of XHTML, the short tag option collides with another valid tag, ?xml. So that option has to be turned off as soon as you need any XML in your pages. I'm in the process of correcting that in more than 150 files in one project alone. There are two other bigger projects that require the same treatment. All three also make extensive use of magic quotes and register_globals, which are likewise becoming extinct. well if you wanna keep short tags.. then ?php echo ?xml would be better idea. Which reminds me, where can I get a definitive list of all deprecated features? In addition to identifying each feature, it should indicate which release marked them deprecated, and which release will no longer support them, if known. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP - user profile page with pic
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Mon, Feb 23, 2009 at 12:25 PM, Jeffery Harris jhar...@harris4interactive.com wrote: my level of coding is basic. out of the box is fine as long as it is a good one. I do know how to connect to database pull and display records as well as set up login. But I guess I have to create a session so that when a user logs in only his/her information is shown correct? Yes, and it would be better for you to have an in depth look into the open source projects found. Get to analyse them. So, you'll get familiarized with the advanced well known methods. Learning from them you will be able to create something better and not reinventing the wheels. Lenin -Jeff - Original Message - From: 9el le...@phpxperts.net Newsgroups: php.general To: jeffery harris jhar...@harris4interactive.cm Cc: php-general@lists.php.net Sent: Thursday, February 19, 2009 12:40 AM Subject: Re: [PHP] PHP - user profile page with pic The question can be equally rephrased as How an Atom bom/Spaceship be created? Answer depends on the level of knowledge you have on coding / developing sites. Woud you be using any framework? or would you use any readymade CMS? Or write everything from scratch? Question can also be generalized further like would php be your developing language? Or you'd develop your own new language out of the box. :) --- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Thu, Feb 19, 2009 at 9:46 AM, jeffery harris jhar...@harris4interactive.com wrote: Any ideas or tutorials on how to build a user profile page sort of like facebook? -Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_real_escape_string(asdasddas) ??? wtf
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Sun, Feb 22, 2009 at 5:35 AM, Tim | iHostNZ t...@ihostnz.com wrote: OK, thanks. I think you guys are right. It's just safer and simpler than writing my function and probably not really slower either. need a db connection anyway. Read a bit on the function and yeah, a bit of screwed up binary data might yet cause funny errors although the xml is a feed from a trusted source. Having concluded with this realization get to read about Security chapters from Zend Certified Engineer Exam Guide Book from phpArchitect. Written by Ben Ramsey and David Shafiq. And you probably know about the term of 're-inventing the wheel'. :) You guys are great! Faster with answers than i can search. Almost feel tempted not to search Nah i still search first. :-) Tim-Hinnerk Heuer http://www.ihostnz.com Emo Philips - I was the kid next door's imaginary friend. 2009/2/22 Robert Cummings rob...@interjinn.com On Sat, 2009-02-21 at 19:19 +1300, Tim | iHostNZ wrote: Hi everyone, Can anyone here tell me why mysql_real_escape_string(asdasddas) returns an empty string? Just writing a data import... Anyway, for security but also simply because i might have a ' in the string, i need to escape it. Apparently it is good practice to use mysql_real_escape_string() but it simply doesn't work at all on this machine. I thought it's a rather standard function. Is it maybe my Apache server setup? But i thought the function wouldn't exist then and throw an error in the php script, but it runs through fine. Please help, we need this data import by next week hence i'm working now... I can send you details of the server setup if required. Please let me know what as there are quite a few things... It's xampp on windows xp (testing/dev machine). RTFM: Note: A MySQL connection is required before using mysql_real_escape_string() otherwise an error of level E_WARNING is generated, and FALSE is returned. If link_identifier isn't defined, the last MySQL connection is used. And turn your error reporting on or check your logs. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP
Re: [PHP] Full versus relative URLs
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Wed, Feb 18, 2009 at 8:02 PM, Stuart stut...@gmail.com wrote: 2009/2/18 PJ af.gour...@videotron.ca: Stuart wrote: ?php include dirname(__FILE__)./../header.php; ? This generates a Fatal error: Cal to undefined function dirname() The dirname function is present in both PHP 4 and 5 and does not rely on any external libraries. Are you sure you're spelling it right? http://php.net/dirname I must be really dense... What I don't understand in the above is this - dirname refers to what directory? -- the directory of the file that is including? what if the directory is the root directory of the site? (_FILE_) = what? - (_filename.ext_) or (filename.ext) --- what file is this, the file which is including the file header.php? The __FILE__ (note 2 _'s either side) constant is the full path and filename to the current script. The dirname function knocks the filename off it to give you the directory the current script is in. You can then append a / and then the relative path to the script you want to include. By doing this you're ensuring that all includes are relative to the current script and are not affected by ini settings or anything else. and what does the . mean and then /../header.php --- I don't understand what to enter here . (dot) is string concatenator/concatenation operator. And .. (double dot) used in a path is a shorthand for parent directory. Goto your command console . ie. CMD or Command.com or linux console type cd .. and press enter it will take you to one level up. also in this shorthand . (a single dot) means current directory/folder (please dont mixup with concatenation operator) The . is the string append operator. I tend to assume the most basic level of PHP knowledge from users of this list and I include the string append operator in that set. You might want to find a beginners tutorial for PHP and work through that to give you a solid foundation before attempting to work with multiple scripts. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Full versus relative URLs
--- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Wed, Feb 18, 2009 at 11:05 PM, PJ af.gour...@videotron.ca wrote: Stuart wrote: 2009/2/18 PJ af.gour...@videotron.ca: Stuart wrote: ?php include dirname(__FILE__)./../header.php; ? This generates a Fatal error: Cal to undefined function dirname() The dirname function is present in both PHP 4 and 5 and does not rely on any external libraries. Are you sure you're spelling it right? http://php.net/dirname dirname (PHP 4, PHP 5) dirname — Returns directory name component of path Description string dirname ( string $path ) Given a string containing a path to a file, this function will return the name of the directory. Parameters path A path. On Windows, both slash (/) and backslash (\) are used as directory separator character. In other environments, it is the forward slash (/). Return Values Returns the name of the directory. If there are no slashes in path , a dot ('.') is returned, indicating the current directory. Otherwise, the returned string is path with any trailing /component removed. Changelog Version Description 5.0.0 dirname() is now binary safe 4.0.3 dirname() was fixed to be POSIX-compliant. Examples Example #1 dirname() example ?php $path = /etc/passwd; $file = dirname($path); // $file is set to /etc ? Notes Note: Since PHP 4.3.0, you will often get a slash or a dot back from dirname() in situations where the older functionality would have given you the empty string. Check the following change example: ?php //before PHP 4.3.0 dirname('c:/'); // returned '.' //after PHP 4.3.0 dirname('c:/x'); // returns 'c:\' dirname('c:/Temp/x'); // returns 'c:/Temp' dirname('/x'); // returns '\' ? I must be really dense... What I don't understand in the above is this - dirname refers to what directory? -- the directory of the file that is including? what if the directory is the root directory of the site? (_FILE_) = what? - (_filename.ext_) or (filename.ext) --- what file is this, the file which is including the file header.php? The __FILE__ (note 2 _'s either side) constant is the full path and filename to the current script. The dirname function knocks the filename off it to give you the directory the current script is in. You can then append a / and then the relative path to the script you want to include. By doing this you're ensuring that all includes are relative to the current script and are not affected by ini settings or anything else. and what does the . mean and then /../header.php --- I don't understand what to enter here the . before the quotemark is the concatenation operator which joins the string(texts) together. :) The . is the string append operator. I tend to assume the most basic level of PHP knowledge from users of this list and I include the string append operator in that set. You might want to find a beginners tutorial for PHP and work through that to give you a solid foundation before attempting to work with multiple scripts. -Stuart What confused me here is that often, in examples, there are all sorts of references to files and there seems to be no standard as to how to refer to them in non-scripts such as these e-mails. So, I thought that dirname(_FILE_) was a general reference to a directory name and a file... :-( I don't want to defend myself here, but I cannot be expected to know all functions and look up anything that might resemble a function... I still do not understand, and that is the keyword here, I am trying to understand things - what does /../header.php mean. I know the 2 dots mean a higher directory in Unix... but I understood that ../ would mean the root directory - so what is the / before the ../header.php mean? When including scripts or pages, i find that if I am referencing to the current directory, just the filename or /filename works. If the reference is up a level, ../ works e.g. to reference root/images/ from root/authors = ../images/file.ext from root = /images/file.ext or images/file.ext I haven't needed to go to a deeper level yet. -- Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP - user profile page with pic
The question can be equally rephrased as How an Atom bom/Spaceship be created? Answer depends on the level of knowledge you have on coding / developing sites. Woud you be using any framework? or would you use any readymade CMS? Or write everything from scratch? Question can also be generalized further like would php be your developing language? Or you'd develop your own new language out of the box. :) --- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Thu, Feb 19, 2009 at 9:46 AM, jeffery harris jhar...@harris4interactive.com wrote: Any ideas or tutorials on how to build a user profile page sort of like facebook? -Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php