[PHP] PHP templeate and client JavaScript.

2002-04-14 Thread Peter Ruan

Hi,
  I'm not sure if this belongs to JavaScript or PHP section.  I'm
running into problems when I'm trying to use php templates with embeded
JavaScript.
  In my template file, I have something like...

script language=JavaScript


function Show()
{
  if(layer) {
   if(timer) {
 clearTimeout(timer);
   }
   for(menu=0; menuLayer.length; menu++) {
  if(Layer[menu]) {
eval(layer).visibility = hidden;
  }
   }
for(i=0; iarguments.length; i++) {
 menu=arguments[i];
eval(layer).visibility = visible;
}
  }
}

/script

  When I instantiate the template in my PHP file and do a view source, I
get this instead:

script language=JavaScript


function Show()

   for(menu=0; menuLayer.length; menu++)
   }
for(i=0; iarguments.length; i++)
  }
}

/script


As you can see, the all the 'if' statements are missing?  Why is that?

Thanks,
-Peter




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




[PHP] Re: PHPTriad Error in Windows XP.

2002-03-25 Thread Peter Ruan

I did started MySQL server first.
Avdija A . Ahmedhodzic [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 In article [EMAIL PROTECTED],
[EMAIL PROTECTED]
 says...
  Hi,
I installed PHPTriad under Windows XP and I keep gettting the
  following error:
 
  Warning: MySQL Connection Failed: Can't connect to MySQL server on
  'localhost' (10061) in C:\apache\htdocs\phpmyadmin\lib.inc.php on
line
  255
 
 
  It worked before under Windows ME.  WinMySQLadmin1.0 works fine as
well
  as MySQL when I ran it in the cmd-line mode.  What's the remedy?
 
  Thanks in advance,
  -Peter
 
 
 
 you should start MySQL first.
 --
 Prevencija putem edukacije
 http://www.narkomanija.com/



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




[PHP] PHPTriad error in Windows XP.

2002-03-23 Thread Peter Ruan

Hi,
  I installed PHPTriad under Windows XP and I keep getting this error:




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




[PHP] PHPTriad Error in Windows XP.

2002-03-23 Thread Peter Ruan

Hi,
  I installed PHPTriad under Windows XP and I keep gettting the
following error:

Warning: MySQL Connection Failed: Can't connect to MySQL server on
'localhost' (10061) in C:\apache\htdocs\phpmyadmin\lib.inc.php on line
255


It worked before under Windows ME.  WinMySQLadmin1.0 works fine as well
as MySQL when I ran it in the cmd-line mode.  What's the remedy?

Thanks in advance,
-Peter



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




[PHP] MySQL question...not sure if this is the correct forum to ask.

2002-02-14 Thread Peter Ruan

Hi,
  I have a quick MySQL question...if this is not the correct forum for
it, then someone please point me to the right one.

  Can the UPDATE statement have conditional check embedded in it?  I
have a page that displays a record (in a FORM format) that the user can
change the information on each column.  I want to check each column and
see which has been changed and update the table for entries that were
changed only.

for each column data {
  if column is changed
  then update;
  else
  do nothing;
}

Maybe I am making this too complicated than it needs and just go ahead
and update all of the columns regardless with the new values, regardless
they are actually different or not.

Thanks in advance,
-Peter




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




[PHP] array variable passing in session.

2002-02-07 Thread Peter Ruan

Hi,
  I am running into a problem that I can't figure out the solution to.  So
I'm hoping that someone can give me some pointers here.  I have two files
(see below):  verify.php and edit.php
  The job of verify.php is basically to verify that a user is in the
database before allowing him/her to edit the information.  The information
retrieved is saved to arrary varaiable $row.  I do a session_register() to
$row and that information should be passed to subsequent pages that has
session_start(), right?  However, when I tried to print out the information
again in edit.php, it doesn't seem to register it in.  At first I thought it
was the array problem, so I put the array variable $dummy to test it out and
that can be reigstered and retrieved correctly.  What am I doing wrong???
Also, how do I redirect to a page automatically once the user is verfied
(right now I have to ask the user to click on a link to redirect).

Thanks in advance,
Peter

/*** verify.php /
?php
   session_start();

include(config.php);
mysql_connect($host_name, $user_name, $passwd)
  or die(Unable to connect to $hostname.);
// select database on MySQL server
mysql_select_db($db_name) or die(Unable to select databse.);

// formulate the query
$sql_statement = SELECT * FROM $table_name WHERE
   user_id  = '$user_id' AND
  password = '$password';

$result = mysql_query($sql_statement) or die(Unable to execute
query.);

$num_of_rows = mysql_num_rows($result);
/* XXX: test array variable...take out later */
$dummy = array(one, two, three);
session_register(dummy);

if (!$num_of_rows) {
echo h3User ID and password missmatch, try again!/h3;
} else {
while ($row = mysql_fetch_array($result)) {
   session_register(row);  // register information retrieved from
MySQL
}
printf(Successfully Logged In! a href=\edit.php\Click
Here/a);
echo br;
}
?


/* edit.php */
?php
session_start();
foreach ($dummy as $val) {
echo $val . br;
}

foreach ($row as $data) {
echo $data . br;
}
?



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




[PHP] Re: How to Configure the MySql Database?

2002-02-07 Thread Peter Ruan

Hi,
  I recommend using a nice program call PHPTriad.  It's painless and you
don't have to worry about anything.  The only downside is that it cofigures
PHP as CGI module only.

-Peter
Karadamoglou Kostas [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
I don't know to configure MySql Database On Apache Server in Windows System.
What I must do? (step by step)




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




[PHP] Re: array variable passing in session.

2002-02-07 Thread Peter Ruan

Hi Joe,
  The record has other information as well, names, phone, and etc.  I like
to store everything in an array and reference to it later.  That way I don't
have to do another mysql_xxx() later for the subsequent pages...that should
save sometime, right?
  The problem has gone away once I switched back to good old Linux.  The
same code works now for both Linux and Windows...I still don't know why it
didn't work in the first place...probably the 'reliable' Windows has
something to do with it. :-)

Thanks,
Peter

Joe Van Meer [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi Peter, are you limited to using arrays? If not, try  msql_fetch_row()
 since you are only looking for the one record, ie: the corresponding
 username and password record for the username and password that was
passed.

 Hope this helps, Joe :)

  ?php
 session_start();

  include(config.php);
  mysql_connect($host_name, $user_name, $passwd)
or die(Unable to connect to $hostname.);
  // select database on MySQL server
  mysql_select_db($db_name) or die(Unable to select databse.);

  // formulate the query
  $sql_statement = SELECT user_id, password FROM $table_name WHERE
 user_id  = '$user_id' AND
password = '$password';

  $result = mysql_query($sql_statement) or die(Unable to execute
 query.);

 //if there is a corresponding record
 if(mysql_fetch_row($result)) {


 $usid = mysql_result($result,0);
  $pswd = mysql_result($result, 1);


 //create session variables

 session_register(password);
 $password = $pswd;

 session_register(user_id);
 $username = $usid;


 //echo a friendly message or use header() function to redirect the user to
 the appropriate page
 echo Succesful login!;
 }
 else
 {
 //the user is not a registered member so redirect them to a sign up page
or
 another page to try and login again
 header(Location: signup.php);

 }

 ?





 Peter Ruan [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi,
I am running into a problem that I can't figure out the solution to.
So
  I'm hoping that someone can give me some pointers here.  I have two
files
  (see below):  verify.php and edit.php
The job of verify.php is basically to verify that a user is in the
  database before allowing him/her to edit the information.  The
information
  retrieved is saved to arrary varaiable $row.  I do a session_register()
to
  $row and that information should be passed to subsequent pages that has
  session_start(), right?  However, when I tried to print out the
 information
  again in edit.php, it doesn't seem to register it in.  At first I
thought
 it
  was the array problem, so I put the array variable $dummy to test it out
 and
  that can be reigstered and retrieved correctly.  What am I doing
wrong???
  Also, how do I redirect to a page automatically once the user is verfied
  (right now I have to ask the user to click on a link to redirect).
 
  Thanks in advance,
  Peter
 
  /*** verify.php /
  ?php
 session_start();
 
  include(config.php);
  mysql_connect($host_name, $user_name, $passwd)
or die(Unable to connect to $hostname.);
  // select database on MySQL server
  mysql_select_db($db_name) or die(Unable to select databse.);
 
  // formulate the query
  $sql_statement = SELECT * FROM $table_name WHERE
 user_id  = '$user_id' AND
password = '$password';
 
  $result = mysql_query($sql_statement) or die(Unable to execute
  query.);
 
  $num_of_rows = mysql_num_rows($result);
  /* XXX: test array variable...take out later */
  $dummy = array(one, two, three);
  session_register(dummy);
 
  if (!$num_of_rows) {
  echo h3User ID and password missmatch, try again!/h3;
  } else {
  while ($row = mysql_fetch_array($result)) {
 session_register(row);  // register information retrieved
from
  MySQL
  }
  printf(Successfully Logged In! a href=\edit.php\Click
  Here/a);
  echo br;
  }
  ?
 
 
  /* edit.php */
  ?php
  session_start();
  foreach ($dummy as $val) {
  echo $val . br;
  }
 
  foreach ($row as $data) {
  echo $data . br;
  }
  ?
 
 





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




Re: [PHP] Problem...header already sent by

2002-02-05 Thread Peter Ruan

Hi Jason,
  Yeap, I ran 'phpinfo()' Server API=CGI.  I look at the manual and you are
right, I must run it as Apache module.  Can someone tell me how do I change
the setting to run as an APACHE module instead?

Thanks,
-Peter

Jason Wong [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 On Tuesday 05 February 2002 15:20, Peter wrote:
  Hi Ryan,
Thanks for the examples.  Okay, I deleted the other stuff and just put
  this code and I get this from
  my interpreter?  Is this a setting problem?


 Are you running PHP as a CGI? If so, what you want to do cannot be done.
See
 chapter HTTP authentication with PHP.


 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk

 /*
 You will triumph over your enemy.
 */



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




Re: [PHP] Problem...header already sent by

2002-02-05 Thread Peter Ruan

Ryan,
   I just tried it with my Linux box and I get the authentication 
box...which is good sign.  So it looks like a PHP in MS Windows (the 
'fabulous' windows) setting which from the error.log file indicates as well.

/** error message listed in error.log **/
[Mon Feb 04 22:36:30 2002] [error] [client 127.0.0.1] malformed header 
from script. Bad header=HTTP/1.0 401 Unauthorized: /apache/php/php.exe


In looks like a setting problem in some .ini file.  Do you know how to 
correct this problem?

Thanks for the help!
-Peter






Ryan F. Bayhonan wrote:

 It will work as expected Peter.
 
 ?php
 header (WWW-authenticate: Basic realm=\Private\);
 header (HTTP/1.0 401 Unauthorized);
 echo Unauthorized;
 exit;
 ?
 
 So where do we go from here??
 
 Ryan
 
 
 


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




Re: [PHP] Problem...header already sent by

2002-02-04 Thread Peter Ruan


I tried it w/o the html tag and I get the BAD Header message.

-Peter

From: Jeff Sheltren [EMAIL PROTECTED]
To: Peter Run [EMAIL PROTECTED],[EMAIL PROTECTED]
Subject: Re: [PHP] Problem...header already sent by
Date: Mon, 04 Feb 2002 21:30:42 -0800

You can't send anything before you send headers...  the html tag is
messing you up I believe.

Jeff

At 08:24 PM 2/4/2002 -0800, Peter Run wrote:
Hi,
   I get the warning message (see below), whenever I try anything with
authentication/session with PHP.  This is tried under Windows (PHPTriad).  
I
get the same message with my Linux drive as well.  I appreciate your help.
Please reply here and cc: to my personal email [EMAIL PROTECTED]

Thanks in advance,
-Peter
**
Warning: Cannot add header information - headers already sent by (output
started at C:\apache\htdocs\proj\sports\phps\verify.php:2) in
C:\apache\htdocs\proj\sports\phps\verify.php on line 26
***

1. html
2. ?php
 


  23.   if (!$auth) {
  24.  header(www-Authenticate: Basic realm='Private');
  25.  header(HTTP/1.0 401 Unauthrized);
...
?
/html






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






_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


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




Re: [PHP] Problem...header already sent by

2002-02-04 Thread Peter Ruan

Okay, I deleted the other stuff and just put this code and I get this from
my interpreter?  Is this a setting problem?

Thanks,
Peter

Niklas lampén [EMAIL PROTECTED] wrote in message
007701c1ae09$1bde80b0$ba93c5c3@Niklas">news:007701c1ae09$1bde80b0$ba93c5c3@Niklas...
 There can't be _anything_ before headers. Even a single space and/or
 linebreak causes an error.


 Niklas


 -Original Message-
 From: Peter Ruan [mailto:[EMAIL PROTECTED]]
 Sent: 5. helmikuuta 2002 7:42
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PHP] Problem...header already sent by



 I tried it w/o the html tag and I get the BAD Header message.

 -Peter

 From: Jeff Sheltren [EMAIL PROTECTED]
 To: Peter Run [EMAIL PROTECTED],[EMAIL PROTECTED]
 Subject: Re: [PHP] Problem...header already sent by
 Date: Mon, 04 Feb 2002 21:30:42 -0800
 
 You can't send anything before you send headers...  the html tag is
 messing you up I believe.
 
 Jeff
 
 At 08:24 PM 2/4/2002 -0800, Peter Run wrote:
 Hi,
I get the warning message (see below), whenever I try anything with

 authentication/session with PHP.  This is tried under Windows
 (PHPTriad).
 I
 get the same message with my Linux drive as well.  I appreciate your
 help.
 Please reply here and cc: to my personal email [EMAIL PROTECTED]
 
 Thanks in advance,
 -Peter
 **
 Warning: Cannot add header information - headers already sent by
 (output started at C:\apache\htdocs\proj\sports\phps\verify.php:2) in
 C:\apache\htdocs\proj\sports\phps\verify.php on line 26
 ***
 
 1. html
 2. ?php
  
 
 
   23.   if (!$auth) {
   24.  header(www-Authenticate: Basic realm='Private');
   25.  header(HTTP/1.0 401 Unauthrized);
 ...
 ?
 /html
 
 
 
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 




 _
 Chat with friends online, try MSN Messenger: http://messenger.msn.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] Problem...header already sent by

2002-02-04 Thread Peter Ruan

Okay, I deleted the other stuff and just put this code and I get this from
my interpreter?  Is this a setting problem?

Thanks,
Peter

?php
Header (WWW-authenticate: Basic realm=\Private\);
Header (HTTP/1.0 401 Unauthorized);
echo Unauthorized;
exit;
?

[Mon Feb 04 22:36:30 2002] [error] [client 127.0.0.1] malformed header from
script. Bad header=HTTP/1.0 401 Unauthorized: /apache/php/php.exe

Niklas lampén [EMAIL PROTECTED] wrote in message
007701c1ae09$1bde80b0$ba93c5c3@Niklas">news:007701c1ae09$1bde80b0$ba93c5c3@Niklas...
 There can't be _anything_ before headers. Even a single space and/or
 linebreak causes an error.


 Niklas




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