[PHP] regex for emoticon codes

2002-07-08 Thread Roger Thomas

i have something like 
$str = sometext sometext [emoticon01] sometext [emoticon23] sometext;

i would like to use regex to replace those codes into:
sometext sometext /images/emot/01.gif sometext /images/emot/23.gif sometext

all numerics after the code emoticon consisted of exactly 2 digits; and they
are in the range from emoticon01 to emoticon30.

i have spent the whole day starring at my crt and reading manpages plus
examples. i achieved nothing but sore eyes.

i would GREATLY-GREATLY appreciate if someone could gimme a code snippet on how
to this sorta thing.

best rgds.
roger



__
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

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




Re: [PHP] regex for emoticon codes

2002-07-08 Thread Roger Thomas

yeeaHAH ! great. Thanks John.
think i'll never regret joining the list.

--
roger


--- John Legg [EMAIL PROTECTED] wrote:
 Hi Roger
 
 Try this:
 
 $str = sometext sometext [emoticon01] sometext [emoticon23] sometext;
 
 $new_str = preg_replace(/\[emoticon(\d\d)\]/, /image/emot/\\1.gif,
 $str);
 
 print $new_str;
 
 Seems to work?
 
 Rgds
 
 John
 
 - Original Message -
 From: Roger Thomas [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, July 08, 2002 11:41 AM
 Subject: [PHP] regex for emoticon codes
 
 
  i have something like
  $str = sometext sometext [emoticon01] sometext [emoticon23] sometext;
 
  i would like to use regex to replace those codes into:
  sometext sometext /images/emot/01.gif sometext /images/emot/23.gif
 sometext
 
  all numerics after the code emoticon consisted of exactly 2 digits; and
 they
  are in the range from emoticon01 to emoticon30.
 
  i have spent the whole day starring at my crt and reading manpages plus
  examples. i achieved nothing but sore eyes.
 
  i would GREATLY-GREATLY appreciate if someone could gimme a code snippet
 on how
  to this sorta thing.
 
  best rgds.
  roger
 
 
 
  __
  Do You Yahoo!?
  Sign up for SBC Yahoo! Dial - First Month Free
  http://sbc.yahoo.com
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 


__
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

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




[PHP] caching dynamic thumbnail

2002-07-10 Thread Roger Thomas

just would like to confirm here whether thumbnail images that i generated
dynamically with gd is cached by browsers.

a) i have a html frontend to call the php script that does that thumbnail. this
html file, say, view.htm contains these lines:

html
img src=thumb.php?image=../images/001.jpgx=150resize=1
/html


b) the thumbnailing works perfectly. but is this thumbnail cached inside my
browser. how do i find this out ?

c) if the answer to question b) above is 'No', is it a good idea to generate
thumbnails dynamically but PHYSICALLY writing it to disk (with extra checking
of course; is the thumb previously was available, is it the desired size etc
etc)

please advise.

--
roger


__
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

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




Re: [PHP] New way to make select boxes auto select

2002-07-25 Thread Roger Thomas

i used the same techniqu a while back when i worked with Fast Template.
scenario:
- present a user with a form to input
- there are several text fields and several select options
- if there is/are error(s) upon form submission, we will call the same template
file and insert proper error messages at appropriate places, normally close to
the input field.
- we would also luv to make the select option field to DEFAULT to the PREVIOUS
value that WAS selected.

with the technique that Nathan describe below, you can do just that.

At present i have dropped this technique as I have switched to Smarty. Smarty
can do all this with its {html_optios blah blah blah}.

Recently I made frequent use of Webreference javascript to make select boxes
that are related to each other. ie changing(selecting) a left select box would
make a right select box change accordingly. I am trying to apply Smarty to this
but my javascript knowledge is too shallow. after submitting a form with
errors, the 2 select boxes will default back when the script starts. which is
NOT what i want. if nebody have done this, appreciate your help.

--
roger

--- Nathan Cook [EMAIL PROTECTED] wrote:
 You may already be doing it like this, but I think I found a new way to
 make select boxes auto-select (what data they put in) a lot easier. All you
 have to do is put a variable in each select tag that is equal to the value
 of the select option i.e.: option value=teacher $teacher -- then all you
 have to do is base the variable on that select name=interest $$interest =
 selected; quick and easy with out having to loop through an if elseif
 statement.  Let me know if you like that method or have any objections.
 
 Full example below.
 
 print(select name=interest\n);
 // creates a variable with a name based on
 // the value of interest with a value of selected
 $$interest = selected;
 print(option value=- Select One -/option\n);
 print(option value=teacher $teacherTeacher/option\n);
 print(option value=lego $legoLego Enthusiast/option\n);
 print(option value=student $studentStudent/option\n);
 print(option value=homeschool $homeschoolHomeschool Parent/option\n);
 print(option value=browsing $browsingBrowsing/option\n);
 print(option value=afterschool $afterschoolAfterschool/option\n);
 print(option value=bgca $bgcaBoys  Girls Club/option\n);
 print(option value=ymca $ymvaYMCA/option\n);
 print(/selectnbsp;nbsp;\n);
 
 [ Nathan Cook | [EMAIL PROTECTED] ]
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


__
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

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




[PHP] fruity arrays

2002-08-13 Thread Roger Thomas

i have these arrays:

$A_fruit_list = array('A1' = 'Fruit A1',
  'A2' = 'Fruit A2',
 );

$B_fruit_list = array('B1' = 'Fruit B1',
  'B2' = 'Fruit B2',
 );

then i do these:

$var = B;
$var_list = $var._fruit_list;

//Note: variable variable below
$fruit_array_of_choice = ${$var_list};
$FRUIT_code = array_keys($fruit_array),
$FRUIT_name = array_values($fruit_array),

which generates these warnings:
Warning: First argument to array_keys() should be an array in
/home/httpd/vhost/home/fruits.php on line 14

Warning: Argument to array_values() should be an array in
/home/httpd/vhost/home/ureg/fruits.php on line 15

how do i script around that ?

--
roger

__
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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




[PHP] no HTML in a form textarea field

2002-08-13 Thread Roger Thomas

i presented my visitor to fill up some description about themselves via HTML's
textarea FORM element.

how do i block them from entering unwanted HTML tags into the textarea field?

--
roger


__
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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




[PHP] howto disable cron output

2002-08-13 Thread Roger Thomas

i wrote an ecard script and added 'send at a future date' feature.
this feature is implemented via cron that runs daily at 1200 hours

$ crontab -l looks like:
00 00 * * * wget http://ecard.domain.com/futuresend.php 21 /dev/null

it works great but everyday there will be a file being written to my ecard
directory.

this file is named futuresend.php.1
the next day there will be another file called futuresend.php.2
so on and so forth.

how do i stop Solaris/Linux from spitting this file out ?

--
roger


__
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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




[PHP] ldap_rename refused to work

2002-08-14 Thread Roger Thomas

built: php-4.2.2 with openldap 2.0.25

i tried using the ldap_rename function to modify the dn of my ldap db but
nothing seems to happen. the record was not change at all. i have followed
closely the code-snippet that was given by Mr Stig Venaas at:
http://marc.theaimsgroup.com/?l=php-generalm=100949195224325w=2

following is my short code to do this:

?
//connect to LDAP
$ds=ldap_connect(192.168.10.222);
if (!$ds) {
 echo Connection to LDAP server failedbrbr;
 exit();
}

if (!ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) {
echo Failed to set protocol version;
exit;
}

//we bind to ldap server AFTER the ldap_set_option is successfull
//this is an authenticated bind
$r=ldap_bind($ds,cn=admin,o=Administrators,dc=mydomain,dc=net, secret);
if (!$r) {
 echo LDAP bind failedbrbr;
 exit();
}

// we want to transfer user roger from Civil Engineering to Credit section in
Finance
$r=ldap_rename($ds,
uid=roger,ou=People,ou=Civil,o=Engineering,dc=mydomain,dc=net,
uid=roger,ou=People,ou=Credit,o=Finance,dc=mydomain,dc=net,
dc=mydomain,dc=net,TRUE);


//Close the LDAP connection.
ldap_close($ds);

print modification done;
?

please advise.

--
roger


__
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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




Re: [PHP] ldap_rename refused to work

2002-08-14 Thread Roger Thomas


--- Stig Venaas [EMAIL PROTECTED] wrote:
 
 But you're not doing what I wrote...

:) or else i won't be asking hehehe 

 
 The third parameter should be the new rdn (which is the same as the old),
 and the fourth should be new parent. So it should look like this:
 
 $r=ldap_rename($ds,
   uid=roger,ou=People,ou=Civil,o=Engineering,dc=mydomain,dc=net,
   uid=roger,
   ou=People,ou=Credit,o=Finance,dc=mydomain,dc=net, TRUE);
 
 Stig

Great, it works. Stig, you saved my day. I owe you my eternal gratitude.

--
roger


__
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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




[PHP] Captcha wrapper

2002-08-15 Thread Roger Thomas

wonder if anyone has developed a wrapper around captcha.
or is there an alternative way ?

--
roger


__
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

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




[PHP] imap_gt_quota is not defined ?

2002-08-28 Thread Roger Thomas

php-4.2.2
Linux rh7.1

I run this on my browser
?
$mbox = imap_open({imap.domain.com},roger,roger123,OP_HALFOPEN)
  or die(can't connect: .imap_last_error());

$quota_value = imap_get_quota($mbox, user.roger);
if(is_array($quota_value)) {
print Usage level is:  . $quota_value['usage'];
print Limit level is:  . $quota_value['limit'];
}

imap_close($mbox);
?

... and I get:
Fatal error: Call to undefined function: imap_get_quota() in
/home/httpd/vhost/home/horde/q.php on line 5


I quickly look inside php-4.2.2/ext/imap/php_imap.c and can see that the
function name is there. What's wrong with *me* ?

--
roger


__
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

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




[PHP] cookies from cgi script

2002-09-25 Thread Roger Thomas

Dear all,
I have a cgi script that create cookie with the cookie path set to /cgi-bin/

How do I access the value of that cookie from a php-script ?
I have tried $_COOKIE[cookiename] but the value is blank. From my NS cookie
manager, I know that there is value associated with that cookie.

Please advise.

--
roger


__
Do you Yahoo!?
New DSL Internet Access from SBC  Yahoo!
http://sbc.yahoo.com

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




[PHP] What is you IP ?

2006-07-12 Thread Roger Thomas
I want to filter IP addresses. I noticed that my script catches IP addresses 
that looks like they came from the internal LAN, ie 192.x.x.x and 10.x.x.x

My script catched those IPs by $_SERVER['REMOTE_ADDR']. Am I not being able to 
catch IPs from transparent proxies that a user's ISP might use? Would 
$_SERVER['HTTP_X_FORWARDED_FOR'] be better ? Reasons ?

Please advise.

--
Roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

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



[PHP] LDAP function to add objectClass

2006-07-31 Thread Roger Thomas
I have an already working LDAP server. One of my user's ldif looks like:

...
...
sn: Roger Thomas
givenName: Roger Thomas
objectClass: top
objectClass: person
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: qmailUser
objectClass: hordePerson
o: example.com
ou: people
...
...

I have around 9000 user records. And I would like to add a new objectClass 
(radiusprofile) to each user record like:
 
...
...
objectClass: qmailUser
objectClass: hordePerson
objectClass: radiusprofile
...
...

Question: which LDAP function do I need to use to achive this ?


---
Sign Up for free Email at http://ureg.home.net.my/
---

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



[PHP] mime with php4.4.4 does not work anymore

2006-12-29 Thread Roger Thomas
I have been serving my community with Invision Power Board (IPB) v1.3.1 Final. 
Things are working well with PHP 4.3.8 and Apache 1.3.29.

Yesterday I just upgraded to PHP4.4.4 and I have problems with Excel and Word 
attachments with IPB. Whenever I click on those attachments, I will get all 
sorts of funny characters all over my browser screen. However, image 
attachments are correctly displayed inline.

I added --with-mime-magic=/usr/local/apache/conf/magic to configure but nothing 
change. If I were to roll back to PHP 4.3.8, IPB works perfectly.

What have I missed. Please advise. TIA.

--
roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

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



[PHP] per user per blog

2005-05-27 Thread Roger Thomas
Hi,
Am looking for opensource blogging engine that does per user per blog with PHP 
and mySQL and authenticates user thru LDAP.

Best rgds,
Roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

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



[PHP] running number

2005-07-25 Thread Roger Thomas
I am required to write a user registration script that captures the basics like 
name, phone number etc etc. I would also have to write to mySQL database a 
number that is associated with that user.

At this point of writing, the start of that number is unknown. But the number 
will be incremented by 1 after each successfull registration.

Let's say the number starts from 12345.

I am quite new at all these stuff and would like to seek your advise on the 
*recommended way* of achieving this. I am thinking along these lines:
a) store that number (12345) in a table
b) a user registers and assign that number to him
c) increment number to 12346
d) process repeats for the next registration

Concern: How do tell mySQL to lock the 'number' table when a new registration 
process is about to take place. Is locking the best option here or is/are there 
better ways?

Please advise.

--
Roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

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



Re: [PHP] running number

2005-07-25 Thread Roger Thomas
Thanks to all that have helped. I am inclined at Robert's suggestion below that 
would free me from worrying about locking issues. Thanks everybody.

--
Roger

Quoting Robert Sossomon [EMAIL PROTECTED]:

 CREATE TABLE `users` (
`num` int(10) NOT NULL auto_increment,
`name` varchar(100) NOT NULL default '',
`login` varchar(100) NOT NULL default '',
`password` varchar(20) NOT NULL default '',
PRIMARY KEY  (`num`),
KEY `num` (`num`)
 ) TYPE=MyISAM AUTO_INCREMENT=12345 ;
 
 That should help out.  When creating the table in mysql you can set the 
 auto_increment number on the last line, which when you add a new user the
 query 
 looks like:
 
 insert into users values('','name','login','pass');
 
 leaving the first field empty makes it automatically increase it.  The beauty
 is 
 that you can have 400 people registering at once, and their number
 gets 
 assigned as the query is run against the database, no matter what order they
 hit 
 it in, the system will take it as they come.
 
 HTH,
 Robert
 
 Roger Thomas is quoted as saying on 7/25/2005 5:21 AM:
  I am required to write a user registration script that captures the basics
 like name, phone number etc etc. I would also have to write to mySQL database
 a number that is associated with that user.
  
  At this point of writing, the start of that number is unknown. But the
 number will be incremented by 1 after each successfull registration.
  
  Let's say the number starts from 12345.
  
  I am quite new at all these stuff and would like to seek your advise on the
 *recommended way* of achieving this. I am thinking along these lines:
  a) store that number (12345) in a table
  b) a user registers and assign that number to him
  c) increment number to 12346
  d) process repeats for the next registration
  
  Concern: How do tell mySQL to lock the 'number' table when a new
 registration process is about to take place. Is locking the best option here
 or is/are there better ways?
  
  Please advise.
  
  --
  Roger
  
  
  ---
  Sign Up for free Email at http://ureg.home.net.my/
  ---
  
 
 -- 
 Robert Sossomon, Business and Technology Application Technician
 4-H Youth Development Department
 512 BrickHaven Drive Suite 220L, Campus Box 7606
 N.C. State University
 Raleigh NC 27695-7606
 Phone: 919/515-8474
 Fax:   919/515-7812
 [EMAIL PROTECTED]
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 





---
Sign Up for free Email at http://ureg.home.net.my/
---

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



RE: [PHP] Calendar program like on php.net

2005-07-31 Thread Roger Thomas
Quoting Jim Moseby [EMAIL PROTECTED]:

 I'd repost the link for you, but I've already deleted it.  Sorry. Look back 
 through the archives.
 
 JM
 

I searched for 'Jim Moseby calendar' in the general and Dev mailing list but no 
go. Anty clue?

--
Roger




---
Sign Up for free Email at http://ureg.home.net.my/
---

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



[PHP] Knowledge Management

2005-08-04 Thread Roger Thomas
I am trying to find a suitable opensource Knowledge Management System to be 
used in my organisation; at least with document management, project management 
group collaboration capabilities, like http://cortexpro.com/

Any clues ?

--
Roger 



---
Sign Up for free Email at http://ureg.home.net.my/
---

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



Re: [PHP] Knowledge Management

2005-08-04 Thread Roger Thomas
OK thanks Rory. I will certainly evaluate it.

--
Roger

Quoting Rory McKinley [EMAIL PROTECTED]:

 Roger Thomas wrote:
  I am trying to find a suitable opensource Knowledge Management System to be
 used in my organisation; at least with document management, project
 management group collaboration capabilities, like http://cortexpro.com/
  
  Any clues ?
  
 snip
 
 Hi Roger
 
 KnowledgeTree comes highly recommended - our company was reviewing it,
 but needed something that comes with project management stuff as well.
 Based on PHP  MySQL:
 
 http://sourceforge.net/projects/kt-dms/
 
 Rory
 
 
 
 





---
Sign Up for free Email at http://ureg.home.net.my/
---

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



[PHP] download snippet

2005-08-09 Thread Roger Thomas
Am looking for code snippet to download file. It should be able to detect 
mime-types. Thanks.

--
Roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

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



[PHP] run remote shell script

2005-08-17 Thread Roger Thomas
My PHP script is in svrA. How do I run a shell script in svrB?
svrB does not have PHP and Apache :(
Is this at all possible? Please advise.

--
Roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

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



Re: [PHP] Re: run remote shell script

2005-08-17 Thread Roger Thomas
OK. I am able to setup remote key authentication between svrA and svrB. From 
svrA I can login to svrB with something like
[EMAIL PROTECTED] www]$ ssh [EMAIL PROTECTED]

and I can also execute a shell script like
[EMAIL PROTECTED] www]$ ssh [EMAIL PROTECTED] /tmp/test.sh

On svrA I have a PHP script like so:
?
system('ssh [EMAIL PROTECTED] /tmp/test.sh someDIR');
?

/tmp/test.sh on svrB is only a one liner like so:
mkdir /tmp/$1

I ran the script from the browser but the /tmp/someDIR is not created :(
Could it be that user nobody on svrA is *not* allowed to connect to svrB 
because the public key belongs to user www ? How do I rectify this ?

In the actual situation, I need to execute a shell script in svrB (from browser 
served by Apache on svrA) that only root can run. Please advise. I am getting 
very worried.

--
Roger



Quoting Matthew Weier O'Phinney [EMAIL PROTECTED]:

 * Roger Thomas [EMAIL PROTECTED]:
  My PHP script is in svrA. How do I run a shell script in svrB?
  svrB does not have PHP and Apache :(
  Is this at all possible? Please advise.
 
 Use ssh. You will have to setup remote key authentication from svrA to
 svrB (so that a password will not be needed), and then in your script
 you would call:
 
 system('ssh svrB /path/to/scriptToRun');
 
 -- 
 Matthew Weier O'Phinney
 Zend Certified Engineer
 http://weierophinney.net/matthew/
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 





---
Sign Up for free Email at http://ureg.home.net.my/
---

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



Re: [PHP] Re: run remote shell script

2005-08-18 Thread Roger Thomas
Quoting Richard Lynch [EMAIL PROTECTED]:

 If 'www' can do it in a shell, then PHP, running as 'www' can usually do do it

www is a Limux system user on both svrA and svrB.
On svrA, Apache runs as user nobody. I mean, this is the httpd user, where we 
defined it in httpd.conf:
User nobody
Group nobody

My bad, I shud have use roger instead of www.

 //Do this:
 exec('ssh [EMAIL PROTECTED] /tmp/test.sh someDIR', $output, $error);
 if ($error) echo OS Error: $error\n;
 echo implode(\n, $output);

I got this: OS Error: 255


 This will tell you what error messages, if any, you are getting.
 
 Most likely what is happening is that the 'www' user in PHP does not
 have a true shell set up -- so 'www' has no home dir, so ssh does
 not find the keys you stuck in ~/.ssh/ so you need to do something
 like:
 
 exec('ssh -i /home/www/.ssh [EMAIL PROTECTED] /tmp/test.sh someDIR', $output,
 $error);

In my case, user nobody (that Apache runs as in svrA), does not have a true 
shell setup. How do I create a private/public key for user nobody when I can't 
even login as user nobody (as it does not have a true shell) ?

What's my option ?

 Though why you have a '[EMAIL PROTECTED]' user and then have '[EMAIL 
 PROTECTED]'
 running Apache/PHP is beyond my ken...

Sorry for the confusion.

 It's usually the PRIVATE key belonging to '[EMAIL PROTECTED]' that you would
 have sitting in the .ssh directory for '[EMAIL PROTECTED]' and then the PUBLIC
 half would be sitting in '[EMAIL PROTECTED]' .ssh directory.

Yes, I did that. I logged in as user www in svrA and executed ssh-keygen -t 
rsa. I then copied id_rsa.pub to svrB and called it 
/home/www/.ssh/authorized_keys. As noted, user www are system users in svrA and 
svrB.

 I'd be real worried about the script that only 'root' can run...
 
 Set up a new user on svrB that has permission to create the
 directories you need, and that's pretty much all that user can do.
 
 Using 'root' access is just too much power.

I mean, I want to execute a command in svrB where only root can do so. Like 
'shutdown' or something else.

Appreciate your advise. TIA

--
Roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

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



Re: [PHP] Re: run remote shell script

2005-08-18 Thread Roger Thomas
Thanks for your great explaination. I really appreciate that. I will try out 
the things that you have outlined and will be back if I land into trouble :)

--
Roger

Quoting Richard Lynch [EMAIL PROTECTED]:

 On Thu, August 18, 2005 12:22 am, Roger Thomas wrote:
  Quoting Richard Lynch [EMAIL PROTECTED]:
 
  If 'www' can do it in a shell, then PHP, running as 'www' can
  usually do do it
 
  www is a Limux system user on both svrA and svrB.
  On svrA, Apache runs as user nobody. I mean, this is the httpd user,
  where we defined it in httpd.conf:
  User nobody
  Group nobody
 
  My bad, I shud have use roger instead of www.
 
 Is 'www' a real user on either server?
 
 What is that user allowed to do?
 
 Does that user exist for the express purpose of doing things related
 to the web-server, and nothing else?
 
 If so, the easiest solution might be to change httpd.conf to have:
 User www
 
 It gives Apache/PHP a little more power ; which increases risk a bit
 
 But if 'www' ONLY has permissions to do the kinds of things you want
 to allow Apache/PHP to do, then that's okay.
 
 If 'www' has lots and lots of permisions to do all sorts of things,
 then it is a Bad Idea to do httpd.conf: User www
 
  This will tell you what error messages, if any, you are getting.
 
 Damn!
 
 Error 255 is not particularly enlightening, at least to me -- But I
 think it indicates a problem before PHP even manages to FIND the ssh
 command, not one actually trying to run it.
 
 Somebody who knows OS error codes better than me could maybe clarify
 this a bit.
 
  Most likely what is happening is that the 'www' user in PHP does not
  have a true shell set up -- so 'www' has no home dir, so ssh does
  not find the keys you stuck in ~/.ssh/ so you need to do something
  like:
 
  exec('ssh -i /home/www/.ssh [EMAIL PROTECTED] /tmp/test.sh someDIR', 
  $output,
  $error);
 
  In my case, user nobody (that Apache runs as in svrA), does not have a
  true shell setup. How do I create a private/public key for user nobody
  when I can't even login as user nobody (as it does not have a true
  shell) ?
 
 You *might* be able to use the -i /home/www/.ssh part, so long as
 the nobody user can *READ* www's key files...
 
 Though that may not be desirable.
 
 In detail, you *COULD* create a group called 'www_nobody' and add both
 'www' and 'nobody' to it, and then you *COULD* chgrp 'www_nobody'
 /home/www/.ssh/ (and/or some files within that) and THEN I think the
 exec() would work with the -i /home/www/.ssh because now nobody is
 using wwws keyring to get into whatever www can get into.
 
 Though, at that point, maybe just changing httpd.conf to User www is
 looking more attractive.
 
 You should first try something more simple like:
 exec(ls, $output, $error);
 if ($error) echo OS Error: $error\n;
 echo implode(\n, $output);
 
 just to be certain the nobody user can do *anything* with exec()
 
 It *MAY* be a requirement that nobody has some kind of shell access
 for exec() to work...  I don't know for sure about that.
 
 But this quick test without the vagaries of ssh and keys and
 permissions involved will sort of work towards your goal from the
 other end -- getting PHP to execute *something* in the shell, and
 knowing that that something is so damn simple that it HAS to work. :-)
 
 If the Apacher user *HAS* to have a valid shell to use exec() then
 you're kinda stuck with User www, or some other user like 'www-run'
 which I sometimes see...  Possibly because for the same reasons that
 you have a 'www' user already and don't want to use that for
 httpd.conf User.
 
 You may also want to use things like /usr/bin/ls and
 /usr/local/bin/ssh or whatever they are on your box.  Better to use a
 full path and be sure you are not subject to the whims of the shell
 and some $PATH environment variable that root might change out from
 under you some day by messing with /etc/passwd in a security audit.
 
  What's my option ?
 
 Short version:
 
 Make sure PHP can do something useful with exec() like ls
 Make sure PHP can *read* the keys it needs to get into srvB
 Use full path to ssh and use -i /home/www/.ssh so PHP knows it's
 supposed to get the keys from there.
 
  Though why you have a '[EMAIL PROTECTED]' user and then have '[EMAIL 
  PROTECTED]'
  running Apache/PHP is beyond my ken...
 
  Sorry for the confusion.
 
 'Sokay.
 
 Just wondering WHY you have a user named 'www' if it's NOT to run
 Apache...
 
 It's pretty common to have a user 'www' (or similar) running Apache
 just so you can keep the web stuff out of the hands of nobody (IE,
 everybody) and have a username everybody recognizes as the user that
 runs Apache
 
 But then I've seen those boxes where it's 'www-run' or 'apache' or
 other more interesting usernames running Apache/PHP, so it's not
 really written in stone.
 
  It's usually the PRIVATE key belonging to '[EMAIL PROTECTED]' that you 
  would
  have sitting in the .ssh directory for '[EMAIL PROTECTED]' and then the
  PUBLIC

Re: [PHP] Re: run remote shell script

2005-08-18 Thread Roger Thomas
Thanks Matthew. You and Richard have been very helpful. I should be able to 
carry on. Thank you again.

--
Roger

Quoting Matthew Weier O'Phinney [EMAIL PROTECTED]:

 First off, Roger, Thomas, not sure which is your given name --
 please
 use a mail or news agent that will wrap your lines with linebreaks at
 72
 characters. Some of us are on text-based clients, and it's difficult
 to
 read your posts when they extend beyond the screen boundaries... ;-)
 
 * Roger Thomas [EMAIL PROTECTED] :
  OK. I am able to setup remote key authentication between svrA and
  svrB. From svrA I can login to svrB with something like
  [EMAIL PROTECTED] www]$ ssh [EMAIL PROTECTED]
 
  and I can also execute a shell script like
  [EMAIL PROTECTED] www]$ ssh [EMAIL PROTECTED] /tmp/test.sh
 
  On svrA I have a PHP script like so:
  ?
  system('ssh [EMAIL PROTECTED] /tmp/test.sh someDIR');
  ?
 
  /tmp/test.sh on svrB is only a one liner like so:
  mkdir /tmp/$1
 
  I ran the script from the browser but the /tmp/someDIR is not
 created :(
  Could it be that user nobody on svrA is *not* allowed to connect
 to
  svrB because the public key belongs to user www ? How do I rectify
  this ?
 
  In the actual situation, I need to execute a shell script in svrB
  (from browser served by Apache on svrA) that only root can run.
 Please
  advise. I am getting very worried.
 
 Okay, I should have been a little more explicit. 
 
 There are two ways I've done this. The initial details are
 different,
 but the final call is pretty much the same. 
 
 1. Using sudo
'sudo' allows users to run commands as different users. In this
 case,
we want the user running the web server (usually www, apache, or
nobody) to run ssh, or a script that executes the ssh command, as
 a
normal user. I usually opt for the latter, and create a script
 such
as:
 
#!/bin/bash
exec ssh [EMAIL PROTECTED] /path/to/remote/script
 
and save it in /usr/local/bin. Then, edit sudoers (usually
 executing
'visudo' as root), and add a line like
 
nobody ALL = (username) NOPASSWD: /usr/local/bin/SCRIPTNAME
 
What this does is to allow the user 'nobody' (or whomever runs
 the
web server process) to execute /usr/local/bin/SCRIPTNAME as
'username', and they do not need to enter a password to do so
(normally with sudo you do).
 
You'll need to restart the webserver after granting the sudo
privileges.
 
In this scenario, the normal user, specified by 'username' above,
needs to have the the SSH keys setup between the servers.
 
 2. Give the web user a home directory
The other option is to setup a home directory for the web user.
 This
will mean editing the /etc/passwd file to give the web user both
 a
home directory and a shell; these are teh last two items in the
 colon
delimited list. A sample entry might look like:
 
nobody:x:65534:65534:nobody:/var/www:/bin/bash

Once you've done this, restart the web server. At this point,
 you'll
then need to become the web user briefly in order to:
 
   * generate an SSH key
   * send the key to the remote server
 
Then, on the remote server, add the SSH key to the appropriate
 user
on that system.
 
 Good luck!
 
  Quoting Matthew Weier O'Phinney [EMAIL PROTECTED] :
 
   * Roger Thomas [EMAIL PROTECTED] :
My PHP script is in svrA. How do I run a shell script in svrB?
svrB does not have PHP and Apache :(
Is this at all possible? Please advise.
   
   Use ssh. You will have to setup remote key authentication from
 svrA to
   svrB (so that a password will not be needed), and then in your
 script
   you would call:
   
   system('ssh svrB /path/to/scriptToRun');
 
 -- 
 Matthew Weier O'Phinney
 Zend Certified Engineer
 http://weierophinney.net/matthew/
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 





---
Sign Up for free Email at http://ureg.home.net.my/
---

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



[PHP] Looking for PHP SSO-engine

2006-03-13 Thread Roger Thomas
Are there are PHP projects that focuses on Single Signon/Signoff like 
Pubcookie, CAS, Cosign etc? Please advise. TIA.

--roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

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



[PHP] Send postcard link

2005-10-09 Thread Roger Thomas
On server-1 I have my photogallery working. On another box, server-2, I have my 
postcard script also working great. Users can send postcards using ready 
inhouse designs or upload their own (max 100K). Both have been serving our 
community for the past  2 years or so.

Current requirement:

When I browsed my photogallery, I would like to have a button that says 'Send 
this picture as postcard'. Behind the scenes, how do I send that picture to 
server-2 postcard script?

Please advise.

--
Roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

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



[PHP] Where is Zend

2006-02-12 Thread Roger Thomas
I have had difficulty going to zend.com to download Zend Optimizer for 
php-4.4.2 since last week. Anybody that have a copy of Zend Optimizer, I would 
appreciate if you could provide me with a link to your server that I can 
download a copy. TIA.


--roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

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



Re: [PHP] Where is Zend

2006-02-12 Thread Roger Thomas
Quoting Chris [EMAIL PROTECTED]:

 Roger Thomas wrote:
  I have had difficulty going to zend.com to download Zend Optimizer
 for php-4.4.2 since last week.
 
 Have you contacted zend and told them you were having a problem ?
 
 I'm sure they have an easy to fill in contact form on their site.
 

I can't even access the site.

--roger



---
Sign Up for free Email at http://ureg.home.net.my/
---

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



[PHP] HN CAPTCHA at http://www.phpclasses.org

2006-02-15 Thread Roger Thomas
I am currently testing HN CAPTCHA and noticed that the range of alphabets that 
were produced ranges from A..F only. My PHP skill is quite limited to change 
that to A..Z so if ppl here have any experience with that class, appreciate 
your thoughts. TIA.

HN CAPTCHA: http://www.phpclasses.org/browse/package/1569.html

--roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

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



Re: [PHP] HN CAPTCHA at http://www.phpclasses.org

2006-02-15 Thread Roger Thomas
Quoting J_K9 [EMAIL PROTECTED]:


 How about sending us the code so that we can have a look? If not we
 have 
 to register there...
 
 Cheers,
 
 J_K9
 

OK. Attached.


--roger


---
Sign Up for free Email at http://ureg.home.net.my/
---


hn_captcha-2004-04-20.tar.gz
Description: GNU Zip compressed data
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] HN CAPTCHA at http://www.phpclasses.org

2006-02-15 Thread Roger Thomas
Quoting Curt Zirzow [EMAIL PROTECTED]:

 On Thu, Feb 16, 2006 at 09:44:33AM +0800, Roger Thomas wrote:
  I am currently testing HN CAPTCHA and noticed that the range of
 alphabets that were produced ranges from A..F only. My PHP skill is
 quite limited to change that to A..Z so if ppl here have any
 experience with that class, appreciate your thoughts. TIA.
  
  HN CAPTCHA: http://www.phpclasses.org/browse/package/1569.html
 
 I'd say contact the author about this.
  
 Curt.

I did. Waited for a week. No response. Hence this list :(

--roger




---
Sign Up for free Email at http://ureg.home.net.my/
---

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



Re: [PHP] HN CAPTCHA at http://www.phpclasses.org

2006-02-15 Thread Roger Thomas
Quoting Kim Christensen [EMAIL PROTECTED]:


 To solve your problem, replace the generate_private() function in
 hn_captcha.class.php - starting at row 756 - with this code:
 
function generate_private($public=)
{
   $letters = 1234567890abcdefghijklmnopqrstuvwxyz;
   $maxsize = strlen($letters)-1;
   for($i=0;$i6;$i++){
 $rstring .= $letters{mt_rand(0, $maxsize)};
   }
   return $rstring;
}
 
 This should yield a 6 char random string containing digits 0-9 and
 letters a-z.
 
 Good luck!
 
 --
 Kim Christensen
 [EMAIL PROTECTED]
 


Thank you Kim.

--roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

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



[PHP] URL restriction on XML file

2005-03-29 Thread Roger Thomas
I have a short script to parse my XML file. The parsing produces no error and 
all output looks good EXCEPT url-links were truncated IF it contain the 'amp;' 
characters.

My XML file looks like this:
--- start of XML ---
?xml version=1.0 encoding=iso-8859-1?
rss version=2.0
channel
titleTest News .Net - Newspapers on the Net/title
copyrightSmall News Network.com/copyright
linkhttp://www.example.com//link
descriptionContinuously updating Example News./description
languageen-us/language
pubDateTue, 29 Mar 2005 18:01:01 -0600/pubDate
lastBuildDateTue, 29 Mar 2005 18:01:01 -0600/lastBuildDate
ttl30/ttl
item
titleGroup buys SunGard for US$10.4bil/title
linkhttp://feeds.example.com/?rid=318045f7e13e0b66amp;cat=48cba686fe041718amp;f=1/link
descriptionNEW YORK: A group of seven private equity investment firms agreed 
yesterday to buy financial technology company SunGard Data Systems Inc in a 
deal worth US$10.4bil plus debt, making it the biggest lev.../description
source url=http://biz.theexample.com/;The Paper/source
/item
item
titleStrong quake hits Indonesia coast/title
linkhttp://feeds.example.com/news/world/quake.html/link
descriptiona quot;widely destructive tsunamiquot; and the quake was felt as 
far away as Malaysia./description
source url=http://biz.theexample.com.net/;The Paper/source
/item
item
titleFinal News/title
linkhttp://feeds.example.com/?id=abcdefamp;cat=somecat/link
descriptionWe are going to expect something new this weekend .../description
source url=http://biz.theexample.com/;The Paper/source
/item
/channel
/rss
--- end of XML ---

For the sake of testing, my script only print out the url-link to those news 
above. I got these:
f=1
http://feeds.example.com/news/world/quake.html
cat=somecat

The output for line 1 is truncated to 'f=1' and the output of line 3 is 
truncated to 'cat=somecat'. ie, the script only took the last parameter of the 
url-link. The output for line 2 is correct since it has NO parameters.

I am not sure what I have done wrong in my script. Is it bcos the RSS spec says 
that you cannot have parameters in URL ? Please advise.

-- start of script --
?
$file = test.xml;
$currentTag = ;

function startElement($parser, $name, $attrs) {
global $currentTag;
$currentTag = $name;
}

function endElement($parser, $name) {
global $currentTag, $TITLE, $URL, $start;

switch ($currentTag) {
case ITEM:
$start = 0;
case LINK:
 if ($start == 1)
 #print A HREF = \.$URL.\$TITLE/ABR;
 print $URL.BR;
 break;
}
   $currentTag = ;
}

function characterData($parser, $data) {
global $currentTag, $TITLE, $URL, $start;

switch ($currentTag) {
case ITEM:
$start = 1;
case TITLE:
   $TITLE = $data;
   break;
case LINK:
$URL = $data;
break;
}
}

$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, startElement, endElement);
xml_set_character_data_handler($xml_parser, characterData);

if (!($fp = fopen($file, r))) {
die(Cannot locate XML data file: $file);
}

while ($data = fread($fp, 4096)) {
if (!xml_parse($xml_parser, $data, feof($fp))) {
die(sprintf(XML error: %s at line %d,
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
}

xml_parser_free($xml_parser);

?
-- end of script --

TIA.
Roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

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



Re: [PHP] URL restriction on XML file

2005-03-30 Thread Roger Thomas
Hi Marek,
Thank you for the solution.

--
Roger

Quoting Marek Kilimajer [EMAIL PROTECTED]:

 That's because the character data is split on the borders of the 
 entities, so for
 
 http://feeds.example.com/?rid=318045f7e13e0b66amp;cat=48cba686fe041718amp;f=1
 
 characterData() will be called 5 times:
 
 http://feeds.example.com/?rid=318045f7e13e0b66
 
 cat=48cba686fe041718
 
 f=1
 
 Solution is inlined below
 
 Roger Thomas wrote:
  I have a short script to parse my XML file. The parsing produces no error
 and all output looks good EXCEPT url-links were truncated IF it contain the
 'amp;' characters.
  
  My XML file looks like this:
  --- start of XML ---
  ?xml version=1.0 encoding=iso-8859-1?
  rss version=2.0
  channel
  titleTest News .Net - Newspapers on the Net/title
  copyrightSmall News Network.com/copyright
  linkhttp://www.example.com//link
  descriptionContinuously updating Example News./description
  languageen-us/language
  pubDateTue, 29 Mar 2005 18:01:01 -0600/pubDate
  lastBuildDateTue, 29 Mar 2005 18:01:01 -0600/lastBuildDate
  ttl30/ttl
  item
  titleGroup buys SunGard for US$10.4bil/title
 
 linkhttp://feeds.example.com/?rid=318045f7e13e0b66amp;cat=48cba686fe041718amp;f=1/link
  descriptionNEW YORK: A group of seven private equity investment firms
 agreed yesterday to buy financial technology company SunGard Data Systems Inc
 in a deal worth US$10.4bil plus debt, making it the biggest
 lev.../description
  source url=http://biz.theexample.com/;The Paper/source
  /item
  item
  titleStrong quake hits Indonesia coast/title
  linkhttp://feeds.example.com/news/world/quake.html/link
  descriptiona quot;widely destructive tsunamiquot; and the quake was
 felt as far away as Malaysia./description
  source url=http://biz.theexample.com.net/;The Paper/source
  /item
  item
  titleFinal News/title
  linkhttp://feeds.example.com/?id=abcdefamp;cat=somecat/link
  descriptionWe are going to expect something new this weekend
 .../description
  source url=http://biz.theexample.com/;The Paper/source
  /item
  /channel
  /rss
  --- end of XML ---
  
  For the sake of testing, my script only print out the url-link to those
 news above. I got these:
  f=1
  http://feeds.example.com/news/world/quake.html
  cat=somecat
  
  The output for line 1 is truncated to 'f=1' and the output of line 3 is
 truncated to 'cat=somecat'. ie, the script only took the last parameter of
 the url-link. The output for line 2 is correct since it has NO parameters.
  
  I am not sure what I have done wrong in my script. Is it bcos the RSS spec
 says that you cannot have parameters in URL ? Please advise.
  
  -- start of script --
  ?
  $file = test.xml;
  $currentTag = ;
  
  function startElement($parser, $name, $attrs) {
  global $currentTag;
  $currentTag = $name;
  }
  
  function endElement($parser, $name) {
  global $currentTag, $TITLE, $URL, $start;
  
  switch ($currentTag) {
  case ITEM:
  $start = 0;
  case LINK:
   if ($start == 1)
   #print A HREF = \.$URL.\$TITLE/ABR;
   print $URL.BR;
   break;
  }
 $currentTag = ;
 
 // Reset also other variables:
 $URL = '';
 $TITLE = '';
 
  }
  
  function characterData($parser, $data) {
  global $currentTag, $TITLE, $URL, $start;
  
  switch ($currentTag) {
  case ITEM:
  $start = 1;
  case TITLE:
 $TITLE = $data;
 
 // append instead:
 $TITLE .= $data;
 
 break;
  case LINK:
  $URL = $data;
 
 // append instead:
 $URL .= $data;
 
 // Warning: entities are decoded at this point, you will receive , not 
 amp;
 
  break;
  }
  }
  
  $xml_parser = xml_parser_create();
  xml_set_element_handler($xml_parser, startElement, endElement);
  xml_set_character_data_handler($xml_parser, characterData);
  
  if (!($fp = fopen($file, r))) {
  die(Cannot locate XML data file: $file);
  }
  
  while ($data = fread($fp, 4096)) {
  if (!xml_parse($xml_parser, $data, feof($fp))) {
  die(sprintf(XML error: %s at line %d,
  xml_error_string(xml_get_error_code($xml_parser)),
  xml_get_current_line_number($xml_parser)));
  }
  }
  
  xml_parser_free($xml_parser);
  
  ?
  -- end of script --
  
  TIA.
  Roger
  
  
  ---
  Sign Up for free Email at http://ureg.home.net.my/
  ---
  
 
 





---
Sign Up for free Email at http://ureg.home.net.my/
---

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


[PHP] imap_set_quota function

2002-12-29 Thread Roger Thomas
an excerpt from php man pages says that:

This function requires the imap_stream to have been opened as the mail
administrator account. It will not work if opened as any other user.
...
...
$mbox = imap_open ({your.imap.host:143}, mailadmin, password);



my question is, where do i set this admin called 'mailadmin' with password
'password'. do i set it in courier/uw for example? 

--




__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




[PHP] 2 servers for mail implementation

2003-01-02 Thread Roger Thomas
dear all,
i have 2 servers that were *given* to me to setup and implement webmail
solution for our client. i have done some groundwork in terms of the backend
applications that are needed to do this.

what i wanted to know is, how best can i distribute the backend applications
between those 2 servers to achieve a balance and fast response. can i go like
this:

server A

ldap
courier-imap

server B

apache
php
qmail


for mysql, i have an existing server that i will use for database queries.
appreciate your kind advice.


best rgds.
roger


__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




[PHP] imap quota

2003-01-13 Thread Roger Thomas
i am referring to imap_get_quota manpages at
http://www.php.net/manual/en/function.imap-get-quota.php

it gave a short script (see bottom).
question: in a qmail-ldap/courier-imap environment, who is that mailadmin ? 


-- script start --
$mbox = imap_open({your.imap.host},mailadmin,password,OP_HALFOPEN)
  or die(can't connect: .imap_last_error());
   
$quota_values = imap_get_quota($mbox, user.kalowsky);
if(is_array($quota_values)) {
   $storage = $quota_values['STORAGE'];
   print STORAGE usage level is:  .  $storage['usage'];
   print STORAGE limit level is:  .  $storage['limit'];

   $message = $quota_values['MESSAGE']; 
   print MESSAGE usage level is:  .  $message['usage'];
   print MESSAGE usage level is:  .  $message['limit'];

   /* ...  */ 
} 

imap_close($mbox);

-- script endz --


--
roger

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




[PHP] --with-mcal=/usr/local/mcal compilation issue

2003-01-16 Thread Roger Thomas
php-4.3
libmcal-0.5 (i intend to use Horde's Kronolith and the README said it cannot
work with libmcal-0.6)

configure gave this error:
checking for MCAL support... yes
configure: error: Unable to locate your libmcal header files - cal_misc.h
should be in the directory you specify or in the include/ subdirectory below it
- default search location is /usr/local

please advise.


__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




[PHP] LDAP next prev howto

2003-02-18 Thread Roger Thomas
is it possible to retrieve a bunch of records from an ldap tree and do a
next-prev navigation on those records ? example script pls.

--


__
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

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




[PHP] LDAP next prev howto

2003-02-20 Thread Roger Thomas
is it possible to retrieve a bunch of records from an ldap tree and do a
next-prev navigation on those records ? example script pls.

--
roger



__
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

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




[PHP] imap_get_quota

2003-03-13 Thread Roger Thomas
on the php.net manpage for imap_get_quota,
http://www.php.net/manual/en/function.imap-get-quota.php , the imap stream is
opened as:
$mbox = imap_open({your.imap.host},mailadmin,password,OP_HALFOPEN)
  or die(can't connect: .imap_last_error());

i am really confused as to how to setup the mailadmin account.
i am running php-4.3, courier-imap and qmail-ldap

appreciate any help.

--
roger


__
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com

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



[PHP] overriding upload_tmp_dir

2003-03-24 Thread Roger Thomas
for an application, i would like to have the temporary upload file directory
under the webroot of this application.

how can i override the php.ini directive of upload_tmp_dir ?

--
roger


__
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

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



RE: [PHP] html form array

2002-10-13 Thread Roger Thomas

try this (noticed that I've changed $foo to $_POST[foo]. after all we're
livin in globals off rite? )

?
if ($_POST[submit]) {
print submittedBR;
for($i=0;$isizeof($_POST[foo]);$i++) {
print $_POST[foo][$i].BR;
}
}
else {
?
form action=? echo $_SERVER[PHP_SELF] ? method=post
  input type=checkbox name=foo[] value=oneOne
  input type=checkbox name=foo[] value=twoTwo
  input type=checkbox name=foo[] value=threeThree
  input type=submit value=submit name=submit
/form
?
}
?

--
roger


--- John W. Holmes [EMAIL PROTECTED] wrote:
  dear all,
  i ran my code below on ie and it works. but when i use netscape 4.76
 under
  linux, i only get the
  message submitted even though i've checked some fields.
 
 The code is running on the same box, right? Just accessing it with
 different browsers?
  
  what do i need to add to make it work with netscape under linux?
  code follows:
  
  ?
  if ($_POST[submit]) {
  print submittedBR;
  for($i=0;$isizeof($foo);$i++) {
  print $foo[$i]BR;
  }
  }
  else {
  ?
  form action=? echo $_SERVER[PHP_SELF] ? method=post
input type=checkbox name=foo[] value=oneOne
input type=checkbox name=foo[] value=twoTwo
input type=checkbox name=foo[] value=threeThree
input type=submit value=submit name=submit
  /form
 
 Try putting quotes () around your types, names, and values in your
 input elements. Netscape may not recognize foo[] as a proper name
 without the quotes and send the data incorrectly.
 
 ---John Holmes...
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


__
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos  More
http://faith.yahoo.com

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




Re: [PHP] Re: Mass Mailing Using PHP

2004-09-27 Thread Roger Thomas
Quoting Manuel Lemos [EMAIL PROTECTED]:

 Just let me know which OS and local mailer (Sendmail, qmail, postfix, 
 exim, MS IIS, Exchange, etc..) do you use so I can advise.

What do you recommend for Linux and qmail combination ?
Please advise.


--
roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

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



Re: [PHP] Re: Mass Mailing Using PHP

2004-09-28 Thread Roger Thomas
Quoting Manuel Lemos [EMAIL PROTECTED]:

 You may just need to tune qmail to maximize the number of simultaneous deliveries 
 according to the available bandwidth.

How do I tune qmail in that manner ? If the answer is too long and complicated, pls 
flame me softly as this is already OT.
 
 For this reason, during deliveries of messages to many recipients, it is better to 
 pause once in a while to let the queue be fully processed and do not stall other 
 programs.

Do you mean, say we fetched 100,000 addresses from database, we make our script sleep 
for a while after sending, say 1000 mails ?

--
roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

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



[PHP] getting rid of NOTICE

2004-10-07 Thread Roger Thomas
I have this short script (below) that does checking whether a userid has an associated 
jpegPhoto in an LDAP database. The script is working fine but gave a 'Notice' msg bcos 
I made error_reporting to report all errors.

Notice: Undefined index: jpegphoto in test.php on line 34

Question: How do I make the Notice go away without changing error reporting to 
error_reporting (E_ALL  ~E_NOTICE) ?

Please advise.

--
roger

?
require_once config.inc;
error_reporting (E_ALL);

$ds = @connectBindServer(LDAP_RDN, LDAP_PASS);
if ($ds) {
$what2return   = array(givenName,sn,jpegPhoto);
$searchFilter  = ([EMAIL PROTECTED]);
$sr= ldap_search($ds, LDAP_BASEDN, $searchFilter,$what2return);
$resultEntries = ldap_get_entries($ds, $sr);
closeConn($ds);

if ($resultEntries[count] == 0) {
print user not found;
exit;
}
else {
$gn= $resultEntries[0][givenname];
$sn= $resultEntries[0][sn];
$photo = $resultEntries[0][jpegphoto];
if ($photo['count'] == 1)
print photo available;
else
print photo not available;
}
}

?



---
Sign Up for free Email at http://ureg.home.net.my/
---

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



Re: [PHP] getting rid of NOTICE

2004-10-07 Thread Roger Thomas
I dont know how to explain this but when you work with an ldap attribute, they are 
case sensitive. jpegPhoto was what the schema was written with.

However when you retrieve that into PHP, you accessed them with all lower case. So 
accessing userPassword attribute in ldap will become userpassword in PHP.

Just to satisfy your curiosity, I have changed that to your advise with running the 
script produces identical result.

--
roger

Quoting zareef ahmed [EMAIL PROTECTED]:

 
 --- Roger Thomas [EMAIL PROTECTED] wrote:
 
  I have this short script (below) that does checking
  whether a userid has an associated jpegPhoto in an
  LDAP database. The script is working fine but gave a
  'Notice' msg bcos I made error_reporting to report
  all errors.
  
  Notice: Undefined index: jpegphoto in test.php on
  line 34
  
  Question: How do I make the Notice go away without
  changing error reporting to error_reporting (E_ALL 
  ~E_NOTICE) ?
  
  Please advise.
  
  --
  roger
  
  ?
  require_once config.inc;
  error_reporting (E_ALL);
  
  $ds = @connectBindServer(LDAP_RDN, LDAP_PASS);
  if ($ds) {
  $what2return   =
  array(givenName,sn,jpegPhoto);
 
 You have define jpegPhoto Note Caps P.
 
  $searchFilter  = ([EMAIL PROTECTED]);
  $sr= ldap_search($ds, LDAP_BASEDN,
  $searchFilter,$what2return);
  $resultEntries = ldap_get_entries($ds, $sr);
  closeConn($ds);
  
  if ($resultEntries[count] == 0) {
  print user not found;
  exit;
  }
  else {
  $gn= $resultEntries[0][givenname];
  $sn= $resultEntries[0][sn];
  $photo = $resultEntries[0][jpegphoto];
 
 here p is small in jpegphoto.
 
 Got it ...
 
 zareef ahmed
  if ($photo['count'] == 1)
  print photo available;
  else
  print photo not available;
  }
  }
  
  ?
  
  
  
  ---
  Sign Up for free Email at http://ureg.home.net.my/
  ---
  
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
 
 =
 Zareef Ahmed :: A PHP Developer in Delhi ( India ).
 Homepage :: http://www.zasaifi.com/zareef_ahmed.php
 
 
   
 ___
 Do you Yahoo!?
 Declare Yourself - Register online to vote today!
 http://vote.yahoo.com
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 





---
Sign Up for free Email at http://ureg.home.net.my/
---

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



[PHP] PEAR Calendar

2004-11-02 Thread Roger Thomas
I would like to install PEAR Calendar  module and did a
[EMAIL PROTECTED] apps]# pear install Calendar
but got these:
No release with state equal to: 'stable' found for 'Calendar'

Please advise.


--
roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

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



Re: [PHP] PEAR Calendar

2004-11-03 Thread Roger Thomas
Thanks Greg. Got it installed now.

--
roger

Quoting Greg Beaver [EMAIL PROTECTED]:

 $ pear install Calendar-beta
 
 or
 
 $ pear install --force Calendar.
 
 Greg



---
Sign Up for free Email at http://ureg.home.net.my/
---

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



[PHP] Reservation technique

2004-11-04 Thread Roger Thomas
I would like to do some sort of facilities reservation system. Suppose this is for 
booking , say, a meeting room.

Booking detail to be stored in db:
- name or id of person
- meeting room number
- date and time (when room will be used)
- number of hours to be allocated

Now say Peter booked room R1 for 20th Nov starting from 9am to 12pm.
Then Mary try to book the same room on the same date beginning 10am for 4 hours.

How will a PHP script perform such checking to prevent that sort of overlapping in 
reservation ? Or could it be that my database design is bad that's blocking ideas into 
my head ?

I need help.

--
roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

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



RE: [PHP] Reservation technique

2004-11-04 Thread Roger Thomas
Great! Thanks Murray. 

--
roger

Quoting Murray @ PlanetThoughtful [EMAIL PROTECTED]:

 
  How will a PHP script perform such checking to prevent that sort of
  overlapping in reservation ? Or could it be that my database design is bad
  that's blocking ideas into my head ?
 
 Hi Roger,
 
 I think you need to check out the BETWEEN operator in MySQL (assuming you're
 using MySQL? Look for the equivalent operator in whatever db platform you're
 using, if otherwise). Essentially what you're looking to do is find out if
 either the start time or the end time of the new booking falls BETWEEN the
 start time or the end time of an existing booking. If either of them does,
 it's safe to assume there's a booking conflict.
 
 Much warmth,
 
 Murray
 http://www.planetthoughtful.org
 Building a thoughtful planet,
 One quirky comment at a time.
 
 





---
Sign Up for free Email at http://ureg.home.net.my/
---

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



RE: [PHP] Reservation technique

2004-11-04 Thread Roger Thomas
Yes. I flipped thru the manpages and found:
expr BETWEEN min AND max
If expr is greater than or equal to min and expr is less than or equal to max, 
BETWEEN returns 1, otherwise it returns 0. This is equivalent to the expression (min 
= expr AND expr = max) if all the arguments are of the same type.

Thanks again.

--
roger


Quoting Murray @ PlanetThoughtful [EMAIL PROTECTED]:

 
  Great! Thanks Murray.
 
 Hi Roger,
 
 On second thoughts, perhaps the BETWEEN operator isn't what you're looking
 for, since it will probably return false matches on bordering reservations.
 
 In other words, someone attempting to make a reservation between 10am and
 12pm might be told there's a conflicting reservation if there is already a
 reservation for between, for example, 12pm and 2pm on the same day. The end
 time of 12pm on the new reservation will return a match for the start time
 of 12pm on the existing reservation using the BETWEEN operator.
 
 As an alternative, you might try something like:
 
 SELECT * FROM reservation_table WHERE (new_start_datetime 
 reservation_start_datetime AND new_start_datetime 
 reservation_end_datetime) OR (new_end_datetime  reservation_start_datetime
 AND new_end_datetime  reservation_end_datetime)
 
 This should exclude false matches on bordering reservations.
 
 Much warmth,
 
 Murray
 http://www.planetthoughtful.org
 Building a thoughtful planet,
 One quirky comment at a time.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 





---
Sign Up for free Email at http://ureg.home.net.my/
---

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



[PHP] stripping negative number

2004-12-23 Thread Roger Thomas
I want to convert negative number to its positive equivalent.

$num = -40;
printf(Unsigned value is %u, $num);

output is: Unsigned value is 4294967256

I have checked the manpages and %u seems the right format. Pls advise.


--
roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

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



[PHP] captcha lib

2004-09-20 Thread Roger Thomas
What's the most popular/usable captcha library that is currently available. I frequent 
PEAR website but couldnt find any. Pls advise.

--
roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

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