[PHP] update entries in a table

2002-04-12 Thread Norman Zhang

Hi,

How do I update entries in MySQL? Say for example, I checked some fields to
a table, and decided to make update to a particular field. How do I do that
in PHP?

Regards,
Norman



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




Re: [PHP] update entries in a table

2002-04-12 Thread Norman Zhang

Thank you so much.

Norman




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




[PHP] session_is_registered

2002-04-12 Thread Norman Zhang

Hi,

If I have register_globals=off, how do I pass session variables? I tried
session_register(var1). session_is_registered(var1) appears successful,
but if I tried to echo the $var1. Nothing shows. How do I pass session
variables?

Thanks,
Norman



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




Re: [PHP] session_is_registered

2002-04-12 Thread Norman Zhang

Sorry it still does not work. Can it be because I have HEADER(Location: ...)
redirection after the session_registered('var1')?

Regards,
Norman

Oliver Beddows [EMAIL PROTECTED] wrote in message
20020412235134.QNTP29761.mta05-svc.ntlworld.com@there">news:20020412235134.QNTP29761.mta05-svc.ntlworld.com@there...
On Saturday 13 April 2002 12:01 am, you wrote:
 Hi,

 If I have register_globals=off, how do I pass session variables? I tried
 session_register(var1). session_is_registered(var1) appears
successful,
 but if I tried to echo the $var1. Nothing shows. How do I pass session
 variables?

 Thanks,
 Norman

Try this:
?php echo($_SESSION['var1']); ?

Also read the manual for more information on session handling functions.
http://www.php.net/manual/en/ref.session.php

Regards,
Oliver.



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




[PHP] upload file size

2002-07-05 Thread Norman Zhang

Hi,

I can't seem to upload file bigger than 5M even if I set the
upload_max_filesize to 20M in php.ini and MAX_FILE_SIZE to 20M in the
script. What's am I missing here? Is the temporary upload directory won't
handle file this size? Please give me some pointers here. TIA.

Regards,
Norman



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




[PHP] Re: GD Lib

2002-07-08 Thread Norman Zhang

Check out

http://rpmfind.net/linux/rpm2html/search.php?query=php-gdsubmit=Search+...;
system=arch=

Yang [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 can't find the php-gd.so on my computer.




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




Re: [PHP] session_is_registered

2002-04-16 Thread Norman Zhang

Sorry. I'm still getting empty output. Are there some global variables that
I must set in php.ini? phpinfo() tells me that I have

register_globals  off
Session Support   enabled
session.auto_startoff
session.cache_limiter nocache
session.cookie_secure off

Regards,
Norman


Oliver Beddows [EMAIL PROTECTED] wrote in message
20020413004351.CMCX20036.mta06-svc.ntlworld.com@there">news:20020413004351.CMCX20036.mta06-svc.ntlworld.com@there...
Sorry...I must get some sleep.

?php
session_start();

$barney = A big purple dinosaur;
session_register(barney);

session_write_close();

// Redirect after session data has been written.
header('Location: /');
exit;
?

?php
// Another page...
session_start(); // Not sure if you need this function call.
// Try either one of these to echo the session var.
echo($_SESSION['barney']);
echo($HTTP_SESSION_VARS['barney']);
?

Regards,
Oliver




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




[PHP] Re: session_is_registered

2002-04-17 Thread Norman Zhang

Thanks everyone. I solved the problem by upgrading 4.0.6 to 4.1.2.

Norman



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




[PHP] difference between $foo and isset($foo)

2002-04-18 Thread Norman Zhang

Hi,

I am looking at some codes. Some authors use $foo and isset($foo)
interchangeably. Just to want to make sure that the statement,

if ($foo) { ... }

is different from

if (isset($foo)) { ... }

Right? if ($foo) means variable exists and can be null. Whereas, isset($foo)
means that the value in $foo cannot be null?

Regards,
Norman



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




[PHP] header redirection

2002-04-19 Thread Norman Zhang

Hi,

I use header(location: ...) for redirection to another page. But I also want
to include title, meta and link tags in the other page. Is there a way
to this? Because php complains that the header already been sent.

Regards,
Norman



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




Re: [PHP] header redirection

2002-04-22 Thread Norman Zhang

Hi,

My codes are as follows,

login.php

?
  session_start();

  if (!$HTTP_POST_VARS['logname']  !$HTTP_POST_VARS['logpass'])
  {
  // User needs to supply login name and password.
?
// This is my default header that I want to include on every page.
  html
  head
titleSupport Center/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
link rel=stylesheet href=css/test.css type=text/css
  /head

  body leftmargin=0 topmargin=0 rightmargin=0
table width=100% border=0 bgcolor=#005796 cellpadding=0
cellspacing=0
tr
  td align=left bgcolor=#005796img src=images/logo.gif
  alt=logo/td
  td align=right class=ttextbSupportbrCenter/b/td
  tdnbsp;nbsp;/td
/tr
tr bgcolor=orange
  td align=leftnbsp;upload nbsp; download/td
  td colspan=2 align=rightLogoutnbsp;/td
/tr
/table
// End of my default header that I want to include on every page.

h1 align=centerSupport Center/h1
form name=fm method=post action=login.php
table border=0 cellspacing=5 cellpadding=5 align=center
bgcolor=#fffacc
  tr
td align=rightbUser Name/b/td
tdinput type=text size=25 maxlength=20 name=logname
value= //td
  /tr
  tr
td align=rightbPassword/b/td
tdinput type=password size=25 maxlength=20 name=logpass
value= //td
  /tr
  tr
td colspan=2 align=centerinput type=submit
value=Log in Now name=submit /nbsp;
input type=reset value=Cancel name=reset //td
  /tr
/table
/form

  /body
  /html
?
  }
  else
  {
// connect to mysql
$authdb=mysql_connect('localhost', 'webauth', 'webauth')
  or die(Cannot connect to database.);

// select the appropriate database
mysql_select_db('auth', $authdb) or die(Cannot select db.);

// query the database to see if there is a record which matches
$query=select * from auth where
  usrname='$HTTP_POST_VARS[logname]' and
  usrpass=md5('$HTTP_POST_VARS[logpass]');

$result=mysql_query($query) or die(Cannot run query.);

$row=mysql_fetch_row($result);

if (mysql_num_rows($result)  0)
{
  $_SESSION['userid']=$row[0];
  $_SESSION['userlevel']=$row[1];
  $_SESSION['usersec']=mt_rand(100, 999);

  $updatesql=update auth set seckey='$_SESSION[usersec]'
where usrid='$_SESSION[userid]';

  if (!mysql_query($updatesql))
die (Cannot update database.);

  header(Location: down.php);
  die ();
}
else
{
  echo h1Go Away!/h1;
  echo You are not authorized to view this resource.;
  die();
}
  }
?

down.php

?
  session_start();

  if ($_SESSION['userid']  $_SESSION['userlevel']  $_SESSION['usersec'])
  {
// connect to mysql
$authdb=mysql_connect('localhost', 'webauth', 'webauth')
  or die(Cannot connect to database.);

// select the appropriate database
mysql_select_db('auth', $authdb)
  or die(Cannot select db.);

// query the database to see if there is a record which matches
$query=select * from auth where
  usrid='$_SESSION[userid]' and
  usrlevel='$_SESSION[userlevel]' and
  seckey='$_SESSION[usersec]';

$result=mysql_query($query, $authdb)
  or die(Cannot run query.);

$row=mysql_fetch_row($result);

if (mysql_num_rows($result)  0)
{
?

// I want to include the default header in here again. But it does not work.

?

}
  }
?

Thanks,
Norman

Jason Wong [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
On Saturday 20 April 2002 05:07, Norman Zhang wrote:
 Hi,

 I use header(location: ...) for redirection to another page. But I also
 want to include title, meta and link tags in the other page. Is
there
 a way to this? Because php complains that the header already been sent.

Show us your code.

--
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Spiritual leadership should remain spiritual leadership and the temporal
power should not become too important in any church.
- Eleanor Roosevelt
*/



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




[PHP] redirection

2002-04-28 Thread Norman Zhang

Hi,

I want to set up a check that the page cannot be exacted by calling from
another page. E.g., members.php can only be excited if it called by
login.php.

So I set

if (eregi(members.php, $_SERVER['PHP_SELF'])) Header(Location,
login.php);

at the very top of members.php. But I am being redirected to login.php no
matter if members.php was called from login.php. What's proper way of
implementing this?

Regards,
Norman







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




[PHP] date

2002-05-02 Thread Norman Zhang

Hi,

I am doing a test with the date function,

$mydate=2002-05-02
$tdate=date(d M Y, $mydate);
echo $tdate

I should expect 02 May 2002. But I get a strange result 31 Dec 1969. Why?
How can I correct this?

Regards,
Norman





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




[PHP] stop resend data

2002-05-10 Thread Norman Zhang

How can I disable the resend data feature when going back to an expired
page? If I return this page again by typing the URL, I won't be ask to
resend data. However, if I hit the back button and go back to the expired
page, I will be prompted to click on resend or not. I seem some sites
disable this feature like Hotmail. Would someone please give me a few
pointers?

Regards,
Norman



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




[PHP] authentication help

2001-10-24 Thread Norman Zhang

Hi,

Would someone please give me a few pointers on how to generate a simple PHP
to check for user's name and password before directing to a directory?

e.g., I have a index.php with a form where I have action=login.php. How
would I write login.php to check username and password if I have them hard
coded in login.php and if authentication fails the user is directed back to
index.php? Is this safe?

Regards,
Norman


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




[PHP] directory access

2001-10-26 Thread Norman Zhang

Hi,

I have a simple authentication script.

if ($username == abc)
{
  readfile(abc/index.php);
}
else
  readfile(index.php);

What I would like to know if there is some way that I can have the user
checked against the user in directory /abc/.htaccess? I would like to have
the script to jump into a directory if authenticates. Can this be done with
a single authentication? TIA.

Regards,
Norman




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