Re: [PHP] Spam Post Defense / ID spam form posts

2007-08-24 Thread Stut

Instruct ICC wrote:
Because that means messing with the recipient list - that's donkey 
work your client should do, hence my use of reply-to-all.

Wouldn't gmail thread it but still have 2 copies?
I could send email TO/CC/BCC the list to a specific folder, but I'd 
still get the copy to me directly in another folder.  What should I 
train my donkey to do?  I reply to all, then I only let the list address 
survive and make sure it is in the TO field.


If your mail client can't resolve two copies of the same email down to 
one, change your mail client.


Attacking a server with the express intention of preventing it from 
working correctly is in most countries. It's the technological 
equivalent of getting prosecuted for assault because you defended your 
property from a burglar.
Now I'm thinking I should inform the attacking server of the situation 
by shutting them down until they address the issue.  It may need new 
laws on the books to cover my ass.  But what do you think?  Either a 
YOU'VE BEEN PWND BY THE GUARDIANS because you are either running 
hijacked services for an attacker, (likely on an MS Windows flavor -- 
upgrade your OS to a non-MS OS), or you are the actual attacker.  When 
you patch your security holes, THE GUARDIANS will consider your petition 
to re-enter the superhighway. or some such.  If the HTTP_USER_AGENT 
hasn't been spoofed, they all seem to be Opera/9.0 (Windows NT 5.1; U; 
en), since I began tracking.  If the server could be shutdown and 
reported to an authority that would re-evaluate their access to the net, 
it could help catch the attacker or in the least, stop attacks on other 
innocents.


Well, if the hijacked service is down, it will hurt the attacker.  If 
the innocent's server is down, they could learn about the need to be a 
better net citizen while at the same time not providing services to the 
attacker.


I'm assuming (and hope) you're being somewhat sarcastic, but you seem to 
misunderstand where these attacks are coming from. Most will not be 
coming from other servers, but from desktop machines belonging to the 
Joe Bloggs of this world. Bringing down their machines just because they 
were ignorant enough to get compromised seems like cruel and unusual 
punishment to me.


You're essentially talking about needing a license to use the Internet. 
This has been talked about before on this list and all over the 'net, 
but it will likely never happen because it goes against the principles 
upon which it has been built and the people involved in running the core 
infrastructure.


The point I was trying to make is that your first step should be to 
find out why he has that position, educate him as to the benefits of 
the CAPTCHA and the complications that any other approach might have.
He holds that position because he does not want the user to have to 
enter any additional keystrokes or mouse clicks (or think more?) while 
they are becoming a sales lead.  Not unlike your repulsion to cut and 
paste to send only to the list perhaps?


I don't have a repulsion toward modifying recipient lists, but I send 
too many emails to be bothered to do it. My toolset works, it de-dupes 
correctly and I've never had a problem with other people sending an 
email to several addresses that end up at the same mailbox.


Now, to get back to your original question... I now understand that this 
form you're dealing with is a contact form on a website? Your solution 
is simple. Put a note above the form stating that they cannot send URLs, 
HTML or BBcode. Then in your form handler check the following...


* Single line fields do not contain carriage returns (used by spammers 
in an attempt to inject their own headers in emails)

* No fields contain URLs, HTML or BBcode.
* If you're asking for an email address check it against one of the many 
regular expression patterns out there.


You may also want to consider naming your form fields non-descriptively. 
For example, if you call the email field email an automated bot will 
know to put an email address in there. If you name it field2 it won't 
and your email address validation will catch it out.


With those steps you can easily cut out the majority of spam that will 
come through a contact form.


-Stut

--
http://stut.net/

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



Re: [PHP] Spam Post Defense / ID spam form posts

2007-08-23 Thread Stut

Instruct ICC wrote:

Can server1 receive a web page form post from remoteAttacker,
identify it as spam (or a DoS or DDoS attack),
hand off the socket to multiple threads on multiple servers owned by 
server1's owner,
return multiple responses to remoteAttacker which normally would have 
been a single response returned by server1,
so that server1 is not busy responding to remoteAttacker and is able to 
handle legitimate requests?


Technically?


Not sure what you mean by hand off the socket to multiple threads on 
multiple servers. I think you're talking about detecting that a POST is 
spam and passing that off to another machine to handle it. Far easier 
and more effective is to stop processing the request the moment you know 
it's spam. Why would you waste any more time with it than you need to.



Legally?


Grey area. You can put restrictions in the terms and conditions of use 
on your site, but AFAIK those have never been legally tested and would 
be extremely difficult and prohibitively expensive to enforce.


The boss doesn't want to use a CAPTCHA on the form but wants us to 
identify it without additional user input.


Then your boss is an idiot. Some form of CAPTCHA is the best defence 
currently available.


There are alternatives such as putting a generated key into a hidden 
field in the form which you also store in the session. When you get the 
POST you check the key you get to make sure that request has come from 
the form you just generated and not something/someone just using the 
field set. However, this is not overly secure since spammers just need 
to get the page containing the form each time.


Also, can a form post be run through an email spam filter to identify it 
as spam?


Certainly can. It takes a lot more time and resources to do it but it 
can be very effective.



Do you have any ideas to detect spam form posts?
I'm tracking the spam posts in an attempt to find a pattern I can use to 
detect them.


There are projects out there that build databases of spam posts reported 
by users. You can uses these to filter out spam but it only works if the 
post is identical to one that has been identified as spam elsewhere. You 
are usually expected to feed back into those systems with your own 
reports of spam, but taking part in a larger effort will certainly be 
more effective than doing it on your own.


You might want to check out the source for Akismet which is one of the 
anti-comment-spam plugins available for Wordpress. There are others 
around that do similar things.


You don't say what context you're taking this data in, but if you can 
refuse to accept posts containing bbcode-style markup and links you will 
get rid of 70-80% of bogus posts.


-Stut

--
http://stut.net/

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



Re: [PHP] Spam Post Defense / ID spam form posts

2007-08-23 Thread Stut

Instruct ICC wrote:
Not sure what you mean by hand off the socket to multiple threads on 
multiple servers. I think you're talking about detecting that a POST 
is spam and passing that off to another machine to handle it.
Yes, that is what I meant.  A socket is a lower level object that the 
web server is using to communicate.


Wow, that's for that egg-sucking lesson. I would think it was clear from 
my answer that I know what a socket is.



Why would you waste any more time with it than you need to.
This was my knee-jerk response that wanted to bring down the attacker's 
server.  I was wondering if I could spawn multiple threads and on 
multiple servers to write back to that attacker socket.


That is pointless since most spam comments come from compromised 
machines, so you'd only succeed in pissing essentially innocent (albeit 
probably stupid) users.


Moreover that would definitely be illegal and you're more likely to be 
sued than the person behind the spam.



Legally?


Grey area. You can put restrictions in the terms and conditions of use 
on your site, but AFAIK those have never been legally tested and would 
be extremely difficult and prohibitively expensive to enforce.
I'm pretty sure I read that bringing down an attacker's server (or 
making the attempt) would put me in the wrong.  And yes, I was thinking 
of adding legal terms to the form of the type Bogus form submissions 
will be {dealt with}.


Sorry, I thought you were questioning the legality of them posting spam 
to your site.


Again, no terms and conditions can enable you to break the law.

Then your boss is an idiot. Some form of CAPTCHA is the best defence 
currently available.

No comment, except that pay-day is approaching.


Doesn't stop him/her being an idiot. Curious that you only value your 
job when payday is approaching.


There are alternatives such as putting a generated key into a hidden 
field in the form which you also store in the session. When you get 
the POST you check the key you get to make sure that request has come 
from the form you just generated and not something/someone just using 
the field set. However, this is not overly secure since spammers just 
need to get the page containing the form each time.

I was thinking of this and came to the same conclusion.

There are projects out there ...taking part in a larger effort will 
certainly be more effective than doing it on your own.

Thanks.

You might want to check out the source for Akismet which is one of the 
anti-comment-spam plugins available for Wordpress. There are others 
around that do similar things.
I think I saw this name Akismet in my defense searches.  I'll take 
another look.


You don't say what context you're taking this data in, but if you can 
refuse to accept posts containing bbcode-style markup and links you 
will get rid of 70-80% of bogus posts.

They do seem to have the bbcode url style markup.  Thanks again.


You've got to bear in mind that they are trying to achieve something, 
and that something is usually to build traffic and/or inbound links to 
their sites. The only way they can do this is to include URLs in their 
posts.


-Stut

--
http://stut.net/

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



Re: [PHP] Spam Post Defense / ID spam form posts

2007-08-23 Thread Stut

Instruct ICC wrote:
Why don't you and others just reply to the list?  (I'm smiling when I 
say this.)


Because that means messing with the recipient list - that's donkey work 
your client should do, hence my use of reply-to-all.


Wow, that's for that egg-sucking lesson. I would think it was clear 
from my answer that I know what a socket is.
Sorry.  You understood the concept but it wasn't clear to me that you 
understood about the socket.  Save me a google search and define 
egg-sucking, although I get your point.


To teach someone how to suck eggs means to explain something to them 
when they already know it.

http://www.google.co.uk/search?q=teach+someone+how+to+suck+eggs

That is pointless since most spam comments come from compromised 
machines, so you'd only succeed in pissing essentially innocent 
(albeit probably stupid) users.


Moreover that would definitely be illegal and you're more likely to be 
sued than the person behind the spam.
I'll try to remember that.  However, the technical interest remains and 
may be handy for a known attacker server (meaning a known party that is 
not a compromised innocent).  It sounds like I'm looking for a 
Reflected attack.


That would still be illegal. Posting unsolicited commercial messages on 
a website is not technically illegal in most countries. Attacking a 
server with the express intention of preventing it from working 
correctly is in most countries. It's the technological equivalent of 
getting prosecuted for assault because you defended your property from a 
burglar.


Doesn't stop him/her being an idiot. Curious that you only value your 
job when payday is approaching.
Come on now.  I meant that he pays me.  I'm not trying to stop him on 
either count.


The point I was trying to make is that your first step should be to find 
out why he has that position, educate him as to the benefits of the 
CAPTCHA and the complications that any other approach might have.



They do seem to have the bbcode url style markup.  Thanks again.


You've got to bear in mind that they are trying to achieve something, 
and that something is usually to build traffic and/or inbound links to 
their sites. The only way they can do this is to include URLs in their 
posts.

Yes I was wondering, wtf is their objective?


To get traffic to their websites that make them money. Think drugs, 
stocks, dating, and anything else that might be lucrative.


The problem is that most of this activity is automated. It's the if you 
throw enough shit at the wall some of it will stick approach, and 
worryingly enough it works which is why they keep doing it.


-Stut

--
http://stut.net/

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



Re: [PHP] ptting the variable inside the input

2007-08-22 Thread Stut

Hulf wrote:

This does not work

echo $title=$row['title'];
echo trtdinput name=\title\ type=\text\ value=\$title\ //td;


In what way does it not work and you do realise you're outputting 
$title on its own as well as the table row and input. This will appear 
above the table in most browsers since it's not actually part of the table.


-Stut

--
http://stut.net/

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



Re: [PHP] ptting the variable inside the input

2007-08-22 Thread Stut

Hulf wrote:

This does not work

echo $title=$row['title'];
echo trtdinput name=\title\ type=\text\ value=\$title\ //td;


In what way does it not work and you do realise you're outputting 
$title on its own as well as the table row and input. This will appear 
above the table in most browsers since it's not actually part of the table.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: Declare variables in advance question

2007-08-21 Thread Stut

Colin Guthrie wrote:

nitrox . wrote:

I want to declare these variables Game_id and Member_id in advance. Following 
the suggestionfrom one of my books can I do something like this:
 
$expected = array('Game_id', 'Member_id');foreach($expected AS $key) {if ( !empty($_POST[$key])) {  ${$key} = $_POST[$key];}else { ${$key} = NULL;}}  case addmember:  switch ($_GET['type']) {case membergame:  $sql = INSERT INTO xsm_membergames(Game_id,Member_id)  VALUES(' . mysql_real_escape_string((int)$_POST[Game_id])) . ',' . mysql_real_escape_string((int)$_POST[Member_id])) . ');  break;  }  break; 
My concern is did I achieve anything with the code I just added to declare the variables? Is it actually being passed to this:  case addmember:  switch ($_GET['type']) {case membergame:  $sql = INSERT INTO xsm_membergames(Game_id,Member_id)  VALUES(' . mysql_real_escape_string((int)$_POST[Game_id]) . ',' . mysql_real_escape_string((int)$_POST[Member_id]) . ');  break;  }  break; 
I did add this and tested it on my server and I didnt recieve any errors. So how can I be sure its doing what I intended? 
_

See what you’re getting into…before you go there
http://newlivehotmail.com/?ocid=TXT_TAGHM_migration_HM_viral_preview_0507



Your code is not formatted very nicly in your mail which makes it very
hard to read, but it's also invalid. There is a case statement in there
without a switch to control it twice.


That being the case the fact that you didn't get any errors indicates 
that you have PHP configured to not show errors, warnings and notices. I 
strongly recommend you modify your php.ini and set display_errors to on 
and error_reporting to E_ALL. Then restart your web server and try your 
script again. You should then see lots of errors.


-Stut

--
http://stut.net/

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



Re: [PHP] PHP eval() fatal error

2007-08-20 Thread Stut

Maarten Balliauw wrote:
Here's the thing: I'm trying to do some dynamic code compilation within 
PHP using eval(). The code I'm trying to compile raises an E_ERROR (Fatal).


Here's a simple example:

?php
$code = '  $returnValue = 12*A+;  '; // Clearly incorrect code :-)
$returnValue = 0;

eval($code);
?

Now, I'd like to catch the error made by eval:

// ...
try {
  eval($code);
} catch (Exception $ex) {
  var_dump($ex);
}
// ...

Problem persists: a fatal error occurs.
Using set_error_handler() and set_exception_handler() is not working 
either...


Is there any way to gracefully catch this error?


Fatal errors are exactly that... fatal. You cannot catch them or recover 
from them.


Your best option is to shell out another PHP process, capture the output 
and parse that for error messages.


-Stut

--
http://stut.net/

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



Re: [PHP] getting from one table listing from another

2007-08-19 Thread Stut

tedd wrote:

At 6:12 PM -0500 8/18/07, Jay Blanchard wrote:

[snip]
I know this is kinda crazy but I need it :P
I have one table that lists name's
and I have another table that has the name's and points
I want to know how to list the name's of the first table by the points
of the second table
[/snip]

Not crazy, pretty standard from a database point of view;

SELECT a.name, b.points
FROM table a LEFT OUTER JOIN table b
ON(a.name = b.name)

This only works if the name in table a matches a name in table b.


Then why use a JOIN? It's my understanding that JOINs are used to 
included unmatched rows -- am I wrong?


Wouldn't this be simpler?

SELECT a.name, b.points
FROM table_name a, table_name_points b
WHERE a.name = b.name

Besides, all that JOIN stuff makes my head hurt.


Maybe so, but what you've done there is an implicit join. I'd recommend 
you learn as much as you can about join operations - they can make life 
a lot easier and more efficient.


-Stut

--
http://stut.net/

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



Re: [PHP] for loop inside a switch

2007-08-16 Thread Stut

Hulf wrote:

Hi,

switch ($q) {

for ($i=0; $i 21; $i++) {
case 'faq$i':
echo $faq1;
break;
 }
}


I just want to loop out a big long list of cases.


That's not a valid construct, but if I understand what you're trying do, 
this should work...


$faqs = array();
for ($i = 0; $i  21; $i++)
$faqs[] = 'faq'.$i;
if (in_array($q, $faqs))
echo $faq1;

-Stut

--
http://stut.net/

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



Re: [PHP] XMLRPC and file_get_contents

2007-08-16 Thread Stut

Andreas Schlicker wrote:

Hi all,

I'm writing an XML-REC client in PHP, based on the following example:

?php
$request = xmlrpc_encode_request(method, array(1, 2, 3));
$context = stream_context_create(array('http' = array(
'method' = POST,
'header' = Content-Type: text/xml,
'content' = $request
)));
$file = file_get_contents(http://www.example.com/xmlrpc;, false, 
$context);

$response = xmlrpc_decode($file);
if (xmlrpc_is_fault($response)) {
trigger_error(xmlrpc: $response[faultString] ($response[faultCode]));
} else {
print_r($response);
}
?

If the XMLRPC call takes longer than say 30 seconds, the 
file_get_contents method doesn't returns null, and the script finishes. 
However, the XMLRPC server is not finished with the computation and gets 
a broken pipe since the client has  already closed the connection.


Is there some timeout? Am I doing something wrong?


There could be several timeouts at work here. First you can set a 
timeout in the context[1]. Second the PHP request time limit[2]. And 
finally your web server (assuming this is running through a web server) 
will have its own timeout - check the documentation for whatever server 
you're using for details.


[1] http://php.net/wrappers.http
[2] http://php.net/set_time_limit

-Stut

--
http://stut.net/

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



Re: [PHP] test for multi-dim array

2007-08-16 Thread Stut

John Pillion wrote:

I'm trying to recursively loop through a multi dimensional array with
unknown keys and unknown values, and echo the keys/values to a sql
statement, where the key is the field, and the value is the. value.

What I want to do is test an array index to see if it has any children
indices (which then need to be looped through again), or if it is the lowest
level child. in which case, the data needs to be extracted.

What is the easiest way to test an array index to see if it has one or more
children? Just doing a count() isn't reliable, as their may only be a single
parent on the highest level.


A combination of is_array and count should be enough.

-Stut

--
http://stut.net/

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



Re: [PHP] QuickTime question

2007-08-15 Thread Stut

tedd wrote:

Given:

http://www.webbytedd.com/bb/ice/

How can I play the movie inside the page instead of going to another page?

I know that I could use phpclasses, but that seems an overkill.

I think something like this --

$file_source = 'ice-fishing.mov';
$size = filesize($file_source,,);

header('Pragma: public');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: must-revalidate, pre-check=0, post-check=0, 
max-age=0');

header('Content-Transfer-Encoding: none');
header(Content-type: video/quicktime);
header(Content-Length:  . $size);

-- but it's falling short.


Something like this...

object classid=clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B 
codebase=http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0; 
height=153 width=321

  param name=src value=ice-fishing.mov
  param name=controller value=true
  param name=autoplay value=true
  embed src=ice-fishing.mov 
pluginspage=http://www.apple.com/quicktime/download/; controller=true 
autoplay=true height=153 width=321

/object

I'm sure there are lots of tutorials on the web regarding the details - 
I just nicked this code from 
http://www.apple.com/trailers/fox/thesimpsonsmovie/trailer1_small.html


-Stut

--
http://stut.net/

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



Re: [PHP] QuickTime question

2007-08-15 Thread Stut

tedd wrote:

At 4:32 PM +0100 8/15/07, Stut wrote:

tedd wrote:

Given:

http://www.webbytedd.com/bb/ice/

How can I play the movie inside the page instead of going to another 
page?


I know that I could use phpclasses, but that seems an overkill.

I think something like this --

$file_source = 'ice-fishing.mov';
$size = filesize($file_source,,);

header('Pragma: public');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: must-revalidate, pre-check=0, post-check=0, 
max-age=0');

header('Content-Transfer-Encoding: none');
header(Content-type: video/quicktime);
header(Content-Length:  . $size);

-- but it's falling short.


Something like this...

object classid=clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B 
codebase=http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0; 
height=153 width=321

  param name=src value=ice-fishing.mov
  param name=controller value=true
  param name=autoplay value=true
  embed src=ice-fishing.mov 
pluginspage=http://www.apple.com/quicktime/download/; 
controller=true autoplay=true height=153 width=321

/object

I'm sure there are lots of tutorials on the web regarding the details 
- I just nicked this code from 
http://www.apple.com/trailers/fox/thesimpsonsmovie/trailer1_small.html


-Stut


-Stut:

That certainly works, --

http://www.webbytedd.com/bb/ice1/

-- but I was hoping for something in the php realm.


I'm confused. What do you mean by inside the page?

If you mean the embedded full-page Quicktime player that you sometimes 
get, that's a browser configuration issue and you'll never be able to 
control it for everyone, if anyone.


I'm not clear why you want a solution in the php realm? Use the right 
tool for the job and life becomes easier.


-Stut

--
http://stut.net/

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



Re: [PHP] XML editors

2007-08-15 Thread Stut

Al wrote:

What do you guys use for casual XML editing, besides plain text editors?

Ones that'll error check and allow fixing files with errors?

Thanks...


I tend to use Visual Studio for this sort of thing since I usually have 
it open anyway.


-Stut

--
http://stut.net/

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



Re: [PHP] XML editors

2007-08-15 Thread Stut

I assume this comment was aimed at the list and not just me.

Kelvin Park wrote:

Stut wrote:

Al wrote:

What do you guys use for casual XML editing, besides plain text editors?

Ones that'll error check and allow fixing files with errors?

Thanks...


I tend to use Visual Studio for this sort of thing since I usually 
have it open anyway.


-Stut


eclipse + with the latest web plugin


-Stut

--
http://stut.net/

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



Re: [PHP] apache content negotiation and $_GET

2007-08-13 Thread Stut

Per Jessen wrote:

Tijnema wrote:


This has nothing to do with PHP, and there's only a very little chance
you get a successfull result here.
Your Apache type-map probably just doesn't take the $_GET variables
with it,


Yeah, that is possible - I was wondering whether to blaim PHP or Apache. 
I just thought there was litte risk of apache throwing away the
querystring during content-negotiation.  


I can tell that the $_SERVER[query-string] variable is not set when
using the type-map, but it when I go straight to a specific file.  That
does seem to suggest apache is at fault.


Actually it suggests exactly that. Apache is giving PHP the query 
string, and PHP does nothing to it before it puts it in the $_SERVER 
variable. So this basically means that when you use the type-map Apache 
is not populating the query string variable.


In short, I'm 5-9's% certain it's Apache that's throwing it away.

-Stut

--
http://stut.net/

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



Re: [PHP] phpinfo problem

2007-08-13 Thread Stut

Rick Knight wrote:

Thanks Chris,

That was the problem. Is this new php5? I've used 3 prior php4 version 
and didn't have this problem.


The default value for short_open_tags was flipped a while back. Might I 
suggest you read the changelog next time you upgrade to a newer version 
- it tells you important stuff like that.


-Stut

--
http://stut.net/


Chris wrote:
You probably just have short_open_tags set to Off in your php.ini 
file. If so, either turn it On, or change the file to be:


?php phpinfo(); ?

Chris

Rick Knight wrote:
I have just installed PHP-5.2.3 on my Kubuntu Feisty box. I removed 
all the debian php first and then compiled php with the options I 
needed. Now everything seems to be working except phpinfo.php which 
consists of one line.


? phpinfo(); ?


I get a blank screen.

If I delete the php.ini file it get the usual phpinfo output.

php -r phpinfo(); works as does php -i and my php scripts run fine. 
What would cause phpinfo.php to not work? It's set rw for the apache2 
user so I think the permissions are right. Is there a phpinfo 
enable/disable in the php.ini? Or in ./configure?


Thanks.
Rick Knight







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



Re: [PHP] question about note on php.net

2007-08-12 Thread Stut

brian wrote:

Michael Cooper wrote:

Hello, I have a question--is the note from equazcion here correct? It
is left unchallenged on the page but I can't see how it is correct 
since I am under the impression that the environment is refreshed each 
page load and the function or method definitions (including those for 
session_set_save_handler) would need to be re-established each page, 
not each session.  I am having tremendous difficulty debugging some 
code I wrote and eliminating my uncertainty regarding this point would 
be greatly helpful.  Any advice would be appreciated. Thanks!


Because i'm already procrastinating ...

google site:php.net equazcion

http://www.php.net/session_set_save_handler

wherein:


equazcion
10-Mar-2007 02:44
I know this might be obvious, but session_set_save_handler() should
only be called once per session, or else your saved data will keep
getting reset.

If your script doesn't have a predictable start page that will only
be called only once per session, place the session_set_save_handler
statement in an include file, and call it via require_once().


I doubt that this is correct. The save handler that is being set is not, 
in itself, a part of the session, but a function that is to be used to 
act upon the session. That is, there isn't anything inherent to the 
session in the function. Thus, it wouldn't be saved as *a part of* the 
session. It's just a handler. It's not as if the function, itself, were 
a container for the session vars.


Looking at the source in head for that function[1] it would appear to 
fail if a session has already been started, in which case equizcion's 
comment would be wrong.


If the OP is concerned about it I suggest they try it and see what happens.

-Stut

[1] http://lxr.php.net/source/php-src/ext/session/session.c#1473

--
http://stut.net/

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



Re: [PHP] What's is the needed configuration to enable SOAP?

2007-08-12 Thread Stut

Brice wrote:

I have a little problem with Soap. I programmed a script which works
well on all server except one. I had an 'HTTP Error : Couldn't open
socket connection to server' Too bad for me it's the main one.

I wonder if  there is a configuration problem? I just saw that socket
is disabled on the main server. Is soap extension needs to enable
socket? Google and php documentation said nothing about that.


Just a guess, but maybe it's slightly within the realms of possibility 
that the server cannot make a connection to the other server for some 
network-related reason. Are you sure that server has a route to the 
server it's trying to talk to? No firewalls in the way? Is the target 
server working properly?


If you were missing a component required for your code to work PHP would 
tell you that. The error you're getting simply indicates that it cannot 
make a connection to the target server.


-Stut

--
http://stut.net/

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



Re: [PHP] very strange behavior.... incomplete query performed

2007-08-12 Thread Stut

Tijnema wrote:

On 8/12/07, Alain Roger [EMAIL PROTECTED] wrote:

Hi,

I'm still working on importing CSV file content (20.000 records) to database
PostgreSQL.

when i run the query, once i stored into my table  5218 records, another
time 5231 another time 4713 and so on
every time the amount of records imported to DB is different.

Do you have any idea from where it could come ?

Here is my PHP code :


snip

thanks a lot for any help.


--
Alain


Might it be that your script times out?
try setting the time limit to unlimited:
set_time_limit(0);

Apache (or w/e your server is) might still timeout, but these values
are a lot higher.. :)


And if that is the case I would strongly recommend that you turn 
display_errors on and set error_reporting to E_ALL, at least for that 
script or if this is a development server do it in php.ini.


-Stut

--
http://stut.net/

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



Re: [PHP] php.ini of PHP 5.2.3

2007-08-11 Thread Stut

Alain Roger wrote:

I have a stupid problem.
At work i installed the PHP 5.2.1 and it works fine.
i uncomment extension = php_opensll and i see that extension is activated
because phpinfo show me information about such extension.

However, at homw i've just installed PHP 5.2.3 and i did the same as at work
but i'm not able to get any table information about openssl via phpinfo();
function.

could you help me please ?


OpenSSL requires a DLL file to be in the path on Windows. From the 
manual page (http://php.net/openssl)...


Note to Win32 Users:  In order for this extension to work, there are 
DLL files that must be available to the Windows system PATH. See the FAQ 
titled How do I add my PHP directory to the PATH on Windows for 
information on how to do this. Although copying DLL files from the PHP 
folder into the Windows system directory also works (because the system 
directory is by default in the systems PATH), it is not recommended. 
This extension requires the following files to be in the PATH: libeay32.dll


-Stut

--
http://stut.net/

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



Re: [PHP] preg_match_all to match img tags

2007-08-11 Thread Stut

Tijnema wrote:

On 8/11/07, Richard Heyes [EMAIL PROTECTED] wrote:

Richard Heyes wrote:

How can i match an image tag correctly so it does not cause any issues
with how the user adds the image.

preg_match_all('/img[^]*/Ui');

Off the top of my head. This wouldn't allow for using the right angle
bracket in the img tag, but that's almost never going to happen in reailty.

Oops that should be:

preg_match_all('/img[^]*/Ui', $input, $matches);

--
Richard Heyes


 img src=image.jpg

Your script doesn't catch above ;)


That's not valid HTML and won't get displayed correctly in most browsers.

-Stut

--
http://stut.net/

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



Re: [PHP] question about note on php.net

2007-08-11 Thread Stut

Michael Cooper wrote:

Hello, I have a question--is the note from equazcion here correct?  It is left 
unchallenged on the page but I can't see how it is correct since I am under the 
impression that the environment is refreshed each page load and the function or 
method definitions (including those for session_set_save_handler) would need to 
be re-established each page, not each session.  I am having tremendous 
difficulty debugging some code I wrote and eliminating my uncertainty regarding 
this point would be greatly helpful.  Any advice would be appreciated. Thanks!


Erm, what note where on php.net?

-Stut

--
http://stut.net/

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



Re: [PHP] string as file

2007-08-10 Thread Stut

Robert Cummings wrote:

On Fri, 2007-08-10 at 16:28 +0100, Stut wrote:

Rick Pasotto wrote:

On Fri, Aug 10, 2007 at 02:19:29PM +0100, Stut wrote:

Rick Pasotto wrote:

On Thu, Aug 09, 2007 at 03:25:27PM -0500, Greg Donald wrote:

On 8/9/07, Rick Pasotto [EMAIL PROTECTED] wrote:

Does php have a facility similar to python's stringIO?

What I'm wanting to do is similar to a mail merge. IOW, I know I can
create an include file like:

$out = EOT
This is an example of $var1 and $var2.
EOT;

and then after assigning values to $var1 and $var2 include that
file. I can later use different values for $var1 and $var2 and get a
different $out with a second include.

eval()

Explain.
One word responses really don't do any good.
Exactly *what* would be the argument to eval()?

RTFM, that's what it's there for.

I did. That's why I rejected the use of eval() before I posted the
message. eval() is totally unsuitable for what I want. Unless, that is,
you or Greg can explain how using eval() will get me what I want.

I think that neither you nor Greg understands what I'm looking for.

Instead of simply stating 'RTFM' perhaps *you* should RTFQuestion.

Your original post asked...

Can I someout include a string instead of a file?

That's exactly what eval does. As for what you would pass to it... PHP 
code maybe? Have you even tried it? The manual page for eval has several 
examples of how to use it, and the comments have even more.



Incidentally, eval is evil and potentially a giant security hole.
You'd be better off doing replacements with preg_match rather than
executing a string.

Agreed. That's another reason I had already rejected it. Although in
this case, since I would have full control of all the variables, it
would probably be ok.
Use regular expressions or straight string replacements - that's the 
best way to implement mail-merge type behaviour. Personally I used 
preg_replace with the 'e' modifier. For an example see, shockingly, the 
manual page for preg_replace.


Now go stick your head in a pig.


Spider-Pig, Spider-Pig, does whatever a Spider-Pig does...

:) I love Fridays!!


It's Friday? Gawdammit!

-Stut

--
http://stut.net/

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



Re: [PHP] Friday morning brain farts....

2007-08-10 Thread Stut

Daniel Brown wrote:

On 8/10/07, Stut [EMAIL PROTECTED] wrote:

If PHP thinks something might be wrong it will tell you. Why on earth
would you want to ignore it? You think you're smarter than PHP? Really?


Okay, Stut, let's not make Friday the official Flame Dan Brown
holiday this week.  I vote that it should be later in the year.

However, it should also be noted that my development is never done
on a production server attached to the Internet, for one; and on my
development machine, E_NOTICE is always enabled.  I just fail to see
the benefit in alerting visitors to the site that there may have been
something overlooked at some point.


Whoa there nelly, that's a whole other thing.

I've never said users get to see notices. They never see warnings or 
errors. That's what the display_errors and log_errors options in php.ini 
are for. On my production servers error_reporting is set to E_ALL, 
display_errors is off and log_errors is on. I get an email from each 
server containing the contents of the error log from the previous day 
and my first task each day is to go through that and track down any 
issues that usage has highlighted.


-Stut

--
http://stut.net/

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



Re: [PHP] Getting a 'newline' out of a string

2007-08-10 Thread Stut

Faither wrote:
I'm kind of lost with how str_replace , preg_replace, ereg_replace or 
even explode are handling a \n-ewline.


I have a text string from a form and am trying to replace the \n or 
chr(10) or however you might call the newline with a simple html break tag.


If I use the replacing functions I get the br-tags where there are 
newlines from the textarea of the form. BUT I still have the newlines 
remain.


So I tried a different approach breaking the text down into an array using:
 explode(' ', $string)
in conjunction with trim() and again made a string out of the array. - 
br-tags still there, newlines aswell -.-'


Next thing I tried was exploding the string using the \n and chr(10).
This function ignored all newlines and gave me an array with one key and 
the entire text of the textarea as value Oh... and the newlines of 
course were there aswell...


So... How can I get rid of these?! - I just want them gone!

Is it even possible under windows? ^^


First of all look at http://php.net/nl2br which does exactly what you're 
trying to do.


Second try this...

$string = str_replace(\r\n, 'br /', $string);
$string = str_replace(\n, 'br /', $string);

-Stut

--
http://stut.net/

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



Re: [PHP] Running a server process

2007-08-10 Thread Stut

Tijnema wrote:

On 8/10/07, Stut [EMAIL PROTECTED] wrote:

Tijnema wrote:

On 8/10/07, Stut [EMAIL PROTECTED] wrote:

Tijnema wrote:

On 8/10/07, Richard Heyes [EMAIL PROTECTED] wrote:

That is it works with just me using the site.  I am wondering how this would
effect performance if say 500 people were executing this php function around
the same time and the processing overlapped.  Is there anyway to make an
executable run as a service, I am guessing at the terminology that I should
use here, but I feel there would be a much more efficient way of performing
this task.

Well, ideally you don't run an executable. But if you must, there's some
Windows program that turns an executable into a service. But then
there's the consideration of communicating with it, which you could do
with sockets. Or you could use a file.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

I don't know if there a program exists that can convert the program
to a service, I think you need to compile it as a service from source
code, but as I mentioned in my first post, and you mentioned here too,
you also need to add support for a socket server in your program.
Sockets in PHP are easy ;)

http://www.firedaemon.com/

But you're right, you'd need a way to communicate with the service.

-Stut

Well stut, this doesn't really run your program as a service.
The program itself is a server, and simply starts every program when
that service starts. That's not the same as running the program as a
service.

That's extremely pedantic. As a service simply means it responds to
messages from the OS such as start, pause and stop. Firedaemon wraps
your executable in a process that does just that. So technically you're
correct, it doesn't turn your executable into a service, it wraps it in
one, but the effect is essentially the same.

If you need the extra control you'll get over it by rewriting your
executable to actually be a service then you should do that. But if
you're working with something you don't have the source for, or don't
have the time to implement such a modification then Firedaemon is the
best option I've come across.

-Stut


Yes, but if you don't have the source, you can't add socket support,
and then you can do quite less with a program... Unless you already
have socket support in the program, but that seems quite odd to me ;)


 Sockets aren't the only IPC mechanism available. And besides, I was 
countering your general statement regarding Firedaemon, not the 
applicability of Firedaemon to the OP's problem, which we can't comment 
on without knowing a lot more information about it.


-Stut

--
http://stut.net/

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



Re: [PHP] Running a server process

2007-08-10 Thread Stut

Tijnema wrote:

On 8/10/07, Stut [EMAIL PROTECTED] wrote:

Tijnema wrote:

On 8/10/07, Richard Heyes [EMAIL PROTECTED] wrote:

That is it works with just me using the site.  I am wondering how this would
effect performance if say 500 people were executing this php function around
the same time and the processing overlapped.  Is there anyway to make an
executable run as a service, I am guessing at the terminology that I should
use here, but I feel there would be a much more efficient way of performing
this task.

Well, ideally you don't run an executable. But if you must, there's some
Windows program that turns an executable into a service. But then
there's the consideration of communicating with it, which you could do
with sockets. Or you could use a file.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

I don't know if there a program exists that can convert the program
to a service, I think you need to compile it as a service from source
code, but as I mentioned in my first post, and you mentioned here too,
you also need to add support for a socket server in your program.
Sockets in PHP are easy ;)

http://www.firedaemon.com/

But you're right, you'd need a way to communicate with the service.

-Stut


Well stut, this doesn't really run your program as a service.
The program itself is a server, and simply starts every program when
that service starts. That's not the same as running the program as a
service.


That's extremely pedantic. As a service simply means it responds to 
messages from the OS such as start, pause and stop. Firedaemon wraps 
your executable in a process that does just that. So technically you're 
correct, it doesn't turn your executable into a service, it wraps it in 
one, but the effect is essentially the same.


If you need the extra control you'll get over it by rewriting your 
executable to actually be a service then you should do that. But if 
you're working with something you don't have the source for, or don't 
have the time to implement such a modification then Firedaemon is the 
best option I've come across.


-Stut

--
http://stut.net/

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



Re: [PHP] string as file

2007-08-10 Thread Stut

Rick Pasotto wrote:

On Fri, Aug 10, 2007 at 02:19:29PM +0100, Stut wrote:

Rick Pasotto wrote:

On Thu, Aug 09, 2007 at 03:25:27PM -0500, Greg Donald wrote:

On 8/9/07, Rick Pasotto [EMAIL PROTECTED] wrote:

Does php have a facility similar to python's stringIO?

What I'm wanting to do is similar to a mail merge. IOW, I know I can
create an include file like:

$out = EOT
This is an example of $var1 and $var2.
EOT;

and then after assigning values to $var1 and $var2 include that
file. I can later use different values for $var1 and $var2 and get a
different $out with a second include.

eval()

Explain.
One word responses really don't do any good.
Exactly *what* would be the argument to eval()?

RTFM, that's what it's there for.


I did. That's why I rejected the use of eval() before I posted the
message. eval() is totally unsuitable for what I want. Unless, that is,
you or Greg can explain how using eval() will get me what I want.

I think that neither you nor Greg understands what I'm looking for.

Instead of simply stating 'RTFM' perhaps *you* should RTFQuestion.


Your original post asked...

Can I someout include a string instead of a file?

That's exactly what eval does. As for what you would pass to it... PHP 
code maybe? Have you even tried it? The manual page for eval has several 
examples of how to use it, and the comments have even more.



Incidentally, eval is evil and potentially a giant security hole.
You'd be better off doing replacements with preg_match rather than
executing a string.


Agreed. That's another reason I had already rejected it. Although in
this case, since I would have full control of all the variables, it
would probably be ok.


Use regular expressions or straight string replacements - that's the 
best way to implement mail-merge type behaviour. Personally I used 
preg_replace with the 'e' modifier. For an example see, shockingly, the 
manual page for preg_replace.


Now go stick your head in a pig.

-Stut

--
http://stut.net/

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



Re: [PHP] help with ming library

2007-08-10 Thread Stut

Diana wrote:

How do I install the ming library on windows??
I copied the php_ming.dll that I had on another computer and enabled 
this line in php.ini extension=php_ming.dll

but I still get that error Call to undefined function Ming_setScale()


Have you restarted your web server (Apache, IIS, whatever) since 
changing php.ini?


-Stut

--
http://stut.net/

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



Re: [PHP] Friday morning brain farts....

2007-08-10 Thread Stut

Robert Cummings wrote:

On Fri, 2007-08-10 at 11:48 -0400, Daniel Brown wrote:

On 8/10/07, Stut [EMAIL PROTECTED] wrote:

 I get an email from each
server containing the contents of the error log from the previous day
and my first task each day is to go through that and track down any
issues that usage has highlighted.

That's actually a good point there that I can take away from this.
 I actually don't have anything set to send me a log of code issues,
only when an error is caused (and, of course, anything server-related,
but that's a different point entirely).


Simple enough... put the following in a file, and add a cron job.

#!/usr/bin/php -qC
?php

if( !isset( $argv[1] ) || !isset( $argv[2] ) || !isset( $argv[3] ) )
{
echo Usage: {$argv[0]} subject email path\n;
exit( 1 );
}

$subject = $argv[1];
$email   = $argv[2];
$path= $argv[3];

$content = implode( '', file( $path ) );

if( trim( $content ) === '' )
{
$content = 'NO ERRORS TODAY!!!';
}

mail( $email, $subject, $content );

?


I used to have something similar to this until someone uploaded a script 
that started writing to the error log like mad. Overnight my poor little 
script tried to load a 240meg log file into memory and email it to me. I 
now use a simple bash script that pipes the log to the mail command - 
much safer.


Should probably say that it also renames the log file, graceful's 
Apache, zips the old log and moves it to an archive file server. Rob's 
script above, used without something that starts a new log will result 
in ever-increasing emails.


-Stut

--
http://stut.net/

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



Re: [PHP] Friday morning brain farts....

2007-08-10 Thread Stut

Daniel Brown wrote:

On 8/10/07, Robert Cummings [EMAIL PROTECTED] wrote:

I never disable E_NOTICE or even E_STRICT.


I'm humbled in the presence of greatness.

I do my best to ensure that there are no notices or warnings, but
I still disable E_NOTICE in general, because I know that it's not
going to end the world.


Do your best? If you set out with the goal of not allowing your sites to 
generate notices it's no harder than ignoring them. The benefits far 
outweigh the minimal cost.


I must admin that a couple of sites I've been involved with over the 
years have run with notices ignored, but that's only because they 
consisted of large amounts of code that had been written without any 
regard for them. Of all the sites I've worked on those were some of the 
worst.


If PHP thinks something might be wrong it will tell you. Why on earth 
would you want to ignore it? You think you're smarter than PHP? Really?


-Stut

--
http://stut.net/

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



Re: [PHP] Friday morning brain farts....

2007-08-10 Thread Stut

Daniel Brown wrote:

On 8/10/07, Stut [EMAIL PROTECTED] wrote:

Bad Dan *slap*. Ignoring notices may be detrimental to your health
and/or well-being. Better to initialise it with a default if it has not
been set in the request.

if (!isset($_GET['order'])) $_GET['order'] = 'Last';


Ouch!

So you're all going to tell me that you have E_NOTICE set to
report on your sites?  Look, I didn't say it was the Right Way[tm],
but it is safe to ignore.


I do indeed. E_NOTICE can help find certain bugs faster than any other 
method I've found. Turning them off is both lazy and dangerous.


-Stut

--
http://stut.net/

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



Re: [PHP] Friday morning brain farts....

2007-08-10 Thread Stut

Daniel Brown wrote:

On 8/10/07, Jason Pruim [EMAIL PROTECTED] wrote:

Hi All :)

Hope you're not getting sick of my questions as of late, but I keep
getting closer and closer and thank you all who have helped me in the
past! The only reason I can see this far is I am standing on the
shoulders of giants don't know who said that but I like it :)

Anyway... Onto the question...

I think I'm just going crazy as it's been a busy week for me, but I
can't figure out how to do this. What I am attempting to do is, I
have a webpage(Don't we all?) that calls info to be displayed from a
database,

I want to be able to sort that info so my sql query looks like:
Select * from current order by '$order'; and $order is populated by
a GET when they click on a link: A href=index.php?order='Last'Sort
by last name/A  Now... the whole PHP page is being included in
a .shtml page to actually display it and make it look purrdee :)

How do I get it to resort the info and include the new sort on the page?

I'm not sure if this has anything to do with it but:

$order = $_GET['order']; --Line 6

[Fri Aug 10 10:42:04 2007] [error] PHP Notice:  Undefined index:
order in /Volumes/RAIDer/webserver/Documents/tests/legion/index.php
on line 6

Any help will be greatly appreciated.. And if it solves the problem
I'll name some of my kids* after you!



*Subject to approval of the Wife :)

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]





Remember to clean that input before you sit down at the table, there, boy!

It's safe to ignore the `Undefined index` notices.  That will just
appear if a variable is referenced without first being instantiated or
defined.  No biggie, just put this at the head of your code:

ini_set(error_reporting,E_ALL  ~E_NOTICE);


Bad Dan *slap*. Ignoring notices may be detrimental to your health 
and/or well-being. Better to initialise it with a default if it has not 
been set in the request.


if (!isset($_GET['order'])) $_GET['order'] = 'Last';

-Stut

--
http://stut.net/

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



Re: [PHP] manual vs. meta refresh

2007-08-10 Thread Stut

Kevin Murphy wrote:
I doubt this, but is there any way to determine via PHP if a browser was 
refreshed automatically via a META tag vs the person clicking the 
refresh button?


Add a GET variable to the URL you put in the meta tag to tell you it 
came from the meta tag.


P.S. Please note that my e-mail and website address have changed from 
wncc.edu to wnc.edu.


Then you might want to change the from address in your mail client!

-Stut

--
http://stut.net/

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



Re: [PHP] string as file

2007-08-10 Thread Stut

Rick Pasotto wrote:

On Thu, Aug 09, 2007 at 03:25:27PM -0500, Greg Donald wrote:

On 8/9/07, Rick Pasotto [EMAIL PROTECTED] wrote:

Does php have a facility similar to python's stringIO?

What I'm wanting to do is similar to a mail merge. IOW, I know I can
create an include file like:

$out = EOT
This is an example of $var1 and $var2.
EOT;

and then after assigning values to $var1 and $var2 include that
file. I can later use different values for $var1 and $var2 and get a
different $out with a second include.

eval()


Explain.

One word responses really don't do any good.

Exactly *what* would be the argument to eval()?


RTFM, that's what it's there for.

Incidentally, eval is evil and potentially a giant security hole. You'd 
be better off doing replacements with preg_match rather than executing a 
string.


-Stut

--
http://stut.net/

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



Re: [PHP] Import XLS file with UTF-8

2007-08-10 Thread Stut

Alain Roger wrote:

Hi,

So now i know how to import the content of the CSV file to database,
however, before to import to database i do a simple test.
in fact, i display in my browser all content of my CSV file.

unfortunately, not all characters are displayed correctly.
in PHP page include meta http-equiv=Content-Type content=text/html;
charset=UTF-8 but it does not help to display the Slovak Characters which
are correctly display in EXCEL when i open the CSV file with it.
i tried to display a standar slovak web page in my browser and it works
perfectly well.

So where could be the problem ?


The Content-Type needs to match the file type, so if the file is not 
UTF-8 extended characters will not be displayed correctly when it's 
displayed as UTF-8.


Try removing that meta tag and see what the browser makes of the file by 
guessing.


-Stut

--
http://stut.net/

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



Re: [PHP] Running a server process

2007-08-10 Thread Stut

Tijnema wrote:

On 8/10/07, Richard Heyes [EMAIL PROTECTED] wrote:

That is it works with just me using the site.  I am wondering how this would
effect performance if say 500 people were executing this php function around
the same time and the processing overlapped.  Is there anyway to make an
executable run as a service, I am guessing at the terminology that I should
use here, but I feel there would be a much more efficient way of performing
this task.

Well, ideally you don't run an executable. But if you must, there's some
Windows program that turns an executable into a service. But then
there's the consideration of communicating with it, which you could do
with sockets. Or you could use a file.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk


I don't know if there a program exists that can convert the program
to a service, I think you need to compile it as a service from source
code, but as I mentioned in my first post, and you mentioned here too,
you also need to add support for a socket server in your program.
Sockets in PHP are easy ;)


http://www.firedaemon.com/

But you're right, you'd need a way to communicate with the service.

-Stut

--
http://stut.net/

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



Re: [PHP] Re: get domain component from email

2007-08-09 Thread Stut

Richard Lynch wrote:

On Wed, August 8, 2007 4:26 am, Stut wrote:

Completely agree. It's like banning someone from a pub based on the
clothes they were wearing the last time you saw them.


Yeah, one drunk abusive chick in a little black dress could get EVERY
gal in a little black dress banned.

That's pretty messed up.

:-)


Messed up? That would be a disaster. It could happen to hot pants too!

-Stut

--
http://stut.net/

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



Re: [PHP] I know this is not easy and I'm not stupid but...

2007-08-09 Thread Stut

Phil Curry wrote:
how can this be? This is not the first time I've run into a situation 
like this. What am I missing?


line 102echo  ($userValues['afterDark']); // outputs 1

line 103if ( $userValues['afterDark'] == 0 ) {// passes


Add a line at 102.5...

var_dump($userValues['afterDark']);

What type is that variable?

-Stut

--
http://stut.net/

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



Re: [PHP] Access parent property from child

2007-08-09 Thread Stut

Suprie wrote:

function getDB()
{
return $this-$db;
}


There should not be a $ before db. It should be $this-db. That's why 
PHP is telling you the property is empty... because it is.


-Stut

--
http://stut.net/

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



Re: [PHP] Segmentation fault on PHP CLI

2007-08-09 Thread Stut

Martin Marques wrote:
I have a script which I run from cron. I'm testing it directly from the 
console:


/usr/bin/php  -f /path/to/script.php

The thing is:

Script executes great, and everything it has to do gets done, but it 
throughs a segmentation fault at the end.


Is there anyway to debug PHP CLI? I'm using php5 from debian etch:

$ php -v
PHP 5.2.0-8+etch7 (cli) (built: Jul  2 2007 21:46:15)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies

BTW: all this is on the development server. On the production server the 
cron runs without this problem.


Is PHP on the production server the same old version? I would start by 
upgrading your development server to the latest version as you may be 
hitting a known bug that's already been fixed.


-Stut

--
http://stut.net/

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



Re: [PHP] I know this is not easy and I'm not stupid but...

2007-08-09 Thread Stut

Please include the list when replying.

Phil Curry wrote:

Phil Curry wrote:
how can this be? This is not the first time I've run into a situation 
like this. What am I missing?

line 102echo  ($userValues['afterDark']); // outputs 1
line 103if ( $userValues['afterDark'] == 0 ) {// passes


Add a line at 102.5...

var_dump($userValues['afterDark']);

What type is that variable?


Don't have to do a dump, I know its a tinyint(1), not null, default 0


That would be the type in the database, not the type of that variable at 
that time.


-Stut

--
http://stut.net/

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



Re: [PHP] Forwarding $_POST[]...

2007-08-09 Thread Stut

Tony Di Croce wrote:

I keep wanting to do something, and either I dont know how to do it, or I'm
doing something wrong and need to rethink things.

Quite often, I have a form that submits to a php script via POST and after
doing some processing (or more frequently, asking the user a question), I'd
like to forward those $_POST[] vars to another script (or even the same
script).


Sounds like an architectural issue to me. Think about why you want to do 
this. Can you not just include the other script rather than causing 
another HTTP request?



I could do something complicated and store the $_POST vars in $_SESSION[],
but what I'd rather do is simply add a var to $_POST[] and resubmit this to
the same .php.


Let me get this straight... you want to add a variable to the $_POST 
array and then re-run the current script? Put the functionality you need 
into a function and then use standard control structures (while, if, 
foreach, etc) to call it over and over again if necessary. There's 
absolutely no need to cause another HTTP request.



Is their any way to do this, or do I need to rethink things?


Rethink things. There's almost certainly a better way but without 
knowing why you think you need to do this it's not possible to help any 
further.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: get domain component from email

2007-08-08 Thread Stut

Richard Lynch wrote:

On Tue, August 7, 2007 6:21 pm, Stut wrote:

Kevin Waterson wrote:

I would like to prevent registration of emails from certain domains
that
abuse a forum. eg: foo.uy7f564d8d6d.com
These domains are registered by the thousands by spammers and
because they
use dyndns it is impossible to use an IP block.


You are also likely to screw up and end up banning legitimate users
who happen to use DynDns for perfectly valid reasons.


I don't think he meant DynDns the company, I think he just mean DHCP 
addresses.



I would suggest that you abandon trying to ban users based on domain,
or IP, and focus on their actual content/contributions
post-registration.

As a bonus, by banning users based on content and not email address,
you'll also catch those who use valid email addresses that you'd
never be able to rule out in any predictive sensible way.


Completely agree. It's like banning someone from a pub based on the 
clothes they were wearing the last time you saw them.


-Stut

--
http://stut.net/

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



Re: [PHP] get domain component from email

2007-08-08 Thread Stut

Daniel Brown wrote:

On 8/7/07, Richard Lynch [EMAIL PROTECTED] wrote:

On Tue, August 7, 2007 1:25 pm, Kevin Waterson wrote:

Im looking for a way to get the domain from an email address.
Not sub domains, just the domain, so
[EMAIL PROTECTED]
would return
example.com.mn

similarly, the address [EMAIL PROTECTED] would return
example.com

perhaps an array of tld's, then strip the tld off the end and anything
before that and the next . is the domain?

also, somebody told me .co.uk was a tld, but I cannot see it listed
http://www.iana.org/root-whois/index.html

I think you're in trouble...

The rules for what is or isn't a TLD have changed over time.

I did see a nice article the other day in the RFCs about some
pragmatic ways to do this right without killing yourself, or coding
something that's bound to break within a very short time.  Don't know
the RFC# offhand though, but I got the feeling that it was pretty
recent...

The LAST thing you want to do is hard-code the list of known TLDs from
today, because that will change too often.

.co.uk is a TLD, afaik...



My understanding was that .co.uk and like domains were still SLDs,
but where a TLD wasn't available for registration under the ccTLD
format for the respective country.


This is just terminology, but to make it clear... .co.uk is a ccTLD not 
an SLD and .uk is *not* a TLD. The IANA website has lots of info on this 
stuff.


-Stut

--
http://stut.net/

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



Re: [PHP] Why do I always come up with the hard stuff?

2007-08-07 Thread Stut

Jason Pruim wrote:
Yes I am hijacking a thread just to screw with all the people who use 
threaded e-mail viewers and because I'm mean like that :P


Figured since yall have to much time on your hands anyway I'd give you 
something else to gripe about... :)


Now... My question :)

?php
$mysqli = new mysqli(localhost, user, password, database);

/* check connection */
if (mysqli_connect_errno()) {
printf(Connect failed: %s\n, mysqli_connect_error());
exit();
}

printf(Host information: %s\n, $mysqli-host_info);

/* close connection */
$mysqli-close();
?

[Tue Aug  7 11:19:20 2007] [error] PHP Fatal error:  Trying to clone an 
uncloneable object of class mysqli in 
/Volumes/RAIDer/webserver/Documents/tests/legion/mysqli.php on line 2



What is wrong with line 2? The login info is correct since I use it to 
connect with the old mysql_connect stuff and it works just fine... What 
am I missing?


Are you trying to use mysqli with PHP4? Either way you can probably get 
rid of the error by putting an  between the = and the new.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: get domain component from email

2007-08-07 Thread Stut

Dan wrote:

yes co.uk is a tdl.


No it's not, it's a ccTLD which is a TLD specific to a country.

Kevin Waterson [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

Hi all.

Im looking for a way to get the domain from an email address.
Not sub domains, just the domain, so
[EMAIL PROTECTED]
would return
example.com.mn

similarly, the address [EMAIL PROTECTED] would return
example.com

perhaps an array of tld's, then strip the tld off the end and anything
before that and the next . is the domain?

also, somebody told me .co.uk was a tld, but I cannot see it listed
http://www.iana.org/root-whois/index.html


What are you actually trying to achieve?

-Stut

--
http://stut.net/

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



Re: [PHP] Re: get domain component from email

2007-08-07 Thread Stut

Jim Lucas wrote:

Dan wrote:
What are you trying to do exactly, maybe there's a better way.  If 
you're trying to determine if an email address is valid there's a 
pretty cool way to do so by using dns records.  It's like 5 lines, 
here's the site http://www.sitepoint.com/article/users-email-address-php


As far as actually just getting the domain, w/o subdomains from a 
string you could try this.  I'm not sure if the code runs because I 
haven't tested it, and I have been working exclusively with Delphi for 
a month so something might be off.


function getDomain($email)
{
list($userName, $mailDomain) = split(@, $email);
$anarray = split(., $mailDomain);
for ($i = 0; $i  count($anarray); $i++)
{
   if (in_array($anarray[$i], $TLDArray)) // if $anarray[$i] is a TDL 
then we move back 1 to get it's domain

   return $anarray[$i-1] . '.' . $anarray[$i];
}
}


As far as I can tell, this doesn't work at all.

Yours,

http://www.cmsws.com/examples/php/domain_verification/example2.php

Mine,

http://www.cmsws.com/examples/php/domain_verification/example.php


And yours is fatally flawed. Not all ccTLDs are sub-divided.

http://dev.stut.net/php/domain.php

http://stut.be/

-Stut

--
http://stut.net/

Kevin Waterson [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

Hi all.

Im looking for a way to get the domain from an email address.
Not sub domains, just the domain, so
[EMAIL PROTECTED]
would return
example.com.mn

similarly, the address [EMAIL PROTECTED] would return
example.com

perhaps an array of tld's, then strip the tld off the end and anything
before that and the next . is the domain?

also, somebody told me .co.uk was a tld, but I cannot see it listed
http://www.iana.org/root-whois/index.html

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



Re: [PHP] javascript in head or in body ?

2007-08-07 Thread Stut

Richard Davey wrote:

Tuesday, August 7, 2007, 9:52:28 PM, you wrote:


PHP is the absolute worst language to do any sort of OO programming
in.


Ignoring the digg user mentality of that statement, try ASP if you
want to see OO suck *royally*


ASP is not a language, it's most like a framework. I think you meant VB6.

-Stut

--
http://stut.net/

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



Re: [PHP] Re: get domain component from email

2007-08-07 Thread Stut

Jim Lucas wrote:

Stut wrote:

Jim Lucas wrote:

Dan wrote:
What are you trying to do exactly, maybe there's a better way.  If 
you're trying to determine if an email address is valid there's a 
pretty cool way to do so by using dns records.  It's like 5 lines, 
here's the site 
http://www.sitepoint.com/article/users-email-address-php


As far as actually just getting the domain, w/o subdomains from a 
string you could try this.  I'm not sure if the code runs because I 
haven't tested it, and I have been working exclusively with Delphi 
for a month so something might be off.


function getDomain($email)
{
list($userName, $mailDomain) = split(@, $email);
$anarray = split(., $mailDomain);
for ($i = 0; $i  count($anarray); $i++)
{
   if (in_array($anarray[$i], $TLDArray)) // if $anarray[$i] is a 
TDL then we move back 1 to get it's domain

   return $anarray[$i-1] . '.' . $anarray[$i];
}
}


As far as I can tell, this doesn't work at all.

Yours,

http://www.cmsws.com/examples/php/domain_verification/example2.php

Mine,

http://www.cmsws.com/examples/php/domain_verification/example.php


And yours is fatally flawed. Not all ccTLDs are sub-divided.


ok, too quick on the draw there.

one would have to be able to run a whois look up on the output to see if 
it fails or succeeds to be able to get the final verdict, but it would 
get you most of the way there.  :)


Indeed, your fixed version converts stut.co.uk (whose owner I 
periodically curse) to co.uk.


Which brings me back to my earlier question of why would you want to do 
this? I can't think of any reason, but then again it is getting late.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: get domain component from email

2007-08-07 Thread Stut

Jim Lucas wrote:
Are all domains that use ccTLD's created/formatted like other not 
ccTLD's just with the .uk or whatever tagged on the end?


Something like this

your example
stut.co.uk

is this the base for your domain.  Basically, would this be

stut.com if it were a dot.com  ??

or would it be something like...

stut.getyourfreesubdomains.com ??

I guess, this is my question.

When you registered that domain.

you registered stut.co.uk,  right?  or was it something else?


Unfortunately I didn't manage to snag stut.co.uk before Stu Turner did 
(grr), but yes, a .co.uk is top level as far as UK domains go. I 
cannot register stut.uk.


As I understand it, the IANA don't define what the sponsor can do with 
each ccTLD when they take control of it. Some, like .uk domains, split 
it up into smaller chunks (co.uk, org.uk, net.uk, etc). Others, like .it 
and .be are not split in that way.


Hope that answers your question.

-Stut

--
http://stut.net/

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



Re: [PHP] Echoing input w/o sanatizing - what is the danger

2007-08-07 Thread Stut

Dan wrote:
I've always heard it is bad if you let a user type some input, then show 
it back to them w/o sanatizing the code.  Eg. I have a form, where the 
user types something, they hit submit and it submits to itself then 
prints back to the user something like, account created with password: 
whatever they typed.


Why and how do you sanatize what they typed before echoing it back to 
them? I figured it was something like they could type in PHP commands 
but I tried typeing phpinfo(); into the box and submitting.  All that 
happened is that it echoed phpinfo();


Can someone explain this?


The main danger is Javascript. If a user can submit some Javascript to 
your site that it then outputs to other users you've got yourself one 
big security hole.


As for sanitizing content, the easy rule is to use htmlentities when you 
output it. That will effectively neutralise any HTML tags they've used, 
including scripts.


If you want to allow a subset of HTML then you need to be very careful 
because Javascript can be attached to any tag through events. There are 
plenty of resources on the web describing the various methods you can 
use to do it safely. I usually use a very restricted set of tags and 
strip anything else.


Finally make sure you test it thoroughly. Try entering every combination 
of invalid content you can, and also make sure you give it to the 
smartest friend you have to do the same - ideally someone who's had 
nothing to do with the development. Other people will always be more 
devious than you are when it comes to trying to break your code.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: get domain component from email

2007-08-07 Thread Stut

Kevin Waterson wrote:

This one time, at band camp, Stut [EMAIL PROTECTED] wrote:


Which brings me back to my earlier question of why would you want to do 
this? I can't think of any reason, but then again it is getting late.


I would like to prevent registration of emails from certain domains that
abuse a forum. eg: foo.uy7f564d8d6d.com
These domains are registered by the thousands by spammers and because they
use dyndns it is impossible to use an IP block.

Banning the subdomain is pointless as this is easily changed and they may
re-register.


In pseudo-PHP (i.e. untested)...

$banned = array('example.net', 'example.co.uk');
list(,$domain) = explode('@', $emailaddress, 2);
$banned = false;
foreach ($banned as $ban)
{
if ($domain == $ban ||
preg_match('|\.'.preg_quote($ban).'$|i', $domain))
{
$banned = true;
break;
}
}
if ($banned) die('Bad spammer. *slap*');

Far more efficient than trying to do what you asked for help with no 
matter how long your banned list gets.


-Stut

--
http://stut.net/

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



Re: [PHP] Problems in php

2007-08-07 Thread Stut

racol wrote:

Dear Sirs,
I have installed a Sambar 64 server and PHP 4.7 plus MySql. I connect 
through localhost and the PHPINFO.php file works OK on IE and Firefox. 
PHPINFO.php shows that the php.ini file is situated in C:/Windows as 
advised and I have altered the error_log and extensions_dir as advised 
by Sambar.

The problem is:
 
When I try to run a php file, either to connect to MySql OR just a 
simple Create Button file, neither browser will output either file. I 
get no error messages and the error logs show nothing significant. I 
just get the html source code (NONE of the php code) when I interrogate 
'view source' in IE and just a blank in Firefox.
 
Can you please advise. I don't know where to look next. I attach the two 
test files for your perusal.


You have an error in your code. Edit your php.ini and make sure 
display_errors is on and error_reporting is at least showing errors and 
warnings, and ideally notices too.


-Stut

--
http://stut.net/

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



Re: [PHP] Saving

2007-08-06 Thread Stut

Dan wrote:
Has anyone had to save the insance of a class which had a properties 
which were pointers?  I have a really simple class.  Just a few 
functions and a couple properties  variables.  But now I need to be 
able to save the class to a file.  Of course when you re-open the file 
the pointers will be useless.


I was thinking and the only way I came up with storing this to file 
would be to get the Name of the TTabSheets and the Text of the Node.  
That way when I read it back in I just have to search for those names in 
the PageControl and Tree by looping through and set those.  Although 
this would probably work it's probably not the best way to do it right?


TPage = class
 private
   pge: TTabSheet;
   par: TTabSheet;
   txt: String;
   show: Boolean;
   node: TTreeNode;
   function GetTab: TTabSheet;
   procedure SetTab(Tab: TTabSheet);
   function GetText: String;
   procedure SetText(text: String);
 public
   Constructor Create; overload;
   Constructor Create(pg: TTabSheet; text: String; pare: TTabSheet = 
nil; showProp: boolean = true); overload;

   property page: TTabSheet read GetTab write SetTab;
   property text: String read GetText write SetText;
 end;


That looks a lot like Delphi not PHP. I'm assuming that means you're 
using that freaky Delphi for PHP thing in which case you'll have better 
luck on their mailing list(s).


-Stut

--
http://stut.net/

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



Re: [PHP] How to implement a plugin system?

2007-08-06 Thread Stut

Hamza Saglam wrote:
Thanks for your response. However I am looking for something a bit more 
comprehensive :)


I could do it as you suggested if I had only a few plugins. As I am going to 
add loads of plugins over the time, rather than adding all the plugins one 
by one, could something like a 'loader' class be implemented? What I mean by 
that is, it will take the requested plugin names (with their own parameters 
necessary) and load/initialise them.


In semi-psuedo-code, it would be something like:

 foreach plugin suplied as the argument
   include the plugin
   initialise it
 end

Perhaps I should change the question to: Do you think something like this 
would be efficient and useable? If not what sort of pattern would you 
follow?


What you're describing is the Factory pattern, and yes that's the most 
efficient way to implement plugins. You should never load classes unless 
you need them - it's a complete waste of time, and definitely not 
recommended if you're going to have a lot of plugins.


I would suggest you name your plugins X_plugin, Y_plugin and Z_plugin 
(where plugin could be anything) because that adds a level of security. 
Otherwise you could open yourself up to security issues because the user 
could instantiate any class in your system.


-Stut

--
http://stut.net/

Borokov Smith [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

Hey Hamza,

require_once($chosenPlugin . '.class.php');

$obj = new $chosenPlugin();
return $obj;

And you can start from there.

hth,

boro



Hamza Saglam schreef:

Hello all,

I am working on a project which needs to have some sort of plugins
architecture and I am kinda stuck. Basically I want to give a list of
items to the user, and according to his/her selection, I want to load
relevant functionality into my application.


I was thinking of having an abstract plugin class, and have the
plugins implement that but then how would I actually load the plugins?
Say for instance I want to load plugins X,Y,Z (and lets say i
implemented them as [X|Y|Z].class.php) , should I just 'include' (or
require) them? Or should I initialize all possible plugins and just
pick the ones user has chosen (which sounds a bit pointless as it
would load unnecessary stuff)?


How would you go about doing something like this?


Thanks.






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



Re: [PHP] Adding to time having a timestamp

2007-08-05 Thread Stut

OOzy Pal wrote:

How can I add a day to a date if I have a timestamp. Here is my line:

list($d,$m,$y,$dayname,$monthname,$am)=explode(' ',date('d m Y D M a',
$timestamp));

Thank you in advance


$timestamp = $timestamp + 86400;

A timestamp is a number of seconds and there are 86400 seconds in a day.

-Stut

--
http://stut.net/

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



Re: [PHP] Premature Ajax-ulation

2007-08-03 Thread Stut

Jay Blanchard wrote:

One of my developers saw the following article;

http://arstechnica.com/news.ars/post/20070802-security-experts-warn-deve
lopers-about-the-risks-of-premature-ajax-ulation.html

How are you securing Ajax? I know that for the most part we send data to
a PHP script for processing, so all of the normal rules for sending that
data apply (mysql_real_escape_string(), etc.) 


Validation, validation, validation. The big danger with doing anything 
on the client-side is that it's all to easy to fall into blindly 
trusting what the client is giving you, even the smallest assumption can 
create a big hole in your app.


Don't assume events will happen the way you expect them to. Don't assume 
users won't be able to make requests just because your logic *should 
not* allow it.


In short, don't treat it any different to any other web application. 
There is no difference, you still need to do all the validation on every 
request whether it's AJAX or not.


-Stut

--
http://stut.net/

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



Re: [PHP] Downloading PHP 521

2007-08-03 Thread Stut

WyleySam wrote:
Exactly where does one go to download PHP 521, not 523, not 522 but 521??? 
Every link I clicked on at http://www.php.net/ took me to 523, which I don't 
want. 


http://museum.php.net/php5/

-Stut

--
http://stut.net/

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



Re: [PHP] OT- why is network solutions more than godaddy?

2007-08-03 Thread Stut

blackwater dev wrote:

I have to register a bunch of names and am trying to figure out why I would
pay $35 when I can just pay $9 at godaddy.  Does godaddy own it and I lease
it from them???


Network Solutions are expensive, GoDaddy are cheap. That's all there is 
to it. In my experience customer service from both can be pretty shoddy 
or excellent depending on the day of the week and the phase of the moon.


My advice is that if it's between the two, go with GoDaddy - you won't 
get any less for your money than you would with NetSol.


-Stut

--
http://stut.net/

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



Re: [PHP] mail function

2007-08-02 Thread Stut

Animesh Joshi wrote:

I've installed IIS (Internet information services on my windows XP machine. 
I've also installed php 5.0 from www.php.net. I'm trying to use the mail() 
function in a simple php script which uses a html form. However, i'm not able 
to send the mail using the mail($to, $subject, $message, $headers); function. I 
wonder what's wrong. Please help, i'm new to php.


Please review the Runtime Configuration section of 
http://uk.php.net/mail and make sure you've told php.ini about your mail 
server.


-Stut

--
http://stut.net/

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



Re: [PHP] subtitute of mysql_error()

2007-08-01 Thread Stut

Patrik Hasibuan wrote:

Dear my friends

What is the substitute of mysql_error() ?

This line of my code does not work anymore:
$hslgbr=mysql_query($sqlgbr,$konek) or die ( mysql_error() 
);

Thank you very much in advance.


In what way does it not work anymore?

The code above is perfectly valid. Incidentally, there is no need to put 
a single variable in quotes - all this does is cause extra pointless 
work for the PHP engine.


-Stut

--
http://stut.net/

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



Re: [PHP] I'm prepared to feel like an idiot... But I just simply need the answer :)

2007-08-01 Thread Stut

Jason Pruim wrote:
I have a php script that I am attempting to run from the CLI to connect 
to a MySQL database and update a field. but when I run it with this 
command: php cronjob.php it prints out the script on screen but doesn't 
process it...


Running: php-rphpinfo(); prints out the standard phpinfo screen.. and 
I don't think I should have to write it differently to make it run from 
the command line right?


Sounds like you're not using ?php and ? tags to surround your code. 
Without those PHP will simply output the content of the file rather than 
running it.


-Stut

--
http://stut.net/

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



Re: [PHP] Question about passing date in sql...

2007-08-01 Thread Stut

Michael Preslar wrote:

I know it has to do with date='`date +%Y%m%d`', because if I remove it
works.


Are you trying to use perl's back tic operator in php here?


PHP also supports the that.

However, I think the OP's problem is that it's inside other quotes and 
is therefore not being executed. But, as someone else pointed out, you 
should be using the PHP date function to get the date from within PHP.


-Stut

--
http://stut.net/

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



Re: [PHP] Authentication

2007-07-31 Thread Stut

Dan Shirah wrote:
Correct Stut, I want transparent authentication, but I also want to have 
the currently logged in user name pulled so I can use it for tracking 
purposes.  My application deals with very sensitive company information 
and I want to pull the username for tracking purposes. I have everything 
running local on the same PC.  Win2k3 server, IIS, PHP and MSSQL 
Server.  I have PHP installed for use with ldap and have NT 
Authentication set in IIS for the site.  This allows me to perform the 
transparency, but I can't seem to extract the username.


Spit out the contents of $_SERVER with print_r - it's probably in there 
somewhere.


print 'pre'.print_r($_SERVER, true).'/pre';

-Stut

--
http://stut.net/

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



Re: [PHP] Re: Pirate PHP books online?

2007-07-31 Thread Stut

tedd wrote:

At 8:53 PM +0100 7/30/07, Stut wrote:

tedd wrote:

  Don't expect that only one living
  entity can envision such a permutation.


 Don't expect anyone with our limitations to be capable to determine
 the truth of that statement.


The phone was independently envisioned by two distinct humans at the
same time. The same is true of calculus. So you are wrong, we are
capable of determine the validity of the statement by the existence of
such events in history.

-snip-


No, I was addressing a concept deeper than that. The only one who can 
envision such a permutation is God, not man. Your previous paragraph 
mentioned permutation of what might exist -- which would be infinite. 
The only living entity that fills that bill is God.


Now, you may argue that, but it's not a topic for this list.


Indeed not, but I must point out your assumption that God exists which 
is in no way a certainty regardless of your beliefs.


-Stut



Yes, but that's why it's called faith.


My point was that it makes no sense to try and prove or demonstrate 
anything using God because the existance of God itself cannot be proven 
or demonstrated.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: Pirate PHP books online?

2007-07-31 Thread Stut

Ryan A wrote:

Yes, but that's why it's called faith.

My point was that it makes no sense to try and prove
or demonstrate 
anything using God because the existance of God
itself cannot be proven 
or demonstrated.


Stut,
 
There will be a demonstration of god's existance  in a

little while, please look up when you are burning and
I am sipping nector.


That would also be the day the devil drives to work in a snow plough right?


Sorry, couldnt resist, no offense meant ;)


None taken. My beliefs are my beliefs and yours are yours, and you are 
entitled to say anything you want, as am I. If you prefer to lead a 
blinkered life go ahead, but I prefer to use my head to find my way 
through life rather than live by the teachings of a bunch of fiction 
written by men.


If this God really thinks that makes me unworthy that's its business. 
I really don't want anything to do with any entity that thinks like that.


-Stut

--
http://stut.net/

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



Re: [PHP] Problem with filemtime

2007-07-31 Thread Stut

Kevin Murphy wrote:
I'm running the following script (simplified for discussion) to create a 
CSV file. My problem here is that the first filemtime and the last 
filemtime always equal each other. What I am trying to get is the 
filemtime ($new_last_modified) of the file that was just executed 3 
lines earlier. Is there something I need to do differently? I tried 
putting a sleep(20) after the fclose, but that didn't seem to help.


$csv_file = myFile.csv;
$last_modified_csv = filemtime($csv_file);

$fh = fopen($csv_file, 'w') or die(can't open file);
fwrite($fh, Data Goes Here);
fclose($fh);

$new_last_modified = filemtime($csv_file);


The data returned by filemtime is cached. Use clearstatcache to clear 
the cache (http://php.net/clearstatcache).


-Stut

--
http://stut.net/

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



Re: [PHP] Re: Pirate PHP books online?

2007-07-30 Thread Stut

David Powers wrote:
When somebody distributes copies of my eBooks to others, they break the 
terms of the licence. They also deprive me of income, as do bit torrent 
sites that assist in that distribution. It might not be stealing in a 
strict legal sense, but it results in financial harm to me. So money 
does frequently come into it where copyright infringement is concerned.


This conversation is getting pointless guys. The argument being had is 
about whether copyright infringement should be called stealing or theft. 
Personally I don't believe it should, but going back and forth on a 
public mailing list is not going to do anyone .


To summarise...

* Nobody thinks copyright infringement is a good thing and nobody is 
denying that it causes harm to every layer of the commercial chain that 
exists to create and publish copyrighted work


* A lot of people believe copyright infringement should not be called 
theft, and those who do not seem unwilling to see the difference


* Comparisons in this arena are always full of holes so stop trying to 
use them


I believe both sides have adequately explained their position and 
justification, and it's now turning into a game of tennis. Can we please 
leave it alone now and get back to making something worthy of being copied?


-Stut

--
http://stut.net/

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



Re: [PHP] Re: Pirate PHP books online?

2007-07-30 Thread Stut
 of property belonging to another 
with the intention of permanently depriving that person of it


Copyright infringement: using material created by another person that is 
under copyright protection without that persons permission


Copyright is not property, it's a legal protection.


And for that, I am accused of having no morality and values.


I don't think anyone has accused you of that, but saying what you have, 
leaves us with the obvious conclusion that you don't recognize copyright 
infringement as stealing -- and that does cast a long shadow as to 
morality and values.


This is not an issue of morality. Whether you believe creative works 
should be protected or not doesn't change the fact that legally speaking 
copyright infringement is not the same as stealing. Likewise it does not 
matter if you believe copyright infringement is a moral sin (whatever 
your definition of a moral sin is).


Legally speaking, and I'd love to see a legal reference that disputes 
this, copyright infringement is not stealing.


PS: I said I wouldn't get back into this argument, but your claims are 
just absurd.


In my opinion so are yours. This is not an issue of morality, it's a 
simple issue of language. Think about this... if I were to be accused of 
copyright theft, surely I've stolen the right to control the material 
because it's the control that copyright provides, not the material 
itself. That simple 2-word phrase makes no sense at all. Here's hoping 
that made my point of view a bit clearer.


-Stut

[1] 
http://www.thamesvalley.police.uk/reduction/saferhomes/safehome/safe1.htm


--
http://stut.net/

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



Re: [PHP] Re: Pirate PHP books online?

2007-07-30 Thread Stut

tedd wrote:

But, the importance here is one of euphemism.

Calling the act of stealing something more palatable, such as copyright 
infringement, simply makes it easier to do.


Conversely, calling the act of copyright infringement something less 
palatable, such as stealing, simply makes it harder to do.


That's a very curious comment. Do you really think people who are 
actively infringing copyright really care what you call it?


In my mind copyright infringement is no better or worse a crime than 
stealing.


And, legally speaking, what you call it makes a world of difference. The 
punishments for stealing are very different to those for copyright 
infringement. If they were the same thing then surely the potential 
punishments would be the same?


-Stut

--
http://stut.net/

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



Re: [PHP] Re: Pirate PHP books online?

2007-07-30 Thread Stut

Crayon Shin Chan wrote:

On Monday 30 July 2007 23:49, tedd wrote:


The opposite of BUYING is STEALING


I think you meant SELLING.


I think he meant alternative not opposite. I'd laugh for years if 
someone tried to defend the position that stealing is the opposite of 
buying. Then I'd send them back to school to start again.


-Stut

--
http://stut.net/

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



Re: [PHP] Reading registry values

2007-07-30 Thread Stut

Jay Blanchard wrote:

[snip]
I want to convert some ASP pages to PHP to go along with a transition
from IIS
to Apache. One of the ASP script functions involves reading data from
the
Windows registry. How does one read from the registry with PHP?
[/snip]

PHP is server-side and cannot read client side info. You would need to
use something client-side, like JavaScript. JavaScript cannot read the
registry either. It's a security thing.


I think you'll find the OP means on the server-side, which is kinda 
obvious when you consider the fact the OP already has an ASP app that 
does this.


Crash: The COM extension (http://php.net/com) should let you do that 
in essentially the same way ASP does.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: Pirate PHP books online?

2007-07-30 Thread Stut

tedd wrote:

At 5:46 PM +0100 7/30/07, Stut wrote:

tedd wrote:

But, the importance here is one of euphemism.

Calling the act of stealing something more palatable, such as 
copyright infringement, simply makes it easier to do.


Conversely, calling the act of copyright infringement something less 
palatable, such as stealing, simply makes it harder to do.


That's a very curious comment. Do you really think people who are 
actively infringing copyright really care what you call it?


I don't know what they think, and neither do you. But I do believe that 
if I raised my son with the idea of stealing software was not really 
stealing, but rather copyright infringement I think he would have a 
different view in acquiring it -- is that not common sense?


Stealing software - that would be walking into a shop and taking a box 
of software. Not the same as downloading it from a pirate website.


My personal view is that it's important that we don't dumb things down 
for children, and in my opinion calling copyright infringement stealing 
is dumbing it down so you don't have to explain the difference.


In my mind copyright infringement is no better or worse a crime than 
stealing.


Ok, we agree that copyright infringement is as bad as stealing. If it 
looks like a duck


Corporate manslaughter and murder? I would get very worried if we 
started treating those the same!


And, legally speaking, what you call it makes a world of difference. 
The punishments for stealing are very different to those for copyright 
infringement. If they were the same thing then surely the potential 
punishments would be the same?


The punishments for any crime vary regardless of what you call it -- 
that's in the guts of the legal system. I'm not using the failings of 
our legal system to make any point, I'm just stating the obvious. And 
the obvious here is that if you deny rights to another, then you are 
stealing something.


No, you're not. If I imprison you am I stealing from you? No.

Again I'm forced to repeat the basic point... stealing involves a thing, 
copyright involves a legal protection mechanism. I cannot steal a legal 
protection mechanism, but I can infringe it.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: Pirate PHP books online?

2007-07-30 Thread Stut

tedd wrote:

At 2:30 PM -0400 7/30/07, Robert Cummings wrote:

Ownership is an illusion... What you have may be taken away at anytime
by the state (be it your own state or a victorious state that just
subjugated your previous state).


But illusion all we have. There is no truth in perception.


Then there is no truth in anything for all things are based on perception.

-Stut

--
http://stut.net/

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



Re: [PHP] Re: Pirate PHP books online?

2007-07-30 Thread Stut

Robert Cummings wrote:

On Mon, 2007-07-30 at 20:23 +0100, Stut wrote:

tedd wrote:

At 2:30 PM -0400 7/30/07, Robert Cummings wrote:

Ownership is an illusion... What you have may be taken away at anytime
by the state (be it your own state or a victorious state that just
subjugated your previous state).

But illusion all we have. There is no truth in perception.

Then there is no truth in anything for all things are based on perception.


The concepts of ownership and copyright both rely on perception...


As does gravity.

I'm done now, there really is no point continuing and I dunno about 
anyone else but I have better things to do.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: Pirate PHP books online?

2007-07-30 Thread Stut

tedd wrote:

  Don't expect that only one living
  entity can envision such a permutation.


 Don't expect anyone with our limitations to be capable to determine
 the truth of that statement.


The phone was independently envisioned by two distinct humans at the
same time. The same is true of calculus. So you are wrong, we are
capable of determine the validity of the statement by the existence of
such events in history.

-snip-


No, I was addressing a concept deeper than that. The only one who can 
envision such a permutation is God, not man. Your previous paragraph 
mentioned permutation of what might exist -- which would be infinite. 
The only living entity that fills that bill is God.


Now, you may argue that, but it's not a topic for this list.


Indeed not, but I must point out your assumption that God exists which 
is in no way a certainty regardless of your beliefs.


-Stut

--
http://stut.net/

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



Re: [PHP] Authentication

2007-07-29 Thread Stut

Dan Shirah wrote:

I looked on PHP.net but I couldn't not find anything suitable to answer my
question.

Within PHP, is there a way to pull the name of the user that is currently
logged into the PC?

I know with some of the _SERVER functions you can pull the IP of the machine
and other data, is there a function within this family that would work?


I'm assuming you're after transparent authentication where the user 
doesn't need to do anything to authenticate with the site. This is only 
possible with IE as the client on an NT domain with the server on the 
same domain. If you're using IIS on the server then it's as easy as 
removing anonymous and basic authentication from the site/directory. If 
you're using Apache or something else you need to find an 
extension/module that provides NTLM authentication, but not all of the 
ones I tried fully supported the transparent side of it.


I implemented this for a corporate intranet a while back in Apache on 
FreeBSD with mod_ntlm (Google for it - dunno if it's still maintained). 
That was in 2004 and information was sparse, but with a bit of research 
and *lots* of experimenting I was able to get it to work.


To be perfectly honest, if I were doing it again I'd save the time and 
use IIS on the server - sooo much easier.


-Stut

--
http://stut.net/

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



Re: [PHP] need insights on encrypting and uploading ASCII file using PHP

2007-07-29 Thread Stut

Richard Lynch wrote:

On Fri, July 27, 2007 3:21 pm, John A DAVIS wrote:

We have various labs that submit coliform sample results in an ASCII
file, quoted/comma delimited.

We are being asked to encrypt this file for internet transfer. We are
also being asked to create a secure process by which to transfer this
file across the interent.

Currently:
the lab pushes and button and generates the ASCII file (12 columns)
the lab logs in to a PHP webpage and uses the file upload input to
submit the file.
If data is valid, file is saved on our server in a folder where we can
pull it into the respective tables.


Be nice to have some insights on how to encrypt this file at the
source and how to transfer the file securely. We keep hearing the
words, digital signature.


If the concern is about during the TRANSFER of the data, SSL should be
enough to satisfy virtually any requirement.

The data is encrypted during the transfer.

Where they get digital signature from, I dunno...

Encrypting it at the source and decrypting it at the destination
before you transfer it encrypted via SSL is kinda pointless...

Unless there is an untrusted individual handling it somewhere between
Lab and upload, or between your receipt and stuffing it into your
tables?


It's possible they want it digitally signed so they can verify the 
source. SSL won't help here.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: Pirate PHP books online?

2007-07-26 Thread Stut

Man-wai Chang wrote:

You could open a sample book in bookstores, scan the chapters to
decide whether you are gonna buy it.


Not even slightly relevant, but it made me think of this (seemingly 
neverending) thread.


http://xkcd.com/294/

-Stut

--
http://stut.net/

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



Re: [PHP] Object instance and session

2007-07-24 Thread Stut

Stefano Esposito wrote:

Hi all,

i've a self-defined class describing an user. In the login page i create an 
instance of the user object and store it in $_SESSION['user']. When accessing 
$_SESSION['user'] from other pages (of course I do require('user.php'); and 
session_start();) i got this errors:

Warning: mysqli::query() [function.mysqli-query]: Couldn't fetch mysqli in 
/home/httpd/html/uss_tyco3/user.php on line 390

Warning: user::get_unita_row() [function.user-get-unita-row]: Couldn't fetch 
mysqli in /home/httpd/html/uss_tyco3/user.php on line 391

Fatal error: Call to a member function fetch_assoc() on a non-object in 
/home/httpd/html/uss_tyco3/user.php on line 396


snip code


Any hint?


You are trying to store a resource (MySQLi connection) in the session. 
This is not possible. You need to implement __sleep and __wakeup methods 
in your class to properly close and re-create the connection on each 
request. See here for more: http://php.net/oop5.magic


-Stut

--
http://stut.net/

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



Re: [PHP] Better way to store data in memory?

2007-07-23 Thread Stut

Richard Davey wrote:

I'm building up some image data in my PHP script (ready for output to
the browser). Having to do some complex per pixel manipulation, which
is fine - but I'm just wondering is there a quicker / more efficient
way of storing the pixel data than in an array?

At the moment I hold it in $array[$x][$y], which makes the drawing
loop painless, but it's creating an array with 307,200 elements which
is proving to be quite slow. As I'm only storing fixed width byte
values is there an alternative method? For example the ability to
read/write to a chunk of memory instead? (so I can read out whole
strips of data rather than one by one?)

I was looking at the Shared Memory functions, but that isn't exactly
what I need (I don't want it shared, I want it process specific)


You could use a string, but I doubt that would be much quicker. 
Personally I'd be doing this with a temporary file, using fseek to get 
around.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: Pirate PHP books online?

2007-07-21 Thread Stut

Dotan Cohen wrote:

On 21/07/07, Larry Garfield [EMAIL PROTECTED] wrote:
Speeding while driving is also an artificial law in that regard, as 
there is

no physical law that says a car can only go 30 mph.  That doesn't make
speeding OK or less illegal, it just means that it is not a natural law.


In Germany, there is. Get up to 250 KPH and the speed limiter kicks
in. It also almost kicks you out of your seat.


If you can't see that that's also an artificial limit and not an actual 
law of physics...!!


-Stut

--
http://stut.net/

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



Re: [PHP] Re: Pirate PHP books online?

2007-07-18 Thread Stut

Larry Garfield wrote:

Artificially created by the law, yes.


All laws are artificial. I really don't know what you're trying to get 
at with this.


-Stut

--
http://stut.net/

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



Re: [PHP] no default value

2007-07-18 Thread Stut

tedd wrote:

At 1:46 PM +0100 7/17/07, Stut wrote:

... but you can get
some of the way there by enabling the display of notices which will tell
you whenever a variable is used without being initialised.


How?


Look in php.ini for error_reporting. With it enabled if you try to use a 
variable without assigning a value to it it will generate a notice. 
There are a lot of situations this won't cover, but it covers more than 
having it disabled.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: Pirate PHP books online?

2007-07-18 Thread Stut

tedd wrote:

At 10:26 PM +0100 7/17/07, Stut wrote:

tedd wrote:
Nope, I'm just saying that if you want my work, pay for it. If you 
get my work without paying, then you're stealing.


You know, this is a pretty simple and obvious concept. I can imagine 
anyone arguing about it.


-snip-

There is no such thing as copyright theft. There is such a thing as 
copyright infringement.


No one is saying otherwise.

I don't care what you call it, taking something that is not yours is 
stealing. If an employer hires you to do a job, receives and uses your 
code, and doesn't pay you for it, then that's stealing. It doesn't make 
much difference if you call it breach of contract, copyright 
infringement, fraud, or theft -- it's still illegal. And, I've spent 
enough time in court to know the difference.


Ok, this is really simple. Stealing is theft and theft is stealing. 
Infringing copyright is neither.


I am always surprised as to how simple wrongful acts can be diminished 
with spin. We live in a world of political correctness, to which we all 
object, but whenever we can, we add our own spin to the layers of 
complexities around us.


I, for one, just call theft what it is.


There is a very very important difference. Stealing/theft is a criminal 
offence. Copyright infringement is not. For you to be prosecuted for 
copyright infringement the injured party must bring a civil case.


This is a fundamental difference. The reason everyone thinks the terms 
theft and stealing cover it is because, as I've previously asserted, 
bodies like the MPAA and RIAA keep referring to it as such. Just because 
they do that doesn't make it any more accurate.


-Stut

--
http://stut.net/

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



Re: [PHP] repetition of tedious references

2007-07-18 Thread Stut

C.R.Vegelin wrote:

what about this ?
$language = isused($_SERVER[HTTP_ACCEPT_LANGUAGE]);


This call will raise a notice if that array element does not exist.


echo language is  . $language;

function isused($variable)
{  return isset($variable)  $variable !=  ? $variable : *;
}


The isset is redundant here. It's been passed as an argument so it 
definitely exists.


-Stut

--
http://stut.net/


- Original Message - From: Olav Mørkrid [EMAIL PROTECTED]
To: PHP General List php-general@lists.php.net
Sent: Wednesday, July 18, 2007 1:24 PM
Subject: [PHP] repetition of tedious references



consider the following statement:

$language =
isset($_SERVER[HTTP_ACCEPT_LANGUAGE]) 
$_SERVER[HTTP_ACCEPT_LANGUAGE] !=  ?
$_SERVER[HTTP_ACCEPT_LANGUAGE] : *;

when using strings in arrays that may be non-existing or empty, you
have to repeat the reference  *three* times, which gets excessive and
unreadable.

is there any way to only have to write
$_SERVER[HTTP_ACCEPT_LANGUAGE] only once?

i know it's possible to supress is not set with @, but that just
seems wrong in case there really is an error in the statement.

i love php, but this is one of my pet peeves.

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




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



Re: [PHP] Re: Encrypted Mail

2007-07-18 Thread Stut

Daniel Brown wrote:

On 7/18/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


Please read the attachment to get the message.


 Attachment: No Virus found
 Norman AntiVirus - www.norman.com



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



   Rut-roh, Reorge!  Rooks rike Andrei rot a rirus!


Probably not. More likely someone with Andrei in their address book or 
an email from/to him has one.


-Stut

--
http://stut.net/

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



Re: [PHP] Error on installing under Windows Vista leads to inability to uninstall 5.2.3

2007-07-18 Thread Stut

Stephan G wrote:
Please pardon the cross-post - I posted this on the php.install 
newsgroup a couple of days ago, but there has been no activity on that 
news group, and I see that other installation issues are posted here.


I have tried to install the following on my Windows Vista Home Premium 
System:


php-5.2.3-win32-installer.msi


The new Windows installer has a maintainer - can't recall his name. 
Probably the best way to find them would be to search the archives of 
the internals list for the discussions that went on while he was 
creating it.


-Stut

--
http://stut.net/

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



Re: [PHP] no default value

2007-07-17 Thread Stut
Man-wai Chang wrote:
 Is there a parameter in php.ini that requires all variables to be
 explicitly initialized, rather than being automatically assigned the
 value of false?

I think you'll find they get assigned the value of null, not false.

There is no setting that enforces such a requirement, but you can get
some of the way there by enabling the display of notices which will tell
you whenever a variable is used without being initialised.

-Stut

-- 
http://stut.net/

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



Re: [PHP] Re: Pirate PHP books online?

2007-07-17 Thread Stut

Daniel Brown wrote:

On 7/16/07, Larry Garfield [EMAIL PROTECTED] wrote:

I am not going to defend copyright infringement, but theft is depriving
someone of something they used to have and no longer have.  If someone
pirates a copy of your book that would have purchased it otherwise, 
then they

have not taken anything away from you that you had.


   Actually, theft is the act of unlawful taking by deceptive practices.


By that definition, if I walk into a shop, grab a TV off the shelf and 
walk out again I am not committing a theft - there is no deception. The 
definition of theft is not important because copyright theft is not an 
accurate term for what's being discussed, it's actually copyright 
infringement.


However, this discussion is not particularly interesting and certainly 
not relevant to this mailing list so it would be great if we could drop 
it or move it off-list if people really really want to continue with it.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: Pirate PHP books online?

2007-07-17 Thread Stut

tedd wrote:

At 11:18 AM -0600 7/17/07, John Meyer wrote:

tedd wrote:
I've written software all my life and I have on numerous occasions 
run into individuals who ask something like Can you get me a copy? 
It's not worth it for me to pay for it because you add in whatever 
reason you want. I would just like to get a copy.


And you think that if somehow, somebody was able to magically lock 
down all copies, all of those people would pony up the money and pay 
you or buy that software?  It's the assumption that the music and 
movie industry make that if only they could lock down all those places 
the money would come flowing in.



Nope, I'm just saying that if you want my work, pay for it. If you get 
my work without paying, then you're stealing.


You know, this is a pretty simple and obvious concept. I can imagine 
anyone arguing about it.


Batter up... The issue is not about what is going on and the fact that 
it's illegal and morally questionable - I think most people would agree 
to that if only to the point that they accept that breaking the law is 
morally questionable even if you don't agree with the laws. What you lot 
seem to insist on arguing about is the terminology being used.


There is no such thing as copyright theft. There is such a thing as 
copyright infringement. Unfortunately organisations such as the MPAA and 
the RIAA have decided (in their infinite wisdom) to call it stealing. 
This is almost certainly because it makes it clearer to the lowest 
common denominator (no offense meant to anyone who might take it that way).


IANAL but I'm fairly certain that there is no official legal 
definition for copyright theft. The correct phrase for the act of 
pirating something protected by copyright is infringement.


Stealing is wrong m'kay!
Piracy is evil m'kay!
Copyright theft doesn't exist m'kay!
Copyright infringement is illegal m'kay!

Now please let's drop this discussion because it's one of those where 
people will never reach agreement, it'll just drag on and on and on and 
on and on.


-Stut

--
http://stut.net/

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



Re: [PHP] Pirate PHP books online?

2007-07-16 Thread Stut

Dotan Cohen wrote:

On 16/07/07, Austin C [EMAIL PROTECTED] wrote:
Dont be so harsh. I used to torrent PHP books, and everyone I 
turrented, I
ended up buying from a book store so I could take it with me. So, that 
kind

of stuff actually helped me. But, ive stopped torrenting now.


I guess that I'm naive. I've gotten a few what's the address
requests, but none from authors... So I'll just delete the address and
not pass it on. Like said earlier in the thread, it can be easily
googled.

As everybody (including M$, excluding RIAA) seems to support the
pirates with they won't buy it anyways I guess that I really am a
sucker for being the one who pays for the books. I'm paying for
everybody, no? So, suckers, I'm with you now, and I'll start pirating
again. Anyone know where I can pick up a copy of Ubuntu pirated? I
still refuse to use Windows, even for free...


Pirated Ubuntu? I hope that was supposed to be funny.

-Stut

--
http://stut.net/

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



Re: [PHP] Unlink file older then 7 days

2007-07-16 Thread Stut

[EMAIL PROTECTED] wrote:

How would I use fileatime to check if the file is older then 7 days?


You want filemtime not fileatime.

-Stut

--
http://stut.net/

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



Re: [PHP] Unlink file older then 7 days

2007-07-16 Thread Stut

Suhas Pharkute wrote:

http://us.php.net/manual/en/function.fileatime.php

$filename = 'somefile.txt';
if (file_exists($filename)  fileatime($filename)  
(time()-(7*24*60*60)) )

{
   unlink($filename);
}

Read docs!


You too! The OP wanted a way to check the age of all files. The 
fileatime function will return when the file was last accessed. 
Accessing a file is not usually deemed to affect its age, modifying it 
is. The filemtime function is what the OP wants.


-Stut

--
http://stut.net/


On 7/16/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


How would I use fileatime to check if the file is older then 7 days?





 I have a directory with .txt and .txt.asc files.

 What I want to do is..

 Check the age of all files ending in .txt.asc

 and if the file *.txt.asc is older then 7 days

 delete thatfile.txt.asc and also thatfile.txt


--
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] html emails and plain text dectection

2007-07-16 Thread Stut

Ross wrote:
I am using the code to send an html email (phpmailer class) now I need to 
somehow determine if the recipient uses text only email and change email to 
plain. Is this possible?


Not really, no. You can send both HTML and plain text versions in the 
same email and nearly all clients will correctly extract the right one. 
AFAIK phpmailer supports doing this but you'll have to check their 
documentation for details.


-Stut

--
http://stut.net/

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



Re: [PHP] Pirate PHP books online?

2007-07-16 Thread Stut

David Powers wrote:

Crayon Shin Chan wrote:

What makes you think any of the authors are subscribed to this list?


I am subscribed to this list, and I'm disgusted that somebody posted the 
URL to the pirate site. I see that more than 2,000 copies of my PHP 
Solutions: Dynamic Web Design Made Easy have been downloaded.


Although eBooks are cheaper than the printed version, the royalties to 
an author are much higher (no printing, storage, or delivery costs). I'm 
not starving, but the loss in revenue is far from trivial, and reduces 
the incentive to continue to write.


I have reported the site to my publisher. Even if it's closed down, my 
work has already been stolen.


I haven't followed this thread particularly closely because the issue of 
copyright has been done to death, but I believe the link you are 
referring to is The Pirate Bay, is that correct? If so you should really 
read up on the history of that site. I'm not defending what they do, but 
don't expect it to go anywhere - it's proven several times to be 
untouchable and is likely here to stay for a very long time.


-Stut

--
http://stut.net/

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



Re: [PHP] Alter an Array Key

2007-07-14 Thread Stut

Craige Leeder wrote:

1. Don't modify $_POST


Why not?


2. You controll the name of the array keys with the form. Why is there
any need to change them form PHP's side of things?


That's an assumption. A reasonable one in most cases, but not 
necessarily the case.



3. I'm not sure Roberts solution would work. I think it might result
in an endless loop, and timeout your script.


I always worry about adding or removing elements while iterating through 
an array. I generally build up an array of keys to remove and remove 
them in a separate loop afterwards just to be on the safe side.


-Stut

--
http://stut.net/

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



<    2   3   4   5   6   7   8   9   10   11   >