[PHP] [php] tcp server connection
Can someone help me about how to retrieve data using TCP server connection -- Best Wishes A Williams
[PHP] Re: Nasty hacker spammer script
The Doctor wrote: Has anyone seen this before? if (trim($_GET['x'])!=''){...@include($_GET['x']);exit();} lol - that's really bad if you're going to waste your time exploiting peoples stuff at least: make it so it'll actually run something don't include your personal email in the script encrypt the malicious code. lol that has to be one of the lamest hack attempts I've seen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [php] tcp server connection
Andrew Williams wrote: Can someone help me about how to retrieve data using TCP server connection you'll need to be a bit more specific to get any useful help back mate.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [php] tcp server connection
Hi Andrew, You'll be needing the stream functions I'd guess (this si how I always do it, with no problems) http://php.net/stream_socket_client is your starting point. Many Regards, Nathan Andrew Williams wrote: I need to connect to server using IP connection to get raw data, process the raw data and display the data. I have the remote server IP, port number and login details. but I just want to know the best way to establish client to server connection via TCP On Tue, May 12, 2009 at 11:38 AM, Nathan Rixham wrote: Andrew Williams wrote: Can someone help me about how to retrieve data using TCP server connection you'll need to be a bit more specific to get any useful help back mate.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [php] tcp server connection
Nathan Rixham wrote: > Andrew Williams wrote: >> Can someone help me about how to retrieve data using TCP server >> connection >> > > you'll need to be a bit more specific to get any useful help back > mate.. > Just point your browser to "http://example.com/blah/blah"; and you'll get some data using a TCP server connection. Oh, sorry - I forgot about the "useful" bit ... /Per -- Per Jessen, Zürich (21.0°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can not read write file from Desktop
hi I was trying to read a file from Desktop (Centos), Simply saying (php code file is in /var/www/html/ ) if (file_exists("/root/Desktop/conf_files_linux")) echo "yes file is there"; else echo "no none"; It gives me none. If i place conf_files_linux file in /var/www/html. i get yes... After checking log file i got [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) What i need to do, so tht i can access files from outside? help pls thanx -- vikas sharma
Re: [PHP] Re: Mail subject encoding breaks
Hello, on 05/11/2009 12:25 PM Thodoris said the following: This script seems to work ok in a freebsd development server I have but a linux production machine breaks the subject's encoding for some unexpected reason. The subject has a mix of English and Greek characters that FreeBSD seems to handle like a charm. Both machines have the same php version (5.2.9) and the scripts encoding is UTF-8. Iconv and mbstring are configured the same way in php.ini (although I am not aware whether phpmailer uses iconv or mbstring). Has anyone had a similar experience? Is it possible that sendmail (which is the underlying tool) breaks the mail encoding? I am not sure what you mean by breaking the mail encoding. I use the MIME message class and it works perfectly with any encoding, even multibyte character sets. Take a look at the examples test_email_message and test_multibyte_message.php . http://www.phpclasses.org/mimemessage I am not sure what is happening exactly but I think that for some reason the subject of the e-mail includes more than one encoding while using linux. The English part is encoded in ISO-8859-1 and the Greek part into something that I can't detect (probably because thunderbird doesn't support all encodings). The body of the message is UTF-8 as expected. I didn't try the suggested solution since I have solved this, but the original question was about phpmailer. I will give it a try however because it seems like a better solution and more robust than mail_utf8. -- Thodoris
Re: [PHP] Can not read write file from Desktop
hi I was trying to read a file from Desktop (Centos), Simply saying (php code file is in /var/www/html/ ) if (file_exists("/root/Desktop/conf_files_linux")) echo "yes file is there"; else echo "no none"; It gives me none. If i place conf_files_linux file in /var/www/html. i get yes... After checking log file i got [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) What i need to do, so tht i can access files from outside? help pls thanx I assume that this running by the web server (/var/www/html) so a wild guess is that the user that your web server uses to run (usually apache or www) cannot access the Desktop directory. In order to use the suexec feature you need to configure it or else the web server user needs to have read/write rights to the directory you need to access like the Desktop. Though this not recommended. You could always run this script from command line being root or whatever user is the owner of the Desktop directory. Read this if you are not aware of how this can be done: http://www.php.net/features.commandline -- Thodoris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Can includes be used for head tags?
At 9:32 PM +0100 5/11/09, Nathan Rixham wrote: Gary wrote: Thank you to everyone again for your help... Gary ""Gary"" wrote in message news:52.b9.21821.82558...@pb1.pair.com... I was thinking of creating a php include for the tags for a site. Is this possible? Gary just an idea.. if you ran the content of the page through a semantic extractor such as open calais or yahoo term extraction, then that'd be 100%(ish) accurate meta keywords without you worrying. but as everybody else said - yes That's an interesting idea. But the point of meta tags (excluding Google because as i understand it, they don't consider them) is that the title of the page and meta tags description and keywords are supposed to be in "harmony" with the content of the page they are on. While one could create a "semantic extractor" that would create the "perfect" meta keywords and description for any piece of text, the "perfect" arrangement might not be what you actually want. IMO, nothing replaces deliberate thought as to what you ultimately want SE's to index. If nothing else, it seems to work for me. While I get good reports from Google, Yahoo, AllTheWeb and AltaVista, I never seem to get my sites listed with MSN. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] CURL problems still
> > Bastien, could you give me an example of what you mean? > would it be $Name = "" > > like that? > > Thanks for the ideas everyone! > >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > Try Imitliazing the variables at the top of the loop to empty strings > or zeros > > Bastien > > Yep, that's it $_thing = ''; Bastien Well I tried it and still it stopped at the "C's" maybe I put them in the wrong spot? I tried something yesterday where I commented out the "C's" url, and it ran through the "F's" could a setting somewhere be restricting how many files it can run...I am just stumped, the script runs fine, inserts the data I'm wanting etc, just can't get it to run all 26 pagesargh. Code-- foreach($html->find('table') as $table) {foreach($table->find('tr') as $tr) { //set variables to nada ? $name = ''; $age = ''; $warrant = ''; $bond = ''; $wnumber = ''; $crime = '';// Grab children $cells = $tr->children(); if($cells[0]->plaintext != "Name"){for ($i = 0; $i < count($cells); $i++){ switch ($i){ case 0: // Name $name = $cells[$i]->plaintext; echo $cells[$i]->plaintext; break; case 1: // Age $age = $cells[$i]->plaintext; break; case 2: // Warrant type $warrant = $cells[$i]->plaintext; break; case 3: // Bond amount $bond = $cells[$i]->plaintext; break; case 4: // Warrant number $wnumber = $cells[$i]->plaintext; break; case 5: // Offence description $crime = $cells[$i]->plaintext; break; Default: echo "Uh-oh"; } } }// Build your INSERT statement here $query = "INSERT into `warrants` (name, age, warrant, bond, wnumber, crime) VALUES (";$query .= " '$name', '$age', '$warrant', '$bond', '$wnumber', '$crime' )";$wid = mysql_insert_id();echo $query; // run query mysql_query($query) or die (mysql_error()); -end code--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Can includes be used for head tags?
tedd wrote: At 9:32 PM +0100 5/11/09, Nathan Rixham wrote: Gary wrote: Thank you to everyone again for your help... Gary ""Gary"" wrote in message news:52.b9.21821.82558...@pb1.pair.com... I was thinking of creating a php include for the tags for a site. Is this possible? Gary just an idea.. if you ran the content of the page through a semantic extractor such as open calais or yahoo term extraction, then that'd be 100%(ish) accurate meta keywords without you worrying. but as everybody else said - yes That's an interesting idea. But the point of meta tags (excluding Google because as i understand it, they don't consider them) is that the title of the page and meta tags description and keywords are supposed to be in "harmony" with the content of the page they are on. While one could create a "semantic extractor" that would create the "perfect" meta keywords and description for any piece of text, the "perfect" arrangement might not be what you actually want. Ah... I know exactly what you mean here, but the point is they always will be perfect for the content on the page, so if you review and they are not what you want, then it means your content needs rewritten / optimized to include the terms you want. No point trying to cheat a system which is ultimately just going to run it through a similar system to work out what the content is about! IMO, nothing replaces deliberate thought as to what you ultimately want SE's to index. If nothing else, it seems to work for me. While I get exactly, the phrase content is king leads though, and the content on the page together with its structure is probably the key factor - always worth listening to the SE's though, their job is to bring people to the content they want, so make content people want and the SE's will drive traffic to it; especially if you write pages that are not context aware - each page should make complete sense as an entity by itself, not only when you've read the pages previous. good reports from Google, Yahoo, AllTheWeb and AltaVista, I never seem to get my sites listed with MSN. Cheers, tedd MSN is a tricky one, assuming you're using their webmaster tools and have uploaded the validation files etc? cue many opinions.. ps: hi tedd :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Trying to create a colortable - what am I missing here?
דניאל דנון wrote: I've tried to make a color table, but I am missing something. not in the color-table-code itself, but in somewhere else... I just can't find... untested but try.. // 4096*4096 = 16777216 = FF+1 $im = imagecreate(4096, 4096); $white = imagecolorallocate($im, 0, 0, 0); $r = $g = $b = $x = $y = 0; $max = 255; while ($r <= $max) { while ($g <= $max) { while ($b <= $max) { $n = imagecolorallocate($im, $r, $g, $b); imagesetpixel($im, $x, $y, $n); $x = $x == 4096 ? 0 : $x+1; $y = $y == 4096 ? 0 : $y+1; $b++; } $b = 0; $g++; } $g = 0; $r++; } header("Content-Type: image/png"); imagepng($im); imagedestroy($im); Never used image manipulation with PHP but this is giving me a black image. -- Thodoris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Trying to create a colortable - what am I missing here?
Thodoris wrote: > >> דניאל דנון wrote: >>> I've tried to make a color table, but I am missing something. not in the >>> color-table-code itself, but in somewhere else... I just can't find... >> >> untested but try.. >> >> // 4096*4096 = 16777216 = FF+1 >> $im = imagecreate(4096, 4096); >> $white = imagecolorallocate($im, 0, 0, 0); >> $r = $g = $b = $x = $y = 0; >> $max = 255; >> while ($r <= $max) { >> while ($g <= $max) { >> while ($b <= $max) { >> $n = imagecolorallocate($im, $r, $g, $b); >> imagesetpixel($im, $x, $y, $n); >> $x = $x == 4096 ? 0 : $x+1; >> $y = $y == 4096 ? 0 : $y+1; >> $b++; >> } >>$b = 0; >>$g++; >> } >> $g = 0; >> $r++; >> } >> header("Content-Type: image/png"); >> imagepng($im); >> imagedestroy($im); >> >> > > Never used image manipulation with PHP but this is giving me a black image. > You probably need $im = imagecreatetruecolor(4096,4096); Also be aware that creating a truecolor image 4096 pixels square is going to take a LOT of memory, and it will take a while to download to the client, AND it is 4096 pixels square! That's a fair bit bigger than most screens... I suspect the OP is going to have to rethink this... -- Peter Ford phone: 01580 89 Developer fax: 01580 893399 Justcroft International Ltd., Staplehurst, Kent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] CURL problems still
Miller, Terion wrote: Well I tried it and still it stopped at the "C's" 1: your script is timing out, you need to set the time limit higher set_time_limit(0); 2: foreach($html->find('table') as $table) { $rows = explode('' , $table ); $headerCells = explode('', array_shift($rows)); $struct = array(); foreach( $headerCells as $c => $cell ) { $struct[] = str_replace(' ', '_', trim(strtolower(strip_tags( $cell ; } $data = array(); foreach( $rows as $r => $row ) { $cells = explode( '' , $row ); $item = array(); foreach( $cells as $c => $cell ) { $item[$struct[$c]] = trim(strip_tags( $cell )); } $data[] = $item; $query = "INSERT into `warrants` "; $query .= "(name, age, warrant, bond, wnumber, crime)"; $query .= " VALUES ("; $query .= " '{$item['name']}',"; $query .= " '{$item['age']}',"; $query .= " '{$item['warrant_type']}',"; $query .= " '{$item['bond']}',"; $query .= " '{$item['warrant_number']}',"; $query .= " '{$item['offence_description']}'"; $query .= " )"; echo $query . "\n"; // run query here } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can not read write file from Desktop
thanks for replying >From command line can access that file. But i need some interface, through that i want to change some files. I am using apache (httpd) server. Now i need to give access to apache user of those folders, which is not recommended as per you. or in order to use the suexec feature you need to configure How can configure tht? On Tue, May 12, 2009 at 6:39 PM, Thodoris wrote: > > hi >> I was trying to read a file from Desktop (Centos), >> >> Simply saying (php code file is in /var/www/html/ ) >> >> if (file_exists("/root/Desktop/conf_files_linux")) >> echo "yes file is there"; >> else >> echo "no none"; >> >> It gives me none. >> If i place conf_files_linux file in /var/www/html. i get yes... >> >> >> After checking log file i got >> >> [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) >> >> What i need to do, so tht i can access files from outside? >> help pls >> >> thanx >> >> > > I assume that this running by the web server (/var/www/html) so a wild > guess is that the user that your web server uses to run (usually apache or > www) cannot access the Desktop directory. In order to use the suexec feature > you need to configure it or else the web server user needs to have > read/write rights to the directory you need to access like the Desktop. > > Though this not recommended. You could always run this script from command > line being root or whatever user is the owner of the Desktop directory. > Read this if you are not aware of how this can be done: > > http://www.php.net/features.commandline > > -- > Thodoris > > -- vikas sharma
Re: [PHP] Can not read write file from Desktop
Thodoris wrote: > >> hi >> I was trying to read a file from Desktop (Centos), >> >> Simply saying (php code file is in /var/www/html/ ) >> >> if (file_exists("/root/Desktop/conf_files_linux")) >> echo "yes file is there"; >> else >> echo "no none"; >> >> It gives me none. >> If i place conf_files_linux file in /var/www/html. i get yes... >> >> >> After checking log file i got >> >> [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) >> >> What i need to do, so tht i can access files from outside? >> help pls >> >> thanx >> > > I assume that this running by the web server (/var/www/html) so a wild > guess is that the user that your web server uses to run (usually apache > or www) cannot access the Desktop directory. In order to use the suexec > feature you need to configure it or else the web server user needs to > have read/write rights to the directory you need to access like the > Desktop. > > Though this not recommended. You could always run this script from > command line being root or whatever user is the owner of the Desktop > directory. Read this if you are not aware of how this can be done: > > http://www.php.net/features.commandline > If the OP's system is set up properly, then nobody but root should be able to read ANY of root's home directory, so the files will not be found. For a start, one doesn't want config files in anyone's home directory if they are for a system-wide server. And one doesn't EVER want to have anything in /root that anyone but root needs to access. And one shouldn't be logged in as root unless one is doing a short-lived system maintenance task: certainly one should not doing development work there... I know it sounds dictatorial, but it's (part-way to) best practice... Those config files should be in something like /etc/apache/extra, perhaps, if they are not safe in the web root (which they probably are not, unless the web server is configured to keep them safe) -- Peter Ford phone: 01580 89 Developer fax: 01580 893399 Justcroft International Ltd., Staplehurst, Kent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Watermarking of images
At 12:27 PM -0700 5/11/09, Daevid Vincent wrote: > > Here's an example with code: > > > http://webbytedd.com/b/watermark/ I can't read the text over the dog's nose... ;) You're lucky. I don't see ANYTHING (as mentioned weeks ago already)... XP. FF 3.0.10 and IE 6. BOTH do not work. FF console says "startup is not defined" and "unknown property 'zoom'. declaration dropped." Daevid: Interesting, try again: http://webbytedd.com/b/watermark/ It works for me in IE6 and IE7 as well as FF on both XP and Vista. All I did was to remove the references to empty js and css files. Cheers, tedd PS: "weeks ago?" I just posted this yesterday. -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] CURL problems still
Nathan Rixham wrote: Miller, Terion wrote: Well I tried it and still it stopped at the "C's" 1: your script is timing out, you need to set the time limit higher set_time_limit(0); 2: foreach($html->find('table') as $table) { $rows = explode('' , $table ); $headerCells = explode('', array_shift($rows)); $struct = array(); foreach( $headerCells as $c => $cell ) { $struct[] = str_replace(' ', '_', trim(strtolower(strip_tags( $cell ; } $data = array(); foreach( $rows as $r => $row ) { $cells = explode( '' , $row ); $item = array(); foreach( $cells as $c => $cell ) { $item[$struct[$c]] = trim(strip_tags( $cell )); } $data[] = $item; $query = "INSERT into `warrants` "; $query .= "(name, age, warrant, bond, wnumber, crime)"; $query .= " VALUES ("; $query .= " '{$item['name']}',"; $query .= " '{$item['age']}',"; $query .= " '{$item['warrant_type']}',"; $query .= " '{$item['bond']}',"; $query .= " '{$item['warrant_number']}',"; $query .= " '{$item['offence_description']}'"; $query .= " )"; echo $query . "\n"; // run query here } } 3: If this is your own site then don't read on, but if it's not your own site and this is a paid job for a client then.. do you not think there is something a bit wrong about taking on work which you obviously can't do, telling the client you can, then continually asking hard working people to take time out from their own working days to both teach you and complete your work for you? There is such an increase in people just saying "I know PHP" taking on work then getting the helpful people on this list and others to do it for them, and it really really sucks. If you can't do the work don't take it on, if you get genuinely stuck then ask - but don't just copy and paste a clients job description here with some random code and expect others to do it for you. In the time you've spent asking and waiting, you could have learnt how to do it yourself. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: RES: [PHP] CURL problems still
Hi Terion, I thing the problems is the time limit on your Server. Try this now: Test the var before insert into db: If(!isset($crime)){$crime=''} After u remove from the db the unwanted lines. On the end of the file u do this: $letters=array(); for($i='A';$i<='Z';$i++){$letters[$i]=$i;if($i=='Z'){break;}} $tL=count($letters); $letters=array_keys($letters); if(isset($_GET['L'])){if(trim($_GET['L'])!==''){if($_GET['L']+1>$tL){$next=0 ;$final=1;}else{$next=$_GET['L'];}}else{$next=0;}}else{$next=0;} $nextLetter=$letters[$next]; if(!isset($final)){ //do the task //on the end of the file u put this: for($i=0;$i<$tL;$i++){if($nextLetter==$letters[$i]){if($i+1==$tL){$nextLette r=0;$file='A';}else{$nextLetter=$i+1;$file=$letters[$i+1];}break;}} #header('Location:'.$file.'.php?L='.$nextLetter); } U'll need to make A.php, B.php, C.php, D.php, etc... file, with the same content., did u get it? Zechim -Mensagem original- De: Miller, Terion [mailto:tmil...@springfi.gannett.com] Enviada em: terça-feira, 12 de maio de 2009 10:24 Para: Phpster; Miller, Terion Cc: Jônatas Zechim; PHP-General List Assunto: Re: RES: [PHP] CURL problems still > > Bastien, could you give me an example of what you mean? > would it be $Name = "" > > like that? > > Thanks for the ideas everyone! > >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > Try Imitliazing the variables at the top of the loop to empty strings > or zeros > > Bastien > > Yep, that's it $_thing = ''; Bastien Well I tried it and still it stopped at the "C's" maybe I put them in the wrong spot? I tried something yesterday where I commented out the "C's" url, and it ran through the "F's" could a setting somewhere be restricting how many files it can run...I am just stumped, the script runs fine, inserts the data I'm wanting etc, just can't get it to run all 26 pagesargh. Code-- foreach($html->find('table') as $table) {foreach($table->find('tr') as $tr){ //set variables to nada ? $name = ''; $age = ''; $warrant = ''; $bond = ''; $wnumber = ''; $crime = ''; // Grab children $cells = $tr->children(); if($cells[0]->plaintext != "Name"){for ($i = 0; $i < count($cells); $i++){ switch ($i){ case 0: // Name $name = $cells[$i]->plaintext; echo $cells[$i]->plaintext; break; case 1: // Age $age = $cells[$i]->plaintext; break; case 2: // Warrant type $warrant = $cells[$i]->plaintext; break; case 3: // Bond amount $bond = $cells[$i]->plaintext; break; case 4: // Warrant number $wnumber = $cells[$i]->plaintext; break; case 5: // Offence description $crime = $cells[$i]->plaintext; break; Default: echo "Uh-oh"; } } }// Build your INSERT statement here $query = "INSERT into `warrants` (name, age, warrant, bond, wnumber, crime) VALUES (";$query .= " '$name', '$age', '$warrant', '$bond', '$wnumber', '$crime' )";$wid = mysql_insert_id();echo $query;// run query mysql_query($query) or die (mysql_error()); -end code--- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can not read write file from Desktop
Thodoris wrote: hi I was trying to read a file from Desktop (Centos), Simply saying (php code file is in /var/www/html/ ) if (file_exists("/root/Desktop/conf_files_linux")) echo "yes file is there"; else echo "no none"; It gives me none. If i place conf_files_linux file in /var/www/html. i get yes... After checking log file i got [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) What i need to do, so tht i can access files from outside? help pls thanx I assume that this running by the web server (/var/www/html) so a wild guess is that the user that your web server uses to run (usually apache or www) cannot access the Desktop directory. In order to use the suexec feature you need to configure it or else the web server user needs to have read/write rights to the directory you need to access like the Desktop. Though this not recommended. You could always run this script from command line being root or whatever user is the owner of the Desktop directory. Read this if you are not aware of how this can be done: http://www.php.net/features.commandline If the OP's system is set up properly, then nobody but root should be able to read ANY of root's home directory, so the files will not be found. For a start, one doesn't want config files in anyone's home directory if they are for a system-wide server. There is always suexec so this is partly true. And one doesn't EVER want to have anything in /root that anyone but root needs to access. Couldn't agree more. And one shouldn't be logged in as root unless one is doing a short-lived system maintenance task: certainly one should not doing development work there... This is the principle but handling files at root directory might be a maintenance task and since PHP is a scripting language it can be used for this kind of tasks mainly running from command line. I know it sounds dictatorial, but it's (part-way to) best practice... Those config files should be in something like /etc/apache/extra, perhaps, if they are not safe in the web root (which they probably are not, unless the web server is configured to keep them safe) The OP could always use one of the already developed file browsers in PHP. Never tried one besides webmin but a little googling could end up very resourceful. -- Thodoris
Re: [PHP] Re: Trying to create a colortable - what am I missing here?
Thodoris wrote: דניאל דנון wrote: I've tried to make a color table, but I am missing something. not in the color-table-code itself, but in somewhere else... I just can't find... untested but try.. // 4096*4096 = 16777216 = FF+1 $im = imagecreate(4096, 4096); $white = imagecolorallocate($im, 0, 0, 0); $r = $g = $b = $x = $y = 0; $max = 255; while ($r <= $max) { while ($g <= $max) { while ($b <= $max) { $n = imagecolorallocate($im, $r, $g, $b); imagesetpixel($im, $x, $y, $n); $x = $x == 4096 ? 0 : $x+1; $y = $y == 4096 ? 0 : $y+1; $b++; } $b = 0; $g++; } $g = 0; $r++; } header("Content-Type: image/png"); imagepng($im); imagedestroy($im); Never used image manipulation with PHP but this is giving me a black image. You probably need $im = imagecreatetruecolor(4096,4096); Still doesn't work... Now the result is an almost black image with a yellow-white line in the middle. Also be aware that creating a truecolor image 4096 pixels square is going to take a LOT of memory, and it will take a while to download to the client, AND it is 4096 pixels square! That's a fair bit bigger than most screens... It was necessary to increase max execution time to something big above 4 minutes. I suspect the OP is going to have to rethink this... Still curious about the right script though (if this is possible of course). -- Thodoris
[PHP] irrational behavior
Could somebody please explain this? When the line - sort($category) is commented out, the output returns Notice: Undefined offset: in the line "36" for all the repeats (29 in this case) The code below: ", $cat, ""; $ii++; } $ii = $lastIndex; //echo $category[$ii]['category']; while ($ii <= $count -1) { $cat = $category[$ii]['name']; $catn = preg_replace("/[^a-zA-Z0-9]/", "", $cat); echo "", $cat, "" ; $ii++; } echo "" ; } ?> The same phenomenon happens in another application using the identical code. I don't want to sort the category; that has been taken care of in the query. It just doesn't make sense that sorting would affect the count. :-( -- Hervé Kempf: "Pour sauver la planète, sortez du capitalisme." - 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
[PHP] How to include a java script in a php tag (form)
Hello, To be clear, my php file www.auditgratuit.be/copropriete.php doesn't work to send the form. My page starts with The problem is that I have to include a javascript to be able to send the form to my email address. I don't know where and how to put it. Could someone help me please? Thanks! Matthieu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] irrational behavior
Could somebody please explain this? When the line - sort($category) is commented out, the output returns Notice: Undefined offset: in the line "36" for all the repeats (29 in this case) The code below: ", $cat, ""; $ii++; } $ii = $lastIndex; //echo $category[$ii]['category']; while ($ii <= $count -1) { $cat = $category[$ii]['name']; $catn = preg_replace("/[^a-zA-Z0-9]/", "", $cat); echo "", $cat, "" ; $ii++; } echo "" ; } ?> The same phenomenon happens in another application using the identical code. I don't want to sort the category; that has been taken care of in the query. It just doesn't make sense that sorting would affect the count. :-( Well a wild guess is this: This function assigns new keys to the elements in /array/ . It will remove any existing keys that may have been assigned, rather than just reordering the keys http://www.php.net/manual/en/function.sort.php -- Thodoris
Re: [PHP] Re: Trying to create a colortable - what am I missing here?
On Tue, 2009-05-12 at 18:05 +0300, Thodoris wrote: > > Still curious about the right script though (if this is possible of > course). Of course it's possible... but you're probably not going to get the results you want since you're taking 3 dimensions and trying to push them into 2. You'll notice most colour pickers have a square for a given colour, and a bar to pick the colour. The following will produce a colour picker, but it won't look like what you expect: = $width ) { $x = 0; $y++; } } } } header( "Content-Type: image/png" ); imagepng( $im ); imagedestroy( $im ); ?> 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] irrational behavior
Could somebody please explain this? When the line - sort($category) is commented out, the output returns Notice: Undefined offset: in the line "36" for all the repeats (29 in this case) The code below: ", $cat, ""; $ii++; } $ii = $lastIndex; //echo $category[$ii]['category']; while ($ii <= $count -1) { $cat = $category[$ii]['name']; $catn = preg_replace("/[^a-zA-Z0-9]/", "", $cat); echo "", $cat, "" ; $ii++; } echo "" ; } ?> The same phenomenon happens in another application using the identical code. I don't want to sort the category; that has been taken care of in the query. It just doesn't make sense that sorting would affect the count. :-( Well a wild guess is this: This function assigns new keys to the elements in /array/ . It will remove any existing keys that may have been assigned, rather than just reordering the keys http://www.php.net/manual/en/function.sort.php Forgot to mention this of course which was my point on the first place: Be careful when sorting arrays with mixed types values because *sort()* can produce unpredictable results. -- Thodoris
Re: [PHP] irrational behavior
Robert Stankiewicz wrote: > Maybe, because of this ? >> $category[$row['name']] = $row; >> > >> $cat = $category[$ii]['name']; //===this is line >> 36== >> > > best regards > Robert > I'm afraid you lose me completely. What does the sort($category) have to do with the count or $ii or whatever it is that is screwing up the script. It works perfectly when the sort is not commented out. Why and how does that change anything. The order certainly does not change the number of rows, or does it? -- Hervé Kempf: "Pour sauver la planète, sortez du capitalisme." - 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
[PHP] Re: irrational behavior
PJ wrote: Could somebody please explain this? When the line - sort($category) is commented out, the output returns Notice: Undefined offset: in the line "36" for all the repeats (29 in this case) The code below: ", $cat, ""; $ii++; } $ii = $lastIndex; //echo $category[$ii]['category']; while ($ii <= $count -1) { $cat = $category[$ii]['name']; $catn = preg_replace("/[^a-zA-Z0-9]/", "", $cat); echo "", $cat, "" ; $ii++; } echo "" ; } ?> The same phenomenon happens in another application using the identical code. I don't want to sort the category; that has been taken care of in the query. It just doesn't make sense that sorting would affect the count. :-( what your doing is: $category[$row['name']] which sets $category['some name'] an associative array. now when you do sort($category); you're sorting all results and assigning them to numerical indexes.. so now $category contains: $category[0] $category[1] $category[2] ... which is what you need seeing as you are cycling them as a numerical array. so sort is turning your associative array in to the needed indexed array. if you remove sort($category) and then change this line: $category[$row['name']] = $row; to $category[] = $row; you'll find it works without error. regards, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] irrational behavior
2009/5/12 PJ : > Could somebody please explain this? > When the line - sort($category) is commented out, the output returns > Notice: Undefined offset: in the line "36" for all the repeats (29 in > this case) Sure thing if you consider this: > The code below: > $SQL = "SELECT name >FROM categories ORDER BY category_id >"; > $category = array(); > //[...] >$category[$row['name']] = $row; > //[...] while >$cat = $category[$ii]['name']; //===this is line 36== > After setting only $arr[NAMEfromDB], why should be a numeric index $arr[INT] ? Now just do var_dump($category) before and after your sort() - But I don't see why you still have it, when the query itself does the sorting. Regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Trying to create a colortable - what am I missing here?
On Tue, 2009-05-12 at 18:05 +0300, Thodoris wrote: Still curious about the right script though (if this is possible of course). Of course it's possible... but you're probably not going to get the results you want since you're taking 3 dimensions and trying to push them into 2. You'll notice most colour pickers have a square for a given colour, and a bar to pick the colour. The following will produce a colour picker, but it won't look like what you expect: if( ++$x >= $width ) { $x = 0; $y++; } } } } header( "Content-Type: image/png" ); imagepng( $im ); imagedestroy( $im ); ?> Cheers, Rob. Thanks for pointing to the right direction Rob. I should really consider some reading on image manipulation theory. My curiosity still beats my reading though. -- Thodoris
Re: [PHP] irrational behavior
Maybe, because of this ? $category[$row['name']] = $row; . $cat = $category[$ii]['name']; //===this is line 36== best regards Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: irrational behavior
PJ wrote: > Could somebody please explain this? > When the line - sort($category) is commented out, the output returns > Notice: Undefined offset: in the line "36" for all the repeats (29 in > this case) Sure it makes sense and is rational, you just have no idea what you're doing :-) > The code below: > $SQL = "SELECT name > FROM categories ORDER BY category_id > "; > $category = array(); > if ( ( $results = mysql_query($SQL, $db) ) !== false ) { > while ( $row = mysql_fetch_assoc($results) ) { You assign your categories to an associative array, so it might look like this $category['bob'] = array > $category[$row['name']] = $row; > } > //sort($category); > $count = mysql_num_rows($results); > $lastIndex = ceil($count/2 -1); //echo $lastIndex; > $ii = 0; > while ($ii <= $lastIndex) { But then you try and loop through them like they are numerically indexed, like this $category[0]['name'] = array So either change this part to foreach through the associative array, or change the assignment above to $category[] = $row; > $cat = $category[$ii]['name']; //===this is line 36== > $catn = preg_replace("/[^a-zA-Z0-9]/", "", $cat); > echo "", $cat, ""; > $ii++; > } > > $ii = $lastIndex; > //echo $category[$ii]['category']; > while ($ii <= $count -1) { You will get the same problems here. Make one of the changes suggested above. > $cat = $category[$ii]['name']; > $catn = preg_replace("/[^a-zA-Z0-9]/", "", $cat); > echo "", $cat, "" ; > $ii++; > } > echo "" ; > } > ?> > > The same phenomenon happens in another application using the identical code. > I don't want to sort the category; that has been taken care of in the query. > It just doesn't make sense that sorting would affect the count. :-( > The sorting actually re-indexes your associative array into a numerical one that makes the code that follows work more correctly. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] irrational behavior SOLVED
Jan G.B. wrote: > 2009/5/12 PJ : > >> Could somebody please explain this? >> When the line - sort($category) is commented out, the output returns >> Notice: Undefined offset: in the line "36" for all the repeats (29 in >> this case) >> > > Sure thing if you consider this: > > > > >> The code below: >> > $SQL = "SELECT name >>FROM categories ORDER BY category_id >>"; >> $category = array(); >> //[...] >>$category[$row['name']] = $row; >> //[...] while >>$cat = $category[$ii]['name']; //===this is line 36== >> >> > > After setting only $arr[NAMEfromDB], why should be a numeric index $arr[INT] ? > > > Now just do var_dump($category) before and after your sort() - But I > don't see why you still have it, when the query itself does the > sorting. > > Regards > Kind of a nice solution for the problem I originally had which was to use a list of categories in the db which had to be used in href for pages with the same names. I had to sort the list as, at the time, I did not know how otherwise to sort the list - the id field was not sequential and I don't remember what other problem may have been involved. I had forgotten that the sort changed the keys. Actually, in the present case I did not want to sort by id since it was already sorted the way I wanted. Thanks to all for the input. The haze slowly clears... :-) -- Hervé Kempf: "Pour sauver la planète, sortez du capitalisme." - 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: irrational behavior
Shawn McKenzie wrote: > PJ wrote: > >> Could somebody please explain this? >> When the line - sort($category) is commented out, the output returns >> Notice: Undefined offset: in the line "36" for all the repeats (29 in >> this case) >> > > Sure it makes sense and is rational, you just have no idea what you're > doing :-) > > You're absolutely right! :-) >> The code below: >> > $SQL = "SELECT name >> FROM categories ORDER BY category_id >> "; >> $category = array(); >> if ( ( $results = mysql_query($SQL, $db) ) !== false ) { >> while ( $row = mysql_fetch_assoc($results) ) { >> > > You assign your categories to an associative array, so it might look > like this $category['bob'] = array > > >> $category[$row['name']] = $row; >> } >> //sort($category); >> $count = mysql_num_rows($results); >> $lastIndex = ceil($count/2 -1); //echo $lastIndex; >> $ii = 0; >> while ($ii <= $lastIndex) { >> > > But then you try and loop through them like they are numerically > indexed, like this $category[0]['name'] = array > > So either change this part to foreach through the associative array, or > change the assignment above to $category[] = $row; > > >> $cat = $category[$ii]['name']; //===this is line 36== >> $catn = preg_replace("/[^a-zA-Z0-9]/", "", $cat); >> echo "", $cat, ""; >> $ii++; >> } >> >> $ii = $lastIndex; >> //echo $category[$ii]['category']; >> while ($ii <= $count -1) { >> > > You will get the same problems here. Make one of the changes suggested > above. > > >> $cat = $category[$ii]['name']; >> $catn = preg_replace("/[^a-zA-Z0-9]/", "", $cat); >> echo "", $cat, "" ; >> $ii++; >> } >> echo "" ; >> } >> ?> >> >> The same phenomenon happens in another application using the identical code. >> I don't want to sort the category; that has been taken care of in the query. >> It just doesn't make sense that sorting would affect the count. :-( >> >> > > The sorting actually re-indexes your associative array into a numerical > one that makes the code that follows work more correctly. > Thanks much. This helps to understand the arrays. -- Hervé Kempf: "Pour sauver la planète, sortez du capitalisme." - 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] How to include a java script in a php tag (form)
> > > and there is a special > > $html = ' blablablablabla '; > > where all the html code is written for the form (table,...). > > The problem is that I have to include a javascript to be able to send the > form to my email address. I don't know where and how to put it. > > Could someone help me please? > Why not just have your "Send" button call the javascript? //Create your javascript function //Create your form //Make your "Send" button call your Javascript function HTH, Dan
Re: [PHP] Nasty hacker spammer script
On Tue, May 12, 2009 at 07:40:57AM +0100, Ashley Sheridan wrote: > On Mon, 2009-05-11 at 17:59 -0600, The Doctor wrote: > [snip][/snip] > > You find this on your server? > > > Ash > www.ashleysheridan.co.uk > Courtesy of a PHP-hacked shell. -- Member - Liberal International This is doc...@nl2k.ab.ca Ici doc...@nl2k.ab.ca God, Queen and country! Beware Anti-Christ rising! Never Satan President Republic! 12 May BC vote Liberal and remember the NDP scandals like Mulroney! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Watermarking of images
yep. works in both now. :) > -Original Message- > From: tedd [mailto:tedd.sperl...@gmail.com] > Sent: Tuesday, May 12, 2009 6:55 AM > To: php-general@lists.php.net; Daevid Vincent > Subject: RE: [PHP] Watermarking of images > > At 12:27 PM -0700 5/11/09, Daevid Vincent wrote: > > > > Here's an example with code: > >> > > > > > http://webbytedd.com/b/watermark/ > >> > >> I can't read the text over the dog's nose... ;) > > > >You're lucky. I don't see ANYTHING (as mentioned weeks ago > already)... > > > >XP. FF 3.0.10 and IE 6. > > > >BOTH do not work. > > > >FF console says "startup is not defined" and "unknown > property 'zoom'. > >declaration dropped." > > Daevid: > > Interesting, try again: > > http://webbytedd.com/b/watermark/ > > It works for me in IE6 and IE7 as well as FF on both XP and Vista. > > All I did was to remove the references to empty js and css files. > > Cheers, > > tedd > > PS: "weeks ago?" I just posted this yesterday. > > -- > --- > http://sperling.com http://ancientstones.com http://earthstones.com > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Watermarking of images
On Tue, 2009-05-12 at 09:54 -0400, tedd wrote: > At 12:27 PM -0700 5/11/09, Daevid Vincent wrote: > > > > Here's an example with code: > >> > > > > > http://webbytedd.com/b/watermark/ > >> > >> I can't read the text over the dog's nose... ;) > > > >You're lucky. I don't see ANYTHING (as mentioned weeks ago already)... > > > >XP. FF 3.0.10 and IE 6. > > > >BOTH do not work. > > > >FF console says "startup is not defined" and "unknown property 'zoom'. > >declaration dropped." > > Daevid: > > Interesting, try again: > > http://webbytedd.com/b/watermark/ > > It works for me in IE6 and IE7 as well as FF on both XP and Vista. > > All I did was to remove the references to empty js and css files. I think you missed the point of my comment about the black text over the dog's black nose. The whole thrust of this thread was to determine how to get the black outline around the text. The OP already had text on an image and I showed how to get an outline so that regardless of the image content the watermark would always be readable. 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] Mail subject encoding breaks
On 5/11/09 11:58 AM, "Thodoris" wrote: > >> On 11 May 2009 at 18:25, Thodoris wrote: >> >> >>> Hi gang, >>> I am using phpmailer to send some mail notifications in an intranet >>> I've made. This is a sample code: >>> >> >> >>> $e->Subject = "This is δφκξγκδφη garbidge κηδφκξγσ"; >>> >> >> Hi, >> >> I have had success with this in the past: >> >> $subject = "This is δφκξγκδφη garbidge κηδφκξγσ"; >> $e->Subject = mb_encode_mimeheader($subject, "UTF-8", "Q") ; >> >> Regards >> >> Ian >> > > Thanks Ian this works in most cases but there are times that still > breaks the subject. I have experimented with: > > mb_encode_mimeheader($subject, "UTF-8", "B") > > as well but nothing seems to be working without problems. is it possible that in the problem cases the subject string isn't valid utf-8? you can check with mb_check_encoding($subject) you can sanitize bad utf-8 with iconv("UTF-8","UTF-8//IGNORE",$subject) though you probably won't get the string you want with that. when you don't have other options, this will at least clean up bad encoding. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Watermarking of images
At 3:48 PM -0400 5/12/09, Robert Cummings wrote: On Tue, 2009-05-12 at 09:54 -0400, tedd wrote: At 12:27 PM -0700 5/11/09, Daevid Vincent wrote: > > > Here's an example with code: >> > > > > http://webbytedd.com/b/watermark/ >> >> I can't read the text over the dog's nose... ;) > >You're lucky. I don't see ANYTHING (as mentioned weeks ago already)... > >XP. FF 3.0.10 and IE 6. > >BOTH do not work. > >FF console says "startup is not defined" and "unknown property 'zoom'. >declaration dropped." Daevid: Interesting, try again: http://webbytedd.com/b/watermark/ It works for me in IE6 and IE7 as well as FF on both XP and Vista. All I did was to remove the references to empty js and css files. I think you missed the point of my comment about the black text over the dog's black nose. The whole thrust of this thread was to determine how to get the black outline around the text. The OP already had text on an image and I showed how to get an outline so that regardless of the image content the watermark would always be readable. Cheers, Rob. Rob: I didn't miss it, I just didn't address that part of the post. Please note -- the OP originally asked: [1] --- quote That site is also coded in php so I'm guessing that the watermark is added using a php technology. Can someone enlighten me on how that is done? -- unquote And: [2] --- quote Also, while not php related, could someone enlighten me of a really good font to use for watermarking images? -- unquote While your post dealt with [2] mine was addressing [1]. Understand? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Watermarking of images
On Tue, 2009-05-12 at 16:31 -0400, tedd wrote: > At 3:48 PM -0400 5/12/09, Robert Cummings wrote: > >On Tue, 2009-05-12 at 09:54 -0400, tedd wrote: > >> At 12:27 PM -0700 5/11/09, Daevid Vincent wrote: > >> > > > Here's an example with code: > >> >> > > >> > > > http://webbytedd.com/b/watermark/ > >> >> > >> >> I can't read the text over the dog's nose... ;) > >> > > >> >You're lucky. I don't see ANYTHING (as mentioned weeks ago already)... > >> > > >> >XP. FF 3.0.10 and IE 6. > >> > > >> >BOTH do not work. > >> > > >> >FF console says "startup is not defined" and "unknown property 'zoom'. > >> >declaration dropped." > >> > >> Daevid: > >> > >> Interesting, try again: > >> > >> http://webbytedd.com/b/watermark/ > >> > >> It works for me in IE6 and IE7 as well as FF on both XP and Vista. > >> > >> All I did was to remove the references to empty js and css files. > > > >I think you missed the point of my comment about the black text over the > >dog's black nose. The whole thrust of this thread was to determine how > >to get the black outline around the text. The OP already had text on an > >image and I showed how to get an outline so that regardless of the image > >content the watermark would always be readable. > > > >Cheers, > >Rob. > > Rob: > > I didn't miss it, I just didn't address that part of the post. Please > note -- the OP originally asked: > > [1] --- quote > >That site is also coded in php so I'm guessing that the watermark is > >added using a php technology. > > > >Can someone enlighten me on how that is done? > -- unquote > > And: > > [2] --- quote > >Also, while not php related, could someone enlighten me of a really > >good font to use for watermarking images? > -- unquote > > While your post dealt with [2] mine was addressing [1]. Understand? Except he already had that part working. He wanted to get the outline. You would know that if you read the full post since he gave a link to what he already had using PHP. When he says: "That site is also coded in php so I'm guessing that the watermark is added using a php technology." It means that he can presumably also generate a watermark with an outline using PHP and GD. Comprendez vous? 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] Watermarking of images
Robert Cummings wrote: > On Tue, 2009-05-12 at 16:31 -0400, tedd wrote: > >> At 3:48 PM -0400 5/12/09, Robert Cummings wrote: >> >>> On Tue, 2009-05-12 at 09:54 -0400, tedd wrote: >>> At 12:27 PM -0700 5/11/09, Daevid Vincent wrote: > > > Here's an example with code: >> > > > > http://webbytedd.com/b/watermark/ >> >> I can't read the text over the dog's nose... ;) > >You're lucky. I don't see ANYTHING (as mentioned weeks ago already)... > >XP. FF 3.0.10 and IE 6. > >BOTH do not work. > >FF console says "startup is not defined" and "unknown property 'zoom'. >declaration dropped." Daevid: Interesting, try again: http://webbytedd.com/b/watermark/ It works for me in IE6 and IE7 as well as FF on both XP and Vista. All I did was to remove the references to empty js and css files. >>> I think you missed the point of my comment about the black text over the >>> dog's black nose. The whole thrust of this thread was to determine how >>> to get the black outline around the text. The OP already had text on an >>> image and I showed how to get an outline so that regardless of the image >>> content the watermark would always be readable. >>> >>> Cheers, >>> Rob. >>> >> Rob: >> >> I didn't miss it, I just didn't address that part of the post. Please >> note -- the OP originally asked: >> >> [1] --- quote >> >>> That site is also coded in php so I'm guessing that the watermark is >>> added using a php technology. >>> >>> Can someone enlighten me on how that is done? >>> >> -- unquote >> >> And: >> >> [2] --- quote >> >>> Also, while not php related, could someone enlighten me of a really >>> good font to use for watermarking images? >>> >> -- unquote >> >> While your post dealt with [2] mine was addressing [1]. Understand? >> > > Except he already had that part working. He wanted to get the outline. > You would know that if you read the full post since he gave a link to > what he already had using PHP. When he says: > > "That site is also coded in php so I'm guessing that the > watermark is added using a php technology." > > It means that he can presumably also generate a watermark with an > outline using PHP and GD. > > Comprendez vous? > That's "comprenez-vous?" Comprends-tu? ;-) > Cheers, > Rob. > -- Hervé Kempf: "Pour sauver la planète, sortez du capitalisme." - 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
[PHP] handling chunked input from php://stdin
I have a server running that receives xml formatted events from other services I have no control over. For certain events the transfer-encoding is chunked. I was just doing $input = file_get_contents('php://stdin'); and this works well until there is chunked input. Then I tried $handle = fopen('php://input', "rb"); $input = ''; while (!feof($handle)) { $input .= fread($handle, 8192); } fclose($handle); And that gives about the same result, has anyone else come across this and how did they solve it? Thanks in advance -- View this message in context: http://www.nabble.com/handling-chunked-input-from-php%3A--stdin-tp23512171p23512171.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] database session management with mdb2
The database session management class I'm using is something I downloaded off the web several years ago. I ported it to use mdb2 but it sometimes fails in a strange way if the session is expired or if the browser sends a session cookie that does not exist. With error reporting turned off this isn't a problem. But with error reporting turned on, it breaks the xml. Since error reporting is turned on on my devel machine, this is an issue. The functions are hard coded to return true and it seems that when the write or gc function fails, the function of the site is not affected, but the error message that results at the end of the page causes an xml failure. Where it fails is in the write class and the garbage collection. Unfortunately I don't know enough about the internals of sessions to try to fix it, so I'm hoping someone can point me to a well tested database session management class written for pear mdb2. All my googling thus far has turned up classes that use a specific database and I really want to avoid that, I'd rather use flat file than go that direction. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Watermarking of images
On Tue, 2009-05-12 at 18:53 -0400, PJ wrote: > Robert Cummings wrote: > > On Tue, 2009-05-12 at 16:31 -0400, tedd wrote: > > > >> At 3:48 PM -0400 5/12/09, Robert Cummings wrote: > >> > >>> On Tue, 2009-05-12 at 09:54 -0400, tedd wrote: > >>> > At 12:27 PM -0700 5/11/09, Daevid Vincent wrote: > > > > Here's an example with code: > >> > > > > > http://webbytedd.com/b/watermark/ > >> > >> I can't read the text over the dog's nose... ;) > > > >You're lucky. I don't see ANYTHING (as mentioned weeks ago already)... > > > >XP. FF 3.0.10 and IE 6. > > > >BOTH do not work. > > > >FF console says "startup is not defined" and "unknown property 'zoom'. > >declaration dropped." > > Daevid: > > Interesting, try again: > > http://webbytedd.com/b/watermark/ > > It works for me in IE6 and IE7 as well as FF on both XP and Vista. > > All I did was to remove the references to empty js and css files. > > >>> I think you missed the point of my comment about the black text over the > >>> dog's black nose. The whole thrust of this thread was to determine how > >>> to get the black outline around the text. The OP already had text on an > >>> image and I showed how to get an outline so that regardless of the image > >>> content the watermark would always be readable. > >>> > >>> Cheers, > >>> Rob. > >>> > >> Rob: > >> > >> I didn't miss it, I just didn't address that part of the post. Please > >> note -- the OP originally asked: > >> > >> [1] --- quote > >> > >>> That site is also coded in php so I'm guessing that the watermark is > >>> added using a php technology. > >>> > >>> Can someone enlighten me on how that is done? > >>> > >> -- unquote > >> > >> And: > >> > >> [2] --- quote > >> > >>> Also, while not php related, could someone enlighten me of a really > >>> good font to use for watermarking images? > >>> > >> -- unquote > >> > >> While your post dealt with [2] mine was addressing [1]. Understand? > >> > > > > Except he already had that part working. He wanted to get the outline. > > You would know that if you read the full post since he gave a link to > > what he already had using PHP. When he says: > > > > "That site is also coded in php so I'm guessing that the > > watermark is added using a php technology." > > > > It means that he can presumably also generate a watermark with an > > outline using PHP and GD. > > > > Comprendez vous? > > > That's "comprenez-vous?" Comprends-tu? ;-) That's why my kids are in French immersion :) But moving along... you did "understand" it ;) 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] database session management with mdb2
Michael A. Peters wrote: The database session management class I'm using is something I downloaded off the web several years ago. I ported it to use mdb2 but it sometimes fails in a strange way if the session is expired or if the browser sends a session cookie that does not exist. With error reporting turned off this isn't a problem. But with error reporting turned on, it breaks the xml. Since error reporting is turned on on my devel machine, this is an issue. The functions are hard coded to return true and it seems that when the write or gc function fails, the function of the site is not affected, but the error message that results at the end of the page causes an xml failure. Where it fails is in the write class and the garbage collection. Unfortunately I don't know enough about the internals of sessions to try to fix it, so I'm hoping someone can point me to a well tested database session management class written for pear mdb2. All my googling thus far has turned up classes that use a specific database and I really want to avoid that, I'd rather use flat file than go that direction. I may have figured out the issue - the class seems to trying to be write the session data before it has created a new session when a session doesn't exist. I'll play with it some more and see - but I would love a well tested existing class ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Watermarking of images
Robert Cummings wrote: > On Tue, 2009-05-12 at 18:53 -0400, PJ wrote: > >> Robert Cummings wrote: >> >>> On Tue, 2009-05-12 at 16:31 -0400, tedd wrote: >>> >>> At 3:48 PM -0400 5/12/09, Robert Cummings wrote: > On Tue, 2009-05-12 at 09:54 -0400, tedd wrote: > > >> At 12:27 PM -0700 5/11/09, Daevid Vincent wrote: >> > > > Here's an example with code: >> >> > >> > > > http://webbytedd.com/b/watermark/ >> >> >> >> I can't read the text over the dog's nose... ;) >> > >> >You're lucky. I don't see ANYTHING (as mentioned weeks ago already)... >> > >> >XP. FF 3.0.10 and IE 6. >> > >> >BOTH do not work. >> > >> >FF console says "startup is not defined" and "unknown property 'zoom'. >> >declaration dropped." >> >> Daevid: >> >> Interesting, try again: >> >> http://webbytedd.com/b/watermark/ >> >> It works for me in IE6 and IE7 as well as FF on both XP and Vista. >> >> All I did was to remove the references to empty js and css files. >> >> > I think you missed the point of my comment about the black text over the > dog's black nose. The whole thrust of this thread was to determine how > to get the black outline around the text. The OP already had text on an > image and I showed how to get an outline so that regardless of the image > content the watermark would always be readable. > > Cheers, > Rob. > > Rob: I didn't miss it, I just didn't address that part of the post. Please note -- the OP originally asked: [1] --- quote > That site is also coded in php so I'm guessing that the watermark is > added using a php technology. > > Can someone enlighten me on how that is done? > > -- unquote And: [2] --- quote > Also, while not php related, could someone enlighten me of a really > good font to use for watermarking images? > > -- unquote While your post dealt with [2] mine was addressing [1]. Understand? >>> Except he already had that part working. He wanted to get the outline. >>> You would know that if you read the full post since he gave a link to >>> what he already had using PHP. When he says: >>> >>> "That site is also coded in php so I'm guessing that the >>> watermark is added using a php technology." >>> >>> It means that he can presumably also generate a watermark with an >>> outline using PHP and GD. >>> >>> Comprendez vous? >>> >>> >> That's "comprenez-vous?" Comprends-tu? ;-) >> > > That's why my kids are in French immersion :) > > But moving along... you did "understand" it ;) > > Cheers, > Rob. > To tell the truth, I've been following in a half hearted manner... I'm a professional photographer and have not needed watermarking up to now. But I gathered enough to understand what should be done... I see no problem. And if I ever stumble, I can always count on the e-mails I have backed up or on the big hearts of the guys on the list. You're all great. Love ya! ;-) -- Hervé Kempf: "Pour sauver la planète, sortez du capitalisme." - 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] handling chunked input from php://stdin
whisperstream wrote: > I have a server running that receives xml formatted events from other > services I have no control over. For certain events the transfer-encoding > is chunked. > > I was just doing > > $input = file_get_contents('php://stdin'); > > and this works well until there is chunked input. Then I tried > > $handle = fopen('php://input', "rb"); > $input = ''; > while (!feof($handle)) { > $input .= fread($handle, 8192); > } > fclose($handle); > > And that gives about the same result, has anyone else come across this and > how did they solve it? > > Thanks in advance > There aren't really many examples around, but check http_chunked_decode() from PECL. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Urgent problem PCRE or DOM help
Home | My Interface My Interface DONT READ TABLE Step-By-Step Instructions: P tags IMG tags DONT READ I am having trouble with the above HTML semantics. I just need to read the content inside the TD with Class name text11(its the only class in the page as well). Need to omit the table inside as it contains Adsense ads. Got to omit the first two A HREF tags as well. I'm not very good with PCRE so failing to make it work. Tried with DOMDocument but with the examples found I failed to achieve the result. $elements = $doc->getElementsById('table'); if (!is_null($elements)) { foreach ($elements as $element) { echo "". $element->nodeName. ": "; $nodes = $element->childNodes; foreach ($nodes as $node) { echo $node->nodeValue. ""; } } } This above code only gets Texts inside but not Img. Plz any help would be greatly appreciated.
[PHP] fileinfo on RHEL5
RHEL5/PHP 5.1.6 I'm having some trouble getting the Fileinfo package working. It installed fine, and phpinfo() says it's enabled. But it consistently returns an empty string when getting the MIME of a file. /usr/share/pear/bin/pecl install fileinfo vi /etc/php.d/fileinfo.ini extension=fileinfo.so ln -s /usr/share/file/magic /etc/magic.mime The code: define('FINFO_PATH', '/usr/share/file/magic'); ... $fi = new finfo(FILEINFO_MIME, FINFO_PATH); $type = $fi->file($file_path); $type is always empty. And, yes, the path to the file is good. This works fine on the dev box (PHP 5.2.6). Unfortunately, the decision to use RHEL5 for production was out of my hands and I'm stuck with this older version. At least, I'm thinking it might be due to that. I didn't see anything in the manual about it, though. I did come across a post[1] online about doing file conversions where the guy mentions rolling an upgrade to 5.2.4 for RHEL5 but wasn't specific as to whether it was necessary to get Fileinfo to work at all. I might try using that upgrade but thought I'd do a sanity check here first. Any other reason it'd be returning nothing? [1] http://bhuga.net/2008/07/setting-your-system-file-conversions-with-file-framework -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php