RE: [PHP] GD 2.0.28 + PHP 4.4.2 + pixelation :(

2006-12-27 Thread Peter Lauri
Hi,

imagecopyresampled might help you... I use that and it works without
problems.

/Peter

-Original Message-
From: Steven Macintyre [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 27, 2006 10:17 AM
To: php-general@lists.php.net
Subject: [PHP] GD 2.0.28 + PHP 4.4.2 + pixelation :(

Hi All,

I have done some searching via google and some answers say change
copyimageresampled to copyimageresized etc 

I have tried all fixes ... to no avail


I have one image here 1280 x 960 (150 dpi) 24 depth

When using the following it pixelates ... 

function createthumb($name,$filename,$new_w,$new_h)
{
$system=explode(".",$name);
$src_img=imagecreatefromjpeg($name);
$old_x=imageSX($src_img);
$old_y=imageSY($src_img);
if ($old_x > $old_y)
{
$thumb_w=$new_w;
$thumb_h=$old_y*($new_h/$old_x);
}
if ($old_x < $old_y)
{
$thumb_w=$old_x*($new_w/$old_y);
$thumb_h=$new_h;
}
if ($old_x == $old_y)
{
$thumb_w=$new_w;
$thumb_h=$new_h;
}
$dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);

imagecopyresized($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
imagejpeg($dst_img,$filename);
imagedestroy($dst_img);
imagedestroy($src_img);
}

Which I am of course calling with
createthumb($add,'../pics/'.$largeval,350,263);

Now ... afaik my new sizes are proportional to the big ones ... but it
pixelates :(

However,

Using an image 1600 x 1200 (96 dpi) 24 depth it works and there is no
pixilation

Can someone perhaps assist now?


  
Kind Regards,


Steven Macintyre
http://steven.macintyre.name
--

http://www.friends4friends.co.za

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] PDFlib problem

2006-12-27 Thread Peter Lauri
Try this one:

http://pecl.php.net/bugs/bug.php?id=9491&edit=1

/Peter

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free



-Original Message-
From: Rosen [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 27, 2006 2:58 PM
To: php-general@lists.php.net
Subject: [PHP] PDFlib problem

Hi,
I have problem with PDFlib on Windows 2000, PHP 5.2.0 and Apache 2.2.3

When I try to execute:

$p = new PDFlib();

in the Apache log I receive:
PDFlib exception (fatal): [1202] PDF_set_parameter: Unknown key 'objorient'
[.] [notice] Parent: child process exited with status 99 -- Restarting.

And nothing happens - I receive "Problem loading page".

Can someone help?

Thanks in advance,
Rosen

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: PDFlib problem

2006-12-27 Thread Peter Lauri
http://www.pdflib.com/download/pdflib-family/pdflib-6/

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free

-Original Message-
From: Rosen [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 27, 2006 4:40 PM
To: php-general@lists.php.net
Subject: [PHP] Re: PDFlib problem

Thank you all,
But from where I can download new version ( binary)  of  PDFlib  for windows

?


""Rosen"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi,
> I have problem with PDFlib on Windows 2000, PHP 5.2.0 and Apache 2.2.3
>
> When I try to execute:
>
> $p = new PDFlib();
>
> in the Apache log I receive:
> PDFlib exception (fatal): [1202] PDF_set_parameter: Unknown key 
> 'objorient'
> [.] [notice] Parent: child process exited with status 99 --  
> Restarting.
>
> And nothing happens - I receive "Problem loading page".
>
> Can someone help?
>
> Thanks in advance,
> Rosen 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Simple PDF manipulation

2006-12-27 Thread Peter Lauri
FPDF might do the same thing, won't it?

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free




-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 27, 2006 11:11 PM
To: php-general@lists.php.net
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Simple PDF manipulation

Yeah, this is exactly what we do at my work.  We have a license for PDFLib
and essentually we load blank forms and then say take this text and position
it at this location.  Kind of like putting words on a clear piece of acetate
and overlaying it on top of a piece of paper.

If I recall, we had issues trying to do this with fpdf and some other PHP
PDF libraries, but PDFlib allowed us to do it and it's what we've used ever
since.

Actually, tedd.. did you use PDFlib or another library or maybe something in
PHP5 (that we don't use yet)?  We may be moving off of PDFlib at some point
and I may be looking for alternatives.  This is the main function we need.
Ignorant question, but I havn't even thought of researching it yet and
figured I'd ask while the topic was at hand.

-TG

= = = Original message = = =

Interesting, that's a good idea. I was not aware that it was possible  
to load an existing PDF into memory and then add stuff to it.


On Dec 27, 2006, at 7:28 AM, tedd wrote:

> At 6:32 AM -0800 12/27/06, Brian Dunning wrote:
>> Let's say I have a complicated PDF document, like a Christmas  
>> card, that was made in Illustrator -- too complicated to easily  
>> create from scratch using PDFlib. Is there a way to use PHP make  
>> simple text changes - like changing "Dear XXX" to "Dear John"?  
>> I've opened the files with a text editor and cannot locate the  
>> simple text, it appears to be encoded somehow. The PDF has no  
>> security or encryption in it. Thanks
>
> Brian:
>
> I'm not saying that there is/isn't a way to do this, but I tried  
> and failed.
>
> In my investigation, I found that the insides of a PDF file are not  
> conducive to a simple search and replace mechanism. The text is  
> encoded in some fashion that is not easy to decode and reassemble.
>
> The solution I came up with was to combine the existing PDF file  
> with my coding and write over (on top of) the old to produce the  
> new PDF that I wanted. In your case, take your Christmas Card with  
> a big space where "xxx" appears and then write over that space with  
> "John" in your new code.
>
> I wish someone would show me a simpler way to do this.
>
> hth's
>
> 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
>


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Chocked

2006-12-28 Thread Peter Lauri
I was chocked when I got my additional dedicated server from my server
provider. I assumed everyting would have been the same as I ordered the
server with same package name etc. The chocking part was that the server had
PHP5 and not PHP4.

 

Ok, it is not a hard piece of work to get it working, but one thing stunned
me :-)

 

Assuming that I have the following structure:

 

/index.php

/classes/first.class.php

/classes/second.class.php

 

Index.php:

 

include_once("classes/first.class.php");

 

 

first.class.php

 

include_once("second.class.php");

 

 

This worked fine, but this time I get an "open dir" error. Is this something
that is new to PHP5 for this, or do I just need to config the server to
accept this "sloppy" including of files?

 

Best regards,

Peter Lauri

 

 <http://www.dwsasia.com/> www.dwsasia.com - company web site

 <http://www.lauri.se/> www.lauri.se - personal web site

 <http://www.carbonfree.org.uk/> www.carbonfree.org.uk - become Carbon Free

 



RE: [PHP] Re: Chocked

2006-12-29 Thread Peter Lauri
Hi,

I got it working before the post, but I was just curious if there were any
change from php4 to php5 as I have been using that method for a while now.

Best regards,
Peter Lauri

www.dwsasia.com  - company web site
www.lauri.se  - personal web site
www.carbonfree.org.uk  - become Carbon Free



-Original Message-
From: Johannes Lindenbaum [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 29, 2006 4:24 AM
To: php-general@lists.php.net
Subject: [PHP] Re: Chocked

I think this is correct:

Let's just assume for a minute that in your index.php you echo out getcwd();
Output would be / (only an example)

According to that you do the following include:
include("./classes/first.class.php");

If you were to echo getcwd() after the include in the first.class.php it 
would output /

You would then have to include your second class (inside the 
first.class.php - correct?) as:
include("./classes/second.class.php")
to make it a "correct" include without PHP having to search the 
directories for the include.

Give that a shot.

Regards,
Johannes

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] help with \n\r in strings

2006-12-29 Thread Peter Lauri
Try:

$string_as_array = explode("\n", $string);

echo "";
print_r($string_as_array);
echo "";

The array that you get will contain segments of the string that is separated
with \n. Let me know if that helps. 

Best regards,
Peter Lauri

www.dwsasia.com  - company web site
www.lauri.se  - personal web site
www.carbonfree.org.uk  - become Carbon Free

-Original Message-
From: Angelo Zanetti [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 29, 2006 10:43 AM
To: PHP List
Subject: [PHP] help with \n\r in strings

Hi all,

I receive a text file with a whole bunch of strings. and each line is 
terminated by what I presume is \n\r however when I read the string into 
PHP, it seems that the last column of the row and the first column of 
the next row are connected but it appears as a space but I've done all 
kinds of tests like $spacePos = strrpos($dateAmount, ' '); but this is 
always empty.

So is there a way to test for \r\n? or what else can I use to delimit 
these two values (last column of row and first column of next row)?

Thanks in advance.

Angelo
   
-- 

Angelo Zanetti
Systems developer


*Telephone:* +27 (021) 469 1052
*Mobile:*   +27 (0) 72 441 3355
*Fax:*+27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Javascript detection

2007-01-01 Thread Peter Lauri
I do have javascript enabled, but it does not detect it...

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free




-Original Message-
From: tedd [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 01, 2007 11:14 PM
To: php-general@lists.php.net
Subject: [PHP] Javascript detection

Hi gang:

I've asked this request on a couple of other list, but considering 
that I've done this with a mixture of php and javascript, perhaps 
some of you might check this out for me.

Try this:

http://sperling.com/js_detect

Does this technique work to detect your browser's javascript setting?

Also, if you change your browser's javascript setting, please restart 
your browser before rechecking the link.

If this works well enough, I'll post the code.

Thanks.

tedd

PS: I wrote this simply because I couldn't find an acceptable PHP 
"Javascript detection" solution. If anyone knows of something better, 
please let me know.
-- 
---
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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Please help me

2007-01-02 Thread Peter Lauri
I also use PHPmailer to send emails. However it is good to do it the 'hard'
way once to learn about mailing headers etc.

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free



-Original Message-
From: Steven Macintyre [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 02, 2007 2:44 PM
To: php-general@lists.php.net
Subject: RE: [PHP] Please help me

> When I send a mail using php using mail(), and using html tags in
> message
> body , these tags are being displayed as it is.
> Please let me know if there's any way of how to tackle with this.

I use phpmailer for all my email sending ... 

Never had a problem with it

S

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] How to read cookies set by php?

2007-01-02 Thread Peter Lauri
Are you trying to read cookies that are not set by your host? If that is the
case you will probably be disappointed. The purpose with cookies is that
they should only be table to be read by the one who is setting the cookie.

If you want to read cookies on the machine that you are able to view just:

echo "";
print_r($_COOKIE);
echo "";

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free



-Original Message-
From: Dotan Cohen [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 02, 2007 4:17 PM
To: php php
Subject: [PHP] How to read cookies set by php?

I'm trying to debug some scripts, and I see that the contents of
cookies seems to be encoded (in Firefox2 on Kubuntu, at least). How
can one read the cookies stored on his machine?

Dotan Cohen

http://what-is-what.com/what_is/gmail.html
http://datip.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Concerning SSL

2007-01-02 Thread Peter Lauri
Make the src ABSOULUTE and it will work. When you are using relative links
as you are right now the web server will look in the
https://www.mywebsite.com/images

Best regards,
Peter Lauri

www.dwsasia.com  - company web site
www.lauri.se  - personal web site
www.carbonfree.org.uk  - become Carbon Free


-Original Message-
From: R. Van Tassel [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 02, 2007 6:33 PM
To: php-general@lists.php.net
Subject: RE: [PHP] Concerning SSL

How do you correct the image URLs? That's what I'm asking.

I have a website that is secure. When you change the URL from
http://www.mywebsite.com
to
https://www.mywebsite.com

the images disappear.

The images are codes as relative links:

http://www.mywebsite.com/images/myimage.jpg

is coded as  if a root file

is coded as  if in a directory



-Original Message-
From: Jochem Maas [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 02, 2007 11:27 AM
To: R. Van Tassel
Cc: php-general@lists.php.net
Subject: Re: [PHP] Concerning SSL

R. Van Tassel wrote:
> Hello everyone, I hope you all had a great new year.
> 
> I'm having an issue with a website where changing the URL from http:// to
> https:// makes the images disappear. The images are all relative and not
> absolute.
> 
> How can I fix this?

correct the image URLs? clear your cache?

we gave up mind-reading on the list last year, please provide us with
some actual info otherwise we can't help you.

> 
> Thanks,
> -Roy
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Pushing a file to the browser

2007-01-03 Thread Peter Lauri
Hi,

I assume that you mean you want to send the file as
application/octet-stream. Take a look at this:


ob_start();

$path = 'path to directory where file resides';
$filename = 'the name of the file';

ob_end_clean();

header("Pragma: public");
header("Expires: 0"); // set expiration time
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=$filename");
header("Content-Transfer-Encoding: binary");
$filesize = filesize($path.$filelocation);
header("Content-Length: $filesize");

echo file_get_contents($path.$filelocation);



You could also use fread() or similar if the file is larger.

Let me know if it helped.

Best regards,
Peter Lauri

www.dwsasia.com  - company web site
www.lauri.se  - personal web site
www.carbonfree.org.uk  - become Carbon Free


-Original Message-
From: Mike Mannakee [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 16, 2006 2:39 AM
To: php-general@lists.php.net
Subject: [PHP] Pushing a file to the browser

Hello,

I have a script I've created which takes a file upload, monkeys with the 
data in it, and needs to push the new file out to the browser.  Everything 
is coded and working up to that last point, but I've never pushed out a file

to the browser before.  Does anyone have the code for this laying around 
that I can see (and modify)?

Mike 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] File reading code2

2007-01-06 Thread Peter Lauri
This just dumps the content to the browsers. You could use file() instead if
you want to loop thru every line.

$file = "test1.txt";

if(file_exists($file)) {
if(is_readable($file)) {
if($file_content = get_file_contents($file)) {
echo "";
echo $file_content;
echo "";
} echo "Something went wrong";  
} else echo "Cannot read the file '$file', check permissions";
} else echo "The file '$file' does not exist in this directory";

You should learn how to read the manual, because in the end we will not do
this kind of things if it already is in the manual.

http://th.php.net/manual/en/function.file-get-contents.php

http://th.php.net/file

Best regards,
Peter Lauri

www.dwsasia.com  - company web site
www.lauri.se  - personal web site
www.carbonfree.org.uk  - become Carbon Free



-Original Message-
From: Delta Storm [mailto:[EMAIL PROTECTED] 
Sent: Saturday, January 06, 2007 10:39 AM
To: php-general@lists.php.net
Subject: [PHP] File reading code2

Hi,

Can someone make me an example of simple reading a *.txt file on a hard 
drive
and displaying that file with a echo command or some loop or anything
path to file:

(C:\Program Files\XAMPP\xampp\htdocs\test_folder\test1.txt) btw the 
script is in this folder to.

Full code please.


Thanks in advance!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: Search script problem

2007-01-06 Thread Peter Lauri
Have you tried to catch (echo) the query you try to execute in mysql and
then debug it from there?

I saw that you in your code did all in one row. Separate it to:

$Query = "your query";

echo $Query; //Use this in phpMyAdmin or any other MySQL administrator and
see if the query is correct. If you get matches there your code should be
fine.

$Result = mysql_query($Query);
...
...


Best regards,
Peter Lauri

www.dwsasia.com  - company web site
www.lauri.se  - personal web site
www.carbonfree.org.uk  - become Carbon Free


-Original Message-
From: Wikus Moller [mailto:[EMAIL PROTECTED] 
Sent: Sunday, January 07, 2007 1:20 AM
To: php-general@lists.php.net
Subject: [PHP] Re: Search script problem

So it should be like this (it still doesn't show the results):

";
echo "http://www.wapforum.org/DTD/xhtml-mobile10.dtd\";>";
echo "http://www.w3.org/1999/xhtml\";>";

error_reporting(E_ALL ^ E_NOTICE);

$pwd = $_GET["pwd"];
$uid = $_GET["uid"];
$action = $_GET["action"];
$cid = $_GET["cid"];
$sid = $_GET["sid"];
$var = $_GET["q"];

include ("function.php");
include ("config.php");
connect($dbserver,$dbname,$dbuser,$dbpass);



/Search main page
if(!isset($var)){
echo "";
echo "Search Engine";
echo "
   .m3 {background-color: #291C6F;}
   .n1 {background-color: #A0A0A0;}
   .n2 {background-color: #88;}
   .c2 {color: #00;}
   .m2 {color: #91D0FF;}
   body   {font-family: Arial, sans-serif;
   font-size: 12px;
   color: #ff;
   background-color: #33;
   margin-left: 0px;
   margin-right: 0px;
   margin-top: 0px;}
   .ct1 {font-family: Arial, sans-serif;
   font-size: 12px;
   color: #800080;}
   .cre {background-color: #1300A4;
   padding: 2px 2px 2px 2px;
   margin: 3px 0 0;
   font-size: 12px;
   color:#00;
   text-align: center;
   border-width:1px 0;
   border-style:solid;
   border-color:#00;}
";
echo "";
echo "";
echo "";
echo "";
echo "Search Engine";
echo ""; ///the uid and pwd is
nessecary cause my member features are very basic and the urls is used
to keep the user 'logged in'
echo "Keywords: ";
echo "";
echo "";
echo "";
echo "Home";
echo "";
echo "";
}

///Display Results

if(isset($var)){
$var = $_GET["q"];
$trimmed = trim($var); //trim whitespace from the stored variable
echo "";
echo "Search Results";
echo "
   .m3 {background-color: #291C6F;}
   .n1 {background-color: #A0A0A0;}
   .n2 {background-color: #88;}
   .c2 {color: #00;}
   .m2 {color: #91D0FF;}
   body   {font-family: Arial, sans-serif;
   font-size: 12px;
   color: #ff;
   background-color: #33;
   margin-left: 0px;
   margin-right: 0px;
   margin-top: 0px;}
   .ct1 {font-family: Arial, sans-serif;
   font-size: 12px;
   color: #800080;}
   .cre {background-color: #1300A4;
   padding: 2px 2px 2px 2px;
   margin: 3px 0 0;
   font-size: 12px;
   color:#00;
   text-align: center;
   border-width:1px 0;
   border-style:solid;
   border-color:#00;}
";
echo "";
echo "";
echo "";
echo "Search Results";
echo "";
 // Get the search variable from URL



// check for an empty string and display a message.
if ($trimmed == "")
 {
 echo "Please enter a search...";
 exit;
 }



if($pg==0)$pg=1;
 $pg--;
 $lmt = $pg*20;
 $pg++;
 $cou =$lmt+1;
 $scount = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM table
WHERE keywords like \"%$trimmed%\" AND banned='0' AND hits_in >=
'2'"));
 $pgs = ceil($scount[0]/20);
 // Build SQL Query
 $sql = "SELECT * FROM table WHERE keywords like \"%$trimmed%\" AND
banned='0' and hits_in >='2' ORDER by hits_in DESC LIMIT ".$lmt.", 20;";
// EDIT HERE and specify your table and field names for the SQL query
 $sites=mysql_query($sql);


while ($site = mysql_fetch_array($sites))
{
   $dsc

RE: [PHP] Domain Search

2007-01-09 Thread Peter Lauri
Most domain wholesale sites have it. www.onlinenic.com has it, I am sure
that godaddy.com has it as well. Joker.com has it.

Best regards,
Peter Lauri

www.dwsasia.com  - company web site
www.lauri.se  - personal web site
www.carbonfree.org.uk  - become Carbon Free

-Original Message-
From: Marcelo Ferrufino Murillo [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 09, 2007 4:23 PM
To: php-general@lists.php.net
Subject: [PHP] Domain Search

I have to make a domain search so I don´t know if there is an API or
something that could help me in this o if you know how I could make this.
Thank you.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] most powerful php editor

2007-01-21 Thread Peter Lauri
I would put my vote on Eclipse. It has great support for cvs and also for
general coding "autofilling" etc. The downside is that it is resource
demanding...

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: Vinicius C Silva [mailto:[EMAIL PROTECTED] 
Sent: Sunday, January 21, 2007 2:54 AM
To: php-general@lists.php.net
Subject: [PHP] most powerful php editor

hi everyone!

i'd like to ask something maybe commonly asked here. what is the most
powerful php editor?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] First Character In A String

2007-01-21 Thread Peter Lauri
$firstchar = substr($string, 0, 1);

Read www.php.net/substr

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: Christopher Deeley [mailto:[EMAIL PROTECTED] 
Sent: Sunday, January 21, 2007 3:44 PM
To: php-general@lists.php.net
Subject: [PHP] First Character In A String

Can anyone tell me if there is a function to return the first letter in a
string, such as:

$surname="SMITH";
$forename="ALAN";

Is there a function which I can use to make $forename "A", so I can display
it as A SMITH?

Thank You In Advance

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] most powerful php editor

2007-01-21 Thread Peter Lauri
I don't know what version you are using or what plugin you are using, there
are more then one plugin :)

To be clear: I am using Eclipse 3.1 with PHPEclipse 1.1.8 and that is
working very well. It does auto complete classes and functions written by my
self etc.

I tried some other PHP plugin for Eclipse, and that one behavied like you
describe, therefore my change to SourceForge PHP Eclipse Plugin.

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free



-Original Message-
From: Larry Garfield [mailto:[EMAIL PROTECTED] 
Sent: Sunday, January 21, 2007 9:31 PM
To: php-general@lists.php.net
Subject: Re: [PHP] most powerful php editor

That's interesting.  I've been trying to use Eclipse, and its
code-assistance 
for PHP is some of the worst I've ever used.  I can't type "array" without
it 
trying to complete that to an Array class from SPL, yet it never 
auto-completes to any function or class I wrote myself.  Nor does it seem to

pick up on anything BUT classes.  It's terrible.  How'd you get it to
behave?

On Sunday 21 January 2007 5:22 am, Peter Lauri wrote:
> I would put my vote on Eclipse. It has great support for cvs and also for
> general coding "autofilling" etc. The downside is that it is resource
> demanding...
>
> Best regards,
> Peter Lauri
>
> www.dwsasia.com - company web site
> www.lauri.se - personal web site
> www.carbonfree.org.uk - become Carbon Free
>
>
> -Original Message-
> From: Vinicius C Silva [mailto:[EMAIL PROTECTED]
> Sent: Sunday, January 21, 2007 2:54 AM
> To: php-general@lists.php.net
> Subject: [PHP] most powerful php editor
>
> hi everyone!
>
> i'd like to ask something maybe commonly asked here. what is the most
> powerful php editor?

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession

of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] __construct __destruct in PHP 4

2007-01-28 Thread Peter Lauri
Hi,

Yes I have been reading both sections and is aware of the different sections
for PHP 4 and 5. I was just hoping there was something missing in the manual
for PHP 4 as I'd love to have a __destruct method to work with. There are
other solutions around this. Basically I just want to make sure that the
objects that have a save() method are saved correctly before they are
destroyed. With PHP 4 I just need to do this "manually". I could probably
just write a cleanup function that will be executed in the end of each
scripts that checks if objects have a save() method and then executes that
one. Or better: Check if there is a method __destruct() existing and use
that when cleaning up. Then it would be forward compatible with PHP 5 as
well :)

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: Larry E. Ullman [mailto:[EMAIL PROTECTED] 
Sent: Sunday, January 28, 2007 4:09 PM
To: Peter Lauri
Cc: php-general@lists.php.net
Subject: Re: [PHP] __construct __destruct in PHP 4

> I have been trying going thru the PHP manual to find if there are any
> equivalent to the __contruct and __destruct in PHP 4, but I cannot  
> find any
> solution for this part. I know it was introduced in PHP 5, but as  
> __sleep
> and __wakeup exist in PHP 4 already I was hoping there is something  
> like
> __init and __die in PHP 4 :-)

In PHP 4 the constructor has the same name as the class (like C++). See
http://us3.php.net/manual/en/language.oop.constructor.php

There is no destructor in PHP 4.

Larry

PS The manual has two sets of OOP documentation: one for PHP 4 &  
another for PHP 5. Make sure you're viewing the right set.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] __construct __destruct in PHP 4

2007-01-28 Thread Peter Lauri
Of course __destruct (in php5) is not meant to be called by "userland" (as
you called it). I just want to make sure all objects are stored as they
should when a script ends. This kind of wrapper method is of course "lame"
as you called it, but it would do what I need it to do, thought it is lame
:) This is just to "simulate" something that is missing in PHP 4 and that I
as a standard am working with. To close down database connections etc are
not the purpose at this stage for me as PHP will take care of these
resources by it self.

Ok, back to Sunday afternoon programming :)

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: Jochem Maas [mailto:[EMAIL PROTECTED] 
Sent: Sunday, January 28, 2007 4:27 PM
To: Peter Lauri
Cc: 'Larry E. Ullman'; php-general@lists.php.net
Subject: Re: [PHP] __construct __destruct in PHP 4

Peter Lauri wrote:
> Hi,
> 
> Yes I have been reading both sections and is aware of the different
sections
> for PHP 4 and 5. I was just hoping there was something missing in the
manual
> for PHP 4 as I'd love to have a __destruct method to work with. There are
> other solutions around this. Basically I just want to make sure that the
> objects that have a save() method are saved correctly before they are
> destroyed. With PHP 4 I just need to do this "manually". I could probably
> just write a cleanup function that will be executed in the end of each
> scripts that checks if objects have a save() method and then executes that
> one. Or better: Check if there is a method __destruct() existing and use
> that when cleaning up. Then it would be forward compatible with PHP 5 as
> well :)

alternative:

have each object register itself with a 'stack' and register a shutdown
function
which automatically calls the save() method of each object in said stack...
be careful to always using the 'reference' operator.

I wouldn't bother to try and make it php4/php5 compatible - the reference
operator
of itself will make sure that you have to change the code for php5, besides
that __destruct()
is not 'meant' to be called by userland code - and as far as I can tell it's
a bit lame (there is no garanteed order of destruction so you can't rely on
other object still
being around and IIRC [somebody correct me if I'm wrong please] things like
DB connections
are also gone by the time __destruct() is called - the same goes for access
to STDIN, STDOUT, etc.

> 
> Best regards,
> Peter Lauri
> 
> www.dwsasia.com - company web site
> www.lauri.se - personal web site
> www.carbonfree.org.uk - become Carbon Free
> 
> 
> -Original Message-
> From: Larry E. Ullman [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, January 28, 2007 4:09 PM
> To: Peter Lauri
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] __construct __destruct in PHP 4
> 
>> I have been trying going thru the PHP manual to find if there are any
>> equivalent to the __contruct and __destruct in PHP 4, but I cannot  
>> find any
>> solution for this part. I know it was introduced in PHP 5, but as  
>> __sleep
>> and __wakeup exist in PHP 4 already I was hoping there is something  
>> like
>> __init and __die in PHP 4 :-)
> 
> In PHP 4 the constructor has the same name as the class (like C++). See
> http://us3.php.net/manual/en/language.oop.constructor.php
> 
> There is no destructor in PHP 4.
> 
> Larry
> 
> PS The manual has two sets of OOP documentation: one for PHP 4 &  
> another for PHP 5. Make sure you're viewing the right set.
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] HTTPS

2007-01-28 Thread Peter Lauri
http://php.net/curl

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: chetan rane [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 29, 2007 8:31 AM
To: php-general@lists.php.net
Subject: [PHP] HTTPS

hi everyone

i am writing a progrram for a Jabber COnnection manager. I want to access
the client XML using HTTPS. do any one know a way to so it


Have any one the

-- 
Have A plesant Day
Chetan. D. Rane
Location: Pune , India
Contact: +91-9890792762
otherID: [EMAIL PROTECTED]
 [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Need desperate help with query

2007-01-31 Thread Peter Lauri
SELECT COUNT(*) AS thecount FROM table1 LEFT JOIN tabel2 ON (table1.col1 =
table2.col2) GROUP BY table1.col3 ORDER BY thecount;

It might give you some hints...

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: Skip Evans [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 31, 2007 6:26 PM
To: PHP-General
Subject: [PHP] Need desperate help with query

Okay, so SQL questions shouldn't come to the list, 
but I am in dire need of some assistance that uses 
a LEFT JOIN and must also get a count of records 
in the RIGHT table, plus group by that count and 
order by it.

If anyone can help out with this and would be 
willing to email me off list to take a look at it 
the good karma and appreciation would rain down 
upon you in such multitudes as to... as to... 
as... to...

I've run out of hyperbole.

Help!
-- 
Skip Evans
Big Sky Penguin, LLC
61 W Broadway
Butte, Montana 59701
406-782-2240
http://bigskypenguin.com
=-=-=-=-=-=-=-=-=-=
Check out PHPenguin, a lightweight and
versatile PHP/MySQL development framework.
http://phpenguin.bigskypenguin.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Programacion orientada a objetos

2007-01-31 Thread Peter Lauri
Try to google for "orientada a objetos en PHP con MySql" :)

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free



-Original Message-
From: Jairo Torres [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 31, 2007 10:05 PM
To: php-general@lists.php.net
Subject: [PHP] Programacion orientada a objetos

Señores buenas tardes.

Tienen un buen ejemplo o manual para programación orientada a objetos en PHP
con MySql.

Muchas gracias.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Send Email to Mobile

2007-02-01 Thread Peter Lauri
This kind of hassle you can avoid if you use PHPMailer that you can find at
http://phpmailer.sourceforge.net

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: Marcelo Ferrufino Murillo [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 01, 2007 6:17 PM
To: php-general@lists.php.net
Subject: [PHP] Send Email to Mobile

Hi guys, I have a script that send emails to mobiles:



And this is the message in a mobile:  [EMAIL PROTECTED] 


I don´t know why appear the address [EMAIL PROTECTED] the address must
be: [EMAIL PROTECTED], could you help me please, thank you

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Graphs

2007-02-03 Thread Peter Lauri
Gnuplot can do it for you as well...

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 02, 2007 12:56 PM
To: php-general@lists.php.net
Subject: [PHP] Graphs

I would like to add some graphing capability to an app of mine. What package
is recommended? I don't need anything too fancy, just some bar graphs, pie
charts, etc.

Thank you in advance.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] OT - Regular Expression

2007-02-09 Thread Peter Lauri
Best group member,

 

I want to match a four digit number. I allow user to enter with * syntax. So
8* would match anything that starts with 8 and is 4 digit long so:

 

/^8[0-9]{3}$/

 

That was easy. Ok then my other case was: *8, so anything that ends with 8

 

/^[0-9]{3}8$/

 

Ok, now the tricky one comes: *8*, so match it incase 8 is anywhere in the
number. Can be beginning, end or in the middle. The problem that I face I
cannot find out a good way of doing this correctly. So I ended up with an
expression like this:

 

/^(8[0-9]{3}|[0-9]8[0-9]{2}|[0-9]{2}8[0-9]|[0-9]{3}8)$/

 

This takes care of it and everything, BUT it is so ugly. What I actually
need to construct is: A regular expression that checks if 8 is a part of the
number, and then that it is four digit long.

 

The pipe "|" is an OR operator, but are there not any "AND" operator in
Regular Expressions? I have been trying to figure this out for a while now.
Of course I am using the above syntax right now, but would like to strip it
down. Maybe not for the performance, but for the beauty of it :-)

 

If you have any comments and suggestions about this I would be happy. 

 

Best regards,

Peter Lauri

 

 <http://www.dwsasia.com/> www.dwsasia.com - company web site

 <http://www.lauri.se/> www.lauri.se - personal web site

 <http://www.carbonfree.org.uk/> www.carbonfree.org.uk - become Carbon Free

 



RE: [PHP] OT - Regular Expression

2007-02-09 Thread Peter Lauri
[snip]

Why not use two checks? One that checks for 4 digits, the other checks
for existence of 8 anywhere in the string?

Cheers,
Rob.
[/snip]

Of course that is a possibility. But I wonder if there is a way to do it
with ONE expression. So there are no AND operator in Regular Expressions
then I assume.

/^([0-9]{4}&[0-9]{0,3}8[0-9]{0,3})$/

That would be nice :) But now there are no AND operator :*(

/Peter

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] OT - Regular Expression

2007-02-09 Thread Peter Lauri
Thanks. I will look into more of the lookahead and lookbehind operators.

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: Roman Neuhauser [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 09, 2007 1:36 PM
To: Peter Lauri
Cc: php-general@lists.php.net
Subject: Re: [PHP] OT - Regular Expression

# [EMAIL PROTECTED] / 2007-02-09 14:13:27 +0200:
> I want to match a four digit number. I allow user to enter with * syntax.
So
> 8* would match anything that starts with 8 and is 4 digit long so:
> 
> /^8[0-9]{3}$/
> 
> That was easy. Ok then my other case was: *8, so anything that ends with 8
> 
> /^[0-9]{3}8$/
> 
> Ok, now the tricky one comes: *8*, so match it incase 8 is anywhere in the
> number. Can be beginning, end or in the middle. The problem that I face I
> cannot find out a good way of doing this correctly.

This is the basic problem of regular expressin parsers, and you are
trying to write something that has the same behavior (if different
syntax).

This shouldn't do too much backtracking, try it out:

"*8*" => /^(?:\d*8\d*){4}$/

> So I ended up with an expression like this:
> 
> /^(8[0-9]{3}|[0-9]8[0-9]{2}|[0-9]{2}8[0-9]|[0-9]{3}8)$/
> 
> This takes care of it and everything, BUT it is so ugly. What I actually
> need to construct is: A regular expression that checks if 8 is a part of
the
> number, and then that it is four digit long.
> 
> The pipe "|" is an OR operator, but are there not any "AND" operator in
> Regular Expressions?

The regular expression "abc" matches "a" AND "b" AND "c".  Sort of.
There's also lookahead and lookbehind assertions.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] plugging gmmktime value into gmdate yields incorrect date

2007-02-15 Thread Peter Lauri
And what are the time zones for those two different machines? And what is
the time? :)

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: Terra Frost [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 15, 2007 8:47 PM
To: php-general@lists.php.net
Subject: [PHP] plugging gmmktime value into gmdate yields incorrect date

I tried running the following script on three different servers:



On two of the servers, I got 03, 23, 2000 back.  On the other,
however, I got 03, 22, 2000.  This doesn't make any sense to me.

On the servers that return the correct date (03, 23, 2000),
gmmktime(0,0,0,3,23,2000) returns 953769600.  On the server that
returns the incorrect date (03, 22, 2000), gmmktime(0,0,0,3,23,2000)
returns 953766000.  There's a difference of 3600 between the two,
which makes me think that some daylight savings time setting is to
blame.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] mysql_affected_rows inaccurate?

2007-02-15 Thread Peter Lauri
Sometimes you can get fooled by the result. If nothing is changed on a
update the result for this function will give 0, because nothing was
affected. Although you might think so just because you are doing an
"update". However, an update doesn't necessary mean an update :)

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free



-Original Message-
From: altendew [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 15, 2007 6:06 PM
To: php-general@lists.php.net
Subject: [PHP] mysql_affected_rows inaccurate?


Hi a long time ago I stopped using mysql_affected_rows because I believed it
was giving me an inaccurate number. Now I was not very knowledged then so it
could of been my own fault. Is this function safe and functional? Could it
possibly give me the row result of a previous query I did and not the
latest?
-- 
View this message in context:
http://www.nabble.com/mysql_affected_rows-inaccurate--tf3234567.html#a898812
3
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Quick organizational question...

2007-02-16 Thread Peter Lauri
Hi,

No matter the size of a project using includes and config files are always a
good way to go.

In the include file I would (as it states) include all main files that are
common for all pages. Such as a DB class (if common), template classes, etc.

In the config file (or you can call it define file) I would define all
constants that might be used. Such as:

define("ROOTDIR", "/wherever/your/webroot/is");
define("CLASSDIR", ROOTDIR . "/classes"); //not the best way, I usually keep
my classes out of the webroot
define("DB_HOST", "localhost");

Or you can have a txt config file config.cfg

ROOTDIR /wherever/your/webroot/is
CLASSDIR [ROOTDIR]/classes

And then you just have to read and parse that with a general define script
:) Something like this (don't have the code here, so I try it anyways).



Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free



-Original Message-
From: Mike Shanley [mailto:[EMAIL PROTECTED] 
Sent: Saturday, February 17, 2007 5:06 AM
To: php-general@lists.php.net
Subject: [PHP] Quick organizational question...

Hi!

Question:
For a website that will have a database driven store, articles, an rss 
feed, and a few other things... not an enormous site, but one with 
growth potential, does it makes sense to organize the whole thing as 
includes through a single main page? It seems like a fun way to do 
things, but I was just wondering what you all thought.

BTW- It's my first time here! Hello world!

-- 
Mike Shanley

~you are almost there~

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Catch STDERR

2007-02-17 Thread Peter Lauri
Hi,

I am executing exec('some cool command', $stdout, $exitcode);

That is fine. I get what I in the beginning wanted. However, now I need to
catch the STDERR that the command is generating as well. Some of you might
tell me to redirect STDERR to STDOUT, but that is not possible as I need to
use the STDOUT as is to automate a process.

I know I can do fwrite(STDERR, 'Output some error\n');

So could I fread(STDERR, SOMESIZE)?

Is there anyone with experience of best way of doing this? Should I maybe
use proc_open or something similar and then write it to a file, and then
read that file? Hrm, doesn’t make any sense to do that.

Best regards,
Peter Lauri
 
www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] LOL, preg_match still not working.

2007-02-17 Thread Peter Lauri
Haha,

This reminds me of a story about some IRC chat somewhere where someone was
asking how to control a media player thru the command line. It ended up with
him executing rm -rf / as root and then complaining that the machine was
slow when he executed it, and then he disappeared from the IRC... I wonder
why? :)

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free



-Original Message-
From: Vahan Yerkanian [mailto:[EMAIL PROTECTED] 
Sent: Saturday, February 17, 2007 7:02 PM
To: php-general@lists.php.net
Subject: Re: [PHP] LOL, preg_match still not working.

Correcting myself before my reply damages someone's box:

Vahan Yerkanian wrote:
> rm -rf /usr/local/lib/*

This indeed should be:

rm -rf /usr/local/lib/php/*

instead ;)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Catch STDERR

2007-02-19 Thread Peter Lauri
It looks like that will be the situation. Sad that exec() don't have that
feature as an option. Maybe in the future :)

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: M.Sokolewicz [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 19, 2007 11:59 AM
To: Frank Arensmeier
Cc: Peter Lauri; php-general@lists.php.net
Subject: Re: [PHP] Catch STDERR

you could instead use the proc_* functions to do this. However, seen as 
those are pretty complicated and were not available in most php versions 
ran by most hosts, a lot of people had to come up with  other ways 
around it. The most used way is indeed what you described. A simple:
$t = tempnam();
exec('/bin/SomeCommand 2>'.$t);
$stderror = file_get_contents($t);

is what most scripts seem to use currently
- tul

Frank Arensmeier wrote:
> Spontaneously, my suggestion would to pipe the STDERR output from your 
> command to a file. I have to admit that this doesn't feel like the most 
> efficient solution since you would involve some reading / writing to 
> your filesystem.
> 
> Regards.
> //frank
> 
> 17 feb 2007 kl. 21.49 skrev Peter Lauri:
> 
>> Hi,
>>
>> I am executing exec('some cool command', $stdout, $exitcode);
>>
>> That is fine. I get what I in the beginning wanted. However, now I 
>> need to
>> catch the STDERR that the command is generating as well. Some of you 
>> might
>> tell me to redirect STDERR to STDOUT, but that is not possible as I 
>> need to
>> use the STDOUT as is to automate a process.
>>
>> I know I can do fwrite(STDERR, 'Output some error\n');
>>
>> So could I fread(STDERR, SOMESIZE)?
>>
>> Is there anyone with experience of best way of doing this? Should I maybe
>> use proc_open or something similar and then write it to a file, and then
>> read that file? Hrm, doesn't make any sense to do that.
>>
>> Best regards,
>> Peter Lauri
>>
>> www.dwsasia.com - company web site
>> www.lauri.se - personal web site
>> www.carbonfree.org.uk - become Carbon Free
>>
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Poblem with sesions

2007-02-19 Thread Peter Lauri
Have you tried to print_r($_SESSION) on all the pages so that you can see
what the $_SESSION is containing and how it is changing?

Best regards,

Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free



-Original Message-
From: Ashish Rizal [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 20, 2007 12:26 AM
To: php-general@lists.php.net
Subject: [PHP] Poblem with sesions

Hi , I am having problem with log in and log out . I have a main
login page where one can login with the username and password
stored in mysql database.
PHP Code:



location.href='$adminAddress'; 
exit();
}
else if ($accesslevel == "user") {
$_SESSION['level'] = "user";
$_SESSION['username'] = $_POST['UserName'];
$_SESSION["userid"] = login($_POST);
include ('userlogin.php');
exit();
}
}
else {
//$_SESSION['loggedIn'] = false;
unset ($_SESSION['userid']);
unset ($_SESSION['username']);
unset ($_SESSION['level']);
echo "Error :$error";
}
}
//ob_end_flush();
?>





so after login user is directed to the corresponding page.

The problem is that when some user is logged in to the user page
or admin page, at the same time if i want to login to the user
page from other computers , it lets me login but after that
whatever link i click in userlogin page, takes me back to login
page. And i have to log in to userpage and click on log out and
then it will work.
its quite strange and i dont know why it is acting like this.
Also in userlogin page i am have a link to other page which i am
calling by
PHP Code:

 if ($_GET['mode'] == "basketball"){
include ('basket_closed.php');
}
and link is userlogin.php?mode=basketball 



My Log out script is
PHP Code:





I need help on this...i couldn't came up with any clue, Any idea..
i really appreciate your help

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Install / update php rpm packages with FC6

2007-02-20 Thread Peter Lauri
Do you really need to use an RPM package to install a PHP on FC. Why not
"yum install php" instead... and for any extension you might want you just
install that as well "yum install php-gd" as example.

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 20, 2007 1:22 PM
To: [EMAIL PROTECTED]
Cc: php
Subject: [PHP] Install / update php rpm packages with FC6

Dear All,

Mine is FC6 System...

When I install the php rpm package, the problem as the following :

[EMAIL PROTECTED] php]$ rpm -qa | grep "libc"
glibc-common-2.5-3
libcap-devel-1.10-25
libcroco-0.6.1-2.1
glibc-headers-2.5-3
glibc-2.5-3
libcap-1.10-25
libc-client2006-2006e-2.fc6
glibc-devel-2.5-3
libcroco-devel-0.6.1-2.1
[EMAIL PROTECTED] php]$ sudo rpm -Uhv php*
warning: php-5.1.6-3.3.fc6.i386.rpm: Header V3 DSA signature: NOKEY, key 
ID 4f2a6fd2
error: Failed dependencies:
libc-client.so.1 is needed by php-imap-5.1.6-3.3.fc6.i386
[EMAIL PROTECTED] php]$

Edward.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Latin letter problem!

2007-02-20 Thread Peter Lauri
How are you setting the charset of the web page? Are you using header() or
using html head section to set it?

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: Delta Storm [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 20, 2007 6:04 PM
To: php-general@lists.php.net
Subject: [PHP] Latin letter problem!

Hi,

I'm building an simple CMS system. I have built almost everything but 
one thing buggs me...

I have a MySQL database built for publishing news 
(Id,title,newsContent,timestamp).

And I have a php web page that displays that content. The problem is 
with the charset, in the database the settings are following:

character set latin2 collation latin2_croatian_ci;

and in the tables character set utf8;

I display the data in the php page using utf8 I see all the non-PHP 
content pure HTML content capable of seeing croatian letter čćžšđ, but 
in the news section I only see čćđ. But they are on the same page!

I tried putting other HTML charsets like iso-8859-1,iso-8859-2 etc...
But in all the scenarios I get the HTMl part working but PHP not working 
vice-versa...


Please help me it is a very important web page if you need any other 
information just ask!

Thank you very much in advance!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] php forcing a post??

2007-02-20 Thread Peter Lauri
fsockopen can probably help you with that http://www.php.net/fsockopen 

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: blackwater dev [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 20, 2007 9:45 PM
To: php-general@lists.php.net
Subject: [PHP] php forcing a post??

I currently have an html page that posts to a cgi function.  I need to
interject some php in the middle.  So, the form will post to itself, the php
page will catch the post, check on thing and then pass along to the cgi page
but the cgi page only handles posts.  How can I still php in the middle and
still have it 'post' to the cgi page?

Thanks!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] php forcing a post??

2007-02-20 Thread Peter Lauri
Or cURL: http://php.net/curl 

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: blackwater dev [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 20, 2007 9:45 PM
To: php-general@lists.php.net
Subject: [PHP] php forcing a post??

I currently have an html page that posts to a cgi function.  I need to
interject some php in the middle.  So, the form will post to itself, the php
page will catch the post, check on thing and then pass along to the cgi page
but the cgi page only handles posts.  How can I still php in the middle and
still have it 'post' to the cgi page?

Thanks!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Catch STDERR

2007-02-20 Thread Peter Lauri
[snip]

Do you need STDERR to go "out" to, err, wherever it goes, *AND* get it
into your PHP script?

Perhaps 'tee' (man tee) would let you do that.

Or do you just need STDOUT in one variable, and STDERR in another,
both in PHP?

I think you could do something in shell to re-bind STDOUT to some
other file/pipe, and then run your cool command...

$tmpfile = tmpfile(); //I always get this one wrong.
exec("rebind 2 $tmpfile; some cool command', $output, $error);
$stderr = file_get_contents($tmpfile);

It's probably not called 'rebind' but I know it's some shell command
that does this.

Possibly shell-specific, so you may even need to wrap the whole thing
in a 'bash' call.

Another option is to try to write a .sh shell script to get what you
want for STDOUT to go where you want, and THEN just call that script
(which has 'some cool command' at the end) from PHP, and let the
weird-o shell stuff be done in a shell script, and not clutter up your
PHP code with a complex shell script setup/tear-down.

[/snip]

I'd like to get STDERR into one variable in PHP and STDOUT into one. This so
that when we execute a script and there is an exit code different from 0 I
want to show a log of error/notices during the script. Actually I want to
show the whole process if it fails so 2>&1 for exit code not equal to 0.

I'll probably end up writing a patch for exec now :)

/Peter

www.dwsasia.com
www.lauri.se
www.carbon-free.org.uk

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] css in mail()

2007-02-20 Thread Peter Lauri
If you are just using the code snippet below you will probably get problems
in Outlook and some other clients. This because you haven't set the proper
header.

But I actually need to assume you did send with a more sophisticated
version. Otherwise KMAIL probably displayed it incorrectly as well.

Best regards,

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: Sancar Saran [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 21, 2007 3:02 AM
To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Subject: Re: [PHP] css in mail()

Hi,
On Wednesday 21 February 2007 01:14, Richard Lynch wrote:
> On Mon, February 19, 2007 10:56 am, Sancar Saran wrote:
> > On Monday 19 February 2007 17:03, Danial Rahmanzadeh wrote:
> >> how can i use css with mail()?
> >> thank u
> >
> >  > $data ='';
> > $fp = fopen ("site/themes/".$arrStat['theme']."/css/main.css","r");
> > while (!feof($fp)) { $data.= fgets($fp, 16384); }
> >
> > $mail="
> > 
> > 
> > Title
> > ".$data."
> > 
> > 
> > Html content
> > 
> > ";
> >
> > mail('[EMAIL PROTECTED]', 'You are welcome', $mail);
> > ?>
>
> No.
>
> This will only work on very badly-broken email clients.
Really ?
I did not have to much choices to check it, In KMAIL everything looks nice.

Thanks for info
> I believe, in fact, that the only email client broken enough for this
> to work is Outlook.
>
> Though I suspect some very lame web-based email client might actually
> work, come to think of it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Catch STDERR

2007-02-21 Thread Peter Lauri
Hi Steve,

Yes that would be an option. But then I need to put the username and
password (alternativly ssh2_auth_hostbased_file). Hrm, will think about it
for a while. I might try it out.

My speed requirements aren't really restricted as it is run on a local
network and no dense traffic.

I will either use this or redirect STDERR to a file and read it from there.

Best regards,

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free




-Original Message-
From: steve [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 21, 2007 7:17 AM
To: Peter Lauri
Cc: [EMAIL PROTECTED]; php-general@lists.php.net
Subject: Re: [PHP] Catch STDERR

What are your speed requirements? You can use the ssh functions can
ssh2_exec into yourself. You can get the error stream separately
then...

After the connection is open, it is basically as fast as exec. But
there is a hit on connection. I wouldn't use this in webpage
environment, but I do use it for CLI admin applications. I use it to
run a stream of commands to many servers simultaneously.

On 2/20/07, Peter Lauri <[EMAIL PROTECTED]> wrote:
> [snip]
>
> Do you need STDERR to go "out" to, err, wherever it goes, *AND* get it
> into your PHP script?
>
> Perhaps 'tee' (man tee) would let you do that.
>
> Or do you just need STDOUT in one variable, and STDERR in another,
> both in PHP?
>
> I think you could do something in shell to re-bind STDOUT to some
> other file/pipe, and then run your cool command...
>
> $tmpfile = tmpfile(); //I always get this one wrong.
> exec("rebind 2 $tmpfile; some cool command', $output, $error);
> $stderr = file_get_contents($tmpfile);
>
> It's probably not called 'rebind' but I know it's some shell command
> that does this.
>
> Possibly shell-specific, so you may even need to wrap the whole thing
> in a 'bash' call.
>
> Another option is to try to write a .sh shell script to get what you
> want for STDOUT to go where you want, and THEN just call that script
> (which has 'some cool command' at the end) from PHP, and let the
> weird-o shell stuff be done in a shell script, and not clutter up your
> PHP code with a complex shell script setup/tear-down.
>
> [/snip]
>
> I'd like to get STDERR into one variable in PHP and STDOUT into one. This
so
> that when we execute a script and there is an exit code different from 0 I
> want to show a log of error/notices during the script. Actually I want to
> show the whole process if it fails so 2>&1 for exit code not equal to 0.
>
> I'll probably end up writing a patch for exec now :)
>
> /Peter
>
> www.dwsasia.com
> www.lauri.se
> www.carbon-free.org.uk
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] DOM Element default ID attribute

2007-02-21 Thread Peter Lauri
This was not clear for me, do you mean:

 => 

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: Eli [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 22, 2007 12:42 AM
To: php-general@lists.php.net
Subject: [PHP] DOM Element default ID attribute

Hi,

I want to declare a default ID attribute to all elements in the document.
For example: If an element got the attribute 'id' then I want it 
automatically to become the ID attribute of the element.
How can I do that?

-thanks!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] GET doesn't work as POST

2007-02-24 Thread Peter Lauri
How are you fetching the GET and POST? With $_GET and $_POST?

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free



-Original Message-
From: Otto Wyss [mailto:[EMAIL PROTECTED] 
Sent: Saturday, February 24, 2007 12:51 PM
To: php-general@lists.php.net
Subject: [PHP] GET doesn't work as POST

On the page

http://www.orpatec.ch/turniere/5erfussball/index.php?page=bvallist.php&kind=
regions 


I have a form with method="post" and action="". While it works fine this way, as soon as I change the form to 
method="get" it looses the parameter "kind" when I change e.g. the 
second parameter from "-Alle-" to "Gültig". Has anybody an idea why it 
works with POST but not with GET?


...
  

O. Wyss

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Include file path.. please help im newby

2007-02-24 Thread Peter Lauri
Include path and include() function is different things.

Include path: this is paths where PHP will look for files tried to be
included if it doesn't exist in script directory. If you do
include("afile.php") and afile.php doesn't exist in the same directory as
where your script that is calling the include is. Then it will first look in

.
/include
/usr/lib/php

Take a look here http://www.php.net/include to read more about the include
function in PHP.

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: StainOnRug [mailto:[EMAIL PROTECTED] 
Sent: Sunday, February 25, 2007 12:57 AM
To: php-general@lists.php.net
Subject: [PHP] Include file path.. please help im newby


Hello I am a beginner at PHP. I searched for my ? but couldn't pinpoint it..
My question is,  How do I upload include files onto my website include
directory. Im hosted through Yahoo, I am not running a server on my
computer. When I check out my PHP info it tells me the include dir is
include path .:/include:/usr/lib/php.. how do I acess this folder to put
files in it so that I can take advantage of the include functions on my PHP
scripts. Thank you sooo much!
-- 
View this message in context:
http://www.nabble.com/Include-file-path..-please-help-im-newby-tf3285344.htm
l#a9138696
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] PHP+MySQL website cache ? Yes/No

2007-02-25 Thread Peter Lauri
MySQL has caching functions I believe. Read here:
http://dev.mysql.com/doc/refman/5.0/en/query-cache.html

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: Martin Zvarík [mailto:[EMAIL PROTECTED] 
Sent: Sunday, February 25, 2007 12:50 PM
To: php-general@lists.php.net
Subject: [PHP] PHP+MySQL website cache ? Yes/No

Hi,
   I am making an eshop and I am thinking about caching system.

You understand, that it cannot be entirely cached because visitor has 
it's own shopping cart etc.

So, my thought is to cache only few blocks like "Categories", 
"Navigation menu" etc. by storing it to an HTML file.

The advantages are that it doesn't have to query database and generate 
the HTML code again, but my question is: Is it good approach? Shouldn't 
we optimize database instead of restoring the data on harddrive?

Thank you for ideas,
Martin Zvarik

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] PHP shell_exec

2007-02-27 Thread Peter Lauri
ssh2_exec would do it for you...

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free



-Original Message-
From: h [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 27, 2007 3:18 PM
To: php-general@lists.php.net
Subject: [PHP] PHP shell_exec 

Hi 



I have been using the shell_exec command to perform several server queries
quite succesfully i.e. analysing files systems by gettin ginformation
returned by df -kP (shell_exec('df -kP')).  do any of you guts know if it is
possible to target a command like this on another server? 



So from server A where I am running a web app, needs to run the
shell_exec('df -kP') on server B, which also has php installed, so that i
can display the results in my web app on server A.  Hope that makes sense!



Also, how would i fopen a file such as /proc/cpuinfo on Server B from Server
A.



Any help greatly appreciated



Regards



Ade

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Who in this list would you...

2007-02-27 Thread Peter Lauri
[snap]
[snip]
He would need to work in-house. And the location is somewhere in
Scandinavia. He could work as sub contractor or employed for my company.
[/snip]

I don't know too many list denizens who live in Scandinavia, so that
severely limits your choices.
[/snap]

I live in Thailand but that didn't stop me from joining the project at a
worldly well known company as a consultant. And now we are looking for more
guys as the project is growing...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Eregi error

2007-02-28 Thread Peter Lauri
Not sure, but I don't think you should escape all those characters inside of
the character class. I might be wrong. However, that might not have anything
to do with the error. But I do think you need to escape the / in the end...
And the - you should have in the beginning of the character class, otherwise
it will be treated as a range.

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free

-Original Message-
From: Brad [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 01, 2007 5:09 AM
To: PHP Mailing
Subject: [PHP] Eregi error


Hey all,
I have been having some trouble with the "eregi" function. I have the 
following piece of code in my application:

function standard_input($input, $min=0, $max=50){
if (strlen($input) <= $max and strlen($input) >= $min ) {
$pattern = '^[a-z0-9\!\_ \.- ,/]*$';
if(!eregi($pattern, $input)){
return false;
}else{
return true;
}
}else{
return false;
}
   
}

And i am running PHP version 5.2.1

I receive the following error:
*Warning*: eregi() [function.eregi 
<http://idontwanttouse.net/MeetMyMate/Bin/Debug/function.eregi>]: 
REG_ERANGE in *[File Location]* on line *287

*Any ideas what might cause this? Googling REG_ERANGE only showed more 
questions.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] exec from process (deamon) without shell

2007-03-01 Thread Peter Lauri
Hi,

 

I have a very complex script that is being called by a running deamon that
doesn't have any shell. To simplify it I make this script, that is also
failing:

 

#/thepathtophp



 

This code give the exit code -1 that is equal to that "ls -lrt" could not be
executed. 

 

Running this from shell give correct result. 

 

Executing it from a web page (thru apache) gives correct result.

 

But the "shell less" deamon is giving the -1 exit code.

 

Is exec requiring a shell? Any workaround on this? I will play around, maybe
something like system() or passthru() will do it, but I haven't tested that
yet, want to get some feedback first.

 

Best regards,

Peter Lauri

 

 <http://www.dwsasia.com/> www.dwsasia.com - company web site

 <http://www.lauri.se/> www.lauri.se - personal web site

 <http://www.carbonfree.org.uk/> www.carbonfree.org.uk - become Carbon Free

 



RE: [PHP] exec from process (deamon) without shell

2007-03-01 Thread Peter Lauri
The thing is that the commands are executed as they should. I have tested to
give full path "/bin/ls" and that gives the same result.

BUT the exit code is -1 still. Not 0 as when running it from command line.

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 02, 2007 12:29 AM
To: Peter Lauri
Cc: 'PHP Mailing'
Subject: Re: [PHP] exec from process (deamon) without shell

On Thu, March 1, 2007 10:28 am, Peter Lauri wrote:
> I have a very complex script that is being called by a running deamon
> that
> doesn't have any shell. To simplify it I make this script, that is
> also
> failing:

PHP also uses a mini non-shell thingie to run exec.

As such, it has no home directory, no $PATH (or is it $path) and not
much of anything.

Provide the FULL PATH to 'ls' and your test script should work fine.

By extension, you need the FULL PATH to everything file-system-related
in your real application.

You also need to be aware that YOU run as, well, you, and PHP runs as
some user defined in httpd.conf (for Apache module) or
IUSER_ for IIS (unless you re-configure) or as, errr,
User in httpd.conf for CGI, and then, ummm, for FCGI, you're going to
have to research that one.

> #/thepathtophp
>
> 
> exec("ls -lrt", $stdout, $exitcode);
>
>
>
> if($exitcode!=0) {
>
> echo "Command ls -lrt could not be executed correctly.
> Exit
> code: $exitcode\n";

You may also want to dump out implode("\n", $stdout) just in case it
has useful messages.

You could also consider sending stderr (2) into stdout (1) so that any
error messages are captured.

See thread from last week on this one.

> } else {
>
> echo "Result:\n";
>
> foreach($stdout AS $line) {
>
> echo $line."\n";

If by some chance performance is an issue (probably not) then you may
want to benchmark this end-to-end with 'ab' compared to echo
implode("\n", $stdout)

I'm not making any prediction either way on this, just noting a simple
alternative worth exploring if performance IS an issue.

> }
>
> }
>
> ?>
>
>
>
> This code give the exit code -1 that is equal to that "ls -lrt" could
> not be
> executed.
>
>
>
> Running this from shell give correct result.

This invariably indicates a path/permissions difference between you
logged in as YOU, and PHP running as some other user in a totally
different environment/shell.

> Executing it from a web page (thru apache) gives correct result.
>
>
>
> But the "shell less" deamon is giving the -1 exit code.
>
>
>
> Is exec requiring a shell? Any workaround on this? I will play around,
> maybe
> something like system() or passthru() will do it, but I haven't tested
> that
> yet, want to get some feedback first.

exec doesn't require a shell.

It has some kind of minimal shell already, I think.

But it's definitely not the same full-blown shell you use when you
login as YOU.  (well, probably not, unless you're a shell masochist
minimalist. :-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] exec from process (deamon) without shell

2007-03-01 Thread Peter Lauri
> -Original Message-
> From: Richard Lynch [mailto:[EMAIL PROTECTED]
> Sent: Friday, March 02, 2007 12:35 AM
> To: [EMAIL PROTECTED]
> Cc: Roman Neuhauser; 'PHP Mailing'
> Subject: Re: [PHP] exec from process (deamon) without shell
> 
> On Thu, March 1, 2007 12:56 pm, [EMAIL PROTECTED] wrote:
> > I tried with /bin/ls but still same thing. I just found out that the
> > exitcode is -1 but the $stdout actually gives correct answer. But that
> > doesn't make sense. How can I then control what action to take
> > depending on the exitcode?
> 
> I *think* this could be the result of trying to ls a bunch of files,
> some of which you don't have permission to 'ls', so you are getting a
> partial list of stuff, but also an error code for trying to ls stuff
> you shouldn't have been doing that too, if you see what I mean...
> 
> I am hoping that your real script is a bit more complicated, as you
> currently have a shell script that runs PHP only to run a shell script
> that just does 'ls', which, really, you could probably just splat into
> your shell script without PHP being involved...
> 

[Peter Lauri - DWS Asia] 

It is a much more complicated logic, so therefore I am not using a shell
script. I will examine how perl acts on executing the same commands and if
that is catching 0 as error code I might move to run perl instead.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] exec from process (deamon) without shell

2007-03-01 Thread Peter Lauri
> -Original Message-
> From: Richard Lynch [mailto:[EMAIL PROTECTED]
> Sent: Friday, March 02, 2007 12:37 AM
> To: [EMAIL PROTECTED]
> Cc: Roman Neuhauser; 'PHP Mailing'
> Subject: Re: [PHP] exec from process (deamon) without shell
> 
> Add a nice clean line to the end of your PHP scripts:
> 
> exit 0; //exit cleanly
> 
> If your PHP scripts' last function call returns, say, -1, and then PHP
> just passes that back on out, it's probably going to look like an
> error code to the outermost shell, if you see what I mean...
> 
> I'm not promising this is how it actually works; this is just a theory.
> 

[Peter Lauri - DWS Asia] 
I will take a look at that tomorrow; right now it is 1am and time for bed :)
I will keep you updated on that one to inform you if your theory was working
:)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] dst and strtotime

2007-03-12 Thread Peter Lauri
Is your system time correct?

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free




> -Original Message-
> From: Jake McHenry [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 12, 2007 6:10 PM
> To: PHP-General
> Subject: [PHP] dst and strtotime
> 
> Hi everyone,
> 
> I was hoping a problem like this wouldn't arise, but it happened :(
> 
> After the dst updates on my fedora box, this broke, and worked fine
> before..
> now gives me 3/10 instead of 3/11 for strtotime("last sunday") anyone
> know why? 3/10 was saturday!
> 
> 
> 
> $recent_period = strtotime('last sunday');
> echo date("Y-m-d", $recent_period);
> print_r($periods);
> $test_recent_period = array_search($recent_period, $periods);
> if ($test_recent_period == '')
>   $recent_period = strtotime('last sunday', $recent_period);
> 
> 
> 
> 
> 
> Thanks,
> Jake
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Capitalizing the first letter

2007-03-13 Thread Peter Lauri
> 
> Thank you!  I did not know about the ucwords() functions, and it
> does not need the string set to lower case.
> 
> Now to create a filter that returns only numbers (e.g. "a1234z"
> -> "1234") and the same for non-numbers.
> 

[Peter Lauri - DWS Asia] 

This to replace all non-digit characters with ""

$string = preg_replace("/\D/", "", $string);

And this to replace all non-character characters with ""

$string = preg_replace("/\W/", "", $string);

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Looking for a good Ajax Mailing List

2007-03-13 Thread Peter Lauri
Not pure Ajax, but it is Javascipt: [EMAIL PROTECTED]

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


> -Original Message-
> From: bruce [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 13, 2007 7:20 PM
> To: 'PHP-General'
> Subject: [PHP] Looking for a good Ajax Mailing List
> 
> Hi...
> 
> I know this is off topic.. I'm looking for a good Ajax Mailing list for
> Ajax
> discussions. I've seen a few via google, but not alot of traffic.
> 
> Any thoughts/ideas.
> 
> Thanks
> 
> -Bruce
> [EMAIL PROTECTED]
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Rewriting urls

2007-03-26 Thread Peter Lauri
On Monday 26 March 2007 19:49:48 Erik Jones wrote:
> Yep, take this to the mod_rewrite forums @ http://www.modrewrite.com/  
> as this is a php list :)

Thanks. This solved it for me:

http://forum.modrewrite.com/viewtopic.php?p=10796#10796

/Peter

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] changing array to a string

2007-03-27 Thread Peter Lauri

> -Original Message-
> From: Richard Kurth [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 28, 2007 6:12 AM
> To: php-general@lists.php.net
> Subject: [PHP] changing array to a string
> 
> When I submit the for below it gives me an array that looks like this
> "array(5) { [0]=> string(1) "3" [1]=> string(1) "4" [2]=> string(1) "5"
> [3]=> string(1) "6" [4]=> string(1) "7" } "
> I would like to convert it to a string like this  "3,4,5,6,7"
> 
> 
> 
> 
>  type="checkbox">test message
>  value="4" type="checkbox">test message
>  value="5" type="checkbox">test message
>  value="6" type="checkbox">test message
>  value="7" type="checkbox">test message
> 
> 
> 
> 
> 
> 
[Peter Lauri - DWS Asia] 

Check www.php.net/implode

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Show Filename using Wildcards

2007-03-29 Thread Peter Lauri
> -Original Message-
> From: Rahul Sitaram Johari [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 29, 2007 9:12 PM
> To: PHP
> Subject: [PHP] Show Filename using Wildcards
> 
> Ave,
> 
> I have a script where I have to provide a Download Link to a file
> associated
> with a record. The common thing between the record & filename is the phone
> number. But the filenames have dates & other symbols besides the phone
> number as well. They all do begin with a phone number though.
> 
> How can I match a filename with a record using wildcards?
> For example, let¹s say someone pulls up a record for phone field:
> 515515515
> The files associated with this record could be 515515515031307 or
> 5155155150325T(2).
> 
> So you can see the filenames do begin the phone number in the record, but
> they contain additional chars. What I need is something that can pull up
> all
> 515515515*.ext
> 
> Can I do this in PHP?
> 
> Thanks!
> 

[Peter Lauri - DWS Asia] 

Hi,

Assuming you are on a linux you could try:

exec("find /the/path/to/the/place/where/you/should/start/searching -type f
-name 515515515*.ext", $files);

Then the $files will be an array with the found files matching the search.

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Gnome and MIME types

2007-03-29 Thread Peter Lauri
Is php safe mode on or off?

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


> -Original Message-
> From: Nathan Ziarek [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 29, 2007 9:30 PM
> To: php-general@lists.php.net
> Subject: [PHP] Gnome and MIME types
> 
> I'm having a hard time getting solid MIME Types of various files.
> 
> On my Ubuntu/Apache2/PHP5 system, I first attempted to install
> fileInfo. That didn't go so well (on Safari even running "$finfo =
> finfo_open(FILEINFO_MIME);" causes it to complain that it lost the
> network connection; Firefox prompts me to download the file_ and
> seeing as it is not really ready for release, I thought I should stay
> away from that.
> 
> I then tried running "system("file -i -m /usr/share/docs/mim file")"
> which worked, but file doens't provide very good mime types -- all
> Microsoft Office Documents returned nothing, for example.
> 
> I then stumbled upon gnomevfs-info that provided the information I
> wanted. I don't know what mime database it is using (couldn't find it)
> but it sure seemed more complete than anything else I had used.
> 
> Problem is, I can't seem to run it from within a PHP script (system,
> exec, etc). I used the full path (/usr/bin/gnamevfs-info) so I don't
> believe that to be the problem, and the page has no errors (I am using
> error_reporting(E_ALL)).
> 
> Any tips or suggestions?
> 
> Thanks!
> 
> Nate
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Show Filename using Wildcards

2007-03-29 Thread Peter Lauri
Just do something like:

$fileswithoutdir = array();
foreach($files AS $file) {
$fileswithoutdir[] = basename($file);
}

Voila...

Or you could do it more complicated in the foreach loop (but not
recommended):
$fileswithoutdir[] = preg_replace("/^.*\/(\d+\.vox)$/", "$1",
$file);

/Peter


> -Original Message-
> From: Rahul Sitaram Johari [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 29, 2007 9:49 PM
> To: Peter Lauri; PHP
> Subject: Re: [PHP] Show Filename using Wildcards
> 
> 
> Peter,
> 
> Believe it or not, but this is actually working. I'm on a Mac OS X, which
> is
> linux underneath, so I was hopeful about the command you provided. I ran
> this code:
> 
> exec("find /Users/rjohari/Documents/XFER/espi/ -type f -name
> 33*.vox", $files);
> foreach ($files as $value) {
> echo "$value";
> }
> 
> And it listed all the files that began with that provided phone number.
> The only problem is, It¹s printing out the path with it too. So what¹s is
> giving me is:
> 
> /Users/rjohari/Documents/XFER/espi/331123.vox
> /Users/rjohari/Documents/XFER/espi/334567.vox
> 
> So I have to accomplish two things:
> 
> 1. I have to eliminate the filepath from the result
> 2. I need to specify the variable that holds the phone number, (like
> $row[ŒPHONE¹]) instead of the actual phone number in the ³exec² command.
> 
> Thanks!! Much Appreciated!
> 
> ~~~
> Rahul Sitaram Johari
> CEO, Twenty Four Seventy Nine Inc.
> 
> W: http://www.rahulsjohari.com
> E: [EMAIL PROTECTED]
> 
> ³I morti non sono piu soli ... The dead are no longer lonely²
> 
> 
> On 3/29/07 4:31 PM, "Peter Lauri" <[EMAIL PROTECTED]> wrote:
> 
> >> -Original Message-
> >> From: Rahul Sitaram Johari [mailto:[EMAIL PROTECTED]
> >> Sent: Thursday, March 29, 2007 9:12 PM
> >> To: PHP
> >> Subject: [PHP] Show Filename using Wildcards
> >>
> >> Ave,
> >>
> >> I have a script where I have to provide a Download Link to a file
> >> associated
> >> with a record. The common thing between the record & filename is the
> phone
> >> number. But the filenames have dates & other symbols besides the phone
> >> number as well. They all do begin with a phone number though.
> >>
> >> How can I match a filename with a record using wildcards?
> >> For example, let¹s say someone pulls up a record for phone field:
> >> 515515515
> >> The files associated with this record could be 515515515031307 or
> >> 5155155150325T(2).
> >>
> >> So you can see the filenames do begin the phone number in the record,
> but
> >> they contain additional chars. What I need is something that can pull
> up
> >> all
> >> 515515515*.ext
> >>
> >> Can I do this in PHP?
> >>
> >> Thanks!
> >>
> >
> > [Peter Lauri - DWS Asia]
> >
> > Hi,
> >
> > Assuming you are on a linux you could try:
> >
> > exec("find /the/path/to/the/place/where/you/should/start/searching -type
> f
> > -name 515515515*.ext", $files);
> >
> > Then the $files will be an array with the found files matching the
> search.
> >
> > Best regards,
> > Peter Lauri
> >
> > www.dwsasia.com - company web site
> > www.lauri.se - personal web site
> > www.carbonfree.org.uk - become Carbon Free
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Show Filename using Wildcards

2007-03-29 Thread Peter Lauri
DON'T commit suicide mate :)

What if you one day move the path? ;)


> -Original Message-
> From: Rahul Sitaram Johari [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 29, 2007 9:54 PM
> To: Peter Lauri; PHP
> Subject: Re: [PHP] Show Filename using Wildcards
> 
> Ave,
> 
> This Works!!
> 
>  exec("find /Users/rjohari/Documents/XFER/espi -type f -name
> ".$row['PHONE']."*.vox", $files);
> foreach ($files as $value) {
> echo substr($value,35)."";
> }
> ?>
> 
> THANKS!
> 
> ~~~
> Rahul Sitaram Johari
> CEO, Twenty Four Seventy Nine Inc.
> 
> W: http://www.rahulsjohari.com
> E: [EMAIL PROTECTED]
> 
> ³I morti non sono piu soli ... The dead are no longer lonely²
> 
> 
> 
> On 3/29/07 4:31 PM, "Peter Lauri" <[EMAIL PROTECTED]> wrote:
> 
> 
> > [Peter Lauri - DWS Asia]
> >
> > Hi,
> >
> > Assuming you are on a linux you could try:
> >
> > exec("find /the/path/to/the/place/where/you/should/start/searching -type
> f
> > -name 515515515*.ext", $files);
> >
> > Then the $files will be an array with the found files matching the
> search.
> >
> > Best regards,
> > Peter Lauri
> >
> > www.dwsasia.com - company web site
> > www.lauri.se - personal web site
> > www.carbonfree.org.uk - become Carbon Free
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: finding the index name of an associative array

2007-04-01 Thread Peter Lauri
> -Original Message-
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Man-wai Chang
> Sent: Sunday, April 01, 2007 2:45 PM
> To: php-general@lists.php.net
> Subject: [PHP] Re: finding the index name of an associative array
> 
> itoctopus wrote:
> > Note, however, that array_keys is not recursive.
> 
> foreach is recursive??? thanks.
> 
> --

[Peter Lauri - DWS Asia] 

foreach is NOT recursive :)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Problems downloading a PDF

2007-04-04 Thread Peter Lauri

> -Original Message-
> From: Mário Gamito [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 04, 2007 1:46 PM
> To: php-general@lists.php.net
> Subject: [PHP] Problems downloading a PDF
> 
> Hi,
> 
> I'm building this site that has several PDFs to download, but only to
> registered users.
> 
> To prevent people to insert the full URL to the documents, i moved them
> outside Apache's DocumentRooot, which is /var/www.
> 
> My site is in /var/www/telbit and i put the PDFs in /var/www
> 
> I've coded in order to do the trick, but it's failing.
> I can't get the name of the file.
> Notice that the page which has the code is products-teststudio.php itself.
> 
> The code follows my signature.
> 
> Any help would be appreciated.
> 
> Warm Regards
> --
> :wq! Mário Gamito
> --
> 
>if (isset($_SESSION['email'])) {
>echo" rel=\"external\">Download TESTUDIO flyer";
> 
>$file = $_GET['file'];
> 
>// try to sanitize the filename
>if (preg_match('/[^A-Za-z0-9._]/', $file))
> die("Invalid filename.");
> 
>$path = '/var/www/';
>$full = $path . $file;
> 
>header('Content-type: application/pdf');
>header("Content-Length: " . filesize($full));
>header('Content-disposition: attachment; filename="'. basename($file)
> .'"');
>readfile($full);
>   }
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
[Peter Lauri - DWS Asia] 

You are echoing stuff before sending the file that is not possible. So
remove the echo and it should work. If not, try this for debugging:

if(!is_readable($full)) echo "the file $full is not readable by apache";
else {
//same as before
}

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] "Sense" last record

2007-04-09 Thread Peter Lauri
Assuming you know it will be three records:

$i = 1;
while(...) {
if($i==3) {
//Do the stuff for the last one
} else {
//Do the rest of the stuff here
}
$i++;
}

Assuming you don't know:

$count = mysql_num_rows($Result); //or equivalent in AdoDB
$i=1;
while(...) {
if($i==$count) {
//Do the stuff for the last one
} else {
//Do the rest of the stuff here
}
$i++;
}

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


> -Original Message-
> From: Mário Gamito [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 09, 2007 3:32 PM
> To: php-general@lists.php.net
> Subject: [PHP] "Sense" last record
> 
> Hi,
> 
> I'm doing this site that has three news in the homepage.
> You can see the static version here:
> http://www.telbit.pt
> As you can see, the two first news have "blocoTexto" class and the
> third, "blocoTextoLast"
> 
> Now, i'm developing a dinamyc structure where the news are stored in a
> MySQL database and retrieved from there.
> 
> My problem is with the third news and it's different class.
> I'm using AdoDB recordSet to get the news from the database.
> You can see it here:
> http://www.telbit.pt/2/
> 
> How can i "sense" that i've reached the last row and apply the
> "blocoTextoLast" class to it ?
> 
> My code follows my signature.
> 
> Any help would be appreciated.
> 
> Warm Regards
> --
> :wq! Mário Gamito
> --
> 
>   include('config.php');
>include('adodb/adodb.inc.php');
> 
>// connect to MySQL
>$conn->debug=1;
>$conn = &ADONewConnection('mysql');
> 
> $conn->PConnect($host,$user,$password,$database);
> 
>// get news data
>$recordSet = &$conn->Execute("SELECT date, now, title, lead, body
> FROMnews ORDER BY date DESC LIMIT 3");
> 
>   if (!$recordSet)
>print $conn->ErrorMsg();
>   else
>while (!$recordSet->EOF) {
> print '' . ' ' . $recordSet->fields[2] .
> '' . '' . $recordSet->fields[0] . '' .
> '' . $recordSet->fields[3] . '' . '';
> 
>   $recordSet->MoveNext();
> }
>   echo "";
> 
>   $recordSet->Close();
>   $conn->Close();
> ?>  
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] redirect http to https

2007-04-09 Thread Peter Lauri
> -Original Message-
> From: Ben Liu [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 09, 2007 3:52 PM
> To: Martin Marques; PHP
> Subject: Re: [PHP] redirect http to https
> 
> On 4/9/07, Martin Marques  wrote:
> 
> >
> > This should be done with the rewrite instruction of apache, or what ever
> > instructionyour web server has.
> 
> Um...guess I will have to check with our hosting company about this.
> Thanks.
> 
> - Ben
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

[Peter Lauri - DWS Asia] 

You might be able to do this by putting an .htaccess file in your webroot of
non-ssl:

--
RewriteEngine On

RewriteRule ^/(.*)$ https://www.yourdomain.com/$1 [L]
--

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Session Authentication

2007-04-09 Thread Peter Lauri


> -Original Message-
> From: Tijnema ! [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 09, 2007 5:38 PM
> To: Martin Marques
> Cc: Ólafur Waage; php-general@lists.php.net
> Subject: Re: [PHP] Session Authentication
> 
> On 4/9/07, Martin Marques  wrote:
> > Tijnema ! escribió:
> > > On 4/9/07, Martin Marques  wrote:
> > >>
> > >> Yes:
> > >>
> > >> Don't use transparent session id, or even better, save the
> > >> authentication in a cookie on the client (seperated from the session
> > >> array).
> > >
> > > And then the user would crack the cookie 
> > > I know they are encrypted, but trust me, cookies can be edited.
> >
> > So what? The user authenticated himself, so what is he gonna crack?
> Yes, but i guess you're not only storing if the user has
> authenticated, also storing a username?
> 
> And if that's not the case, then you could authenticate by creating a
> cookie where it says authenticated = yes, and you're authenticated...
> 
> Tijnema
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

[Peter Lauri - DWS Asia] 

If cookies were that unsecured so you could create your own cookies that
easily, then would cookies exist?

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Session Authentication

2007-04-09 Thread Peter Lauri
> 
> Cookies are old, so in the time they were introduced, today it is
> possible to create and modify cookies with some good tools. These
> tools are illegal,  but every cracker is 99% illegal right? But that
> means i can't give you these tools to proof it, but it is possible.
> 
> Tijnema

[Peter Lauri - DWS Asia] 

Having these tools is probably not illegal. But using them illegally is
illegal :) Could you send me some more info "off-list" about this. Knowing
how to use these tools will probably help me making my sites more secure, am
I not right? :)

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Copying PHP array into a Javascript array

2007-04-10 Thread Peter Lauri
Check www.php.net/json

You can use the encode function there.

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


> -Original Message-
> From: Otto Wyss [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 10, 2007 10:37 PM
> To: php-general@lists.php.net
> Subject: [PHP] Copying PHP array into a Javascript array
> 
> I don't know if I should ask this question here or in the JavaScript
> group. I'll try it here since people usually are more helpful.
> 
> I've an array of file names
> 
>$files = getFiles ($d);
> 
> but would like to use this array in a JavaScript array. How can I copy
> this $files into a JavaScript variable?
> 
> O. Wyss
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Getting PHP CLI on machine without compiling or changing the other part of the system

2007-09-23 Thread Peter Lauri
Hi,

 

In a current project we have developed a piece of software that run
independently and that only requires php5 as a CLI component.

 

Now we want to use this software on other machines, and the only requirement
it that the machine has php5 installed. Fine for now, but then we have
started to get request from clients to use this on their machines, as they
need our software there. Then we informed them that we need to compile php
on their machine. But due to the sensitive machines that they have, they
rejected that idea. So now we need to find a way to have PHP5 on the
machine, without compiling it on their machine and changing their
environment.

 

So is there any nice solution with php pre compiled and that the files are
just in a tar ball or similar, so that the php cli can be used?

 

Best regards,

Peter Lauri

 

 <http://www.dwsasia.com/> www.dwsasia.com - company web site

 <http://www.lauri.se/> www.lauri.se - personal web site

 <http://www.carbonfree.org.uk/> www.carbonfree.org.uk - become Carbon Free

 



RE: [PHP] str_replace oddity

2007-09-23 Thread Peter Lauri
No, turn Magic Quotes off :)

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Sunday, September 23, 2007 3:10 AM
> To: Jim Lucas
> Cc: Kevin Waterson; php-general@lists.php.net
> Subject: Re: [PHP] str_replace oddity
> 
> So replace ' \" ' instead of ' " '.
> 
> On 9/22/07, Jim Lucas <[EMAIL PROTECTED]> wrote:
> > Kevin Waterson wrote:
> > > I am using str_replace to strip double quotes.
> > >
> > > $string = 'This string has "quotes" in it';
> > >
> > > $string = str_replace('"', '', $string);
> > >
> > > this seems to work, yet when I put the $string into mysql,
> > > it uses backslashes to escape where the quotes were. The
> > > double-quotes are gone, yet it still escapes the 'ghost'
> > > where they were.
> > >
> > > I even tried
> > > str_replace(array("\x8c", "\x9c", "'", '"'), '', $string)
> > > but the ghost remains and mysql continues to escape them.
> > >
> > > I check the charsets, and the db is Latin-1 and the sting is ISO-8859-
> 1
> > >
> > > Any thoughts on this would be most graciously accepted.
> > > Kind regards
> > > kevin
> > >
> > >
> > is $string honestly something that you are getting via a form submit?
> >
> > if so, your system might have magic quotes enabled.
> >
> > This would automatically escape quotes with the attempt to make the
> > values safer, and then you go and run your str_replace command and
> > remove the double quotes, you end up leaving the '\' that the system
> > automatically put in the value for you.
> >
> > read up on magic quote gpc
> >
> > hope this helps.
> >
> > Jim
> >
> > --
> > Jim Lucas
> >
> >
> >  "Perseverance is not a long race;
> >  it is many short races one after the other"
> >
> > Walter Elliot
> >
> >
> >
> >  "Some men are born to greatness, some achieve greatness,
> >  and some have greatness thrust upon them."
> >
> > Twelfth Night, Act II, Scene V
> >  by William Shakespeare
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] file() ignores PHP tags

2007-09-23 Thread Peter Lauri
Your array that you get from the file() will contain the  -Original Message-
> From: magoo [mailto:[EMAIL PROTECTED]
> Sent: Sunday, September 23, 2007 3:52 PM
> To: php-general@lists.php.net
> Subject: [PHP] file() ignores PHP tags
> 
> Hi NG!
> 
> I wanna output several kinds of ascii files. Two things are bothering me
> right now:
> 1. I don`t get the PHP starttag ( Is there anything I can to to get all of it?
> 
> 2. How can I stop the browser to render HTML output, in order to get plain
> ascii?
> 
> Cheers!
> 
> --
> Kind regards,
> magoo
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] file() ignores PHP tags

2007-09-23 Thread Peter Lauri
Oh, and by the way, remember that the array that file() returns also will
contain the newline. Add the flag FILE_IGNORE_NEW_LINES if you don't want
them.

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


> -Original Message-
> From: magoo [mailto:[EMAIL PROTECTED]
> Sent: Sunday, September 23, 2007 3:52 PM
> To: php-general@lists.php.net
> Subject: [PHP] file() ignores PHP tags
> 
> Hi NG!
> 
> I wanna output several kinds of ascii files. Two things are bothering me
> right now:
> 1. I don`t get the PHP starttag ( Is there anything I can to to get all of it?
> 
> 2. How can I stop the browser to render HTML output, in order to get plain
> ascii?
> 
> Cheers!
> 
> --
> Kind regards,
> magoo
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] PHP Command line script

2007-05-02 Thread Peter Lauri
Check the error from mysqli:

http://fi.php.net/manual/en/function.mysqli-error.php

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free

> -Original Message-
> From: Nathaniel Hall [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, May 01, 2007 10:13 PM
> To: php-general@lists.php.net
> Subject: [PHP] PHP Command line script
> 
> I am attempting to run a script that will run from the command line
> nightly to update a field in a database.  I already created a script
> that would access the database and insert most of the information when a
> webpage is visited and I had no problems with it.  The command line
> script appears to fail on the prepare.  I have echo'ed the SQL statement
> to the screen, copied it, and run it on the MySQL server with no
> problems.  Any ideas?
> 
>  $mysqli = new mysqli('localhost', 'root', 'abc123', 'mydb');
> if (mysqli_connect_errno()) {
> echo "Unable to connect to database.\n";
> exit;
> } else {
> $login = date('m\-d\-Y');
> if ($logout = $mysqli->prepare("UPDATE `mydb`.`authlog`
> SET `logout`  = ? WHERE `login` LIKE '$login%'")) { // <--- Will not go
> any further than here, even when hard coding the information.
> $logout->bind_param("s", date('m\-d\-
> Y\TH\:i\:s'));
> $logout->execute();
> $logout->close();
> }
> }
> $mysqli->close();
> ?>
> 
> --
> Nathaniel Hall, GSEC GCFW GCIA GCIH GCFA
> Spider Security
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] exec dont work for svn

2007-05-29 Thread Peter Lauri
Hi,

In many apps the messages comes as STDERR, so try:

exec("svn update 2>&1", $out);

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free

> -Original Message-
> From: Manolet Gmail [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, May 29, 2007 5:45 PM
> To: PHP List
> Subject: [PHP] exec dont work for svn
> 
> 2007/5/28, Greg Donald <[EMAIL PROTECTED]>:
> > On 5/28/07, Manolet Gmail <[EMAIL PROTECTED]> wrote:
> > > but this doesnt work:
> > >
> > > exec("svn update",$out);
> > > foreach($out as $line)echo"$line\n";
> > >
> > > dont print anything... dont update the files
> >
> > Is it possible you need to provide some type of authentication?  `svn
> > update` may be asking for input your exec call isn't providing.
> 
> well, i have  error reporting (E ALL) and dont give me any error, also
> i try with
> 
> svn update --non-interactive --username user --password pass
> 
> and again... nothing appears. Also if the svn update ask for a
> password  why php dont show it?, or why i dont receive a maximum
> ececution time of script error?.
> 
> the script run instantly btw,..
> 
> >
> >
> > --
> > Greg Donald
> > http://destiney.com/
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Removing a row from an Array

2007-06-04 Thread Peter Lauri
Using array_pop wouldn't do it, as it just removes the last element.

You could use unset() for the rows you don't want to keep.

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


> -Original Message-
> From: Jay Blanchard [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 04, 2007 9:25 PM
> To: Ken Kixmoeller -- reply to [EMAIL PROTECTED]; php-
> [EMAIL PROTECTED]
> Subject: RE: [PHP] Removing a row from an Array
> 
> [snip]
> To do this, I am:
> 
>   - looping through the array
>   - copying the rows that I want to *keep* to a temp array, and
>   - replacing the original array with the "temp' one.
> 
> Seems convoluted, but I couldn't find any function to remove a row of
> an array. Am I missing something (other than a few brain cells)?
> [/snip]
> 
> http://us2.php.net/manual/en/function.array-pop.php
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Controlling a scanner with PHP

2006-06-27 Thread Peter Lauri
Probably nobody, as PHP is a Server Side Scripting Language.

-Original Message-
From: George Pitcher [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 27, 2006 7:16 PM
To: php-general@lists.php.net
Subject: [PHP] Controlling a scanner with PHP

Hi,

I have been asked to look at extending one of my CMS systems to incorporate
integration to a library management system, as well as LDAP and Active
Directory. The requirement also asks for scanning and OCR of documents to be
controlled by the CMS.

Does anyone have any experience of implementing the scanning into a PHP
application?

MTIA

George

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Controlling a scanner with PHP

2006-06-27 Thread Peter Lauri
Maybe JavaScript can do it for you?

-Original Message-
From: George Pitcher [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 27, 2006 8:01 PM
To: Peter Lauri
Subject: RE: [PHP] Controlling a scanner with PHP

Peter,

I take it you have spoken to everyone on the list then?

I know that PHP is a server side language, but that doesn't mean that nobody
has been able to do what I need to do, just that they've used other non-php
tools.

George

> -Original Message-
> From: Peter Lauri [mailto:[EMAIL PROTECTED]
> Sent: 27 June 2006 8:56 am
> To: 'George Pitcher'; php-general@lists.php.net
> Subject: RE: [PHP] Controlling a scanner with PHP
>
>
> Probably nobody, as PHP is a Server Side Scripting Language.
>
> -Original Message-
> From: George Pitcher [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 27, 2006 7:16 PM
> To: php-general@lists.php.net
> Subject: [PHP] Controlling a scanner with PHP
>
> Hi,
>
> I have been asked to look at extending one of my CMS systems to
> incorporate
> integration to a library management system, as well as LDAP and Active
> Directory. The requirement also asks for scanning and OCR of
> documents to be
> controlled by the CMS.
>
> Does anyone have any experience of implementing the scanning into a PHP
> application?
>
> MTIA
>
> George
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Controlling a scanner with PHP

2006-06-27 Thread Peter Lauri
Stut,

You are correct. PHP can be used in much more extent, but my tiny box where
I use PHP has never touched that area though :) I did truly enjoy the
continuing of the thread, because I learned that PHP is much more then a Web
Server Scripting Language :)

/Peter



-Original Message-
From: Stut [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 27, 2006 8:11 PM
To: Peter Lauri
Cc: 'George Pitcher'; php-general@lists.php.net
Subject: Re: [PHP] Controlling a scanner with PHP

Peter Lauri wrote:
> Probably nobody, as PHP is a Server Side Scripting Language.

If there's one thing I hate it's needless pigeonholing. PHP is not a 
"Server Side Scripting Language". It is a scripting language for sure, 
but is by no means limited to being used on a server never mind on a web 
server.

As to the OPs question, assuming you are aware that PHP cannot control 
anything on the client-side if used on a web server, and assuming you 
are talking about a Windows-based machine, you will probably find there 
are COM objects you can use to control scanners. From the PHP side check 
here: http://php.net/com. For the actual interface to scanners I suggest 
you Google.

Sounds like a fun project, enjoy.

-Stut

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Find out cookies on a computer?

2006-06-29 Thread Peter Lauri
Is it possible to some how find out all cookies on a specific computer and
their name and value? I assume not :)

 

/Peter

 

 

 



[PHP] RE: Find out cookies on a computer?

2006-06-29 Thread Peter Lauri
Is the question dumb? Why you answer it then? It is very interesting in a
security manner. I have very low knowledge about them, so therefore the
question. And if you think this question is unethical, and the rest of the
society does that, we would probably not have as secure technology regarding
cookies _as you state it is_. Rethink you answer a bit...

As a developer I would like to know if someone can view the cookies that are
not authorized to do so. Sorry for wanting to learn more...


-Original Message-
From: Adam Zey [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 30, 2006 4:32 AM
To: Peter Lauri
Cc: php-general@lists.php.net
Subject: Re: Find out cookies on a computer?

Peter Lauri wrote:
> Is it possible to some how find out all cookies on a specific computer and
> their name and value? I assume not :)
> 
>  
> 
> /Peter
> 

No, because you don't OWN them, therefore you have no right (either 
technologically or ethically) to see them. Asking such unethical 
questions on this list is, well, pretty dumb.

Regards, Adam.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: Find out cookies on a computer?

2006-06-29 Thread Peter Lauri

The global array $_COOKIE should hold any cookie which is available to you


Yes, but that is just for the ones available for me. Like Google, they set a
cookie if you click on one of their "adwords" ads and then use them in the
tracking of the customer conversion.

Cookies like this are interesting to use. One of my clients want to track a
little deeper the "adwords" and the conversion of them, and to get that
cookie would be awesome.

But I am loosing hope that it can be done now :)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] RE: Find out cookies on a computer?

2006-06-29 Thread Peter Lauri
Thank you, great reading :)

-Original Message-
From: Richard Collyer [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 30, 2006 5:01 AM
To: php-general@lists.php.net
Subject: Re: [PHP] RE: Find out cookies on a computer?

Peter Lauri wrote:
> Is the question dumb? Why you answer it then? It is very interesting in a
> security manner. I have very low knowledge about them, so therefore the
> question. And if you think this question is unethical, and the rest of the
> society does that, we would probably not have as secure technology
regarding
> cookies _as you state it is_. Rethink you answer a bit...
> 
> As a developer I would like to know if someone can view the cookies that
are
> not authorized to do so. Sorry for wanting to learn more...

http://en.wikipedia.org/wiki/HTTP_cookie#Privacy_and_third-party_cookies

Cheers
Richard

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] design?

2006-06-30 Thread Peter Lauri
How about answer extends question?

-Original Message-
From: David Tulloh [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 30, 2006 9:36 AM
To: Sjef
Cc: php-general@lists.php.net
Subject: Re: [PHP] design?

Sjef wrote:
> Hi there,
> 
> I am starting a new, very small project. A simple question and answering 
> form. In one screen, question and answer can be typed, the strings will be

> saved in a database table questions which holds question and answer (as 
> there is only one answer to a question). There will be a webpage
displaying 
> all the questions, clickable to the webpage of the answer to the question 
> clicked.
> 
> I want to create a class Question for dealing wiht the questions and a
class 
> answer for the answers. Each could contain an array with the their part of

> the content of the database table. The class Question manages the class 
> Answer, so when instantiating the Question, the Answer will follow.
> Beside of this I want to create a 'visual' component class that creates
the 
> lists as displayed on the webpage.
> 
> Is this a good idea? Or should I not bother, and just create one class 
> Question that also deals with the Answers.
> 

You have essentially three pages:
  one that displays a form and inputs the entered data to a database;
  one that gets a list of questions from the database;
  one that displays a specific question/answer pair.

As a ballpark estimate, I'd say that the above should be possible in
under 100 lines of PHP code.

You are looking at creating a Question class, an Answer class and a
Visual/List class.  The net result being that you double the number of
PHP files and considerably increase the amount of code, there isn't much
opportunity for code reuse here.

Now, if the objective is to play with php OOP then go ahead.  I would
even suggest a DB class, a TableRow class, the Question and Answer then
inherit from the TableRow, a TableRows class from which your List class
would inherit.  Maybe throw a few in to control the templates etc. as well.

If the objective is just to get the job done and the site out, I don't
see why you should bother with OOP at all.


David

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] GD to database directly

2006-07-10 Thread Peter Lauri
Best group member,

 

I am creating images via GD and want to save them to the database. Right now
I save them to the disk and then save them to the database. Is it possible
to write them directly to the database and skip the middle step where I
temporary write it to the hard disk?

 

Best regards,

Peter Lauri

 

 

 



RE: [PHP] GD to database directly

2006-07-10 Thread Peter Lauri
[snip]
1. Do not store images in a database, it is just a bad idea from a
performance perspective (as has been covered many times heretofore). 
[/snip]

Is that really the case? Is this not depending on the application? :) My
application will never grow, and I can easily just change the file storage
procedure by changing in my file storage class if a change will be
necessary.

/Peter

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Setting cookie on one domain for an other domain

2006-07-20 Thread Peter Lauri
Best group member,

 

When a user does a specific action on domain1.com I want a cookie to be set
so that domain1.com and domain2.com can reach it. Ok, after reading the
manual for setcookie() I tried this:

 

setcookie("thevariable", "thevalue", time()+60*60*24*30, "/",
".domain1.com");

setcookie("thevariable", "thevalue", time()+60*60*24*30, "/",
".domain2.com");

 

However, I can not detect the cookie at domain2.com.

 

A solution would be to just make a redirect to the other domain where the
cookie is set and then return.

 

Question is: Can I not set a cookie at domain1.com to work at domain2.com?

 

Best regards,

Peter Lauri

 

 



RE: [PHP] jpg to pdf using fpdf

2006-07-26 Thread Peter Lauri
Correct me if I am wrong, but do fpdf allow jpg? I think you must convert to
PNG or GIF and then use that image.



-Original Message-
From: nicolas figaro [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 26, 2006 8:24 PM
To: PHP List
Subject: [PHP] jpg to pdf using fpdf 

Hi,

I'd like to convert a jpg image to a pdf document using the fpdf class. 
(www.fpdf.org).

here is the code :
open();

$pdf->image($image,0,0);

$pdf->Output("/path/to/image.pdf",'F');
?>

but I only get a blank a4 pdf document when I open image.pdf using 
acroread.

does anyone have an idea how I can convert a jpg to a pdf ? (without 
paying if possible
the price for a commercial library).

thanks

 N F

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] jpg to pdf using fpdf

2006-07-26 Thread Peter Lauri
So then it was the opposite of what I had in memory :)

-Original Message-
From: nicolas figaro [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 26, 2006 8:30 PM
To: 'PHP List'
Subject: Re: [PHP] jpg to pdf using fpdf

Peter Lauri a écrit :
> Correct me if I am wrong, but do fpdf allow jpg? I think you must convert
to
> PNG or GIF and then use that image.
>
>   
I correct you.
FPDF allow jpg.
take a look at ttp://www.fpdf.org/en/doc/image.htm
" Supported formats are JPEG and PNG. "

 N F

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] jpg to pdf using fpdf

2006-07-26 Thread Peter Lauri
This is code how it works for me:

$pdf =& new FPDF('p','pt','a4');
$pdf->AddPage();
$pdf->Image("pdf/profilechart.png",145,$pdf->GetY());
$pdf->Output("pdf/temp/thepdf.pdf",'F');

Add the $pdf->AddPage(); and it might work :)


-Original Message-
From: nicolas figaro [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 26, 2006 8:24 PM
To: PHP List
Subject: [PHP] jpg to pdf using fpdf 

Hi,

I'd like to convert a jpg image to a pdf document using the fpdf class. 
(www.fpdf.org).

here is the code :
open();

$pdf->image($image,0,0);

$pdf->Output("/path/to/image.pdf",'F');
?>

but I only get a blank a4 pdf document when I open image.pdf using 
acroread.

does anyone have an idea how I can convert a jpg to a pdf ? (without 
paying if possible
the price for a commercial library).

thanks

 N F

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] jpg to pdf using fpdf

2006-07-26 Thread Peter Lauri
Check the FPDF function in the manual http://www.fpdf.org/en/doc/fpdf.htm, I
think you can set custom size of the PDF. You have to figure out how to get
the image size first, hint: getImageSize();), and then convert it to the
units you use for the pdf.

-Original Message-
From: nicolas figaro [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 26, 2006 8:44 PM
To: PHP List
Subject: Re: [PHP] jpg to pdf using fpdf

Peter Lauri a écrit :
> This is code how it works for me:
>
> $pdf =& new FPDF('p','pt','a4');
> $pdf->AddPage();
> $pdf->Image("pdf/profilechart.png",145,$pdf->GetY());
> $pdf->Output("pdf/temp/thepdf.pdf",'F');
>
> Add the $pdf->AddPage(); and it might work :)
>
>   
addpage did the trick.
thanks peter.

next question : how to set the pdf size to the size of the image ? :)

N F

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Books: PHP and WAP

2006-07-26 Thread Peter Lauri
http://www.w3schools.com/wap/default.asp

That is a good start...


-Original Message-
From: Angelo Zanetti [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 26, 2006 10:54 PM
To: PHP List
Subject: [PHP] Books: PHP and WAP

Hi all,

I need some recommendations for books:
are there any good books on PHP and WAP/WML? Also (OT) a recommendation 
regarding books for CSS2 and XHTML.

Thanks in advance
-- 

Angelo Zanetti
Systems developer


*Telephone:* +27 (021) 469 1052
*Mobile:*   +27 (0) 72 441 3355
*Fax:*+27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] fpdf

2006-07-26 Thread Peter Lauri
Yes you can...

$pdf->Output("thelocation/filename.pdf", "F");

Just make sure that thelocation has permission to write for the web server.

/Peter

-Original Message-
From: João Cândido de Souza Neto [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 27, 2006 7:05 AM
To: php-general@lists.php.net
Subject: [PHP] fpdf

Hi everyone.

Could someone tell me if fpdf class can write the pdf file into the server? 
I've reading about and just found that it save the pdf document in a local 
place or open it in browser.

I need to write it in server, it's possible?

Thanks a lot. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] sorting in array

2006-07-30 Thread Peter Lauri
   function cmpcountry($a, $b)
   {

 $country1 = $a['country'];
 $country2 = $b['country'];

   if($country1=='') return 1;
   else return ($country1 < $country2) ? -1 : 1;

   }

-Original Message-
From: weetat [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 31, 2006 12:32 PM
To: php-general@lists.php.net
Subject: [PHP] sorting in array

Hi all ,

  I have array value as shown below, i have paste my test php code below:
  I have problem when doing usort() when 'country' = '', i would like to 
display records where country = '' last. Any ideas how to do that ?

Thanks

   $arraytest= array(
  array
 (
 'country' => '',
 )
  ,
  array
 (
 'country' => 'Thailand',
 )
  ,
  array
 (
 'country' => 'Singapore',
 )
  ,
  array
 (
 'country' => 'Singapore',
 )
  ,
  array
 (
 'country' => '',
 )
   ,
  array
 (
 'country' => '',
 )
,
array
 (
 'country' => '',
 )

  );


   function cmpcountry($a, $b)
   {

 $country1 = $a['country'];
 $country2 = $b['country'];

  return ($country1 < $country2) ? -1 : 1;
   }

 usort($arraytest,"cmpcountry");
 while(list($name,$value)=each($arraytest)){
   echo $name."";

   while(list($n,$v) = each($arraytest[$name])){
   echo $v."";
   }
  }

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] sorting in array

2006-07-31 Thread Peter Lauri
And this for DESCending

   function cmpcountry($a, $b)
   {
 $country1 = $a['country'];
 $country2 = $b['country'];

if($country1=='' OR $country2=='') {
if($country1==$country2) return 0;
elseif($country1=='') return 1;
else return -1;
} else return ($country1 < $country2) ? 1 : -1;
   }

-Original Message-
From: weetat [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 31, 2006 3:15 PM
To: php-general@lists.php.net; Paul Novitski
Cc: php-general@lists.php.net
Subject: Re: [PHP] sorting in array

Thanks Paul,

   Very weird tried Peter's option, it doesn't work.

   Btw , how to sort by ascending ?

Thanks

Paul Novitski wrote:
> At 12:22 AM 7/31/2006, Paul Novitski wrote:
>> I could make that last statement just a bit simpler:
>>
>>   function cmpcountry($a, $b)
>>   {
>> $country1 = ($a['country'] == '') ? "zzz" : $a['country'];
>> $country2 = ($b['country'] == '') ? "zzz" : $b['country'];
>>
>> return ($country1 > '' && $country1 < $country2) ? -1 : 1;
>>   }
> 
> 
> *Sigh*  I shouldn't post this late at night.  This is the comparison 
> function that works for me:
> 
>   function cmpcountry($a, $b)
>   {
> $country1 = ($a['country'] == '') ? "zzz" : $a['country'];
> $country2 = ($b['country'] == '') ? "zzz" : $b['country'];
> 
> return ($country1 < $country2) ? -1 : 1;
>   }
> 
> demo: http://juniperwebcraft.com/test/sortTest.php
> code: http://juniperwebcraft.com/test/sortTest.txt
> 
> Paul 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] sorting in array

2006-07-31 Thread Peter Lauri
Sorry, I just woke up and just posted an reply without thinking, use this:

   function cmpcountry($a, $b)
   {
 $country1 = $a['country'];
 $country2 = $b['country'];

if($country1=='' OR $country2=='') {
if($country1==$country2) return 0;
elseif($country1=='') return 1;
else return -1;
} else return ($country1 < $country2) ? -1 : 1;
   }

/Peter



-Original Message-
From: Paul Novitski [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 31, 2006 1:57 PM
To: php-general@lists.php.net
Subject: Re: [PHP] sorting in array

At 10:31 PM 7/30/2006, weetat wrote:
>  I have problem when doing usort() when 'country' = '', i would 
> like to display records where country = '' last. Any ideas how to do that
?
...
>   $arraytest= array(
>  array
> (
> 'country' => '',
> )
>  ,
>  array
> (
> 'country' => 'Thailand',
> )
...
>   function cmpcountry($a, $b)
>   {
> $country1 = $a['country'];
> $country2 = $b['country'];
>
>  return ($country1 < $country2) ? -1 : 1;
>   }


Weetat,

You can sort the blank fields to the end simply by forcing their 
evaluated values in your usort callback function:

   function cmpcountry($a, $b)
   {
 $country1 = $a['country'];
 $country2 = $b['country'];

 if ($country1 == '') $country1 = "zzz";
 if ($country2 == '') $country2 = "zzz";

 return ($country1 < $country2) ? -1 : 1;
   }

...or, using ternary syntax:

   function cmpcountry($a, $b)
   {
 $country1 = ($a['country'] == '') ? "zzz" : $a['country'];
 $country2 = ($b['country'] == '') ? "zzz" : $b['country'];

 return ($country1 < $country2) ? -1 : 1;
   }


Regards,
Paul 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] All active variables?

2006-08-01 Thread Peter Lauri
Hi,

Is it possible to print out all variables that are active within a script
without doing it manually? This is what I would like to do:

$a = 12;
$b = 'Peter';
$c = 'Lauri';

echo '';
print_r( get_all_variables() );
echo '';

Best regards,
Peter Lauri

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] All active variables?

2006-08-01 Thread Peter Lauri
Great stuff, I probably just searched the wrong words.

-Original Message-
From: Stut [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 01, 2006 6:22 PM
To: Peter Lauri
Cc: php-general@lists.php.net
Subject: Re: [PHP] All active variables?

Peter Lauri wrote:
> Is it possible to print out all variables that are active within a script
> without doing it manually? This is what I would like to do:
>
> $a = 12;
> $b = 'Peter';
> $c = 'Lauri';
>
> echo '';
> print_r( get_all_variables() );
> echo '';

30 seconds of searching the PHP site later... 
http://php.net/get_defined_vars

-Stut

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] SQL injection

2006-08-02 Thread Peter Lauri
Hi all,

 

I saw some strange error messages from a site when I was surfing it, and it
was in form of SQL. I did some testing of the security of the SQL injection
protection of that site, and it showed it was not that protected against SQL
injections. To show this to them, I deleted my own record in their database
after finding out the table name of the "entity" in the database. I also
found out a lot of other that I think is important table names.

 

What I did to them was to report this to them, and inform them about the
damage I created, and what could have been done. (I did DELETE FROM
tablename WHERE id=1234, what if I did DELETE FROM tablename, destruction if
no backup). This is a large "athletic site" in Sweden, with more then
100,000 daily visitors.

 

What I am a little bit worried about is the legal part of this; can I be
accused of breaking some laws? I was just doing it to check if they were
protected, and I informed them about my process etc. I only deleted my
record, no one else's. In Sweden it might have been called "computer
break-in", but I am not sure.

 

Anyone with experience of a similar thing?

 

Best regards,

Peter Lauri

 

 

 



RE: [PHP] SQL injection

2006-08-02 Thread Peter Lauri
Thank you all for your replies; it has been interesting to read. I am just
waiting for the webmaster to reply to me with his thoughts.

My intentions for this were to help, not to break, so I do indeed hope that
they will not take legal action for it. A friend of mine hoped that they
would use the law against me, it would just increase the publicity for me,
and that might increase the value of my services. And he was also sure that
they would never win the case.

I was for a while thinking about using my "private" yahoo email to not
disclose my name, however, that felt like "hiding for something you did not
do".

One at the forum sent me an message off the list and said: "You got bigger
balls than me. :-)", what did he mean with that? I did not know that the php
list also shows the web cam at the same time. "I better watch out"...

Best regards,
Peter Lauri




-Original Message-
From: Peter Lauri [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 02, 2006 11:17 PM
To: php-general@lists.php.net
Subject: [PHP] SQL injection

Hi all,

 

I saw some strange error messages from a site when I was surfing it, and it
was in form of SQL. I did some testing of the security of the SQL injection
protection of that site, and it showed it was not that protected against SQL
injections. To show this to them, I deleted my own record in their database
after finding out the table name of the "entity" in the database. I also
found out a lot of other that I think is important table names.

 

What I did to them was to report this to them, and inform them about the
damage I created, and what could have been done. (I did DELETE FROM
tablename WHERE id=1234, what if I did DELETE FROM tablename, destruction if
no backup). This is a large "athletic site" in Sweden, with more then
100,000 daily visitors.

 

What I am a little bit worried about is the legal part of this; can I be
accused of breaking some laws? I was just doing it to check if they were
protected, and I informed them about my process etc. I only deleted my
record, no one else's. In Sweden it might have been called "computer
break-in", but I am not sure.

 

Anyone with experience of a similar thing?

 

Best regards,

Peter Lauri

 

 

 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



  1   2   3   4   >