php-general Digest 21 Jan 2001 05:40:35 -0000 Issue 467

Topics (messages 35815 through 35880):

Re: HELP!. INstalling PHP4 on a Cobalt RAQ 2!
        35815 by: Rasmus Lerdorf

Re: Help w/ regular expressions for banned words
        35816 by: Team JUMP
        35818 by: Romulo Roberto Pereira
        35831 by: Team JUMP

Re: Profanity Filter
        35817 by: Website4S.aol.com
        35860 by: Alex Black
        35864 by: scott.gerhardt-it.com
        35870 by: Fraser MacKenzie

Re: Help - removal of trailing zeros from double integer field
        35819 by: Art Wells

Re: PHP site on CD-ROM
        35820 by: Brian T. Allen

Re: Image Widths/Heights on Upload
        35821 by: Dan Lowe

What's wrong with this link?
        35822 by: Mike Yuen
        35824 by: Romulo Roberto Pereira
        35828 by: Angus Mann
        35830 by: Philip Olson
        35857 by: scott.gerhardt-it.com

Re: cookies - not working with Nutscrape
        35823 by: Brian V Bonini
        35825 by: Brian V Bonini
        35853 by: Brian V Bonini

Re: Please: XTemplate help?
        35826 by: Jaxon
        35843 by: Kristi Russell
        35856 by: Jaxon

JSDK 2.0 & PHP
        35827 by: Ashley M. Kirchner

Re: <> Flash + PHP <>
        35829 by: Mike Tuller

Verifying against a file
        35832 by: Website4S.aol.com

Installing Php/Apache/Win98
        35833 by: Todd Cary
        35854 by: Morkai Kurst

Re: Spell checker?
        35834 by: John Hinsley

Compiling PHP with "--with-apxs"
        35835 by: Jero
        35877 by: Brian Clark

simple math
        35836 by: PeterOblivion.aol.com
        35837 by: Rasmus Lerdorf

MailBomb Problem...
        35838 by: ewiz
        35839 by: Rasmus Lerdorf

Unique Session Question
        35840 by: Randy Johnson
        35842 by: Alain Fontaine

Re: a text formating & cpu question
        35841 by: Michael A. Peters

Mysql & Array Question
        35844 by: Jeff Lacy
        35845 by: Rasmus Lerdorf

date
        35846 by: Randy Johnson

XOR data encryption
        35847 by: Steve Quezadas
        35852 by: Todd Cary
        35871 by: jeremy brand
        35880 by: Sean Cazzell

opinion polling code
        35848 by: Lucas Young

Cookies...
        35849 by: WreckRman2
        35850 by: Rasmus Lerdorf

MySQL Access Denied
        35851 by: Website4S.aol.com

get last directory of a full path? (parent directory)
        35855 by: Noah Spitzer-Williams
        35858 by: Romulo Roberto Pereira
        35859 by: Stephan Ahonen

Re: is it possible to communicate javascript and php?
        35861 by: Alex Black
        35863 by: Markus Fischer

Re: Ethics question...
        35862 by: Alex Black

CF vs PHP for Creating PDF's
        35865 by: DPG Account

Sending a mail in HTML format
        35866 by: Pascal Clerin
        35867 by: Markus Fischer

mysql table dump problem
        35868 by: PHP List
        35873 by: Markus Fischer

Getting part of a string
        35869 by: Website4S.aol.com
        35874 by: Markus Fischer
        35876 by: Website4S.aol.com

my cookies arent working!
        35872 by: Lucas Young
        35875 by: Markus Fischer
        35878 by: Lucas Young

" " charactor problem
        35879 by: Rick Ridgeway

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]


----------------------------------------------------------------------


Can you install flex and bison?

On Sat, 20 Jan 2001, Trunkz Santai wrote:

> Hi Im trying to isntall PHP4 on my Raq 2 but Im not having much luck. I was
> wondering if someone here could assist me.
>
> I uploaded apache and configured it and it worked fine. Its running in
> /usr/local/apache-x.x.x
>
> I uploaded the php zipped binary by ftp to /home/sites/home
> then
> mv php-4.0.4.tar.gz /usr/local
> then I unpacked it
>
>
> gunzip php-4.0.4.tar.gz
> then
> tar vxf php-4.0.4.tar
>
> It unpacked fine. I changed firectories
>
> cd php-4.0.4
>
> I did the configure thing
>
> ./configure --with-mysql --with-apache=../apache_1.3.14 --enable-track-vars
>
>
> I pressed enter and it said loading config.cache and a long list of things
> came up. Then it ended and this was what I got.
>
> checking for working makeinfo... found
> checking whether to enable maintainer-specific portions of Makefiles... no
> checking host system type... mipsel-unknown-linux-gnu
> checking for gawk... gawk
> checking for bison... bison -y
> checking bison version... 1.25 (ok)
> checking for gcc... gcc
> checking whether the C compiler (gcc ) works... yes
> checking whether the C compiler (gcc ) is a cross-compiler... no
> checking whether we are using GNU C... yes
> checking whether gcc accepts -g... yes
> checking how to run the C preprocessor... gcc -E
> checking for AIX... no
> checking for gcc option to accept ANSI C... none needed
> checking for ranlib... ranlib
> checking whether gcc and cc understand -c and -o together... yes
> checking whether ln -s works... yes
> checking for flex... no
> checking for lex... no
> ./configure: flex: command not found
> checking for flex... lex
> checking for yywrap in -ll... no
> checking lex output file root... ./configure: lex: command not found
> configure: error: cannot find output from lex; giving up
> [root php-4.0.4]#
>
>
> If anyone can help me i would greatly appreciate it. Thanks.
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





Thanks for your help.  Unfortunately, [:space:]$bannedwords[$i][:space:]
would not work, since I need to also check for the first and last word.  In
a last-case scenario I could write special code for the first and last word,
but that may get ugly with bug-checking... but I've already tried
"\s+$bannedwords[$i]\s+" to no avail.  I believe [:space:] is just a
substitute for \s+, right?

Yeah, I've tried \<$bannedwords[$i]\> too, unfortunately.  Like I said
before, eregi_replace("a","[censored]",$string) makes a match, but
eregi_replace("\<a\>","[censored]",$string) or
eregi_replace("\ba\b","[censored]",$string) does not.  Most odd.

Thanks for your help, though.  Anyone else have suggestions?

--Neal



on 1/20/01 12:20 PM, CC Zona at [EMAIL PROTECTED] wrote:

> In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> (Team JUMP) wrote:
> 
>> $num=count($bannedwords);
>> for($i=0;$i<$num-1;$i++)
>> {
>> $string =
>> eregi_replace("\b$bannedwords[$i]\b","[censored]",$string);
>> }
>> 
>> 
>> For whatever reason, no word in $bannedwords will match in the string.  I've
>> tested it with simple expressions like "\btest\b" and it will not match the
>> word "test". 
> 
> Have you tried it with either "[:space:]$bannedwords[$i][:space:] or
> "\<$bannedwords[$i]\>" yet?  Also, I think using a foreach($bannedwords as
> $current_word) would be a better choice here; more compact, and loops all
> the way to the end of the array even when the numerical index does not
> follow the expected sequence.  (BTW, if you want to stick with the for()
> and you know the index numbers will always be sequentially zero to
> whatever, then your test should be just $i<$num.  Otherwise, you're
> skipping the final loop.)







try this; I am working on the last word... ereg replace is not finding the
REGEX "\.$" - anyone has a clue?

<?
$bannedwords = array ("dadada", "dedede", "dididi");

$string = "Dadada in this world dadaDA is not permitedadada because this
very deDede peoplededede that appears in our DIDIDi world dedede.";
$num=count($bannedwords);
/*
echo $num."<BR><BR>";
echo $string."<BR><BR>";
 for($i=0;$i<$num;$i++) {
  $string = eregi_replace("{$bannedwords[$i]}","[censored]",$string);
 }
*/
echo $string."<BR><BR>";

// take out the damn ; . : chars on the end of the string and save for later
/*
 elseif (ereg("\;$",$string)) {
 ereg_replace("\;$","",$string);
 $semmicolon = TRUE;
} elseif (ereg("\:$",$string)) {
 ereg_replace("\:$","",$string);
 $colon = TRUE;
} else {
 $dot = TRUE;
 $semmicolon = TRUE;
 $colon = TRUE;
}
*/
$hasdot = ereg("\.$",$string);

if ($hasdot) {
 ereg_replace("\.$","test",$string);
 $dot = TRUE;
}

// the middle words
 reset($bannedwords);
 foreach ($bannedwords as $word) {
  $string = eregi_replace(" {$word} "," [censored] ",$string);
 }

echo $string."<BR><BR>";

// test the start word and exchange
 reset($bannedwords);
 foreach ($bannedwords as $word) {
  $string = eregi_replace("^{$word}","[censored] ",$string);
 }

echo $string."<BR><BR>";

// test the end word and exchange
 reset($bannedwords);
 foreach ($bannedwords as $word) {
  $string = eregi_replace("{$word}$","[censored]",$string);
 }

echo $string."<BR><BR>";
echo $dot."<BR>";
echo $hasdot;
?>

----- Original Message -----
From: Team JUMP <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, January 20, 2001 12:35 PM
Subject: Re: [PHP] Help w/ regular expressions for banned words


Thanks for your help.  Unfortunately, [:space:]$bannedwords[$i][:space:]
would not work, since I need to also check for the first and last word.  In
a last-case scenario I could write special code for the first and last word,
but that may get ugly with bug-checking... but I've already tried
"\s+$bannedwords[$i]\s+" to no avail.  I believe [:space:] is just a
substitute for \s+, right?

Yeah, I've tried \<$bannedwords[$i]\> too, unfortunately.  Like I said
before, eregi_replace("a","[censored]",$string) makes a match, but
eregi_replace("\<a\>","[censored]",$string) or
eregi_replace("\ba\b","[censored]",$string) does not.  Most odd.

Thanks for your help, though.  Anyone else have suggestions?

--Neal



on 1/20/01 12:20 PM, CC Zona at [EMAIL PROTECTED] wrote:

> In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
> (Team JUMP) wrote:
>
>> $num=count($bannedwords);
>> for($i=0;$i<$num-1;$i++)
>> {
>> $string =
>> eregi_replace("\b$bannedwords[$i]\b","[censored]",$string);
>> }
>>
>>
>> For whatever reason, no word in $bannedwords will match in the string.
I've
>> tested it with simple expressions like "\btest\b" and it will not match
the
>> word "test".
>
> Have you tried it with either "[:space:]$bannedwords[$i][:space:] or
> "\<$bannedwords[$i]\>" yet?  Also, I think using a foreach($bannedwords as
> $current_word) would be a better choice here; more compact, and loops all
> the way to the end of the array even when the numerical index does not
> follow the expected sequence.  (BTW, if you want to stick with the for()
> and you know the index numbers will always be sequentially zero to
> whatever, then your test should be just $i<$num.  Otherwise, you're
> skipping the final loop.)




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





No, it didn't work.  I've tried [:space:]$bannedwords[$i][:space:],
\<$bannedwords[$i]\>, and \b$bannedwords[$i]\b.  It doesn't detect anything.
I'm reading a list of banned words out of a text file and putting them into
$bannedwords.  I'm pretty sure $bannedwords is right, since I've tried stuff
like "test" (detected), "\<test\>" (not detected), "[:space:]test[:space:]"
(not detected).

And, in all times, I use the syntax like this: $string =
eregi_replace("a","[censored]",$string);

So I'm sure the syntax is right.

Thanks for your help, though.

--Neal




-------------------


did it work?

----- Original Message -----
From: Team JUMP <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, January 20, 2001 12:35 PM
Subject: Re: [PHP] Help w/ regular expressions for banned words


Thanks for your help.  Unfortunately, [:space:]$bannedwords[$i][:space:]
would not work, since I need to also check for the first and last word.  In
a last-case scenario I could write special code for the first and last word,
but that may get ugly with bug-checking... but I've already tried
"\s+$bannedwords[$i]\s+" to no avail.  I believe [:space:] is just a
substitute for \s+, right?

Yeah, I've tried \<$bannedwords[$i]\> too, unfortunately.  Like I said
before, eregi_replace("a","[censored]",$string) makes a match, but
eregi_replace("\<a\>","[censored]",$string) or
eregi_replace("\ba\b","[censored]",$string) does not.  Most odd.

Thanks for your help, though.  Anyone else have suggestions?

--Neal








Ok,

I am now using the following code to check if there is any profanity in the 
$FirstName however it just doesn`t work when testing, I am thinking it has 
something to do with the way I`m loading the file, any better ways.

$words=file('words.txt');
$done=false;
while ((list($key, $val)=each($words)) and $done==false)
{
  $done=strpos(strtolower($FirstName), $val);
};
if (!$done==false)
{
  echo "Oops! Bad name";
}
else
{
  echo"Okay, valid name.";
};




hey,

does anyone have a big compiled list? like a profanity library?

maybe even a multi-lingual one!

hey, it would be fun to make :)

_alex


--
Alex Black, Head Monkey
[EMAIL PROTECTED]

The Turing Studio, Inc.
http://www.turingstudio.com

vox+510.666.0074
fax+510.666.0093

Saul Zaentz Film Center
2600 Tenth St Suite 433
Berkeley, CA 94710-2522




> From: [EMAIL PROTECTED] ("Sterling Hughes")
> Organization: Pentap Technologies
> Newsgroups: php.general
> Date: 19 Jan 2001 12:09:56 -0800
> Subject: Re: [PHP] Profanity Filter
> 
> 
> 
>> On Fri, 19 Jan 2001, Ignacio Vazquez-Abrams wrote:
>> 
>>> On Fri, 19 Jan 2001, Sterling Hughes wrote:
>>> 
>>>> I'm saying use the same method, but use an array and avoid the
> strpos()
>>>> function:
>>>> 
>>>> $words = preg_split("//", $data);
>>>> foreach ($words as $word) {
>>>> if (in_array($prof, $words)) {
>>>> echo "BAD WORD";
>>>> echo "BAD WORD";
>>>> echo "I'M TELLING";
>>>> }
>>>> }
>>>> 
>>>> -Sterling
>>>> 
>>> 
>>> That method suffers from the dictionary problem that Egan brought up.
>>> 
>> 
>> Hey, wait a second...
>> 
>> Does that code even make sense? I must be missing something...
>> 
>> --
> 
> well if you have a concussion... :)
> 
> Its a whip up of what I was talking about, I didn't mean it as real code
> :)...   Switch $words to $word and then swith the argument order to in_array
> and yes, it makes sense...
> 
> <?php
> $profanities = array("fuck", "shit");
> 
> $words = preg_split("/\s+/", $data);
> foreach ($words as $word) {
> if (in_array($word, $profanities)) {
> echo "you did a naughty thing";
> break;
> }
> }
> ?>
> 
> 
> Would be the somewhat sane version...
> 
> _Sterling
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 






Just go to one of those raunchy porn sites and pull the words out of thier meta tags 
or "hidden" word list (i.e. white text on white background) buried in the HTML.

;-)


> hey,
> 
> does anyone have a big compiled list? like a profanity library?
> 
> maybe even a multi-lingual one!
> 
> hey, it would be fun to make :)
> 
> _alex
> 
> 
> --
> Alex Black, Head Monkey
> [EMAIL PROTECTED]
> 
> The Turing Studio, Inc.
> http://www.turingstudio.com
> 
> vox+510.666.0074
> fax+510.666.0093
> 
> Saul Zaentz Film Center
> 2600 Tenth St Suite 433
> Berkeley, CA 94710-2522
> 
> 
> 
> 
> > From: [EMAIL PROTECTED] ("Sterling Hughes")
> > Organization: Pentap Technologies
> > Newsgroups: php.general
> > Date: 19 Jan 2001 12:09:56 -0800
> > Subject: Re: [PHP] Profanity Filter
> >
> >
> >
> >> On Fri, 19 Jan 2001, Ignacio Vazquez-Abrams wrote:
> >>
> >>> On Fri, 19 Jan 2001, Sterling Hughes wrote:
> >>>
> >>>> I'm saying use the same method, but use an array and avoid the
> > strpos()
> >>>> function:
> >>>>
> >>>> $words = preg_split("//", $data);
> >>>> foreach ($words as $word) {
> >>>> if (in_array($prof, $words)) {
> >>>> echo "BAD WORD";
> >>>> echo "BAD WORD";
> >>>> echo "I'M TELLING";
> >>>> }
> >>>> }
> >>>>
> >>>> -Sterling
> >>>>
> >>>
> >>> That method suffers from the dictionary problem that Egan brought up.
> >>>
> >>
> >> Hey, wait a second...
> >>
> >> Does that code even make sense? I must be missing something...
> >>
> >> --
> >
> > well if you have a concussion... :)
> >
> > Its a whip up of what I was talking about, I didn't mean it as real code
> > :)...   Switch $words to $word and then swith the argument order to in_array
> > and yes, it makes sense...
> >
> > <?php
> > $profanities = array("fuck", "shit");
> >
> > $words = preg_split("/\s+/", $data);
> > foreach ($words as $word) {
> > if (in_array($word, $profanities)) {
> > echo "you did a naughty thing";
> > break;
> > }
> > }
> > ?>
> >
> >
> > Would be the somewhat sane version...
> >
> > _Sterling
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


--
--------------------------------------
   Scott A. Gerhardt  P.Geo.
   Gerhardt Information Technologies
   [EMAIL PROTECTED]
--------------------------------------





What you could do is have a bad word and a reallybadword list.  Wank could
be a bad word and if it didn't appear along (ie. whitespace on either
side, or in plural) then it is ok.  In really bad word, say F*ck, then it
couldn't appear at all...( ie. f*ckville would be invalid).

It would mean a second loop...but not much more processing...

Just my 2 cents.

Fraser

On Sat, 20 Jan 2001, Nik Gare wrote:

> In article <94adfp$5le$[EMAIL PROTECTED]>,
>    Stephan Ahonen <[EMAIL PROTECTED]> wrote:
> > I'd make it an array:
> 
> > $filter = array(moron, idiot, pratt);
> 
> > foreach($filter as $badword) {
> >  if (strstr($name, $badword)) {
> >   do this if it contains one of the bad words
> >  }
> >  else {
> >   do this if it doesn't
> >  }
> > }
> 
> But wouldn't this approach have its drawbacks, too?
> For example, I live in Kiel, Germany, about 20km from a town called
> Wankendorf.  Presumably I wouldnÄt be able to say this.
> 
> Nik
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 





This might help.

$no_trailing_zeroes = preg_replace("/0+$/","",$trailing_zeroes);


> Dear friends,
>
> I am accessing MySQL database using apache and php.
> I have to display a double integer field without trailing zeros.
> The number of digits after the decimal point varies.
>
> I have tried searching the archive and did not get any previous questions.
>
> Kindly help me in this regard.
>
> Thanking you.
> Sincerely,
> Raveendra Reddy B
> National Law School
> Bangalore
> India
> E-mail: [EMAIL PROTECTED]
>
> ----- End forwarded message -----
>

-- 
http://www.artwells.com/
That which indicates nothing
introduces everything.





Just create it online in such a way that you can spider your whole site and
burn it to CD.  Granted you will lose the searchability of the DB, but the
contents would all be there, and could easily be indexed so that you could
still find what you are looking for.

Create one page that has a link to all of the DB ID's, titles, descriptions,
etc.  Worse case scenario you could still use CTRL-F to find-in-page the
text you are looking for.

Granted this is clumsy compared to what you had in mind, but that is a long
trip.  You would be better off to use Delphi, VB, or something similar to
write a binary app and copy the contents of the MySQL DB to something
appropriate for your programming language and application.

$0.02.

Brian


> I wonder if it's possible to adapt the CGI version of PHP as a Netscape
> plugin, or to  associate the extension of php files to some kind of php
> wrapper.  This would require distributing a browser with the CD for this
> specific CD, but it could work.
>
> For a Unix-only kludge, I found this page,
>  http://home.netscape.com/newsref/std/x-remote.html
> It seems to me, by playing with with the application associations, one
> could get php to write to a temporary file, and then use netscape's
> -remote openFile to read it.  I imagine, though, that if this works, it
> would be rather unstable.
>
> MySQL would be a whole 'nother can of worms.
>
> Just playing with ideas.
>
> [EMAIL PROTECTED]
> http://www.artwells.com/
> That which indicates nothing
> introduces everything.
>
> On Fri, 19 Jan 2001, Philip Apostol wrote:
>
> > Can I run a PHP/Apache/MySQL services on a CD-ROM.  We have PHP scripts
that
> > handle queries on a large database.  We would like to distribute it on a
> > CD-ROM so they could access the database offline.  Is it possible? Or
are
> > there any similar solutions for this?  Im thinking of a text-file
database
> > and access it via javascript but have no much time to study on this.  If
php
> > can be run on the cd-rom, that would be a better solution.   But any
> > solution you posted here will be highly appreciated.  Thanks in advance.
> >
> > Philip
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





http://www.php.net/manual/en/function.getimagesize.php

Previously, Bryan Fritchie said:
> When uploading a file, the built in functions let you get the filename,
> size, type.  If the file is an image, is it possible to also get the width
> and height of the image?
> 
> Right now we are giving input boxes for the user to enter the correct
> values, but I'd rather that my code do it for them.  That way I can prevent
> images that are too wide, as well as not depend on the uploader being smart
> enough to know what the dimensions are.
> 
> Can anyone help me out?

-- 
Dan Lowe <[EMAIL PROTECTED]>                 http://tangledhelix.com/
  
A computer without sendmail is like a dog without bricks tied to its head.
                - seen on the Exim users mailing list




I realize my slashes are most likely in the wrong spot and i'm new to this
PHP stuff so a little help would be appreciated.  I get a parse error

print "<a href=/"showpictures.php?id=<PID>/">Click Here</a>";

Thanks,
Mike






the slashes ate no the correct escape slashes...

the correct would be:

print "<a href=\"showpictures.php?id=<PID>\">Click Here</a>";


----- Original Message ----- 
From: Mike Yuen <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, January 20, 2001 1:25 PM
Subject: [PHP] What's wrong with this link?


I realize my slashes are most likely in the wrong spot and i'm new to this
PHP stuff so a little help would be appreciated.  I get a parse error

print "<a href=/"showpictures.php?id=<PID>/">Click Here</a>";

Thanks,
Mike



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





At 11:25 20/01/01 -0700, Mike Yuen wrote:
>I realize my slashes are most likely in the wrong spot and i'm new to this
>PHP stuff so a little help would be appreciated.  I get a parse error
>
>print "<a href=/"showpictures.php?id=<PID>/">Click Here</a>";

You've got the wrong type of slashes - use backslashes within the string - 
e.g. print ("<a href=\"showpicturesblahlbah\">etc");





Mike,

Read and print this out :

    http://www.zend.com/zend/tut/using-strings.php

It will increase your happiness.

Philip

On Sat, 20 Jan 2001, Mike Yuen wrote:

> I realize my slashes are most likely in the wrong spot and i'm new to this
> PHP stuff so a little help would be appreciated.  I get a parse error
> 
> print "<a href=/"showpictures.php?id=<PID>/">Click Here</a>";
> 
> Thanks,
> Mike
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 






Mike,

Looks like your slashes are backwards use "\" instead of "/" to escape characters.  
You will notice that "/" is used in UNIX directories and HTML tags.

Here is the corrected code:

print "<a href=\"showpictures.php?id=$PID>\">Click Here</a>";

I assume "PID" is a variable.  If so, it should be noted as "$PID".

A really good book for learning PHP is "Beginning PHP4" by Wrox ISBN# 1-861003-73-0



        - Scott


> I realize my slashes are most likely in the wrong spot and i'm new to this
> PHP stuff so a little help would be appreciated.  I get a parse error
> 
> print "<a href=/"showpictures.php?id=<PID>/">Click Here</a>";
> 
> Thanks,
> Mike
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


--
--------------------------------------
   Scott A. Gerhardt  P.Geo.
   Gerhardt Information Technologies
   [EMAIL PROTECTED]
--------------------------------------





The complete snippet is

<?
if (isset($ecb)) {
    if ($ecb >= 5) {
        $val = 1;
    } else {
        $val = $ecb;
        $val++;
    }
} else {
    $val = 1;
}
$expires = mktime(12, 00, 00, 12, 31, 2005);
setcookie("ecb",$val,$expires,"/",".domain.com",0);
?>

I've gotten around it for the moment by using
a browser detection routine and delivering different
methods based on that but that's kind of a dirty
hack.....

> -----Original Message-----
> From: Richard Lynch [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 19, 2001 7:53 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] cookies - not working with Nutscrape
>
>
> What's the rest of your SetCookie look like?
>
> By Day:                                |By Night:
>     Don't miss the Zend Web Store's    |   There's not enough room here...
>     Grand Opening on January 23, 2001! |   Start here:
>     http://www.zend.com                |   http://l-i-e.com/artists.htm
> ----- Original Message -----
> From: Brian V Bonini <[EMAIL PROTECTED]>
> To: Richard Lynch <[EMAIL PROTECTED]>; "Brian V Bonini"
> <[EMAIL PROTECTED]>
> Sent: Friday, January 19, 2001 4:15 PM
> Subject: RE: [PHP] cookies - not working with Nutscrape
>
>
> > That broke em both.......
> >
> > > -----Original Message-----
> > > From: Richard Lynch [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, January 19, 2001 4:04 PM
> > > To: "Brian V Bonini"
> > > Subject: Re: [PHP] cookies - not working with Nutscrape
> > >
> > >
> > >
> > >
> > > > Why would this work in IE but not NN (4.08)?
> > > >
> > > > If I remove "/" ".mydomain.com" it works with
> > > > NN but not IE. Vice versa if I leave it in.
> > >
> > > Keep just the "/", not the domain.
> > >
> > > They both suck.
> > >
> > > By Day:                                |By Night:
> > >     Don't miss the Zend Web Store's    |   There's not enough room
> here...
> > >     Grand Opening on January 23, 2001! |   Start here:
> > >     http://www.zend.com                |
http://l-i-e.com/artists.htm
> >
> >
> >
>
>






Yup, the issue really seems to lie with
the path and domain.....
I may just resort to;
header("Set-Cookie: ......")

-Brian

> -----Original Message-----
> From: DanO [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 19, 2001 7:10 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP] cookies - not working with Nutscrape
> 
> 
> 
> have you checked the date element?
> 
> the browsers differ in how they handle post-y2k dates.
> 
> DanO
> 
> 
> -----Original Message-----
> From: Brian V Bonini [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 19, 2001 4:09 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] cookies - not working with Nutscrape
> 
> 
> Why would this work in IE but not NN (4.08)?
> 
> If I remove "/" ".mydomain.com" it works with
> NN but not IE. Vice versa if I leave it in.
> 
> Thanks,
> -Brian
> ***********
> 
> <? 
> if (isset($ecb)) {
>     if ($ecb >= 5) {
>         $val = 1;
>     } else {
>         $val = $ecb;
>         $val++;
>     }
> } else {
>     $val = 1;
> }
> $expires = mktime(12, 00, 00, 12, 31, 2005);
> setcookie("ecb",$val,$expires,"/",".eastcoastbicycles.com",0);
> ?>
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 




Actually, it's excepting the time/date.
It's the path/domain that is creating a problem.

For some reason your original suggestion of
leaving the domain out is working today.
setcookie("ecb",$val,$expires,"/");

I could not get this to work for the life of me
yesterday. Either I was overworked/tired or the
Gremlins were out in force. ... ;-)

Thank for your persistence.....

-Brian
********

> -----Original Message-----
> From: Richard Lynch [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, January 20, 2001 4:20 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] cookies - not working with Nutscrape
>
>
> > $expires = mktime(12, 00, 00, 12, 31, 2005);
>
> I think Netscape follows the spec and there's some sort of
> maximal reliable
> time limit of two years or somesuch -- and anything else is assumed to be
> badly-formatted time...
>
> Try using something a little more reasonable like a year.
>
> By Day:                                |By Night:
>     Don't miss the Zend Web Store's    |   There's not enough room here...
>     Grand Opening on January 23, 2001! |   Start here:
>     http://www.zend.com                |   http://l-i-e.com/artists.htm
>
>
>





Kristi,

That makes more sense, thanks, but one problem - I don't want to have to do:

$template->assign("FIELD2", $row[fieldname2]);

If I've already called mysql_fetch_array, then I have an array like this:

field1:field1_data
field2:field2_data
field3:field3 data

Is there any way to use the array itself as the assignment, or tell
XTemplate to do so?  That way I can use one file to generate pages from
different templates.

Regards,
Jaxon


On 1/20/01 12:26 PM, "Kristi Russell" <[EMAIL PROTECTED]> wrote:

> require "xtpl.p"; //include XTemplate engine
> 
> //don't need this - wrong.
>> require "html.xtpl"; //html layout file with field names e.g. {firstfield}
> 
> You need to create a new instance of the Xtemplate class so:
> //assign the new instance to a variable name you'll use - I called it
> $template
> //and I specified which "html layout file" to use.
> 
> $template = new Xtemplate("html.tpl"); // I name them tpl not xtpl *shrug*
> 
> while($row = mysql_fetch_array($result))
> {
>   $template->assign("FIELD1", $row[fieldname]);
>   //FIELD1 being the name you're going to use in the layout file by
> {FIELD1}
>   //$row being the name of the array you fetched, field name being the
> fieldname in the database
> 
>   $template->assign("FIELD2", $row[fieldname2]);
> 
>   $template->parse("main");//replace {field} with matching result row
> element
>   $template->out("main");` //send final html page to browser
> }
> 
> 
> 
> Kristi
> 
> 





while ( $rowData = mysql_fetch_array($result))
{
    list($fieldName,  $fieldValue) = each($rowData);
    $template->assign("$fieldName", $fieldValue);
}


----- Original Message -----
From: "Jaxon" <[EMAIL PROTECTED]>
To: "Kristi Russell" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, January 20, 2001 2:03 PM
Subject: Re: [PHP] Please: XTemplate help?


> Kristi,
>
> That makes more sense, thanks, but one problem - I don't want to have to
do:
>
> $template->assign("FIELD2", $row[fieldname2]);
>
> If I've already called mysql_fetch_array, then I have an array like this:
>
> field1:field1_data
> field2:field2_data
> field3:field3 data
>
> Is there any way to use the array itself as the assignment, or tell
> XTemplate to do so?  That way I can use one file to generate pages from
> different templates.
>
> Regards,
> Jaxon
>
>
> On 1/20/01 12:26 PM, "Kristi Russell" <[EMAIL PROTECTED]> wrote:
>
> > require "xtpl.p"; //include XTemplate engine
> >
> > //don't need this - wrong.
> >> require "html.xtpl"; //html layout file with field names e.g.
{firstfield}
> >
> > You need to create a new instance of the Xtemplate class so:
> > //assign the new instance to a variable name you'll use - I called it
> > $template
> > //and I specified which "html layout file" to use.
> >
> > $template = new Xtemplate("html.tpl"); // I name them tpl not xtpl
*shrug*
> >
> > while($row = mysql_fetch_array($result))
> > {
> >   $template->assign("FIELD1", $row[fieldname]);
> >   //FIELD1 being the name you're going to use in the layout file by
> > {FIELD1}
> >   //$row being the name of the array you fetched, field name being the
> > fieldname in the database
> >
> >   $template->assign("FIELD2", $row[fieldname2]);
> >
> >   $template->parse("main");//replace {field} with matching result row
> > element
> >   $template->out("main");` //send final html page to browser
> > }
> >
> >
> >
> > Kristi
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





Cool, so just iterate through the array and sort it into the template
assignment - quite nice!

Thanks for the pointers Kristi!

Regards,
Jaxon

On 1/20/01 3:37 PM, "Kristi Russell" <[EMAIL PROTECTED]> wrote:

> while ( $rowData = mysql_fetch_array($result))
> {
>   list($fieldName,  $fieldValue) = each($rowData);
>   $template->assign("$fieldName", $fieldValue);
> }
> 
> 
> ----- Original Message -----
> From: "Jaxon" <[EMAIL PROTECTED]>
> To: "Kristi Russell" <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Saturday, January 20, 2001 2:03 PM
> Subject: Re: [PHP] Please: XTemplate help?
> 
> 
>> Kristi,
>> 
>> That makes more sense, thanks, but one problem - I don't want to have to
> do:
>> 
>> $template->assign("FIELD2", $row[fieldname2]);
>> 
>> If I've already called mysql_fetch_array, then I have an array like this:
>> 
>> field1:field1_data
>> field2:field2_data
>> field3:field3 data
>> 
>> Is there any way to use the array itself as the assignment, or tell
>> XTemplate to do so?  That way I can use one file to generate pages from
>> different templates.
>> 
>> Regards,
>> Jaxon
>> 
>> 
>> On 1/20/01 12:26 PM, "Kristi Russell" <[EMAIL PROTECTED]> wrote:
>> 
>>> require "xtpl.p"; //include XTemplate engine
>>> 
>>> //don't need this - wrong.
>>>> require "html.xtpl"; //html layout file with field names e.g.
> {firstfield}
>>> 
>>> You need to create a new instance of the Xtemplate class so:
>>> //assign the new instance to a variable name you'll use - I called it
>>> $template
>>> //and I specified which "html layout file" to use.
>>> 
>>> $template = new Xtemplate("html.tpl"); // I name them tpl not xtpl
> *shrug*
>>> 
>>> while($row = mysql_fetch_array($result))
>>> {
>>>   $template->assign("FIELD1", $row[fieldname]);
>>>   //FIELD1 being the name you're going to use in the layout file by
>>> {FIELD1}
>>>   //$row being the name of the array you fetched, field name being the
>>> fieldname in the database
>>> 
>>>   $template->assign("FIELD2", $row[fieldname2]);
>>> 
>>>   $template->parse("main");//replace {field} with matching result row
>>> element
>>>   $template->out("main");` //send final html page to browser
>>> }
>>> 
>>> 
>>> 
>>> Kristi
>>> 
>>> 
>> 
>> 
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>> 
> 






        I posted this twice on PHP-Install and got not a single reply back. 
So, I'm trying here:

----------

    I've installed Sun's JSDK v1.3.0 onto my system (an Intel running
RH), and compiled PHP 4.0.4 with the --with-java=/usr/java flag.  When I
look in php.ini, I see the following references to java:

[Java]
;java.class.path = .\php_java.jar
;java.home = c:\jdk
;java.library = c:\jdk\jre\bin\hotspot\jvm.dll
;java.library.path = .\

    However, this seems to be for a WinTel installation, not a unix
one.  The php_java.jar I found resides in
$SYSTEM_SRC/php-4.0.4/ext/java/php_java.jar.  Do I copy this somewhere
(out of my SRC tree) and adjust the php.ini accordingly?

    As for the library, the 'jvm's I have are the following:

/usr/java/jre/lib/i386/client/libjvm.so
/usr/java/jre/lib/i386/server/libjvm.so
/usr/java/jre/lib/i386/classic/libjvm.so

    Which do I specify?  And what path do I set?

    When I look at phpinfo(), it doesn't mention anything anywhere about
Java, and I'm assuming because it's not enabled in the php.ini file.
(would make sense at least)

    AMK4

--
W |
  |  I haven't lost my mind; it's backed up on tape somewhere.
  |____________________________________________________________________
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Ashley M. Kirchner <mailto:[EMAIL PROTECTED]>   .   303.442.6410 x130
  SysAdmin / Websmith                           .     800.441.3873 x130
  Photo Craft Laboratories, Inc.             .        eFax 248.671.0909
  http://www.pcraft.com                  .         3550 Arapahoe Ave #6
  .................. .  .  .     .               Boulder, CO 80303, USA




www.thickbook.com is a good start. Last I looked it covered Flash 4, and
Flash 5 is quite a bit different.

Basically you have PHP print the variables in HTML and Have Flash parse
that. Flash can't directly parse PHP variables. It's not difficult once you
figure it out.

Mike

> From: "Abe Asghar" <[EMAIL PROTECTED]>
> Reply-To: "Abe Asghar" <[EMAIL PROTECTED]>
> Date: Fri, 19 Jan 2001 14:41:27 -0000
> To: "PHP General List" <[EMAIL PROTECTED]>
> Subject: [PHP] <> Flash + PHP <>
> 
> Hey Guys,
> 
> Anybody have any good links for Flash with PHP simple stuff.
> 
> Any tutorials or general links that maybe useful.
> 
> Thanks,
> Abe
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





Hi,

I have used the following code to open a file

$fd=fopen("words.txt", "r");
$words = fread($fd, 1000000);

I then convert a string which is passed in a form to this script

$FirstName=strtolower("$FirstName");

And now I check to see if the lowercase version of $FirstName contains any of 
the words from the $words

if ($FirstName=="$words")
{
echo "Bad";
}

But it doesn`t seem to want to work, anyone give me a pointer as to where I 
am going wrong with this??

Ade




I have PHP working like a champ on my WIN 2K computer with IIS.  Now I
would like to have it on my notebook, so I loaded Apache and have
following the instructions from Shanx; however, I get the message that
Apache cannot load php4apache.dll.  It shows the correct path.

What is the best source for help?

Todd
--
Todd Cary
Ariste Software
[EMAIL PROTECTED]







I had the same problem, i ended up placing the php4apache.dll in the
apache/modules directory where the rest of the modules for apache are
stored.

Then change the entry in httpd.conf to: LoadModule php4_module
modules/php4apache.dll

everything worked then :)

good luck

Morkai

> I have PHP working like a champ on my WIN 2K computer with IIS.  Now I
> would like to have it on my notebook, so I loaded Apache and have
> following the instructions from Shanx; however, I get the message that
> Apache cannot load php4apache.dll.  It shows the correct path.
>
> What is the best source for help?
>
> Todd
> --
> Todd Cary
> Ariste Software
> [EMAIL PROTECTED]





Nik Gare <[EMAIL PROTECTED]> wrote

> Does anyone know where I could find a text list of every
> word in the English language ;-)

You could try (also) getting hold of ispell

a search on www.google.com/linux

or sunsite should get it.

You'll need something capable of uncompressing tar archives to peek at
it.

-- 
******************************************************************************
Marx: "Why do Anarchists only drink herbal tea?"
Proudhon: "Because all proper tea is theft."
******************************************************************************




Hello,
      I am trying to compile PHP with the option "--with-apxs" to be able to
use both PHP 3 and PHP 4 on the same server.Unfortunately, if I try to
use configure with that option

./configure --with-mysql=../mysql --with-ldap=/usr --with-apache=../apache 
--enable-track-var --with-imap=../imap-4.7 --enable-versioning 
--with-apxs=/usr/local/apache/bin/apxs

I keep getting this error...

checking for Apache module support via DSO through APXS... apxs:Error: 
Sorry, no DSO support for Apache available
apxs:Error: under your platform. Make sure the Apache
apxs:Error: module mod_so is compiled into your server
apxs:Error: binary `/usr/local/apache/bin/httpd'.


I did a "httpd -l" and it showed mod_so in the httpd .

It gave me this warning at the end....

WARNING: Your /usr/local/apache/bin/apxs script is most likely broken.

Please go read http://www.php.net/FAQ.php3#6.11 and make the
changes described there and try again.

Tried the changes it gave, had no success with them.

Thanks for any help!

Sincerely,

Jero






Hello Jero, 

(J == "Jero") [EMAIL PROTECTED] writes:

J> checking for Apache module support via DSO through APXS... apxs:Error:
J> Sorry, no DSO support for Apache available
J> apxs:Error: under your platform. Make sure the Apache
J> apxs:Error: module mod_so is compiled into your server
J> apxs:Error: binary `/usr/local/apache/bin/httpd'.

The only time I've ever gotten this error is when there were either
two installations of Apache on the system, or leftovers from a
previous installation (Ie. BSDi (the worst) and RedHat).

Run updatedb if you're on Linux, then do a locate for apxs. If you
find more than one, you need to find out which one belongs to the
currently running httpd.

If all else fails you can backup your web files, cgi-bin,
configuration files, etc. and remove everything that is Apache on the
system. Then do a complete, fresh install of Apache and try building
PHP as a DSO again.

But, I would probably make sure it's not getting confused by the
multiple apxs scripts first.

-Brian






Lets say I have 11 / 3

answer is 2.6666667

what if I want to get the remainder of it
so 11 / 3 would be 2

is there a built in function for this in PHP?
kinda like MOD in Visual Basic?

- Thanks




11 % 3

On Sat, 20 Jan 2001 [EMAIL PROTECTED] wrote:

> Lets say I have 11 / 3
>
> answer is 2.6666667
>
> what if I want to get the remainder of it
> so 11 / 3 would be 2
>
> is there a built in function for this in PHP?
> kinda like MOD in Visual Basic?
>
> - Thanks
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





I am facing a problem where some users on the server are using php
mail() function to mail a list of users in taken from mysql db(around
5000 users, but not spam), but this is getting the system crashed due to
excessvie loads and if I limit the delivery load on exim than even
geninue mail is getting holded up.

so is there anyway to limit the number of emails or delay the mails from
the nobody user( which is the apach+php user which mails) or make PHP
use a remote server than the local sendmail ?

any help would be apperciated.
TIA

ewiz




Edit your php.ini file and edit your sendmail_path directive.  The default
is "sendmail -t -i".  Add the correct -o switch (don't remember it
offhand) to have sendmail just queue the email instead of trying to
deliver right away.  Then set up sendmail to deliver the queue at regular
intervals.

-Rasmus

On Sun, 21 Jan 2001, ewiz wrote:

> I am facing a problem where some users on the server are using php
> mail() function to mail a list of users in taken from mysql db(around
> 5000 users, but not spam), but this is getting the system crashed due to
> excessvie loads and if I limit the delivery load on exim than even
> geninue mail is getting holded up.
>
> so is there anyway to limit the number of emails or delay the mails from
> the nobody user( which is the apach+php user which mails) or make PHP
> use a remote server than the local sendmail ?
>
> any help would be apperciated.
> TIA
>
> ewiz
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





Hello,

I plan to use session variables to identify if a user is logged in...   I
know there is an option to set the life of the session but I am looking for
a way to end the session five minutes after they have did there last
"transaction" with my site...

I don't want people that are actively using my site to be logged out after 5
minutes just the folks that are sitting idle...


Any ideas,


Thanks

Randy





Hi,

How about this: Save the "last action time" as a session variable. Whenever
the user hits a page, check that session variable against the current time.
If the "last action time" is more than 5 minutes older than the current
time, log them out/unset session variables.

Should work I guess.

""Randy Johnson"" <[EMAIL PROTECTED]> a écrit dans le message news:
[EMAIL PROTECTED]
> Hello,
>
> I plan to use session variables to identify if a user is logged in...   I
> know there is an option to set the life of the session but I am looking
for
> a way to end the session five minutes after they have did there last
> "transaction" with my site...
>
> I don't want people that are actively using my site to be logged out after
5
> minutes just the folks that are sitting idle...
>
>
> Any ideas,
>
>
> Thanks
>
> Randy
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






Christian Reiniger wrote:
> 
> On Thursday 18 January 2001 23:05, Noel Akins wrote:
> > Question 2:
> > Is there a way for php to detect the cpu speed of a users computer?
> 
> If you're on a Linux machine you can read /proc/cpuinfo and pick out the
> speed entry.

Linux on the sun sparc64 architexture doesn't always have the cpu speed
in /proc/cpuinfo.
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-
Michael A. Peters
Abriasoft Senior Developer




Hello Everyone,

    I am trying to make a page that will interact with mysql.  I need to be
able to access the result of my mysql_query by using a for loop.  I made a
little function that will sortof do this, but it returns a numeric array.
Of course, I want an associative array (becauses things get screwy with a
null). Does anyone know how to make something like what I want?  Thanks a
bunch :-)

This is my current function:

function returnArray ($id) {
     $z = array (array());
     for ($i = 0; $row = mysql_fetch_array ($id); $i++) {
          for ($a = 0; $a < sizeof ($row); $a++) {
               $z[$i][$a] = $row[$a];
          }
     }
     return $z;
}





while($row = mysql_fetch_array($id,MYSQL_ASSOC)) {
    foreach($row as $index=>$value) {
        $z[$index][] = $value;
    }
}

For a table with 3 rows and fields abc and def in each row this would
produce an array like this:

   $z[abc][0]
   $z[def][0]
   $z[abc][1]
   $z[def][1]
   $z[abc][2]
   $z[def][2]

-Rasmus

On Sat, 20 Jan 2001, Jeff Lacy wrote:

> Hello Everyone,
>
>     I am trying to make a page that will interact with mysql.  I need to be
> able to access the result of my mysql_query by using a for loop.  I made a
> little function that will sortof do this, but it returns a numeric array.
> Of course, I want an associative array (becauses things get screwy with a
> null). Does anyone know how to make something like what I want?  Thanks a
> bunch :-)
>
> This is my current function:
>
> function returnArray ($id) {
>      $z = array (array());
>      for ($i = 0; $row = mysql_fetch_array ($id); $i++) {
>           for ($a = 0; $a < sizeof ($row); $a++) {
>                $z[$i][$a] = $row[$a];
>           }
>      }
>      return $z;
> }
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





I am wondering if it would be more efficient to store the integer value that
the php function time() returns when a transaction is inserted into the
database and then when querying the database to get certain transactions
just use basic math functions to get the certain transactions.

For example in I wanted to get all the transactions from the last 31 days

lets say there was 980026719 seconds since 1970 and the number of seconds
from the last 31 days is 2678400


select from   table where time_of_trans >(980026719-2678400)



I know that the syntax isn't correct, I am just curious if this would be the
most efficient way to do this?

thanks

Randy





I am trying to store some credit card numbers in a database, along with the rest of 
the data (dangerous, I know). Unforunately, I am using a provider that doesn't have 
the mcrypt functions compiled into PHP, so I guess I am stuck using the swiss-cheese 
like XOR method of encryption. My client is too cheap to put a separate server to 
store the credit card numbers, so I am stuck using symmetrical encryption.

NEvertheless, I want to implement XOR, but I can't find an example on the net that 
shows how to do it in PHP. I know the philosophy behind it, but hwo do you do it? Do 
you convert the letters in the passphrase and the credit card number into 0 1 binary 
and then XOR that? What commands are there iN PHP that converts from alphanumeric to 
binary? If someone could post an example, that would be great.

- Steve





I have some Delphi code that uses the XOR, if that would help.

Todd

--
Todd Cary
Ariste Software
[EMAIL PROTECTED]






Feel free (as in public domain) to use this function:
http://www.nirvani.net/software/misc/xor_string-1.0.0.inc.asc

Jeremy

Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: [EMAIL PROTECTED]
http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html for more 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    "LINUX is obsolete"  -- Andy Tanenbaum, January 29th, 1992
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       http://www.JEEP-FOR-SALE.com/ -- I need a buyer
  Get your own Free, Private email at http://www.smackdown.com/

On Sat, 20 Jan 2001, Steve Quezadas wrote:

> Date: Sat, 20 Jan 2001 13:41:20 -0800
> From: Steve Quezadas <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: [PHP] XOR data encryption
> 
> I am trying to store some credit card numbers in a database, along with the rest of 
>the data (dangerous, I know). Unforunately, I am using a provider that doesn't have 
>the mcrypt functions compiled into PHP, so I guess I am stuck using the swiss-cheese 
>like XOR method of encryption. My client is too cheap to put a separate server to 
>store the credit card numbers, so I am stuck using symmetrical encryption.
> 
> NEvertheless, I want to implement XOR, but I can't find an example on the net that 
>shows how to do it in PHP. I know the philosophy behind it, but hwo do you do it? Do 
>you convert the letters in the passphrase and the credit card number into 0 1 binary 
>and then XOR that? What commands are there iN PHP that converts from alphanumeric to 
>binary? If someone could post an example, that would be great.
> 
> - Steve
> 
> 





Steve,

If you're using MySQL, it has some built-in encryption functions that
would be slightly better than trying to implement XOR encryption in
PHP.  The best solution would be to use PGP or GPG (GNU Privacy Guard) to
encrypt the credit card numbers before you put them in the
database.


Regards,

Sean Cazzell





Hi

I'm looking for some free opinion polling code using PHP and MySQL. I've
checked a number of scripts and they haven't been up to scratch - I'm just
after a simple poll that allows a user to vote once (selecting yes or no)
and then for the remainder of their session they can only view the poll
results (i.e. not vote again). Tricks like hitting refresh to resubmit the
vote shouldnt work, and the results need to be shown as a bar graph - if
anyone knows of a good script, please let me know. I'm trying Sympoll but
it's not working properly and the guy's site is down (www.ralusp.net)

thanks in advance

Lucas Young






Currently my cookie expires in 1 hour, How can I make it expire in 1 day?

        setcookie("MemberLogin",$value,time()+3600);  /* expire in 1 hour */
        setcookie("MemberLogin",$value,time()+3600,"/",".combatfs.com",1);

        WreckRman2
        Combat Flight Center
        http://www.combatfs.com




> Currently my cookie expires in 1 hour, How can I make it expire in 1 day?
>
>       setcookie("MemberLogin",$value,time()+3600);  /* expire in 1 hour */
>       setcookie("MemberLogin",$value,time()+3600,"/",".combatfs.com",1);

24*3600

-Rasmus





Hi,

I am trying to conect to a MySQL db and no matter what code I use I am always 
getting denied, I know the password is correct as I have tested it elsewhere. 
Just wondering if this could be caused by the fact that the password has a + 
and a . in it. Would that get me denied, and how can I get around it other 
than changing the PW ??

TIA
Ade




whats the easiest way to go from "/dir1/dir2/dir3/hello.php" to "dir3/" ?
dirname will cut off hello.php but i want to cut dir1 and dir2 as well

Thanks!

- Noah






Hello!

> whats the easiest way to go from "/dir1/dir2/dir3/hello.php" to "dir3/" ?
> dirname will cut off hello.php but i want to cut dir1 and dir2 as well

<?php

$dir_path = "/dir1/dir2/dir3/hello.php";

$dirs = explode("/",$dir_path);

$numberofelements = count($dirs);

$i = 1;
foreach ($dirs as $value) {
 if ($i == ($numberofelements-1)) $lastdir = $value;
 if ($i == $numberofelements) $file = $value;
 $i++; 
}

echo $lastdir."/".$file;


?>

I believe that this will do the job





> $i = 1;
> foreach ($dirs as $value) {
>  if ($i == ($numberofelements-1)) $lastdir = $value;
>  if ($i == $numberofelements) $file = $value;
>  $i++;
> }

I don't think the foreach is necessary - Why can't you just say:

$lastdir = $dirs[$numberofelements-1];
$file = $dirs[$numberofelements];

That way you're not traversing the entire array, you're just getting what
you need, more efficient. Now if only you could work with files the same way
you can with arrays...





no without submitting information to the server with get or post.

for example, if a bit of javascript you have comes up with some value, the
only way you can get it to the server is to put it in a get and send the
user to that url:

http://www.mysite.com/index.php?your_js_var=your_value

etc.

_alex


--
Alex Black, Head Monkey
[EMAIL PROTECTED]

The Turing Studio, Inc.
http://www.turingstudio.com

vox+510.666.0074
fax+510.666.0093

Saul Zaentz Film Center
2600 Tenth St Suite 433
Berkeley, CA 94710-2522




> From: [EMAIL PROTECTED] (Evelio Martinez)
> Newsgroups: php.general
> Date: 19 Jan 2001 09:01:33 -0800
> Subject: [PHP] is it possible to communicate javascript and php?
> 
> I would like to know if it possible to pass in any way some values
> 
> from javascript functions to php variables ?
> 
> Any FAQ?
> 
> Thanks
> 
> --
> Evelio Martínez
> Testanet. Dept. desarrollo software.
> Av. Reino de Valencia, 15 - 5
> 46005 Valencia (Spain)
> Tel: +34 96 395 90 00
> Fax: +34 96 316 23 19
> 
> 
> 





On Sat, Jan 20, 2001 at 05:20:53PM -0800, Alex Black wrote : 
> no without submitting information to the server with get or post.
> 
> for example, if a bit of javascript you have comes up with some value, the
> only way you can get it to the server is to put it in a get and send the
> user to that url:
> 
> http://www.mysite.com/index.php?your_js_var=your_value

        With 'post' methods its also possible this way (works NS
and IE):

<script language="JavaScript"><!--
        function do_something( form) {
                form.jsvar.value = form.bla.selcetedIndex;
                form.submit();
                return true;
        }
//--></script>

<form name="mainform", action="<?echo$PHP_SELF?>" methos="post">
<input type="hidden" name="jsvar" value="">

<selcet name="bla">
<option> foo
<option> bar
</select>

<input type="button" onclick="do_something( document.mainform)" value="click">

</form>


You know have set the phpvar $jsvar from within javascript.

m.

-- 
Markus Fischer,  http://josefine.ben.tuwien.ac.at/~mfischer/
EMail:         [EMAIL PROTECTED]
PGP Public  Key: http://josefine.ben.tuwien.ac.at/~mfischer/C2272BD0.asc
PGP Fingerprint: D3B0 DD4F E12B F911 3CE1  C2B5 D674 B445 C227 2BD0




>>> is there any benchmarks or proof that I should host a high traffic site on a
>>> FREEBSD/APACHE instead of a redhat Linux/Apache server?

I have _heard_ that linux is great under medium load, but does not deal as
well with super-high loads as well as freeBSD. that has not stopped me from
using linux in all of my commercial installations, with not a problem once
:)

I think the answer is to say:

we'll use apache, on (insert your fav. *nix here) - in a cluster of
webservers that can be easily expanded as the need arises.

I personally dislike sun: expensive, hyper-proprietary (almost worse then
MS, because its their hardware as well), and really_really_rude

What's great about both FreeBSD and Linux: commodity hardware! cheap! easy
to get! cheap! It's easier to build in redundancy than it is to engineer
100% uptime.

_alex






Hi-

I'm new to this list. I'll start out with hopefully a good question. I have
a project coming up where I need to take some form input insert it into a
premade template and create a custom pdf for a user. The pdf will then be
e-mailed to the user or a link to download it e-mailed to them.

My question is, which would be better for doing this? I see Cold Fusion has
some tags for creating pdf's but it looks like PHP has more capabilities
along these lines. Also, I see Adobe (http://cpdf1.adobe.com/) has its own
pdf service that might somehow be able to be taken advantage of.

If anyone has some expertise and knowledge to share along these lines I
would be grateful.

Thanks for any help,
-----------------------------------------------------------------------
| D A R K  P O R T A L  G A M E S    Tony K. Bounds, Web Wizard       |
| http://www.darkportalgames.com     [EMAIL PROTECTED]      |
|_____________________________________________________________________|
|          You provide the paper. We provide the adventure.           |
-----------------------------------------------------------------------

 





Hello,

I want to send a mail in HTML format with the mail() function.
I have tried to send html stuff in the message parameter, but when I read it
in my hotmail account, I just see the html code and not what the html is
supposed to show.
I suppose that it is necessary to send some additional headers to specify that
the mail is in html format.
Thanks for your help.

Pascal

____________________________________________________________________
Get free email and a permanent address at http://www.netaddress.com/?N=1




On Sat, Jan 20, 2001 at 06:46:39PM -0700, Pascal Clerin wrote : 
> I want to send a mail in HTML format with the mail() function.
> I have tried to send html stuff in the message parameter, but when I read it
> in my hotmail account, I just see the html code and not what the html is
> supposed to show.
> I suppose that it is necessary to send some additional headers to specify that
> the mail is in html format.
> Thanks for your help.

        How about sending yourself a HTML email and examing the
headers ? I did that way, worked. To shorten this cycle for you,
some hints:

Content-Type: text/html; charset="us-ascii"

        (for example)


To include test and html, use the following:

Content-Type: multipart/alternative;
        boundary="----=_NextPart_000_062D_01C079C0.9DFF9B70"

Then, in the body

This is a multi-part message in MIME format.

------=_NextPart_000_062D_01C079C0.9DFF9B70
Content-Type: text/plain;
        charset="us-ascii"
Content-Transfer-Encoding: 7bit

ene mene u

------=_NextPart_000_062D_01C079C0.9DFF9B70
Content-Type: text/html;
        charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html><body><h1>
ene mene mu
</h1></body></html>


m.

-- 
Markus Fischer,  http://josefine.ben.tuwien.ac.at/~mfischer/
EMail:         [EMAIL PROTECTED]
PGP Public  Key: http://josefine.ben.tuwien.ac.at/~mfischer/C2272BD0.asc
PGP Fingerprint: D3B0 DD4F E12B F911 3CE1  C2B5 D674 B445 C227 2BD0




Hi list,

I have scoured the archives with no good game plans.

Here is what I am trying to accomplish:

dump a table to a file on my server:
$sql = "SELECT * INTO OUTFILE '/tmp/test.txt' FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\n' FROM table_name";

take the file and email it to someone:
using a mime-mail class from http://phpclasses.upperdesign.com

The above works perfectly.  I am able to create the file and email it to a
designated address.

Problem is that once I have created the dump file, it will not allow me to
overwrite it and it gives me an error.  Error = rm: cannot unlink
`test.txt': Operation not permitted.  It is owned by mysql:mysql.  So it
looks like it must be deleted by root or I need to change the ownership of
the file so it can be deleted.  So...

What is the best way to remove the file before re-dumping it to the /tmp
directory?  I'm not sure if it is possible to switch to root...but I know
that is probably a very bad idea.  How can I change the ownership of the
file so it can be deleted from PHP code?

TIA,

Scott

P.S.  Please cc: me on any responses as I am no longer a member of the list.





On Sat, Jan 20, 2001 at 05:57:25PM -0800, PHP List wrote : 
> dump a table to a file on my server:
> $sql = "SELECT * INTO OUTFILE '/tmp/test.txt' FIELDS TERMINATED BY '\t'
> LINES TERMINATED BY '\n' FROM table_name";
> 
> Problem is that once I have created the dump file, it will not allow me to
> overwrite it and it gives me an error.  Error = rm: cannot unlink
> `test.txt': Operation not permitted.  It is owned by mysql:mysql.  So it
> looks like it must be deleted by root or I need to change the ownership of
> the file so it can be deleted.  So...

        As i first shot, if you need it quickly to work, add a
random number to the text file.

Sorry, no more ideas, just a dirty hack.

m.

-- 
Markus Fischer,  http://josefine.ben.tuwien.ac.at/~mfischer/
EMail:         [EMAIL PROTECTED]
PGP Public  Key: http://josefine.ben.tuwien.ac.at/~mfischer/C2272BD0.asc
PGP Fingerprint: D3B0 DD4F E12B F911 3CE1  C2B5 D674 B445 C227 2BD0




Hi,

I have a form which users enter their email address, once submitted I need a 
way to chop it up and put it in lowercase. So that if a user submits 
[EMAIL PROTECTED] I want PHP to throw out Website4S and then make the rest 
lowercase so I would get @aol.com

I know how to get the string to lowercase by using

$Email1=strtolower($Email);

My problem is how to get $Email and chop off anything up to the @ and because 
people may enter different email providors I have no idea how to get around 
it. Anyone have a suggestion I would really appreciate it.

Ade




On Sat, Jan 20, 2001 at 09:10:45PM -0500, [EMAIL PROTECTED] wrote : 
> I have a form which users enter their email address, once submitted I need a 
> way to chop it up and put it in lowercase. So that if a user submits 
> [EMAIL PROTECTED] I want PHP to throw out Website4S and then make the rest 
> lowercase so I would get @aol.com
> 
> I know how to get the string to lowercase by using
> 
> $Email1=strtolower($Email);
> 
> My problem is how to get $Email and chop off anything up to the @ and because 
> people may enter different email providors I have no idea how to get around 
> it. Anyone have a suggestion I would really appreciate it.

        The key to your secret is called regular expression.

<?
        $email = "[EMAIL PROTECTED]";

        if( eregi( "^([^@]+)@([^@]+)$", $email, $match)) {
                $email_user   = $match[1];
                $email_domain = strtolower( $match[2]);
                echo "$email_user at $email_domain";
        } else
                echo "bad email";
?>

Note, this does not validate if the email is correct; if you need
this, take a look at php.net, some of the manual comments talk
about email validaten ( whereupon methinks Tom Christiansen email
verifier [written in perl] is still the best validator).

hope this helps

m.

-- 
Markus Fischer,  http://josefine.ben.tuwien.ac.at/~mfischer/
EMail:         [EMAIL PROTECTED]
PGP Public  Key: http://josefine.ben.tuwien.ac.at/~mfischer/C2272BD0.asc
PGP Fingerprint: D3B0 DD4F E12B F911 3CE1  C2B5 D674 B445 C227 2BD0




In a message dated 21/01/2001 03:43:19 GMT Standard Time, 
[EMAIL PROTECTED] writes:

<<         if( eregi( "^([^@]+)@([^@]+)$", $email, $match)) {
                 $email_user   = $match[1];
                 $email_domain = strtolower( $match[2]);
                 echo "$email_user at $email_domain";
         } else
                 echo "bad email"; >>

Thank you m. that works perfect!

Ade




Hi all

I think most of the problems I am having with PHP and sample code not
working seems to be because cookies arent being generated
I'm using php.ini in it's default config
Windows 2000 Pro IIS PHP 4.0.4pl1
PHP seems to be working fine otherwise... I did the installshield install
then unzipped the zip package over the top to get the extra modules...
How can I check that cookies are working and et up? I am seeing cookies in
c:\documents and settings\<login>\cookies on both the web machine and my
workstation for normal www sites but not for any of my php sites...

thanks in advance

Luacs





On Sun, Jan 21, 2001 at 04:24:09PM +1300, Lucas Young wrote : 
> I think most of the problems I am having with PHP and sample code not
> working seems to be because cookies arent being generated
> I'm using php.ini in it's default config
> Windows 2000 Pro IIS PHP 4.0.4pl1
> PHP seems to be working fine otherwise... I did the installshield install
> then unzipped the zip package over the top to get the extra modules...
> How can I check that cookies are working and et up? I am seeing cookies in
> c:\documents and settings\<login>\cookies on both the web machine and my
> workstation for normal www sites but not for any of my php sites...

        How have you done cookie activation ? One easy way is to
use session_start(); as it tries to set a cookie and fallsback to
urlmodifieng if not possible.

m.

-- 
Markus Fischer,  http://josefine.ben.tuwien.ac.at/~mfischer/
EMail:         [EMAIL PROTECTED]
PGP Public  Key: http://josefine.ben.tuwien.ac.at/~mfischer/C2272BD0.asc
PGP Fingerprint: D3B0 DD4F E12B F911 3CE1  C2B5 D674 B445 C227 2BD0




I'm actually using code from the web - sympoll from www.ralusp.net and
authlib, both give me errors and neither seems to be writing cookies... I
note in PHP the session save path is /tmp, where should this folder live?

-----Original Message-----
From: Markus Fischer [mailto:[EMAIL PROTECTED]]
Sent: Sunday, 21 January 2001 4:44 p.m.
To: Php-General
Subject: Re: [PHP] my cookies arent working!


On Sun, Jan 21, 2001 at 04:24:09PM +1300, Lucas Young wrote :
> I think most of the problems I am having with PHP and sample code not
> working seems to be because cookies arent being generated
> I'm using php.ini in it's default config
> Windows 2000 Pro IIS PHP 4.0.4pl1
> PHP seems to be working fine otherwise... I did the installshield install
> then unzipped the zip package over the top to get the extra modules...
> How can I check that cookies are working and et up? I am seeing cookies in
> c:\documents and settings\<login>\cookies on both the web machine and my
> workstation for normal www sites but not for any of my php sites...

        How have you done cookie activation ? One easy way is to
use session_start(); as it tries to set a cookie and fallsback to
urlmodifieng if not possible.

m.

--
Markus Fischer,  http://josefine.ben.tuwien.ac.at/~mfischer/
EMail:         [EMAIL PROTECTED]
PGP Public  Key: http://josefine.ben.tuwien.ac.at/~mfischer/C2272BD0.asc
PGP Fingerprint: D3B0 DD4F E12B F911 3CE1  C2B5 D674 B445 C227 2BD0

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






im trying to build an array from an entry in a file and im having some
trouble with it.

in a file i have a line similar to:
1234 hello 123456 12345678

I grab this line and try to make it an array like this:
$var1 = trim($thelinefromfile);
$var2 = split(" ", $thelinefromfile);
$count = count($var2);

$count comes out to equal 1
so, it doesnt actually see each space as the seperator therefore it sees it
as one field..
Ive also tried split("\ ", $thelinefromfile);
but, that doesnt work either...
ive tried ereg_replace($space, $commathenspace, $thelinefromfile);
that also does not seem to work....

Please help...

Thanks in advance

Rick



Reply via email to