Re: [PHP] RSS Generation

2006-04-10 Thread Greg Schnippel
 ... When I tried saving it with an xml extension and
 adding a .htaccess file to the directory in which the file was saved, I get
 prompted to save the file instead of being able to view the file in a
 browser.  The only line in the .htaccess file is AddType
 application/x-httpd-php xml.

I had similar problems when trying to roll-my-own RSS feed with php.
Michael is right that it doesn't matter what your file extension is
(you probably don't even need that htaccess directive) as long as the
file is served as XML. Try adding a header at the top of the file:

header(Content-type: text/xml; charset=utf-8);

rss version=2.0
channel

...

I also use the Firefox browser which has a built-in XML browser that
allows me to do a quick validation of the XML. You can also use
www.feedvalidator.org to troubleshoot your feed once its online.

- Greg

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



Re: [PHP] Need a CRM recommendation

2006-04-04 Thread Greg Schnippel
Try Civiccrm -

http://www.openngo.org/

CiviCRM is the first open source and freely downloadable constituent
relationship management solution. CiviCRM is web-based,
internationalized, and designed specifically to meet the needs of
advocacy, non-profit and non-governmental groups.

I use this with several NGOs, very easy to customize and scale.

- Greg

On 4/4/06, Jay Blanchard [EMAIL PROTECTED] wrote:
 Howdy group!

 I need recommendations for a good CRM done in PHP, thanks!

 Jay

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

2006-02-27 Thread Greg Schnippel



On 2/27/06 6:20 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 When users input is displayed for others then themself I try to filter out
 html tags too.

I type cast all relevant variables before processing them as one last check.
Type casting forces the variable to be of the type you expect. For example,
if you are expecting two integers: $id1 and $id2 but you get the following
user input:

$_GET[id1] = 1234;
$_GET[id2] = evil hakor code;

if you type cast these as:

$id1 = (int)$_GET[id1];
$id2 = (int)$_GET[id2];

the output of print $id1, $id2 would be:

1234, 0

Possible types you can use (not all relevant to $_GET):

(int), (integer) - cast to integer
(bool), (boolean) - cast to boolean
(float), (double), (real) - cast to float
(string) - cast to string
(array) - cast to array
(object) - cast to object

- schnippy

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



Re: [PHP] novice with hacked email form issue

2006-02-21 Thread Greg Schnippel
On 2/21/06, cKc Consultants [EMAIL PROTECTED] wrote:
 An email form that uses a simple server side php code to send the variable
 values managed to send:
snip

Try looking for articles on 'email injection'. This is a really good
place to start for a description of the security risk and ways to
patch your code:

http://securephp.damonkohler.com/index.php/Email_Injection

You should also check recent archives on this list, there have been
several threads on this topic that may be of use.

- schnippy

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



Re: [PHP] Secure Mail Form using PHP

2006-02-16 Thread Greg Schnippel
 I'm trying to make sure my email form cannot be used for spam or
 injecting additional code and addresses in any way.

// CHECK FOR SPAM ATTEMPTS AND REMOVE THEM

 snip

I had a similar problem with my contact form and went down a similar
path of trying to clean up the user-input with regexes. They caught
some of the spammers but they kept trying and were eventually able to
get around them.

I posted this to the php-general list as well and two users suggested
I try the following:

- add a numeric limit to your email field to prevent spammers from
dumping huge blocks of email addresses:

if (strlen($email)255) echo Scram!;

- after you have tried to filter/clean the e-mail address, test it
again with a function that determines if the input is a valid email
address. I used this validation function to check email addresses,
from an article on Validating Emails with PHP on Developer.com:
 http://www.developer.com/lang/php/article.php/10941_3290141_1

function validate_email($email)
{

   // Create the syntactical validation regular expression
   $regexp = 
^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$;

   // Presume that the email is invalid
   $valid = 0;

   // Validate the syntax
   if (eregi($regexp, $email))
   {
  list($username,$domaintld) = split(@,$email);
  // Validate the domain
  if (getmxrr($domaintld,$mxrecords))
 $valid = 1;
   } else {
  $valid = 0;
   }

   return $valid;

}

$email = [EMAIL PROTECTED];

if (validate_email($email))
   echo Email is valid!;
else
   echo Email is invalid!;

I implemented these two steps to a function that was similar to yours
and haven't had a breach since.

Best of luck,

- schnippy

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



[PHP] Help Defending against Email Injection Attacks

2006-02-06 Thread Greg Schnippel
Has anyone developed a really good defense against email injection attacks?

I'm waging a prolonged campaign against these luser hordes on a number
of non-profit sites I help maintain. I've tried to secure all of the
feedback forms using the function below that I cobbled together from
various php security sites on the web. I also set it up so that every
time a 'successful' attempt is made, it gets logged to a database
before it is emailed.

The script worked well for 2-3 weeks and I enjoyed watching the
spammers bounce off of the firewall. Unfortunately, they finally
figured out how to get through last night and sent out hundreds of
emails on a couple dozen sites. I quickly took all of the forms down
to plug the breach but I can't keep them down indefinitely.

Few questions -

 - Does anyone have a better regex to use to detect email injection
attacks? Part of the problem seems to be that they figured out what
values I'm searching for and created a new attack that uses character
references (ex. #089; etc) to get through.

 - The successful attacks that I logged in my database weren't helpful
because they had already been converted to HTML. Is there a better way
to store _exactly_ what they entered into the field in the database?

 - Another way to stop these attacks would be to reject any mail field
over a specified length. Is there a limit to how long an email address
can be? I don't want to set a limit (ex. 50 chars) that excludes

 - The most foolproof solution I can think of would be to continue
logging the successful entries to a database and _not_ send the email.
That way even if they get through, no emails get sent. The form would
log the feedback and send an email to the admin that a comment is
available for viewing. Is it time to abandon using mail() for all user
contributed data?

Looking forward to the discussion,

- schnippy


#---
 /**
 * Secures field against email header injection attacks.
 *
 * USAGE:
 *  secureFeedbackValue($_POST[to]);
 *  mail($_POST[to], $_POST[subject], $_POST[message]);
 *
 * @param $value value to be cleansed of evil
 */

function secureFeedbackValue( $value )
{
# mail adress(ess) for reports...
$report_to = [EMAIL PROTECTED];

# array holding strings to check...
$suspicious_str = array
(
\r,
\n,
bcc,
cc:,
boundary=,
charset,
content-disposition,
content-type,
content-transfer-encoding,
errors-to,
in-reply-to,
message-id,
mime-version,
multipart/mixed,
multipart/alternative,
multipart/related,
reply-to,
x-mailer,
x-sender,
x-uidl
);

// remove added slashes from $value...

$value = stripslashes($value);

foreach($suspicious_str as $suspect)
{
# checks if $value contains $suspect...
if(eregi($suspect, strtolower($value)))
{
$ip = (empty($_SERVER['REMOTE_ADDR'])) ? 'empty' : 
$_SERVER['REMOTE_ADDR'];
$rf = (empty($_SERVER['HTTP_REFERER'])) ? 'empty' : 
$_SERVER['HTTP_REFERER'];
$ua = (empty($_SERVER['HTTP_USER_AGENT'])) ? 'empty' :
$_SERVER['HTTP_USER_AGENT'];
$ru = (empty($_SERVER['REQUEST_URI'])) ? 'empty' : 
$_SERVER['REQUEST_URI'];
$rm = (empty($_SERVER['REQUEST_METHOD'])) ? 'empty' :
$_SERVER['REQUEST_METHOD'];

if(isset($report_to)  !empty($report_to))
{
@mail
(
$report_to
,[ABUSE] mailinjection @  . 
$_SERVER['HTTP_HOST'] .  by  . $ip
,Stopped possible mail-injection @  . 
$_SERVER['HTTP_HOST'] .
 by  . $ip .  ( . date('d/m/Y
H:i:s') . )\r\n\r\n .
*** IP/HOST\r\n . $ip . \r\n\r\n .
*** USER AGENT\r\n . $ua . \r\n\r\n .
*** REFERER\r\n . $rf . \r\n\r\n .
*** REQUEST URI\r\n . $ru . \r\n\r\n .
*** REQUEST METHOD\r\n . $rm . \r\n\r\n .
*** SUSPECT\r\n--\r\n . $value . \r\n--
);
}

die ('Snakes on the plane.');
}
}
}

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



Re: [PHP] Hide email addresses from spam bots

2006-02-01 Thread Greg Schnippel
found this a couple of days ago on Digg:

http://www.csarven.ca/hiding-email-addresses

A comprehensive list of methods on how to hide email addresses in
source code from spam bots. Includes; CSS, Javascript, Forms, Images,
Obfuscation, Authentication, Flash, Unicode, Encryption and other
methods. Each technique is presented and explained with their
advantages and downfalls.

- schnippy

On 2/1/06, tedd [EMAIL PROTECTED] wrote:
 A user of mine insists that her email address shows on a web page. I
 need to protect that address from spam bots. There are lots of
 solutions around that I have come acros. I am looking for a clean,
 reusable, non-javascript solution.
 
 Any help is appreciated.
 
 Gerry

 Gerry:

 There are several ways to help protect your email address.

 There are only two ways for a spambot to get your email address from
 a web site: A) to read it via a screen reader, which is exceedingly
 slow. I may be wrong, but I doubt that any serious harvester would
 consider this method; B) to read it via text contained within your
 web site.

 A) With the first you could use CAPTCHA, see:

 http://xn--ovg.com

 If you want the code, I'll provide.

 B) With the second, you need to disguise your email address such that
 spambots don't understand it.

 One way is to use Enkoder (it's javascript):

 http://automaticlabs.com/enkoderform/

 I also have their program and it works great.

 For example, check out the source for the following page:

 http://www.sperling.com/contact.php

 The javascript enkoder portion is hidden from spambots.

 Using javascript isn't bad -- at last count less than 9 percent of
 surfers don't have javascript.

 Another way is to use PHP, but it is involved. I direct you to PHP
 Cookbook  O'Reilly by Sklar page 188.

 I'm sure there are other ways, but the above work.

 tedd
 --
 
 http://sperling.com/

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



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



Re: [PHP] Hide email addresses from spam bots

2006-02-01 Thread Greg Schnippel
 I doubt if this can be done, but it there a way to detect a spambot
 as compared to a SE indexing your site? They are both basically the
 same, right?

Yes, if you can assume that a spambot will be doing sneaky things to
hide its origin or identity. The bad behavior project has been
trying to develop a script to detect bad spambots and other evil
robots based on rule-breaking:

Bad Behavior is a set of PHP scripts which prevents spambots from
accessing your site by analyzing their actual HTTP requests and
comparing them to profiles from known spambots. It goes far beyond
User-Agent and Referer, however. Bad Behavior is available for several
PHP-based software packages, and also can be integrated in seconds
into any PHP script.

http://www.ioerror.us/software/bad-behavior/

Worth checking out..

- schnippy

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



Re: [PHP] php / mysql / js search result question

2005-12-29 Thread Greg Schnippel
Hi -

It sounds like you're trying to implement something similar to google
suggest which uses ajax to allow a user to navigate through a large
list of entries. The google suggest method does use a lot of calls
to the database but its asynchronous which eliminates cumbersome page
loads.

http://www.google.com/webhp?complete=1hl=en

I found this article which gives advice on how to implement google
suggest using php:

http://www.phpriot.com/d/articles/php/application-design/google-suggest-ajaxac/

A quick google search on +php +google suggest +ajax came up with
others as well.

If you're just interested in the javascript (i.e. you're not
navigating that large of a list) these articles should be able to help
with that as well.

- schnippy

On 12/27/05, Dave Carrera [EMAIL PROTECTED] wrote:
 Hi List,

 I have a very long list of customer names which i know is easy to get
 from a mysql result using php, no prob there.

 But what i would like to do is offer input box and when the user enters
 a letter, i think this will require client side onchange(), the full
 list, i think might be in an iframe, will move to the first instance of
 user input.

 Example:

 1 Alpha Customer
 2 Apple Customer
 3 Beta Customer
 4 Crazy customer
 5 Doppy customer

 User input is a so the list moves to first instance of a.  User
 continues to input ap so the list moves to 2 Apple Customer and so on.

 If the user had input d then the list would move to 5 Doppy customer
 and i suppose this could  become selected ready for the user to hit the
 return key to select this customer.

 I would prefer to not do multiple POSTS and return result, which i can
 do already, so i think some natty client side JS might do the trick but
 i have very little knowledge of this.

 Any urls or direct help / advise is gratefully received.

 Thank you in advance

 Dave c

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



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



[PHP] Help with Reverse Tree Traversal using Recursion ..

2005-11-14 Thread Greg Schnippel
I have a large data tree that I wanted to display in an outline
format. I used a textbook tree recursion function to go through the
data and display it as nested unordered lists:

function outputTree($id) {

   if (checkChildObjectExists($id)) {
   print ul;
   $child = getChildArray($id);
   foreach ($child as $key = $value) {
   print lia href=\/object/$key/\$value/a/li;
   outputTree($key);
   }
   print /ul;
   }
}

This works as expected:

 Level 1 (Top)
Level 2
   Level 3 (Bottom)

However, I also want to display a reverse tree to allow users to trace
their way back up the tree after landing on a lower branch. I tried to
be clever and reverse the function above as:

function outputReverseTree($id) {

   if (checkParentExists($id)) {
   print ul;
   $parent = getParentArray($id);
   foreach ($parent as $key = $value) {
   print lia href=\/object/$key/\$value/a\n;
   outputReverseTree($key);
   }
   print /ul;
   }
}

Which works, but there is something wrong with my logic as the tree
comes back reversed:

 Level 3 (Bottom)
Level 2
   Level 1 (Top)

Any suggestions on how to do this?

Thanks,

- Greg

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



Re: [PHP] Help with Reverse Tree Traversal using Recursion ..

2005-11-14 Thread Greg Schnippel
Richard -

Thanks for the helpful suggestion but that won't resolve my problem
the way I currently have it written because I'm creating a new, nested
ul each time I loop through:

print ul;
foreach ($parent as $key = $value) {
...
}
print /ul;

So when I tried this, the output was still inverted because it began
printing at the innermost branch of the nested list.

I'm trying to figure out a way now to save the output into an array
instead of outputting and then traversing the array in a separate
function to output it. Might run into the same problem again but I'm
hopeful that once the data is an array, I can make use of a php
function to reverse or sort the array.

Another reader also recommended this article on php and recursion:

http://www.zend.com/zend/art/recursion.php

I'll post if I get any closer,

- Greg


On 11/14/05, Richard Lynch [EMAIL PROTECTED] wrote:
 On Mon, November 14, 2005 7:46 am, Greg Schnippel wrote:
  I have a large data tree that I wanted to display in an outline
  format. I used a textbook tree recursion function to go through the
  data and display it as nested unordered lists:
 
  function outputTree($id) {
 
 if (checkChildObjectExists($id)) {
 print ul;
 $child = getChildArray($id);
 foreach ($child as $key = $value) {
 print lia
  href=\/object/$key/\$value/a/li;
 outputTree($key);
 }
 print /ul;
 }
  }
 
  This works as expected:
 
  Level 1 (Top)
  Level 2
 Level 3 (Bottom)
 
  However, I also want to display a reverse tree to allow users to trace
  their way back up the tree after landing on a lower branch. I tried to
  be clever and reverse the function above as:
 
  function outputReverseTree($id) {
 
   if (checkParentExists($id)) {
  print ul;
  $parent = getParentArray($id);
  foreach ($parent as $key = $value) {

 Just swap the order of these two lines:
print lia href=\/object/$key/\$value/a\n;
outputReverseTree($key);

 So that you walk up to the ROOT of the tree *before* you start
 printing stuff out.

  }
  print /ul;
}
  }
 
  Which works, but there is something wrong with my logic as the tree
  comes back reversed:
 
  Level 3 (Bottom)
  Level 2
 Level 1 (Top)
 
  Any suggestions on how to do this?


 --
 Like Music?
 http://l-i-e.com/artists.htm




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



Re: [PHP] Good user comment system?

2005-11-14 Thread Greg Schnippel
If you're looking for a light-weight, threaded discussion script, I
can recommend this class from xhawk.net

http://www.xhawk.net/projects/discussion/

I like it because I can quickly integrate this into blogs or galleries
by just instantiating a new board instance for each object id or
article.

It does need some work fending off comment-spam, as the demo version
illustrates. However, it is very small and well-documented so you can
easily integrate an approval-based or captcha anti-spam defense.

- Greg



On 11/13/05, Guy Brom [EMAIL PROTECTED] wrote:
 Hi all,

 Anyone familiar with a good user-comment system for PHP, preferably one that
 works with adodb and has thread-like design (where users can answer each
 other).

 Thanks!

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



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



Re: [PHP] Re: security/sql issues with php

2005-09-21 Thread Greg Schnippel
have you tried googling on +application framework +php..
 that seems like what you're looking for and several of these projects are
commercial-grade and open source.
i use dbasis as my application framework and highly recommend it -- its a
component of the syntaxCMS project. i have also used blueshoes and mambo
before on other sites
 here's an o'reilly article to get you started
 http://www.oreillynet.com/pub/wlg/6029
 - schnippy
 On 9/21/05, bruce [EMAIL PROTECTED] wrote:

 i would have thought (perhaps wrongly) that someone would have created a
 series of functions/routines and wrapped them in a package/lib to deal
 with
 the security issues that i've raised!!

 but i have to tell you. i've looked at some open source classess/apps that
 aren't that strong. in fact, some simply have no real checks on the data
 types/structure of the data being inserted into the db at all...

 and aaron, your app is a commercial app. for now, we're looking in the
 open
 source area where we can get to the underlying source.

 -bruce


 -Original Message-
 From: Aaron Greenspan [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, September 21, 2005 7:18 AM
 To: php-general@lists.php.net
 Subject: [PHP] Re: security/sql issues with php


 Bruce,

 If you're looking for commercial-grade open-source packages, I think
 you're going to have a pretty hard time finding much. Most
 commercial-grade software is...commercial. The truly robust open-source
 packages, i.e. Mozilla, MySQL, JBoss, BerkeleyDB, etc., are backed by
 some sort of commercial, or at the very least, corporate, entity. The
 rest, more often than not, are not commercial-grade; the support
 structures that companies require just don't exist for those packages.

 I've offered to help you before via our commercial framework, Lampshade,
 which handles I'd say 98% of everything you want, and can be easily
 customized or added to in order to handle the remaining 2%. It's not
 open-source, but it also doesn't need to be since the documentation is
 so extensive. It's used in applications for all sorts of organizations
 from Harvard University to companies traded on the NYSE. There may be
 other open frameworks that are used just as widely--I would venture to
 guess phpNuke and the-CMS-formerly-known-as-Mambo--but as you've
 discovered, they don't do half of the things you'd like to see all in
 one place. Also, Mambo's political machinations are a good example of
 what you don't want to see in a commercial-grade product.

 If you want to keep searching, I suppose no one's going to stop you. I'm
 just afraid it's not out there. Anyone, correct me if I'm wrong.

 Best of luck,

 Aaron

 Aaron Greenspan
 President  CEO
 Think Computer Corporation

 http://www.thinkcomputer.com

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

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




Re: [PHP] Browsing Into Levels

2005-08-30 Thread Greg Schnippel
Good answer, I think thats what they were looking for but just in case:
 Most of the breadcrumb classes out there (at least the ones that showed up 
in an initial google search) use either the existing directory/file 
structure or a hard-coded array of your site structure to create the 
breadcrumbs. 
 What about on non-structured sites like Wikis? For example, on DokuWiki, it 
keeps track of your last 4-5 clicks in a breadcrumb trail on the top of 
the page. Amazon.com http://Amazon.com's recently viewed pages is 
another good example (though probably patented ;))
 What are these kind of breadcrumbs called and which classes would you 
recommend using to implement them?
 Thx,
 - Greg
 

 On 8/30/05, Jordan Miller [EMAIL PROTECTED] wrote: 
 
 They are called breadcrumbs:
 http://www.google.com/search?q=php+breadcrumbs
 
 Jordan
 
 
 On Aug 30, 2005, at 4:57 AM, areguera wrote:
 
 
  Hi,
 
  I been wondering the best way to make the level browsing, I mean,
  those links up in page which tell you the position you are, and make
  you able to return sections back, keeping some kind of logic of where
  you are.
 
  I been used the url vars to do this but I arrive some point where
  there are coincidences and it loose sense, it jumps to other section,
  where indeed have to, but not where it logically should.
 
  any suggestions?
 
  thank :)
 
  --
  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] Be careful! Look at what this spammer did.

2005-08-17 Thread Greg Schnippel
 I'll reply soon off list, as I don't think it appropriate to give
 potential spammers an archive full of new tricks.

I don't know -- I think its always better to discuss this in the open
if there is a real security risk that people should be aware of.

A couple days after your posting to PHP-General, I saw the same kind
of probe on my system:

begin clueless code
Content-Type: multipart/mixed; boundary0493326424==
MIME-Version: 1.0
Subject: c3b8e7fc
To: [EMAIL PROTECTED]
bcc: [EMAIL PROTECTED]
From: [EMAIL PROTECTED]

This is a multi-part message in MIME format.

--===0493326424==
Content-Type: text/plain; charset=us-ascii
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

awhvtr
--===0493326424==--
/end clueless code

This was submitted through a simple web contact form with a message,
subject, and body form fields. The hakor submitted the above as the
body of the message 3-4 times than seemed to give up (although he did
send a few obnoxious threats). I don't believe this did anything
because

1) I never got a bounce message from the made-up address he attempted
to send to ([EMAIL PROTECTED])

2) I believe that since the mail function already sent out the
headers, any subsequent headers would just be ignored. Or they would
be treated as text since they occurred in the message portion and not
parsed literally.

Not sure that there is any risk here, but I'm shrouding my contact
script (changing the form variables and script name to something less
obvious) just in case.

- Greg

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



[PHP] Fixing Invalid Characters in RSS Feeds.. ?

2005-08-10 Thread Greg Schnippel
I wrote a custom blog/CMS script that I use to generate RSS feeds.
Every so often, in the process of cutting and pasting from other sites
I will inadvertently enter a bad character that RSS doesn't like which
causes the whole feed to break. (For example, versions of quotation
marks or long dashes). My solution now is to check the feed at
feedvalidator.org and then edit any offending characters by hand.

Does anyone know an easier way to do this? In truth, I'm not sure I
know what kind of characters are valid and which are not and why. Is
there an easy way to validate and correct any incoming text?

Thanks, 

- schnippy

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



Re: [PHP] Insert one or many chekbox values in a db mysql

2005-08-10 Thread Greg Schnippel
Try this article on Evolt: 

http://www.evolt.org/article/Storing_form_array_data_to_MySQL_using_PHP/18/60222/

that covers the whole process with good code examples..

- schnippy

On 8/9/05, Jesús Alain Rodríguez Santos [EMAIL PROTECTED] wrote:
 Hi, I have 5 chekboxes in a page, I would like insert the values of all
 chekboxes checked in a mysql db.
 
 
 --
 Este mensaje ha sido analizado por MailScanner
 en busca de virus y otros contenidos peligrosos,
 y se considera que está limpio.
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



Re: [PHP] redirect based off server string

2005-08-10 Thread Greg Schnippel
Try doing a pattern match on the server string and then using Header
to redirect them if its coming from the old server:

if (preg_match(/ces.ncsu/i, $_SERVER[HTTP_HOST])) {
 
 header(Location: http://www.nc4h.org;);

} 

- schnippy


On 8/10/05, Robert Sossomon [EMAIL PROTECTED] wrote:
 Anyone have a script or know of a way to check and see what the url is of a
 system and then sending it to another url if it is not right?
 
 I have this problem where if someone is using:
 http://www.ces.ncsu.edu/depts/fourh
 instead of:
 http://www.nc4h.org
 
 to get to my site it is breaking other pieces within it (though there is code 
 in
 place which supposedly stops this from happening, I have found that this is 
 not
 the case)
 
 what I plan on doing is invoking the script on the main page of each man
 sub-directory and the main page so that it should catch the majority of folks.
 
 Any suggestions/help would be greatly appreciated!
 
 Robert
 
 --
 Robert Sossomon, Business and Technology Application Technician
 4-H Youth Development Department
 512 BrickHaven Drive Suite 220L, Campus Box 7606
 N.C. State University
 Raleigh NC 27695-7606
 Phone: 919/515-8474
 Fax:   919/515-7812
 [EMAIL PROTECTED]
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



RE: [PHP] Write an array to a file

2002-01-29 Thread Greg Schnippel

Scott -

You can just write it as a pipe-delimited file, write it 
to the file, and then read it back in. Use implode and explode:

$company = array(Item 1, Item 2, Item 3, Item 4);

#-
#
# Output array 
#

$output_string = implode(|, $company);

 write $output_string to a file 

#
# Read array from file
#

if (!$file=fopen(file.txt, r)) {
echo Error opening file;
} else {
$input_string = fread($file,2048);
}

$company = explode(|, $input_string);

#-

-schnippy

 -Original Message-
 From: Scott Saraniero [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, January 29, 2002 12:34 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Write an array to a file
 
 
 Hi,
 
 How do I write an array to a file? For example, I need to 
 write just this in
 a file:
 ?php $Company = array(Item 1, Item 2, Item 3, Item 
 4, Item 5,);
 ?
 
 I've been hung up for 2 days on this. Any help would be appreciated.
 
 Thanks,
 Scott
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: 
 [EMAIL PROTECTED]
 
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Search Engine

2002-01-15 Thread Greg Schnippel


 * On 15-01-02 at 12:09 
 * Yogesh Mahadnac said
 
 Hi all! I want to develop a search engine in PHP for a 
 portal that I'm working on at the moment, and I'd be glad if 
 someone could please show me how to do it, or if anyone knows 
 of a link where i can find a tutorial for that.

 I don't think PHP is really a very good language for a genuine www
 search engine. (although it works very well on site-wide basis)
 I'm sure more knowledgeable people than I can make some alternative
 suggestions but I'm certain that PHP won't be the best tool 
 for the job.

I would concur with what everyone else is saying. If you need a search
engine and you have system-level access on your machine, your best
bet is to set up either htdig or mnogosearch (open source search
engine packages) because they already have done the hard work of 
figuring out fuzzy matching and search ranking.

http://www.htdig.org/
http://mnogosearch.org/

Alternatively, if you are using a database you can use some tricky sql 
statements to search your records for the user's search query. Here's 
a good tutorial that should get you started on this route:

http://www.devshed.com/Server_Side/PHP/Search_Engine/page1.html


-schnippy

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Mysterious MYSQL Error..

2001-07-22 Thread Greg Schnippel


I'm stumped on this one.. I set up PHP 4.04/Apache/Mysql 3.23
on my Windows 98 box for development purpouses. Its been
working flawlessly for 2-3 years now (using the same
configuration files, etc).

However, as of 3 days ago, i can't get it to execute a simple
select * from table query. Here's the code I'm using:

$query = select * from $this-table where $this-primary_key='$record_id';
$result = mysql_query($this-database, $query);
echo mysql_errno().: .mysql_error().BR;

and the query that it sends to the mysql database is

select * from article where article_id='1';

However, mysql fails to execute the query. Result returns
nothing and the echo command returns:

errno: 0
mysql_error_text: 

??!? I've tried everything to get it to display any more information
as to why its breaking but nothing works. I even uninstalled and
reinstalled all of the packages, thinking it had something to do
with a windows dll file or something annoying like that but no luck.

Any ideas? Anyone encountered a problem like this?

Thanks,

Greg


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Mysterious MYSQL Error..

2001-07-22 Thread Greg Schnippel


Never mind this one.. :) I figured out that it
was because I'm using mysql_query, but declaring
the database which means that the mysql_query
command will fail and of course won't return a
mysql_error code. Geeez...

Another classic case of figuring out the problem
in the process of trying to explain it to a colleague.
I should 'pretend' to send a letter to php-general
next time :p

-greg

-Original Message-
From: Greg Schnippel [mailto:[EMAIL PROTECTED]]
Sent: Sunday, July 22, 2001 9:48 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Mysterious MYSQL Error..



I'm stumped on this one.. I set up PHP 4.04/Apache/Mysql 3.23
on my Windows 98 box for development purpouses. Its been
working flawlessly for 2-3 years now (using the same
configuration files, etc).

However, as of 3 days ago, i can't get it to execute a simple
select * from table query. Here's the code I'm using:

$query = select * from $this-table where $this-primary_key='$record_id';
$result = mysql_query($this-database, $query);
echo mysql_errno().: .mysql_error().BR;

and the query that it sends to the mysql database is

select * from article where article_id='1';

However, mysql fails to execute the query. Result returns
nothing and the echo command returns:

errno: 0
mysql_error_text: 

??!? I've tried everything to get it to display any more information
as to why its breaking but nothing works. I even uninstalled and
reinstalled all of the packages, thinking it had something to do
with a windows dll file or something annoying like that but no luck.

Any ideas? Anyone encountered a problem like this?

Thanks,

Greg


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] is there free php+mySql hosting?

2001-05-03 Thread Greg Schnippel

From the archives: 

The number of free PHP web hosts is growing .  More and more are 
offering MySQL options too!  Each category below is in alphabetic order.

 Some don't require banners :

http://www.1st-home.net/ (requires affiliate signups)

http://www.mycgiserver.com/

http://www.portland.co.uk/ (allows your own domain name)

http://www.saxen.net/


 Some do require banners AND offer FREE MySQL :

http://www.f2s.net/free/free%20home.htm

http://www.grandcity.net/hosting/

http://hosting.datablocks.net/free/

http://www.jumpworld.net/
 
http://www.nexen.net/

http://www.spaceports.com/

http://www.surecity.com/

 Some do require banners (no db):

http://www.netcabins.com/

http://users.destiney.com/

http://www.worldzone.net/

 Some require you be Open Source and offer many services :

http://www.sourceforge.net/

If you later decide to pay for your web hosting, check out :

http://hosts.php.net/

As it features a searchable directory and comments from users.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]O
n Behalf Of Peter Stevens
Sent: Thursday, May 03, 2001 6:02 AM
To: [EMAIL PROTECTED]
Subject: [PHP] is there free php+mySql hosting?


Hi,

Can anyone tell me if you can get free php+mysql hosting anywhere?

Many thanks and regards,

Peter Stevens
Project Assistant DP
-
Berent APS
Njalsgade 21G,5
2300 København S
+45 32 64 12 00
-
http://www.berent.dk
http://www.berent.de



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]