Re: [PHP] attaching MySQL 5.0.18 to PHP 4.4.2

2006-02-16 Thread Kim Christensen
On 2/17/06, Paul Goepfert <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I know the subject doesn't seem too clear so here is what I am talking
> aboukt.  I recently installed php on my windows machine.  The PHP
> compiler works great.  However upon looking through the phpinfo ()
> document I noticed that the MySQL client version was 3.23.49.  I
> assume that is the built in version of MySQL.  I also have installed
> MySQL 5.0.18 on my system.  I have my database in the 5.0.18 version
> of MySQL .  How do I asssociate the MySQL 5.0.18 version with php?

http://php.net/manual/en/ref.mysqli.php

This isn't really the answer to your question per se, but will
probably solve things along the way.

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] menu Q

2006-02-16 Thread Kim Christensen
On 2/17/06, William Stokes <[EMAIL PROTECTED]> wrote:
> I have a  menu on a header bar on my page. The header bar is 20px
> high. The menu, code and style below, works ok on Opera but not in Ie6 or
> Firefox. In these browsers the menu 'streches' the bar height so that the bg
> image starts repeating itself. (looks nasty) It's almost like the menu
> prints one 'invisble' or empty row beneath the menu so that the header bar
> becomes about 30 or 35px high. Any ideas?

Try using defining the style as a class instead of ID, since ID makes
every child element inside the parent inheriting the style - seems
that different browsers handle this differently, but my guess is that
this is the case. So, remove the # in the style sheet and call upon
the style by using class="menu" instead of id="menu".

> This might not be a PHP related issue. I don't know. But this one is really
> bothering me.

http://www.css-discuss.org/ :-)

--
Kim Christensen
[EMAIL PROTECTED]

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



[PHP] menu Q

2006-02-16 Thread William Stokes
Hello,

This might not be a PHP related issue. I don't know. But this one is really 
bothering me.

I have a  menu on a header bar on my page. The header bar is 20px 
high. The menu, code and style below, works ok on Opera but not in Ie6 or 
Firefox. In these browsers the menu 'streches' the bar height so that the bg 
image starts repeating itself. (looks nasty) It's almost like the menu 
prints one 'invisble' or empty row beneath the menu so that the header bar 
becomes about 30 or 35px high. Any ideas?

Thanks
-Will

Code:
print "\n";
print "\n";
print "\n";

$sql="SELECT * FROM x_table ORDER BY sorter ASC";
$result=mysql_query($sql);
$num = mysql_num_rows($result);
$cur = 1;
print "";
print "";
print "Valitse joukkue:";
while ($num >= $cur) {
$row = mysql_fetch_array($result);
$jouk_nimi = $row["jouk_nimi"];
$team_id = $row["jouk_id"];
print "$jouk_nimi";
$cur++;
}
print "";
print "";


StyleSheet:

#menu{
 height: 18px;
 font-family: Arial, Helvetica, sans-serif;
 font-size: 12px;
 font-weight: bold;
 text-align: left;
 background-color: #CC;
 BORDER-RIGHT: #FF 1px solid;
 BORDER-TOP: #FF 1px solid;
 BORDER-LEFT: #FF 1px solid;
 BORDER-BOTTOM: #FF 1px solid;
 COLOR: #FF;
}

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



Re: [PHP] Clear POST variables

2006-02-16 Thread Curt Zirzow
On Thu, Feb 16, 2006 at 09:34:12PM -0600, Mike Tuller wrote:
> ...
> 
> This is how I learned in some book somewhere. Is everyone saying that  
> I need to either use sessions, or redirect so that when someone  
> refreshes insert.php, it doesn't submit the information again? To me  
> it seems that there has to be a more efficient way. I don't  
> understand the token thing that some are suggesting.

Since  web requests are stateless you need to protect yourself
in some ways, this is a method to prevent those duplicate entries
in the db when someone refreshes the browser and reposts the data.

The only difference with richards code with what I have is that he stores it
differently than I generally do. The concept is as follows:

form.php:


  



action.php:
http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Saving a BLOB image to a file (SOLVED)

2006-02-16 Thread tedd

So single-user disclaimer would apply?


Obviously, if you have numerous people accessing your dB and doing 
inserts and updates, then all the lock-down stuff needs to be 
implemented.


But, my code is not for that, but rather for someone (a single 
programmer) who wants to pull an image from a BLOB and save it as a 
file.


Normally, a civilian wouldn't be doing that for if they wanted to see 
a file, your code would simply pull the image directly from the MySQL 
to the web page. No need to save as a file.


However, after given it some thought, I would imagine that one could 
get a unique generated string, create a file with that string, give 
the file the correct permissions, then pull the image from the dB and 
save, do image processing, and then reload the image into a web page, 
and delete the file without any conflict. I can envision lot's of 
users doing that simultaneously without problems. BUT, I haven't 
tried it yet!


tedd



On 2/16/06, tedd <[EMAIL PROTECTED]> wrote:

 Gerry wrote:

 >What if several users try to access a different picture at the same
 >time? Won't that render the wrong image for some?
 >
 >Gerry


 Gerry:

 Normally, it's not needed for civilians. This is for when YOU want to
 do some image stuff on your images, like to do some background
 processing via your code.

 As for users, they just want to see the image and you can pull that
 out of your dB or files, whichever you prefer.

 tedd

 ---


 >
 >On 2/16/06, tedd <[EMAIL PROTECTED]> wrote:
 >>  Hi gang:
 >>
 >>  In a previous post (i.e., [PHP] Strange response to MySQL query) I
 >>  was trying to save a BLOB as a file, namely using an "INTO DUMPFILE"
 >>  query.
 >>
 >>  If you are the system admin, and have all the system permissions,
 >>  then this is not a big problem. However, if you aren't, then getting
 >>  MySQL to dump a file becomes very problematic with respect to getting
 >>  the right permissions to accomplish the task.
 >>
 >>  So, I found a way around it. I am sure that others have thought of
 >>  this before me, so I'm not claiming credit and I am sure that this
 >>  solution is obvious to some -- but, it's just that I searched
 >>  literally hundreds of posts and spent considerable time without
 >>  finding an answer.  The following is the result of my tinkering. So
 >>  here goes:
 >>
 >>  First, on your site create a file called "my_image.png"
 >>
 >>  Second, give it 777 permissions.
 >>
 >>  Third, in your code after opening the dB, grab the image from MySQL:
 >>
 >>  $dbQuery = "SELECT image";
 >>  $dbQuery .= "FROM $your_table ";
 >>  $dbQuery .= "WHERE image_Id = $pageNum";
 >>
 >>  $result = mysql_query($dbQuery) or die("Error: ".mysql_error());
 >>
 >>  Forth, drop the image into a variable:
 >>
 >>  $fileContent = @mysql_result($result, 0, "image");
 >>
 >>  Fifth, create an image from a string (a great function here):
 >>
 >>  $original=imagecreatefromstring($fileContent);
 >>
 >>  Sixth, save the image.
 >>
 >>  imagepng($original, "my_image.png");
 >>
 >>  And Bingo, the image is now the "my_image.png" file.
 >>
 >>  Any comments or suggestions are welcomed.
 >>
 >>  tedd
 >>
 >>  --
 >>
 
>>
 >>  http://sperling.com/
 >>
 >>  --
 >>  PHP General Mailing List (http://www.php.net/)
 >>  To unsubscribe, visit: http://www.php.net/unsub.php
 >>
 >>
 >
 >
 >--
 >Gerry
 >http://portal.danen.org/


 --


 http://sperling.com/




--
Gerry
http://portal.danen.org/



--

http://sperling.com/

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



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

2006-02-16 Thread Manuel Lemos
Hello,

on 02/17/2006 01:55 AM tedd said the following:
>>  > Most of those who are aware of disability issues, don't use any
>> barriers
>>  > at all.
>>
>> CAPTCHA is often used to prevent abuses from people using automated
>> robot programs.
>>
>> To solve the problem of visually impaired people, there are audio
>> CAPTCHA solutions.
>>
>> Regards,
>> Manuel Lemos
>
> Manuel:
>
> No offense meant, but please review this --

No offense taken.


> http://www.access-matters.com/2005/05/22/quiz-115-did-a-captcha-catch-ya/
>
> -- before installing a CAPTCHA.
>
> Accessibility matters.

I am not sure what you mean. Are you saying that nobody should use audio
CAPTCHA because one user was not able to configure his browser to play
the audio CAPTCHA? I am sure that it is something easier to achieve than
screen reader software that many blind users use to access read Web
pages loud.

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



[PHP] attaching MySQL 5.0.18 to PHP 4.4.2

2006-02-16 Thread Paul Goepfert
Hi all,

I know the subject doesn't seem too clear so here is what I am talking
aboukt.  I recently installed php on my windows machine.  The PHP
compiler works great.  However upon looking through the phpinfo ()
document I noticed that the MySQL client version was 3.23.49.  I
assume that is the built in version of MySQL.  I also have installed
MySQL 5.0.18 on my system.  I have my database in the 5.0.18 version
of MySQL .  How do I asssociate the MySQL 5.0.18 version with php?

Paul

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



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

2006-02-16 Thread tedd

 > Most of those who are aware of disability issues, don't use any barriers
 > at all.

CAPTCHA is often used to prevent abuses from people using automated
robot programs.

To solve the problem of visually impaired people, there are audio
CAPTCHA solutions.

Regards,
Manuel Lemos


Manuel:

No offense meant, but please review this --

http://www.access-matters.com/2005/05/22/quiz-115-did-a-captcha-catch-ya/

-- before installing a CAPTCHA.

Accessibility matters.

tedd
--

http://sperling.com/

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



Re: [PHP] Clear POST variables

2006-02-16 Thread Mike Tuller
I am not using a session, and redirecting I think would be a bad way  
of doing this because of the potential hit that the server would take  
for every insert. I have done a few pages like this, and never ran  
into this situation. Now I need to go back and fix this. Basically  
all I have is this.


add.php

Name: 

?>

Then in insert.php I have this:

if ($_POST['name'] !== "")
{
$name = $_POST['name'];

$query = "insert into Locations
(name)
values
('$name)";

mysql_query($query, $link) or die 
(mysql_error());
}

This is how I learned in some book somewhere. Is everyone saying that  
I need to either use sessions, or redirect so that when someone  
refreshes insert.php, it doesn't submit the information again? To me  
it seems that there has to be a more efficient way. I don't  
understand the token thing that some are suggesting.






On Feb 16, 2006, at 4:39 PM, Curt Zirzow wrote:


On Thu, Feb 16, 2006 at 01:23:23PM -0600, Richard Lynch wrote:

On Thu, February 16, 2006 9:07 am, Mike Tuller wrote:

How do I clear out the POST variables, or the variables that I have
set from the POST variables, so that when the page is refreshed it
will not resubmit.  I have tried unset() and have tried to set it to
and
empty value, but it doesn't seem to work.


You can't clear out the POST variables -- they are SENT by the  
browser

to you.

The simplest solution is to set up a one-time-use token and embed  
that

in your FORM data:



I usually use a session based token but i guess it the result is
the same.

Curt.
--
cat .signature: No such file or directory

--
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] Clearing pipe stream and a few other issues.

2006-02-16 Thread Support
Permissions on a virtual server is the reason for running this script as a
cgi. It's not what prefer to do. However, this is only way php will work
under my user name. Perl would probably be a better alternative but I don't
know perl. If I had control of the apache server this would not be a
problem.

I have the script working, I just need to clear up these issues.

Zed

- Original Message - 
From: "Chris" <[EMAIL PROTECTED]>
To: "zedleon" <[EMAIL PROTECTED]>
Cc: 
Sent: Thursday, February 16, 2006 8:27 PM
Subject: Re: [PHP] Clearing pipe stream and a few other issues.


>
> >  >
> > $fp=popen("cat","r");
> > $str=fgets($fp);
> > pclose($fp);
> >
> > print $str;
> >
> > $arr = array();
> > foreach (explode('&', $str) as $v) {
> > $split = explode('=', $v);
> > // urldecode content for readability
> > $arr[$split[0]] = urldecode($split[1]); // create assoc. array
> > ${$split[0]} = urldecode($split[1]); // form the variables
> > }
> >
> > //echo $sender_name . '' . $arr['sender_name'];
> > print_r($arr);
> >
> > $msg = "Sender's Full Name: $sender_name\n";
> > $msg .= "Sender's E-Mail: $sender_email\n";
> > $msg .= "Secret Message? $sender_msg\n\n";
> > ?>
> >
>
> What exactly are you trying to achieve and what problems were you having
> using it as a normal script?
>
>
> I'm guessing it's some form of a mailing script.
>
> What's wrong with using a regular php script with a mail command:
>
>  $sender_name = htmlentities($_POST['sender_name']);
> $sender_email = htmlentities($_POST['sender_email']);
> $sender_msg = htmlentities($_POST['sender_msg']);
>
> $msg = "Name: $sender_name\n";
> $msg .= "Email: $sender_email\n";
> $msg .= "Message: $sender_msg\n";
>
> mail('');
> ?>
>
>
> and then your form posts to this script (change the form action to point
> to this new file)...
>
> -- 
> 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] Clearing pipe stream and a few other issues.

2006-02-16 Thread Chris



' . $arr['sender_name'];
print_r($arr);

$msg = "Sender's Full Name: $sender_name\n";
$msg .= "Sender's E-Mail: $sender_email\n";
$msg .= "Secret Message? $sender_msg\n\n";
?>



What exactly are you trying to achieve and what problems were you having 
using it as a normal script?



I'm guessing it's some form of a mailing script.

What's wrong with using a regular php script with a mail command:




and then your form posts to this script (change the form action to point 
to this new file)...


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



Re: [PHP] Site bloated by images

2006-02-16 Thread Warren Vail
Good point, I didn't check all the images and probably had assumed that 
there was one that was huge.  Another candidate to look at, is the number 
of file transfer threads that her server can maintain for each client, this 
is often limited.  I have seen one occasion when a user cranked the number 
down to just a few (2 or 3) and transfer became very slow as some transfers 
had to wait on others to complete, but this was limited to pages with lots 
of images.


this of course would be a server issue (apache or whatever) and not 
PHP.  Seems also that browser security (firewalls) could be a factor as well.


Warren Vail
[EMAIL PROTECTED]

At 03:14 PM 2/16/2006, Curt Zirzow wrote:

On Thu, Feb 16, 2006 at 02:39:54PM -0800, Warren Vail wrote:
> MARG's suggestion is right on,
>
> I took a look at some of the images, and while relatively small at 250 x
> 300 pixels, they end up displaying in an image statement that limits them
> to 15 x 16 pixels (or there abouts) on the finished page.  If you only 
need

> 15 x 16 pixels, resize the files to that size and reduce the transfer size
> to about 5 percent of their current size.  What you are doing is
> transferring all the pixels then asking the browser at the destination to
> resize them.  This will eat up bandwidth very fast.  If you need to keep
> the original image with lots of pixels, keep copies on your work machine
> and not on the server.

Yes, this an issue, but doesn't explain why it takes 20 minutes to
load page in full, while 90% of the time is waiting for a response.

I hardly think the problem is either php or image size related,
there is something else wrong.

Curt.
--
cat .signature: No such file or directory

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


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



[PHP] Re: A quick Regex query

2006-02-16 Thread M. Sokolewicz

hi, have you tried
[^0-9][0-9]{4} [A-Za-zÅØ]{2,20}
?

- tul

phplists wrote:

Hi,

I am using the following:
[0-9]{4} [A-Za-zÅØ]{2,20}

to extract data like:
1000 Øslo

How can I alter the above to limit to ONLY 4 digits, or in other words 
exclude:

11000 Beograd

Please note that what I am extracting from is NOT at the begining of a 
line, so I can't use the ^ first.



Also, you may notice a couple of 'special' characters in my expression 
'Å + Ø'  By putting them in they seem to work fine, but is this the best 
way of doing it?


MTIA
Alexis


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



Re: [PHP] A quick Regex query

2006-02-16 Thread Jim McIntyre

At 4:57 PM -0500 2/16/06, phplists wrote:

Hi,

I am using the following:
[0-9]{4} [A-Za-zÅØ]{2,20}

to extract data like:
1000 Øslo

How can I alter the above to limit to ONLY 4 
digits, or in other words exclude:

11000 Beograd

Please note that what I am extracting from is 
NOT at the begining of a line, so I can't use 
the ^ first.


How about:

  ^[^\d\r]*([0-9]{4} [A-Za-zÅØ]{2,20})

The backreferenced pattern $1 contains the extracted string.

Also, you may notice a couple of 'special' 
characters in my expression 'Å + Ø'  By putting 
them in they seem to work fine, but is this the 
best way of doing it?


I'm sorry, I don't know the answer to that.

-Jim

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



Re: [PHP] Clear POST variables

2006-02-16 Thread Curt Zirzow
On Thu, Feb 16, 2006 at 02:07:33PM -0600, Richard Lynch wrote:
> On Thu, February 16, 2006 9:15 am, John Wells wrote:
> > I'm curious to hear what others say, but I tend to build into my
> > application flow a header("Location: someurl") redirect after a form
> > submission.  It's just as if you were to include("somefile") the
> > resulting page, but by using header() you are moving the user away
> > from the action so that this sort of thing won't happen.  In my
> > experience it also helps with a user's tendency to use the back
> > button--which is not "wrong", it can just get in the way of rich
> > applications.
> 
> If it's not "wrong" for me to push the "back" button, why are you
> breaking it with all your re-directs :-)
> 
> Seriously, I think the re-direct feature is the most over-used and
> abused feature.

It really comes down to how you build your application and how it
behaves on a POST. If the application is designed to post something
and come back to the same page, a redirect makes sense after the action
occurs.  But then again you have to worry about how to transmit a
mesage back saying the action is done.

Honestly, i think the abuse of the re-direct is due to the commonly
used browser, IE. If you hit back an ugly message comes up warning
the person that it is going to re-post data, if they hit OK and you
protect against it (like the solution you give later in this
thread) your ok, but if they hit cancel, they get an 'Expired
Page'.  The redirect avoids that issue.

> 
> It's also wasteful of HTTP connections which will kill a busy server,
> and does not scale well.

If the server supports keep-alive connections the client most
likely will use the same connection to make the redirect.


> 
> I generally find that if I sit down and figure out why there is a
> re-direct, and then code the application so that I don't need the
> re-direct, because I've gathered/generated the information in advance
> or re-structed things to not need the re-direct, I end up with a far
> more clean and sensible design in my code-base.

I'm always 100% for thinking things through!

Curt.
-- 
cat .signature: No such file or directory

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



Re: [PHP] PHP job postings?

2006-02-16 Thread Curt Zirzow
On Thu, Feb 16, 2006 at 03:45:39PM -0500,
[EMAIL PROTECTED] wrote:
> 
> I see people post to this list periodically but it really doesn't
> seem like the right place.  Our project is going to be expanding
> quite a bit and we are probably going to be hiring more on-site
> programmers probably in the near future.

It can acceptable to post announcments of jobs here on the list as
mentioned if you make it clear with a tag clearifying that the
topic is about a job offering.  

Although, it really doesn't make sense to post here since most
people are posting for help. 

> 
> Specifically we're looking for people (or lists/forums) in the
> MD/DC/VA area.

If you are looking for specific areas, look for groups related to
php that are in that area that have a job posting.

> 
> Just kind of pre-scouting for my boss before we resort to going
> through headhunters and recruiters and the big job posting sites.

If I was scouting for postions that need to area specific, i'd first
look for a php group that is located within the area. Go to local
colleges post announcments. Look at any sort of group that is
related to php like a linux group. 

Before going to headhunter and the like (assuming cost is an issue)
try things like dice.com, craigslist.com etc..

There are a lot of things you can do, this work can become a
fulltime job. 

HTH,

Curt.
-- 
cat .signature: No such file or directory

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



Re: [PHP] Site bloated by images

2006-02-16 Thread Curt Zirzow
On Thu, Feb 16, 2006 at 02:39:54PM -0800, Warren Vail wrote:
> MARG's suggestion is right on,
> 
> I took a look at some of the images, and while relatively small at 250 x 
> 300 pixels, they end up displaying in an image statement that limits them 
> to 15 x 16 pixels (or there abouts) on the finished page.  If you only need 
> 15 x 16 pixels, resize the files to that size and reduce the transfer size 
> to about 5 percent of their current size.  What you are doing is 
> transferring all the pixels then asking the browser at the destination to 
> resize them.  This will eat up bandwidth very fast.  If you need to keep 
> the original image with lots of pixels, keep copies on your work machine 
> and not on the server.

Yes, this an issue, but doesn't explain why it takes 20 minutes to
load page in full, while 90% of the time is waiting for a response.

I hardly think the problem is either php or image size related,
there is something else wrong.

Curt.
-- 
cat .signature: No such file or directory

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



[PHP] Re: A quick Regex query

2006-02-16 Thread Rafael

phplists wrote:

I am using the following:
[0-9]{4} [A-Za-zÅØ]{2,20}

to extract data like:
1000 Øslo

How can I alter the above to limit to ONLY 4 digits, or in other words 
exclude:

11000 Beograd

Please note that what I am extracting from is NOT at the begining of a 
line, so I can't use the ^ first.


	Well, it depends what "usually is" (can be) before what you want to get 
and the regex family your using.  If it's PCRE, you may try something 
like "\b\d{4} [A-Za-zÅØ]{2,20}"  \b = "word boundary", it's basically 
a word separator and it's not included in the result you get (since it's 
more a "position" rather than a "string")


Also, you may notice a couple of 'special' characters in my expression 
'Å + Ø'  By putting them in they seem to work fine, but is this the 
best way of doing it?


	I think it is.  IIRC what you define in a "class" (i.e. between 
square-brackets) is quite fast; e.g. "[ab]" fastest than "(a|b)", is 
that what you were asking?

--
Atentamente,
J. Rafael Salazar Magaña
Innox - Innovación Inteligente
Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE
[EMAIL PROTECTED]
http://www.innox.com.mx

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



Re: [PHP] A way to block SMTP injections

2006-02-16 Thread Brian Dunning
Sorry, assume $email_address is already set - it's me,  
'[EMAIL PROTECTED]'.


My typo on the '\r\n' should be "\r\n".



I created a simple mail form and am blocking SMTP injections like
this. Seems like it ought to be 100% foolproof, AFAIK you can't
complete and SMTP injection with a Content-Type header in there. Any
opinions?

$body = 'Name: '.$_POST['name'].'\r\n';
$body = $body.'Phone: '.$_POST['phone'].'\r\n';
$body = $body.'Email: '.$_POST['email'].'\r\n';
$body = $body.'Comment: '.$_POST['comment'];
if(!strpos(strtolower($body), 'content-type')) {
mail($email_address, "Site Feedback", $body, "From:
".$email_address);
}


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



RE: [PHP] Session problems

2006-02-16 Thread Chrome
Hi

I've checked the PHP ini and session.auto_start is off (0)

[snip]
Looks like your Session ID that you are trying to insert into the
database in your session_start_handler function is a duplicate of an
existing session.
[/snip]

It IS the existing session... I've verified this by being the only person
that knows where the site is :) (and matching IDs in the DB, natch)

This has stumped my hosting company as well as me

Successful conclusion rewards a night out :)

http://chrome.me.uk/snippets/ << to view the issue (may need a few
refreshes)

Use admin/admin to log in on this site (it's in dev :) )

Ooo at this point I should mention I'm replying to this from my home
address, not work (yeah, I have no life...)

Thanks all

Dan
 
---
http://chrome.me.uk
 
-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: 16 February 2006 21:26
To: Dan Parry
Cc: php-general@lists.php.net
Subject: Re: [PHP] Session problems

On Thu, February 16, 2006 3:50 am, Dan Parry wrote:
> I've been getting an error while using a custom session handler
> utilising a
> MySQL database
>
> The error I receive is:
>
> Duplicate entry '<>' for key 1

Looks like your Session ID that you are trying to insert into the
database in your session_start_handler function is a duplicate of an
existing session.

> Warning: Unknown(): A session is active. You cannot change the session
> module's ini settings at this time. in Unknown on line 0

This to me sounds like you have php.ini setting sessions to 'file' and
then you try to change it in, say, .htaccess but php.ini has
session.auto_start turned on, so you've already got an active 'file'
session going, and PHP ain't gonna let you change horses in mid-stream
to 'user' sessions...

Just a Wild Guess.

If you have .htaccess changing the session to 'user', try turning off
session.auto_start as well, and it may fix it.

You may also have to remove all cookies from your browser (and all
user's browsers) to clear out all old session data...

Or, perhaps, you could get away with changing the session ID name of
the Cookie, which might resolve the situation enough that the old
session data hanging around is a non-issue.

> I've contacted my hosting company regarding this but currently they
> don't
> seem to know the cause

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


__ NOD32 1.1412 (20060216) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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



Re: [PHP] Site bloated by images

2006-02-16 Thread Warren Vail

MARG's suggestion is right on,

I took a look at some of the images, and while relatively small at 250 x 
300 pixels, they end up displaying in an image statement that limits them 
to 15 x 16 pixels (or there abouts) on the finished page.  If you only need 
15 x 16 pixels, resize the files to that size and reduce the transfer size 
to about 5 percent of their current size.  What you are doing is 
transferring all the pixels then asking the browser at the destination to 
resize them.  This will eat up bandwidth very fast.  If you need to keep 
the original image with lots of pixels, keep copies on your work machine 
and not on the server.


good luck,

Warren
[EMAIL PROTECTED]

At 04:51 PM 2/16/2006, Angelo Zanetti wrote:


MARG wrote:

Hi,
I have this site on
http://www.dte.ua.pt/portulano/
The problem with it is that it tak ages for the images to appear.
I have several other sites in the same server and this one is the only 
which has this kind of trouble.

I've already pushed up memory_limit in php.ini, but no good :(
Any help would be apreciated.
Warm Regards,
MARG



perhaps your images need to be made smaller as they might be quite big 
(optimise them for web)

So it might not be a PHP issue...

HTH
Angelo Zanetti

--
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] Clear POST variables

2006-02-16 Thread Curt Zirzow
On Thu, Feb 16, 2006 at 01:23:23PM -0600, Richard Lynch wrote:
> On Thu, February 16, 2006 9:07 am, Mike Tuller wrote:
> > How do I clear out the POST variables, or the variables that I have
> > set from the POST variables, so that when the page is refreshed it
> > will not resubmit.  I have tried unset() and have tried to set it to
> > and
> > empty value, but it doesn't seem to work.
> 
> You can't clear out the POST variables -- they are SENT by the browser
> to you.
> 
> The simplest solution is to set up a one-time-use token and embed that
> in your FORM data:
> 
>  $connection = mysql_connect('localhost', 'username', 'password') or
> die(mysql_error());
> 
> if (isset($_POST['example'])){
>   $token = $_POST['token'];
>   $query = "delete from token where token = '$token'";

I usually use a session based token but i guess it the result is
the same.

Curt.
-- 
cat .signature: No such file or directory

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



Re: [PHP] Using javascript with php

2006-02-16 Thread Richard Lynch

getElementByID()


On Wed, February 15, 2006 4:10 pm, Sugrue, Sean wrote:
> To all,
>
> I have a check box input which I assign an array to the name. I want
> to
> pass the array to a javascript and based on a certain criteria check
> the box. I use the syntax:
> formname.elements['array[]'][index].checked=
> true. It works with IE but since my buddy added an html validator
> to a config file we all use and now the code will not work in Firefox.
> Does anyone out there perform this task differently? Any suggestions?
>
> Sean
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
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] PHP !== Hypertext Pre-Processor

2006-02-16 Thread Richard Lynch
On Thu, February 16, 2006 9:38 am, tedd wrote:
> Gustavo said:
>
>>This great programming language is *much more* than a Hypertext
>> Pre-Processor!
>
> It is?

I've seen a fair number of PHP applications that had nothing to do
with Hypertext...

GD, libPDF, Ming, GTK...

The list goes on.

I was hoping for some inspiration from the ancient poll on php.net
from the last time we went through this.  Some of the suggestions were
very... creative. :-)

Personally, I don't really care what the acronym's words say.  I know
it's "not just for text anymore"

Actually, I think most of the non-text Modules were there when we did
the last acronym change.

And certainly there were many heavy-duty applications whose
"Hypertext" component was not the primary focus of PHP.

So, fwiw, I'm voting -1 on the re-invention of PHP as an acronym.

I could be swayed by a REALLY good acronym that expressed what I
really thought PHP was all about...

But I defy anybody to fit that all into 3 words that come out to PHP.

We'd have to change PHP to:  RCLTDHIPFGAAOCS

which of course stands for:
Really Cool Language That Does HTML, Images, PDFs, Flash, GTK,
Applications, And Other Cool Stuff.

:-)

Damn.  I missed all the cool sockets/soap/streams stuff.  Sorry.

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



[PHP] Clearing pipe stream and a few other issues.

2006-02-16 Thread zedleon
ok, I'm not sure how to explain this but here goes..

I have a php script being used as a cgi to get around certain permission
issues.
Its not what I wanted but is basically working. Running through the cgi-bin
has been
much more difficult however, for example,

1. I need to clear or reset the stream because on occasion, I am get
variables from a previous submission to the form.
Not sure how to do this.
2. I have having trouble using the header function. Its says that the header
is already been sent.
I can only assume at this point its because of the
#!/usr/local/bin/php -q at the top of the script required for cgi's.
I may be wrong. I may not even need the header.

3. The formatting is coming out in plain text..The html code is not
executing. Here again I believe its a header content issue.

  here is the code:

Thank You, $sender_name
Your secret message has been sent.";
?>

 here is the result:
Thank You, David
Your secret message has been sent.

I am rookie at php, so any insights, workarounds or help is appreciated.

Thanks in advance,

Zed


' . $arr['sender_name'];
print_r($arr);

$msg = "Sender's Full Name: $sender_name\n";
$msg .= "Sender's E-Mail: $sender_email\n";
$msg .= "Secret Message? $sender_msg\n\n";
?>

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



[PHP] A quick Regex query

2006-02-16 Thread phplists

Hi,

I am using the following:
[0-9]{4} [A-Za-zÅØ]{2,20}

to extract data like:
1000 Øslo

How can I alter the above to limit to ONLY 4 digits, or in other words 
exclude:

11000 Beograd

Please note that what I am extracting from is NOT at the begining of a 
line, so I can't use the ^ first.



Also, you may notice a couple of 'special' characters in my expression 
'Å + Ø'  By putting them in they seem to work fine, but is this the best 
way of doing it?


MTIA
Alexis

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



Re: [PHP] php module problems ???

2006-02-16 Thread Richard Lynch
On Wed, February 15, 2006 8:36 pm, Mehmet Fatih Akbulut wrote:
> hi all,
> i install fileinfo and memcache using pecl
> #pecl install fileinfo
> #pecl install memcache
> then add extension=fileinfo.so and extension=memcache.so in my php.ini
> file and finally restart apache but still get these errors :
>
> # MIME Magic Support (fileinfo): No
> # memcached Support (memcache): No
>
> what else should i do ???
> do i have to install anything else ?

Check your Apache error log for messages.

It SHOULD have messages about having successfully restarted when you
restarted.

If it doesn't, you only THINK you re-started Apache, and didn't.  I've
seen cases where apachectl (or maybe /etc/rc.d/rc.init/S10apache)
would fail to kill/start Apache, but would output a message that it
HAD done so. :-(

More likely, however, you've got error messages about the .so files
not being valid or not being found.

They have to be where php.ini says they should be, and if your php.ini
is out of sync with your pecl, then pecl put them someplace else. :-(

-- 
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] installing php 4.4.2 on windows system

2006-02-16 Thread Richard Lynch
On Thu, February 16, 2006 3:46 am, Olaf Greve wrote:
>> I have been developing a php website.  I have been ftping my php web
>> pages to a webserver and that works hkowever I don't have an error
>> log
>> on the webserver.  So I downloaded apache 2.0.55.   I am doing a
>> manual installation and I am at the point where it tells me where to
>> place the php.ini file.  The instructions tell me to put the file in
>> a
>> number of places. The directions told me that if I were using apache
>> to use the PHPIniDir directive.  My question is where do I put the
>> php.ini file? Where do I put this Directive? In the Httpd.conf?
>
> Under Windows it didn't use to be necessary to make Apache explicitly
> point to the ini file (at least: for all Apache 1.3.x versions).

PHPIniDir only works in Apache 2, I think...

> Rather,
> the trick used to be to simply place the php.ini file somewhere in the
> path that has been set for all Windows applications.

Or the path which was compiled into the php DLL when it was compiled.

This was usually:
C:\php
C:\php4
C:\php5
or some variant on that.

> Normally, the 'windows' or 'winnt\system32' directories do the trick.

I suspect this only "works" if there was no specific directory chosen
when php DLL was compiled, but it MIGHT be the case that Apache/PHP
would automatically look here via the Windows OS system rules...

Rather than guess, however, a quick look at:

http://php.net/phpinfo

output on your own server will tell you EXACTLY where PHP expects the
php.ini file to be.

-- 
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] installing php 4.4.2 on windows system

2006-02-16 Thread Richard Lynch
On Wed, February 15, 2006 10:43 pm, Paul Goepfert wrote:
> I have been developing a php website.  I have been ftping my php web
> pages to a webserver and that works hkowever I don't have an error log
> on the webserver.

If you want Apache error logs, you can just configure Apache to
generate them and put them where you want them...

They usually end up in /var/log/httpd/error.log (or somesuch) by
default, though with older Apache from source maybe in
/usr/local/lib/apache/logs/error or similar.

It's quite likely that you HAVE error logs, but just don't know where
they are :-)

locate error_log

might find them for you.

If the error logging was turned "off" in Apache config, you want to
find your "httpd.conf" file:

locate httpd.conf

and turn it back on.

Installing a whole new Apache to turn on error logging is like buying
a new car because the cigarette lighter is missing...

> So I downloaded apache 2.0.55.   I am doing a
> manual installation and I am at the point where it tells me where to
> place the php.ini file.  The instructions tell me to put the file in a
> number of places. The directions told me that if I were using apache
> to use the PHPIniDir directive.  My question is where do I put the
> php.ini file? Where do I put this Directive? In the Httpd.conf?

php.ini traditionally went in /usr/local/lib/php.ini

Many OS-installed distros (RPMs et al) put it in place like:
/etc/php.ini
/usr/local/etc/php.ini

locate php.ini

might be instructive.

You can put php.ini anyplace you like ; You just have to convince
Apache+PHP where to find it.

PHPIniDir directive in Apache 2.0 simplifies this.
PHPIniDir would need to go in httpd.conf file.

All these "locate xyz" things assume you can SSH (telnet?!) in to your
server...

If you ONLY have FTP access, then it is unlikely to be useful...

It is equally unlikely, with only FTP access, that you'll be able to
successfully install a new Apache anyway, much less get it to run
(you'd have to have root access).

Some webhosts, for reasons beyond my ken, do not provide log files
unless you specifically ask for them, but will do it if you ask.

-- 
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] CSS Groups?

2006-02-16 Thread Weber Sites LTD
http://www.weberforums.com

There is a CSS forum where I get all of my questions  answered :)

berber 

-Original Message-
From: William Stokes [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 16, 2006 2:58 PM
To: php-general@lists.php.net
Subject: [PHP] CSS Groups?

Anybody know any good CSS groups? I don't want to post here non PHP related
stuff

Thanks
-Will

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

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



Re: [PHP] Session problems

2006-02-16 Thread Richard Lynch
On Thu, February 16, 2006 3:50 am, Dan Parry wrote:
> I've been getting an error while using a custom session handler
> utilising a
> MySQL database
>
> The error I receive is:
>
> Duplicate entry '<>' for key 1

Looks like your Session ID that you are trying to insert into the
database in your session_start_handler function is a duplicate of an
existing session.

> Warning: Unknown(): A session is active. You cannot change the session
> module's ini settings at this time. in Unknown on line 0

This to me sounds like you have php.ini setting sessions to 'file' and
then you try to change it in, say, .htaccess but php.ini has
session.auto_start turned on, so you've already got an active 'file'
session going, and PHP ain't gonna let you change horses in mid-stream
to 'user' sessions...

Just a Wild Guess.

If you have .htaccess changing the session to 'user', try turning off
session.auto_start as well, and it may fix it.

You may also have to remove all cookies from your browser (and all
user's browsers) to clear out all old session data...

Or, perhaps, you could get away with changing the session ID name of
the Cookie, which might resolve the situation enough that the old
session data hanging around is a non-issue.

> I've contacted my hosting company regarding this but currently they
> don't
> seem to know the cause

-- 
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] PHP job postings?

2006-02-16 Thread Weber Sites LTD
http://www.weberforums.com/ 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 16, 2006 10:46 PM
To: php-general@lists.php.net
Subject: [PHP] PHP job postings?

Just wondering if anyone know of a mailing list of forum specifically
dedicated to soliciting for programmers to fill PHP programming positions?

I see people post to this list periodically but it really doesn't seem like
the right place.  Our project is going to be expanding quite a bit and we
are probably going to be hiring more on-site programmers probably in the
near future.

Specifically we're looking for people (or lists/forums) in the MD/DC/VA
area.

Just kind of pre-scouting for my boss before we resort to going through
headhunters and recruiters and the big job posting sites.

Thanks.

-TG


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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

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



Re: [PHP] gd extension crashed on mandrake

2006-02-16 Thread Richard Lynch
On Thu, February 16, 2006 4:40 am, Roman Rumisek wrote:
> Hi. I attempt the antispam.php from jpgraph library but
> both cli and mod php crashed with SIGINT 11 in imagecreatefromstring
> function. String is correct (I saved it into the file and view it in
> Firefox - OK).
> PHP version: 4.3.8, gd version: both 2.0.27 and 2.0.33. - original
> Mandrake rpm(libgd2-2.0.33-3mdk, libgd2-2.0.27-3mdk,
> mod_php-4.3.8-1mdk,
> php-gd-4.3.8-2mdk, libphp_common432-4.3.8-3mdk, php-cgi-4.3.8-3mdk).
>
> Can you help me ?

Check for your bug here:
http://bugs.php.net
and also on the GD site.

If it's not there, post the raw text string somewhere on the 'net,
file a bug report, and link to it.

One Issue:
Browsers are notoriously forgiving and capable of rendering botched
images, as well as image formats that GD doesn't know about (EG, AOL's
image "format"), so the browser test is not really conclusive.

Try opening that image up in graphics programs like GIMP, PhotoShop,
GraphicConverter, etc and see what happens in each.  One of those
programs may be able to clue you in to what's going wrong.

-- 
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] PHP job postings?

2006-02-16 Thread Philip Hallstrom
Just wondering if anyone know of a mailing list of forum specifically 
dedicated to soliciting for programmers to fill PHP programming 
positions?


I see people post to this list periodically but it really doesn't seem 
like the right place.  Our project is going to be expanding quite a bit 
and we are probably going to be hiring more on-site programmers probably 
in the near future.


Specifically we're looking for people (or lists/forums) in the MD/DC/VA 
area.


Just kind of pre-scouting for my boss before we resort to going through 
headhunters and recruiters and the big job posting sites.


I think it's a reasonable place as long as you clearly mark the subject 
"JOB" with the *location*.


Also...

http://www.zend.com/jobs/
http://craigslist.org/

Seems craiglist.org has much better stuff than monster, etc.

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



Re: [PHP] PHP job postings?

2006-02-16 Thread Richard Lynch
On Thu, February 16, 2006 2:45 pm, [EMAIL PROTECTED] wrote:
> Just wondering if anyone know of a mailing list of forum specifically
> dedicated to soliciting for programmers to fill PHP programming
> positions?
>
> I see people post to this list periodically but it really doesn't seem
> like the right place.  Our project is going to be expanding quite a
> bit and we are probably going to be hiring more on-site programmers
> probably in the near future.
>
> Specifically we're looking for people (or lists/forums) in the
> MD/DC/VA area.
>
> Just kind of pre-scouting for my boss before we resort to going
> through headhunters and recruiters and the big job posting sites.

http://www.php.net/links.php

has a "Jobs" section, a bit far down, but it's there and looks quite
good.

-- 
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] Saving a BLOB image to a file (SOLVED)

2006-02-16 Thread tedd

Gerry wrote:


What if several users try to access a different picture at the same
time? Won't that render the wrong image for some?

Gerry



Gerry:

Normally, it's not needed for civilians. This is for when YOU want to 
do some image stuff on your images, like to do some background 
processing via your code.


As for users, they just want to see the image and you can pull that 
out of your dB or files, whichever you prefer.


tedd

---




On 2/16/06, tedd <[EMAIL PROTECTED]> wrote:

 Hi gang:

 In a previous post (i.e., [PHP] Strange response to MySQL query) I
 was trying to save a BLOB as a file, namely using an "INTO DUMPFILE"
 query.

 If you are the system admin, and have all the system permissions,
 then this is not a big problem. However, if you aren't, then getting
 MySQL to dump a file becomes very problematic with respect to getting
 the right permissions to accomplish the task.

 So, I found a way around it. I am sure that others have thought of
 this before me, so I'm not claiming credit and I am sure that this
 solution is obvious to some -- but, it's just that I searched
 literally hundreds of posts and spent considerable time without
 finding an answer.  The following is the result of my tinkering. So
 here goes:

 First, on your site create a file called "my_image.png"

 Second, give it 777 permissions.

 Third, in your code after opening the dB, grab the image from MySQL:

 $dbQuery = "SELECT image";
 $dbQuery .= "FROM $your_table ";
 $dbQuery .= "WHERE image_Id = $pageNum";

 $result = mysql_query($dbQuery) or die("Error: ".mysql_error());

 Forth, drop the image into a variable:

 $fileContent = @mysql_result($result, 0, "image");

 Fifth, create an image from a string (a great function here):

 $original=imagecreatefromstring($fileContent);

 Sixth, save the image.

 imagepng($original, "my_image.png");

 And Bingo, the image is now the "my_image.png" file.

 Any comments or suggestions are welcomed.

 tedd

 --


 http://sperling.com/

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





--
Gerry
http://portal.danen.org/



--

http://sperling.com/

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



Re: [PHP] A way to block SMTP injections

2006-02-16 Thread Curt Zirzow
On Thu, Feb 16, 2006 at 11:05:13AM -0800, Brian Dunning wrote:
> I created a simple mail form and am blocking SMTP injections like  
> this. Seems like it ought to be 100% foolproof, AFAIK you can't  
> complete and SMTP injection with a Content-Type header in there. Any  
> opinions?
> 
> $body = 'Name: '.$_POST['name'].'\r\n';
> $body = $body.'Phone: '.$_POST['phone'].'\r\n';
> $body = $body.'Email: '.$_POST['email'].'\r\n';
> $body = $body.'Comment: '.$_POST['comment'];
> if(!strpos(strtolower($body), 'content-type')) {
>   mail($email_address, "Site Feedback", $body, "From: 
>   ".$email_address);
> }

You're main issue is with the $email_address var, where is that
comming from?

Here is something I posted a few months ago relating to what to watch
out for:

http://news.zirzow.dyndns.org/news.php/php.general/read/939b664d151f374782f8ba48e9bf5161/

Curt.
-- 
cat .signature: No such file or directory

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



Re: [PHP] php.net has turned Japanese [SOLVED]

2006-02-16 Thread Curt Zirzow
On Thu, Feb 16, 2006 at 01:32:27PM -0600, Richard Lynch wrote:
> 
> I think this post can now be condensed into a plea:
> 
> When the php.net site is utilizing a short-cut URL, perhaps an
> additional navigational element should be added to switch languages,
> as it is not at all obvious how one should switch.

There is a small link in the top right corner called my.php.net,
you can set your preferences there.

I could see a nice little drop down with 'select language' in that
grey area for the printer friendly.  Try Submitting a feature
request if it hasn't already been suggested.

Curt.
-- 
cat .signature: No such file or directory

-- 
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 Richard Lynch
On Thu, February 16, 2006 7:23 am, Martin E. Koss wrote:
> So far I'm able to remove bcc, cc, to, etc but unable to remove \n &
> \r.

I dunno why you are having trouble losing \r and \n, since it's not
tricky...

But forget all that, and consider this:

$Email = $_POST['Email'];
$Email = str_replace("\r", "\n", $Email);
$Email = explode("\n");
$Email = $Email[0];
if (trim($Email) !== trim($_POST['Email'])){
  die("spammer");
}
$Email = trim($Email);

Now, whatever other crap headers they added, they're gone, and you can
safe go on with life, secure in the knowledge that $Email, even if
it's not valid, is at least not header-injected with all kinds of crap
you dont' want.

You should do this for all variables that get embedded into headers.

You can't do this on the Body, of course, so they still might be able
to trick things with a cleverly-composed $Email to set up the
Mime-type, and then an html "enhanced" (cough, cough) Body.

Assuming you don't allow HTML "enhanced" email in the first place, do:

$Body = striptags($_POST['Body']);

Should take care of it.

The advantage of this technique is that it doesn't just focus on the
headers you know are "bad" while possibly ignoring other headers
you're not aware of.

It forces the $Email to a single line, which cannot have multiple
headers in it.

Sort of like "whitelist" better than "blacklist"

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



[PHP] PHP job postings?

2006-02-16 Thread tg-php
Just wondering if anyone know of a mailing list of forum specifically dedicated 
to soliciting for programmers to fill PHP programming positions?

I see people post to this list periodically but it really doesn't seem like the 
right place.  Our project is going to be expanding quite a bit and we are 
probably going to be hiring more on-site programmers probably in the near 
future.

Specifically we're looking for people (or lists/forums) in the MD/DC/VA area.

Just kind of pre-scouting for my boss before we resort to going through 
headhunters and recruiters and the big job posting sites.

Thanks.

-TG


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



Re: [PHP] Re: Parsing HTML

2006-02-16 Thread Richard Lynch
On Thu, February 16, 2006 1:20 pm, Boby wrote:
> Jay Blanchard wrote:
>>> I need to extract news items from several news sites.
>  >> ...
>>> Can anybody please give me some pointers?
>>
>> Can you be more specific here? This is awfully broad.
>
> I'll give an example:
>
> Let's say I want to extract some news-items from the www.CNN.com web
> page (If you visit CNN's page, you can see the 'MORE NEWS' block at
> the
> right side).
>
> I know how to extract the news-items (or any other data in the page)
> using regular expressions, but I wonder if there are other ways. The
> code I'm writing will be maintained by other people in the future, and
> perhaps regular expressions won't be easy for them to update when the
> site changes its format.
>
> Can somebody please give me a short overview of the different ways of
> extracting data from HTML?
>
> I hope my question is clear enough now.

First, bypass the problem entirely, and look for an RSS / XML feed of
the same content.

Or a SOAP source of the content.

Or RPC.

Or WebDAV.

Or *anything* but web-scraping and parsing HTML, which should be your
"last resort"

If Regex seems high-maintenance, consider using just strpos and
explode and other simple string functions.

Most of the time, what you want in web-scrape looks like this:


TONS OF CRAP YOU DON'T CARE ABOUT,
LINE AFTER LINE,
PAGE AFTER PAGE...

• Melting
of Atlantic glaciers speeds up• U.S.: Iraqi death
squad members detained• U.N.: Close Gitmo, free
or try detainees | http://i.a.cnn.net/cnn/.element/img/1.3/misc/icon.wd.watch.white.gif";
alt="WATCH" width="39" height="14" hspace="0" vspace="0" border="0"
class="cnnWatchBtn">• Bush OK with Cheney's
story on shooting | Shooting
timeline• 360° Blog: 
Massive morgue
outside New Orleans rests in peace• White House
urged to review sale of U.S. ports to Arab
firm• Watch:
 Volunteers
build hope, homes on the bayou | Read• Watch:  Rings?
Check. Vows? Check. Caskets? Check.• New Bond
film finds its villain

Re: [PHP] Parsing HTML

2006-02-16 Thread Sumeet

Boby wrote:

I need to extract news items from several news sites.

In order to do that, I need to parse the HTML data.

I know how to use Regular Expressions, but I wonder if there are other 
ways to do that.


Can anybody please give me some pointers?



i could suggest you to use html parsing libraries available on the net 
try. http://www.sourceforge.net and http://www.phpclasses.org


--
Sumeet Shroff
http://www.prateeksha.com
Web Design and Ecommerce Development, Mumbai India

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



RE: [PHP] Re: Parsing HTML

2006-02-16 Thread Jay Blanchard
[snip]
Let's say I want to extract some news-items from the www.CNN.com web 
page (If you visit CNN's page, you can see the 'MORE NEWS' block at the 
right side).

I know how to extract the news-items (or any other data in the page) 
using regular expressions, but I wonder if there are other ways. The 
code I'm writing will be maintained by other people in the future, and 
perhaps regular expressions won't be easy for them to update when the 
site changes its format.

Can somebody please give me a short overview of the different ways of 
extracting data from HTML?

I hope my question is clear enough now.
[/snip]

This was clear (and just as broad) before, but the answer is going to be
very broad. Have you looked at RSS feeds?

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



Re: [PHP] Clear POST variables

2006-02-16 Thread Richard Lynch
On Thu, February 16, 2006 9:15 am, John Wells wrote:
> I'm curious to hear what others say, but I tend to build into my
> application flow a header("Location: someurl") redirect after a form
> submission.  It's just as if you were to include("somefile") the
> resulting page, but by using header() you are moving the user away
> from the action so that this sort of thing won't happen.  In my
> experience it also helps with a user's tendency to use the back
> button--which is not "wrong", it can just get in the way of rich
> applications.

If it's not "wrong" for me to push the "back" button, why are you
breaking it with all your re-directs :-)

Seriously, I think the re-direct feature is the most over-used and
abused feature.

It's also wasteful of HTTP connections which will kill a busy server,
and does not scale well.

I generally find that if I sit down and figure out why there is a
re-direct, and then code the application so that I don't need the
re-direct, because I've gathered/generated the information in advance
or re-structed things to not need the re-direct, I end up with a far
more clean and sensible design in my code-base.

YMMV

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



[PHP] Re: Parsing HTML

2006-02-16 Thread Boby

Jay Blanchard wrote:

I need to extract news items from several news sites.

>> ...

Can anybody please give me some pointers?


Can you be more specific here? This is awfully broad.


I'll give an example:

Let's say I want to extract some news-items from the www.CNN.com web 
page (If you visit CNN's page, you can see the 'MORE NEWS' block at the 
right side).


I know how to extract the news-items (or any other data in the page) 
using regular expressions, but I wonder if there are other ways. The 
code I'm writing will be maintained by other people in the future, and 
perhaps regular expressions won't be easy for them to update when the 
site changes its format.


Can somebody please give me a short overview of the different ways of 
extracting data from HTML?


I hope my question is clear enough now.

TIA.

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



Re: [PHP] Site bloated by images

2006-02-16 Thread Richard Lynch
On Thu, February 16, 2006 8:36 am, MARG wrote:
> I have this site on
> http://www.dte.ua.pt/portulano/
>
> The problem with it is that it tak ages for the images to appear.
> I have several other sites in the same server and this one is the only
> which has this kind of trouble.
>
> I've already pushed up memory_limit in php.ini, but no good :(

It's probably not (just) the images...

I did:
time wget http://www.dte.ua.pt/portulano/
which snags JUST the HTML, and no images.

It went up to around 28K in reasonable time, and then just sort of
hung for a log time with that ~28K number.

real3m3.158s
user0m0.001s
sys 0m0.016s


Doing a:
split -b 28000 index.html
would indicate that the problem code is in or near the calendar
section of the HTML.

Of course, this was only a single test.  You'd need to duplicate and
see the same behaviour multiple times, at the same filesize point, to
be sure it's where I think it is.

And, really, it's not the best way to test these things, but without
having your source, it was the best easy thing I could come up with.

That said, all these posts about the images are probably a false
trail, at least for your first pass of debugging.

:-)

-- 
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] A way to block SMTP injections

2006-02-16 Thread Richard Lynch




On Thu, February 16, 2006 1:05 pm, Brian Dunning wrote:
> I created a simple mail form and am blocking SMTP injections like
> this. Seems like it ought to be 100% foolproof, AFAIK you can't
> complete and SMTP injection with a Content-Type header in there. Any
> opinions?
>
> $body = 'Name: '.$_POST['name'].'\r\n';
> $body = $body.'Phone: '.$_POST['phone'].'\r\n';
> $body = $body.'Email: '.$_POST['email'].'\r\n';
> $body = $body.'Comment: '.$_POST['comment'];
> if(!strpos(strtolower($body), 'content-type')) {
>   mail($email_address, "Site Feedback", $body, "From:
> ".$email_address);
> }

Where does $email_address come from?

Unless we know that, we can't discuss header injection...

Also, this:
$body = $body . "...";

is more usually expressed as:

$body .= "...";

And, finally, your '\r\n' are not going to work.
Only \\ and \' are special inside ''
You need "" for \r\n to be special.

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



[PHP] Re: Parsing HTML

2006-02-16 Thread Rafael
	If all you want is to "parse" HTML code, then you could treat it as 
XML, of course, that would assume that the sites are all well XHTML 
formed.  Other than that, I can only thing on PCRE.


Boby wrote:

I need to extract news items from several news sites.

In order to do that, I need to parse the HTML data.

I know how to use Regular Expressions, but I wonder if there are other 
ways to do that.

--
Atentamente,
J. Rafael Salazar Magaña
Innox - Innovación Inteligente
Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE
[EMAIL PROTECTED]
http://www.innox.com.mx

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



Re: [PHP] Clear POST variables

2006-02-16 Thread Richard Lynch
On Thu, February 16, 2006 1:23 pm, Richard Lynch wrote:
> if (isset($_POST['example'])){

D'oh!

Either add an INPUT named "example" or change this line to "token"
instead of "example"

Need caffiene.

-- 
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] Clear POST variables

2006-02-16 Thread Richard Lynch
On Thu, February 16, 2006 9:14 am, Dan Parry wrote:
> Submit the data to a page that just inserts it into the DB (validating
> it
> first, natch) then do a header(location) to the thank you (or
> whatever) page
>
> This also fixes 'page expired' warnings

I've tried this...

Depending on the speed of the browser, network connection, your
web-server, and your database, the user *MIGHT* be able to hit reload
and/or bookmark and/or their "Back" button, quickly enough, and in
enough weird combinations, to fool the browser into using the same URL
again.

I would not consider this a reliable method, so if it really matters
to you, I wouldn't do it this way.

YMMV

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



[PHP] php.net has turned Japanese [SOLVED]

2006-02-16 Thread Richard Lynch
Yesterday, while searching for a way to programmatically do HTTP Basic
Authentication, I ended up visiting the Japanese language version of
http://php.net/

The User-Contributed notes that matched my search were in English, so
I thought nothing of it, and successfully completed that task.

Today, I type something like:
http://php.net/mysql_affected_rows
And I end up on the Japanese site, with no /ja/ in the URL.

I suppose this is a "feature" and a nifty one at that...

... for those users that can actually read Japanese.

E...  How do I turn this feature off?

:-) :-) :-)

Actually, I'd have to say it's a bug that viewing the site ONE TIME in
some language forever ties one to that language...  I did nothing
explicit to "choose" Japanese, other than clicking on a link in a
search engine -- said link having nothing about it to indicate I was
switching to Japanese.

Aha!  I just click on a link to get to a URL with /ja/ in it, then
change the /ja/ to /en/ and then it default back to English when I use
a short-cut URL again.

I think this post can now be condensed into a plea:

When the php.net site is utilizing a short-cut URL, perhaps an
additional navigational element should be added to switch languages,
as it is not at all obvious how one should switch.

-- 
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] Clear POST variables

2006-02-16 Thread Richard Lynch
On Thu, February 16, 2006 9:07 am, Mike Tuller wrote:
> How do I clear out the POST variables, or the variables that I have
> set from the POST variables, so that when the page is refreshed it
> will not resubmit.  I have tried unset() and have tried to set it to
> and
> empty value, but it doesn't seem to work.

You can't clear out the POST variables -- they are SENT by the browser
to you.

The simplest solution is to set up a one-time-use token and embed that
in your FORM data:



  
  



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



[PHP] A way to block SMTP injections

2006-02-16 Thread Brian Dunning
I created a simple mail form and am blocking SMTP injections like  
this. Seems like it ought to be 100% foolproof, AFAIK you can't  
complete and SMTP injection with a Content-Type header in there. Any  
opinions?


$body = 'Name: '.$_POST['name'].'\r\n';
$body = $body.'Phone: '.$_POST['phone'].'\r\n';
$body = $body.'Email: '.$_POST['email'].'\r\n';
$body = $body.'Comment: '.$_POST['comment'];
if(!strpos(strtolower($body), 'content-type')) {
mail($email_address, "Site Feedback", $body, "From: ".$email_address);
}

Too simple to be true?

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



RE: [PHP] Parsing HTML

2006-02-16 Thread Jay Blanchard
[snip]
I need to extract news items from several news sites.

In order to do that, I need to parse the HTML data.

I know how to use Regular Expressions, but I wonder if there are other 
ways to do that.

Can anybody please give me some pointers?
[/snip]

Can you be more specific here? This is awfully broad.

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



[PHP] Parsing HTML

2006-02-16 Thread Boby

I need to extract news items from several news sites.

In order to do that, I need to parse the HTML data.

I know how to use Regular Expressions, but I wonder if there are other 
ways to do that.


Can anybody please give me some pointers?

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



Re: [PHP] Session problems

2006-02-16 Thread Curt Zirzow
On Thu, Feb 16, 2006 at 12:37:14PM -, Dan Parry wrote:
> Here is the complete code from the class... it's just a modified version of
> that available from an article on the Zend site
> 
>  
> $ses_class = new session();
>   ini_set("session.save_handler", "user");

You dont need to do this. session_set_save_handler() worries (if at
all) about that.

Curt.
-- 
cat .signature: No such file or directory

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



Re: [PHP] Saving a BLOB image to a file (SOLVED)

2006-02-16 Thread Gerry Danen
What if several users try to access a different picture at the same
time? Won't that render the wrong image for some?

Gerry

On 2/16/06, tedd <[EMAIL PROTECTED]> wrote:
> Hi gang:
>
> In a previous post (i.e., [PHP] Strange response to MySQL query) I
> was trying to save a BLOB as a file, namely using an "INTO DUMPFILE"
> query.
>
> If you are the system admin, and have all the system permissions,
> then this is not a big problem. However, if you aren't, then getting
> MySQL to dump a file becomes very problematic with respect to getting
> the right permissions to accomplish the task.
>
> So, I found a way around it. I am sure that others have thought of
> this before me, so I'm not claiming credit and I am sure that this
> solution is obvious to some -- but, it's just that I searched
> literally hundreds of posts and spent considerable time without
> finding an answer.  The following is the result of my tinkering. So
> here goes:
>
> First, on your site create a file called "my_image.png"
>
> Second, give it 777 permissions.
>
> Third, in your code after opening the dB, grab the image from MySQL:
>
> $dbQuery = "SELECT image";
> $dbQuery .= "FROM $your_table ";
> $dbQuery .= "WHERE image_Id = $pageNum";
>
> $result = mysql_query($dbQuery) or die("Error: ".mysql_error());
>
> Forth, drop the image into a variable:
>
> $fileContent = @mysql_result($result, 0, "image");
>
> Fifth, create an image from a string (a great function here):
>
> $original=imagecreatefromstring($fileContent);
>
> Sixth, save the image.
>
> imagepng($original, "my_image.png");
>
> And Bingo, the image is now the "my_image.png" file.
>
> Any comments or suggestions are welcomed.
>
> tedd
>
> --
> 
> http://sperling.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Gerry
http://portal.danen.org/

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



Re: [PHP] Clear POST variables

2006-02-16 Thread tedd

On 2/16/06, Mike Tuller <[EMAIL PROTECTED]> wrote:

 How do I clear out the POST variables, or the variables that I have
 set from the POST variables, so that when the page is refreshed it
 will not resubmit.  I have tried unset() and have tried to set it to and
 empty value, but it doesn't seem to work.


When needed, I usually loop through the entire $_POST array and
concatenate all the values to one (long?) string - then I take an MD5
hash of this string together with the form name and put in the
$_SESSION array. Now each time one of my scripts with a form action
loads, I include a script in the top which checks the MD5 hash of the
current $_REQUEST array with the one in the $_SESSION array using the
same name, if it exists - unset($_REQUEST) before the form is normally
parsed and action is taken.

(This idea of a script came from one of my co-workers)



Why not use a session ID? Allow post into your dB only once per session.

tedd
--

http://sperling.com/

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



[PHP] Saving a BLOB image to a file (SOLVED)

2006-02-16 Thread tedd

Hi gang:

In a previous post (i.e., [PHP] Strange response to MySQL query) I 
was trying to save a BLOB as a file, namely using an "INTO DUMPFILE" 
query.


If you are the system admin, and have all the system permissions, 
then this is not a big problem. However, if you aren't, then getting 
MySQL to dump a file becomes very problematic with respect to getting 
the right permissions to accomplish the task.


So, I found a way around it. I am sure that others have thought of 
this before me, so I'm not claiming credit and I am sure that this 
solution is obvious to some -- but, it's just that I searched 
literally hundreds of posts and spent considerable time without 
finding an answer.  The following is the result of my tinkering. So 
here goes:


First, on your site create a file called "my_image.png"

Second, give it 777 permissions.

Third, in your code after opening the dB, grab the image from MySQL:

   $dbQuery = "SELECT image";
   $dbQuery .= "FROM $your_table ";
   $dbQuery .= "WHERE image_Id = $pageNum";

   $result = mysql_query($dbQuery) or die("Error: ".mysql_error());

Forth, drop the image into a variable:

   $fileContent = @mysql_result($result, 0, "image");

Fifth, create an image from a string (a great function here):

   $original=imagecreatefromstring($fileContent);

Sixth, save the image.

   imagepng($original, "my_image.png");

And Bingo, the image is now the "my_image.png" file.

Any comments or suggestions are welcomed.

tedd

--

http://sperling.com/

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



Re: [PHP] Clear POST variables

2006-02-16 Thread Kim Christensen
On 2/16/06, Mike Tuller <[EMAIL PROTECTED]> wrote:
> How do I clear out the POST variables, or the variables that I have
> set from the POST variables, so that when the page is refreshed it
> will not resubmit.  I have tried unset() and have tried to set it to and
> empty value, but it doesn't seem to work.

When needed, I usually loop through the entire $_POST array and
concatenate all the values to one (long?) string - then I take an MD5
hash of this string together with the form name and put in the
$_SESSION array. Now each time one of my scripts with a form action
loads, I include a script in the top which checks the MD5 hash of the
current $_REQUEST array with the one in the $_SESSION array using the
same name, if it exists - unset($_REQUEST) before the form is normally
parsed and action is taken.

(This idea of a script came from one of my co-workers)

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] Clear POST variables

2006-02-16 Thread Mike Tuller
What I have is a page that you enter the information in, and when you  
click on submit, it goes to another page that has the code to enter  
it into the database and says "Thank You, you submitted   
information. Are you saying that I should redirect to another page  
after that?


On Feb 16, 2006, at 9:14 AM, Dan Parry wrote:

Submit the data to a page that just inserts it into the DB  
(validating it
first, natch) then do a header(location) to the thank you (or  
whatever) page


This also fixes 'page expired' warnings

HTH

Dan

-Original Message-
From: Mike Tuller [mailto:[EMAIL PROTECTED]
Sent: 16 February 2006 15:07
To: php list
Subject: [PHP] Clear POST variables

I have a page that submits form information into a database, and  
all is

good, but someone testing the page pointed out something to me that I
didn't notice. I have a form that sends you to another page that  
submits

the data into a database. If you refresh the page, the information is
submitted again. Here is what I have.

 $name = $_POST['name'];
 $address = $_POST['address'];
 $city = $_POST['city'];
 $state = $_POST['state'];
 $zipcode = $_POST['zipcode'];
 $phone = $_POST['phone'];
 $notes = $_POST['notes'];

 $query = "insert into Locations
 (name, address, city, loc_state,
main_phone, zipcode, notes)
 values
 ('$name', '$address', '$city',
'$state', '$phone', '$zipcode',
'$notes')";

 mysql_query($query, $link) or die
(mysql_error());


How do I clear out the POST variables, or the variables that I have
set from the POST variables, so that when the page is refreshed it
will not resubmit.  I have tried unset() and have tried to set it  
to and

empty value, but it doesn't seem to work.


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] gd extension crashed on mandrake

2006-02-16 Thread Jochem Maas

Roman Rumisek wrote:
Hi. I attempt the antispam.php from jpgraph library but 
both cli and mod php crashed with SIGINT 11 in imagecreatefromstring


your sure it was the CLI and not the CGI binary? not that that should
make much difference in theory.

function. String is correct (I saved it into the file and view it in 
Firefox - OK).

PHP version: 4.3.8, gd version: both 2.0.27 and 2.0.33. - original


the fact that there are 2 versions of gd could suggest a problem with
mixed-up dependencies which, as I was reminded today, is usually a segfault
waiting to happen. you might consider compiling your php gd extension against
the gb lib bundled with php (you might need to install same php-dev type RPM,
but I wouldn't know for sure) to fix the problem.

here is a bug report that hints at your kind of problem ... it might help you
to undertstand and fix what going wrong for you:

http://bugs.php.net/bug.php?id=29349

another thing to consider is upgrading php to a 4.4.x version - which
has some serious fixes in it (which may have no baring on your problem).
at any rate 4.3.x is (IIRC) consider [fairly?] unsafe due to known/exploitable
security issues.


Mandrake rpm(libgd2-2.0.33-3mdk, libgd2-2.0.27-3mdk, mod_php-4.3.8-1mdk,
php-gd-4.3.8-2mdk, libphp_common432-4.3.8-3mdk, php-cgi-4.3.8-3mdk).


me I suffer from permanent arpiemitis (say it aloud ;-) and perfer to
build php and its extensions 'by hand'  - might be worth a shot to
try to roll you your?



Can you help me ?

Cheers,

Rumisek



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



RE: [PHP] PHP !== Hypertext Pre-Processor

2006-02-16 Thread Finner, Doug

> In the end it is not worth worrying about. If someone asks you what 
> PHP stands for tell them it stands for the best darned programming 
> language you ever saw.

>Not disagreeing, just wondering if people here see PHP as a programming
language, or a scripting language? Just curious >what the general
consensus is, as someone decided to challenge me over it recently and I
was left in two minds over it.

>Cheers,

>Rich

How 'bout this - 'PHP is an application development framework'.  I come
from a Lotus Notes background and get into the same kind of inane
religious discussions about 'you are/are not a programmer because ' in much of the same way I see for
other 'scripting/programming' languages.  I don't program, I create
applications and try and use the right tool for the right function.


___
This e-mail message has been sent by Kollsman, Inc. and is for the use
of the intended recipients only. The message may contain privileged
or confidential information. If you are not the intended recipient
you are hereby notified that any use, distribution or copying of
this communication is strictly prohibited, and you are requested to
delete the e-mail and any attachments and notify the sender immediately.

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



[PHP] gd extension crashed on mandrake

2006-02-16 Thread Roman Rumisek
Hi. I attempt the antispam.php from jpgraph library but 
both cli and mod php crashed with SIGINT 11 in imagecreatefromstring
function. String is correct (I saved it into the file and view it in 
Firefox - OK).
PHP version: 4.3.8, gd version: both 2.0.27 and 2.0.33. - original
Mandrake rpm(libgd2-2.0.33-3mdk, libgd2-2.0.27-3mdk, mod_php-4.3.8-1mdk,
php-gd-4.3.8-2mdk, libphp_common432-4.3.8-3mdk, php-cgi-4.3.8-3mdk).

Can you help me ?

Cheers,

Rumisek

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



RE: [PHP] Clear POST variables

2006-02-16 Thread Dan Parry
Submit the data to a page that just inserts it into the DB (validating it
first, natch) then do a header(location) to the thank you (or whatever) page

This also fixes 'page expired' warnings

HTH

Dan

-Original Message-
From: Mike Tuller [mailto:[EMAIL PROTECTED] 
Sent: 16 February 2006 15:07
To: php list
Subject: [PHP] Clear POST variables

I have a page that submits form information into a database, and all is
good, but someone testing the page pointed out something to me that I
didn't notice. I have a form that sends you to another page that submits
the data into a database. If you refresh the page, the information is
submitted again. Here is what I have.

 $name = $_POST['name'];
 $address = $_POST['address'];
 $city = $_POST['city'];
 $state = $_POST['state'];
 $zipcode = $_POST['zipcode'];
 $phone = $_POST['phone'];
 $notes = $_POST['notes'];

 $query = "insert into Locations
 (name, address, city, loc_state,  
main_phone, zipcode, notes)
 values
 ('$name', '$address', '$city',  
'$state', '$phone', '$zipcode',
'$notes')";

 mysql_query($query, $link) or die  
(mysql_error());


How do I clear out the POST variables, or the variables that I have  
set from the POST variables, so that when the page is refreshed it
will not resubmit.  I have tried unset() and have tried to set it to and
empty value, but it doesn't seem to work.


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] PHP !== Hypertext Pre-Processor

2006-02-16 Thread tedd

Gustavo said:


This great programming language is *much more* than a Hypertext Pre-Processor!


It is?

A rose by any other  Shakespeare
I am what I am ... -- Popeye

And don't forget: perche' un cambiamento tira  l'altra -- Machiavelli

tedd -- non sum qualis eram -- and aren't we all?

--

http://sperling.com/

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



Re: [PHP] Re: Site bloated by images/method question added

2006-02-16 Thread Jochem Maas

Lists wrote:

I've already pushed up memory_limit in php.ini, but no good :(

Any help would be apreciated.

Warm Regards,
MARG


The site itself takes ages to appear. lol.

Source code please!

How is the site genereated?
where are the images stored?



Browser Activity on that page (quoted were long delayed):


http://www.dte.ua.pt/portulano/file.php?file=/1/AboutPort1.jpg
http://www.dte.ua.pt/portulano/file.php?file=/1/Icons/AnaSmall.jpg
http://www.dte.ua.pt/portulano/file.php?file=/1/Icons/PortulanoFavWhite.jpg



none of the files were that big.  I've never seen calling an image file like 
that.  What are the
benefits?


two possible reasons:

1. to hide the true location of a file and/or force viewing according to 
certain rules
(much easier to perform the logic to determine whether a file should be 
returned to the requester
when you have a programming language to write it in)

2. to be able to generate/change images on the fly (e.g. shown a thumbnail of 
an image)

two things that might be going wrong:

1. file.php is opening the session (the defautl session handler does session 
locking so that
all requests to file.php will be handled in series rather than in parrallel)

2. file.php is generating images and not caching the results (if you did cache 
the results
the page would only, in theory, be slow to load the images on the first view of 
the page
- subsequent requests would be returned the cached copy of the generated image.

of course there are many more things that could be going wrong - the OP would
have to show some code (i.e. whatever is in file.php ;-) in order for us to 
determine
the problem though.





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

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] Re: Site bloated by images

2006-02-16 Thread Manuel Lemos
Hello,

on 02/16/2006 12:36 PM MARG said the following:
> Hi,
> 
> I have this site on
> http://www.dte.ua.pt/portulano/
> 
> The problem with it is that it tak ages for the images to appear.
> I have several other sites in the same server and this one is the only
> which has this kind of trouble.
> 
> I've already pushed up memory_limit in php.ini, but no good :(

Your server is being flooded with excessive connections that seem to
exhaust your server memory.

Consider serving the images with a multithreaded HTTP server dedicated
to static content like images and CSS, like thttp.

Here you may find more details on what you can do to solve that problem:

http://www.meta-language.net/metabase-faq.html#excessive-connections


-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



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

2006-02-16 Thread Manuel Lemos
Hello,

on 02/16/2006 01:20 PM tedd said the following:
>> I am currently testing HN CAPTCHA and noticed that the range of
>> alphabets that were produced ranges from A..F only. My PHP skill is
>> quite limited to change that to A..Z so if ppl here have any
>> experience with that class, appreciate your thoughts. TIA.
>>
>> HN CAPTCHA: http://www.phpclasses.org/browse/package/1569.html
>>
>> --roger
> 
> --roger:
> 
> Why use CAPTCHA?
> 
> It is very problematic for the visually impaired.
> 
> If you must use a barrier, then you can make it less difficult (but
> doesn't solve the problem) for the visually impaired by using something
> like:
> 
> http://xn--ovg.com/captcha
> 
> If you want the code, just ask.
> 
> Most of those who are aware of disability issues, don't use any barriers
> at all.

CAPTCHA is often used to prevent abuses from people using automated
robot programs.

To solve the problem of visually impaired people, there are audio
CAPTCHA solutions.

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



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

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


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

--roger


--roger:

Why use CAPTCHA?

It is very problematic for the visually impaired.

If you must use a barrier, then you can make it less difficult (but 
doesn't solve the problem) for the visually impaired by using 
something like:


http://xn--ovg.com/captcha

If you want the code, just ask.

Most of those who are aware of disability issues, don't use any 
barriers at all.


Perhaps if you would share with us the problem you're trying to solve 
and we could come up with a different solution.


tedd
--

http://sperling.com/

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



Re: [PHP] Clear POST variables

2006-02-16 Thread Larry E. Ullman
How do I clear out the POST variables, or the variables that I have  
set from the POST variables, so that when the page is refreshed it
will not resubmit.  I have tried unset() and have tried to set it  
to and

empty value, but it doesn't seem to work.


You can clear out POST by doing this:
$_POST = array();

But that won't do anything in your case because every time the page  
is refreshed the form is resubmitted (and POST is repopulated). You  
need to find a way to ensure unique entries in the database. One  
option is to store a hidden, random value in the form, like a  
timestamp or the md5() of a random value. Then store this in the db,  
along with the other data. Put a unique index on that column so that  
the same random value cannot be inserted multiple times. (In other  
words, the form would need to be reloaded, then resubmitted for the  
data to go into the db.)


HTH,
Larry

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



RE: [PHP] Clear POST variables

2006-02-16 Thread Jay Blanchard
[snip]
How do I clear out the POST variables, or the variables that I have  
set from the POST variables, so that when the page is refreshed it
will not resubmit.  I have tried unset() and have tried to set it to and
empty value, but it doesn't seem to work.
[/snip]

At the end of the database entry unset($_POST) and then redirect to another
page that says Thanks! or redirect back to the empty form.

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



Re: [PHP] Re: Site bloated by images/method question added

2006-02-16 Thread Lists
>> I've already pushed up memory_limit in php.ini, but no good :(
>> 
>> Any help would be apreciated.
>> 
>> Warm Regards,
>> MARG
>The site itself takes ages to appear. lol.
>
>Source code please!
>
>How is the site genereated?
>where are the images stored?

Browser Activity on that page (quoted were long delayed):
>http://www.dte.ua.pt/portulano/file.php?file=/1/AboutPort1.jpg
>http://www.dte.ua.pt/portulano/file.php?file=/1/Icons/AnaSmall.jpg
>http://www.dte.ua.pt/portulano/file.php?file=/1/Icons/PortulanoFavWhite.jpg

none of the files were that big.  I've never seen calling an image file like 
that.  What are the
benefits?

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



RE: [PHP] Clear POST variables

2006-02-16 Thread Gustafson, Tim
I agree.  I always redirect my users to a "GET" page after a successful
posting so that they can't click the browser's "RELOAD" button to cause
a second posting.  I have used this technique in dozens of PHP
applications with hundreds of users, and it really cuts down on
duplicate entries.

On the "POST" page I usually add something to the session variables that
causes the user to see a "Your changes have been saved" type message on
the "GET" page that they're redirected to.

Tim Gustafson
MEI Technology Consulting, Inc
[EMAIL PROTECTED]
(516) 379-0001 Office
(516) 908-4185 Fax
http://www.meitech.com/ 



-Original Message-
From: John Wells [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 16, 2006 10:15 AM
To: php list
Subject: Re: [PHP] Clear POST variables


I'm curious to hear what others say, but I tend to build into my
application flow a header("Location: someurl") redirect after a form
submission.  It's just as if you were to include("somefile") the
resulting page, but by using header() you are moving the user away
from the action so that this sort of thing won't happen.  In my
experience it also helps with a user's tendency to use the back
button--which is not "wrong", it can just get in the way of rich
applications.

Cheers,
John


On 2/16/06, Mike Tuller <[EMAIL PROTECTED]> wrote:
> I have a page that submits form information into a database, and all
is
> good, but someone testing the page pointed out something to me that I
> didn't notice. I have a form that sends you to another page that
submits
> the data into a database. If you refresh the page, the information is
> submitted again. Here is what I have.
>
>  $name = $_POST['name'];
>  $address = $_POST['address'];
>  $city = $_POST['city'];
>  $state = $_POST['state'];
>  $zipcode = $_POST['zipcode'];
>  $phone = $_POST['phone'];
>  $notes = $_POST['notes'];
>
>  $query = "insert into Locations
>  (name, address, city, loc_state,
> main_phone, zipcode, notes)
>  values
>  ('$name', '$address', '$city',
> '$state', '$phone', '$zipcode',
> '$notes')";
>
>  mysql_query($query, $link) or die
> (mysql_error());
>
>
> How do I clear out the POST variables, or the variables that I have
> set from the POST variables, so that when the page is refreshed it
> will not resubmit.  I have tried unset() and have tried to set it to
and
> empty value, but it doesn't seem to work.
>
>
> 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



smime.p7s
Description: S/MIME cryptographic signature


Re: [PHP] Clear POST variables

2006-02-16 Thread John Wells
I'm curious to hear what others say, but I tend to build into my
application flow a header("Location: someurl") redirect after a form
submission.  It's just as if you were to include("somefile") the
resulting page, but by using header() you are moving the user away
from the action so that this sort of thing won't happen.  In my
experience it also helps with a user's tendency to use the back
button--which is not "wrong", it can just get in the way of rich
applications.

Cheers,
John


On 2/16/06, Mike Tuller <[EMAIL PROTECTED]> wrote:
> I have a page that submits form information into a database, and all is
> good, but someone testing the page pointed out something to me that I
> didn't notice. I have a form that sends you to another page that submits
> the data into a database. If you refresh the page, the information is
> submitted again. Here is what I have.
>
>  $name = $_POST['name'];
>  $address = $_POST['address'];
>  $city = $_POST['city'];
>  $state = $_POST['state'];
>  $zipcode = $_POST['zipcode'];
>  $phone = $_POST['phone'];
>  $notes = $_POST['notes'];
>
>  $query = "insert into Locations
>  (name, address, city, loc_state,
> main_phone, zipcode, notes)
>  values
>  ('$name', '$address', '$city',
> '$state', '$phone', '$zipcode',
> '$notes')";
>
>  mysql_query($query, $link) or die
> (mysql_error());
>
>
> How do I clear out the POST variables, or the variables that I have
> set from the POST variables, so that when the page is refreshed it
> will not resubmit.  I have tried unset() and have tried to set it to and
> empty value, but it doesn't seem to work.
>
>
> 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



[PHP] Site bloated by images

2006-02-16 Thread MARG

Hi,

I have this site on
http://www.dte.ua.pt/portulano/

The problem with it is that it tak ages for the images to appear.
I have several other sites in the same server and this one is the only 
which has this kind of trouble.


I've already pushed up memory_limit in php.ini, but no good :(

Any help would be apreciated.

Warm Regards,
MARG

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



[PHP] Re: Site bloated by images

2006-02-16 Thread Barry

MARG wrote:

Hi,

I have this site on
http://www.dte.ua.pt/portulano/

The problem with it is that it tak ages for the images to appear.
I have several other sites in the same server and this one is the only 
which has this kind of trouble.


I've already pushed up memory_limit in php.ini, but no good :(

Any help would be apreciated.

Warm Regards,
MARG

The site itself takes ages to appear. lol.

Source code please!

How is the site genereated?
where are the images stored?

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] Clear POST variables

2006-02-16 Thread Mike Tuller

I have a page that submits form information into a database, and all is
good, but someone testing the page pointed out something to me that I
didn't notice. I have a form that sends you to another page that submits
the data into a database. If you refresh the page, the information is
submitted again. Here is what I have.

$name = $_POST['name'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zipcode = $_POST['zipcode'];
$phone = $_POST['phone'];
$notes = $_POST['notes'];

$query = "insert into Locations
(name, address, city, loc_state,  
main_phone, zipcode, notes)

values
('$name', '$address', '$city',  
'$state', '$phone', '$zipcode',

'$notes')";

mysql_query($query, $link) or die  
(mysql_error());



How do I clear out the POST variables, or the variables that I have  
set from the POST variables, so that when the page is refreshed it

will not resubmit.  I have tried unset() and have tried to set it to and
empty value, but it doesn't seem to work.


Thanks.

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



Re: [PHP] Site bloated by images

2006-02-16 Thread Angelo Zanetti


MARG wrote:

Hi,

I have this site on
http://www.dte.ua.pt/portulano/

The problem with it is that it tak ages for the images to appear.
I have several other sites in the same server and this one is the only 
which has this kind of trouble.


I've already pushed up memory_limit in php.ini, but no good :(

Any help would be apreciated.

Warm Regards,
MARG




perhaps your images need to be made smaller as they might be quite big 
(optimise them for web)
So it might not be a PHP issue...

HTH
Angelo Zanetti

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



[PHP] Secure Mail Form using PHP

2006-02-16 Thread Martin E. Koss
This issue has probably been discussed more than I've been able to find
in the archive, so I'm sorry if I'm going over old ground.
 
I'm trying to make sure my email form cannot be used for spam or
injecting additional code and addresses in any way.
 
So far I'm able to remove bcc, cc, to, etc but unable to remove \n & \r.
If I could do that I'd consider it fairly secure. As you'll see below,
I've been trying various ways of doing it.
 

// CHECK FOR SPAM ATTEMPTS AND REMOVE THEM
$Email = stripslashes($Email);
$Senders_Name = stripslashes($Senders_Name);
$Message = stripslashes($Message);
$recipient = stripslashes($recipient);
$subject = stripslashes($subject);

  $Email = preg_replace( "/[\n\r]+/", " ", $Email );
  // Remove injected headers
  $find = array("/bcc\:/i","/Content\-Type\:/i","/cc\:/i","/to\:/i");
  $Email = preg_replace($find, "", $Email);
  $Senders_Name = preg_replace($find, "", $Senders_Name);
  $Message = preg_replace($find, "", $Message);
  $recipient = preg_replace($find, "", $recipient);
//  $message = preg_replace($find, "", message); 
//  $email=str_replace("\r","\n",$email);
//  $name=str_replace("\r","\n",$name);
//  $message=str_replace("\r","\n",$message);
//  $phone=str_replace("\r","\n",$phone);

//  $Email = ereg_replace( "\r", " ", $Email ); THIS DOES NOT WORK
//  $Email = ereg_replace( "\n", " ", $Email ); THIS DOES NOT WORK
//  $Email = ereg_replace( "bcc:", " ", $Email );
//  $Email = ereg_replace( "cc:", " ", $Email );

$Senders_Name = preg_replace( "/[\n\r]+/", " ", $Senders_Name );

$Message = preg_replace( "/[\n\r]+/", " ", $Message );

$recipient = preg_replace( "/[\n\r]+/", " ", $recipient );

$subject = preg_replace( "/[\n\r]+/", " ", $subject );  




// NOW SEND THE EMAIL
mail("$recipient", "$subject.", $Message,
"From: $Email ($Senders_Name)\nReply-To: $Email\n
Sent by:   $Senders_Name
Email Address: $Email");

 
Thanks for any guidance
 
Martin

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



[PHP] Re: Secure Mail Form using PHP

2006-02-16 Thread Barry

Martin E. Koss wrote:

This issue has probably been discussed more than I've been able to find
in the archive, so I'm sorry if I'm going over old ground.
 
I'm trying to make sure my email form cannot be used for spam or

injecting additional code and addresses in any way.
 
So far I'm able to remove bcc, cc, to, etc but unable to remove \n & \r.

If I could do that I'd consider it fairly secure. As you'll see below,
I've been trying various ways of doing it.
 

strtr() works good for me.

http://de2.php.net/strtr

Barry

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] CSS Groups?

2006-02-16 Thread Kim Christensen
On 2/16/06, William Stokes <[EMAIL PROTECTED]> wrote:
> Anybody know any good CSS groups? I don't want to post here non PHP related
> stuff

http://www.css-discuss.org/

--
Kim Christensen
[EMAIL PROTECTED]

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



[PHP] Re: CSS Groups?

2006-02-16 Thread Barry

William Stokes wrote:
Anybody know any good CSS groups? I don't want to post here non PHP related 
stuff


Thanks
-Will

http://www.css-discuss.org/

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] Secure Mail Form using PHP

2006-02-16 Thread Martin E. Koss
This issue has probably been discussed more than I've been able to find
in the archive, so I'm sorry if I'm going over old ground.
 
I'm trying to make sure my email form cannot be used for spam or
injecting additional code and addresses in any way.
 
So far I'm able to remove bcc, cc, to, etc but unable to remove \n & \r.
If I could do that I'd consider it fairly secure. As you'll see below,
I've been trying various ways of doing it.
 

// CHECK FOR SPAM ATTEMPTS AND REMOVE THEM
$Email = stripslashes($Email);
$Senders_Name = stripslashes($Senders_Name);
$Message = stripslashes($Message);
$recipient = stripslashes($recipient);
$subject = stripslashes($subject);

  $Email = preg_replace( "/[\n\r]+/", " ", $Email );
  // Remove injected headers
  $find = array("/bcc\:/i","/Content\-Type\:/i","/cc\:/i","/to\:/i");
  $Email = preg_replace($find, "", $Email);
  $Senders_Name = preg_replace($find, "", $Senders_Name);
  $Message = preg_replace($find, "", $Message);
  $recipient = preg_replace($find, "", $recipient);
//  $message = preg_replace($find, "", message); 
//  $email=str_replace("\r","\n",$email);
//  $name=str_replace("\r","\n",$name);
//  $message=str_replace("\r","\n",$message);
//  $phone=str_replace("\r","\n",$phone);

//  $Email = ereg_replace( "\r", " ", $Email ); THIS DOES NOT WORK
//  $Email = ereg_replace( "\n", " ", $Email ); THIS DOES NOT WORK
//  $Email = ereg_replace( "bcc:", " ", $Email );
//  $Email = ereg_replace( "cc:", " ", $Email );

$Senders_Name = preg_replace( "/[\n\r]+/", " ", $Senders_Name );

$Message = preg_replace( "/[\n\r]+/", " ", $Message );

$recipient = preg_replace( "/[\n\r]+/", " ", $recipient );

$subject = preg_replace( "/[\n\r]+/", " ", $subject );  




// NOW SEND THE EMAIL
mail("$recipient", "$subject.", $Message,
"From: $Email ($Senders_Name)\nReply-To: $Email\n
Sent by:   $Senders_Name
Email Address: $Email");

 
Thanks for any guidance
 
Martin

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



[PHP] CSS Groups?

2006-02-16 Thread William Stokes
Anybody know any good CSS groups? I don't want to post here non PHP related 
stuff

Thanks
-Will

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



RE: [PHP] Session problems

2006-02-16 Thread Dan Parry
Here is the complete code from the class... it's just a modified version of
that available from an article on the Zend site

ses_table = SESSION_TABLE;
$this->db_host = DB_HOST;
$this->db_user = DB_USER;
$this->db_pass = DB_PASS;
$this->db_dbase = DB_DB_NAME;
}

function localError($code = '', $message = '', $file = '', $line =
-1, $status = ERROR_STATUS_NOTIFY)
{ // handle a local error
global $base;
if (class_exists('baseClass'))
{ // use the base class error handler
$base->errorPush($code, $message, $file, $line,
$status);
} else {
die ('Error ' . $code . '' . $message);
}
}

/* Create a connection to a database */ 
function db_connect() { 
$this->dblink = @mysql_pconnect ($this->db_host, $this->db_user,
$this->db_pass); 
if (!$this->dblink) $this->localError('c1(ses)',
mysql_error(), __file__, __line__, ERROR_STATUS_FATAL);
$mysql_db = @mysql_select_db ($this->db_dbase);
if (!$mysql_db) $this->localError('c1(ses)', mysql_error() .
' - Tried: ' . $this->db_dbase, __file__, __line__, ERROR_STATUS_FATAL); 

if (!$this->dblink || !$mysql_db) { 
return FALSE; 
} else { 
return TRUE; 
} 
} 

/* Open session, if you have your own db connection 
   code, put it in here! */ 
function _open($path, $name) { 
$this->db_connect(); 
return TRUE; 
} 

/* Close session */ 
function _close() { 
/* This is used for a manual call of the 
   session gc function */ 
$this->_gc(0); 
return TRUE; 
} 

/* Read session data from database */ 
function _read($ses_id) { 
$session_sql = "SELECT * FROM " . $this->ses_table 
 . " WHERE ses_id = '$ses_id'"; 
$session_res = @mysql_query($session_sql, $this->dblink) or die
(mysql_error()); 
if (!$session_res) { 
return ''; 
} 

$session_num = @mysql_num_rows ($session_res); 
if ($session_num > 0) { 
$session_row = mysql_fetch_assoc ($session_res); 
$ses_data = $session_row["ses_value"]; 
return $ses_data; 
} else { 
return ''; 
} 
} 

/* Write new data to database */ 
function _write($ses_id, $data) { 
$session_sql = "UPDATE " . $this->ses_table 
 . " SET ses_time='" . time() 
 . "', ses_value='$data' WHERE ses_id='$ses_id'"; 
$session_res = @mysql_query ($session_sql, $this->dblink) or die
(mysql_error()); 
if (!$session_res) { 
return FALSE; 
} 
if (mysql_affected_rows ()) { 
return TRUE; 
} 

$session_sql = "INSERT INTO " . $this->ses_table 
 . " (ses_id, ses_time, ses_start, ses_value)" 
 . " VALUES ('$ses_id', '" . time() 
 . "', '" . time() . "', '$data')"; 
$session_res = @mysql_query ($session_sql, $this->dblink) or die
(mysql_error()); 
if (!$session_res) { 
return FALSE; 
} else { 
return TRUE; 
} 
} 

/* Destroy session record in database */ 
function _destroy($ses_id) { 
$session_sql = "DELETE FROM " . $this->ses_table 
 . " WHERE ses_id = '$ses_id'"; 
$session_res = @mysql_query ($session_sql, $this->dblink) or die
(mysql_error()); 
if (!$session_res) { 
return FALSE; 
} else { 
return TRUE; 
} 
} 

/* Garbage collection, deletes old sessions */ 
function _gc($life) { 
$ses_life = strtotime("-" . SESSION_LIFETIME . " minutes"); 

$session_sql = "DELETE FROM " . $this->ses_table 
 . " WHERE ses_time < $ses_life"; 
$session_res = @mysql_query ($session_sql, $this->dblink);
if (!$session_res)  $this->localError('c1(ses)',
mysql_error() . ' - SQL: ' . $session_sql . 'Click here to build session tables (for database)',
__file__, __line__, ERROR_STATUS_FATAL);


if (!$session_res) { 
return FALSE; 
} else { 
return TRUE; 
} 
} 
}
?>
-Original Message-
From: Peter Lauri [mailto:[EMAIL PROTECTED] 
Sent: 16 February 2006 12:25
To: [EMAIL PROTECTED]; php-general@lists.php.net
Subject: RE: [PHP] Session problems

What is the code that generates this?

-Original Message-
From: "Dan Parry"<[EMAIL PROTECTED]>
Sent: 16/02/06 4:50:51 PM
To: "php-general@lists.php.net"
Subject: [PHP] Session problems

Hi all

 

I've been getting an error while using a custom session handler
utilisin

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

2006-02-16 Thread Manuel Lemos
Hello,

on 02/15/2006 11:44 PM Roger Thomas said the following:
> I am currently testing HN CAPTCHA and noticed that the range of alphabets 
> that were produced ranges from A..F only. My PHP skill is quite limited to 
> change that to A..Z so if ppl here have any experience with that class, 
> appreciate your thoughts. TIA.
> 
> HN CAPTCHA: http://www.phpclasses.org/browse/package/1569.html

I suggest that you contact the author, either posting in that package
support forum in the same site or by e-mail. I think the author is the
most qualified person to make the improvements you want.

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



RE: [PHP] Session problems

2006-02-16 Thread Peter Lauri
What is the code that generates this?

-Original Message-
From: "Dan Parry"<[EMAIL PROTECTED]>
Sent: 16/02/06 4:50:51 PM
To: "php-general@lists.php.net"
Subject: [PHP] Session problems

Hi all

 

I've been getting an error while using a custom session handler utilising a
MySQL database

 

The error I receive is:

 

Duplicate entry '<>' for key 1
Warning: Unknown(): A session is active. You cannot change the session
module's ini settings at this time. in Unknown on line 0

 

I've contacted my hosting company regarding this but currently they don't
seem to know the cause

 

I've Googled but I can't find anything I can use

 

Thanks in advance :-)

 

Dan

 

-

Dan Parry

Senior Developer

Virtua Webtech Ltd

http://www.virtuawebtech.co.uk

 


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



Re: [PHP] please help me I try to post my question to Php.net 2-3 times

2006-02-16 Thread Kim Christensen
On 2/16/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> $filename =3D "c:data.txt";
> $contents =3D file($filename);
> echo $contents;
> ?>
> // data in text file is "1_2_3_4" < _ =3D blank>
> // output is "1 2 3 4"
> // I want fixed possition . please help me ?

I'm not really sure what you're trying to do, but I assume you want to
keep the four(?) spaces when you output the data. If you're going to
display it using HTML, you have to replace the spaces with   -
otherwise HTML truncates the excess whitespace. Try using REGEX:

$contents =3D file($filename);
echo preg_replace("/\s/", " ", $contents);

This regular expression will replace all whitespace
(spaces/newlines/carriage returns) with the character  , which in
HTML yields a blank space.

--
Kim Christensen
[EMAIL PROTECTED]

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



Re: [PHP] installing php 4.4.2 on windows system

2006-02-16 Thread Kim Christensen
On 2/16/06, Olaf Greve <[EMAIL PROTECTED]> wrote:
> Under Windows it didn't use to be necessary to make Apache explicitly
> point to the ini file (at least: for all Apache 1.3.x versions). Rather,
> the trick used to be to simply place the php.ini file somewhere in the
> path that has been set for all Windows applications.

It still ain'¨t necessary, but preferred. Either way works :-)

--
Kim Christensen
[EMAIL PROTECTED]

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



[PHP] Session problems

2006-02-16 Thread Dan Parry
Hi all

 

I've been getting an error while using a custom session handler utilising a
MySQL database

 

The error I receive is:

 

Duplicate entry '<>' for key 1
Warning: Unknown(): A session is active. You cannot change the session
module's ini settings at this time. in Unknown on line 0

 

I've contacted my hosting company regarding this but currently they don't
seem to know the cause

 

I've Googled but I can't find anything I can use

 

Thanks in advance :-)

 

Dan

 

-

Dan Parry

Senior Developer

Virtua Webtech Ltd

http://www.virtuawebtech.co.uk

 



Re: [PHP] installing php 4.4.2 on windows system

2006-02-16 Thread Olaf Greve

Hi Paul,


I have been developing a php website.  I have been ftping my php web
pages to a webserver and that works hkowever I don't have an error log
on the webserver.  So I downloaded apache 2.0.55.   I am doing a
manual installation and I am at the point where it tells me where to
place the php.ini file.  The instructions tell me to put the file in a
number of places. The directions told me that if I were using apache
to use the PHPIniDir directive.  My question is where do I put the
php.ini file? Where do I put this Directive? In the Httpd.conf?


Under Windows it didn't use to be necessary to make Apache explicitly 
point to the ini file (at least: for all Apache 1.3.x versions). Rather, 
the trick used to be to simply place the php.ini file somewhere in the 
path that has been set for all Windows applications.


Normally, the 'windows' or 'winnt\system32' directories do the trick. If 
you're working under NT, 2000, or XP give the latter a go and restart 
Apache. Chances are it still picks it up swell. If it doesn't, then 
indeed perhaps as of Apache 2 you need to explicitly make Apache point 
to the right file.


Cheers!
Olafo

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



[PHP] Re: Re: RE: safe_mode + move_upload_file

2006-02-16 Thread fjug
Le Thu, 16 Feb 2006 10:18:40 +1100, Chris a écrit :

> Basically your '$path' is not owned by the right user.
>

OK you are right, it's hard to deal beetween rights implied by
safe-mode and Unix rights...

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



Re: [PHP] Ternary operators

2006-02-16 Thread Jochem Maas

sorry - I have had a php5 CLI at hand for so long
I forgot that 'php -r' is not available in v4.

that said the 'php -a' option also works (although
I always find the interactive mode odd to work with)

Kevin Kinsey wrote:

Carl Furst wrote:


Well, I tried something simple...

$ php -r 'echo "hello world\n";'
Error in argument 1, char 2: option not found r
Error in argument 1, char 2: option not found r
Usage: php [-q] [-h] [-s] [-v] [-i] [-f ]
  php  [args...]
 -a   Run interactively
 -C   Do not chdir to the script's directory
 -c | Look for php.ini file in this directory
 -n   No php.ini file will be used
 -d foo[=bar] Define INI entry foo with value 'bar'
 -e   Generate extended information for debugger/profiler
 -f Parse .  Implies `-q'
 -h   This help
 -i   PHP information
 -l   Syntax check only (lint)
 -m   Show compiled in modules
 -q   Quiet-mode.  Suppress HTTP Header output.
 -s   Display colour syntax highlighted source.
 -v   Version number
 -w   Display source with stripped comments and whitespace.
 -z Load Zend extension .


This means my install can't run inline stuff like this? Guess it 
wasn't set
up to do that. So no I won't say that I will use php -r to test 
anything..

lol :)
 



Actually run "php -v" and let's see if it's not version 4 ... in
which there is no "r" option available IIRC 



please say your going start using "php -r" to test stuff like this. :-)
  



Not unless he upgrades, apparently.

Still, not too hard to open an editor, code a tiny script,
and run it from the CLI in either PHP4 or PHP5.

Let's all learn to test things, eh?

Kevin Kinsey



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



Re: [PHP] Help! Apache 2.2 gives segmentation fault errors with PHP.

2006-02-16 Thread Olaf Greve

Hi all,

Yesterday I had trouble when configuring Apache 2.2 with PHP 4.4.2, 
which caused Apache to crash (segmentation fault) when calling various 
PHP functions. Just before heading home I encountered the source of the 
issue, as well as the solution.


The hint to the answer resided in the /var/log/httpd-error.log file:

> And the /var/log/httpd-error.log file mentions the following (at the 
end):

> [...]
> PHP Warning:  Function registration failed - duplicate name - bzopen in
> Unknown on line 0
> PHP Warning:  Function registration failed - duplicate name - bzread in
> Unknown on line 0
> [...]
> ..many more similar messages...

This obviously hinted at these functions (i.e php4-extensions) somehow 
being doubly present and called.


Issuing a 'pkg_info | grep php' command was most illustrative, and 
showed over a screen full of output like this:


mod_php4-4.4.2_1,1  PHP Apache Module
php4-bcmath-4.4.2_1 The bcmath shared extension for php
php4-bz2-4.3.10 The bz2 shared extension for php
php4-bz2-4.4.2_1The bz2 shared extension for php
php4-calendar-4.4.2_1 The calendar shared extension for php
php4-crack-4.4.2_1  The crack shared extension for php
php4-ctype-4.4.2_1  The ctype shared extension for php
php4-dio-4.4.2_1The dio shared extension for php
php4-domxml-4.4.2_1 The domxml shared extension for php
php4-exif-4.4.2_1   The exif shared extension for php
php4-extensions-1.0 A "meta-port" to install PHP extensions
php4-gd-4.3.10  The gd shared extension for php
php4-gd-4.4.2_1 The gd shared extension for php
[...more lines where those came from...]

Tadh!! there we go: indeed several extensions were somehow not 
removed properly when a previous upgrade to PHP 4.4.2 (from v4.3.10) was 
performed!


As to the reason for this, go figure, I always install from the ports by 
doing a 'make' 'make deinstall' 'make reinstall' sequence when upgrading...


Anyway, manually removing all PHP extensions using the various 
individual 'make deinstall' sequences (and bluntly pkg_delete for pear). 
Then, I cleanly redid the process for installing mod_php4 and the 
extensions, and now all is working fine!


Tnx for thinking along with me, and beware of this potential pitfall! :)

Cheers!
Olafo

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



Re: [PHP] please help me I try to post my question to Php.net 2-3times

2006-02-16 Thread Hugh Danaher
wvolks wrote "...but when I display data in text file it compress space in 
each lines..."  Sounded to me like he wanted all the blank spaces he put 
into the string, but when he "displayed" it, the spaces were gone.  Since 
html ignores more than one blank space between printable characters, I 
suggested he substitute   for the blank spaces.  He also said "I want 
fixed possition . please help me ?", and so I tried to help.

Regards,
HTD
- Original Message - 
From: "Barry" <[EMAIL PROTECTED]>

To: 
Sent: Thursday, February 16, 2006 12:37 AM
Subject: Re: [PHP] please help me I try to post my question to Php.net 
2-3times




Hugh Danaher wrote:

If you want to preserve the blank spaces then try;

str_replace(" ", " ", $contents); //   is html for blank space.
HTH
HTD


no he don't:
qote:

> read text file to array string


--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.6/257 - Release Date: 2/10/2006






--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.6/257 - Release Date: 2/10/2006

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



Re: [PHP] please help me I try to post my question to Php.net 2-3 times

2006-02-16 Thread Barry

Hugh Danaher wrote:

If you want to preserve the blank spaces then try;

str_replace(" ", " ", $contents); //   is html for blank space.
HTH
HTD


no he don't:
qote:

> read text file to array string


--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] please help me I try to post my question to Php.net 2-3 times

2006-02-16 Thread Hugh Danaher

If you want to preserve the blank spaces then try;

str_replace(" ", " ", $contents); //   is html for blank space.
HTH
HTD
- Original Message - 
From: <[EMAIL PROTECTED]>

To: 
Sent: Wednesday, February 15, 2006 10:26 PM
Subject: [PHP] please help me I try to post my question to Php.net 2-3 times



text file problem

read text file to array string. I use function File(). but when I display
data in text file it compress space in each lines such as first record
contain "1_2__3__4__" ( _ = blank )
when store in array string is "1 2 3 4" . I want you tell me howto do?
+

// data in text file is "1_2_3_4" < _ = blank>
// output is "1 2 3 4"
// I want fixed possition . please help me ?
from Wvolks

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



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.6/257 - Release Date: 2/10/2006






--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.6/257 - Release Date: 2/10/2006

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



[PHP] Re: please help me I try to post my question to Php.net 2-3 times

2006-02-16 Thread Barry

[EMAIL PROTECTED] wrote:

text file problem

read text file to array string. I use function File(). but when I display
data in text file it compress space in each lines such as first record
contain "1_2__3__4__" ( _ = blank )
when store in array string is "1 2 3 4" . I want you tell me howto do?
+

// data in text file is "1_2_3_4" < _ = blank>
// output is "1 2 3 4"
// I want fixed possition . please help me ?
from Wvolks


is it just "whitespace" or are there also commands in it like \t or \r ?

Otherwise just replace the whitespace with "" like

$filename = "c:data.txt";
str_replace(" ", "", $contents);
echo $contents;

Something like that?

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



  1   2   >