php-general Digest 26 Apr 2002 13:12:28 -0000 Issue 1309

Topics (messages 94696 through 94726):

HTTP GET with Digest Auth
        94696 by: Eric

Re: Redirect
        94697 by: Maxim Maletsky \(PHPBeginner.com\)
        94698 by: John Holmes

mail() not sending -- Little bit OT
        94699 by: David Redmond
        94700 by: Miguel Cruz
        94701 by: Justin French

Re: º becomes $
        94702 by: heinisch.creaction.de
        94708 by: hugh danaher

Re: Form validation
        94703 by: Tarjei Huse

Re: Won't save session ids?
        94704 by: Johan Holst Nielsen

good php hosting environments
        94705 by: hamish
        94706 by: Brian McGarvie
        94726 by: Michael Egan

how to use session data in other php scripts
        94707 by: Deval Parikh
        94719 by: Uchendu Nwachukwu

Combine SQL query OT
        94709 by: Richard Baskett
        94715 by: php3.developersdesk.com

Callin PHP gurus...figure this out
        94710 by: r
        94714 by: Michael Virnstein
        94716 by: Michael Virnstein
        94717 by: Michael Virnstein
        94718 by: Uchendu Nwachukwu
        94725 by: John Holmes

Problem on Load CSV file to Mysql through PHP Script
        94711 by: Jack

Re: Array function to delete
        94712 by: Ford, Mike               [LSS]

Re: Session.save_path in php.ini
        94713 by: Maciej Gruszczynski

Re: 4.2 new GLOBALS question
        94720 by: Uchendu Nwachukwu

mail() Returned mail: Data format error (
        94721 by: SeanW

Counting number of value instances within an array
        94722 by: Neil Freeman
        94723 by: andrey
        94724 by: Neil Freeman

Administrivia:

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

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

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
I am trying to do an HTTP GET to pull down webpages, parse and store data
into a MySQL DB.
However the pages are using digest auth as outlines in RFC2617.  I am unable
to generate the
correct MD5 hash from the following code for using MD5-sess:

        $realm = "[EMAIL PROTECTED]";
        $nonce = "dcd98b7102dd2f0e8b11d0f600bfb0c093";
        $opaque = "5ccc069c403ebaf9f0171e9517f40e41";
        $stale = "false";
        $qop = "auth";
        $alg = "MD5-sess";
        $cnonce = "0a4f113b";
        $uri = "/dir/index.html";
        $username = "Mufasa";
        $nc = "00000001";
        $pwd = "Circle Of Life";


        $auth_inf = "$username:$realm:$pwd";
        $h1 = md5($auth_info);
        $a1 = "$h1:$nonce:$cnonce";
        $ha1 = md5($a1);
        $a2 = "GET:$uri";
        $ha2 = md5($a2);
        $response = "$ha1:$nonce:$nc:$cnonce:$qop:$ha2";
        echo $response;
        $digest_resp = md5($response);

This is the example given in the RFC but the hash returns the incorrect
value and doesn't match the
one stated in the RFC paper.  Anyone else ever try this or know the correct
method of running the
hash for Digest Auth using MD5

Thanks
Eric
[EMAIL PROTECTED]


--- End Message ---
--- Begin Message ---

With header you can do by using

header("Location: http://www.site.com/some/page.php?some=var";);

here's a good article about it:
http://www.phpbeginner.com/columns/shobhan/browser

other than that, you can always include(). But this is a little bit of a
mess.


Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins



> -----Original Message-----
> From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 26, 2002 2:10 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Redirect
> 
> Hi to all,
> 
> I am wondering if there are other ways to redirect users other than
using
> header()?
> 
> I have a script that if the user doesn't have enough money to buy an
item
> then it directs to one page and if they do then it directs them back
to the
> referring page.
> 
> Is this possible?
> 
> 
> Thanks
> Jennifer
> 
> --
> The sleeper has awaken
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
You can use header() for that...just don't display anything before you
redirect them.

Otherwise you need a client side solution like a META REFRESH 

---John Holmes...

> -----Original Message-----
> From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 25, 2002 5:10 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Redirect
> 
> Hi to all,
> 
> I am wondering if there are other ways to redirect users other than
using
> header()?
> 
> I have a script that if the user doesn't have enough money to buy an
item
> then it directs to one page and if they do then it directs them back
to
> the
> referring page.
> 
> Is this possible?
> 
> 
> Thanks
> Jennifer
> 
> --
> The sleeper has awaken
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Hi All,

When attempting to send an email through a PHP script via Apache, no emails
are sent.  However if I use the standalone binary and run the same script
but on the console then it works fine.

Because of that I have a feeling that there is something in Sendmail which
is preventing the "nobody" user to send emails since "nobody" is what Apache
runs as.

Any ideas appreciated :)

Cheers
--- End Message ---
--- Begin Message ---
On Fri, 26 Apr 2002, David Redmond wrote:
> When attempting to send an email through a PHP script via Apache, no emails
> are sent.  However if I use the standalone binary and run the same script
> but on the console then it works fine.
> 
> Because of that I have a feeling that there is something in Sendmail which
> is preventing the "nobody" user to send emails since "nobody" is what Apache
> runs as.

Have you checked /var/log/maillog?

miguel

--- End Message ---
--- Begin Message ---
Are you using headers in your mail script??? I'm no expert on sendmail at
all, but your host may require the From: [EMAIL PROTECTED] header before it
will send????

<?

$to = "[EMAIL PROTECTED]";
$subject = "test";
$message = "testing";
$headers = "From: [EMAIL PROTECTED]";

mail($to,$subject,$message,$headers);

?>

It's worth a shot :)

Otherwise, does the binary and Apache version share the same php.ini
file????


Justin French

--------------------
Creative Director
http://Indent.com.au
--------------------



on 26/04/02 11:45 AM, David Redmond ([EMAIL PROTECTED]) wrote:

> Hi All,
> 
> When attempting to send an email through a PHP script via Apache, no emails
> are sent.  However if I use the standalone binary and run the same script
> but on the console then it works fine.
> 
> Because of that I have a feeling that there is something in Sendmail which
> is preventing the "nobody" user to send emails since "nobody" is what Apache
> runs as.
> 
> Any ideas appreciated :)
> 
> Cheers

--- End Message ---
--- Begin Message ---
At 25.04.2002  18:03, you wrote:
>   When I create an image, º becomes $. Actually a small $. (pratically
>half-sized). Maybe it's a "s" with a tail. I really have never seen this
>character before :-)
>
>   An example:
>
>$im = @ImageCreate (450, 500)
>     or exit ("Cannot Initialize new GD image stream");
>$background_color = ImageColorAllocate ($im, 255, 255, 255);
>$text_color = ImageColorAllocate ($im, 0, 0, 0);
>$horizonte = 465;
>$vertical = 25;
>$pasta = 'Pasta Nº: ';
>ImageStringUp ($im, 5, $vertical, $horizonte,  $pasta, $text_color);
>ImagePng ($im,'etiqueta.png');
>
>   Outputs:
>
>Pasta N$:
Shouldn´t you load the font you want to uses, before you use it?
something like $font=imageTTFloadfont("yourfont.ttf") // untested, cannot 
find the manual right now
And is the char, you want to use, available in that font?

HTH Oliver

--- End Message ---
--- Begin Message ---
Another solution would be to add another imagestringup with only the "O"
character  at the right size and location.
Hope this helps,
Hugh
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 25, 2002 11:40 PM
Subject: Re: [PHP] GD: º becomes $


At 25.04.2002  18:03, you wrote:
>   When I create an image, º becomes $. Actually a small $. (pratically
>half-sized). Maybe it's a "s" with a tail. I really have never seen this
>character before :-)
>
>   An example:
>
>$im = @ImageCreate (450, 500)
>     or exit ("Cannot Initialize new GD image stream");
>$background_color = ImageColorAllocate ($im, 255, 255, 255);
>$text_color = ImageColorAllocate ($im, 0, 0, 0);
>$horizonte = 465;
>$vertical = 25;
>$pasta = 'Pasta Nº: ';
>ImageStringUp ($im, 5, $vertical, $horizonte,  $pasta, $text_color);
>ImagePng ($im,'etiqueta.png');
>
>   Outputs:
>
>Pasta N$:
Shouldn´t you load the font you want to uses, before you use it?
something like $font=imageTTFloadfont("yourfont.ttf") // untested, cannot
find the manual right now
And is the char, you want to use, available in that font?

HTH Oliver


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


--- End Message ---
--- Begin Message ---
Hi,

I just thought I'd say thank's too all who responded to my question.
Very good answers! I ended up using strip_tags (after someone pointed it
out too me) kombinded with a couple of eregs. 

Tarjei

John Holmes wrote:
> 
> > I need a function or class to validate a form with a cuple of text
> areas
> > that are alloed to contain a few html tags (<br><p> etc) but not all,
> > and I need a script to validate the input from the fields and stop the
> > html elements that are not allowed.
> >
> > Does anyone have a function or class handy that I might use? (for
> free)
> 
> I've got one...
> 
> www.php.net/strip_tags
> 
> www.php.net/htmlentities
> 
> You can have them for free if you send me $20.
> 
> ---John Holmes...
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---


Kirk Johnson wrote:

> The coding style needs to match the register_globals setting in php.ini.
>
> register_globals on:
>
> $accountsession = $session;
> $accountemail = $email;
> session_register("accountsession");
> session_register("accountemail");

Oh, sorry... I have just tried so many ways... but this works!

Thank you very much :o)

Regards,
Johan

--- End Message ---
--- Begin Message ---
Hello,
I'm looking for a really good, professional hosting environment in the uk 
that supports php (not in safe mode)), mysql and offers the use of a secure 
server and mail server. I'm looking for a client of mine who needs to rely 
on their site being up, and so needs a hoster who has enough redundancy in 
all systems. We have a budget of between £200 and £400 a year, but don't 
want to get stuck with bandwidth charges, database usage, etc etc..
It would be good if the hoster also offered a remote control panel as well 
as ftp access to the server.
Does any one have any suggested companies, or companies that they've had 
good experiences using? 

cheers
Hamish 
--- End Message ---
--- Begin Message ---
havva look at 34sp.com

I use them for virtually all my clients. Tho gimme a shout in siz months
or so I'm going to be running a web farm ;)

========================================================
  Brian M McGarvie,
    eCommerce Co-ordinator/Consultant
========================================================
    [ www.mcgarvie.net | www.lennox-mckinlay.co.uk]
========================================================

-----Original Message-----
From: hamish [mailto:[EMAIL PROTECTED]]
Sent: 26 April 2002 08:59
To: [EMAIL PROTECTED]
Subject: [PHP] good php hosting environments


Hello,
I'm looking for a really good, professional hosting environment in the
uk 
that supports php (not in safe mode)), mysql and offers the use of a
secure 
server and mail server. I'm looking for a client of mine who needs to
rely 
on their site being up, and so needs a hoster who has enough redundancy
in 
all systems. We have a budget of between £200 and £400 a year, but don't

want to get stuck with bandwidth charges, database usage, etc etc..
It would be good if the hoster also offered a remote control panel as
well 
as ftp access to the server.
Does any one have any suggested companies, or companies that they've had

good experiences using? 

cheers
Hamish 

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

--- End Message ---
--- Begin Message ---
Hamish,

I've been using UK Linux (www.uklinux.net) both at home and at work and
they really have been excellent.

From their various types of membership I think you would be able to find
a level of service that you want within the price range you suggest.

Best of luck,

Michael

hamish wrote:
> 
> Hello,
> I'm looking for a really good, professional hosting environment in the uk
> that supports php (not in safe mode)), mysql and offers the use of a secure
> server and mail server. I'm looking for a client of mine who needs to rely
> on their site being up, and so needs a hoster who has enough redundancy in
> all systems. We have a budget of between £200 and £400 a year, but don't
> want to get stuck with bandwidth charges, database usage, etc etc..
> It would be good if the hoster also offered a remote control panel as well
> as ftp access to the server.
> Does any one have any suggested companies, or companies that they've had
> good experiences using?
> 
> cheers
> Hamish
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi,

I have one string variable in script a.php, I regester
this variable to session name testsess.

this link redirects to another script b.php then how i
get that string var from session.

basically I want to store var. serverside and use them
in to different scripts.

If any one help me let me know.

thanks,

~ deval

__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/
--- End Message ---
--- Begin Message ---
Simply do the same thing in the other script. Create a session named
'testsess' and register the variable (under the same name) to it. That
variable will auttomatically take up the it was set to previously.

--
Uchendu Nwachukwu
newsreply AT unndunn DOT com - www.unndunn.com

"Deval Parikh" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> I have one string variable in script a.php, I regester
> this variable to session name testsess.
>
> this link redirects to another script b.php then how i
> get that string var from session.
>
> basically I want to store var. serverside and use them
> in to different scripts.
>
> If any one help me let me know.
>
> thanks,
>
> ~ deval
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Games - play chess, backgammon, pool and more
> http://games.yahoo.com/


--- End Message ---
--- Begin Message ---
Is there a way I can combine these queries?

$result = queryDB("SELECT count(ResumeID) FROM Resumes WHERE
typeEmploy='1'");
$numEmp = mysql_result($result,0);
$result = queryDB("SELECT count(ResumeID) FROM Resumes WHERE
typeContract='1'");
$numCon = mysql_result($result,0);
$result = queryDB("SELECT count(ResumeID) FROM Resumes WHERE typeTemp='1'");
$numTem = mysql_result($result,0);

Rick

"The greatest trick the devil ever played was convincing the world he didn't
exist." - Unknown

--- End Message ---
--- Begin Message ---
Addressed to: Richard Baskett <[EMAIL PROTECTED]>
              [EMAIL PROTECTED]

** Reply to note from Richard Baskett <[EMAIL PROTECTED]> Fri, 26 Apr 2002 01:47:17 
-0700
>
> Is there a way I can combine these queries?
>
> $result = queryDB("SELECT count(ResumeID) FROM Resumes WHERE
> typeEmploy='1'");
> $numEmp = mysql_result($result,0);
> $result = queryDB("SELECT count(ResumeID) FROM Resumes WHERE
> typeContract='1'");
> $numCon = mysql_result($result,0);
> $result = queryDB("SELECT count(ResumeID) FROM Resumes WHERE typeTemp='1'");
> $numTem = mysql_result($result,0);



Try:


SELECT SUM( IF( typeEmploy = 1, 1, 0 )) AS Employ,
       SUM( IF( typeContract = 1, 1, 0 )) AS Contract,
       SUM( IF( typeTemp = 1, 1, 0 )) AS Temp
FROM Resumes



If type* is always either 1 or 0 you can lose the if:

   SUM( typeEmploy ) AS Employ ...


Rick

Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com
--- End Message ---
--- Begin Message ---
Greetings All,
(Special greetings go out to Steve for excellient previous help - Thanks
again dude)
Calling all PHP gurus, have broked my head over this but cant seem to figure
this out in c,perl or java servlets.
Am new to PHP so dont even know the common functions leave alone the answer
to this problem.
Heres the setup:
I have a form with just one TEXTAREA
Data from this form is entered directly into the database

BUT...

everytime a user presses the ENTER or RETURN key on the keyboard, when the
PHP script validates the form
I want it to add <br> it should also add a <br> if the line is sayyyyy....75
charactors long & if there is no <br> or enter key pressed..
If it finds any "  it should convert it to '

Any ideas?

Any help appreciated.
Have a great day.
-Ryan A.

--- End Message ---
--- Begin Message ---
if you want to write into the database, i wouldn't convert newline to <br>.
do this
when you read from the database using nl2br($var) ot convert every newline
in $var to <br>.
default <br> after 75 characters if no <br> was found before.
if you don't care about word-splitting, you could do the following:

//INSERT TO DATABASE
//max number of chars per line
$maxchars = 75;
//lets say $var is the content of your textarea
$lines = explode("\n", $var);

// text we want to write to the db
$newtext = "";

foreach ($lines as $line) {
    if (strlen($line) > $maxchars) {
        $newtext .= substr($line, 0, $maxchars)."\n";
        $newtext .= substr($line, $maxchars)."\n";
    }
}


// SELECT FROM DATABASE

//lets say $var is the selected content
echo nl2br($var);

This is very simple solution. It won't look for words and splits after the
word
and if your line is 76 chars long, it'll convert it into two lines, onw with
75 chars
and one with 1 char. but it's a start i think.

Regards Michael




"R" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
000b01c1ed6e$d21595e0$0a6da8c0@lgwezec83s94bn">news:000b01c1ed6e$d21595e0$0a6da8c0@lgwezec83s94bn...
> Greetings All,
> (Special greetings go out to Steve for excellient previous help - Thanks
> again dude)
> Calling all PHP gurus, have broked my head over this but cant seem to
figure
> this out in c,perl or java servlets.
> Am new to PHP so dont even know the common functions leave alone the
answer
> to this problem.
> Heres the setup:
> I have a form with just one TEXTAREA
> Data from this form is entered directly into the database
>
> BUT...
>
> everytime a user presses the ENTER or RETURN key on the keyboard, when the
> PHP script validates the form
> I want it to add <br> it should also add a <br> if the line is
sayyyyy....75
> charactors long & if there is no <br> or enter key pressed..
> If it finds any "  it should convert it to '
>
> Any ideas?
>
> Any help appreciated.
> Have a great day.
> -Ryan A.
>


--- End Message ---
--- Begin Message ---
forgot the " to ' conversion:
// this should do the job quite fine.
$var = str_replace ("\"", "'", $var);

Regards Michael

"Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> if you want to write into the database, i wouldn't convert newline to
<br>.
> do this
> when you read from the database using nl2br($var) ot convert every newline
> in $var to <br>.
> default <br> after 75 characters if no <br> was found before.
> if you don't care about word-splitting, you could do the following:
>
> //INSERT TO DATABASE
> //max number of chars per line
> $maxchars = 75;
> //lets say $var is the content of your textarea
> $lines = explode("\n", $var);
>
> // text we want to write to the db
> $newtext = "";
>
> foreach ($lines as $line) {
>     if (strlen($line) > $maxchars) {
>         $newtext .= substr($line, 0, $maxchars)."\n";
>         $newtext .= substr($line, $maxchars)."\n";
>     }
> }
>
>
> // SELECT FROM DATABASE
>
> //lets say $var is the selected content
> echo nl2br($var);
>
> This is very simple solution. It won't look for words and splits after the
> word
> and if your line is 76 chars long, it'll convert it into two lines, onw
with
> 75 chars
> and one with 1 char. but it's a start i think.
>
> Regards Michael
>
>
>
>
> "R" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> 000b01c1ed6e$d21595e0$0a6da8c0@lgwezec83s94bn">news:000b01c1ed6e$d21595e0$0a6da8c0@lgwezec83s94bn...
> > Greetings All,
> > (Special greetings go out to Steve for excellient previous help - Thanks
> > again dude)
> > Calling all PHP gurus, have broked my head over this but cant seem to
> figure
> > this out in c,perl or java servlets.
> > Am new to PHP so dont even know the common functions leave alone the
> answer
> > to this problem.
> > Heres the setup:
> > I have a form with just one TEXTAREA
> > Data from this form is entered directly into the database
> >
> > BUT...
> >
> > everytime a user presses the ENTER or RETURN key on the keyboard, when
the
> > PHP script validates the form
> > I want it to add <br> it should also add a <br> if the line is
> sayyyyy....75
> > charactors long & if there is no <br> or enter key pressed..
> > If it finds any "  it should convert it to '
> >
> > Any ideas?
> >
> > Any help appreciated.
> > Have a great day.
> > -Ryan A.
> >
>
>


--- End Message ---
--- Begin Message ---
this is wrong:
> foreach ($lines as $line) {
>     if (strlen($line) > $maxchars) {
>         $newtext .= substr($line, 0, $maxchars)."\n";
>         $newtext .= substr($line, $maxchars)."\n";
>     }
> }

try this:
foreach ($lines as $line) {
    if (strlen($line) > $maxchars) {
         $newtext .= substr($line, 0, $maxchars)."\n";
        $newtext .= substr($line, $maxchars)."\n";
    } else {
        $newtext .= $line."\n";
    }
}

Regards Michael


"Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> if you want to write into the database, i wouldn't convert newline to
<br>.
> do this
> when you read from the database using nl2br($var) ot convert every newline
> in $var to <br>.
> default <br> after 75 characters if no <br> was found before.
> if you don't care about word-splitting, you could do the following:
>
> //INSERT TO DATABASE
> //max number of chars per line
> $maxchars = 75;
> //lets say $var is the content of your textarea
> $lines = explode("\n", $var);
>
> // text we want to write to the db
> $newtext = "";
>
> foreach ($lines as $line) {
>     if (strlen($line) > $maxchars) {
>         $newtext .= substr($line, 0, $maxchars)."\n";
>         $newtext .= substr($line, $maxchars)."\n";
>     }
> }
>
>
> // SELECT FROM DATABASE
>
> //lets say $var is the selected content
> echo nl2br($var);
>
> This is very simple solution. It won't look for words and splits after the
> word
> and if your line is 76 chars long, it'll convert it into two lines, onw
with
> 75 chars
> and one with 1 char. but it's a start i think.
>
> Regards Michael
>
>
>
>
> "R" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> 000b01c1ed6e$d21595e0$0a6da8c0@lgwezec83s94bn">news:000b01c1ed6e$d21595e0$0a6da8c0@lgwezec83s94bn...
> > Greetings All,
> > (Special greetings go out to Steve for excellient previous help - Thanks
> > again dude)
> > Calling all PHP gurus, have broked my head over this but cant seem to
> figure
> > this out in c,perl or java servlets.
> > Am new to PHP so dont even know the common functions leave alone the
> answer
> > to this problem.
> > Heres the setup:
> > I have a form with just one TEXTAREA
> > Data from this form is entered directly into the database
> >
> > BUT...
> >
> > everytime a user presses the ENTER or RETURN key on the keyboard, when
the
> > PHP script validates the form
> > I want it to add <br> it should also add a <br> if the line is
> sayyyyy....75
> > charactors long & if there is no <br> or enter key pressed..
> > If it finds any "  it should convert it to '
> >
> > Any ideas?
> >
> > Any help appreciated.
> > Have a great day.
> > -Ryan A.
> >
>
>


--- End Message ---
--- Begin Message ---
Easy as pie.

Firstly, make sure your TEXTAREA tab has the 'wrap' attribute set to 'hard'.
You can set the number of characters per line by using the 'cols' attribute.
So if you want to do a hard wrap every 75 characters, use <TEXTAREA
name="yourText" wrap="hard" cols="75">.

Next, in your PHP script, run the text through nl2br() to add the <BR> tags,
and run it through strtr("\"", "'") to change the double-quotes to single
quotes.

You'll also want to run the text through addslashes() before you submit it
to the database - to prevent people from passing commands to the database
through your form.

Hope that helps!

--
Uchendu Nwachukwu
newsreply AT unndunn DOT com - www.unndunn.com

"R" <[EMAIL PROTECTED]> wrote in message
000b01c1ed6e$d21595e0$0a6da8c0@lgwezec83s94bn">news:000b01c1ed6e$d21595e0$0a6da8c0@lgwezec83s94bn...
> Greetings All,
> (Special greetings go out to Steve for excellient previous help - Thanks
> again dude)
> Calling all PHP gurus, have broked my head over this but cant seem to
figure
> this out in c,perl or java servlets.
> Am new to PHP so dont even know the common functions leave alone the
answer
> to this problem.
> Heres the setup:
> I have a form with just one TEXTAREA
> Data from this form is entered directly into the database
>
> BUT...
>
> everytime a user presses the ENTER or RETURN key on the keyboard, when the
> PHP script validates the form
> I want it to add <br> it should also add a <br> if the line is
sayyyyy....75
> charactors long & if there is no <br> or enter key pressed..
> If it finds any "  it should convert it to '
>
> Any ideas?
>
> Any help appreciated.
> Have a great day.
> -Ryan A.
>


--- End Message ---
--- Begin Message ---
Use wordwrap() to wrap the text to 75 characters and str_replace() to
replace " with '

www.php.net/wordwrap
www.php.net/str_replace

---John Holmes...

> -----Original Message-----
> From: r [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 26, 2002 3:08 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Callin PHP gurus...figure this out
> 
> Greetings All,
> (Special greetings go out to Steve for excellient previous help -
Thanks
> again dude)
> Calling all PHP gurus, have broked my head over this but cant seem to
> figure
> this out in c,perl or java servlets.
> Am new to PHP so dont even know the common functions leave alone the
> answer
> to this problem.
> Heres the setup:
> I have a form with just one TEXTAREA
> Data from this form is entered directly into the database
> 
> BUT...
> 
> everytime a user presses the ENTER or RETURN key on the keyboard, when
the
> PHP script validates the form
> I want it to add <br> it should also add a <br> if the line is
> sayyyyy....75
> charactors long & if there is no <br> or enter key pressed..
> If it finds any "  it should convert it to '
> 
> Any ideas?
> 
> Any help appreciated.
> Have a great day.
> -Ryan A.
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Dear all
I had a problem which trying to load data to Mysql Table,
Here is my code in my HTML:

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
</head>
<body bgcolor="#FFFFFF" text="#000000">
  <?
include 'phpstudy/constant.inc';
$link=mysql_pconnect(HOST,USER,PASSWD);
mysql_select_db(DBNAME,$link);
print ($select);
if ($select =="HKD RATE")
{
$importquery= "LOAD DATA LOCAL INFILE 'C:\\Documents and
Settings\\jack\\Desktop\\Web\\test\\hkd_rate.csv' into hkd_depsit1 fields
terminated by ','";
$resultimportquery=mysql_query($importquery,$link);
print ($result);
}
?>
</body>
</html>

The code above is to see if the variable passed from other form($select) is
"HKD RATE"  or not , if it is, then it will call Mysql to perform LOAD DATA
from a csv to hkd_deposit1 table.
As the result comes out that the mysql didn't do any thing at all, it
doesn't import the data from hkd_rate.csv to hkd_deposit1.
I had tested using different query , which change the 'importquery' to
"delete from hkd_deposit" in php, by using this as the query, it works!It
did delete all the record from hkd_deposit table!

I had test the query in myCC program which design for MYSQL Operation, it
can successfully import the csv file into table, but i don't know why it
won't work with php script!

Pls give advice see if i got anything wrong in php!


--
Thx a lot!
Jack
[EMAIL PROTECTED]







--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Nathan [mailto:[EMAIL PROTECTED]]
> Sent: 25 April 2002 21:01
> 
> Apparently in 4.1.X this is true... I'd been running 4.0.6 
> for a long time (until 4.1.2 was
> released), and must have coded it in the earlier version. I 
> stand corrected! :-)

H'mmm, I think you must have an even longer memory than that, since the following 
script:

> <?php
> $array = array();
> $array[0] = "zero";
> $array[1] = "one";
> $array[2] = "two";
> $array[3] = "three";
> 
> unset($array[1]);
> 

  echo "version=" . phpversion() . "<br>";

> foreach ($array as $key=>$value) {
>         echo $key." = ".$value."<BR>";
> }
> ?>

when run on my server produces:

version=4.0.5
0 = zero
2 = two
3 = three

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 
--- End Message ---
--- Begin Message ---
Probably the php exec couldn't find your php.ini script or it's in the wrong
directory.
Try to use simple phpinfo() function in your php script to check where the
php.ini file should be.
Default directory is something like /usr/local/php/etc/


--

Maciej Gruszczynski
<[EMAIL PROTECTED]>

Freelance Polska sp. z o.o.
"Creative Talents for Business"
pl. Konstytucji 4/15
00-522 Warszawa
tel. 622 49 70
fax 622 49 69
http://www.freelance.pl

 -----------------------------------------------------------
 Note:  The information contained in this message may be privileged and
confidential and protected from disclosure.  If the reader of this message
is not the intended recipient, or an employee or agent responsible for
delivering this message to the intended recipient, you are hereby notified
that any dissemination, distribution or copying of this communication is
strictly prohibited. If you have received this communication in error,
please notify the sender immediately by replying to the message and deleting
it from your computer. Thank you.



Uzytkownik "Tim Loram" <[EMAIL PROTECTED]> napisal w wiadomosci
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> Having some issues with the session.save_path value in php.ini
>
> Whatever I change this value to it always ends up trying to save the
> temporary session info in /tmp (the default setting in php.ini).
>
> I can overide the value by setting a new path in the actual php script
> using session_save_path("my/path/here") but if I don't specify a path like
> this it always attempts to save in /tmp (c:\tmp\) even though the value in
> the php.ini file says otherwise....
>
> Why is this happening ?
>
> HELP!
>
> Cheers.
>
> Tim Loram
> LaTiS Centre
> University of Exeter
> Queens Building
> Queens Drive
> Exeter
> EX4 4QH
>
> Tel: (01392) 263721
> http://latis.ex.ac.uk/
>


--- End Message ---
--- Begin Message ---
Try simply changing '$HTTP_GET_VARS' to '$_GET'.

so..

$start = isset($_GET['s']) ? $_GET['s'] : '';

--
Uchendu Nwachukwu
newsreply AT unndunn DOT com - www.unndunn.com

"Jeff Lewis" <[EMAIL PROTECTED]> wrote in message
00b101c1ecaf$2f429850$0100a8c0@cr983033a">news:00b101c1ecaf$2f429850$0100a8c0@cr983033a...
> Excuse me, you're right.  I was using this include as a "preprocess" step
as
> I was using ; to seperate arguments in the query string like this
> index.php?s=something;t=thing
>
> The preprocess step was breaking them apart and then I was doing this:
>
> $start = isset($HTTP_GET_VARS['s']) ? $HTTP_GET_VARS['s'] : '';
>
> Then back in index I did a if ($start == "somevalue")
>
> However, with 4.2, the $start is no longer populated.
>
> If I add an echo $start; right after the include, in 4.1.2 and below, it
> would echo the value of $start but now it keeps turning up empty.
>
> Jeff
> ----- Original Message -----
> From: "John Holmes" <[EMAIL PROTECTED]>
> To: "'Jeff Lewis'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Thursday, April 25, 2002 10:13 PM
> Subject: RE: [PHP] 4.2 new GLOBALS question
>
>
> > > I am working on an odler script which loads up in index.php and a URL
> > is
> > > passed usually like index.php?s=something
> > >
> > > Now, around line 10 of index.php I do an include that pulls the value
> > of s
> > > via HTTP_POST_VARS and then I dump it into $start.
> >
> > What do you mean you "dump it into $start"?? Where is $start coming
> > from? Also, if you are using index.php?s=something, then 's' will be in
> > HTTP_GET_VARS or _GET ...not POST.
> >
> > ---John Holmes...
> >
> >
> >
> >
>
>


--- End Message ---
--- Begin Message ---
Using this command

 mail(

         $mailrow[email],
                   $subject,
                   $spamstr,
                   "From: me@mydomain\r\n
       Content-type: text/html; charset=us-ascii\r\n
       Contenet-Transfer-Encoding: 7bit\r\n
       MIME-Version: 1.0n"

                );

I get bounces only from some servers with this message ,

Date: Mon, 15 Apr 2002 01:42:15 +1000
From: Mail Delivery Subsystem <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Returned mail: Data format error

The original message was received at Mon, 15 Apr 2002 01:42:07 +1000
from nobody@localhost

   ----- The following addresses had permanent fatal errors -----
info@xxxxxxxxxx

   ----- Transcript of session follows -----
... while talking to mx0.hyperlink.net.au.:
>>> MAIL From:<[EMAIL PROTECTED]> SIZE=18853 BODY=8BITMIME
<<< 553 5.1.8 <[EMAIL PROTECTED]>... Domain of sender address
[EMAIL PROTECTED] does not exist
501 [EMAIL PROTECTED] Data format error


Again most of the email go through but not for some, why does my domain how
as localhost.


Sean


--- End Message ---
--- Begin Message ---
Hi guys,

Is there a function I can use to count the number of instances of a
value within an array. For example:
$a[0] = "bob";
$a[1] = "bob";
$a[2] = "fred";
$a[3] = "james";
$a[4] = "bob";
$a[5] = "carl";

Searching for 'bob' would return 3.

I've had a quick look through the array functions but didn't spot
anything obvious.

Neil
--------------------------------
 Email:  [EMAIL PROTECTED]
         [EMAIL PROTECTED]
--------------------------------


--- End Message ---
--- Begin Message ---
array_count_values()

HTH
Best regards,
Andrey Hristov

----- Original Message ----- 
From: "Neil Freeman" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Friday, April 26, 2002 1:24 PM
Subject: [PHP] Counting number of value instances within an array


> Hi guys,
> 
> Is there a function I can use to count the number of instances of a
> value within an array. For example:
> $a[0] = "bob";
> $a[1] = "bob";
> $a[2] = "fred";
> $a[3] = "james";
> $a[4] = "bob";
> $a[5] = "carl";
> 
> Searching for 'bob' would return 3.
> 
> I've had a quick look through the array functions but didn't spot
> anything obvious.
> 
> Neil
> --------------------------------
>  Email:  [EMAIL PROTECTED]
>          [EMAIL PROTECTED]
> --------------------------------
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
Sorry - don't worry. Found the function I require.

FYI : array_count_values()

Neil Freeman wrote:

> *************************************************************************
> This Message Was Virus Checked With : SAVI 3.54 Feb 2002
> Last Updated 24th April 2002
> *************************************************************************
>
> Hi guys,
>
> Is there a function I can use to count the number of instances of a
> value within an array. For example:
> $a[0] = "bob";
> $a[1] = "bob";
> $a[2] = "fred";
> $a[3] = "james";
> $a[4] = "bob";
> $a[5] = "carl";
>
> Searching for 'bob' would return 3.
>
> I've had a quick look through the array functions but didn't spot
> anything obvious.
>
> Neil
> --------------------------------
>  Email:  [EMAIL PROTECTED]
>          [EMAIL PROTECTED]
> --------------------------------
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--
--------------------------------
 Email:  [EMAIL PROTECTED]
         [EMAIL PROTECTED]
--------------------------------


--- End Message ---

Reply via email to