Re: [PHP] Re: File or directory?

2009-08-16 Thread George Langley
is_dir() is_file() George Langley On 15-Aug-09, at 5:45 PM, Clancy wrote: On Sat, 15 Aug 2009 10:33:07 +0100, a...@ashleysheridan.co.uk (Ashley Sheridan) wrote: On Sat, 2009-08-15 at 09:56 +0200, Ralph Deff

Re: [PHP] to a css file requires .css ???

2009-08-16 Thread Adam Shannon
On Sun, Aug 16, 2009 at 4:37 PM, Daniel Kolbo wrote: > Hello, > > I realize this is more of an html question than a php, but I was hoping > someone here would know what's going on. > > I am linking to a stylesheet and it is requiring me to use *.css > extension. I want to use a .php extension (an

Re: [PHP] to a css file requires .css ???

2009-08-16 Thread Daniel Kolbo
Daniel Kolbo wrote: > Hello, > > I realize this is more of an html question than a php, but I was hoping > someone here would know what's going on. > > I am linking to a stylesheet and it is requiring me to use *.css > extension. I want to use a .php extension (and have the php engine > generate

Re: [PHP] to a css file requires .css ???

2009-08-16 Thread Nitsan Bin-Nun
Of course not, just send the corresponding mime type to the file extension .css Probably header('Content-Type: text/css'); Good luck ;) On Sun, Aug 16, 2009 at 11:37 PM, Daniel Kolbo wrote: > Hello, > > I realize this is more of an html question than a php, but I was hoping > someone here would

[PHP] to a css file requires .css ???

2009-08-16 Thread Daniel Kolbo
Hello, I realize this is more of an html question than a php, but I was hoping someone here would know what's going on. I am linking to a stylesheet and it is requiring me to use *.css extension. I want to use a .php extension (and have the php engine generate css). However, whenever i use a .php

Re: [PHP] Another date exercise

2009-08-16 Thread Ralph Deffke
i agree on date pickers and js is well use individual fields for day month and year, make month and year as drop down and u have no problem at all make live easier ralph "Paul M Foster" wrote in message news:20090816202217.gs2...@quillandmouse.com... > On Sun, Aug 16, 2009 at 08:36:17AM +

[PHP] running str_replace, it misbehaves!

2009-08-16 Thread Allen McCabe
Hi friends, I'm trying to get an encrypting program working to possibly use for password insertion into a db. I set up a function that runs str_replace on a string (user supplied) two times. It searches for a single letter or number, and replace it with a pair. The next str_replace searches that n

Re: [PHP] Re: How do I extract link text from anchor tag as well as the URL from the "href" attribute

2009-08-16 Thread chrysanhy
The code snippet below worked! Thank you so much for your time helping me with this! On Sun, Aug 16, 2009 at 11:26 AM, Ralph Deffke wrote: > this worked here: > > $html = new DOMDocument(); > $html->loadHtmlFile("testHtml.html"); > $links = $html->getElementsByTagName('a'); > echo ""; > > foreac

Re: [PHP] Another date exercise

2009-08-16 Thread Paul M Foster
On Sun, Aug 16, 2009 at 08:36:17AM +0100, Lester Caine wrote: > tedd wrote: >> Hi gang: >> >> Here's another exercise to consider. >> >> This is a date entry problem where the user can enter a date in various >> forms, but the return will be in a consistent format. >> >> For example, a user might

Re: [PHP] Cannot exec in my own directory

2009-08-16 Thread Dotan Cohen
> Please copy your script in the Linux include paths. Such as /usr/local/bin > and give it neccecary permission and try your script again. > I do not have root access on this machine. That is why I run the script from /home/username/ -- Dotan Cohen http://what-is-what.com http://gibberish.co.il

Re: [PHP] Sanitizing mysql inserts of user data

2009-08-16 Thread Dotan Cohen
2009/8/16 Caner Bulut : > > Hi Dotan, > > You can use htmlentities(), htmlspecialchars() and strip_tags() functions > when you show your saved data on your web pages. mysql_real_escape_string > function saved data into mysql DB with a secure way. But when you try to > show data you still have to co

Re: [PHP] Sanitizing mysql inserts of user data

2009-08-16 Thread Dotan Cohen
> You should in pretty much all cases be safe with just using the > mysql_real_escape_string, which takes care of the - for you as well. > If I remember correctly, TFM once stated that mysql_real_escape_string does not prevent SQL injection attacks, though I am hard pressed to think of what it _is

Re: [PHP] Sanitizing mysql inserts of user data

2009-08-16 Thread Adam Randall
What you are doing here is potentially altering valid user information coming into MySQL. For example, if someone legitimately enters in -- or ; into some string that is going to be put into MySQL, some comment or such, then what is put in, and then put out if you display it, won't be the same. Yo

RE: [PHP] Cannot exec in my own directory

2009-08-16 Thread Caner Bulut
Dotan, Please copy your script in the Linux include paths. Such as /usr/local/bin and give it neccecary permission and try your script again. If you still have any problem, we understand that it is no related script path problem and permissions. Maybe there is some problems on your php script.

RE: [PHP] Sanitizing mysql inserts of user data

2009-08-16 Thread Caner Bulut
Hi Dotan, You can use htmlentities(), htmlspecialchars() and strip_tags() functions when you show your saved data on your web pages. mysql_real_escape_string function saved data into mysql DB with a secure way. But when you try to show data you still have to control it. Thanks. Caner. -Orig

Re: [PHP] Cannot exec in my own directory

2009-08-16 Thread Dotan Cohen
> Check the include path. Try using the complete path to the file. And make > sure the user PHP is running has read permissions to the directories upwards > the hierarchy. > Thanks. I am using the complete path to the script: exec("/home/username/script.sh"); In the /home/username/ directory ther

[PHP] brainstorm/samples on _autoload() needed

2009-08-16 Thread Ralph Deffke
anybody out there with a ultimate solution, speed optimzed? im going now for an ultimate solution, this repeating problem sucks ralph_def...@yahoo.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Sanitizing mysql inserts of user data

2009-08-16 Thread Dotan Cohen
I am sanitizing user-entered data before storing in mysql with this function: function clean_mysql ($dirty) { $dirty=trim($dirty); $dirty=str_replace ("--", "", $dirty); $dirty=str_replace (";", "", $dirty); $clean=mysql_real_escape_string($dirty); return $clean; } Is this goo

Re: [PHP] Re: How do I extract link text from anchor tag as well as the URL from the "href" attribute

2009-08-16 Thread Ralph Deffke
this worked here: loadHtmlFile("testHtml.html"); $links = $html->getElementsByTagName('a'); echo ""; foreach ($links as $item) { echo $item->getAttribute( 'href' ). "\n"; echo "---" . $item->nodeValue . "\n"; } echo ""; ?> Im sending u the 2 files directly in a minute. it came out, as I

Re: [PHP] Re: How do I extract link text from anchor tag as well as the URL from the "href" attribute

2009-08-16 Thread Ralph Deffke
well the immage goes inside the on ur html the node a has no value however u should not get a error this is pergect jtml link ralph "chrysanhy" wrote in message news:88827b190908160943t2254137fve43771c7e4f8c...@mail.gmail.com... > WHile waiting for suggestions for extracting the link text

Re: [PHP] Cannot exec in my own directory

2009-08-16 Thread Sudheer Satyanarayana
Dotan Cohen wrote: I have a script in /home/username/script.sh with permissions 777. I can SSH into the server and execute ./script.sh to run the script, but calling it from exec in PHP does not run it. What should I start checking? Thanks. Check the include path. Try using the complete path

Re: [PHP] Dan Brown

2009-08-16 Thread Per Jessen
Angus Mann wrote: > Dan Brown is a frequent poster here and developer on the PHP team. > Dan has not posted to the PHP list for quite a while and is not > responding to my emails directly to him. Does anyone know if he's OK? > If anyone has knowledge can they please reply to me directly - off > li

[PHP] Cannot exec in my own directory

2009-08-16 Thread Dotan Cohen
I have a script in /home/username/script.sh with permissions 777. I can SSH into the server and execute ./script.sh to run the script, but calling it from exec in PHP does not run it. What should I start checking? Thanks. -- Dotan Cohen http://what-is-what.com http://gibberish.co.il -- PHP Ge

Re: [PHP] Re: How do I extract link text from anchor tag as well as the URL from the "href" attribute

2009-08-16 Thread chrysanhy
WHile waiting for suggestions for extracting the link text from the DOM, I tried a brute force approach using the URLs I had found with getAttribute(), but found myself baffled by my results. I boiled down my issue with this approach to the following snippet. $htmldata =<

Re: [PHP] Re: How do I extract link text from anchor tag as well as the URL from the "href" attribute

2009-08-16 Thread chrysanhy
I pasted the code exactly as you have it, and I got the following: *Fatal error*: Call to undefined method DOMElement::getContent() I got the same thing with nodeValue(). On Sun, Aug 16, 2009 at 7:35 AM, Ralph Deffke wrote: > did u try it something like this > > foreach ($links as $link) { >

Re: [PHP] Re: How do I extract link text from anchor tag as well as the URL from the "href" attribute

2009-08-16 Thread Ralph Deffke
I found this iteration over the item collection for ($i = 0; $i < $items->length; $i++) { echo $items->item($i)->nodeValue . "\n"; } check here as well http://us.php.net/manual/en/domnodelist.item.php doesn't seem a simple foreach dos it ralph_def...@yahoo.de "chrysanhy" wrote in message n

[PHP] Re: How do I extract link text from anchor tag as well as the URL from the "href" attribute

2009-08-16 Thread Ralph Deffke
did u try it something like this foreach ($links as $link) { $int_url_list[$i]["href"] = $link->getAttribute( 'href' ); $int_url_list[$i++]["linkText"] = $link->getContent( ); // nodeValue(); } that should work send ur code then please ralph_def...@yahoo,de "chrysanhy" wrote in messag

[PHP] Dan Brown

2009-08-16 Thread Angus Mann
Dan Brown is a frequent poster here and developer on the PHP team. Dan has not posted to the PHP list for quite a while and is not responding to my emails directly to him. Does anyone know if he's OK? If anyone has knowledge can they please reply to me directly - off list. Thanks, Angus

Re: [PHP] Re: How do I extract link text from anchor tag as well as the URL from the "href" attribute

2009-08-16 Thread chrysanhy
It did not work. Both gave me a "Call to undefined method" fatal error. On Sun, Aug 16, 2009 at 1:43 AM, Ralph Deffke wrote: > > try > > $link->nodeValue() > > or > > $link->getContent() > > im not shure which one works on an image link which is indeed a child of so u could also check if the no

Re: [PHP] Issue with the huge import script

2009-08-16 Thread Phpster
On Aug 15, 2009, at 9:15 PM, Devendra Jadhav wrote: Hi, I have to import data from one database to another, I have to import around 10(1Lac) records. First I need to check if the record is already imported or not and import only those records which are not imported. Here is my l

Re: [PHP] Re: Issue with the huge import script

2009-08-16 Thread Ralph Deffke
better consider if u r insulting I've seen a view posts of u falling into that category i w'ld recomment respect posters first approaches even if they r stupid and incorporate the respect in the way u answer the comment "you r crying ..." is an insult. "Ashley Sheridan" wrote in message news:125

[PHP] Re: Issue with the huge import script

2009-08-16 Thread Ollisso
On Sun, 16 Aug 2009 04:15:12 +0300, Devendra Jadhav wrote: Is it because of the size of the records or something else...? Please suggest me some solution which is faster, safe and easy to code :D What about using insert ignore ? :) 1. add UNIQUE constraint on a key you want to add, so yo

Re: [PHP] Re: Issue with the huge import script

2009-08-16 Thread Ashley Sheridan
On Sun, 2009-08-16 at 11:25 +0200, Ralph Deffke wrote: > so then tell me tell me what my first sentence means > > "this sounds huge, and cries for a sql version of the import." > > it looks like u have no experience in working as consultant hotlines Ash > first the folk is asking for a sulotion

Re: [PHP] Re: Issue with the huge import script

2009-08-16 Thread Ralph Deffke
so then tell me tell me what my first sentence means "this sounds huge, and cries for a sql version of the import." it looks like u have no experience in working as consultant hotlines Ash first the folk is asking for a sulotion of HIS php implying a general solution in PHP with a hint to the pr

Re: [PHP] Re: Issue with the huge import script

2009-08-16 Thread Ashley Sheridan
On Sun, 2009-08-16 at 11:05 +0200, Ralph Deffke wrote: > because I assume always that a requester got some intelligence, so in that > case there must be a reasonsble reason why he wants to do it in PHP > > im not like u assuming everybody is a thumb > > ralph > > "Ashley Sheridan" wrote in mess

Re: [PHP] Re: Issue with the huge import script

2009-08-16 Thread Ralph Deffke
because I assume always that a requester got some intelligence, so in that case there must be a reasonsble reason why he wants to do it in PHP im not like u assuming everybody is a thumb ralph "Ashley Sheridan" wrote in message news:1250413427.2344.51.ca...@localhost... > On Sun, 2009-08-16 at

Re: [PHP] Another date exercise

2009-08-16 Thread Ashley Sheridan
On Sun, 2009-08-16 at 08:36 +0100, Lester Caine wrote: > tedd wrote: > > Hi gang: > > > > Here's another exercise to consider. > > > > This is a date entry problem where the user can enter a date in various > > forms, but the return will be in a consistent format. > > > > For example, a user mi

Re: [PHP] Re: Issue with the huge import script

2009-08-16 Thread Ashley Sheridan
On Sun, 2009-08-16 at 04:06 +0200, Ralph Deffke wrote: > Hi, > > this sounds huge, and cries for a sql version of the import. > Are both databases the same? MySQL? > > I give u a draft for MySQL > u export the data u have, then u got a textfile with 10+ sql statments > > in the php script u

[PHP] Re: How do I extract link text from anchor tag as well as the URL from the "href" attribute

2009-08-16 Thread Ralph Deffke
try $link->nodeValue() or $link->getContent() im not shure which one works on an image link which is indeed a child of wrote in message news:88827b190908160033n226b370bqe2ab70732811...@mail.gmail.com... > I have the following code to extract the URLs from the anchor tags of an > HTML page: >

Re: [PHP] Another date exercise

2009-08-16 Thread Lester Caine
tedd wrote: Hi gang: Here's another exercise to consider. This is a date entry problem where the user can enter a date in various forms, but the return will be in a consistent format. For example, a user might enter a date in the form of: August 5, 2009 Aug 05 2009 Aug 5, 9 08/05/09 8-5-9 8

[PHP] How do I extract link text from anchor tag as well as the URL from the "href" attribute

2009-08-16 Thread chrysanhy
I have the following code to extract the URLs from the anchor tags of an HTML page: $html = new DOMDocument(); $htmlpage->loadHtmlFile($location); $xpath = new DOMXPath($htmlpage); $links = $xpath->query( '//a' ); foreach ($links as $link) { $int_url_list[$i++] = $link->getAttribute( 'href' ) . "\