[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 ?php tag, but you
will not see it in your browser as it is parsed as html.

header(Content-type: text/plain);

ontop of your script will output plain text. Hope it 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: 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 (?php) in my output, but the ending tags.
 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 (?php) in my output, but the ending tags.
 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] 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] 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 21, $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)echobr/$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] 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?
 
 ?php
 $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] 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



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
 --
 div id=blocoNews
   ?php
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 'div class=blocoTexto' . ' h3' . $recordSet-fields[2] .
 '/h3' . 'p class=data' . $recordSet-fields[0] . '/p' .
 'p' . $recordSet-fields[3] . '/p' . '/div';
 
   $recordSet-MoveNext();
 }
   echo br class=\clear\;
 
   $recordSet-Close();
   $conn-Close();
 ?  !-- end #secContent --
 /div
 
 --
 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 martin@bugs.unl.edu.ar 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 martin@bugs.unl.edu.ar wrote:
  Tijnema ! escribió:
   On 4/9/07, Martin Marques martin@bugs.unl.edu.ar 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] 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
 --
 
 ?php
   if (isset($_SESSION['email'])) {
echoa href=\products-teststudio.php?file=testudio.pdf\
 rel=\external\Download TESTUDIO flyer/a;
 
$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] 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] 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 $valuebr;
 }
 
 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!!
 
 ?php
 exec(find /Users/rjohari/Documents/XFER/espi -type f -name
 .$row['PHONE'].*.vox, $files);
 foreach ($files as $value) {
 echo substr($value,35).br;
 }
 ?
 
 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] 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
 
 
 form action=test.php method=post
 table
 trtd colspan=2 align=leftinput name=subscriptions[] value=3
 type=checkboxtest message
 /td/trtrtd colspan=2 align=leftinput name=subscriptions[]
 value=4 type=checkboxtest message
 /td/trtrtd colspan=2 align=leftinput name=subscriptions[]
 value=5 type=checkboxtest message
 /td/trtrtd colspan=2 align=leftinput name=subscriptions[]
 value=6 type=checkboxtest message
 /td/trtrtd colspan=2 align=leftinput name=subscriptions[]
 value=7 type=checkboxtest message
 /td/tr
 /table
 input type=hidden name=doit value=yes
 input type=submit name=submit
 
 /form
[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] 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] 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] 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



[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

?php

exec(ls -lrt, $stdout, $exitcode);

 

if($exitcode!=0) {

echo Command ls -lrt could not be executed correctly. Exit
code: $exitcode\n;

} else {

echo Result:\n;

foreach($stdout AS $line) {

echo $line.\n;

}

}

?

 

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_machinename 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

 ?php

 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] 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



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] 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] 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.phpkind=
regions 


I have a form with method=post and action=?PHP $_SERVER['PHP_SELF']; 
?. 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?

form action=?PHP $_SERVER['PHP_SELF']; ? method=get
...
  select name=state onchange=this.form.submit()

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] 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 21 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:

a peter = a id=peter

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] 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 21 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
 
  ?php
  $data ='';
  $fp = fopen (site/themes/.$arrStat['theme']./css/main.css,r);
  while (!feof($fp)) { $data.= fgets($fp, 16384); }
 
  $mail=
  html
  head
  titleTitle/title
  style.$data./style
  /head
  body
  Html content
  /body
  /html;
 
  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-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:

?php
session_start();
//ob_start();
require_once 'functions.php';
$UserName = $_POST['UserName'];
$Password = $_POST['Password'];
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$adminAddress = getAbsolutePath().'adminlogin.php';
$userAddress = getAbsolutePath().'userlogin.php';
$samePage = getAbsolutePath().'login.php';
if ($_POST){
$error = login_check($_POST);
if (trim ($error)==)
{
$accesslevel = accessLevel($UserName);
?
?php
if ($accesslevel == admin){
$_SESSION['level'] = admin;
$_SESSION['username'] = $_POST['UserName'];
$_SESSION[userid] = login($_POST);
include ('adminlogin.php');
//echo script language='javascript'
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();
?
BODY
FORM id=form1 name=loginform  method=post



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:

?php
session_start();
//store to test if they were logged in
$old_user = $_SESSION['userid'];
//$_SESSION['loggedIn'] = false;
unset ($_SESSION['userid']);
unset ($_SESSION['username']);
unset ($_SESSION['level']);
session_destroy();
?



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



[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] 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).

?php
$configcontent = file_get_contents(config.cfg);
$lines = explode(\n, $configcontent);
foreach($lines AS $line) {
$line = trim($line);
if(preg_match(/^[A-Z_]+\s+.+$/, $line)) {
$linemodified =
preg_replace(/^([A-Z_]+)\s+(.+)$/,$1:$2,$line);
list($const, $value) = explode(:, $linemodified, 2);
define($const, $value);
}
}
?

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



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:

?php
echo gmdate('m, d, Y', gmmktime(0,0,0,3,23,2000) );
?

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



[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] 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



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:

?php
$subject=$_REQUEST[sb];
$nmobile=trim($_REQUEST[nmobile]);
$message=$_REQUEST[message];
$header=From: [EMAIL PROTECTED];

//Bolivia providers
switch($nmobile[1]){
 case 0: $company=@viva-gsm.com; break;
 case 1: $company=@entelmovil.com.bo;break;
 case 2:
 case 3: $company=@movil.com.bo; break;
 case 6:
 case 7: $company=@tigo.com.bo;break;
 }
$number=591.$nmobile.$company;
if( @mail($number,$subject,$message,$header))
echo Message sent;
else echo error;
?

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] 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] __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] 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] 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] 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 pre;
echo $file_content;
echo /pre;
} 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):

?php

echo ?xml version=\1.0\ encoding=\UTF-8\?;
echo !DOCTYPE HTML PUBLIC \-//W3C//DTD XHTML Mobile 1.0//EN\
\http://www.wapforum.org/DTD/xhtml-mobile10.dtd\;;
echo html xmlns=\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 head;
echo titleSearch Engine/title;
echo style type=\text/css\
   .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;}
/style;
echo /head;
echo body;
echo table;
echo div class=\cre\;
echo bSearch Engine/b/div;
echo form method=\GET\
action=\search.php?uid=$uidamp;pwd=$pwd\; ///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: input type=\text\ name=\q\ /br/;
echo input type=\submit\ name=\Submit\/;
echo /form;
echo /table;
echo div class=\cre\img src=\images/home.gif\ alt=\*\/a
href=\index.php?uid=$uidamp;pwd=$pwd\Home/a/div;
echo /body;
echo /html;
}

///Display Results

if(isset($var)){
$var = $_GET[q];
$trimmed = trim($var); //trim whitespace from the stored variable
echo head;
echo titleSearch Results/title;
echo style type=\text/css\
   .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;}
/style;
echo /head;
echo body;
echo div class=\cre\;
echo bSearch Results/b/div;
echo table;
 // 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))
{
   $dscr =htmlspecialchars($site[11]);
   $snm=htmlspecialchars($site[1]);
   echo trtd align=\left

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] 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 pre;
print_r($_COOKIE);
echo /pre;

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 img src=images/myimage.jpg / if a root file

is coded as img src=../images/myimage.jpg / 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] 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] 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 pre;
print_r($string_as_array);
echo /pre;

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



[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] 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=9491edit=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



RE: [PHP] calling a function in the same page

2006-12-26 Thread Peter Lauri
This is what you could do. Separating them into a few files. Also read the
http://en.wikipedia.org/wiki/Ajax_%28programming%29 to learn some more about
AJAX.

You should also learn more about Server Side Scripting so you understand
what can be done with Server Side Scripting and Client Side Scripting.


index.php:

$query would contain the SQL (or is it some other query type) you want to
execute. This is far from any security as you come if this would be SQL, as
you would output the SQL and therefore give table names etc to anyone who
views the source of the HTML. This could in the future lead to SQL
injections etc if you don't protect your self against that as well. 

You would also need to include the javascript.js in your head tag of the
HTML that you generate. Also you would need to download the Prototype
library and include them in head as well. See
http://wiki.script.aculo.us/scriptaculous/show/Prototype where you can
download the necessary files to do your AJAX calls. If you want to do it the
hard coded way you need to create an ActiveXObject object if the user have
IE or an XMLHttpRequest object if user don't have a IE compatiable browser.
I suggest that you stick with Prototype unless you need to create an really
high performance tool for this, and might need to hard code it your self.

--
echo brbra href=\javascript:doSearch($query)\More results from
Mysite/a;
echo div id='resultsdiv'/div;
--



javascript.js:

--
function doSearch(sql) {
var success = function(t){
thediv = document.getElementById(resultsdiv);
thediv.innerHTML = t.responseText;
}

var failure = function(t){
alert(Something went wrong, please try again.);
}

var url='ajax.php';

pars = query=+ query;

var req= new Ajax.Request(url, {method: 'post', postBody:pars,
onSuccess: success, onFailure: failure});

}
--



ajax.php

--
//Set header to TEXT/HTML and also whatever enc type you want.
header(Content-type: text/html);

if(isset($_POST['mysql'])) {
//do whatever you want with the
//$_POST['mysql'] variable and output the results
//the you want to be shown in the div with id resultsdiv
}
--


Best regards,
Peter Lauri


-Original Message-
From: Aras [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 26, 2006 11:50 AM
To: php-general@lists.php.net
Subject: RE: [PHP] calling a function in the same page



You can not call PHP functions through a href which is used for linking web
pages.
You need to create a new file or use a switch in your current file for
search input,
with the function in it. So that you can link to that URL, not the function
itself.

You can use AJAX as well, to send commands to a php file and get the results
in xml/text,
but again you need to call Javascript there, your logic is totally wrong.


Aras Koktas
[EMAIL PROTECTED]
Business Excellence Development
Phi.dot Internet Systems


-Original Message-
From: Jahangir [mailto:[EMAIL PROTECTED]
Sent: Sunday, December 24, 2006 6:34 PM
To: php-general@lists.php.net
Subject: [PHP] calling a function in the same page


I am trying to call a function from a href inside the same page.
this is the code:
echo brbra href=\isearch($query)\More results from Mysite/a;
// calling the function isearch

function isearch($query)

{$query=urlencode($query);

$request='http://api.search.yahoo.com/WebSearchService/V1/webSearch?appid=Ja
hangirquery=' .urlencode($query). 'output=phpresults=100site=mysite.com;

$response=file_get_contents($request);

if ($response === false) {

die('Request failed');}

$phpobj=unserialize($response);

$count=$phpobj[ResultSet][totalResultsReturned];

if($phpobj[ResultSet][totalResultsAvailable]==0)

{echo brNO RESULTS TO DISPLAY; }

echo tr; echo h4 style=\color:#FF\ align=\center\Results from
Mysite/h4;

for($i=0;$i$count;$i++)

{ echo 'pre';

$no=$i+1;

$url=$phpobj[ResultSet][Result][$i][Url];

echo h3 .$no. . a href=\$url\ .
$phpobj[ResultSet][Result][$i][Title] . /a/h3; echo /tr;

echo tr; echo $phpobj[ResultSet][Result][$i][Summary]; echo
/tr;

echo br; echo tr; echo b
.$phpobj[ResultSet][Result][$i][Url] ./b; echo /tr;

echo br; $link=$phpobj[ResultSet][Result][$i][DisplayUrl];

echo tr; echo a href=\$url\$link/a; echo /tr;

echo '/pre'; }}



whenever i try to execute this function i either get an Object not found
error or Access Forbidden error.

Can someone tell me where am i going wrong here??

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

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



RE: [PHP] pattern containing single quote in IF statement

2006-12-26 Thread Peter Lauri
Quote:

here is the code:
 if($_GET['query']==new)
 { filter($query);}
 elseif($_GET['query']==some'u'all)
 { filter($query);}
 elseif($_GET['query']==all'u'ppl)
 { filter($query);}


Did you forget about  around the strings?

/Peter

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - a way to reduce your carbon emissions and be a
helping hand in the struggle against global warming

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



RE: [PHP] calling a function in the same page

2006-12-25 Thread Peter Lauri
Hi,

Are you trying to use PHP as a client scripting language?

What you are doing cannot be done with plain PHP, you have to invoke
JavaScript or similar to make a HTTP request and then parse it.

Search Google for AJAX and you could get it working using that. Prototype
is a easy to use JS library that you can do AJAX requests with and then do
what you want with by DOM.

/Peter


-Original Message-
From: Jahangir [mailto:[EMAIL PROTECTED] 
Sent: Sunday, December 24, 2006 5:34 PM
To: php-general@lists.php.net
Subject: [PHP] calling a function in the same page

I am trying to call a function from a href inside the same page.
this is the code:
echo brbra href=\isearch($query)\More results from Mysite/a;
// calling the function isearch

function isearch($query)

{$query=urlencode($query);

$request='http://api.search.yahoo.com/WebSearchService/V1/webSearch?appid=Ja
hangirquery=' .urlencode($query). 'output=phpresults=100site=mysite.com;

$response=file_get_contents($request);

if ($response === false) {

die('Request failed');}

$phpobj=unserialize($response);

$count=$phpobj[ResultSet][totalResultsReturned];

if($phpobj[ResultSet][totalResultsAvailable]==0)

{echo brNO RESULTS TO DISPLAY; }

echo tr; echo h4 style=\color:#FF\ align=\center\Results from
Mysite/h4;

for($i=0;$i$count;$i++)

{ echo 'pre';

$no=$i+1;

$url=$phpobj[ResultSet][Result][$i][Url];

echo h3 .$no. . a href=\$url\ .
$phpobj[ResultSet][Result][$i][Title] . /a/h3; echo /tr;

echo tr; echo $phpobj[ResultSet][Result][$i][Summary]; echo
/tr;

echo br; echo tr; echo b
.$phpobj[ResultSet][Result][$i][Url] ./b; echo /tr;

echo br; $link=$phpobj[ResultSet][Result][$i][DisplayUrl];

echo tr; echo a href=\$url\$link/a; echo /tr;

echo '/pre'; }}



whenever i try to execute this function i either get an Object not found
error or Access Forbidden error.

Can someone tell me where am i going wrong here??

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] Cookies page refresh

2006-12-12 Thread Peter Lauri
Hi,

I think it says somewhere in the documentation that the cookie values will
not be available until next request/response...

/Peter


-Original Message-
From: William Stokes [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 12, 2006 5:28 PM
To: php-general@lists.php.net
Subject: [PHP] Cookies  page refresh

Hello,

I have a page that uses session cookies for deciding what content to show to

a visitor. User also has 2 form objecks to apply filters to the content SQL 
queries. So at the beginning of the script I set 2 cookies based on user 
selections(or defaults) and after that make DB query based on user 
selections. I wanted to use cookies because there also back - up - 
forward links for pagination.

Problem is that in order to get the cookie based system to work the page 
needs a refresh to read the cookies and display content corretly. Is this 
because the page loads faster than the server set's the cookies to client 
browser? If so what's the corrert / best way to implement the filters and 
page navigation if there's 2 form select lists and 3 links to navigate the 
page.

Thanks
-Will

-- 
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] preg_match to preg_replace

2006-12-11 Thread Peter Lauri
Hi guys,

I have a sample string [hp-ex][log]peter[hall o] that I need to process. I
need to remove the [] and separate the sections with a space. If there are
more then one [] part the first part should be bold (add b/b around it).
I have a solution that is working very well, but am thinking that I can do
this with preg_replace directly, what do you think? The final output is
always found in $thestr. Can all this be done with one preg_replace?

?php

echo pre;

$str = [hp-ex][log]peter[hall o];

preg_match_all(/\[(.+?)\]/, $str, $matches);

print_r($matches);

$m1 = $matches[0];
$m2 = $matches[1];

if(count($m1)1) {
$m2[0] = b$m2[0]/b;
$thestr = implode( , $m2);
} elseif(count($m1)==1) {
$thestr = $m2[0];
} else $thestr = ;

echo $thestr;

echo /pre;

?

Best regards,
Peter Lauri

www.dwsasia.com - company website
www.lauri.se - personal website

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



RE: [PHP] How to not be abused by mail form injectors?

2006-12-06 Thread Peter Lauri
Except the check for \n and \r? I mean any class that you think is good
doing this? Is PHP Mailer doing any check of its variables?

/Peter

-Original Message-
From: Peter Lauri [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 06, 2006 11:10 PM
To: php-general@lists.php.net
Subject: [PHP] How to not be abused by mail form injectors?

Hi,

 

Are there any general protection methods to minimize the risk of robots
using your mailing forms as spam senders?

 

/Peter

 

 

 

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



RE: [PHP] GD, and GD JPEG

2006-11-26 Thread Peter Lauri
I don't know what environment you are on, because I have been absent from
this list a long while. If you are on a Linux distribution you might be able
to do this via the command line:

yum install php-gd.i386

service httpd restart

That might install GD and then restart the web server.

/Peter



-Original Message-
From: sublimenal [mailto:[EMAIL PROTECTED] 
Sent: Sunday, November 26, 2006 6:31 AM
To: php-general@lists.php.net
Subject: Re: [PHP] GD, and GD JPEG


Hey you need to ./configure it into your php installation via the command
line

Jeff-153 wrote:
 
 
   Hi there.
 I installed a script but it requires GD and GD JPEG
 
 I downloaded GD, and GD JPEG
 
 But how the heck do I install it?
 
 Thanks guys
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

-- 
View this message in context:
http://www.nabble.com/GD%2C-and-GD-JPEG-tf2705080.html#a7543299
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] readfile() problem

2006-10-13 Thread Peter Lauri
Hi, I am trying to do this, but now I cannot set values with ini_set. I do
the following and it outputs could not set. I have also tried 0, 0, but
that doesn't help.

if(ini_set(output_buffering, off)) echo could set;
else echo could NOT set;

/Peter


-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 13, 2006 4:59 AM
To: Peter Lauri
Cc: php-general@lists.php.net
Subject: RE: [PHP] readfile() problem

On Thu, October 12, 2006 3:26 pm, Peter Lauri wrote:
 It did help, but not perfectly. Sometimes I have to refresh a few
 times
 before it will be pushed.

Is output_buffering defaulted to on?...

Cuz then you're putting a whole SECOND copy of the output into PHP's
output buffer.

That's bad. :-)

ini_set the buffering off in that script, or just turn it off
entirely, or...

Sorry I missed that bit.  I never turn ob on in php.ini, so never
think of it.

-- 
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] readfile() problem

2006-10-13 Thread Peter Lauri
You are correct. I might love you :)

-Original Message-
From: Robert Cummings [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 13, 2006 2:27 PM
To: Peter Lauri
Cc: [EMAIL PROTECTED]; php-general@lists.php.net
Subject: RE: [PHP] readfile() problem

On Fri, 2006-10-13 at 13:28 +0700, Peter Lauri wrote:
 Hi, I am trying to do this, but now I cannot set values with ini_set. I do
 the following and it outputs could not set. I have also tried 0, 0,
but
 that doesn't help.
 
 if(ini_set(output_buffering, off)) echo could set;
 else echo could NOT set;

I don't think you can set it at run-time, at least it wouldn't make
sense to me... looking at PHP it has the following semantic:

PHP_INI_PERDIR  

So you can't :) But the following might work without having to edit
a .htaccess:

?php

while( ob_get_level() )
{
ob_end_flush();
}

?

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] readfile() problem

2006-10-12 Thread Peter Lauri
Hi gang,

I have a problem. I am using readfile() to send files to the browser. The
code is below. I had is working on another server before, but now my client
have moved to a new server and we have started to experience problems with
bigger files.

I have three different files that I am sending. They are 3MB, 15MB and 59MB
large. The 3MB and 15MB are working fine, but the 59MB does not work. I have
checked so that the file_exist() and also was able to retrieve filesize() of
the file, so the file is there. I have also tried to download it with the
url I know it is located at, and that works too.

Is there any limitations or settings of how large the files can be when
using readfile()? If so, are they settable?

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=$Row[filename]);
header(Content-Transfer-Encoding: binary);
$filesize = filesize($filelocation);
header(Content-Length: $filesize); 
readfile($filelocation);

Best regards,
Peter Lauri

www.lauri.se - personal website
www.dwsasia.com - company website

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



RE: [PHP] PHP Mailer and SMTP = SPAM?

2006-10-12 Thread Peter Lauri
Thanks for your answer. I better think about this one more time, read some
more about it, and then execute :) I will let you know if it flops...

-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 12, 2006 11:24 PM
To: Peter Lauri
Cc: php-general@lists.php.net
Subject: RE: [PHP] PHP Mailer and SMTP = SPAM?

On Wed, October 11, 2006 11:28 pm, Peter Lauri wrote:
 [snip]
 Unless the email is coming from somebody the recipient knows/trusts,
 then you're going to get marked by them as a spammer -- which will
 report back to some of the lists marking you as a spammer.
 [/snip]

 But is it not a problem sending from the SMTP server thedomain.com
 using
 something else then the email [EMAIL PROTECTED] I am planning to
 send
 from an existing email from the domain.

Not really -- at least not in my limited experience.

There are so many OTHER factors that the DNS resolution of the return
address and the actual SMTP machine not matching up are probably not a
deciding factor...

I could be wrong on this -- I don't run SMTP servers, and *most* of my
email is coming out from the same server, but I also have a contact
them link, and it seems to work fine, and is most certainly not using
return addresses whose DNS matches the sending server.

 So even that I send from thedomain.com SMTP server I should to set the
 FROM
 and REPLY TO to the person who is referring? Our main idea was to send
 the
 email from the author of the book as it comes from him, but that is
 maybe
 not a great idea?

Send the email From:  the person who actually typed it.

Anything else is more likely to trip you up in some other way, I
should think.

 So I am in the middle of two suggestions:

 1. Make sure that the email is in the domain that you are sending from
 2. Make sure that the emails is from the referring persons email so it
 won't
 be marked as spam at their point.

In an ideal world, you have a limited number of authors, and you can
configure YOUR SMTP server as a relay for them, thus meeting both
conditions.

rasmus AT dwsasia.com would a valid email, forwarding to a known valid
email for Rasmus the PHP Pocket Guide author.

So, you get the best of all worlds -- Custom emails on your site with
the correct DNS resolution to match the sender, the author's name in
the email address, even using the First Last [EMAIL PROTECTED]
format.

This satisfies all the conditions, at the minimal expense of setting
up an email forward for each author/recipient.

If I had easy access to control email setup, I'd do that on my site,
but I don't, so I just send them out with the return address of
whomever sent them.

Course I also throttle it so it can only send 4 emails per day from
one IP, and have a few other measures in place to limit spam abuse.

NOTE:
If the authors aren't typing the actual email, you do NOT want to be
sending it from them without their prior explicit review and consent
of the outgoing email.  Authors in particular are very picky about
what words you put in their mouth. :-)

-- 
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



[PHP] Internet Explorer - and File Download dialog box

2006-10-12 Thread Peter Lauri
Hi,

 

Is there any way to set so that the IE File Download dialog box can
understand UTF-8? I have some Thai named files that just end up like
nonsense :-)

 

/Peter

 

www.lauri.se http://www.lauri.se/  - personal website

www.dwsasia.com http://www.dwsasia.com/  - company website



RE: [PHP] readfile() problem

2006-10-12 Thread Peter Lauri
Hi,

It did help, but not perfectly. Sometimes I have to refresh a few times
before it will be pushed.

Best regards,
Peter

-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 13, 2006 12:52 AM
To: Peter Lauri
Cc: php-general@lists.php.net
Subject: Re: [PHP] readfile() problem

On Thu, October 12, 2006 11:43 am, Peter Lauri wrote:
 I have a problem. I am using readfile() to send files to the browser.

 I have three different files that I am sending. They are 3MB, 15MB and
 59MB

 Is there any limitations or settings of how large the files can be
 when
 using readfile()? If so, are they settable?

readfile() will slurp the whole file into RAM, and then spit it out to
the browser.

It's super-convenient and easy for small files.

It's not a Good Idea for large files.

fopen/fread/echo loop is your buddy.

I'll bet a dollar that your old setting had a different memory_limit
in php.ini  -- or none at all, or it wasn't even compiled to allow
memory_limit -- something along those lines.

Actually, depending on the speed of the server, and its hard drives,
and the drive caches, etc, it's entirely possible that the server is
just taking TOO LONG to spit out that monster file.  wget would
probably let you find out pretty quickly if it's RAM or speed that's
killing you.  But it's kinda moot, really, as the solution either way
remains the same.

 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=$Row[filename]);
 header(Content-Transfer-Encoding: binary);

You got Content-type: right, but you know that filename thing is only
going to work on some browsers, right?
http://richardlynch.blogspot.com

Actually, I think -Type should be -type and it might be
case-sensitive, but I'd have to re-read HTTP specs to be 100% sure,
and I think all the browsers ignore case anyway, so it's kind of moot,
and I'm not THAT bored...


//readfile($filelocation);
$file = fopen($filelocation);
while (!feof($file)){
  //Last I heard, 2048 optimized some PHP internal buffer...
  //That's probably way out of date!
  //And does not account for your bandwidth bottle-neck anyway.
  //Play with the 2048 until you're happy.
  echo fread($file, 2048);
}

-- 
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] PHP Mailer and SMTP = SPAM?

2006-10-12 Thread Peter Lauri
Thanks, that was very clear :)

-Original Message-
From: Roman Neuhauser [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 13, 2006 6:32 AM
To: Richard Lynch
Cc: Peter Lauri; php-general@lists.php.net
Subject: Re: [PHP] PHP Mailer and SMTP = SPAM?

# [EMAIL PROTECTED] / 2006-10-12 11:23:52 -0500:
 On Wed, October 11, 2006 11:28 pm, Peter Lauri wrote:
  [snip]
  Unless the email is coming from somebody the recipient knows/trusts,
  then you're going to get marked by them as a spammer -- which will
  report back to some of the lists marking you as a spammer.
  [/snip]
 
  But is it not a problem sending from the SMTP server thedomain.com
  using something else then the email [EMAIL PROTECTED] I am
  planning to send from an existing email from the domain.
 
 Not really -- at least not in my limited experience.
 
 There are so many OTHER factors that the DNS resolution of the return
 address and the actual SMTP machine not matching up are probably not a
 deciding factor...

Sender, client.example.org, IP 1.2.3.4 connects to the receiver
(server.example.org).

1. DNS - PTR RR. If 4.3.2.1.in-addr.arpa doesn't exist (the value
   would be client.example.org), server refuses the connection
2. DNS - A RR. If client.example.org doesn't exist or doesn't
   resolve to 1.2.3.4, server refuses the connection
3. DNS - RBL. If 1.2.3.4 is in any of a number of possible
   RBLs, server refuses the connection
4. DNS - RHSBL. If example.org is in any of a number of possible
   RHSBLs, server refuses the connection 
 
If the client passed all checks, the server accepts the connection:

S: 220 server.example.org ESMTP
C: HELO client.example.org
S: 250 Ok

5. SMTP - If client doesn't say HELO with a FQDN argument, or
6. SMTP - If the HELO command argument doesn't resolve to the client
   IP address, the server responds with a 4xx or 5xx.

C: MAIL FROM: [EMAIL PROTECTED]

7. DNS - MX or A RR. If neither of these records exists for
   elsewhere.org, server replies with 5xx, permanent error.

S: 450 Greylisted
C: QUIT

server replied with a 4xx temporary error code, the client (rightly)
disconnected. server in turn tries to send a message back to
[EMAIL PROTECTED] to see if it accepts email:

E: 220 erwin.elsewhere.org ESMTP
S: HELO server.example.org
E: 250 Ok
S: MAIL FROM: 
E: 250 Ok
S: RCPT TO: [EMAIL PROTECTED]
E: 250 Ok
S: QUIT

The empty FROM address is the special null address used to send
bounce messages.

Should erwin reply with 5xx to any of the commands from server,
[EMAIL PROTECTED] will be stored in a nondeliverables database, and
when client returns it'll be rejected:

C: MAIL FROM: [EMAIL PROTECTED]
S: 550 Sender rejected

I'm sure I forgot something or screwed the description here and
there, but you get the idea.

-- 
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] PHP Mailer and SMTP = SPAM?

2006-10-11 Thread Peter Lauri
[snip]
Unless the email is coming from somebody the recipient knows/trusts,
then you're going to get marked by them as a spammer -- which will
report back to some of the lists marking you as a spammer.
[/snip]

But is it not a problem sending from the SMTP server thedomain.com using
something else then the email [EMAIL PROTECTED] I am planning to send
from an existing email from the domain.

So even that I send from thedomain.com SMTP server I should to set the FROM
and REPLY TO to the person who is referring? Our main idea was to send the
email from the author of the book as it comes from him, but that is maybe
not a great idea?

So I am in the middle of two suggestions:

1. Make sure that the email is in the domain that you are sending from
2. Make sure that the emails is from the referring persons email so it won't
be marked as spam at their point.

This is what I got from Rick. What are you thoughts on this?

[snip]
when you do a dns lookup (from a machine not on the same network) on the
ipnumber of the sending mail server does it show a name? if you do a forward
lookup on that name, does that resolve to the (same) ipnumber? 

the answer to the first part must be yes, and ideally the second will be
yes. if the first is no, then don't bother sending from that machine
until that issue has been dealt with. 

sending html substantially increases the probability that your messages will
be tagged as spam. certain things will increase that probability. 

your point 2. is mostly irrelevant. an smtp server simply needs to be
configured so it is not an open relay. that is generally the default
configuration (of any MTA that's worth using), and is achievable without
smtp auth.
[/snip]

Best regards,
Peter Lauri

www.lauri.se - personal website
www.dwsasia.com - company website

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



RE: [PHP] Seperate HTML from PHP

2006-10-10 Thread Peter Lauri
Have you tried Smarty (smarty.php.net)?

-Original Message-
From: Sancar Saran [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 10, 2006 3:43 PM
To: php-general@lists.php.net
Subject: [PHP] Seperate HTML from PHP

Hi there, following words are my ideas about that HTML PHP parting. I hope
you 
can understand my broken english and do not take personally.

SEPERATING html FROM php ARE USELESS

For years, some php users try to show php to look like other programming 
languages like C or JAVA. I believe they try to prove PHP can act like other

programming languages because most professionals from other disciplines 
thinks that thing PHP was so easy to write to someting and because of this 
that PHP thing can't be a professional tool.

To show professionalisim of php, people start to make programs using 3 tier 
programming aproach. Then that MAGIC WORD seperating business layer from 
presentation layer comes to php land...

After some time community sees templating engines, today you will see lots
of 
them oh sorry TONS of them...

I'm sorry guys, I admire your efforts, REALLY. 

Personally I spend more than 2 years to create some kind of OO library to 
making forms easly.  And after some time I realize, we cannot standardize 
HTML/Javascirpt, every new project we have to challange to new interface 
problems and because of this I have to redesign that templating library to 
not broke code integritiy. Of course I may use that common library's to
solve 
problems and of course later or sooner I find myself into a deep trouble. 
That new project can't fit that lib.

And of course that was not only problem about templating engines. 
They are slow, hell yes SLOW. (yea yea I know your uber template system 
blazingly faster than more popular ones). You have to open tons of mini tpl 
files, have to parse them, have to manage them.

So if that templating system generates this much of problem why we should
use 
them ? Just Because of our uber HTML designer can't understand php ?.

I'm sorry, things are changing, nearly all new project are contains dynamic 
parts. These visual designers have to learn some degree of php code.

And also I believe we have to change aproaching and usage of php language.

I see most people using php dynamic part of their html code. They using php 
like

a href=somepage.php?a=?php echo $foo; ??php echo $bar; ?/a

And I suggest we can aproaching html marking language to part of php 
presentation layer. 

Like

?php
...
generate $head
generate $header
generate $left
generate $content
generate $right
generate $footer
...
include('theme.inc.php')
print $strOutput;
?

theme.inc.php
?php

$strOutput=!DOCTYPE html PUBLIC \-//W3C//DTD XHTML 1.0 Transitional//EN\

\http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\;
html xmlns=\http://www.w3.org/1999/xhtml\; lang=\en\
head
.$head.
/head
body
div id='mainDiv' class='cMainDiv'
div id='headDiv' class='cHeadDiv'
.$header.
/div
div id='contDiv' class='cContDiv'
table border='0' cellpadding='0'
cellspacing='1' width='100%'
tr
td id='contLeftTD'
class='cContLeftTD' valign='top'
.$left.
/td
td id='contCentTD'
class='cContCentTD' valign='top'
.$content.
/td
td id='contRightTD'
class='cContRightTD' valign='top'
.$right.
/td
/tr
/table
/div
div id='footDiv' class='cFootDiv'
.$footer.
/div
/div
/body
/html;

?
Also we can use php to generate some kind of html code to reduce our
workload, 
I believe best aproach was, do not generate data and html code in same 
function...

Seperating html generation and data generation best way to increase code 
reuse.

For example

function makeSelects($arrData,$strRequest)
{
$intSize = sizeof($arrData);
for($intS=0;$intS$intSize;$intS++)
{
@$strReturn.=option value='.$arrData[$intS]['val'].';
if(@$strRequest == $arrData[$intS]['val']) { $strReturn.= 
selected; }
$strReturn.= .$arrData[$intS]['tex']./option\n;
}
return $strReturn;
}

with this function we can generate select options. 

$sqlGetType = 
SELECT typeId,typeName
  FROM listType
 WHERE 

[PHP] PHP Mailer and SMTP = SPAM?

2006-10-10 Thread Peter Lauri
Hi,

 

I am developing a tell-a-friend application for one of my customers. We
are going to have it all located on their server, and want to make sure we
take the right decisions on the road so that we don't spam mark our server
and don't end up in the SPAM inbox of the recipients. This is how I have
prepared it all:

 

1.  We have setup an email that do have an inbox and is REAL. We have an
mailbox connected to it and can send and read emails from it via webmail and
pop
2.  We have an SMTP server that requires authentication
3.  We are going to use PHP Mailer

 

Using PHP Mailer and the SMTP sending function should make the emails look
pretty real, am I right? On that we make sure that the HTML that we create
is good, check that with http://spamcheck.sitesell.com
http://spamcheck.sitesell.com/  or similar.

 

Shouldn't I be pretty good to go? We are not talking about millions of
emails per day here, maybe a few thousands. What are the risks of ending up
being a spam marked ip?

 

Best regards,

Peter Lauri

 

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

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

 

 

 



[PHP] $_SERVER['HTTP_REFERER']

2006-10-08 Thread Peter Lauri
Hi guys,

 

I am trying to track where the people entered a unique page from (developing
an affiliate system).

 

I have been using the $_SERVER['HTTP_REFERER'] to track this and record it
on a affiliate entrance of the web site. However, that is not tracking all
clicks. Only some of them have. I assume some of the links are not from a
traditional a/a link.

 

Is there any other way to do this?

 

Best regards,

Peter Lauri

 

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

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

 

 



[PHP] Template system

2006-10-05 Thread Peter Lauri
Hi group,

 

I was curious of your experience of Template systems/parsers.

 

For the moment I am using the one available on www.berrewaerts.net/dev.
However, sometimes it feels like the parsing takes to long.

 

I am looking for a fast template parser that supports nested blocks etc to
be able to build more complicated pages structures.

 

Best regards,

Peter Lauri

 

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

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

 

 



RE: [PHP] Template system

2006-10-05 Thread Peter Lauri
I haven't even read all replies, but the first one caught my love :-)

 

/Peter

 

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

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

 

  _  

From: Dave Goodchild [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 05, 2006 5:59 PM
To: Peter Lauri
Cc: PHP
Subject: Re: [PHP] Template system

 

Smarty? smarty.php.net












-- 
http://www.web-buddha.co.uk 



[PHP] WebMail client

2006-10-02 Thread Peter Lauri
Hi,

 

Do you have any suggestion on WebMail clients written in PHP that is good
and easy to install?

 

Horde IMP and SquirrelMail is two that I found. 

 

Are there any AJAX supporting client?

 

/Peter

 



RE: [PHP] a function for retuned vatiable

2006-10-02 Thread Peter Lauri
Not actually sure what you want, but this might do it :)

$j = 0;

While($Row = mysql_fetch_array($Result)) {
$email[$j] = $Row['email'];
...
...
$j++;
}

-Original Message-
From: Ross [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 02, 2006 7:09 PM
To: php-general@lists.php.net
Subject: [PHP] a function for retuned vatiable

What I need is a quick way to assign variable names to the same value of the

row name.

example..

$query= SELECT * from $table_name WHERE sname=='hulford';

  $result = mysql_query($query) or die('Error, query failed');
 while ($row=mysql_fetch_array($result)) {


$email = $row['email'];
$name=$row['name'];
$address = $row['address'];

//this goes on for 30 fields is there a way to automate this?


} 

-- 
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] Rapid application development

2006-09-29 Thread Peter Lauri
Why don't you reuse the basic code from your old projects? Then you don't
need to worry about this :) (OOP)

-Original Message-
From: Ahmad Al-Twaijiry [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 30, 2006 12:45 PM
To: PHP
Subject: [PHP] Rapid application development

Hi Everyone,

I need your feedback in this

What is the best RAD (Rapid application development) do you use for
PHP to develop an *advance* application in few days or weeks ?

I like programming but one this that I hate is the first stage of
programming when you start creating the basic code (db connection,
interface, insert,update,etc), this is why I'm looking for a good
RAD tool that can speed up my programming.



-- 

Ahmad Fahad AlTwaijiry

-- 
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] Convert UTF-8 to windows-874?

2006-09-28 Thread Peter Lauri
Hi group,

 

I am having a site all encoded in UTF-8, and it works fine. I use AJAX a lot
to send data back and forth to the server.

 

I have one service that requires that I send the data in windows-874
encoding (SMS gateway in Thailand). So is there anyway I can take the data
that is UTF-8 and then convert it to windows-874 and then send it to the SMS
gateway?

 

Best regards,

Peter Lauri

 

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

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



RE: [PHP] Convert UTF-8 to windows-874?

2006-09-28 Thread Peter Lauri
I think I am on the right track right now.

There is a function mb_convert_encoding() that could be used. However, I
have not found out how to code windows-874?

Warning: mb_convert_encoding(): Unknown encoding ISO-8859-11 in
D:\webserver\viphavadee\sms\classes\sms.class.php on line 17

Was one of my attempts...

Anyone with a hint of how to work out this problem?

/Peter


-Original Message-
From: Peter Lauri [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 28, 2006 5:10 PM
To: 'PHP General'
Subject: [PHP] Convert UTF-8 to windows-874?

Hi group,

 

I am having a site all encoded in UTF-8, and it works fine. I use AJAX a lot
to send data back and forth to the server.

 

I have one service that requires that I send the data in windows-874
encoding (SMS gateway in Thailand). So is there anyway I can take the data
that is UTF-8 and then convert it to windows-874 and then send it to the SMS
gateway?

 

Best regards,

Peter Lauri

 

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

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

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



  1   2   3   >