Re: [PHP] 4.0.2 = 4.2.3, form vars are empty?

2002-09-28 Thread Justin French

turn register globals ON on php.ini (they now default to off), then read the
1000's of threads about register globals, missing/empty form variables,
super global arrays, etc etc in the archives.

post vars are found in $_POST, session in $_SESSION, get in $_GET, etc etc

Justin French


on 28/09/02 12:47 AM, Qmail List ([EMAIL PROTECTED]) wrote:

 Hello List,
 
 I'm putting a php app that has been off-line for about 18 months back
 on-line. During my absence from php I had heard about some security issues,
 so figured I'd try the latest 4.2.3 release.
 
 Sessions and the DB are fine, but GET/POST vars are continually empty. I
 mean a form submission from .html to .php (about the simplest thing
 possible) the variables are not getting populated with their form values.
 
 Actually, phpinfo() does show the variables and their values if I throw it
 in the .php file. But tailing the mysql log shows the following:
 
 SELECT * FROM users WHERE username='' AND password=''
 
 from this code.
 
 $query = mysql_query(SELECT * FROM users WHERE username='$username' AND
 password='$password');
 
 
 Regards, Thx
 


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




Re[2]: [PHP] counting words in a string

2002-09-28 Thread rdkurth

Hello Justin,

That worked perfect but I have one more problem I need to know if one
of the word is UNAVAILABLE I need to know if it is the first one or
the second one. I don't know if there is any way to do this.
   1st 2nd
$string =UNAVAILABLE AVAILABLE More Info;
  1st   2nd
 $string =AVAILABLE More Info UNAVAILABLE ;
 
Friday, September 27, 2002, 11:22:42 PM, you wrote:


JF if this is your SPECIFIC problem, putting a space at the beginning of $srch
JF will help, eliminating XAVAILABLE... but this will cause a problem with the
JF word AVAILABLE appearing at the start of the string, so temporarily put a
JF space at the start of the string:

JF ?
JF // UNTESTED
JF $count = substr_count(' '.strtolower($string), strtolower(' '.$srch));
JF echo $count;
?

JF this won't help if there are newlines and other white space instead of
JF spaces, and won't help (so far) for a different set of circumstances...

JF it would be nice to extend substr_count() could be extended to have an
JF option.

JF Justin



JF on 28/09/02 3:41 PM, [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote:

 
 I need to count how many times the word AVAILABLE appears in a string
 like this
 $string =AVAILABLE More Info AVAILABLE More Info;
 some time the string looks like this
 $string =UNAVAILABLE More Info AVAILABLE More Info;
 or
 $string =AVAILABLE More Info UNAVAILABLE More Info;
 when I use
 $srch=AVAILABLE;
 $count=substr_count(strtolower($string), strtolower($srch));
 echo $count;
 it puts the count a 2 even when one of the words is UNAVAILABLE
 how can I make it only count AVAILABLE and not UNAVAILABLE or visa
 verse





-- 
Best regards,
 rdkurthmailto:[EMAIL PROTECTED]


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




[PHP] Solaris8/intel PHP binaries .. PLEASE !!

2002-09-28 Thread PHPio

hi guys..

i've really seached alot for Soalris8/intel PHP binaries with no result..
i've tried also to do the compiling but every tme thier is a lots of
errors..
so my only solution now is to find any pre-made binaries for Solaris8/i386
platforme

my question is : does it exist ?

thanx alot



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




[PHP] Solaris8/intel PHP binaries .. PLEASE !!

2002-09-28 Thread PHPio

hi guys..

i've really seached alot for Soalris8/intel PHP binaries with no result..
i've tried also to do the compiling but every tme thier is a lots of
errors..
so my only solution now is to find any pre-made binaries for Solaris8/i386
platforme

my question is : does it exist ?

thanx alot




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




[PHP] Header Content x-tar

2002-09-28 Thread Sascha Braun

Hi Erwin,

and anyone else too.

It's me again. Maybe you are able to solve another problem for me.

The last Scriptcode I returned to you is working fine in IE6 and below
(I believe), but a friend of mine tried to download a tared file with IE
on MacOS. After checking this behaviour (I'm not really able to do a
real check, because I'm not really able to understand what really
happens with theese mime-types), I thought about to check it in 
Netscape too, and later Mozilla in Mac and Win, but it worked
nowhere else than in IE 6 until now. In Netscape the download
starts and a 10 KB file is safed to disk called download.php. In
Mozilla the download starts and a file named picture_name.tar.php
is safed. Size 10KB. The main picture Size is still 406 KB, packed
as a Tar File it's 410 KB.

Thats the problem I need a solvation for.

I read something about theese headers on php.net. There was
an workaround for the circumstace that the download would not
start in IE but not in the other direction.

So please, if you know some more, please share it with me.

There are only two days left, to finish my project. So I'm really
in trouble. After this projekt I will step up and start learning Linux
and Apache configuration to the fullest.

So later I maybe will be an helpfull guy too.

Greetz

Sascha

PS.: Just for remembrance, the old working samplecode:

!-- download.php --
?
Header('Content-Type: application/x-tar');
Header(Content-disposition: filename=.$_REQUEST['name']..tar);
$dir = explode(/, $_REQUEST['image']);
chdir('../images/'.$dir['0']./.$dir['1']./.$dir['2']./);
$command = 'tar -cf - '.$_REQUEST['name'].'.jpg';
passthru($command);
// Insert the download into order_db for statistic use
include('global.inc.php');
$Query = INSERT INTO order_db (id, user_id, image_id, date, time) ;
$Query .= VALUES 
('','.$_REQUEST['customer_id'].','.$_REQUEST['image_id'].','.date('Y-m-d').','.date('H:i:s').');
mysql_query($Query, $connect);
? 



[PHP] Posting a value to one form to another

2002-09-28 Thread Uma Shankari T.


Hello ,

a href=Delay.php?hid=?php echo $hid+1; ?img src=Gif/nextque.gif 
border=0/a

While clicking this link the $hid value get incremented and fetch the value 
from the database according to that..the same thing is working in linux 
platform and it is not working for the windows platform..the value is not 
getting increment..Can anyone please tell me how to go about with this..??

Regards,
Uma


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




[PHP] Header content x-tar

2002-09-28 Thread Sascha Braun

Hi,

I think I could solve the problem on my own.

Thanks anyone for listening, thanks!

Sascha



RE: [PHP] Re: 4.0.2 = 4.2.3, form vars are empty?

2002-09-28 Thread Pekka Saarinen

At 9/27/2002, you wrote:
Erwin mailto:[EMAIL PROTECTED] scribbled;
 
  Qmail List wrote:
  Hello List,
 
  I'm putting a php app that has been off-line for about 18 months back
  on-line. During my absence from php I had heard about some security
  issues, so figured I'd try the latest 4.2.3 release.
 
  Sessions and the DB are fine, but GET/POST vars are continually
  empty. I mean a form submission from .html to .php (about the
  simplest thing possible) the variables are not getting populated with
  their form values.
 
  Turn register_globals = On in the php.ini file...
 
  HTH
  Erwin

Or better yet, actually use the new $_GET[] and $_POST[] and leave that
option off.

If you want to make the script compatible both with register globals=off 
and work with old AND new PHP versions, use $HTTP_POST_VARS  and 
$HTTP_GET_VARS. Manual says they are deprecated, but there is no reason to 
presume they are removed from PHP any time soon. And if that day comes it's 
a few minutes task to search and replace all sources to convert them to 
$_GET and $_POST.

For commonly used $PHP_SELF I use this:

if (isset($_SERVER)) $PHP_SELF = $_SERVER['PHP_SELF'];
$scriptname = basename($PHP_SELF);

This way users don't have to select from two source versions, one  PHP 
4.1.0 and one  4.1.0.




-
Pekka Saarinen
http://photography-on-the.net
-



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




[PHP] Multiple Domains in cookie?

2002-09-28 Thread Tony Harrison

Is it possible to specify more than 1 domain in a cookie?
-
[EMAIL PROTECTED]
http://www.cool-palace.com


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




Re: [PHP] Multiple Domains in cookie?

2002-09-28 Thread debbie_dyer

Is this because you have domain aliases?

Debbie

- Original Message - 
From: Tony Harrison [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, September 28, 2002 10:25 AM
Subject: [PHP] Multiple Domains in cookie?


 Is it possible to specify more than 1 domain in a cookie?
 -
 [EMAIL PROTECTED]
 http://www.cool-palace.com
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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




Re: [PHP] Posting a value to one form to another

2002-09-28 Thread debbie_dyer

Must be a register globals problem again - php.ini (register_globals) - on
for linux off for windows.

You should keep it switched off (or at least code for it being off) and use
the superglobal arrays $_POST, $_GET etc

Debbie

- Original Message -
From: Uma Shankari T. [EMAIL PROTECTED]
To: PHP [EMAIL PROTECTED]
Sent: Saturday, September 28, 2002 9:42 AM
Subject: [PHP] Posting a value to one form to another



 Hello ,

 a href=Delay.php?hid=?php echo $hid+1; ?img src=Gif/nextque.gif
 border=0/a

 While clicking this link the $hid value get incremented and fetch the
value
 from the database according to that..the same thing is working in linux
 platform and it is not working for the windows platform..the value is not
 getting increment..Can anyone please tell me how to go about with this..??

 Regards,
 Uma


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



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




[PHP] regexp help wanted

2002-09-28 Thread Thomas Seifert

Hi folks,

I just got nuts by trying to find a regexp for use with preg_replace to achive the 
following:

remove all br / which are in the text between a pre and a /pre Tag.

So, I want no br between these tags.

Any ideas or quick help?


thanks in advance,

Thomas

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




Re: [PHP] Multiple Domains in cookie?

2002-09-28 Thread Julien Bonastre

GREAT Q!

I have been trying to play with my cookies for a while now for this same
reason..

And to no avail..

It seems due to the structure of them and as long as the client (browser)
sticks to the specifications you can only access a cookie belonging to that
same host..

For example, I am starting up a large network site base but I wanted all
the sites even though they have their own unique domain to be able to have a
global member login system.. Catch is.. The only way for them to be able to
login to one site and then be able to freely go to another completely diff.
site also on our network they would still be logged in and hence they have
this main ONE account that allows them access  to all our network sites..

So I studied the workings behind Terra Lycos and found their trick quite
easily.. Since they have basically this same concept they too had to find a
solution..


And their's is very close to mine :) I had thought.. since it's HOST
specific. Not the full domain.. that means that cookies only differentiate
between: aaa.com and bbb.com..

But not: one.aaa.com or two.aaa.com

Therefore to create ONE cookie you set it's host for aaa.com and that way
all your other site domains can be redirectors to the subdomain..

Ie.. if you have aaa.com as your main site and bbb.com and ccc.com just make
those other two point to: bbb.aaa.com and ccc.aaa.com  respectively..

Don't think it's unpro because that's exactly what Terra Lycos does..

For eg.. Checkout www.webmonkey.com (I'm sure many of you already know it)
you soon see you'll be transported to: www.hotwired.lycos.com/webmonkey

This is because not only is webmonkey part of Terra lycos.. It's also under
HotWired..

Then I thought.. No way.. that can't be their trick surely??

Yep.. Checkout all their other sites..

More examples: www.angelfire.com goes to angelfire.lycos.com and tripod.com
goes to tripod.lycos.com

it seems this is the idea.. that way.. if they login.. just set some details
(perhaps the SESSID so you can easily jsut reload the session on the other
sites) on for example lycos.com as the domain and then all the subdomains
can also use this freely..

Use your domains as redirectors and you get a sweet system.. :)


HIH
--oOo---oOo--

 Julien Bonastre [The_RadiX]
 The-Spectrum Network CEO
 [EMAIL PROTECTED]
 www.the-spectrum.org

--oOo---oOo--
- Original Message -
From: Tony Harrison [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, September 28, 2002 7:25 PM
Subject: [PHP] Multiple Domains in cookie?


 Is it possible to specify more than 1 domain in a cookie?
 -
 [EMAIL PROTECTED]
 http://www.cool-palace.com


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




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




[PHP] Update identical table

2002-09-28 Thread Radu Manole

Hi guys,

I have 2 identical tables called tmp_data and data. (on the same mysql database).
What would be the simple and more convenient way to update table data with a row 
from table tmp_data.
(something like select * from tmp_data and than update data ...).

Thanks a lot,
Radu



Re: [PHP] where's waldo

2002-09-28 Thread Kenneth Love

no no, i understand.
really, what i was getting at, i guess was that this isn't really meant to
be developed for mass distribution. more for a class.


@ Edwin [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Well, I didn't really mean to imply anything about people's honesty and so
 forth...

 I just wanted to say that validating (anything) on the client side is not
 normally a good (and reliable) idea. Of course, as always mentioned,
 validation on the server side is always better.

 - E


 Kenneth Love [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]...
  about the peeking at the code...
  yes, you could, unless the images were coded somehow. perhaps just
 numbers,
  not names. after a few tries they'd find waldo easily enough, but not
at
  first.
 
  and besides. i'd like to give people credit for being more honest than
 that.
 
 
  @ Edwin [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   True. Perhaps.
  
   But, I think, you can actually do something like that WITH php. Say
   PHP+Flash or PHP+Javascript...
  
   Of course, if you're able to do something like this just by using
   PHP+Javascript (and HTML only), most probably, you can just take a
peek
 at
   the code and find out where waldo is... ;)
  
   - E
  
   On Thursday, September 26, 2002 12:12 AM
   Marek Kilimajer wrote:
  
This is for java, javascript, or flash, not much to do for php.
   
Kenneth Love wrote:
   
hi all.

i'm interested in creating a php game that generates a page of
random
   (ish)
images, one of which is waldo (or the like). when the player clicks
 on
waldo, they're taken to the next, slightly harder level.

anyone think that sounds fun?
any pointers, tips, advice, criticisms?

--
-- http://kennethlove.onewingedangel.com --


 
 




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




[PHP] PHP and MSSQL Problem

2002-09-28 Thread Christopher J. Crane

I wrote a simple script to return data from a query. The database is MS SQL
and the field I am looking to return is a VARCHAR(5000). Everything seems to
work except the data returned is not the whole field it is shortened. It
only returns a portion of the field.

Here is the field:
99 Services, Inc. is a full service IT systems integrator and general
contractor specializing in cradle to grave technology planning with strong
emphasis on LAN/WAN design (routing and switching) and deployment of high
speed, fully redundant, high availability networks. 99 Services also
provides Internet/Intranet/Website/email systems design.  The company
services small to medium sized businesses as well as home offices.

Here is what is returned by the PHP:
99 Services, Inc. is a full service IT systems integrator and general
contractor specializing in cradle to grave technology planning with strong
emphasis on LAN/WAN design (routing and switching) and deployment of high
speed, fully redundant, high availab


Here is the script:
?PHP
/* CTC Profile about Company */
/* = */
$HostName = DAS54-DAL-SBC;
$UserName = ***; //changed for security
$Password = ; //changed for security
$DBName = DirectoryDB;

MSSQL_CONNECT($HostName,$UserName,$Password);
mssql_select_db($DBName) or DIE(Table unavailable);

$ProfileResults = MSSQL_QUERY(SELECT * FROM CompanyProfile WHERE
CompanyID = '$ID');
$RowCount = MSSQL_NUM_ROWS($ProfileResults);

if($RowCount != 0) {
  for ($i = 0; $Field2 = MSSQL_FETCH_ARRAY($ProfileResults); ++$i) {
  $Profile = $Field2[Profile];
echo $Field2[CompanyID] . br . $Field2[Profile] .
brbrTo read more information about this ;
echo company, visit their website\n;
 }
   }
 else { print This company, $sym is not listed in the CTC Directory.; }

MSSQL_CLOSE();
?



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




[PHP] Re: Carriage returns don't display in HTML

2002-09-28 Thread Christopher J. Crane

On thing you could do is output pretags around the text you want to
display. The pre tags keeps simple formatting like tabs and new line
characters.
Shane [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Greetings folks.

I need my carriage returns to show up in my HTML output from my text form
field.

There is a JavaScript function that will convert carriage return to BR
tags, but is there a PHP function that will add BR or P tags to a text
form field in place of the carriage returns a user might add.

Thanks in advance!
-NorthBayShane



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




[PHP] Re: PHP and MSSQL Problem

2002-09-28 Thread @ Edwin
Hello,

...just wondering...

Are you sure VARCHAR in MS SQL can handle 5000? Should be 255 only? (I'm not
really familiar with MS SQL but you can count the number of characters
returned by php...)

- E


"Christopher J. Crane" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I wrote a simple script to return data from a query. The database is MS
SQL
 and the field I am looking to return is a VARCHAR(5000). Everything seems
to
 work except the data returned is not the whole field it is shortened. It
 only returns a portion of the field.

 Here is the field:
 99 Services, Inc. is a full service IT systems integrator and general
 contractor specializing in cradle to grave technology planning with strong
 emphasis on LAN/WAN design (routing and switching) and deployment of high
 speed, fully redundant, high availability networks. 99 Services also
 provides Internet/Intranet/Website/email systems design.  The company
 services small to medium sized businesses as well as home offices.

 Here is what is returned by the PHP:
 99 Services, Inc. is a full service IT systems integrator and general
 contractor specializing in cradle to grave technology planning with strong
 emphasis on LAN/WAN design (routing and switching) and deployment of high
 speed, fully redundant, high availab


 Here is the script:
 ?PHP
 /* CTC Profile about Company */
 /* = */
 $HostName = "DAS54-DAL-SBC";
 $UserName = "***"; //changed for security
 $Password = ""; //changed for security
 $DBName = "DirectoryDB";

 MSSQL_CONNECT($HostName,$UserName,$Password);
 mssql_select_db($DBName) or DIE("Table unavailable");

 $ProfileResults = MSSQL_QUERY("SELECT * FROM CompanyProfile WHERE
 CompanyID = '$ID'");
 $RowCount = MSSQL_NUM_ROWS($ProfileResults);

 if($RowCount != 0) {
   for ($i = 0; $Field2 = MSSQL_FETCH_ARRAY($ProfileResults); ++$i) {
   $Profile = $Field2["Profile"];
 echo $Field2["CompanyID"] . "br" . $Field2["Profile"] .
 "brbrTo read more information about this ";
 echo "company, visit their website\n";
  }
}
  else { print "This company, $sym is not listed in the CTC Directory."; }

 MSSQL_CLOSE();
 ?




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


Re: [PHP] where's waldo

2002-09-28 Thread @ Edwin
I see.

Now, that sounds a lot of fun! :)

Anyway, enjoy!

- E

"Kenneth Love" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 no no, i understand.
 really, what i was getting at, i guess was that this isn't really meant to
 be developed for mass distribution. more for a class.


 "@ Edwin" [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Well, I didn't really mean to imply anything about people's honesty and
so
  forth...
 
  I just wanted to say that validating (anything) on the client side is
not
  normally a good (and reliable) idea. Of course, as always mentioned,
  validation on the server side is always better.
 
  - E
 
 
  "Kenneth Love" [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]...
   about the peeking at the code...
   yes, you could, unless the images were coded somehow. perhaps just
  numbers,
   not names. after a few tries they'd find "waldo" easily enough, but
not
 at
   first.
  
   and besides. i'd like to give people credit for being more honest than
  that.
  
  
   "@ Edwin" [EMAIL PROTECTED] wrote in message
   [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
True. Perhaps.
   
But, I think, you can actually do something like that WITH php. Say
PHP+Flash or PHP+Javascript...
   
Of course, if you're able to do something like this just by using
PHP+Javascript (and HTML only), most probably, you can just take a
 peek
  at
the code and find out where "waldo" is... ;)
   
- E
   
On Thursday, September 26, 2002 12:12 AM
Marek Kilimajer wrote:
   
 This is for java, javascript, or flash, not much to do for php.

 Kenneth Love wrote:

 hi all.
 
 i'm interested in creating a php game that generates a page of
 random
(ish)
 images, one of which is waldo (or the like). when the player
clicks
  on
 waldo, they're taken to the next, slightly harder level.
 
 anyone think that sounds fun?
 any pointers, tips, advice, criticisms?
 
 --
 -- http://kennethlove.onewingedangel.com --
 
 
  
  
 




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


[PHP] AS A MATTER OF INTEREST

2002-09-28 Thread Georgie Casey

Can you fake IP addresses and referer addresses with the PHP header command.
I want to contact a remote php script and not have my page as the referer or
ip address. Is this possible with sockets or even just fopen()?

--
Regards,
Georgie Casey
[EMAIL PROTECTED]

***
http://www.filmfind.tv
Online Film Production Directory
***



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




Re: [PHP] Multiple Domains in cookie?

2002-09-28 Thread @ Saif @

Please how can I unsubscribe .



Regards
Saif Yousif


 No God
except AllahMohammed is profit of Allah

- Original Message -
From: Julien Bonastre [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]; Tony Harrison
[EMAIL PROTECTED]
Sent: Saturday, September 28, 2002 3:21 PM
Subject: Re: [PHP] Multiple Domains in cookie?


 GREAT Q!

 I have been trying to play with my cookies for a while now for this same
 reason..

 And to no avail..

 It seems due to the structure of them and as long as the client (browser)
 sticks to the specifications you can only access a cookie belonging to
that
 same host..

 For example, I am starting up a large network site base but I wanted all
 the sites even though they have their own unique domain to be able to have
a
 global member login system.. Catch is.. The only way for them to be able
to
 login to one site and then be able to freely go to another completely
diff.
 site also on our network they would still be logged in and hence they have
 this main ONE account that allows them access  to all our network sites..

 So I studied the workings behind Terra Lycos and found their trick quite
 easily.. Since they have basically this same concept they too had to find
a
 solution..


 And their's is very close to mine :) I had thought.. since it's HOST
 specific. Not the full domain.. that means that cookies only differentiate
 between: aaa.com and bbb.com..

 But not: one.aaa.com or two.aaa.com

 Therefore to create ONE cookie you set it's host for aaa.com and that way
 all your other site domains can be redirectors to the subdomain..

 Ie.. if you have aaa.com as your main site and bbb.com and ccc.com just
make
 those other two point to: bbb.aaa.com and ccc.aaa.com  respectively..

 Don't think it's unpro because that's exactly what Terra Lycos does..

 For eg.. Checkout www.webmonkey.com (I'm sure many of you already know it)
 you soon see you'll be transported to: www.hotwired.lycos.com/webmonkey

 This is because not only is webmonkey part of Terra lycos.. It's also
under
 HotWired..

 Then I thought.. No way.. that can't be their trick surely??

 Yep.. Checkout all their other sites..

 More examples: www.angelfire.com goes to angelfire.lycos.com and
tripod.com
 goes to tripod.lycos.com

 it seems this is the idea.. that way.. if they login.. just set some
details
 (perhaps the SESSID so you can easily jsut reload the session on the other
 sites) on for example lycos.com as the domain and then all the subdomains
 can also use this freely..

 Use your domains as redirectors and you get a sweet system.. :)


 HIH
 --oOo---oOo--

  Julien Bonastre [The_RadiX]
  The-Spectrum Network CEO
  [EMAIL PROTECTED]
  www.the-spectrum.org

 --oOo---oOo--
 - Original Message -
 From: Tony Harrison [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, September 28, 2002 7:25 PM
 Subject: [PHP] Multiple Domains in cookie?


  Is it possible to specify more than 1 domain in a cookie?
  -
  [EMAIL PROTECTED]
  http://www.cool-palace.com
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 


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




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




Re: [PHP] Multiple Domains in cookie?

2002-09-28 Thread @ Edwin

You mean from this list? Please take a loot at the end of this e-mail...

- E

On Thursday, July 27, 2000 11:36 AM
 Saif  wrote:

 Please how can I unsubscribe .
 

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




Re: [PHP] Update identical table

2002-09-28 Thread Marek Kilimajer

INSERT INTO data SELECT * FROM tmp_data WHERE condition_definition

Radu Manole wrote:

Hi guys,

I have 2 identical tables called tmp_data and data. (on the same mysql database).
What would be the simple and more convenient way to update table data with a row 
from table tmp_data.
(something like select * from tmp_data and than update data ...).

Thanks a lot,
Radu

  



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




[PHP] export data to text file

2002-09-28 Thread Diana Castillo

Hi, I want to export some fields on a regular basis from a table to a text
file, preferable to the users local computer. I tried writing to a file with
fopen but I get permission denied when I try to open it for writing.
What is the best solution?
Thanks,
Diana

--
See my web page:
http://www.netrox.net/%7Ecastillo/



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




[PHP] Re: PHP and MSSQL Problem

2002-09-28 Thread Christopher J. Crane

Thanks for some help. I will look into that. This is not my database so I am
not sure how or why it was setup this way. There is more than 255 characters
in each of these fields.
@ Edwin [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hello,

 ...just wondering...

 Are you sure VARCHAR in MS SQL can handle 5000? Should be 255 only? (I'm
not
 really familiar with MS SQL but you can count the number of characters
 returned by php...)

 - E


 Christopher J. Crane [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  I wrote a simple script to return data from a query. The database is MS
 SQL
  and the field I am looking to return is a VARCHAR(5000). Everything
seems
 to
  work except the data returned is not the whole field it is shortened. It
  only returns a portion of the field.
 
  Here is the field:
  99 Services, Inc. is a full service IT systems integrator and general
  contractor specializing in cradle to grave technology planning with
strong
  emphasis on LAN/WAN design (routing and switching) and deployment of
high
  speed, fully redundant, high availability networks. 99 Services also
  provides Internet/Intranet/Website/email systems design.  The company
  services small to medium sized businesses as well as home offices.
 
  Here is what is returned by the PHP:
  99 Services, Inc. is a full service IT systems integrator and general
  contractor specializing in cradle to grave technology planning with
strong
  emphasis on LAN/WAN design (routing and switching) and deployment of
high
  speed, fully redundant, high availab
 
 
  Here is the script:
  ?PHP
  /* CTC Profile about Company */
  /* = */
  $HostName = DAS54-DAL-SBC;
  $UserName = ***; //changed for security
  $Password = ; //changed for security
  $DBName = DirectoryDB;
 
  MSSQL_CONNECT($HostName,$UserName,$Password);
  mssql_select_db($DBName) or DIE(Table unavailable);
 
  $ProfileResults = MSSQL_QUERY(SELECT * FROM CompanyProfile WHERE
  CompanyID = '$ID');
  $RowCount = MSSQL_NUM_ROWS($ProfileResults);
 
  if($RowCount != 0) {
for ($i = 0; $Field2 = MSSQL_FETCH_ARRAY($ProfileResults); ++$i) {
$Profile = $Field2[Profile];
  echo $Field2[CompanyID] . br . $Field2[Profile] .
  brbrTo read more information about this ;
  echo company, visit their website\n;
   }
 }
   else { print This company, $sym is not listed in the CTC
Directory.; }
 
  MSSQL_CLOSE();
  ?
 
 




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




[PHP] headers?

2002-09-28 Thread cleaner

Hi all..

Got this script to verify a login against a mysql-databas with several
checking for type errors etc.

When I wanna login people, I include a file with all my functions
('functions.php') and I a function verify is called upon.

the function returns false if user entered wrong user/pass, And if they
enter correct info I want them to be redirected to another page.. hm. the
headers cant be added (u heard that before?) cuz my login form already
started output...

function verify($user,$pass){
// some sql queries here...

 if(count($number)0){
return false;
}else{
   header(Location:admin.php);
   }

}

I would like som help using headers in a correct way, or be able to use
another way...


reg:cleaner



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




Re: [PHP] headers?

2002-09-28 Thread debbie_dyer

It's giving you this error because you are sending the headers after
outputting something (which could be just  a blank line) - check in your
functions.php that you dont have any blank lines before the start of or
after the end of your script. ie. before the ?php or after the ?

Debbie
- Original Message -
From: cleaner [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, September 28, 2002 3:23 PM
Subject: [PHP] headers?


 Hi all..

 Got this script to verify a login against a mysql-databas with several
 checking for type errors etc.

 When I wanna login people, I include a file with all my functions
 ('functions.php') and I a function verify is called upon.

 the function returns false if user entered wrong user/pass, And if they
 enter correct info I want them to be redirected to another page.. hm. the
 headers cant be added (u heard that before?) cuz my login form already
 started output...

 function verify($user,$pass){
 // some sql queries here...

  if(count($number)0){
 return false;
 }else{
header(Location:admin.php);
}

 }

 I would like som help using headers in a correct way, or be able to use
 another way...


 reg:cleaner



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



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




Re: [PHP] headers?

2002-09-28 Thread cleaner

I´ll do that...I hope thats the problemthanks a LOT!

Debbie_dyer [EMAIL PROTECTED] skrev i meddelandet
00d601c266fe$2f4d32f0$0100a8c0@homepc">news:00d601c266fe$2f4d32f0$0100a8c0@homepc...
 It's giving you this error because you are sending the headers after
 outputting something (which could be just  a blank line) - check in your
 functions.php that you dont have any blank lines before the start of or
 after the end of your script. ie. before the ?php or after the ?

 Debbie
 - Original Message -
 From: cleaner [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, September 28, 2002 3:23 PM
 Subject: [PHP] headers?


  Hi all..
 
  Got this script to verify a login against a mysql-databas with several
  checking for type errors etc.
 
  When I wanna login people, I include a file with all my functions
  ('functions.php') and I a function verify is called upon.
 
  the function returns false if user entered wrong user/pass, And if they
  enter correct info I want them to be redirected to another page.. hm.
the
  headers cant be added (u heard that before?) cuz my login form already
  started output...
 
  function verify($user,$pass){
  // some sql queries here...
 
   if(count($number)0){
  return false;
  }else{
 header(Location:admin.php);
 }
 
  }
 
  I would like som help using headers in a correct way, or be able to use
  another way...
 
 
  reg:cleaner
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 




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




[PHP] unexpected T_STRING error

2002-09-28 Thread Gary

Hi All,
Can someone explain to me why I am getting an error for the following?

$keywords = $_POST[keywords];
if ($keywords) {
echolt;META NAME=keywords CONTENT= $keywords gt;;
}

TIA
Gary


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




RE: [PHP] unexpected T_STRING error

2002-09-28 Thread Jonathan Rosenberg

That line is syntactically invalid.  Did you meant it to say

echo lt;META NAME=$keywords CONTENT= $keywords gt;;

--
JR

 -Original Message-
 From: Gary [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, September 28, 2002 11:15 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] unexpected T_STRING error
 
 
 Hi All,
 Can someone explain to me why I am getting an error for the following?
 
 $keywords = $_POST[keywords];
 if ($keywords) {
 echolt;META NAME=keywords CONTENT= $keywords gt;;
 }
 
 TIA
 Gary
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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




Re: [PHP] unexpected T_STRING error

2002-09-28 Thread Matt

The quotes within the quotes.
Change to:
echolt;META NAME=\keywords\ CONTENT=\ $keywords \gt;;

 From: Gary [EMAIL PROTECTED]
 Sent: Saturday, September 28, 2002 11:15 AM
 Subject: [PHP] unexpected T_STRING error


 Hi All,
 Can someone explain to me why I am getting an error for the following?

 $keywords = $_POST[keywords];
 if ($keywords) {
 echolt;META NAME=keywords CONTENT= $keywords gt;;
 }


The quotes within the quotes -- you need to escape them.   Otherwise, the
second double quote terminates the quoted string, yet there's some more junk
on the line.  By escaping them, you tellphp you mean the literal , and
don't want to terminate the string .
So change to:
echolt;META NAME=\keywords\ CONTENT=\ $keywords \gt;;



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




Re: [PHP] Multiple Domains in cookie?

2002-09-28 Thread Chris Shiflett

Nope, but you can have more than one host per domain (foo.php.net, 
bar.php.net, etc.).

Tony Harrison wrote:

Is it possible to specify more than 1 domain in a cookie?



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




RE: [PHP] Multiple Domains in cookie?

2002-09-28 Thread Gareth Hastings

or you just have something like

login.myhost.com

and all your sites use that to authenticate the user. In your php login
script you can just see which site they came back from and then on a
successful login you just redirect them back to that one. You wouldn't
need to use cookies. You could make your own session ID. I thik owning
say subdomain.mydomain.com and having it point to
www.asite.com/mydomain/subdomain doesn't look as good. The PHP needed to
do something like this would be fairly simple too.

-Original Message-
From: Julien Bonastre [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, September 28, 2002 8:22 AM
To: [EMAIL PROTECTED]; Tony Harrison
Subject: Re: [PHP] Multiple Domains in cookie?

GREAT Q!

I have been trying to play with my cookies for a while now for this same
reason..

And to no avail..

It seems due to the structure of them and as long as the client
(browser)
sticks to the specifications you can only access a cookie belonging to
that
same host..

For example, I am starting up a large network site base but I wanted
all
the sites even though they have their own unique domain to be able to
have a
global member login system.. Catch is.. The only way for them to be able
to
login to one site and then be able to freely go to another completely
diff.
site also on our network they would still be logged in and hence they
have
this main ONE account that allows them access  to all our network
sites..

So I studied the workings behind Terra Lycos and found their trick quite
easily.. Since they have basically this same concept they too had to
find a
solution..


And their's is very close to mine :) I had thought.. since it's HOST
specific. Not the full domain.. that means that cookies only
differentiate
between: aaa.com and bbb.com..

But not: one.aaa.com or two.aaa.com

Therefore to create ONE cookie you set it's host for aaa.com and that
way
all your other site domains can be redirectors to the subdomain..

Ie.. if you have aaa.com as your main site and bbb.com and ccc.com just
make
those other two point to: bbb.aaa.com and ccc.aaa.com  respectively..

Don't think it's unpro because that's exactly what Terra Lycos does..

For eg.. Checkout www.webmonkey.com (I'm sure many of you already know
it)
you soon see you'll be transported to: www.hotwired.lycos.com/webmonkey

This is because not only is webmonkey part of Terra lycos.. It's also
under
HotWired..

Then I thought.. No way.. that can't be their trick surely??

Yep.. Checkout all their other sites..

More examples: www.angelfire.com goes to angelfire.lycos.com and
tripod.com
goes to tripod.lycos.com

it seems this is the idea.. that way.. if they login.. just set some
details
(perhaps the SESSID so you can easily jsut reload the session on the
other
sites) on for example lycos.com as the domain and then all the
subdomains
can also use this freely..

Use your domains as redirectors and you get a sweet system.. :)


HIH
--oOo---oOo--

 Julien Bonastre [The_RadiX]
 The-Spectrum Network CEO
 [EMAIL PROTECTED]
 www.the-spectrum.org

--oOo---oOo--
- Original Message -
From: Tony Harrison [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, September 28, 2002 7:25 PM
Subject: [PHP] Multiple Domains in cookie?


 Is it possible to specify more than 1 domain in a cookie?
 -
 [EMAIL PROTECTED]
 http://www.cool-palace.com


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




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


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




php-general Digest 28 Sep 2002 15:34:19 -0000 Issue 1612

2002-09-28 Thread php-general-digest-help


php-general Digest 28 Sep 2002 15:34:19 - Issue 1612

Topics (messages 117916 through 117955):

.htaccess to change browscap setting
117916 by: SpamSucks86

Re: Assigning data to fields
117917 by: Ken

field size for common data
117918 by: Pablo Oliva
117920 by: Justin French

counting words in a string
117919 by: rdkurth.starband.net
117921 by: Justin French
117923 by: rdkurth.starband.net

Re: 4.0.2 = 4.2.3, form vars are empty?
117922 by: Justin French
117929 by: Pekka Saarinen

Solaris8/intel PHP binaries .. PLEASE !!
117924 by: PHPio
117925 by: PHPio

Header Content x-tar
117926 by: Sascha Braun
117928 by: Sascha Braun

Posting a value to one form to another
117927 by: Uma Shankari T.
117932 by: debbie_dyer

Multiple Domains in cookie?
117930 by: Tony Harrison
117931 by: debbie_dyer
117934 by: Julien Bonastre
117942 by: . Saif .
117943 by: . Edwin
117953 by: Chris Shiflett
117954 by: Gareth Hastings
117955 by: Gareth Hastings

regexp help wanted
117933 by: Thomas Seifert

Update identical table
117935 by: Radu Manole
117944 by: Marek Kilimajer

Re: where's waldo
117936 by: Kenneth Love
117940 by: . Edwin

PHP and MSSQL Problem
117937 by: Christopher J. Crane
117939 by: . Edwin
117946 by: Christopher J. Crane

Re: Carriage returns don't display in HTML
117938 by: Christopher J. Crane

AS A MATTER OF INTEREST
117941 by: Georgie Casey

export data to text file
117945 by: Diana Castillo

headers?
117947 by: cleaner
117948 by: debbie_dyer
117949 by: cleaner

unexpected T_STRING  error
117950 by: Gary
117951 by: Jonathan Rosenberg
117952 by: Matt

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]


--

---BeginMessage---

AllowOverride is set to All in apache, and when I put this in a
.htaccess file, it changes the value:

 

IfModule mod_php4.c

php_value upload_max_filesize 750

/IfModule

 

however, when I put php_value browscap /home/user/php/browscap.ini in
there, it doesn't change the setting.

 

Is browscap not changeable from .htaccess, or am I doing something
wrong? Thanks for the help!

 

 


---End Message---
---BeginMessage---

Thanks John! That was it!

John W. Holmes [EMAIL PROTECTED] wrote in message
01c26698$1abbc290$7c02a8c0@coconut">news:01c26698$1abbc290$7c02a8c0@coconut...
  I used the examples you have lead me to and I get this error? I am
  stumped?
 
  mysql_fetch_array(): supplied argument is not a valid MySQL result
  resource
  in /home/pay.php on line 51

 You're query probably failed. Look at mysql_error().

 www.php.net/mysql_error

 ---John Holmes...





---End Message---
---BeginMessage---

What amount of chars is reasonable and should I allow for each of the
following fields in a database:
 
company name: 30 chars
address/street: 30 chars
city: 30 chars
 
  Thanks.

---End Message---
---BeginMessage---

I'm no expert on MySQL field types, but I'd be going for a varchar field of
50-ish (maybe more???)... the reason is that (from what I understand)
varchar fields only take up as much room as the content, plus one or two
bytes, so making them 50 vs 30 will offer no advantage, but may become a
disadvantage down the track.

It'd be worth checking the MySQL manual though.

Justin


on 28/09/02 3:24 PM, Pablo Oliva ([EMAIL PROTECTED]) wrote:

 What amount of chars is reasonable and should I allow for each of the
 following fields in a database:
 
 company name: 30 chars
 address/street: 30 chars
 city: 30 chars
 
   Thanks.
 


---End Message---
---BeginMessage---


I need to count how many times the word AVAILABLE appears in a string
like this
$string =AVAILABLE More Info AVAILABLE More Info;
 some time the string looks like this
$string =UNAVAILABLE More Info AVAILABLE More Info;
 or
$string =AVAILABLE More Info UNAVAILABLE More Info;
when I use
$srch=AVAILABLE;
$count=substr_count(strtolower($string), strtolower($srch));
echo $count;
it puts the count a 2 even when one of the words is UNAVAILABLE
how can I make it only count AVAILABLE and not UNAVAILABLE or visa
verse
-- 
Best regards,
 rdkurth  mailto:[EMAIL PROTECTED]


---End Message---
---BeginMessage---

if this is your SPECIFIC problem, putting a space at the beginning of $srch
will help, eliminating XAVAILABLE... but this will cause a problem with the
word AVAILABLE appearing at the start of the string, so temporarily put a
space at the start of the string:

?
// UNTESTED
$count = substr_count(' '.strtolower($string), strtolower(' 

RE: [PHP] Multiple Domains in cookie?

2002-09-28 Thread Gareth Hastings

Oops, sorry, forgot to turn off read receipt before I posted.


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




Re: [PHP] unexpected T_STRING error

2002-09-28 Thread Chris Shiflett

Everyone seems to forget that you don't have to do everything in PHP.

if ($_POST[keywords])
{
?meta name=keywords content=? echo $_POST[keywords]; ??
}

Happy hacking.

Chris

Gary wrote:

 Can someone explain to me why I am getting an error for the following?

 $keywords = $_POST[keywords];
 if ($keywords) {
echolt;META NAME=keywords CONTENT= $keywords gt;;
 }



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




Re: [PHP] unexpected T_STRING error

2002-09-28 Thread Gary

I knew I shouldn't of been doing this on Saturday morning. I forgot 
something as simple as that. Maybe another jolt of caffeine is needed.

Thanks
Gary

Matt wrote:
 The quotes within the quotes.
 Change to:
 echolt;META NAME=\keywords\ CONTENT=\ $keywords \gt;;
 
 
From: Gary [EMAIL PROTECTED]
Sent: Saturday, September 28, 2002 11:15 AM
Subject: [PHP] unexpected T_STRING error
 
 
 
Hi All,
Can someone explain to me why I am getting an error for the following?

$keywords = $_POST[keywords];
if ($keywords) {
echolt;META NAME=keywords CONTENT= $keywords gt;;
}
 
 
 
 The quotes within the quotes -- you need to escape them.   Otherwise, the
 second double quote terminates the quoted string, yet there's some more junk
 on the line.  By escaping them, you tellphp you mean the literal , and
 don't want to terminate the string .
 So change to:
 echolt;META NAME=\keywords\ CONTENT=\ $keywords \gt;;
 
 



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




RE: [PHP] export data to text file

2002-09-28 Thread Todd Pasley

Hi

If what you mean is... you want to be able to write to a file on the
browsers computer, then please let us know if you find a way.

To my knowledge, there is not any intended way to do this... you wouldn't
want any old website to be able to manipulate your hard drive would you?

It might be possible if you write an applet, otherwise, pretty much the only
thing you should be able to write to the hard drive is a cookie.

HTH

Todd.

 -Original Message-
 From: Diana Castillo [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, 29 September 2002 12:03 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] export data to text file

 8---


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




[PHP] Challenging problem for you programing gurus...

2002-09-28 Thread Ryan A

Hi guys,
I have come accross a small problem while trying to convert a java program to a PHP 
one
my database table is like so

*
cno (int)
name (varchar)
lastname(varchar)
etc etc
*

as you can see the details I take is name/lastname and customer number (cno) is 
automatically generated, now instead of using a auto increment a int was declared 
and this code was used

**
synchronized(this) 
{ 
rs=stmt.executeQuery(select max(cno)+1 from cust);
}
**

(for those of you who dont understand java)
the synchronized keyword makes sure only one thread can work in the block of code 
between the { and } then it executes the query select max(cno)+1 from cust and 
stores the result in an array (like PHP) in rs.

Basically, it just gets the next higher cno from the table cust.

Then it enters the cno like this rs=cno,then name,lastname etc and then tells the 
customer that the data has been entered and his new customer number is rs.


As you can see its a pain in the ass job which has to be changed,
the problem is a few hundred records have already been entered,
how do i use the current table BUT use the more useful auto increment and 
LAST_INSERT_ID() via PHP?
The java servlet program which is handleing the requests is working fine, but I am 
want to convert it to a PHP program as paying for servlet hosting is upto 5-8 times 
more...and I aint rich, or even close to being rich :-(


Please reply,
ANY help appreciated and thanks in advance.
Cheers,
-Ryan.



Re: [PHP] Challenging problem for you programing gurus...

2002-09-28 Thread Chris Shiflett

I didn't catch which database you are using, but you can alter a field 
in MySQL to add the auto_increment characteristic. Look into the alter 
table SQL statement.

Happy hacking.

Chris

Ryan A wrote:

how do i use the current table BUT use the more useful auto increment and 
LAST_INSERT_ID() via PHP?



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




Re: [PHP] Challenging problem for you programing gurus...

2002-09-28 Thread Matt

snip
Chris Shiflett wrote:
 I didn't catch which database you are using, but you can alter a field
 in MySQL to add the auto_increment characteristic. Look into the alter
 table SQL statement.
/snip

And if you do that, there won't be any trouble with the existing IDs.  mysql
will grab the next higher number automatically.  But test this on your own
installation first, just to be sure ...



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




[PHP] Chris,Matt-Re: [PHP] Challenging problem for you programing gurus

2002-09-28 Thread Ryan A

Thanks guys,
I thought it would be much more complicated than that but will look into the
alter table thing.
Sorry forgot to mention in the first mail, I am using MySql as its the
cheapest database to get from a hosting company,otherwise on my personal
machine I use MySql and/or Oracle 7.3 (pirated version, I may not be rich
but where theres a will theres a way :-) )
The reason I didnt alter it in the first place was that I was not sure if it
would effect my current IDs, but since you guys say it wont i'll take
your word for it.

Cheers and thanks,
-Ryan.

 snip
 Chris Shiflett wrote:
  I didn't catch which database you are using, but you can alter a field
  in MySQL to add the auto_increment characteristic. Look into the alter
  table SQL statement.
 /snip

 And if you do that, there won't be any trouble with the existing IDs.
mysql
 will grab the next higher number automatically.  But test this on your own
 installation first, just to be sure ...



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



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




Re: [PHP] export data to text file

2002-09-28 Thread Diana Castillo

okay, how can I write a file in csv format either to the browser or to the
server? If I use the Mysqladmin page I get all the fields, I just want some
of them.
Diana

--
See my web page:
http://www.netrox.net/%7Ecastillo/
Todd Pasley [EMAIL PROTECTED] escribió en el mensaje
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi

 If what you mean is... you want to be able to write to a file on the
 browsers computer, then please let us know if you find a way.

 To my knowledge, there is not any intended way to do this... you wouldn't
 want any old website to be able to manipulate your hard drive would you?

 It might be possible if you write an applet, otherwise, pretty much the
only
 thing you should be able to write to the hard drive is a cookie.

 HTH

 Todd.

  -Original Message-
  From: Diana Castillo [mailto:[EMAIL PROTECTED]]
  Sent: Sunday, 29 September 2002 12:03 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] export data to text file
 
  8---




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




Re: Re[2]: [PHP] counting words in a string

2002-09-28 Thread Justin French

You need to look at a few options... one is regular expression (not my
forte), or perhaps winding through the string one character at a time,
writing a very simple state engine.

Justin French


on 28/09/02 4:47 PM, [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote:

 Hello Justin,
 
 That worked perfect but I have one more problem I need to know if one
 of the word is UNAVAILABLE I need to know if it is the first one or
 the second one. I don't know if there is any way to do this.
 1st 2nd
 $string =UNAVAILABLE AVAILABLE More Info;
 1st   2nd
 $string =AVAILABLE More Info UNAVAILABLE ;
 
 Friday, September 27, 2002, 11:22:42 PM, you wrote:
 
 
 JF if this is your SPECIFIC problem, putting a space at the beginning of
 $srch
 JF will help, eliminating XAVAILABLE... but this will cause a problem with
 the
 JF word AVAILABLE appearing at the start of the string, so temporarily put a
 JF space at the start of the string:
 
 JF ?
 JF // UNTESTED
 JF $count = substr_count(' '.strtolower($string), strtolower(' '.$srch));
 JF echo $count;
 ?
 
 JF this won't help if there are newlines and other white space instead of
 JF spaces, and won't help (so far) for a different set of circumstances...
 
 JF it would be nice to extend substr_count() could be extended to have an
 JF option.
 
 JF Justin
 
 
 
 JF on 28/09/02 3:41 PM, [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote:
 
 
 I need to count how many times the word AVAILABLE appears in a string
 like this
 $string =AVAILABLE More Info AVAILABLE More Info;
 some time the string looks like this
 $string =UNAVAILABLE More Info AVAILABLE More Info;
 or
 $string =AVAILABLE More Info UNAVAILABLE More Info;
 when I use
 $srch=AVAILABLE;
 $count=substr_count(strtolower($string), strtolower($srch));
 echo $count;
 it puts the count a 2 even when one of the words is UNAVAILABLE
 how can I make it only count AVAILABLE and not UNAVAILABLE or visa
 verse
 
 
 
 


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




[PHP] Htmlentities and Newlines?

2002-09-28 Thread Andre Dubuc

Perhaps I don't understand the use of 'htmlentities' too well, but I would 
like newlines to be retained/inserted into a db, and then if displayed, to 
produce a new line from a textarea. However, I want the possibility of 
dangerous html excluded (hence the use of 'htmlentities').

Is there some way of excluding '\n \r ' and other newline indicators from 
'htmlentities()'? Perhaps a combination of preg_match and something else? I'm 
a bit brained-fried struggling with other errant parts of this code since 6 
am.

Any ideas how I could proceed?



The code far:


?php
. . .
/* Verification script. Adds sponsor's name, city, prov, country and current 
date at end of 'request' string */
. . .

$request = $_POST['request'];
$request = ucfirst($request);
$html = htmlentities($request);
^^^
/* $html defuses all newlines . . . sigh */ 


$title = $_POST['title'];
$title = ucfirst($title);
$title = htmlentities($title);


$date = date('Y-m-d');
$preview = 
{$_SESSION['title']}brbrbr$htmlbrbrbr{$_SESSION['sfname']} 
{$_SESSION['ssname']}br{$_SESSION['scity']}, {$_SESSION['rprov']}  
{$_SESSION['scountry']}br$date;;


print h2Preview of Request from 
{$_SESSION['sfname']}{$_SESSION['ssname']}/h2brbr;
. . .
?

Any ideas or advice will be most gratefully accepted.
Tia,
Andre

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




RE: [PHP] what do you think?

2002-09-28 Thread Tony Earnshaw

fre, 2002-09-27 kl. 14:26 skrev Ford, Mike [LSS]:

 I think the page needs a drastic proof-read and grammar check -- I have trouble 
understanding what some of it is even trying to say.  And I haven't a clue what 
ASSAY TO INTEGRATE MANAGEMENT is supposed to mean!

 It looks like a nice product, but I wouldn't even evaluate it after looking at this 
because I'd be worried about having to spend too much time trying to decipher it's 
output.

Beheading gnats:

1:

its (genitive) does *not* have an apostrophe.

it's a nice day - right;
it's output - wrong.

2: Please keep your line length to below 76 characters.

Best,

Tony

-- 

Tony Earnshaw

Growing old is compulsory, growing up is optional.

e-post: [EMAIL PROTECTED]
www:http://www.billy.demon.nl
gpg public key: http://www.billy.demon.nl/tonni.armor

Telefoon:   (+31) (0)172 530428
Mobiel: (+31) (0)6 51153356

GPG Fingerprint = 3924 6BF8 A755 DE1A 4AD6 FA2B F7D7 6051 3BE7 B981
3BE7B981





signature.asc
Description: Dette er en digitalt signert meldingsdel


Re: [PHP] unexpected T_STRING error

2002-09-28 Thread Philip Olson


You can mix and match single (') and double ()
quotes so the following are all appropriate:

  echo a 'string' b;
  echo a \string\ b;
  
  echo 'a \'string\' b;
  echo 'a string b;

See?  PHP can't read your mind and know what  
goes with what, like:

  echo abcdefg; // BAD

Now, when dealing with arrays inside strings:

  echo an {$array['key']} b;
  echo 'an ' . $array['key'] . ' b';
  echo an $array[key] b;

See also:

  http://www.zend.com/zend/tut/using-strings.php
  http://www.php.net/manual/en/language.types.string.php

Regards,
Philip Olson


On Sat, 28 Sep 2002, Gary wrote:

 Hi All,
 Can someone explain to me why I am getting an error for the following?
 
 $keywords = $_POST[keywords];
 if ($keywords) {
 echolt;META NAME=keywords CONTENT= $keywords gt;;
 }
 
 TIA
 Gary
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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




Re: [PHP] unexpected T_STRING error

2002-09-28 Thread Chris Shiflett

I think you meant to end both of these strings with a '

Philip Olson wrote:

  echo 'a \'string\' b;
  echo 'a string b;



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




RE: [PHP] Challenging problem for you programing gurus...

2002-09-28 Thread John W. Holmes

ALTER TABLE your_table CHANGE COLUMN old_column_name new_column_name NOT
NULL AUTO_INCREMENT PRIMARY KEY;

Then use mysql_insert_id() in your PHP code to retrieve the ID that is
generated upon INSERTs.

---John Holmes...

 -Original Message-
 From: Ryan A [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, September 28, 2002 12:17 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Challenging problem for you programing gurus...
 
 Hi guys,
 I have come accross a small problem while trying to convert a java
program
 to a PHP one
 my database table is like so
 
 *
 cno (int)
 name (varchar)
 lastname(varchar)
 etc etc
 *
 
 as you can see the details I take is name/lastname and customer number
 (cno) is automatically generated, now instead of using a auto
increment
 a int was declared and this code was used
 
 **
 synchronized(this)
 {
 rs=stmt.executeQuery(select max(cno)+1 from cust);
 }
 **
 
 (for those of you who dont understand java)
 the synchronized keyword makes sure only one thread can work in the
 block of code between the { and } then it executes the query
select
 max(cno)+1 from cust and stores the result in an array (like PHP) in
 rs.
 
 Basically, it just gets the next higher cno from the table cust.
 
 Then it enters the cno like this rs=cno,then name,lastname etc and
then
 tells the customer that the data has been entered and his new customer
 number is rs.
 
 
 As you can see its a pain in the ass job which has to be changed,
 the problem is a few hundred records have already been entered,
 how do i use the current table BUT use the more useful auto increment
and
 LAST_INSERT_ID() via PHP?
 The java servlet program which is handleing the requests is working
fine,
 but I am want to convert it to a PHP program as paying for servlet
hosting
 is upto 5-8 times more...and I aint rich, or even close to being rich
:-(
 
 
 Please reply,
 ANY help appreciated and thanks in advance.
 Cheers,
 -Ryan.



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




RE: [PHP] Htmlentities and Newlines?

2002-09-28 Thread John W. Holmes

 Perhaps I don't understand the use of 'htmlentities' too well, but I
would
 like newlines to be retained/inserted into a db, and then if
displayed, to
 produce a new line from a textarea. However, I want the possibility of
 dangerous html excluded (hence the use of 'htmlentities').
 
 Is there some way of excluding '\n \r ' and other newline indicators
from
 'htmlentities()'? Perhaps a combination of preg_match and something
else?
 I'm
 a bit brained-fried struggling with other errant parts of this code
since
 6
 am.
 Any ideas how I could proceed?

What's wrong with

echo nl2br(htmlentities($text));

??

---John Holmes...



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




[PHP] Imagemagick Mailinglist

2002-09-28 Thread Sascha Braun

Hi,

I need some discussion about the imagemagick library.

Does anyone know some about an good Imagemagick Mailinglist?

Please send me some Links if you got some ;)

Thanks very much

Sascha



RE: [PHP] export data to text file

2002-09-28 Thread John W. Holmes

 okay, how can I write a file in csv format either to the browser or to
the
 server? If I use the Mysqladmin page I get all the fields, I just want
 some
 of them.
 Diana

You can use the SELECT ... INTO OUTFILE query like someone else
mentioned, and then use passthru() to send the file to the browser.
It'll come out as text to the user and appear in the browser. If you
want it available to download, then you'll have to send attachment
headers before passthru(). 

If you don't have FILE privs so you can use the above query, then you
could do something like this:

$result = mysql_query(SELECT ... FROM table WHERE ... );
while($row = mysql_fetch_row($result))
{ echo implode(,,$row); }

You can use \t instead of , or whatever. That doesn't put quotes around
strings or anything like that, though...

---John Holmes...




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




RE: [PHP] Update identical table

2002-09-28 Thread John W. Holmes

 I have 2 identical tables called tmp_data and data. (on the same
mysql
 database).
 What would be the simple and more convenient way to update table
data
 with a row from table tmp_data.
 (something like select * from tmp_data and than update data ...).

Why not have just one table with a flag that says whether it's a temp
row or not?? It would make things easier and not replicate data.

If you don't want to do that, use the INSERT INTO table2 SELECT ... FROM
table1 WHERE ...

---John Holmes...



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




Re: [PHP] export data to text file

2002-09-28 Thread Curtis Gordon

Why not write to a file on the server and generate a link to it?

Collect info  write file  user downloads file

Curtis

Diana Castillo wrote:

okay, how can I write a file in csv format either to the browser or to the
server? If I use the Mysqladmin page I get all the fields, I just want some
of them.
Diana

--
See my web page:
http://www.netrox.net/%7Ecastillo/
Todd Pasley [EMAIL PROTECTED] escribió en el mensaje
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  

Hi

If what you mean is... you want to be able to write to a file on the
browsers computer, then please let us know if you find a way.

To my knowledge, there is not any intended way to do this... you wouldn't
want any old website to be able to manipulate your hard drive would you?

It might be possible if you write an applet, otherwise, pretty much the


only
  

thing you should be able to write to the hard drive is a cookie.

HTH

Todd.



-Original Message-
From: Diana Castillo [mailto:[EMAIL PROTECTED]]
Sent: Sunday, 29 September 2002 12:03 AM
To: [EMAIL PROTECTED]
Subject: [PHP] export data to text file

  

 8---






  





[PHP] mkdir() failed: Permission denied

2002-09-28 Thread Phil Powell

Ok, I am stuck.  I am trying to create a folder in the same directory as
process.php and then use move_uploaded_file($FILES['myImage]['tmp_name'])
and it constantly fails:

mkdir() failed (Permission denied)

Here is my code:

?
  $willChangeLayout = 1; $isEmptyLayoutValues = 1;

  foreach ($_POST as $key = $val) {
   if (strcmp($key, isDefaultLayout) == 0) $willChangeLayout = 0;
   if (!empty($_POST[$key])) $isEmptyLayoutValues = 0;
   ${$key} = $val;
  }

  // SERVER-SIDE VALIDATION
  if ($willChangeLayout  $isEmptyLayoutValues)
   header(Location:  . $refURL . ?errorMsg= . urlencode(Please fill out
all required fields));

  // FILE UPLOAD HANDLING

  $attempt = mkdir(/users/ppowell/web/my/images, 0655);

  if (is_uploaded_file($_FILES['myImage']['tmp_name']))
   move_uploaded_file($_FILES['myImage']['tmp_name'],
/users/ppowell/web/my/images/ . $_FILES['myImage']['name']);


?

Please someone tell me what I'm doing wrong :(

Thanx
Phil



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




[PHP] Smarty template question

2002-09-28 Thread Matt Giddings

Hello,

Be for warned that I am new to smarty and for some reason I'm
finding it very difficult to learn.  ???  Anyway, my question is how do
I access an array of associative arrays via the {section} statement?

Heres the code:

PHP:

Function readComment( $smarty, $bid ) {

  ...

  // this code is contained within a class that uses pear db.
  // I pass by reference the smarty object that was created
  // in the main php script.  I have already performed the
  // sql query and checked for any db errors, heres how the
  // data gets assigned.

  while( $row = $result-fetchRow( DB_FETCHMODE_ASSOC ) ) {
$rowdata[$i] = $row;
$i++;
  }
  $db-disconnect();
  $smarty-assign(comments, $rowdata);
}


TPL:

HTML
TITLESmarty Test/TITLE
BODY
{* $action is assigned to smarty in the main php script. *}
{if $action eq read}
  {if count($comments) gt 0}
{strip}
  table align=center border=1
trthnick/ththcomment/th/tr
  {section name=idx loop=$comments}
tr bgcolor={cycle values=#99,#d0d0d0}
  td{$comments[idx].nick}/td
  td{$comments[idx].comment}/td
/tr
  {sectionelse}
trtd colspan=2sorry, no data avaliable/td/tr
  {/section}
  /table
{/strip}
  {else}
centersorry, no data avaliable/center
  {/if}
{else}
  centeraction != read/center
{/if}
/BODY
/HTML


TIA,
Matt

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.391 / Virus Database: 222 - Release Date: 9/19/2002
 


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




Re: Re[2]: [PHP] counting words in a string

2002-09-28 Thread debbie_dyer

You can get all the terms into an array using preg_match_all:-

$str = UNAVAILABLE More Info AVAILABLE More Info;
$regExp = /(?:UN)?AVAILABLE|More Info/;
preg_match_all($regExp, $str, $regs);

$regs[0] will contain the matched terms - you should then be able to use
array functions to do whatever else you need to do - counting, positions,
etc

Debbie

- Original Message -
From: Justin French [EMAIL PROTECTED]
To: Richard Kurth [EMAIL PROTECTED]; php-general
[EMAIL PROTECTED]
Sent: Saturday, September 28, 2002 6:26 PM
Subject: Re: Re[2]: [PHP] counting words in a string


 You need to look at a few options... one is regular expression (not my
 forte), or perhaps winding through the string one character at a time,
 writing a very simple state engine.

 Justin French


 on 28/09/02 4:47 PM, [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote:

  Hello Justin,
 
  That worked perfect but I have one more problem I need to know if one
  of the word is UNAVAILABLE I need to know if it is the first one or
  the second one. I don't know if there is any way to do this.
  1st 2nd
  $string =UNAVAILABLE AVAILABLE More Info;
  1st   2nd
  $string =AVAILABLE More Info UNAVAILABLE ;
 
  Friday, September 27, 2002, 11:22:42 PM, you wrote:
 
 
  JF if this is your SPECIFIC problem, putting a space at the beginning
of
  $srch
  JF will help, eliminating XAVAILABLE... but this will cause a problem
with
  the
  JF word AVAILABLE appearing at the start of the string, so temporarily
put a
  JF space at the start of the string:
 
  JF ?
  JF // UNTESTED
  JF $count = substr_count(' '.strtolower($string), strtolower('
'.$srch));
  JF echo $count;
  ?
 
  JF this won't help if there are newlines and other white space instead
of
  JF spaces, and won't help (so far) for a different set of
circumstances...
 
  JF it would be nice to extend substr_count() could be extended to have
an
  JF option.
 
  JF Justin
 
 
 
  JF on 28/09/02 3:41 PM, [EMAIL PROTECTED] ([EMAIL PROTECTED])
wrote:
 
 
  I need to count how many times the word AVAILABLE appears in a string
  like this
  $string =AVAILABLE More Info AVAILABLE More Info;
  some time the string looks like this
  $string =UNAVAILABLE More Info AVAILABLE More Info;
  or
  $string =AVAILABLE More Info UNAVAILABLE More Info;
  when I use
  $srch=AVAILABLE;
  $count=substr_count(strtolower($string), strtolower($srch));
  echo $count;
  it puts the count a 2 even when one of the words is UNAVAILABLE
  how can I make it only count AVAILABLE and not UNAVAILABLE or visa
  verse
 
 
 
 


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



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




[PHP] smarty template question.

2002-09-28 Thread Matt Giddings

Hello,

Be for warned that I am new to smarty and for some reason I'm
finding it very difficult to learn.  ???  Anyway, my question is how do
I access an array of associative arrays via the {section} statement?

Heres the code:

PHP:

Function readComment( $smarty, $bid ) {

  ...

  // this code is contained within a class that uses pear db.
  // I pass by reference the smarty object that was created
  // in the main php script.  I have already performed the
  // sql query and checked for any db errors, heres how the
  // data gets assigned.

  while( $row = $result-fetchRow( DB_FETCHMODE_ASSOC ) ) {
$rowdata[$i] = $row;
$i++;
  }
  $db-disconnect();
  $smarty-assign(comments, $rowdata);
}


TPL:

HTML
TITLESmarty Test/TITLE
BODY
{* $action is assigned to smarty in the main php script. *}
{if $action eq read}
  {if count($comments) gt 0}
{strip}
  table align=center border=1
trthnick/ththcomment/th/tr
  {section name=idx loop=$comments}
tr bgcolor={cycle values=#99,#d0d0d0}
  td{$comments[idx].nick}/td
  td{$comments[idx].comment}/td
/tr
  {sectionelse}
trtd colspan=2sorry, no data avaliable/td/tr
  {/section}
  /table
{/strip}
  {else}
centersorry, no data avaliable/center
  {/if}
{else}
  centeraction != read/center
{/if}
/BODY
/HTML


TIA,
Matt


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.391 / Virus Database: 222 - Release Date: 9/19/2002
 


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




RE: [PHP] mkdir() failed: Permission denied

2002-09-28 Thread John W. Holmes

Whatever user your web server is running as needs to have permission to
write to that directory that you are trying to make the new one in.

---John Holmes...

 -Original Message-
 From: Phil Powell [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, September 28, 2002 3:38 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] mkdir() failed: Permission denied
 
 Ok, I am stuck.  I am trying to create a folder in the same directory
as
 process.php and then use
move_uploaded_file($FILES['myImage]['tmp_name'])
 and it constantly fails:
 
 mkdir() failed (Permission denied)
 
 Here is my code:
 
 ?
   $willChangeLayout = 1; $isEmptyLayoutValues = 1;
 
   foreach ($_POST as $key = $val) {
if (strcmp($key, isDefaultLayout) == 0) $willChangeLayout = 0;
if (!empty($_POST[$key])) $isEmptyLayoutValues = 0;
${$key} = $val;
   }
 
   // SERVER-SIDE VALIDATION
   if ($willChangeLayout  $isEmptyLayoutValues)
header(Location:  . $refURL . ?errorMsg= . urlencode(Please
fill
 out
 all required fields));
 
   // FILE UPLOAD HANDLING
 
   $attempt = mkdir(/users/ppowell/web/my/images, 0655);
 
   if (is_uploaded_file($_FILES['myImage']['tmp_name']))
move_uploaded_file($_FILES['myImage']['tmp_name'],
 /users/ppowell/web/my/images/ . $_FILES['myImage']['name']);
 
 
 ?
 
 Please someone tell me what I'm doing wrong :(
 
 Thanx
 Phil
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




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




Re: [PHP] mkdir() failed: Permission denied

2002-09-28 Thread Phil Powell

Ok I did just that.. Permission is set for /users/ppowell/web/my at 0755
giving me full write permissions onto that directory, I would think, to
create subdirectory /images.

However, I can't do that because I get the following error:

on line 27:
if (!is_dir($path)) mkdir($path, 01755);

// $path = /users/ppowell/web/my/images/;

Warning: Unable to access /users/ppowell/web/my/images/ in
/users/ppowell/web/my/process.php on line 27




Phil
- Original Message -
From: John W. Holmes [EMAIL PROTECTED]
To: 'Phil Powell' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Saturday, September 28, 2002 4:22 PM
Subject: RE: [PHP] mkdir() failed: Permission denied


 Whatever user your web server is running as needs to have permission to
 write to that directory that you are trying to make the new one in.

 ---John Holmes...

  -Original Message-
  From: Phil Powell [mailto:[EMAIL PROTECTED]]
  Sent: Saturday, September 28, 2002 3:38 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] mkdir() failed: Permission denied
 
  Ok, I am stuck.  I am trying to create a folder in the same directory
 as
  process.php and then use
 move_uploaded_file($FILES['myImage]['tmp_name'])
  and it constantly fails:
 
  mkdir() failed (Permission denied)
 
  Here is my code:
 
  ?
$willChangeLayout = 1; $isEmptyLayoutValues = 1;
 
foreach ($_POST as $key = $val) {
 if (strcmp($key, isDefaultLayout) == 0) $willChangeLayout = 0;
 if (!empty($_POST[$key])) $isEmptyLayoutValues = 0;
 ${$key} = $val;
}
 
// SERVER-SIDE VALIDATION
if ($willChangeLayout  $isEmptyLayoutValues)
 header(Location:  . $refURL . ?errorMsg= . urlencode(Please
 fill
  out
  all required fields));
 
// FILE UPLOAD HANDLING
 
$attempt = mkdir(/users/ppowell/web/my/images, 0655);
 
if (is_uploaded_file($_FILES['myImage']['tmp_name']))
 move_uploaded_file($_FILES['myImage']['tmp_name'],
  /users/ppowell/web/my/images/ . $_FILES['myImage']['name']);
 
 
  ?
 
  Please someone tell me what I'm doing wrong :(
 
  Thanx
  Phil
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php





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




Re: [PHP] mkdir() failed: Permission denied

2002-09-28 Thread Sascha Braun

I've made many dirs:

$path_to_dir = '../';
  $images = 'images/';
  $year = date('Y').'/';
  $month = date('m').'/';
  $source = 'jpg/';
  $thumbs = 'thumbs/';
  $preview = 'preview/';
  $files = $HTTP_POST_FILES['image'];
  $path = $path_to_dir.$images.$year.$month.$source;
  if(!file_exists($path_to_dir.$images.$year)) {
   mkdir($path_to_dir.$images.$year, 0755);
   if(!file_exists($path_to_dir.$images.$year.$month)) {
mkdir($path_to_dir.$images.$year.$month, 0755);
if(!file_exists($path_to_dir.$images.$year.$month.$source)) {
 mkdir($path_to_dir.$images.$year.$month.$source, 0755);

But you need to be the owner of the dir where you want to create another dir
and the permissions have to allow you to make some dirs.

The abowe script doesn't work unless you close the if () { constructs.


 Ok, I'm confused.. tell me how to make a directory, please.

 Phil
 - Original Message -
 From: Sascha Braun [EMAIL PROTECTED]
 To: Phil Powell [EMAIL PROTECTED]
 Sent: Saturday, September 28, 2002 3:53 PM
 Subject: Re: [PHP] mkdir() failed: Permission denied


  You have to be the owenr too and maybe set the permission to 755.
 
 
   Ok, I am stuck.  I am trying to create a folder in the same directory
as
   process.php and then use
 move_uploaded_file($FILES['myImage]['tmp_name'])
   and it constantly fails:
  
   mkdir() failed (Permission denied)
  
   Here is my code:
  
   ?
 $willChangeLayout = 1; $isEmptyLayoutValues = 1;
  
 foreach ($_POST as $key = $val) {
  if (strcmp($key, isDefaultLayout) == 0) $willChangeLayout = 0;
  if (!empty($_POST[$key])) $isEmptyLayoutValues = 0;
  ${$key} = $val;
 }
  
 // SERVER-SIDE VALIDATION
 if ($willChangeLayout  $isEmptyLayoutValues)
  header(Location:  . $refURL . ?errorMsg= . urlencode(Please
fill
  out
   all required fields));
  
 // FILE UPLOAD HANDLING
  
 $attempt = mkdir(/users/ppowell/web/my/images, 0655);
  
 if (is_uploaded_file($_FILES['myImage']['tmp_name']))
  move_uploaded_file($_FILES['myImage']['tmp_name'],
   /users/ppowell/web/my/images/ . $_FILES['myImage']['name']);
  
  
   ?
  
   Please someone tell me what I'm doing wrong :(
  
   Thanx
   Phil
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
 



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




[PHP] Bet this is a dead horse

2002-09-28 Thread John Hinton

Sorry, just signed on... due to this question... hope this horse ain't 
too dead.

Anyway, I have a need to run a SSI inside of a PHP page. Only thing I 
have found so far is that maybe Apache 2.0 will handle this feature? Is 
there anyway to get this to work under Linux/Apache?

-- 
John Hinton - Goshen, VA.
http://www.ew3d.com

Those who dance are considered insane
by those who can't hear the music


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




Re: [PHP] Bet this is a dead horse

2002-09-28 Thread Rasmus Lerdorf

Nope, convert your SSI's to PHP.

On Sat, 28 Sep 2002, John Hinton wrote:

 Sorry, just signed on... due to this question... hope this horse ain't
 too dead.

 Anyway, I have a need to run a SSI inside of a PHP page. Only thing I
 have found so far is that maybe Apache 2.0 will handle this feature? Is
 there anyway to get this to work under Linux/Apache?

 --
 John Hinton - Goshen, VA.
 http://www.ew3d.com

 Those who dance are considered insane
 by those who can't hear the music


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



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




[PHP] Newbie Q: Any difference what the .ext is on include() files???

2002-09-28 Thread -[ Rene Brehmer ]-

Hi y'all

I've only been working with PHP for the past 2-3 weeks, so there's alot of
things I haven't quite grasped 100% yet ...

Basically what I'm doing is converting my old framed, js-driven, HTML
website, with 137 physical pages (individual HTML files) and some
dynamically created ones, into a full-fledged PHP site ... 

As the whole idea in this is to get rid of the frameset, and reuse as much
code as entirely possible, I'm using 5-6 PHP master files (I'm only
through converting little more than half the site by now), which then mix
and match variables to include the right files for bodies and menus and
such...

But here's the real Q: Does it matter at all what extension I use for the
include() source files???
I mean, they're the old HTML files that I strip down to the most basic,
with a few HTML tags to control the formatting, so my though pattern is
that .html is wrong, because it's not real HTML (in that it lacks
everything that makes them HTML), and it's not really .txt, because it
contains formatting characters ... so in lack of better, I decided to name
them .psrc (for PHP source) ...

Right now I'm only running the site on test-basis on my own PHP on Apache
on WinXP, where it works well, nomatter what ext I use (provided I
remember to update the include() command to reflect it of course. But it's
going to be uploaded to a webhotel I haven't bought yet ... so I just want
to know: Do I risk any functionality in using my own extensions? Or does
PHP as a general not care about the include() extensions???

I do have some .php includes, because they run PHP code, but most of my
includes are just text that needs to put in the right part of a table...

TIA

Rene
-- 
Rene Brehmer
System developer in the making...

This message was written on 100% recycled spam.

My website: http://www.geocities.com/cerberus_hotdog
Babes and computer  internet references...

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




Re: [PHP] Smarty template question

2002-09-28 Thread Peter J. Schoenster



On 28 Sep 2002 at 15:48, Matt Giddings wrote:

 Hello,
 
  Be for warned that I am new to smarty and for some reason I'm
 finding it very difficult to learn.  ???  Anyway, my question is how do
 I access an array of associative arrays via the {section} statement?
 
 Heres the code:

Matt,

I suggest you break your code down to the simplest possible. Too many 
factors in there for my taste.  FWIW, I had to bang my head a few times 
to get it and still have to verify my assumptions. For some reason I 
took to Template::Toolkit rather fast but smarty is working fine for 
me.

Here are a few notes, but I'm fairly new to PHP so caution.

First, totally unrelated to your question:

 Function readComment( $smarty, $bid ) {

In Perl and in PHP I have my classes ONLY manipulate data and return 
data to the handerl which then passes it off to what I call the 
viewer. In this way, in Perl for instance, I can use more than one 
template system as I create a class for each template system and 
manipulate the data as needed for that system. Works like a charm. In 
this way you can use the code in your classes for manythings ... it's 
not tied to your output.  Also, now some might complain that this might 
be slower or take more memory or whatever, but I do this with smarty:

$data = $g-run($com,$fid);

$data is an array of data returned by my functions.
$data['content'] = $g-viewer-Merge($data,$template); 

print $g-viewer-Merge($data,'index.html'); 

So I *wrap* the content of pages into a page which pulls in 
header/footer rather than having a header/footer in every page. 

Okay, back to your qeustion:


   while( $row = $result-fetchRow( DB_FETCHMODE_ASSOC ) ) {
 $rowdata[$i] = $row;
 $i++;

I don't think you need the $i.

Are you sure you have data in $rowdata?

Your use of section looks good to me. You've got those if statements. 
Sure they are all true. 

I'm using section in lots of stuff and it's working fine.

When I run into trouble I work from the most basic, the simplest and 
then move up.

Peter




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




Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Andre Dubuc

On Saturday 28 September 2002 03:30 pm, John W. Holmes wrote:
  Perhaps I don't understand the use of 'htmlentities' too well, but I

 would

  like newlines to be retained/inserted into a db, and then if

 displayed, to

  produce a new line from a textarea. However, I want the possibility of
  dangerous html excluded (hence the use of 'htmlentities').
 
  Is there some way of excluding '\n \r ' and other newline indicators

 from

  'htmlentities()'? Perhaps a combination of preg_match and something

 else?

  I'm
  a bit brained-fried struggling with other errant parts of this code

 since

  6
  am.
  Any ideas how I could proceed?

 What's wrong with

 echo nl2br(htmlentities($text));

 ??

 ---John Holmes...


Thanks John,

Well, as expected, the Preview function admirably displays text, with line 
breaks, from the textarea.

However, once saved in the db (which used to display br's)  the db record  
now displays the same as on screen --  line breaks with no characters 
indicating linebreaks). Yet, if I call that particular record from the db, 
and display it on-screen, it's all on one line. 

So, I'm confused. Any ideas what to do to save it properly in the db so that 
on display, it renders the same way as in the Preview (pre-db insertion) mode?

And now, ucfirst($text); refuses to work! Sigh . . . what a day!

Tia,
Andre

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




RE: [PHP] Htmlentities and Newlines?

2002-09-28 Thread John W. Holmes

OK, I can't quite follow what you are doing. Here's what you should do.
You should always save it in the database exactly how the user typed it.
Save it with newlines and don't add any HTML code to it. Reason being,
when this has to be edited, it'll show up in the textarea the same way
the user typed it. No having to explain what the br are or where the
extra stuff came from. 

Then, to show a preview or whatever to the user, use
nl2br(htmlentities($text)) to send it to the browser. 

---John Holmes...

 -Original Message-
 From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, September 28, 2002 6:25 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PHP] Htmlentities and Newlines?
 
 On Saturday 28 September 2002 03:30 pm, John W. Holmes wrote:
   Perhaps I don't understand the use of 'htmlentities' too well, but
I
 
  would
 
   like newlines to be retained/inserted into a db, and then if
 
  displayed, to
 
   produce a new line from a textarea. However, I want the
possibility of
   dangerous html excluded (hence the use of 'htmlentities').
  
   Is there some way of excluding '\n \r ' and other newline
indicators
 
  from
 
   'htmlentities()'? Perhaps a combination of preg_match and
something
 
  else?
 
   I'm
   a bit brained-fried struggling with other errant parts of this
code
 
  since
 
   6
   am.
   Any ideas how I could proceed?
 
  What's wrong with
 
  echo nl2br(htmlentities($text));
 
  ??
 
  ---John Holmes...
 
 
 Thanks John,
 
 Well, as expected, the Preview function admirably displays text, with
line
 breaks, from the textarea.
 
 However, once saved in the db (which used to display br's)  the db
 record
 now displays the same as on screen --  line breaks with no characters
 indicating linebreaks). Yet, if I call that particular record from the
db,
 and display it on-screen, it's all on one line.
 
 So, I'm confused. Any ideas what to do to save it properly in the db
so
 that
 on display, it renders the same way as in the Preview (pre-db
insertion)
 mode?
 
 And now, ucfirst($text); refuses to work! Sigh . . . what a day!
 
 Tia,
 Andre



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




[PHP] Member's Area Script

2002-09-28 Thread Stephen Craton

Hello again,

I'm trying to write a script that has a member's area in it. So far I've
been able to successfully validate only one username and only one
password but now I'm going big and trying to compare it with a table in
my MySQL database. Everything goes nice and smooth until I actually try
and enter in my username and password. I type it in, copy and paste,
whaetever and it tells me the error I wanted it to say The username and
password is not a good combo. I've copied and pasted the username and
password from the database directly yet it still gives me this error.
Here's my code for the login() function that logs the user in:

function login($username, $password)
{
  $conn = $main;
  if (!$conn)
return 0;

  $result = mysql_query(select * from user 
 where username='$username'
 and passwd = '$password');
  if (!$result)
 return 0;
  
  if (mysql_num_rows($result)0)
 return 1;
  else 
 return 0;
}

Here's the code for the part that calls the login() function:

if(login($user, $pass))
{
$valid_user = $user;
session_register(valid_user);
}
else
{
echo font face='Arial, Helvetica, sans-serif'
size='3'centerbYou supplied an invalid username and password combo.
Try again please./b/center;
exit;
}

And here's the part that connects to the database:

?php
# FileName=Connection_php_mysql.htm
# Type=MYSQL
# HTTP=true
$hostname_main = localhost;
$database_main = mom;
$username_main = root;
$password_main = ;
$main = mysql_pconnect($hostname_main, $username_main, $password_main)
or die(mysql_error());
?

Does anyone see why it's doing this to me? Please help!!

Thanks,
Stephen
http://www.melchior.us
http://php.melchior.us



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




Re: Re[2]: [PHP] counting words in a string

2002-09-28 Thread olinux

wouldn't it be easier and more efficient to simply
count the number of spaces in the string (and add 1)?

using substr_count or something similar

olinux


--- Justin French [EMAIL PROTECTED] wrote:
 You need to look at a few options... one is regular
 expression (not my
 forte), or perhaps winding through the string one
 character at a time,
 writing a very simple state engine.
 
 Justin French
 
 
 on 28/09/02 4:47 PM, [EMAIL PROTECTED]
 ([EMAIL PROTECTED]) wrote:
 
  Hello Justin,
  
  That worked perfect but I have one more problem I
 need to know if one
  of the word is UNAVAILABLE I need to know if it is
 the first one or
  the second one. I don't know if there is any way
 to do this.
  1st 2nd
  $string =UNAVAILABLE AVAILABLE More Info;
  1st   2nd
  $string =AVAILABLE More Info UNAVAILABLE ;
  
  Friday, September 27, 2002, 11:22:42 PM, you
 wrote:
  
  
  JF if this is your SPECIFIC problem, putting a
 space at the beginning of
  $srch
  JF will help, eliminating XAVAILABLE... but this
 will cause a problem with
  the
  JF word AVAILABLE appearing at the start of the
 string, so temporarily put a
  JF space at the start of the string:
  
  JF ?
  JF // UNTESTED
  JF $count = substr_count(' '.strtolower($string),
 strtolower(' '.$srch));
  JF echo $count;
  ?
  
  JF this won't help if there are newlines and
 other white space instead of
  JF spaces, and won't help (so far) for a
 different set of circumstances...
  
  JF it would be nice to extend substr_count()
 could be extended to have an
  JF option.
  
  JF Justin
  
  
  
  JF on 28/09/02 3:41 PM, [EMAIL PROTECTED]
 ([EMAIL PROTECTED]) wrote:
  
  
  I need to count how many times the word
 AVAILABLE appears in a string
  like this
  $string =AVAILABLE More Info AVAILABLE More
 Info;
  some time the string looks like this
  $string =UNAVAILABLE More Info AVAILABLE More
 Info;
  or
  $string =AVAILABLE More Info UNAVAILABLE More
 Info;
  when I use
  $srch=AVAILABLE;
  $count=substr_count(strtolower($string),
 strtolower($srch));
  echo $count;
  it puts the count a 2 even when one of the words
 is UNAVAILABLE
  how can I make it only count AVAILABLE and not
 UNAVAILABLE or visa
  verse
  
  
  
  
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


__
Do you Yahoo!?
New DSL Internet Access from SBC  Yahoo!
http://sbc.yahoo.com

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




RE: [PHP] Newbie Q: Any difference what the .ext is on include() files???

2002-09-28 Thread John W. Holmes

The only thing to worry about is that if someone pulls up your include
file, they're likely to see it as plain text and all of the code within
it will be visible. If there is no PHP code within the file, or the PHP
code is irrelevant (no passwords, logic, etc), then it doesn't matter. 

I normally name my include files as file.inc.php. But (there is always a
but) you have to remember that this file can be run out of context now,
and all of the PHP code within it will be evaluated. It may or may not
matter, but it's something to stay aware of. 

A third option is to place them in an .htaccess protected directory or
add a rule that .inc or .psrc files can't be called up through the
browser (deny all). Depending on your web server, this may or may not be
possible.

The safest and best method to using includes is to store them outside of
the webroot, so they can't be called by the browser at all. An easy way
to do this is to define to variables, the html path, and the include
path.

$_CONF['html'] = '/home/groups/user/htdocs/';
$_CONF['include'] = '/home/groups/user/includes/';

And then base all of your include(), fopen(), header(), href, etc, off
of those two variables. Makes moving your sites very easy, too, just
change the values of those variables...

---John Holmes...

 -Original Message-
 From: -[ Rene Brehmer ]- [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, September 28, 2002 4:57 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Newbie Q: Any difference what the .ext is on include()
 files???
 
 Hi y'all
 
 I've only been working with PHP for the past 2-3 weeks, so there's
alot of
 things I haven't quite grasped 100% yet ...
 
 Basically what I'm doing is converting my old framed, js-driven, HTML
 website, with 137 physical pages (individual HTML files) and some
 dynamically created ones, into a full-fledged PHP site ...
 
 As the whole idea in this is to get rid of the frameset, and reuse as
much
 code as entirely possible, I'm using 5-6 PHP master files (I'm only
 through converting little more than half the site by now), which then
mix
 and match variables to include the right files for bodies and menus
and
 such...
 
 But here's the real Q: Does it matter at all what extension I use for
the
 include() source files???
 I mean, they're the old HTML files that I strip down to the most
basic,
 with a few HTML tags to control the formatting, so my though pattern
is
 that .html is wrong, because it's not real HTML (in that it lacks
 everything that makes them HTML), and it's not really .txt, because it
 contains formatting characters ... so in lack of better, I decided to
name
 them .psrc (for PHP source) ...
 
 Right now I'm only running the site on test-basis on my own PHP on
Apache
 on WinXP, where it works well, nomatter what ext I use (provided I
 remember to update the include() command to reflect it of course. But
it's
 going to be uploaded to a webhotel I haven't bought yet ... so I just
want
 to know: Do I risk any functionality in using my own extensions? Or
does
 PHP as a general not care about the include() extensions???
 
 I do have some .php includes, because they run PHP code, but most of
my
 includes are just text that needs to put in the right part of a
table...
 
 TIA
 
 Rene
 --
 Rene Brehmer
 System developer in the making...
 
 This message was written on 100% recycled spam.
 
 My website: http://www.geocities.com/cerberus_hotdog
 Babes and computer  internet references...
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




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




Re: [PHP] Member's Area Script

2002-09-28 Thread debbie_dyer


  $conn = $main; - that line is the problem - you cant use global vars
inside functions without declaring them as global

- Original Message -
From: Stephen Craton [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, September 28, 2002 11:49 PM
Subject: [PHP] Member's Area Script


 Hello again,

 I'm trying to write a script that has a member's area in it. So far I've
 been able to successfully validate only one username and only one
 password but now I'm going big and trying to compare it with a table in
 my MySQL database. Everything goes nice and smooth until I actually try
 and enter in my username and password. I type it in, copy and paste,
 whaetever and it tells me the error I wanted it to say The username and
 password is not a good combo. I've copied and pasted the username and
 password from the database directly yet it still gives me this error.
 Here's my code for the login() function that logs the user in:

 function login($username, $password)
 {
   $conn = $main;
   if (!$conn)
 return 0;

   $result = mysql_query(select * from user
  where username='$username'
  and passwd = '$password');
   if (!$result)
  return 0;

   if (mysql_num_rows($result)0)
  return 1;
   else
  return 0;
 }

 Here's the code for the part that calls the login() function:

 if(login($user, $pass))
 {
 $valid_user = $user;
 session_register(valid_user);
 }
 else
 {
 echo font face='Arial, Helvetica, sans-serif'
 size='3'centerbYou supplied an invalid username and password combo.
 Try again please./b/center;
 exit;
 }

 And here's the part that connects to the database:

 ?php
 # FileName=Connection_php_mysql.htm
 # Type=MYSQL
 # HTTP=true
 $hostname_main = localhost;
 $database_main = mom;
 $username_main = root;
 $password_main = ;
 $main = mysql_pconnect($hostname_main, $username_main, $password_main)
 or die(mysql_error());
 ?

 Does anyone see why it's doing this to me? Please help!!

 Thanks,
 Stephen
 http://www.melchior.us
 http://php.melchior.us



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



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




RE: [PHP] mkdir() failed: Permission denied

2002-09-28 Thread John W. Holmes

_YOU_ don't need write permissions, the web server does

---John Holmes...

 -Original Message-
 From: Phil Powell [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, September 28, 2002 4:24 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PHP] mkdir() failed: Permission denied
 
 Ok I did just that.. Permission is set for /users/ppowell/web/my at
0755
 giving me full write permissions onto that directory, I would think,
to
 create subdirectory /images.
 
 However, I can't do that because I get the following error:
 
 on line 27:
 if (!is_dir($path)) mkdir($path, 01755);
 
 // $path = /users/ppowell/web/my/images/;
 
 Warning: Unable to access /users/ppowell/web/my/images/ in
 /users/ppowell/web/my/process.php on line 27
 
 
 
 
 Phil
 - Original Message -
 From: John W. Holmes [EMAIL PROTECTED]
 To: 'Phil Powell' [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Saturday, September 28, 2002 4:22 PM
 Subject: RE: [PHP] mkdir() failed: Permission denied
 
 
  Whatever user your web server is running as needs to have permission
to
  write to that directory that you are trying to make the new one in.
 
  ---John Holmes...
 
   -Original Message-
   From: Phil Powell [mailto:[EMAIL PROTECTED]]
   Sent: Saturday, September 28, 2002 3:38 PM
   To: [EMAIL PROTECTED]
   Subject: [PHP] mkdir() failed: Permission denied
  
   Ok, I am stuck.  I am trying to create a folder in the same
directory
  as
   process.php and then use
  move_uploaded_file($FILES['myImage]['tmp_name'])
   and it constantly fails:
  
   mkdir() failed (Permission denied)
  
   Here is my code:
  
   ?
 $willChangeLayout = 1; $isEmptyLayoutValues = 1;
  
 foreach ($_POST as $key = $val) {
  if (strcmp($key, isDefaultLayout) == 0) $willChangeLayout =
0;
  if (!empty($_POST[$key])) $isEmptyLayoutValues = 0;
  ${$key} = $val;
 }
  
 // SERVER-SIDE VALIDATION
 if ($willChangeLayout  $isEmptyLayoutValues)
  header(Location:  . $refURL . ?errorMsg= .
urlencode(Please
  fill
   out
   all required fields));
  
 // FILE UPLOAD HANDLING
  
 $attempt = mkdir(/users/ppowell/web/my/images, 0655);
  
 if (is_uploaded_file($_FILES['myImage']['tmp_name']))
  move_uploaded_file($_FILES['myImage']['tmp_name'],
   /users/ppowell/web/my/images/ . $_FILES['myImage']['name']);
  
  
   ?
  
   Please someone tell me what I'm doing wrong :(
  
   Thanx
   Phil
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 




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




Re: [PHP] mkdir() failed: Permission denied

2002-09-28 Thread Phil Powell

Got it but the solution is derned freaky... talking to the webserver admin I
come to find out that I have to write a stub executable to php4.cgi which
will interpret the PHP script bypassing the Apache mods.. that way I can
keep the directories at the default 0755 and STILL be able to do file mkdir
and uploading!!

Phil

- Original Message - 
From: John W. Holmes [EMAIL PROTECTED]
To: 'Phil Powell' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Saturday, September 28, 2002 7:04 PM
Subject: RE: [PHP] mkdir() failed: Permission denied


 _YOU_ don't need write permissions, the web server does
 
 ---John Holmes...
 
  -Original Message-
  From: Phil Powell [mailto:[EMAIL PROTECTED]]
  Sent: Saturday, September 28, 2002 4:24 PM
  To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Subject: Re: [PHP] mkdir() failed: Permission denied
  
  Ok I did just that.. Permission is set for /users/ppowell/web/my at
 0755
  giving me full write permissions onto that directory, I would think,
 to
  create subdirectory /images.
  
  However, I can't do that because I get the following error:
  
  on line 27:
  if (!is_dir($path)) mkdir($path, 01755);
  
  // $path = /users/ppowell/web/my/images/;
  
  Warning: Unable to access /users/ppowell/web/my/images/ in
  /users/ppowell/web/my/process.php on line 27
  
  
  
  
  Phil
  - Original Message -
  From: John W. Holmes [EMAIL PROTECTED]
  To: 'Phil Powell' [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Sent: Saturday, September 28, 2002 4:22 PM
  Subject: RE: [PHP] mkdir() failed: Permission denied
  
  
   Whatever user your web server is running as needs to have permission
 to
   write to that directory that you are trying to make the new one in.
  
   ---John Holmes...
  
-Original Message-
From: Phil Powell [mailto:[EMAIL PROTECTED]]
Sent: Saturday, September 28, 2002 3:38 PM
To: [EMAIL PROTECTED]
Subject: [PHP] mkdir() failed: Permission denied
   
Ok, I am stuck.  I am trying to create a folder in the same
 directory
   as
process.php and then use
   move_uploaded_file($FILES['myImage]['tmp_name'])
and it constantly fails:
   
mkdir() failed (Permission denied)
   
Here is my code:
   
?
  $willChangeLayout = 1; $isEmptyLayoutValues = 1;
   
  foreach ($_POST as $key = $val) {
   if (strcmp($key, isDefaultLayout) == 0) $willChangeLayout =
 0;
   if (!empty($_POST[$key])) $isEmptyLayoutValues = 0;
   ${$key} = $val;
  }
   
  // SERVER-SIDE VALIDATION
  if ($willChangeLayout  $isEmptyLayoutValues)
   header(Location:  . $refURL . ?errorMsg= .
 urlencode(Please
   fill
out
all required fields));
   
  // FILE UPLOAD HANDLING
   
  $attempt = mkdir(/users/ppowell/web/my/images, 0655);
   
  if (is_uploaded_file($_FILES['myImage']['tmp_name']))
   move_uploaded_file($_FILES['myImage']['tmp_name'],
/users/ppowell/web/my/images/ . $_FILES['myImage']['name']);
   
   
?
   
Please someone tell me what I'm doing wrong :(
   
Thanx
Phil
   
   
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
  
  
  
 
 
 


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




Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Andre Dubuc

Hi John,

Sorry about the ambiguity. What I'm trying to accomplish is close to what you 
describe. However, before anything goes into the db (ie html chars, bad 
commands, or anything from Mr.Hacker), I verify it. Someone suggested, way 
back when I first started with textarea, to use 'htmlentities' to strip the 
bad items out.

You should always save it in the database exactly how the user typed it.

So far, so good. But, if I follow what you suggest (and it's eminently 
reasonable!) I could have some 'bad stuff' becoming 'resident' in my db. 
Perhaps I am paranoid, but that seems like a-bad-thing-to-do.

Save it with newlines and don't add any HTML code to it. 

Ahh . . . if I save as the user typed it, assuming Mr. Hacker has added some 
little extras, what then?? I use a Preview mode for viewing what thgey've 
entered, and they must go back  to the textarea box if they need to edit 
(which has exactly what they typed.)

Oh, this all did sense to me a while ago, but I am tired, and it's beginning 
to sound like gibberish .

Thanks again.
Andre




On Saturday 28 September 2002 06:44 pm, John W. Holmes wrote:
 OK, I can't quite follow what you are doing. Here's what you should do.
 You should always save it in the database exactly how the user typed it.
 Save it with newlines and don't add any HTML code to it. Reason being,
 when this has to be edited, it'll show up in the textarea the same way
 the user typed it. No having to explain what the br are or where the
 extra stuff came from.

 Then, to show a preview or whatever to the user, use
 nl2br(htmlentities($text)) to send it to the browser.

 ---John Holmes...

  -Original Message-
  From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
  Sent: Saturday, September 28, 2002 6:25 PM
  To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Subject: Re: [PHP] Htmlentities and Newlines?
 
  On Saturday 28 September 2002 03:30 pm, John W. Holmes wrote:
Perhaps I don't understand the use of 'htmlentities' too well, but

 I

   would
  
like newlines to be retained/inserted into a db, and then if
  
   displayed, to
  
produce a new line from a textarea. However, I want the

 possibility of

dangerous html excluded (hence the use of 'htmlentities').
   
Is there some way of excluding '\n \r ' and other newline

 indicators

   from
  
'htmlentities()'? Perhaps a combination of preg_match and

 something

   else?
  
I'm
a bit brained-fried struggling with other errant parts of this

 code

   since
  
6
am.
Any ideas how I could proceed?
  
   What's wrong with
  
   echo nl2br(htmlentities($text));
  
   ??
  
   ---John Holmes...
 
  Thanks John,
 
  Well, as expected, the Preview function admirably displays text, with

 line

  breaks, from the textarea.
 
  However, once saved in the db (which used to display br's)  the db
  record
  now displays the same as on screen --  line breaks with no characters
  indicating linebreaks). Yet, if I call that particular record from the

 db,

  and display it on-screen, it's all on one line.
 
  So, I'm confused. Any ideas what to do to save it properly in the db

 so

  that
  on display, it renders the same way as in the Preview (pre-db

 insertion)

  mode?
 
  And now, ucfirst($text); refuses to work! Sigh . . . what a day!
 
  Tia,
  Andre

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




RE: [PHP] Member's Area Script

2002-09-28 Thread Stephen Craton

Thank you very much!!!

Thanks,
Stephen
http://www.melchior.us
http://php.melchior.us

:: -Original Message-
:: From: debbie_dyer [mailto:[EMAIL PROTECTED]] 
:: Sent: Saturday, September 28, 2002 6:03 PM
:: To: [EMAIL PROTECTED]
:: Subject: Re: [PHP] Member's Area Script
:: 
:: 
:: 
::   $conn = $main; - that line is the problem - you cant use 
:: global vars inside functions without declaring them as global
:: 
:: - Original Message -
:: From: Stephen Craton [EMAIL PROTECTED]
:: To: [EMAIL PROTECTED]
:: Sent: Saturday, September 28, 2002 11:49 PM
:: Subject: [PHP] Member's Area Script
:: 
:: 
::  Hello again,
:: 
::  I'm trying to write a script that has a member's area in 
:: it. So far 
::  I've been able to successfully validate only one username 
:: and only one 
::  password but now I'm going big and trying to compare it 
:: with a table 
::  in my MySQL database. Everything goes nice and smooth 
:: until I actually 
::  try and enter in my username and password. I type it in, copy and 
::  paste, whaetever and it tells me the error I wanted it to say The 
::  username and password is not a good combo. I've copied 
:: and pasted the 
::  username and password from the database directly yet it 
:: still gives me 
::  this error. Here's my code for the login() function that 
:: logs the user 
::  in:
:: 
::  function login($username, $password)
::  {
::$conn = $main;
::if (!$conn)
::  return 0;
:: 
::$result = mysql_query(select * from user
::   where username='$username'
::   and passwd = '$password');
::if (!$result)
::   return 0;
:: 
::if (mysql_num_rows($result)0)
::   return 1;
::else
::   return 0;
::  }
:: 
::  Here's the code for the part that calls the login() function:
:: 
::  if(login($user, $pass))
::  {
::  $valid_user = $user;
::  session_register(valid_user);
::  }
::  else
::  {
::  echo font face='Arial, Helvetica, sans-serif' 
::  size='3'centerbYou supplied an invalid username and password 
::  combo. Try again please./b/center; exit;
::  }
:: 
::  And here's the part that connects to the database:
:: 
::  ?php
::  # FileName=Connection_php_mysql.htm
::  # Type=MYSQL
::  # HTTP=true
::  $hostname_main = localhost;
::  $database_main = mom;
::  $username_main = root;
::  $password_main = ;
::  $main = mysql_pconnect($hostname_main, $username_main, 
:: $password_main) 
::  or die(mysql_error()); ?
:: 
::  Does anyone see why it's doing this to me? Please help!!
:: 
::  Thanks,
::  Stephen
::  http://www.melchior.us
::  http://php.melchior.us
:: 
:: 
:: 
::  --
::  PHP General Mailing List (http://www.php.net/)
::  To unsubscribe, visit: http://www.php.net/unsub.php
:: 
:: 
:: 
:: -- 
:: PHP General Mailing List (http://www.php.net/)
:: To unsubscribe, visit: http://www.php.net/unsub.php
:: 
:: 



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




RE: [PHP] Htmlentities and Newlines?

2002-09-28 Thread John W. Holmes

 Sorry about the ambiguity. What I'm trying to accomplish is close to
what
 you
 describe. However, before anything goes into the db (ie html chars,
bad
 commands, or anything from Mr.Hacker), I verify it. Someone suggested,
way
 back when I first started with textarea, to use 'htmlentities' to
strip
 the
 bad items out.

It doesn't strip it, it just converts some characters to HTML code.
 
 You should always save it in the database exactly how the user typed
it.
 
 So far, so good. But, if I follow what you suggest (and it's eminently
 reasonable!) I could have some 'bad stuff' becoming 'resident' in my
db.
 Perhaps I am paranoid, but that seems like a-bad-thing-to-do.

Yes. The key is to display it with htmlentities(). Never display it
directly.

 Save it with newlines and don't add any HTML code to it. 
 
 Ahh . . . if I save as the user typed it, assuming Mr. Hacker has
added
 some
 little extras, what then?? I use a Preview mode for viewing what
thgey've
 entered, and they must go back  to the textarea box if they need to
edit
 (which has exactly what they typed.)

Again, you don't have to worry what's in there, as long as you display
it correctly. 

Now, if you know that these entries aren't going to be edited, then you
can do the conversion and save that. Unfortunately, there is no
reversal to htmlentities. So, you can't run htmlentities on the text
and then hope to display it back to the user for editing. A  will be
lt;, and if you submit that and run html entities again, you'll have
amp;lt;. See where the problem is?

So, basically, as long as your displaying the text correctly, use the
conversions when you display it. If you don't need to edit the text, run
the conversion before you put it in your database. 

Anyone disagree?

---John Holmes...



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




[PHP] preg help ?

2002-09-28 Thread :B nerdy

ive got a html document with the following string in it:
INPUT TYPE=HIDDEN NAME=SPIDERSESSION VALUE=\oiXESASZC?~adQXZDQ?_

what i want to do is get the string which corresponds to value. so that is
\oiXESASZC?~adQXZDQ?_

ive used
preg_match_all ('INPUT TYPE=HIDDEN NAME=SPIDERSESSION VALUE=(.*)',
$contents,$out, PREG_PATTERN_ORDER);

but it returns the whole document :(

a little help? cheers



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




Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Sascha Cunz

 Hi John,

 Sorry about the ambiguity. What I'm trying to accomplish is close to what
 you describe. However, before anything goes into the db (ie html chars, bad
 commands, or anything from Mr.Hacker), I verify it. Someone suggested, way
 back when I first started with textarea, to use 'htmlentities' to strip the
 bad items out.

 You should always save it in the database exactly how the user typed it.

 So far, so good. But, if I follow what you suggest (and it's eminently
 reasonable!) I could have some 'bad stuff' becoming 'resident' in my db.
 Perhaps I am paranoid, but that seems like a-bad-thing-to-do.

 Save it with newlines and don't add any HTML code to it. 

 Ahh . . . if I save as the user typed it, assuming Mr. Hacker has added
 some little extras, what then?? I use a Preview mode for viewing what
 thgey've entered, and they must go back  to the textarea box if they need
 to edit (which has exactly what they typed.)

 Oh, this all did sense to me a while ago, but I am tired, and it's
 beginning to sound like gibberish .

 Thanks again.
 Andre


Things will be alright, if you follow two rules:

1. before Output, use htmlentities() to make sure, your text isn't confused 
with HTML (This way noone can insert HTML-Tags into your Text).

2. before saving to database, either use addslashes() or turn on magic_qoutes 
in php.ini. (This will ensure, that noone drops your database on the fly. 
e.g. Enters something like '; drop database;' into a textarea.)
as i remember magic_qoutes should be turned on by default.

Don't do anything else with data that goes to your database, or you'll lose 
posibility to edit it later on.

Regards 
Sascha


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




RE: [PHP] preg help ?

2002-09-28 Thread Thoenen, Peter Mr. EPS

/INPUT TYPE=HIDDEN NAME=SPIDERSESSION VALUE=([^]*)/ should work ...
prob. a better way to do this but its functional :)

-Peter

 -Original Message-
 From: :B nerdy [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, September 29, 2002 02:05
 To: [EMAIL PROTECTED]
 Subject: [PHP] preg help ?
 
 
 ive got a html document with the following string in it:
 INPUT TYPE=HIDDEN NAME=SPIDERSESSION VALUE=\oiXESASZC?~adQXZDQ?_
 
 what i want to do is get the string which corresponds to 
 value. so that is
 \oiXESASZC?~adQXZDQ?_
 
 ive used
 preg_match_all ('INPUT TYPE=HIDDEN NAME=SPIDERSESSION 
 VALUE=(.*)',
 $contents,$out, PREG_PATTERN_ORDER);
 
 but it returns the whole document :(
 
 a little help? cheers
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

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




Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Andre Dubuc

On Saturday 28 September 2002 07:55 pm, John W. Holmes wrote:
  Sorry about the ambiguity. What I'm trying to accomplish is close to

 what

  you
  describe. However, before anything goes into the db (ie html chars,

 bad

  commands, or anything from Mr.Hacker), I verify it. Someone suggested,

 way

  back when I first started with textarea, to use 'htmlentities' to

 strip

  the
  bad items out.

 It doesn't strip it, it just converts some characters to HTML code.

  You should always save it in the database exactly how the user typed

 it.

  So far, so good. But, if I follow what you suggest (and it's eminently
  reasonable!) I could have some 'bad stuff' becoming 'resident' in my

 db.

  Perhaps I am paranoid, but that seems like a-bad-thing-to-do.

 Yes. The key is to display it with htmlentities(). Never display it
 directly.

  Save it with newlines and don't add any HTML code to it. 
 
  Ahh . . . if I save as the user typed it, assuming Mr. Hacker has

 added

  some
  little extras, what then?? I use a Preview mode for viewing what

 thgey've

  entered, and they must go back  to the textarea box if they need to

 edit

  (which has exactly what they typed.)

 Again, you don't have to worry what's in there, as long as you display
 it correctly.

 Now, if you know that these entries aren't going to be edited, then you
 can do the conversion and save that. Unfortunately, there is no
 reversal to htmlentities. So, you can't run htmlentities on the text
 and then hope to display it back to the user for editing. A  will be
 lt;, and if you submit that and run html entities again, you'll have
 amp;lt;. See where the problem is?

 So, basically, as long as your displaying the text correctly, use the
 conversions when you display it. If you don't need to edit the text, run
 the conversion before you put it in your database.

 Anyone disagree?

 ---John Holmes...


Thanks John,

It appears I was doing it 'somewhat' correctly since I haven't run into the 
one-time-only problem with htmlentities. However, as I am only displaying the 
text in Preview Mode, when they click 'Back' on their browser, they'll see 
what they had just typed in. So, if they correct it, and click Preview, it'll 
be a new process since the old 'Preview was not saved to session, but is a 
'new' post (the old Preview was destroyed.)

Still, since I'm pulling the saved info from the db, iterating through all 
rows, and displaying it in table format, I can't get the linebreaks to 
display.  Here's the 'code' that displays the info:

?php 
/* db access using postgresql - each row is displayed */
...
trtd{$myrow['request']}/td/tr
...
?

Now unless I can do something like:

 trtd'nl2br({$myrow['request']}'/td/tr

(Unfortunately, in the db the linebreaks appear as whitespaces (no \n or 
br). I'm sort of sunk. Somehow, that syntax looks like it won't work. 

Thanks for the advice,
Andre
.

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




RE: [PHP] Htmlentities and Newlines?

2002-09-28 Thread John W. Holmes

Yeah, good catch on the addslash/magic_quote. 

Also, FYI: PHP will only allow you to do one query per mysql_query(). So
you can't try to end a quote and then send another query. Don't know if
this is the case for all database functions, or what... 

---John Holmes...

 -Original Message-
 From: Sascha Cunz [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, September 28, 2002 8:19 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; php-
 [EMAIL PROTECTED]
 Subject: Re: [PHP] Htmlentities and Newlines?
 
  Hi John,
 
  Sorry about the ambiguity. What I'm trying to accomplish is close to
 what
  you describe. However, before anything goes into the db (ie html
chars,
 bad
  commands, or anything from Mr.Hacker), I verify it. Someone
suggested,
 way
  back when I first started with textarea, to use 'htmlentities' to
strip
 the
  bad items out.
 
  You should always save it in the database exactly how the user
typed
 it.
 
  So far, so good. But, if I follow what you suggest (and it's
eminently
  reasonable!) I could have some 'bad stuff' becoming 'resident' in my
db.
  Perhaps I am paranoid, but that seems like a-bad-thing-to-do.
 
  Save it with newlines and don't add any HTML code to it. 
 
  Ahh . . . if I save as the user typed it, assuming Mr. Hacker has
added
  some little extras, what then?? I use a Preview mode for viewing
what
  thgey've entered, and they must go back  to the textarea box if they
 need
  to edit (which has exactly what they typed.)
 
  Oh, this all did sense to me a while ago, but I am tired, and it's
  beginning to sound like gibberish .
 
  Thanks again.
  Andre
 
 
 Things will be alright, if you follow two rules:
 
 1. before Output, use htmlentities() to make sure, your text isn't
 confused
 with HTML (This way noone can insert HTML-Tags into your Text).
 
 2. before saving to database, either use addslashes() or turn on
 magic_qoutes
 in php.ini. (This will ensure, that noone drops your database on the
fly.
 e.g. Enters something like '; drop database;' into a textarea.)
 as i remember magic_qoutes should be turned on by default.
 
 Don't do anything else with data that goes to your database, or you'll
 lose
 posibility to edit it later on.
 
 Regards
 Sascha
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




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




Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Sascha Cunz

 ?php
 /* db access using postgresql - each row is displayed */
 ...
 trtd{$myrow['request']}/td/tr
 ...
 ?

 Now unless I can do something like:

  trtd'nl2br({$myrow['request']}'/td/tr

Try something like

  echo 'trtd'.nl2br($myrow['request'].'/td/tr';

Regards Sascha

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




Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Andre Dubuc

On Saturday 28 September 2002 08:19 pm, Sascha Cunz wrote:
  Hi John,
 
  Sorry about the ambiguity. What I'm trying to accomplish is close to what
  you describe. However, before anything goes into the db (ie html chars,
  bad commands, or anything from Mr.Hacker), I verify it. Someone
  suggested, way back when I first started with textarea, to use
  'htmlentities' to strip the bad items out.
 
  You should always save it in the database exactly how the user typed
  it.
 
  So far, so good. But, if I follow what you suggest (and it's eminently
  reasonable!) I could have some 'bad stuff' becoming 'resident' in my db.
  Perhaps I am paranoid, but that seems like a-bad-thing-to-do.
 
  Save it with newlines and don't add any HTML code to it. 
 
  Ahh . . . if I save as the user typed it, assuming Mr. Hacker has added
  some little extras, what then?? I use a Preview mode for viewing what
  thgey've entered, and they must go back  to the textarea box if they need
  to edit (which has exactly what they typed.)
 
  Oh, this all did sense to me a while ago, but I am tired, and it's
  beginning to sound like gibberish .
 
  Thanks again.
  Andre

 Things will be alright, if you follow two rules:

 1. before Output, use htmlentities() to make sure, your text isn't confused
 with HTML (This way noone can insert HTML-Tags into your Text).

 2. before saving to database, either use addslashes() or turn on
 magic_qoutes in php.ini. (This will ensure, that noone drops your database
 on the fly. e.g. Enters something like '; drop database;' into a textarea.)
 as i remember magic_qoutes should be turned on by default.

 Don't do anything else with data that goes to your database, or you'll lose
 posibility to edit it later on.

 Regards
 Sascha

Hi Sascha,

Short question: following your advice, what would the data look like in the 
db if I typed in:

Hi Sascha.
Next line is doubled.

Double.

How would that appear iun the db? In mine, it looks exactly like I typed it 
above (using  1  2 with magic_quotes=on).

Regards,
Andre

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




Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Sascha Cunz

 Yeah, good catch on the addslash/magic_quote.

 Also, FYI: PHP will only allow you to do one query per mysql_query(). So
 you can't try to end a quote and then send another query. Don't know if
 this is the case for all database functions, or what...

Does PHP this? Such behaviour would be pretty new and pretty strange to me. 
And if, there must be any source in the source that does this, of which i 
can't remember...

Regards Sascha

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




[PHP] Need to get last element of 2-dimensional array

2002-09-28 Thread Phil Powell

The following produced a rather nasty parse error:

echo ($idArray[0][sizeof($idArray[0])]));

I have a 2-dimensional array $idArray that I must obtain the LAST element of that 
2-dimensional array.. how do I do it?

Thanx
Phil



RE: [PHP] Htmlentities and Newlines?

2002-09-28 Thread John W. Holmes



 -Original Message-
 From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, September 28, 2002 8:34 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PHP] Htmlentities and Newlines?
 
 On Saturday 28 September 2002 07:55 pm, John W. Holmes wrote:
   Sorry about the ambiguity. What I'm trying to accomplish is close
to
 
  what
 
   you
   describe. However, before anything goes into the db (ie html
chars,
 
  bad
 
   commands, or anything from Mr.Hacker), I verify it. Someone
suggested,
 
  way
 
   back when I first started with textarea, to use 'htmlentities' to
 
  strip
 
   the
   bad items out.
 
  It doesn't strip it, it just converts some characters to HTML code.
 
   You should always save it in the database exactly how the user
typed
 
  it.
 
   So far, so good. But, if I follow what you suggest (and it's
eminently
   reasonable!) I could have some 'bad stuff' becoming 'resident' in
my
 
  db.
 
   Perhaps I am paranoid, but that seems like a-bad-thing-to-do.
 
  Yes. The key is to display it with htmlentities(). Never display it
  directly.
 
   Save it with newlines and don't add any HTML code to it. 
  
   Ahh . . . if I save as the user typed it, assuming Mr. Hacker has
 
  added
 
   some
   little extras, what then?? I use a Preview mode for viewing what
 
  thgey've
 
   entered, and they must go back  to the textarea box if they need
to
 
  edit
 
   (which has exactly what they typed.)
 
  Again, you don't have to worry what's in there, as long as you
display
  it correctly.
 
  Now, if you know that these entries aren't going to be edited, then
you
  can do the conversion and save that. Unfortunately, there is no
  reversal to htmlentities. So, you can't run htmlentities on the
text
  and then hope to display it back to the user for editing. A  will
be
  lt;, and if you submit that and run html entities again, you'll
have
  amp;lt;. See where the problem is?
 
  So, basically, as long as your displaying the text correctly, use
the
  conversions when you display it. If you don't need to edit the text,
run
  the conversion before you put it in your database.
 
  Anyone disagree?
 
  ---John Holmes...
 
 
 Thanks John,
 
 It appears I was doing it 'somewhat' correctly since I haven't run
into
 the
 one-time-only problem with htmlentities. However, as I am only
displaying
 the
 text in Preview Mode, when they click 'Back' on their browser, they'll
see
 what they had just typed in. So, if they correct it, and click
Preview,
 it'll
 be a new process since the old 'Preview was not saved to session, but
is a
 'new' post (the old Preview was destroyed.)
 
 Still, since I'm pulling the saved info from the db, iterating through
all
 rows, and displaying it in table format, I can't get the linebreaks to
 display.  Here's the 'code' that displays the info:
 
 ?php
 /* db access using postgresql - each row is displayed */
 ...
 trtd{$myrow['request']}/td/tr
 ...
 ?

I assume that's being echo'd or something, like this?

echo trtd{$myrow['request']}/td/tr;

Then, you'd have to do this:

Echo trtd . nl2br(htmlentities($myrow['request'])) . /td/tr;

Does that clear it up?

---John Holmes...



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




Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Rasmus Lerdorf

  Yeah, good catch on the addslash/magic_quote.
 
  Also, FYI: PHP will only allow you to do one query per mysql_query(). So
  you can't try to end a quote and then send another query. Don't know if
  this is the case for all database functions, or what...

 Does PHP this? Such behaviour would be pretty new and pretty strange to me.
 And if, there must be any source in the source that does this, of which i
 can't remember...

Does PHP do what?  By default the MySQL query function can only take one
query at a time.  There is nothing strange about this.  The command-line
mysql tool can take multiple queries separated by semi-colons, but that is
something that is implemented in that command-line tool.  It is not done
in the underlying API function which is what PHP is talking to.

-Rasmus


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




Re: [PHP] Need to get last element of 2-dimensional array

2002-09-28 Thread Rasmus Lerdorf

Well, your nasty parse error is because you have 2 opening ( and 3 closing
) on that line.

A quick way to get the very last element of a 2-d array is to use:

  echo end(end($idArray));

-Rasmus

On Sat, 28 Sep 2002, Phil Powell wrote:

 The following produced a rather nasty parse error:

 echo ($idArray[0][sizeof($idArray[0])]));

 I have a 2-dimensional array $idArray that I must obtain the LAST element of that 
2-dimensional array.. how do I do it?

 Thanx
 Phil



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




Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Andre Dubuc

On Saturday 28 September 2002 08:32 pm, John W. Holmes wrote:
  -Original Message-
  From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
  Sent: Saturday, September 28, 2002 8:34 PM
  To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Subject: Re: [PHP] Htmlentities and Newlines?
 
  On Saturday 28 September 2002 07:55 pm, John W. Holmes wrote:
Sorry about the ambiguity. What I'm trying to accomplish is close

 to

   what
  
you
describe. However, before anything goes into the db (ie html

 chars,

   bad
  
commands, or anything from Mr.Hacker), I verify it. Someone

 suggested,

   way
  
back when I first started with textarea, to use 'htmlentities' to
  
   strip
  
the
bad items out.
  
   It doesn't strip it, it just converts some characters to HTML code.
  
You should always save it in the database exactly how the user

 typed

   it.
  
So far, so good. But, if I follow what you suggest (and it's

 eminently

reasonable!) I could have some 'bad stuff' becoming 'resident' in

 my

   db.
  
Perhaps I am paranoid, but that seems like a-bad-thing-to-do.
  
   Yes. The key is to display it with htmlentities(). Never display it
   directly.
  
Save it with newlines and don't add any HTML code to it. 
   
Ahh . . . if I save as the user typed it, assuming Mr. Hacker has
  
   added
  
some
little extras, what then?? I use a Preview mode for viewing what
  
   thgey've
  
entered, and they must go back  to the textarea box if they need

 to

   edit
  
(which has exactly what they typed.)
  
   Again, you don't have to worry what's in there, as long as you

 display

   it correctly.
  
   Now, if you know that these entries aren't going to be edited, then

 you

   can do the conversion and save that. Unfortunately, there is no
   reversal to htmlentities. So, you can't run htmlentities on the

 text

   and then hope to display it back to the user for editing. A  will

 be

   lt;, and if you submit that and run html entities again, you'll

 have

   amp;lt;. See where the problem is?
  
   So, basically, as long as your displaying the text correctly, use

 the

   conversions when you display it. If you don't need to edit the text,

 run

   the conversion before you put it in your database.
  
   Anyone disagree?
  
   ---John Holmes...
 
  Thanks John,
 
  It appears I was doing it 'somewhat' correctly since I haven't run

 into

  the
  one-time-only problem with htmlentities. However, as I am only

 displaying

  the
  text in Preview Mode, when they click 'Back' on their browser, they'll

 see

  what they had just typed in. So, if they correct it, and click

 Preview,

  it'll
  be a new process since the old 'Preview was not saved to session, but

 is a

  'new' post (the old Preview was destroyed.)
 
  Still, since I'm pulling the saved info from the db, iterating through

 all

  rows, and displaying it in table format, I can't get the linebreaks to
  display.  Here's the 'code' that displays the info:
 
  ?php
  /* db access using postgresql - each row is displayed */
  ...
  trtd{$myrow['request']}/td/tr
  ...
  ?

 I assume that's being echo'd or something, like this?

 echo trtd{$myrow['request']}/td/tr;

 Then, you'd have to do this:

 Echo trtd . nl2br(htmlentities($myrow['request'])) . /td/tr;

 Does that clear it up?

 ---John Holmes...

Well, if it works. I just assumed you couldn't manipulate this line. I'm not 
thinking too clearly -- long day since 6 am!

Thanks John, Sascha,  Dan.
Regards,
Andre

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




RE: [PHP] Htmlentities and Newlines?

2002-09-28 Thread John W. Holmes

 Short question: following your advice, what would the data look like
in
 the
 db if I typed in:
 
   Hi Sascha.
   Next line is doubled.
 
   Double.
 
 How would that appear iun the db? In mine, it looks exactly like I
typed
 it
 above (using  1  2 with magic_quotes=on).

It depends on your viewer, I guess. It may appear as though it's all on
one line, but the new lines are there, regardless. Htmlentities()
doesn't do anything to linebreaks...

---John Holmes...



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




RE: [PHP] Smarty template question

2002-09-28 Thread Matt Giddings



 -Original Message-
 From: Peter J. Schoenster [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, September 28, 2002 5:25 PM
 To: [EMAIL PROTECTED]
 Cc: Matt Giddings
 Subject: Re: [PHP] Smarty template question
 
 
 
 On 28 Sep 2002 at 15:48, Matt Giddings wrote:
 
  Hello,
 
   Be for warned that I am new to smarty and for some reason I'm
  finding it very difficult to learn.  ???  Anyway, my question is how
do
  I access an array of associative arrays via the {section} statement?
 
  Heres the code:
 
 Matt,
 
 I suggest you break your code down to the simplest possible. Too many
 factors in there for my taste.  FWIW, I had to bang my head a few
times
 to get it and still have to verify my assumptions. For some reason I
 took to Template::Toolkit rather fast but smarty is working fine for
 me.
 
 Here are a few notes, but I'm fairly new to PHP so caution.
 
 First, totally unrelated to your question:
 
  Function readComment( $smarty, $bid ) {
 
 In Perl and in PHP I have my classes ONLY manipulate data and return
 data to the handerl which then passes it off to what I call the
 viewer. In this way, in Perl for instance, I can use more than one
 template system as I create a class for each template system and
 manipulate the data as needed for that system. Works like a charm. In
 this way you can use the code in your classes for manythings ... it's
 not tied to your output.  Also, now some might complain that this
might
 be slower or take more memory or whatever, but I do this with smarty:


That does sound like a better and more logical approach.  I think I'll
incorporate that into my code.


 $data = $g-run($com,$fid);
 
 $data is an array of data returned by my functions.
 $data['content'] = $g-viewer-Merge($data,$template);
 
 print $g-viewer-Merge($data,'index.html');
 
 So I *wrap* the content of pages into a page which pulls in
 header/footer rather than having a header/footer in every page.
 
 Okay, back to your qeustion:
 
 
while( $row = $result-fetchRow( DB_FETCHMODE_ASSOC ) ) {
  $rowdata[$i] = $row;
  $i++;
 
 I don't think you need the $i.

  I need the $i because I'm assigning the every row from the result into
an array.


 Are you sure you have data in $rowdata?


  Yup, $rowdata is filled with data, and the right data at that. :)


 Your use of section looks good to me. You've got those if statements.
 Sure they are all true.


This one might be my downfall, I'll have to dig into this one a bit
more.


 I'm using section in lots of stuff and it's working fine.
 
 When I run into trouble I work from the most basic, the simplest and
 then move up.
 
 Peter

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.391 / Virus Database: 222 - Release Date: 9/19/2002
 


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




Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Andre Dubuc

On Saturday 28 September 2002 08:42 pm, John W. Holmes wrote:
  Short question: following your advice, what would the data look like

 in

  the
  db if I typed in:
 
  Hi Sascha.
  Next line is doubled.
 
  Double.
 
  How would that appear iun the db? In mine, it looks exactly like I

 typed

  it
  above (using  1  2 with magic_quotes=on).

 It depends on your viewer, I guess. It may appear as though it's all on
 one line, but the new lines are there, regardless. Htmlentities()
 doesn't do anything to linebreaks...

 ---John Holmes...

Hi John,

Tried that 

Echo trtd . nl2br(htmlentities($myrow['request'])) . and it appears 
exactly as it is written (as part of the text request). Maybe if I try again 
Monday with a fresh mind, I might discover what I'm doing wrong.

I'll keep hacking at this.
Thanks for your help.
Andre

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




Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Sascha Cunz

 Does PHP do what?  By default the MySQL query function can only take one
 query at a time.  There is nothing strange about this.  The command-line
 mysql tool can take multiple queries separated by semi-colons, but that is
 something that is implemented in that command-line tool.  It is not done
 in the underlying API function which is what PHP is talking to.

 -Rasmus

Oops. I just tried it myself, you're right in this. 

Sascha

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




RE: [PHP] Htmlentities and Newlines?

2002-09-28 Thread John W. Holmes



 -Original Message-
 From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, September 28, 2002 9:00 PM
 To: [EMAIL PROTECTED]; 'Sascha Cunz'; [EMAIL PROTECTED]
 Subject: Re: [PHP] Htmlentities and Newlines?
 
 On Saturday 28 September 2002 08:42 pm, John W. Holmes wrote:
   Short question: following your advice, what would the data look
like
 
  in
 
   the
   db if I typed in:
  
 Hi Sascha.
 Next line is doubled.
  
 Double.
  
   How would that appear iun the db? In mine, it looks exactly like I
 
  typed
 
   it
   above (using  1  2 with magic_quotes=on).
 
  It depends on your viewer, I guess. It may appear as though it's all
on
  one line, but the new lines are there, regardless. Htmlentities()
  doesn't do anything to linebreaks...
 
  ---John Holmes...
 
 Hi John,
 
 Tried that
 
 Echo trtd . nl2br(htmlentities($myrow['request'])) . and it
appears
 exactly as it is written (as part of the text request). Maybe if I try
 again
 Monday with a fresh mind, I might discover what I'm doing wrong.

?? Umm..that's what should happen. It's not exact, mind you, it just
looks the same in the browser. Any  you had was converted to lt;, but
you'd have to look at the source. A newline should now have a br /
along with it... Is that not happening?

---John Holmes...



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




[PHP] Help! Can't set cookie or redirect!!!

2002-09-28 Thread Phil Powell

I am getting the following errors attempting to set a cookie and redirect:

Warning: Cannot add header information - headers already sent by (output started at 
/users/ppowell/web/my/process.php:5) in /users/ppowell/web/my/process.php on line 76

Warning: Cannot add header information - headers already sent by (output started at 
/users/ppowell/web/my/process.php:5) in /users/ppowell/web/my/process.php on line 77


Lines:

   setcookie(valLayout, $id, time()+3600*24*30*12*100, $SERVER_NAME); // WILL EXPIRE 
IN 100 YEARS.. UM YEAH
header(Location:  . $HTTP_POST_VARS[refURL]);

The first time I ran this script it set the cookie just fine; subsequent runnings of 
this script produce this error.  What am I doing wrong, anyone?

Thanx
Phil



Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Andre Dubuc

On Saturday 28 September 2002 08:59 pm, John W. Holmes wrote:
  -Original Message-
  From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
  Sent: Saturday, September 28, 2002 9:00 PM
  To: [EMAIL PROTECTED]; 'Sascha Cunz'; [EMAIL PROTECTED]
  Subject: Re: [PHP] Htmlentities and Newlines?
 
  On Saturday 28 September 2002 08:42 pm, John W. Holmes wrote:
Short question: following your advice, what would the data look

 like

   in
  
the
db if I typed in:
   
Hi Sascha.
Next line is doubled.
   
Double.
   
How would that appear iun the db? In mine, it looks exactly like I
  
   typed
  
it
above (using  1  2 with magic_quotes=on).
  
   It depends on your viewer, I guess. It may appear as though it's all

 on

   one line, but the new lines are there, regardless. Htmlentities()
   doesn't do anything to linebreaks...
  
   ---John Holmes...
 
  Hi John,
 
  Tried that
 
  Echo trtd . nl2br(htmlentities($myrow['request'])) . and it

 appears

  exactly as it is written (as part of the text request). Maybe if I try
  again
  Monday with a fresh mind, I might discover what I'm doing wrong.

 ?? Umm..that's what should happen. It's not exact, mind you, it just
 looks the same in the browser. Any  you had was converted to lt;, but
 you'd have to look at the source. A newline should now have a br /
 along with it... Is that not happening?

 ---John Holmes...


Nope. In the db I see it as it's displayed on-screen without any br etc.
Strangely, before I attempted to use htmlentities, in the db, I'd see text 
like:

This linebris broken in two.brbrBefore this line is a double space.

Now I see:

This line
is broken in two.

Before this line is a double space.

I just KNOW I'm messing up here -- but where???

Andre

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




RE: [PHP] Help! Can't set cookie or redirect!!!

2002-09-28 Thread John W. Holmes

You can only set a cookie before any output is send to the browser. A
newline, space, or html, etc, is output to the browser. Redesign your
code so the cookie is set before any output or use output buffering.

---John Holmes...

 -Original Message-
 From: Phil Powell [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, September 28, 2002 9:03 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: [PHP] Help! Can't set cookie or redirect!!!
 
 I am getting the following errors attempting to set a cookie and
redirect:
 
 Warning: Cannot add header information - headers already sent by
(output
 started at /users/ppowell/web/my/process.php:5) in
 /users/ppowell/web/my/process.php on line 76
 
 Warning: Cannot add header information - headers already sent by
(output
 started at /users/ppowell/web/my/process.php:5) in
 /users/ppowell/web/my/process.php on line 77
 
 
 Lines:
 
setcookie(valLayout, $id, time()+3600*24*30*12*100,
$SERVER_NAME); //
 WILL EXPIRE IN 100 YEARS.. UM YEAH
 header(Location:  . $HTTP_POST_VARS[refURL]);
 
 The first time I ran this script it set the cookie just fine;
subsequent
 runnings of this script produce this error.  What am I doing wrong,
 anyone?
 
 Thanx
 Phil



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




RE: [PHP] Htmlentities and Newlines?

2002-09-28 Thread John W. Holmes



 -Original Message-
 From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, September 28, 2002 9:14 PM
 To: [EMAIL PROTECTED]; 'Sascha Cunz'; [EMAIL PROTECTED]
 Subject: Re: [PHP] Htmlentities and Newlines?
 
 On Saturday 28 September 2002 08:59 pm, John W. Holmes wrote:
   -Original Message-
   From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
   Sent: Saturday, September 28, 2002 9:00 PM
   To: [EMAIL PROTECTED]; 'Sascha Cunz';
[EMAIL PROTECTED]
   Subject: Re: [PHP] Htmlentities and Newlines?
  
   On Saturday 28 September 2002 08:42 pm, John W. Holmes wrote:
 Short question: following your advice, what would the data
look
 
  like
 
in
   
 the
 db if I typed in:

   Hi Sascha.
   Next line is doubled.

   Double.

 How would that appear iun the db? In mine, it looks exactly
like I
   
typed
   
 it
 above (using  1  2 with magic_quotes=on).
   
It depends on your viewer, I guess. It may appear as though it's
all
 
  on
 
one line, but the new lines are there, regardless.
Htmlentities()
doesn't do anything to linebreaks...
   
---John Holmes...
  
   Hi John,
  
   Tried that
  
   Echo trtd . nl2br(htmlentities($myrow['request'])) . and it
 
  appears
 
   exactly as it is written (as part of the text request). Maybe if I
try
   again
   Monday with a fresh mind, I might discover what I'm doing wrong.
 
  ?? Umm..that's what should happen. It's not exact, mind you, it just
  looks the same in the browser. Any  you had was converted to lt;,
but
  you'd have to look at the source. A newline should now have a br /
  along with it... Is that not happening?
 
  ---John Holmes...
 
 
 Nope. In the db I see it as it's displayed on-screen without any br
etc.
 Strangely, before I attempted to use htmlentities, in the db, I'd see
text
 like:
 
   This linebris broken in two.brbrBefore this line is a
double
 space.
 
 Now I see:
 
   This line
   is broken in two.
 
   Before this line is a double space.
 
 I just KNOW I'm messing up here -- but where???
 
 Andre

OK...I think you are confused. :)

That's what you should see in the database. You are seeing text,
newline, text, two newlines, and text. That's what should be in the
database.

Now, when you pull that out, and run nl2br() on it, it'll show up like
this, in the source of the html output:

This linebr /
Is broken in twobr /
br /
Before this line is a double space.

Bottom line !!! :

Store the data exactly as the user typed it.

Display the data using nl2br(htmlentities($text)).

OK?

---John Holmes...



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




[PHP] Session Not Saving?

2002-09-28 Thread Stephen Craton

I'm having another problem with my member's area script. When someone
logs in, it's supposed to register their username into a session and it
displays fine on the first page. But once you navigate to another part
of the area, it does not tell you you are logged in, instead it gives me
the error I set it to give You are  not logged in. Here's the code
that checks to see if the user is valid:

function check_valid()
{
  global $valid_user;
  if (session_is_registered(valid_user))
  {
  echo font size='2'Welcome $valid_user!/font;
  }
  else
  {
 echo You are not logged in.;
 exit;
  }  
}

Here's the code that's supposed to save the session:

include_once(funcs.php);
session_start();
if($user  $pass)
{
if(login($user, $pass))
{
$valid_user = $user;
session_register(valid_user);
}
else
{
echo font face='Arial, Helvetica, sans-serif'
size='3'centerbYou supplied an invalid username and password combo.
Try again please./b/center;
exit;
}
}

Please help again!!!

Thanks,
Stephen
http://www.melchior.us
http://php.melchior.us



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




Re: [PHP] Htmlentities and Newlines?

2002-09-28 Thread Andre Dubuc

On Saturday 28 September 2002 09:13 pm, John W. Holmes wrote:
  -Original Message-
  From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
  Sent: Saturday, September 28, 2002 9:14 PM
  To: [EMAIL PROTECTED]; 'Sascha Cunz'; [EMAIL PROTECTED]
  Subject: Re: [PHP] Htmlentities and Newlines?
 
  On Saturday 28 September 2002 08:59 pm, John W. Holmes wrote:
-Original Message-
From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
Sent: Saturday, September 28, 2002 9:00 PM
To: [EMAIL PROTECTED]; 'Sascha Cunz';

 [EMAIL PROTECTED]

Subject: Re: [PHP] Htmlentities and Newlines?
   
On Saturday 28 September 2002 08:42 pm, John W. Holmes wrote:
  Short question: following your advice, what would the data

 look

   like
  
 in

  the
  db if I typed in:
 
  Hi Sascha.
  Next line is doubled.
 
  Double.
 
  How would that appear iun the db? In mine, it looks exactly

 like I

 typed

  it
  above (using  1  2 with magic_quotes=on).

 It depends on your viewer, I guess. It may appear as though it's

 all

   on
  
 one line, but the new lines are there, regardless.

 Htmlentities()

 doesn't do anything to linebreaks...

 ---John Holmes...
   
Hi John,
   
Tried that
   
Echo trtd . nl2br(htmlentities($myrow['request'])) . and it
  
   appears
  
exactly as it is written (as part of the text request). Maybe if I

 try

again
Monday with a fresh mind, I might discover what I'm doing wrong.
  
   ?? Umm..that's what should happen. It's not exact, mind you, it just
   looks the same in the browser. Any  you had was converted to lt;,

 but

   you'd have to look at the source. A newline should now have a br /
   along with it... Is that not happening?
  
   ---John Holmes...
 
  Nope. In the db I see it as it's displayed on-screen without any br

 etc.

  Strangely, before I attempted to use htmlentities, in the db, I'd see

 text

  like:
 
  This linebris broken in two.brbrBefore this line is a

 double

  space.
 
  Now I see:
 
  This line
  is broken in two.
 
  Before this line is a double space.
 
  I just KNOW I'm messing up here -- but where???
 
  Andre

 OK...I think you are confused. :)

 That's what you should see in the database. You are seeing text,
 newline, text, two newlines, and text. That's what should be in the
 database.

 Now, when you pull that out, and run nl2br() on it, it'll show up like
 this, in the source of the html output:

 This linebr /
 Is broken in twobr /
 br /
 Before this line is a double space.

 Bottom line !!! :

 Store the data exactly as the user typed it.

 Display the data using nl2br(htmlentities($text)).

 OK?

 ---John Holmes...


Yup. Got it.

Thnaks again,
Andre

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




  1   2   >