php-general Digest 5 Sep 2005 19:57:24 -0000 Issue 3665

2005-09-05 Thread php-general-digest-help

php-general Digest 5 Sep 2005 19:57:24 - Issue 3665

Topics (messages 221853 through 221872):

Re: online/offline...but on a list of users
221853 by: Shaw, Chris - Accenture
221861 by: Edward Vermillion

Passing by reference, assigning by reference?
221854 by: Alex Gemmell

Re: exec() may not be safe
221855 by: Ilja Polivanovas
221870 by: Rory Browne

Ticket Number
221856 by: Kenny

how to divide string
221857 by: Adi Zebic
221858 by: Shafiq Rehman
221859 by: Kevin Waterson

Re: AND OR NOT
221860 by: John Taylor-Johnston
221863 by: David Robley

Re: I have a special problem
221862 by: Rory Browne

disable safe_mode with .htaccess ?
221864 by: Wong HoWang
221868 by: Rory Browne

Re: Scary nonsense form submissions
221865 by: Lowell Allen

howto send a whole smarty page to a printer
221866 by: Steven
221867 by: David Dorward
221869 by: £ukasz 'nostra' Wojciechowski
221871 by: Mikey

Re: Filter based on ctype_print()
221872 by: Rick Emery

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---

 clip
  I want to add this same functionality to a forum on the

 same site (the
 forum
  was custom programmed
  from scratch and not any of the popular ones), but since in a single
 thread
  there can be a lot of different
  people/usernames that answer I would prefer _not_ to do a

 select lookup
 for
  each username...
  any ideas on how else it can be done?
 /clip


 I'd say start with a query that pulls the online users into an array,
 then do an array_key_exists() or in_array() against that.


 


 Thanks! Thats a really good idea and one that i didnt think of.


 For now it should be okay as there are just a few hundred users, but
 if it gets really big then it might be a bit of a problem...
 if you any other ideas please feel free to reply till then

 I'll try your
 idea out.



What about using the 'in' or 'exists' keyword in sql.

for example:
select * from (select username from the rest of your online select
statement) a
where a.username in ($username, $username, $username ..)

Use some for loop to build up your 'in' statement.

A better way to do it is using joins and the exists statement, but its too
early for that. :)




This message has been delivered to the Internet by the Revenue Internet e-mail 
service

*
---End Message---
---BeginMessage---

Ryan A wrote:

clip


I want to add this same functionality to a forum on the same site (the


forum


was custom programmed
from scratch and not any of the popular ones), but since in a single


thread


there can be a lot of different
people/usernames that answer I would prefer _not_ to do a select lookup


for


each username...
any ideas on how else it can be done?


/clip

I'd say start with a query that pulls the online users into an array,
then do an array_key_exists() or in_array() against that.



Thanks! Thats a really good idea and one that i didnt think of.

For now it should be okay as there are just a few hundred users, but
if it gets really big then it might be a bit of a problem...
if you any other ideas please feel free to reply till then I'll try your
idea out.

Thanks,
Ryan






One of the things to think about with this is, although you may have a 
few hundred users signed up how many are online at once. I've got a 
forum with a few thousand members, but at any one time there's only 
about 15 average that are online. It peaks at about 45 sometimes, but 
that's rare. So the array in this case is relativly small. Plus it lets 
you do other things with the infomation like There are X users online, 
showing who is reading what and stuff like that.


If your running a site like MySpace or DA then it could be a problem. 
They tend to break things down though into smaller groups like showing 
your friends, or whatever they call them, that are online.


Another idea that goes with what Chris had said is to use a join on your 
online table. I'm assuming that your having to do a lookup for each 
post in the forum anyway, just join the online table here against the 
members id or name or whatever your using to track who makes the 
individual posts. How you do it exactly really depends on how you're 
building up the forums page.


That would probably be a better situation all around if you're doing a 
query for each post anyway.
---End Message---
---BeginMessage---

Hi sports fans!

I have a quick references related question.

Ok, I'm passing a Page object by reference to another object:


[PHP] Passing by reference, assigning by reference?

2005-09-05 Thread Alex Gemmell

Hi sports fans!

I have a quick references related question.

Ok, I'm passing a Page object by reference to another object:

myClass-myFunction($objPage);

What I want to do is store that Page object as part of the myClass 
object (see definition code below).


My question is this: When assigning the Page object to be a variable of 
the myClass object do I store a reference to it or a copy of the reference?


class myClass()
{
var $objPage;

function myFunction($objPage) {
// this way (a reference to the reference?):
$this-objPage = $objPage;

// or this way (a copy of the reference?):
$this-objPage = $objPage;

// code, code, code...
}
}

Is there much difference?  Does it really matter?  I'm unsure if this is 
efficient or not.


Can someone please shed some light on this.

Thanks!

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



[PHP] Re: exec() may not be safe

2005-09-05 Thread Ilja Polivanovas
By the way Zend Optimizer 2.5.7 is also installed in that PC. Does anybody  
know what does that [warn] means ?


--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

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



[PHP] Ticket Number

2005-09-05 Thread Kenny

Hello,

We're in the midst of creating a high volume transaction platform with 
PHP and MySQL. Each transaction ties to a transaction ID that is in turn 
an auto_increment, unsigned BIGINT(12).


The problem now is I do not want users to see this running transaction 
ID when using the system (such that we can roll out surprises for the 
customer of, say, the 10th million transaction).


We plan to convert the id to something like [A-Z0-9]-[checksums], (e.g. 
1X2Z0HTDEKS93-C8P), for simple input-error detection, and we can use it 
to lookup the relevant id from the database.


Which algorithm(s) in your opinion is the best for the encrypted 
transaction ID and checksum such that:

- Transaction ID should always be unique
- Running sequence is not predictable (when you have 2 transactions, you 
don't know how many transactions are between them)
- Contains only alphanumeric and case insensitive letters of not more 
than 15 characters, excluding checksum


We've thought of using the first 15 characters of a MD5 hash, so we can 
kind of SELECT substring(MD5(t_id)... during lookup, and CRC16 for the 
checksum. Someone also suggests scrapping the auto_increment field from 
db and generate our own using the below method


while (t_id exists in db)
  randomize

but i see the 2nd method being quite taxing to the server as you have to 
query at least one time per transaction.


I appreciate all inputs. Thanks!

Sincerely,
Kenny

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



[PHP] how to divide string

2005-09-05 Thread Adi Zebic

Hi,

is there any magic function who can give me from:

$string =  abcdefghijklmnopqrstuwvxyz;

somthing like this:

abcd
efgh
ijkl
mnop
qrst
uwvx
yz

(each 'x' letters go to the next line)

Thanks a lot,

ADI

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



Re: [PHP] how to divide string

2005-09-05 Thread Shafiq Rehman
Hi Zebic

It is pretty much simple./ Look into the code

$text = abcdefghijklmnopqrstuwvxyz;
$newtext = wordwrap($text, 4, br, 1);
echo $newtext;

// if you want all these chunks in an array use it as
$array = explode(br, $newtext);

echo $array[0];
echo $array[1];
echo $array[2];

Regards
Shafiq [http://www.phpgurru.com]


On 9/5/05, Adi Zebic [EMAIL PROTECTED] wrote:
 
 Hi,
 
 is there any magic function who can give me from:
 
 $string =  abcdefghijklmnopqrstuwvxyz;
 
 somthing like this:
 
 abcd
 efgh
 ijkl
 mnop
 qrst
 uwvx
 yz
 
 (each 'x' letters go to the next line)
 
 Thanks a lot,
 
 ADI
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


-- 
*** phpgurru.com http://phpgurru.com [A php resource provider] ***

\\\|///
\\ - - //
( @ @ ) PHP is too logical for my brain
+---oOOo-(_)-oOOo--+
| Mian Shafiq ur Rehman
| phpgurru.com http://phpgurru.com [A php resource provider]
| 107 B, New Town, Multan Road
| Lahore Pakistan
|
| Mobile: 0300 423 9385
|
| ooo0 http://www.phpgurru.com
| ( ) 0ooo E-Mail: [EMAIL PROTECTED]
+---\ (( )--+
\_) ) /
(_/


Re: [PHP] how to divide string

2005-09-05 Thread Kevin Waterson
This one time, at band camp, Adi Zebic [EMAIL PROTECTED] wrote:

 is there any magic function who can give me from:
 
 $string =  abcdefghijklmnopqrstuwvxyz;
 
 somthing like this:
 
 abcd
 efgh
 ijkl
 mnop
 qrst
 uwvx
 yz


$newstring=chunk_split($string, 4, 'br /');

Kevin

-- 
Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote.

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



[PHP] Re: AND OR NOT

2005-09-05 Thread John Taylor-Johnston
Any ideas? Post kind of lost in there since Saturday. Is str_replace the 
best choice for case sensitive and for swapping  AND ?



input TYPE=text NAME=searchenquiry VALUE= size=30

Any suggestion on how to swap AND OR NOT for mysql fulltext syntax in 
$searchenquiry?
A simple parse for  AND  and then str_replace? Is str_replace 
appropriate for case?


John

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



Re: [PHP] online/offline...but on a list of users

2005-09-05 Thread Edward Vermillion

Ryan A wrote:

clip


I want to add this same functionality to a forum on the same site (the


forum


was custom programmed
from scratch and not any of the popular ones), but since in a single


thread


there can be a lot of different
people/usernames that answer I would prefer _not_ to do a select lookup


for


each username...
any ideas on how else it can be done?


/clip

I'd say start with a query that pulls the online users into an array,
then do an array_key_exists() or in_array() against that.



Thanks! Thats a really good idea and one that i didnt think of.

For now it should be okay as there are just a few hundred users, but
if it gets really big then it might be a bit of a problem...
if you any other ideas please feel free to reply till then I'll try your
idea out.

Thanks,
Ryan






One of the things to think about with this is, although you may have a 
few hundred users signed up how many are online at once. I've got a 
forum with a few thousand members, but at any one time there's only 
about 15 average that are online. It peaks at about 45 sometimes, but 
that's rare. So the array in this case is relativly small. Plus it lets 
you do other things with the infomation like There are X users online, 
showing who is reading what and stuff like that.


If your running a site like MySpace or DA then it could be a problem. 
They tend to break things down though into smaller groups like showing 
your friends, or whatever they call them, that are online.


Another idea that goes with what Chris had said is to use a join on your 
online table. I'm assuming that your having to do a lookup for each 
post in the forum anyway, just join the online table here against the 
members id or name or whatever your using to track who makes the 
individual posts. How you do it exactly really depends on how you're 
building up the forums page.


That would probably be a better situation all around if you're doing a 
query for each post anyway.


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



Re: [PHP] I have a special problem

2005-09-05 Thread Rory Browne
If you are uploading to a Unix or Linux server, then you can use the
chmod program to make your files writable.

If you want a program for your local computer to allow you to FTP your
files across, then check out this page.
http://www.thefreecountry.com/webmaster/freeftpclients.shtml

On 9/3/05, Populous Refurbished [EMAIL PROTECTED] wrote:
 Hi, with what program i can upload my files in ftp but make it writables, 
 beacause i cant's config nothing and start to build with php.
 amp;nbsp;
 Thanks.
 


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



[PHP] Re: AND OR NOT

2005-09-05 Thread David Robley
John Taylor-Johnston wrote:

 Any ideas? Post kind of lost in there since Saturday. Is str_replace the
 best choice for case sensitive and for swapping  AND ?
 
 input TYPE=text NAME=searchenquiry VALUE= size=30

 Any suggestion on how to swap AND OR NOT for mysql fulltext syntax in
 $searchenquiry?
 A simple parse for  AND  and then str_replace? Is str_replace
 appropriate for case?
 
 John

I think you have a slightly more complex situation than just replacing text
between what I assume is a LIKE or multiple WHERE situation and a fulltext
search. Perhaps if you can give an idea of the type of string you are
likely to get in $searchenquiry, and to what you wish to convert it, we
might be better placed to give advice.

I can envisage that you might get 'bananas NOT pears AND apples' in the
variable; I guess you would currently manipulate that to a query such as
 
WHERE x = 'bananas' AND x  'pears' AND x = 'apples'

(OK that's not a good example) but if you were to feed that to a fulltext
search you might want

WHERE MATCH (x) AGAINST ('+bananas -pears -apples' IN BOOLEAN MODE)

or maybe something else depending on the version of Mysql and exactly what
you are trying to do with your fulltext search.




Cheers
-- 
David Robley

Why do cats have canine teeth?

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



[PHP] disable safe_mode with .htaccess ?

2005-09-05 Thread Wong HoWang
Hello everyone,

I have a special question and want to ask here, hope anyone can answer me.

My server is Apache/1.3.33 with PHP/4.3.10
I have AllowOverride All in my httpd.conf and safe_mode = On in php.ini , I 
want to turn off safe_mode in one folder by .htaccess , is it possiable? I 
don't want to make changes to my httpd.conf or php.ini because that is a 
productive server and shouldn't restart it.

Please help, thank you!

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



Re: [PHP] Scary nonsense form submissions

2005-09-05 Thread Lowell Allen

On Sep 4, 2005, at 12:06 PM, Brian Dunning wrote:


Hi all -

I have forms on a number of unrelated web sites that just send me an 
email for one purpose or another. There are 2 to 6 fields: name, 
email, comment, etc. No big deal.


Recently I've been getting a lot of weird submissions. I'll receive 
half a dozen at a time, with all the fields filled with some kind of 
garbage contents. Here is one example from a form on my 
americansubstandard.com site:


---snip---
COMMENT: [EMAIL PROTECTED]
NAME: [EMAIL PROTECTED]
---/snip---

Other times one of the fields will contain a complete multipart 
submission, like this:


---snip---
COMMENT: [EMAIL PROTECTED]
NAME: [EMAIL PROTECTED]
Content-Type: multipart/mixed; boundary=\===1655480186==\
MIME-Version: 1.0
Subject: e8df6b7
To: [EMAIL PROTECTED]
bcc: [EMAIL PROTECTED]
From: [EMAIL PROTECTED]
This is a multi-part message in MIME format.
--===1655480186==
Content-Type: text/plain; charset=\us-ascii\
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
xqofli
--===1655480186==--
---/snip---

I wonder if this is some kind of automated attack attempt. Does anyone 
recognize this type of thing, and is it potentially dangerous? Should 
I do something about it?


- Brian


I've gotten the same kind of thing recently from a comment form. 
Something's definitely going around.


I modified my script to check for various mail header elements within 
the comments and return an error message if any are found. I also added 
two returns following my own mail headers, which supposedly prevents an 
injection of additional headers -- see 
http://us2.php.net/manual/en/ref.mail.php#55112. And see the recent 
thread on this list -- Be careful! Look at what this spammer did.


--
Lowell Allen

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



[PHP] howto send a whole smarty page to a printer

2005-09-05 Thread Steven

Hi

I am using smarty with my php site, I know you can send a whole smarty 
template page to a variable, is their any way i can easily print that 
variable out.  or am i going about this the wrong way.


I basically want to print the output of the page directly to the 
printer.  I find using the Internet Explorer Print Page button, prints 
extra text on the top and bottom of the page, which i dont want, also it 
seems to effect my page formatting a little.


any help would be appreciated
Thanks
steve

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



[PHP] Re: howto send a whole smarty page to a printer

2005-09-05 Thread David Dorward
Steven wrote:

 I basically want to print the output of the page directly to the
 printer.  I find using the Internet Explorer Print Page button, prints
 extra text on the top and bottom of the page, which i dont want, also it
 seems to effect my page formatting a little.

Presumably you want your HTML to be *rendered* (i.e. you don't want a print
out of the HTML source)? I'm not aware of any tool better then a browser
for doing that (although MSIE would not be my first choice). I'm yet to see
a browser which doesn't allow you to specify which (if any) headers and
footers should be added to the page. Look in your browser's preferences.

-- 
David Dorward   http://blog.dorward.me.uk/   http://dorward.me.uk/
 Home is where the ~/.bashrc is

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



Re: [PHP] disable safe_mode with .htaccess ?

2005-09-05 Thread Rory Browne
By the looks of things you can't. 

safe_mode changability is set to PHP_INI_SYSTEM

You may be able to put a Directory ... type setting into the
httpd.conf file, and have apache re-read its config file by sending it
a USR1 signal.

As it is a production server you may want to test this on a dev server first:

On 9/5/05, Wong HoWang [EMAIL PROTECTED] wrote:
 Hello everyone,
 
 I have a special question and want to ask here, hope anyone can answer me.
 
 My server is Apache/1.3.33 with PHP/4.3.10
 I have AllowOverride All in my httpd.conf and safe_mode = On in php.ini , I
 want to turn off safe_mode in one folder by .htaccess , is it possiable? I
 don't want to make changes to my httpd.conf or php.ini because that is a
 productive server and shouldn't restart it.
 
 Please help, thank you!
 
 --
 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] howto send a whole smarty page to a printer

2005-09-05 Thread Łukasz 'nostra' Wojciechowski
W odpowiedzi na maila (18:09 - 5 września 2005):

 Hi

Hello

 I am using smarty with my php site, I know you can send a whole smarty
 template page to a variable, is their any way i can easily print that
 variable out.  or am i going about this the wrong way.

Why don't you just make another template file witch would be more
printer friendly (i.e. just formated text). You would take your
compiled variable, parse it (threw away all img,swf etc.) and give it
to print tpl.

Personaly I do it with CSS ... i just change my
layout.css to layout_print.css with no backgrounds and black text. But
images still remain.

You can even use XSL ... but it would
require to redesign whole presentation part of your website. More info
here: http://www.w3.org/Style/XSL/

-- 
pozdrawiam
Łukasz nostra Wojciechowski
gg.1028640 * icq.23059512 * gsm.609.655.911


--
Jedyny taki czat...  http://link.interia.pl/f18b0

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



Re: [PHP] Re: exec() may not be safe

2005-09-05 Thread Rory Browne
AFAIK Apache on win98 does that.

It's warning you that you are doing unsafe stuff on an unsafe OS.

On 9/5/05, Ilja Polivanovas [EMAIL PROTECTED] wrote:
 By the way Zend Optimizer 2.5.7 is also installed in that PC. Does anybody
 know what does that [warn] means ?
 
 --
 Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
 
 --
 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] howto send a whole smarty page to a printer

2005-09-05 Thread Mikey

Łukasz 'nostra' Wojciechowski wrote:


W odpowiedzi na maila (18:09 - 5 września 2005):

 


Hi
   



Hello

 


I am using smarty with my php site, I know you can send a whole smarty
template page to a variable, is their any way i can easily print that
variable out.  or am i going about this the wrong way.
   



Why don't you just make another template file witch would be more
printer friendly (i.e. just formated text). You would take your
compiled variable, parse it (threw away all img,swf etc.) and give it
to print tpl.

Personaly I do it with CSS ... i just change my
layout.css to layout_print.css with no backgrounds and black text. But
images still remain.

You can even use XSL ... but it would
require to redesign whole presentation part of your website. More info
here: http://www.w3.org/Style/XSL/

 

If you are running on a Linux server (your e-mail is confusing as a 
browser is client side and PHP cannot change what happens to the code 
once it has been sent) then you can use html2ps to render and print a page.


HTH,

Mikey

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



Re: [PHP] Filter based on ctype_print()

2005-09-05 Thread Rick Emery

Quoting Robin Vickery [EMAIL PROTECTED]:


On 9/5/05, Rick Emery [EMAIL PROTECTED] wrote:


What I really want to do is replace the non-printable character(s) with
printable character(s) (maybe a question mark, or a space), but haven't
been able to find a function that will do it. Maybe something like:

$xmlOutput .= 'remark';
$xmlOutput .= ctype_print_replace($remarks['Remark'], '');
$xmlOutput .= '/remark';


$xmlOutput .= preg_replace('/[^[:print:]]/', '?', $remarks['Remark']);


Worked great, thanks!

Rick

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



[PHP] Re: FTP Chmod problem

2005-09-05 Thread Raj Shekhar
Matt Palermo [EMAIL PROTECTED] writes:


 ftp_chmod($connId, 0777, $folder);
 
 The function almost works, but when I check the permission of the folder 
 after it's run, the folder has 410 for permissions instead of 777.  So, it 
 is changing the permissions, but not to the correct value.  Now when I use 
 the following code, it seems to work fine:
 
 $chmodCmd = CHMOD 0777 .$file;
 ftp_site($connId, $chmodCmd);
 
 This properly changes the folder permissions to 777.  Does anyone know why 
 the ftp_chmod() function doesn't work correctly?  As a side note, the 
 ftp_chmod() function works correctly on a file, but not a directory.  Any 
 help is appreciated.

Some ftp server (like vsftpd) can be configure to change the mode of all
uploaded files .  There is a possibility that your server is configure
to chmod your files (in vsftpd it is controlled by the file_open_mode
option in the config file)

-- 
Raj Shekhar
blog : http://rajshekhar.net/blog  home : http://rajshekhar.net
Disclaimer : http://rajshekhar.net/disclaimer

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



Re: [PHP] how to divide string

2005-09-05 Thread Jordan Miller
If  you are using php 5, don't forget about str_split, with 4 as the  
second parameter.

http://us2.php.net/str_split

so you could do:
echo implode(br /, str_split($string, 4));

if you still have php 4 or earlier, look at that page anyway as there  
is a workaround function in the comments for earlier  versions of php.


Jordan



On Sep 5, 2005, at 6:50 AM, Adi Zebic wrote:


Hi,

is there any magic function who can give me from:

$string =  abcdefghijklmnopqrstuwvxyz;

somthing like this:

abcd
efgh
ijkl
mnop
qrst
uwvx
yz

(each 'x' letters go to the next line)

Thanks a lot,

ADI

--
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] Re: FTP Chmod problem

2005-09-05 Thread Matt Palermo
It doesn't make sense to me that the function would work fine on a file and 
not work on a directory.  Moreover, why would the ftp_site chmod command 
produce a working result and not the ftp_chmod?  This seems strange to me.

-Matt




Raj Shekhar [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Matt Palermo [EMAIL PROTECTED] writes:


 ftp_chmod($connId, 0777, $folder);

 The function almost works, but when I check the permission of the folder
 after it's run, the folder has 410 for permissions instead of 777.  So, 
 it
 is changing the permissions, but not to the correct value.  Now when I 
 use
 the following code, it seems to work fine:

 $chmodCmd = CHMOD 0777 .$file;
 ftp_site($connId, $chmodCmd);

 This properly changes the folder permissions to 777.  Does anyone know 
 why
 the ftp_chmod() function doesn't work correctly?  As a side note, the
 ftp_chmod() function works correctly on a file, but not a directory.  Any
 help is appreciated.

 Some ftp server (like vsftpd) can be configure to change the mode of all
 uploaded files .  There is a possibility that your server is configure
 to chmod your files (in vsftpd it is controlled by the file_open_mode
 option in the config file)

 -- 
 Raj Shekhar
 blog : http://rajshekhar.net/blog  home : http://rajshekhar.net
 Disclaimer : http://rajshekhar.net/disclaimer 

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



Re: [PHP] Re: PHP/MySQL offline

2005-09-05 Thread viraj
On 9/4/05, John Taylor-Johnston
[EMAIL PROTECTED] wrote:
 This is maybe what you want:
 http://www.indigostar.com/
 http://www.indigostar.com/microweb.htm

another good method is a Live Linux CD. you can find a light weight
live linux distro and remaster it to include your live web site. so
your client can put boot his/her pc with this cd and start browsing
the site.

this way you can use whatever the LAMP combination!

http://www.google.com/search?hl=enq=howto+remasterspell=1
http://taprobane.org/

~viraj.

 Runs an apache server, php  all, from a CD. (windows app.)
 John
 
 Mario netMines wrote:
 
  Hi all
 
  I have a project where I'm using PHP/Mysql. The client wants to run
  that project to a cd.
  Does anyone know of a trick either by using javascript, XML or an
  automated script that creates a static site that will allow me to do
  that?
 
  Many Thanks
 
  M
 
 --
 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 and $ sign in PHP5

2005-09-05 Thread Cabbar Duzayak
Hi,

I have a regular expression check as:

preg_match(/$xyz/, $data, $matches);

And, as you know $xyz means string starts with xyz. But somehow PHP
5 is interpreting this as variable xyz, and gives the  notice below.
You can ignore the message, but now it matches everything that has
xyz, i.e. aaxyzbb


PHP Notice:  Undefined variable: xyz in /tmp/test.php

Any idea about how I can specify string starts with xyz or fix it
such that PHP5 won't recognize this as a variable?

Thanks...

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



Re: [PHP] preg_match and $ sign in PHP5

2005-09-05 Thread Jasper Bryant-Greene

Cabbar Duzayak wrote:

I have a regular expression check as:

preg_match(/$xyz/, $data, $matches);

And, as you know $xyz means string starts with xyz. But somehow PHP
5 is interpreting this as variable xyz, and gives the  notice below.
You can ignore the message, but now it matches everything that has
xyz, i.e. aaxyzbb


Either use single quotes:

preg_match('/$xyz/', $data, $matches);

or escape the $-sign:

preg_match(/\$xyz/, $data, $matches);

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

If you find my advice useful, please consider donating to a poor
student! You can choose whatever amount you think my advice was
worth to you. http://tinyurl.com/7oa5s

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



[PHP] Re: AND OR NOT

2005-09-05 Thread John Taylor-Johnston

David,

I'm under pressure to permit AND, OR  NOT. My research group insists 
that MySQL 4 syntax is not good enough.


An idea of what one might enter is here (on the bottom):  
http://compcanlit.usherbrooke.ca/advanced.html


I was hoping to get away with replacing  AND  with +,  NOT  with 
- and  OR  with  .


I use this as SQL:

SELECT *,MATCH (YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC,JR,KW,AUS,TUS,GEO,AN,SA,RB)
AGAINST ('$mydata-searchenquiry' IN BOOLEAN MODE)
AS relevancy FROM ccl_main
WHERE MATCH (YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC,JR,KW,AUS,TUS,GEO,AN,SA,RB)
AGAINST ('$mydata-searchenquiry' IN BOOLEAN MODE)
ORDER BY relevancy DESC;--

John


David Robley wrote:


John Taylor-Johnston wrote:


Any ideas? Post kind of lost in there since Saturday. Is str_replace the
best choice for case sensitive and for swapping  AND ?


input TYPE=text NAME=searchenquiry VALUE= size=30

Any suggestion on how to swap AND OR NOT for mysql fulltext syntax in
$searchenquiry?
A simple parse for  AND  and then str_replace? Is str_replace
appropriate for case?


John



I think you have a slightly more complex situation than just replacing 
text

between what I assume is a LIKE or multiple WHERE situation and a fulltext
search. Perhaps if you can give an idea of the type of string you are
likely to get in $searchenquiry, and to what you wish to convert it, we
might be better placed to give advice.

I can envisage that you might get 'bananas NOT pears AND apples' in the
variable; I guess you would currently manipulate that to a query such as

WHERE x = 'bananas' AND x  'pears' AND x = 'apples'

(OK that's not a good example) but if you were to feed that to a fulltext
search you might want

WHERE MATCH (x) AGAINST ('+bananas -pears -apples' IN BOOLEAN MODE)

or maybe something else depending on the version of Mysql and exactly what
you are trying to do with your fulltext search.




--
John Taylor-Johnston
-
If it's not Open Source, it's Murphy's Law.

°v° Bibliography of Comparative Studies in Canadian, Québec and Foreign 
Literatures

/(_)\ Université de Sherbrooke
^ ^ http://compcanlit.ca/ T: 819.569.2064

--
John Taylor-Johnston
-
If it's not Open Source, it's Murphy's Law.

 ' ' 'Collège de Sherbrooke:
ô¿ôhttp://www.collegesherbrooke.qc.ca/languesmodernes/
   - 819-569-2064

 °v°   Bibliography of Comparative Studies in Canadian, Québec and Foreign 
Literatures
/(_)\  Université de Sherbrooke
 ^ ^   http://compcanlit.ca/ T: 819.569.2064



[PHP] Re: AND OR NOT

2005-09-05 Thread John Taylor-Johnston

David,

I'm under pressure to permit AND, OR  NOT. My research group insists 
that MySQL 4 syntax is not good enough.


An idea of what one might enter is here (on the bottom):  
http://compcanlit.usherbrooke.ca/advanced.html


I was hoping to get away with replacing  AND  with +,  NOT  with 
- and  OR  with  .


I use this as SQL:

SELECT *,MATCH (YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC,JR,KW,AUS,TUS,GEO,AN,SA,RB)
AGAINST ('$mydata-searchenquiry' IN BOOLEAN MODE)
AS relevancy FROM ccl_main
WHERE MATCH (YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC,JR,KW,AUS,TUS,GEO,AN,SA,RB)
AGAINST ('$mydata-searchenquiry' IN BOOLEAN MODE)
ORDER BY relevancy DESC;--

John


David Robley wrote:


John Taylor-Johnston wrote:


Any ideas? Post kind of lost in there since Saturday. Is str_replace the
best choice for case sensitive and for swapping  AND ?


input TYPE=text NAME=searchenquiry VALUE= size=30

Any suggestion on how to swap AND OR NOT for mysql fulltext syntax in
$searchenquiry?
A simple parse for  AND  and then str_replace? Is str_replace
appropriate for case?


John



I think you have a slightly more complex situation than just replacing 
text

between what I assume is a LIKE or multiple WHERE situation and a fulltext
search. Perhaps if you can give an idea of the type of string you are
likely to get in $searchenquiry, and to what you wish to convert it, we
might be better placed to give advice.

I can envisage that you might get 'bananas NOT pears AND apples' in the
variable; I guess you would currently manipulate that to a query such as

WHERE x = 'bananas' AND x  'pears' AND x = 'apples'

(OK that's not a good example) but if you were to feed that to a fulltext
search you might want

WHERE MATCH (x) AGAINST ('+bananas -pears -apples' IN BOOLEAN MODE)

or maybe something else depending on the version of Mysql and exactly what
you are trying to do with your fulltext search.




--
John Taylor-Johnston
-
If it's not Open Source, it's Murphy's Law.

°v° Bibliography of Comparative Studies in Canadian, Québec and Foreign 
Literatures

/(_)\ Université de Sherbrooke
^ ^ http://compcanlit.ca/ T: 819.569.2064

--
John Taylor-Johnston
-
If it's not Open Source, it's Murphy's Law.

 ' ' 'Collège de Sherbrooke:
ô¿ôhttp://www.collegesherbrooke.qc.ca/languesmodernes/
   - 819-569-2064

 °v°   Bibliography of Comparative Studies in Canadian, Québec and Foreign 
Literatures
/(_)\  Université de Sherbrooke
 ^ ^   http://compcanlit.ca/ T: 819.569.2064


--
John Taylor-Johnston
-
If it's not Open Source, it's Murphy's Law.

 ' ' 'Collège de Sherbrooke:
ô¿ôhttp://www.collegesherbrooke.qc.ca/languesmodernes/
   - 819-569-2064

 °v°   Bibliography of Comparative Studies in Canadian, Québec and Foreign 
Literatures
/(_)\  Université de Sherbrooke
 ^ ^   http://compcanlit.ca/ T: 819.569.2064



Re: [PHP] Re: AND OR NOT

2005-09-05 Thread Jasper Bryant-Greene

John Taylor-Johnston wrote:

David,

I'm under pressure to permit AND, OR  NOT. My research group insists 
that MySQL 4 syntax is not good enough.


An idea of what one might enter is here (on the bottom):  
http://compcanlit.usherbrooke.ca/advanced.html


I was hoping to get away with replacing  AND  with +,  NOT  with 
- and  OR  with  .


I use this as SQL:

SELECT *,MATCH 
(YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC,JR,KW,AUS,TUS,GEO,AN,SA,RB)

AGAINST ('$mydata-searchenquiry' IN BOOLEAN MODE)
AS relevancy FROM ccl_main
WHERE MATCH (YR,AU,ST,SD,SC,BT,BD,BC,AT,AD,AC,JR,KW,AUS,TUS,GEO,AN,SA,RB)
AGAINST ('$mydata-searchenquiry' IN BOOLEAN MODE)
ORDER BY relevancy DESC;--


Please don't top-post [1]. Nice cryptic column names, by the way :)

Your research group obviously haven't researched very carefully, as 
+term is exactly equal to  AND term, -term to  NOT term and 
simply term to  OR term. So there's no point in complicating the syntax.


Not only that, but MySQL's boolean mode fulltext search offers many more 
great possibilities like truncation (app* will match apple, 
application...) and in-query relevance altering. Take a look at the 
BOOLEAN MODE section of the MySQL manual [2]; maybe print it and give it 
to your research group :)


[1] http://en.wikipedia.org/wiki/Top-posting
[2] http://dev.mysql.com/doc/mysql/en/fulltext-boolean.html

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

If you find my advice useful, please consider donating to a poor
student! You can choose whatever amount you think my advice was
worth to you. http://tinyurl.com/7oa5s

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