Re: [PHP-DB] Am I doing This Right?

2002-11-01 Thread Tony72284

   After I upload it was takes me back to the Form. And ignores 
$replay_file...
   And I don't know why.



Re: [PHP-DB] Am I doing This Right?

2002-11-01 Thread Jason Wong
On Friday 01 November 2002 17:00, [EMAIL PROTECTED] wrote:
After I upload it was takes me back to the Form. And ignores
 $replay_file...
And I don't know why.

1) Any error messages?

2) What exactly do you mean by: ignores $replay_file...

Try some basic debugging techniques like printing the names  values of 
important variables at strategic places in your code to verify that they 
contain what you expect them to contain.

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


/*
One man's Mede is another man's Persian.
-- George M. Cohan
*/


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




Re: [PHP-DB] Am I doing This Right?

2002-11-01 Thread Tony72284

   After I submit the file, it goes back to the form, even though in the 
script, it says to go to the database and move the uploaded file to a new 
DIR.

   It ignores it as if the file wasn't uploaded. 

   As for printing out the variables. All my important variables are 
$HTTP_POST_FILES and those are all null.



Re: [PHP-DB] Am I doing This Right?

2002-11-01 Thread Jason Wong
On Friday 01 November 2002 17:45, [EMAIL PROTECTED] wrote:
After I submit the file, it goes back to the form, even though in
 the script, it says to go to the database and move the uploaded file to a
 new DIR.

It ignores it as if the file wasn't uploaded.

As for printing out the variables. All my important variables are
 $HTTP_POST_FILES and those are all null.

manual  Variables  Variable scope

And also if you're using a version of php newer than 4.0.6 then you should be 
using $_FILES instead of $HTTP_POST_FILES.

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


/*
What we Are is God's gift to us.
What we Become is our gift to God.
*/


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




Re: [PHP-DB] Am I doing This Right?

2002-11-01 Thread Mohammad Saad
check the values of these variables

$rTemp = $HTTP_POST_FILES['replay_file']['tmp_name'];
$rName = $HTTP_POST_FILES['replay_file']['name'];
$rSize = $HTTP_POST_FILES['replay_file']['size'];

// Define Replay Upload DIR and FILE name
$rFile = $db_nextid._.$HTTP_POST_FILES['replay_file']['name'];
$rLoc = files/war3-replays/$rFile;

they should contain some value , one more thing , mite be the case that
$HTTP_POST_FILES['replay_file']['tmp_name'] should be
$HTTP_POST_FILES['REPLAY_FILE']['TMP_NAME]

do one thing, print_r($HTTP_POST_FILES); this should show you what that
array contains
Good Luck

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 01, 2002 2:45 PM
Subject: Re: [PHP-DB] Am I doing This Right?



After I submit the file, it goes back to the form, even though in
the
 script, it says to go to the database and move the uploaded file to a new
 DIR.

It ignores it as if the file wasn't uploaded.

As for printing out the variables. All my important variables are
 $HTTP_POST_FILES and those are all null.



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




RE: [PHP-DB] Am I doing This Right?

2002-11-01 Thread Snijders, Mark
or just do

phpinfo(); en check all the vars

cause in the latest php versions it could be that you have to use
$_POST[.. etc..

___ 

Mark Snijders, Developer 
Atos Origin 
Groenewoudeseweg 1, Room VN-515 
5621 BA  Eindhoven, The Netherlands 
*   : [EMAIL PROTECTED] 
*:+31 (0)40 - 2785992 (tel) 
* : +31 (0)40 - 2788729 (fax) 

The information in this mail is intended only for use of the individual or
entity to which it is addressed and may contain information that is
privileged, confidential and exempt from disclosure under applicable law.
Access to this mail by anyone else than the addressee is unauthorized. If
you are not the intended recipient, any disclosure, copying, distribution or
any action taken omitted to be taken in reliance of it, is prohibited and
may be unlawful.



-Original Message-
From: Mohammad Saad [mailto:m_saad;khi.comsats.net.pk]
Sent: vrijdag 1 november 2002 11:11
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Am I doing This Right?


check the values of these variables

$rTemp = $HTTP_POST_FILES['replay_file']['tmp_name'];
$rName = $HTTP_POST_FILES['replay_file']['name'];
$rSize = $HTTP_POST_FILES['replay_file']['size'];

// Define Replay Upload DIR and FILE name
$rFile = $db_nextid._.$HTTP_POST_FILES['replay_file']['name'];
$rLoc = files/war3-replays/$rFile;

they should contain some value , one more thing , mite be the case that
$HTTP_POST_FILES['replay_file']['tmp_name'] should be
$HTTP_POST_FILES['REPLAY_FILE']['TMP_NAME]

do one thing, print_r($HTTP_POST_FILES); this should show you what that
array contains
Good Luck

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 01, 2002 2:45 PM
Subject: Re: [PHP-DB] Am I doing This Right?



After I submit the file, it goes back to the form, even though in
the
 script, it says to go to the database and move the uploaded file to a new
 DIR.

It ignores it as if the file wasn't uploaded.

As for printing out the variables. All my important variables are
 $HTTP_POST_FILES and those are all null.



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


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




Re: [PHP-DB] Am I doing This Right?

2002-11-01 Thread 1LT John W. Holmes
No, you're doing it wrong.

---John Holmes...

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 01, 2002 2:05 AM
Subject: [PHP-DB] Am I doing This Right?




 ?php

 function war3_replays_submit() {

 if ( isset($replay_file) ) {
 $htmlHead = ;
 pgHead('Shadow Legion :: Warcraft III Replays', $htmlHead);

 // Get Current DB Entrys
 $rDB = mysql_query(select * from war3_replays where 1);

 // Select The Next Entry ID For Newly Uploaded Replay
 $db_count = sizeof($rDB);
 $db_nextid = $db_count + 1;

 // Define Date Dubmitted
 $rDate = date(m-d-y);

 // Define HTTP_POST_FILES Variables
 $rTemp = $HTTP_POST_FILES['replay_file']['tmp_name'];
 $rName = $HTTP_POST_FILES['replay_file']['name'];
 $rSize = $HTTP_POST_FILES['replay_file']['size'];

 // Define Replay Upload DIR and FILE name
 $rFile = $db_nextid._.$HTTP_POST_FILES['replay_file']['name'];
 $rLoc = files/war3-replays/$rFile;

 // DB Query For Inserting File Information into DB
 // DB Layout [ id | user | date | url | size | type | replaytitle
|
 version | replayname | downloads ]
 $q1 = INSERT INTO war3_replays VALUES ( $db_nextid,
 '$replay_submitter', '$rDate', '$rLoc', '$rSize', '$replay_type',
 '$replay_version', '$replay_mapname', 0 ) ;

 // Check If The File Was Moved And Renamed Properly
 if ( @
 !move_uploaded_file($HTTP_POST_FILES['replay_file']['tmp_name'],
$rLoc) ) {
 print 'centerSorry, file not correctly uploaded.';
 pgMid();
 nav('war3-replays-submit');
 pgFoot();
 exit();

 // If File Was Moved And Renames Properly
 } else {

 // Check If The Database Information Was Inserted Properly
 if ( !mysql_query($q1) ) {
 print 'Failed to insert the Replay Information into the
 database.';
 pgMid();
 nav('war3-replays-submit');
 pgFoot();
 exit();

 // If The DB Was Updated Properly... Make The User Happy
!!!
 } else {

 print 'Thank you for submitting your replay
 '.$replay_submitter.'!br
 The view replay will be up within the next few
days.pThanks
 again!/p';

 }
 }
 } else {
 $htmlHead = 'script Language=Javascript type=text/javascript
 src=/files/upload.js/script';
 pgHead('Shadow Legion :: Warcraft 3 Replays',$htmlHead);
 print 'pbr/p
 centerUpload Your Replay
 form enctype=multipart/form-data
 action=?q=war3-replays-submit method=post
 table border=1 cellpadding=0 cellspacing=0 width=400
 borderColor=#99
 tr
 td valign=topcenterfont size=-1Replay File
 /font:/center/td
 td valign=topinput name=replay_file
type=file
 /td
 /tr
 tr
 td valign=topcenterfont size=-1Replay Title
 /font/center/td
 td valign=topinput type=text maxlength=50
 name=replay_title/td
 /tr
 tr
 td valign=topcenterfont
size=-1Category/font:
 /center/td
 td valign=topselect name=replay_typeoption
 value=-Type.../optionoption value=soloSolo/optionoption
 value=ffaFree For All/optionoption value=teamTeam/optionoption
 value=umsUse Map Settings/option/select/td
 /tr
 tr
 td valign=topcenterfont size=-1Map
Name/font:
 /center/td
 td valign=topinput type=text maxlength=50
 size=20 name=replay_mapname/td
 /tr
 tr
 td valign=topcenterfont size=-1War3
Versionbr
 When Replay Recorded:/font/center/td
 td valign=topselect name=replay_version
 id=replay_versionoption value=-Version.../optionoption
value=1.03
 v1.03/optionoption value=1.02v1.02/optionoption
value=1.01v1.01
 /optionoption value=1.00v1.00/option/select/td
 /tr
 tr
 td valign=topcenterfont
size=-1Member/font:
 /center/td
 td valign=topinput type=text maxlength=20
 name=replay_submitter id=replay_submitter/td
 /tr
 tr
 td valign=top colspan=2centertextarea
 name=replay_disc cols=40 rows=7/textarea/center/td
 /tr
 tr
 td valign=top colspan=2centerinput
type=button
 onClick=javascript:uploadCheck(); value=Upload nbsp; input
 type=reset value=Start Over/center/td
 /tr
 /table
 /form
 /center
 pbr/p
 hr width=75% size=1 color=#99
 p/p';
 pgMid();
 

Re: [PHP-DB] Re: cookie trouble

2002-11-01 Thread Seabird
Now, I have set the cookie,

but when I run this code I always get the bye output.

Why??

 ?php
 if (isset($user))
 print 'hello';
 else
 print 'bye';
 ?


--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching
Aaron Wolski [EMAIL PROTECTED] wrote in message
news:000201c2811e$a787ebe0$0701a8c0;aaron...
 You cannot reverse the encryption of an md5 hash. Nor should you want
 to.

 You don't want to know their password which is why you encrypt it.

 When you seyup an account you convert the password to an md5 has(I
 assume you have done so). When they log back in.. You convert the
 password to an md5 hash and compare that value against the stored md5
 password. If a match - log the user in. If not - kick an error page.

 Aaron

  -Original Message-
  From: Seabird [mailto:jacco;vliegt.nl]
  Sent: Thursday, October 31, 2002 9:49 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] Re: cookie trouble
 
 
  I got this fixed,
 
  but how do I reverse a md5 encryption? this way I can log
  people in again.
 
  Jacco
 
  --
  http://seabird.jmtech.ca
 
  Attitude is Everything!
  But Remember, Attitudes are Contagious!
  Is Yours worth Catching
  Seabird [EMAIL PROTECTED] wrote in message
  news:20021031165410.94762.qmail;pb1.pair.com...
   Hi everyone,
  
   I'm having some trouble configuring a cookie (first time
  doing this):
   I have a login-script and this sets a session cookie. What I really
   want
  is
   to pass a cookie so that returning-people don't have to log
  in every
   time, but I'm not sure how to do what part is passing on
  the cookie (I
   think $_HTTP_SESSION_VARS=['PHP_SELF'] )
  
   How can I change this to a cookie that stores username and password
   for a time set by me (infinite).
  
   Here is my loginscript:
  
   ?php
   if(isset($_POST['submit'])) { // if form has been submitted
/* check they filled in what they were supposed to and
  authenticate
   */  if(!$_POST['uname'] | !$_POST['passwd']) {
 print 'form action=index.php method=post
   div align=left
 input class=test name=uname type=text size=8
   maxlength=8
 input class=test type=password size=8
  maxlength=8
   name=passwd
 input name=submit type=submit value=Login
 br
 span class=welcomeplease fill in the required
   fields./span/div
 /form
   ';
}
// authenticate.
if(!get_magic_quotes_gpc()) {
 $_POST['uname'] = addslashes($_POST['uname']);
}
$check = $db_object-query(SELECT username, password FROM users
   WHERE username = '.$_POST['uname'].');
if(DB::isError($check)) {
 print 'form action=index.php method=post
   div align=left
 input class=test name=uname type=text size=8
   maxlength=8
 input class=test type=password size=8
  maxlength=8
   name=passwd
 input name=submit type=submit value=Login
 br
 span class=welcomeusername doesn\'t exist./span a
   class=header
  
  href=javascript:loadPage(\'mainlayer\',null,\'login/signup.php\')si
   gn
  up
   here/a/div
 /form
   ';
}
$info = $check-fetchRow();
// check passwords match
$_POST['passwd'] = stripslashes($_POST['passwd']);
  $info['password']
   = stripslashes($info['password']);  $_POST['passwd'] =
   md5($_POST['passwd']);  if($_POST['passwd'] != $info['password']) {
 print 'form action=index.php method=post
   div align=left
 input class=test name=uname type=text size=8
   maxlength=8
 input class=test type=password size=8 maxlength=8
   name=passwd
 input name=submit type=submit value=Login
 br
 span class=welcomewrong password, try
  again/span/div
 /form
   ';
}
  
// if we get here username and password are correct,
  register session
   variables and set  // last login time.
$date = date('m d, Y');
$update_login = $db_object-query(UPDATE users SET
  last_login = '$date'
   WHERE username = '.$_POST['uname'].');
$_POST['uname'] = stripslashes($_POST['uname']);
$_SESSION['username'] = $_POST['uname'];
$_SESSION['password'] = $_POST['passwd'];
$db_object-disconnect();
   ?
   span class=welcomeWelcome a class=header
  
  href=javascript:loadPage('mainlayer',null,'users/edit.php?use
  r=?=$_SESSION
   ['username']??PHP print PHPSESSID=.session_id(); ?')font
   color=white?=$_SESSION['username']?/font/abra
   class=header href=login/logout.phpLogout/a
   /span
   ?php
   }
   else { // if form hasn't been submitted
   ?
   form action=?=$HTTP_SESSION_VARS['PHP_SELF']? method=post
   div align=left
 input class=test name=uname type=text size=8
   maxlength=8
 input class=test type=password size=8
  maxlength=8
   name=passwd
 input name=submit type=submit value=Login br
 a class=header
  
  

RE: [PHP-DB] Re: cookie trouble

2002-11-01 Thread Walter, Marcel
Try something like 
$_COOKIE_VARS[user] ... or $COOKIE_VARS[user] ... dunno exactly ... 

-Original Message-
From: Seabird [mailto:jacco;vliegt.nl]
Sent: 01 November 2002 10:04
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Re: cookie trouble


Now, I have set the cookie,

but when I run this code I always get the bye output.

Why??

 ?php
 if (isset($user))
 print 'hello';
 else
 print 'bye';
 ?


--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching
Aaron Wolski [EMAIL PROTECTED] wrote in message
news:000201c2811e$a787ebe0$0701a8c0;aaron...
 You cannot reverse the encryption of an md5 hash. Nor should you want
 to.

 You don't want to know their password which is why you encrypt it.

 When you seyup an account you convert the password to an md5 has(I
 assume you have done so). When they log back in.. You convert the
 password to an md5 hash and compare that value against the stored md5
 password. If a match - log the user in. If not - kick an error page.

 Aaron

  -Original Message-
  From: Seabird [mailto:jacco;vliegt.nl]
  Sent: Thursday, October 31, 2002 9:49 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] Re: cookie trouble
 
 
  I got this fixed,
 
  but how do I reverse a md5 encryption? this way I can log
  people in again.
 
  Jacco
 
  --
  http://seabird.jmtech.ca
 
  Attitude is Everything!
  But Remember, Attitudes are Contagious!
  Is Yours worth Catching
  Seabird [EMAIL PROTECTED] wrote in message
  news:20021031165410.94762.qmail;pb1.pair.com...
   Hi everyone,
  
   I'm having some trouble configuring a cookie (first time
  doing this):
   I have a login-script and this sets a session cookie. What I really
   want
  is
   to pass a cookie so that returning-people don't have to log
  in every
   time, but I'm not sure how to do what part is passing on
  the cookie (I
   think $_HTTP_SESSION_VARS=['PHP_SELF'] )
  
   How can I change this to a cookie that stores username and password
   for a time set by me (infinite).
  
   Here is my loginscript:
  
   ?php
   if(isset($_POST['submit'])) { // if form has been submitted
/* check they filled in what they were supposed to and
  authenticate
   */  if(!$_POST['uname'] | !$_POST['passwd']) {
 print 'form action=index.php method=post
   div align=left
 input class=test name=uname type=text size=8
   maxlength=8
 input class=test type=password size=8
  maxlength=8
   name=passwd
 input name=submit type=submit value=Login
 br
 span class=welcomeplease fill in the required
   fields./span/div
 /form
   ';
}
// authenticate.
if(!get_magic_quotes_gpc()) {
 $_POST['uname'] = addslashes($_POST['uname']);
}
$check = $db_object-query(SELECT username, password FROM users
   WHERE username = '.$_POST['uname'].');
if(DB::isError($check)) {
 print 'form action=index.php method=post
   div align=left
 input class=test name=uname type=text size=8
   maxlength=8
 input class=test type=password size=8
  maxlength=8
   name=passwd
 input name=submit type=submit value=Login
 br
 span class=welcomeusername doesn\'t exist./span a
   class=header
  
  href=javascript:loadPage(\'mainlayer\',null,\'login/signup.php\')si
   gn
  up
   here/a/div
 /form
   ';
}
$info = $check-fetchRow();
// check passwords match
$_POST['passwd'] = stripslashes($_POST['passwd']);
  $info['password']
   = stripslashes($info['password']);  $_POST['passwd'] =
   md5($_POST['passwd']);  if($_POST['passwd'] != $info['password']) {
 print 'form action=index.php method=post
   div align=left
 input class=test name=uname type=text size=8
   maxlength=8
 input class=test type=password size=8 maxlength=8
   name=passwd
 input name=submit type=submit value=Login
 br
 span class=welcomewrong password, try
  again/span/div
 /form
   ';
}
  
// if we get here username and password are correct,
  register session
   variables and set  // last login time.
$date = date('m d, Y');
$update_login = $db_object-query(UPDATE users SET
  last_login = '$date'
   WHERE username = '.$_POST['uname'].');
$_POST['uname'] = stripslashes($_POST['uname']);
$_SESSION['username'] = $_POST['uname'];
$_SESSION['password'] = $_POST['passwd'];
$db_object-disconnect();
   ?
   span class=welcomeWelcome a class=header
  
  href=javascript:loadPage('mainlayer',null,'users/edit.php?use
  r=?=$_SESSION
   ['username']??PHP print PHPSESSID=.session_id(); ?')font
   color=white?=$_SESSION['username']?/font/abra
   class=header href=login/logout.phpLogout/a
   /span
   ?php
   }
   else { // if form hasn't been submitted
   ?
   form action=?=$HTTP_SESSION_VARS['PHP_SELF']? method=post
   div align=left
 input 

Re: [PHP-DB] Re: cookie trouble

2002-11-01 Thread Seabird
Oops,

lights were on, but nobody home sorry, register_globals was set to off.
Works again.

Jacco
--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching
Seabird [EMAIL PROTECTED] wrote in message
news:20021101151508.26292.qmail;pb1.pair.com...
 still a bye output.
 Jacco
 --
 http://seabird.jmtech.ca

 Attitude is Everything!
 But Remember, Attitudes are Contagious!
 Is Yours worth Catching
 Marcel Walter [EMAIL PROTECTED] wrote in message

news:5A1D56DECE4EF242B1CE7A18FB1F87F50111A93F;ibfftce105.is.de.dresdnerkb.co
 m...
  Try something like
  $_COOKIE_VARS[user] ... or $COOKIE_VARS[user] ... dunno exactly ...
 
  -Original Message-
  From: Seabird [mailto:jacco;vliegt.nl]
  Sent: 01 November 2002 10:04
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] Re: cookie trouble
 
 
  Now, I have set the cookie,
 
  but when I run this code I always get the bye output.
 
  Why??
 
   ?php
   if (isset($user))
   print 'hello';
   else
   print 'bye';
   ?
 
 
  --
  http://seabird.jmtech.ca
 
  Attitude is Everything!
  But Remember, Attitudes are Contagious!
  Is Yours worth Catching
  Aaron Wolski [EMAIL PROTECTED] wrote in message
  news:000201c2811e$a787ebe0$0701a8c0;aaron...
   You cannot reverse the encryption of an md5 hash. Nor should you want
   to.
  
   You don't want to know their password which is why you encrypt it.
  
   When you seyup an account you convert the password to an md5 has(I
   assume you have done so). When they log back in.. You convert the
   password to an md5 hash and compare that value against the stored md5
   password. If a match - log the user in. If not - kick an error page.
  
   Aaron
  
-Original Message-
From: Seabird [mailto:jacco;vliegt.nl]
Sent: Thursday, October 31, 2002 9:49 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: cookie trouble
   
   
I got this fixed,
   
but how do I reverse a md5 encryption? this way I can log
people in again.
   
Jacco
   
--
http://seabird.jmtech.ca
   
Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching
Seabird [EMAIL PROTECTED] wrote in message
news:20021031165410.94762.qmail;pb1.pair.com...
 Hi everyone,

 I'm having some trouble configuring a cookie (first time
doing this):
 I have a login-script and this sets a session cookie. What I
really
 want
is
 to pass a cookie so that returning-people don't have to log
in every
 time, but I'm not sure how to do what part is passing on
the cookie (I
 think $_HTTP_SESSION_VARS=['PHP_SELF'] )

 How can I change this to a cookie that stores username and
password
 for a time set by me (infinite).

 Here is my loginscript:

 ?php
 if(isset($_POST['submit'])) { // if form has been submitted
  /* check they filled in what they were supposed to and
authenticate
 */  if(!$_POST['uname'] | !$_POST['passwd']) {
   print 'form action=index.php method=post
 div align=left
   input class=test name=uname type=text size=8
 maxlength=8
   input class=test type=password size=8
maxlength=8
 name=passwd
   input name=submit type=submit value=Login
   br
   span class=welcomeplease fill in the required
 fields./span/div
   /form
 ';
  }
  // authenticate.
  if(!get_magic_quotes_gpc()) {
   $_POST['uname'] = addslashes($_POST['uname']);
  }
  $check = $db_object-query(SELECT username, password FROM users
 WHERE username = '.$_POST['uname'].');
  if(DB::isError($check)) {
   print 'form action=index.php method=post
 div align=left
   input class=test name=uname type=text size=8
 maxlength=8
   input class=test type=password size=8
maxlength=8
 name=passwd
   input name=submit type=submit value=Login
   br
   span class=welcomeusername doesn\'t exist./span a
 class=header

   
href=javascript:loadPage(\'mainlayer\',null,\'login/signup.php\')si
 gn
up
 here/a/div
   /form
 ';
  }
  $info = $check-fetchRow();
  // check passwords match
  $_POST['passwd'] = stripslashes($_POST['passwd']);
$info['password']
 = stripslashes($info['password']);  $_POST['passwd'] =
 md5($_POST['passwd']);  if($_POST['passwd'] != $info['password'])
{
   print 'form action=index.php method=post
 div align=left
   input class=test name=uname type=text size=8
 maxlength=8
   input class=test type=password size=8
maxlength=8
 name=passwd
   input name=submit type=submit value=Login
   br
   span class=welcomewrong password, try
again/span/div
   /form
 ';
  }

  // if 

Re: [PHP-DB] Am I doing This Right?

2002-11-01 Thread Tony72284

   The server is 4.0.6 ...And I tried to get the owner to update it. He 
said its not nesscarry.



[PHP-DB] COOKIE problem... URGENTLY NEEDED HELP

2002-11-01 Thread Aaron Wolski
Hi All,
 
Ok.. just went live with a site that 'appeared' to work wonderfuylly.
 
However, now it seems I cannot read a cookie in a secure area (https)
when it was set in a non-secure area (http).
 
Any clue on how to get this universally to work?
 
Really really need help with this.
 
Arg.
 
Thanks.
 
Aaron



[PHP-DB] SESSIONS

2002-11-01 Thread wade
How would one go about registering a session if you were to create
the session based on the users ID and NAME from the database.

I have the users ID and NAME already being pulled from the database
and being stored in variables named $id and $name.

I have latest version of PHP so I think I need to use the $_SESSION[]
instead of session_register.

I am also using the session_encode function to echo out the session that
is currently being stored. What I am trying to store and what I am
actually seeing printed to the page is entirly different.

if (mysql_num_rows($sql_result) == 1)
{
session_start();
list($id, $name) = mysql_fetch_row($sql_result);
$SESSION_ID = $id;
$SESSION_NAME = $name;

session_register(SESSION_ID);
session_register(SESSION_NAME);
header(Location:);
}
else
{
header(Location:);
exit;
}

--
Should you have any questions, comments or concerns, feel free to call
me at 318-338-2033.

Thank you for your time,

Wade Kelley, Design Engineer

Bayou Internet...(888) 30-BAYOU...http://www.bayou.com
Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net
Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.com





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




Re: [PHP-DB] SESSIONS

2002-11-01 Thread Peter Beckman
Do this instead:

$user = mysql_fetch_object($sql_result);

$_SESSION['user'] = $user;

Then, you can use stuff like:

print {$_SESSION[user]-name};
// or if register_globals is on
print $user-name; // which is nice because you don't have to {} the var or 
.$var[name].

Peter

On Fri, 1 Nov 2002, wade wrote:

 How would one go about registering a session if you were to create
 the session based on the users ID and NAME from the database.

 I have the users ID and NAME already being pulled from the database
 and being stored in variables named $id and $name.

 I have latest version of PHP so I think I need to use the $_SESSION[]
 instead of session_register.

 I am also using the session_encode function to echo out the session that
 is currently being stored. What I am trying to store and what I am
 actually seeing printed to the page is entirly different.

 if (mysql_num_rows($sql_result) == 1)
 {
 session_start();
 list($id, $name) = mysql_fetch_row($sql_result);
 $SESSION_ID = $id;
 $SESSION_NAME = $name;

 session_register(SESSION_ID);
 session_register(SESSION_NAME);
 header(Location:);
 }
 else
 {
 header(Location:);
 exit;
 }

 --
 Should you have any questions, comments or concerns, feel free to call
 me at 318-338-2033.

 Thank you for your time,

 Wade Kelley, Design Engineer
 
 Bayou Internet...(888) 30-BAYOU...http://www.bayou.com
 Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net
 Vicksburg Online...(800) MISSISSIPPI...http://www.vicksburg.com
 




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


---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---


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




FW: [PHP-DB] COOKIE problem... URGENTLY NEEDED HELP - BEGGING

2002-11-01 Thread Aaron Wolski
Hi Guys,

I'm begging here.. ANYONE have a clue. I can searchinbg and searching
but I see nothing that's helping me. Anyone had issues like this before?

Thanka!!!

Aaron

-Original Message-
From: Aaron Wolski [mailto:aaronjw;martekbiz.com] 
Sent: Friday, November 01, 2002 11:55 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] COOKIE problem... URGENTLY NEEDED HELP


Hi All,
 
Ok.. just went live with a site that 'appeared' to work wonderfuylly.
 
However, now it seems I cannot read a cookie in a secure area (https)
when it was set in a non-secure area (http).
 
Any clue on how to get this universally to work?
 
Really really need help with this.
 
Arg.
 
Thanks.
 
Aaron


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




Re: FW: [PHP-DB] COOKIE problem... URGENTLY NEEDED HELP - BEGGING

2002-11-01 Thread Jeffrey_N_Dyke

Hey arron...
can you send the the set cookie code and set up of your servers. this works
fine on a site that i'm working on.  I have the https running as a
virtualhost in apachemust be an easy fix.

jeff
|---|
|  Jeff | KeaneIT - Presidents  |
|  Landing | Suite: 200 |
|Outside: 617 -517-1772 |   |
|  E-mail: [EMAIL PROTECTED] |
|[ Mailing: 10 Presidents   |
| Landing  Medford, MA 02155 USA|
|   ]   |
|---|





   
 
Aaron Wolski 
 
aaronjw@marte   To: [EMAIL PROTECTED]
 
kbiz.comcc:   
 
 Subject: FW: [PHP-DB] COOKIE problem... 
URGENTLY NEEDED HELP - BEGGING 
11/01/2002 
 
12:23 PM   
 
Please respond 
 
to aaronjw 
 
   
 
   
 




Hi Guys,

I'm begging here.. ANYONE have a clue. I can searchinbg and searching
but I see nothing that's helping me. Anyone had issues like this before?

Thanka!!!

Aaron

-Original Message-
From: Aaron Wolski [mailto:aaronjw;martekbiz.com]
Sent: Friday, November 01, 2002 11:55 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] COOKIE problem... URGENTLY NEEDED HELP


Hi All,

Ok.. just went live with a site that 'appeared' to work wonderfuylly.

However, now it seems I cannot read a cookie in a secure area (https)
when it was set in a non-secure area (http).

Any clue on how to get this universally to work?

Really really need help with this.

Arg.

Thanks.

Aaron


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





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




RE: [PHP-DB] COOKIE problem... URGENTLY NEEDED HELP - BEGGING

2002-11-01 Thread Josh Johnson
Are you maybe passing the last parameter in setcookie(), that makes sure
that the cookie is only transmitted over a secure connection?

Maybe limiting it to a domain, the domain of the secure server instead
of the domain of the whole site? 

http://www.php.net/manual/sk/function.setcookie.php --- 

-- Josh

-Original Message-
From: Aaron Wolski [mailto:aaronjw;martekbiz.com] 
Sent: Friday, November 01, 2002 12:23 PM
To: [EMAIL PROTECTED]
Subject: FW: [PHP-DB] COOKIE problem... URGENTLY NEEDED HELP - BEGGING
Importance: High

Hi Guys,

I'm begging here.. ANYONE have a clue. I can searchinbg and searching
but I see nothing that's helping me. Anyone had issues like this before?

Thanka!!!

Aaron

-Original Message-
From: Aaron Wolski [mailto:aaronjw;martekbiz.com] 
Sent: Friday, November 01, 2002 11:55 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] COOKIE problem... URGENTLY NEEDED HELP


Hi All,
 
Ok.. just went live with a site that 'appeared' to work wonderfuylly.
 
However, now it seems I cannot read a cookie in a secure area (https)
when it was set in a non-secure area (http).
 
Any clue on how to get this universally to work?
 
Really really need help with this.
 
Arg.
 
Thanks.
 
Aaron


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



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




[PHP-DB] killing cookie

2002-11-01 Thread Seabird
Hi everyone,

I don't understand why my cookie won't be removed.

I set my cookie:

setcookie('user',$_SESSION['username'],time()+36000);
setcookie('pass',$_SESSION['password'],time()+36000);

I kill my cookie:

setcookie('user','',time()-60);
setcookie('pass','',time()-60);

but it doesn't work. why not??
Jacco

--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching



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




Re: [PHP-DB] killing cookie

2002-11-01 Thread Jeffrey_N_Dyke

you need the exact same parameters as you used to set the cookie.

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




   
 
Seabird  
 
jacco@vliegt.   To: [EMAIL PROTECTED]  
 
nl  cc:   
 
 Subject: [PHP-DB] killing cookie  
 
11/01/2002 
 
07:16 AM   
 
   
 
   
 




Hi everyone,

I don't understand why my cookie won't be removed.

I set my cookie:

   setcookie('user',$_SESSION['username'],time()+36000);
   setcookie('pass',$_SESSION['password'],time()+36000);

I kill my cookie:

setcookie('user','',time()-60);
setcookie('pass','',time()-60);

but it doesn't work. why not??
Jacco

--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching



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





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




RE: [PHP-DB] killing cookie

2002-11-01 Thread Josh Johnson
I'm pretty sure you just have to set a cookie to an empty string to
delete it, i.e., no expiration time

-- Josh

-Original Message-
From: Seabird [mailto:jacco;vliegt.nl] 
Sent: Friday, November 01, 2002 7:16 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] killing cookie

Hi everyone,

I don't understand why my cookie won't be removed.

I set my cookie:

setcookie('user',$_SESSION['username'],time()+36000);
setcookie('pass',$_SESSION['password'],time()+36000);

I kill my cookie:

setcookie('user','',time()-60);
setcookie('pass','',time()-60);

but it doesn't work. why not??
Jacco

--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching



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



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




Re: [PHP-DB] killing cookie

2002-11-01 Thread Seabird
Nope, doesn't work.

In PHP manual the say that the correct way is to set the cookie in a already
expired time. That's why I used time()-60 but it doesn't work...

Anybody else?
Jacco
--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching
Josh Johnson [EMAIL PROTECTED] wrote in message
news:004101c281d3$55b80100$8b00a8c0;manpa...
 I'm pretty sure you just have to set a cookie to an empty string to
 delete it, i.e., no expiration time

 -- Josh

 -Original Message-
 From: Seabird [mailto:jacco;vliegt.nl]
 Sent: Friday, November 01, 2002 7:16 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] killing cookie

 Hi everyone,

 I don't understand why my cookie won't be removed.

 I set my cookie:

 setcookie('user',$_SESSION['username'],time()+36000);
 setcookie('pass',$_SESSION['password'],time()+36000);

 I kill my cookie:

 setcookie('user','',time()-60);
 setcookie('pass','',time()-60);

 but it doesn't work. why not??
 Jacco

 --
 http://seabird.jmtech.ca

 Attitude is Everything!
 But Remember, Attitudes are Contagious!
 Is Yours worth Catching



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





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




Re: [PHP-DB] killing cookie

2002-11-01 Thread Peter Beckman
You are doing it wrong then.  Are you checking $_SESSION['username'] or
$_COOKIE['user'] to determine if the cookie is being deleted?  Or looking
in your cookies.txt (or similar) file/directory to see if they still exist?

What exactly is your PROOF :-) that the cookie is not deleted?

Peter

On Fri, 1 Nov 2002, Seabird wrote:

 Nope, doesn't work.

 In PHP manual the say that the correct way is to set the cookie in a already
 expired time. That's why I used time()-60 but it doesn't work...

 Anybody else?
 Jacco
 --
 http://seabird.jmtech.ca

 Attitude is Everything!
 But Remember, Attitudes are Contagious!
 Is Yours worth Catching
 Josh Johnson [EMAIL PROTECTED] wrote in message
 news:004101c281d3$55b80100$8b00a8c0;manpa...
  I'm pretty sure you just have to set a cookie to an empty string to
  delete it, i.e., no expiration time
 
  -- Josh
 
  -Original Message-
  From: Seabird [mailto:jacco;vliegt.nl]
  Sent: Friday, November 01, 2002 7:16 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP-DB] killing cookie
 
  Hi everyone,
 
  I don't understand why my cookie won't be removed.
 
  I set my cookie:
 
  setcookie('user',$_SESSION['username'],time()+36000);
  setcookie('pass',$_SESSION['password'],time()+36000);
 
  I kill my cookie:
 
  setcookie('user','',time()-60);
  setcookie('pass','',time()-60);
 
  but it doesn't work. why not??
  Jacco
 
  --
  http://seabird.jmtech.ca
 
  Attitude is Everything!
  But Remember, Attitudes are Contagious!
  Is Yours worth Catching
 
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 



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


---
Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation
[EMAIL PROTECTED] http://www.purplecow.com/
---


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




[PHP-DB] Quarter question..

2002-11-01 Thread James Hatridge
HI all,

In the code below I'm trying to get the last column to show 1, 2, 3, or 4 
according to which quarter of the year it is. But all it shows in that column 
is  Resource ID # X. The X starts with #3 and goes to 18. There are (at the 
moment) 15 items in the table.  Any ideas what's wrong?

Thanks

JIM

#
?php
echo table border=1 \n;
$i=1;
while ($myrow = mysql_fetch_array($result)) {
if($i % 2) { //this means if there is a remainder
echo TR bgcolor=\yellow\\n;
} else { //if there isn't a remainder we will do the else
echo TR bgcolor=\white\\n;
}
$qdate=$myrow[date];
$sql = select quarter($qdate) or die(not work #3);
$yyy = mysql_query ($sql) or die(not work #4);

printf(tda href=\%s?id=%sdelete=yes\Delete/a/td, $PHP_SELF, 
$myrow[id]);
printf(tda href=\%s?id=%ssubmit=yes\Update/tdtd%s/tdtd  
%s/tdtd  %s/td/a/tr, 
update-inv.php, $myrow[id], $myrow[name], $myrow[details], $yyy);
$i=$i+1;
}
echo /table\n;
}
?
#

-- 
Jim Hatridge
Linux User #88484
--
 BayerWulf
   Linux System # 129656
 The Recycled Beowulf Project
  Looking for throw-away or obsolete computers and parts
   to recycle into a Linux super computer



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




Re: [PHP-DB] killing cookie

2002-11-01 Thread lherbst

try

setcookie('user');

setcookie with no parameters other than name deletes the cookie.


Lee




   
  
Seabird  
  
jacco@vliegtTo: [EMAIL PROTECTED]  
  
.nl cc:   
  
 Subject: Re: [PHP-DB] killing cookie  
  
11/01/2002 
  
07:23 AM   
  
   
  
   
  



Nope, doesn't work.

In PHP manual the say that the correct way is to set the cookie in a
already
expired time. That's why I used time()-60 but it doesn't work...

Anybody else?
Jacco
--
http://seabird.jmtech.ca

Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching
Josh Johnson [EMAIL PROTECTED] wrote in message
news:004101c281d3$55b80100$8b00a8c0;manpa...
 I'm pretty sure you just have to set a cookie to an empty string to
 delete it, i.e., no expiration time

 -- Josh

 -Original Message-
 From: Seabird [mailto:jacco;vliegt.nl]
 Sent: Friday, November 01, 2002 7:16 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] killing cookie

 Hi everyone,

 I don't understand why my cookie won't be removed.

 I set my cookie:

 setcookie('user',$_SESSION['username'],time()+36000);
 setcookie('pass',$_SESSION['password'],time()+36000);

 I kill my cookie:

 setcookie('user','',time()-60);
 setcookie('pass','',time()-60);

 but it doesn't work. why not??
 Jacco

 --
 http://seabird.jmtech.ca

 Attitude is Everything!
 But Remember, Attitudes are Contagious!
 Is Yours worth Catching



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





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






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




[PHP-DB] Session Variable Question...

2002-11-01 Thread NIPP, SCOTT V (SBCSI)
I am a little confused by a specific behavior of a session variable.
Here is an example of my confusion:

?php require_once('prod.lib.php');
session_start();
if (!isset($_SESSION['valid_user']))
{
  echo You must be logged in to use this application.  br;
  echo Please a href=\login.php\ login/a now.  br;
  exit();
} else {
  $sbcuid = $valid_user;
}

$_SESSION['type'] = $AccountType;
if (!isset($_SESSION['type']))
{
  echo You did not select an account creation option.  brPlease return to
the previous page and make a selection.;
}
echo $_SESSION[type];
echo $type;
?

OK...  The basic question is that the first time the page loads only
the '$_SESSION[type]' variable is populated.  If you hit the back button and
then reload this page, then both variables are populated even if the
$AccountType is changed on the previous page.  I can now work around this
problem, but I would like to understand why it behaves this way.

Sorry if this is covered in the documentation or a FAQ somewhere.
Thanks in advance for the feedback.
Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com



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




[PHP-DB] ODBTP, a possible solution for MS-SQL and other databases

2002-11-01 Thread Robert Twitty
Hello

I have been using PHP for about 9 months, and have chosen it as my primary
scripting language for web applications.   I have and still use ASP and JSP.
IMHO, PHP is superior and easier to use than those languages except in one
area that is important to me,  which is the ability to access MS SQL Server
7.0 / 2000 databases from a UNIX box.  Out of the box PHP provides great
support for MySQL and PostgreSQL, and at this time I have no desire to use
them because I do not believe that they are ready for  prime time.  The
open source solution that is always recommended for UNIX-based PHP / MS-SQL
connectivity is freeTDS, and unfortunately I found it to be quite lacking in
its capabilities and useless in certain situations.   Another alternative
was to use a commercial ODBC driver management system on UNIX.  Sadly, it
was not in the budget for this endeavor, and the PHP odbc extensions could
use some work in terms of ease of use.

Because I was determined to use PHP (I really dislike using JSP / JDBC on
UNIX, and  IIS / ASP is out of the question), I decided to create my own
solution.  Since I have a substantial amount of experience in programming
directly with the Win32 ODBC API and TCP/IP,  I decided to create a service
that runs on a Win32 platform that can communicate with any platform via
TCP/IP.  The service uses a home grown protocol that allows a client to
access any database that the service can see via the ODBC drivers that are
installed on the computer which it resides.  In other words, it allows a PHP
client on UNIX to access a database using the ODBC drivers installed on a
Windows NT / 2000 server.  It is nothing more than a middle man service for
Win32 ODBC.  The name of the service is called ODBTP (Open Database
Transport Protocol),  and no there is not a RFC for this protocol.  Thus
far, I have successfully accessed MS-SQL, Oracle and Sybase databases via
ODBTP.

ODBTP consists of a Windows NT / 2000 service application, an ODBTP client
library that can be used to create  Win32 or UNIX clients,  and a PHP
extension module that was created with the library.   ODBTP has the
following features:

* Multi-client servicing
* True connection pooling (not persistent connections)
* Client reserved connections (virtual connections for stateless web
clients)
* Supports all data types, including nvarchar, ntext, varchar(255),
char(255), datetime, and bigint.
* No big-endian / little-endian problems.
* Server-side data binding.
* Stored procedure execution, parameter passing (including NULL's) and
output retrieval.
* Transactions, i.e., supports commits and rollbacks under any transaction
isolation level.
* UNICODE data is processed using UTF-8 encoding (important since PHP
strings are not UNICODE)
* Can retrieve query results sent in XML format.
* Verbose error reporting, all ODBC error messages are sent to client.
* No discovered memory leaks or buffer overflow possibilities.
* Designed to be as easy as possible to use with PHP

I am new to this mailing list, and it appears that PHP is predominantly used
for MySQL and PostgreSQL, and thus I am not sure if ODBTP is of any interest
to most people on this list.  My original intent was not to release ODBTP to
the public (I really don't have the time to maintain freeware),  but if
there is a substantial interest I will release it to the public.  I am
curious to see how well it performs in other environments.

-- bob

The following is a table, stored procedures and a php script that uses ODBTP
to initialize the table with data.

CREATE TABLE dbo.Employees (
 Id int IDENTITY (1, 1) NOT NULL ,
 ExtId numeric (15,0) NOT NULL ,
 LastName varchar (50) NOT NULL ,
 FirstName varchar (50) NOT NULL ,
 Title varchar (256) NOT NULL ,
 Salary money NOT NULL ,
 JobDesc varchar (3000) NULL ,
 Notes ntext NULL ,
 Active bit NOT NULL ,
 DateEntered datetime NOT NULL ,
 DateModified datetime NOT NULL ,
 CONSTRAINT PKCL_Employees_Id PRIMARY KEY  CLUSTERED (
  Id
 )
)

CREATE PROCEDURE AddEmployee
ExtId numeric(15,0),
LastName varchar(50),
FirstName varchar(50),
Title varchar(256),
Salary money,
JobDesc varchar(3000) = 'Job not defined'
AS
SET NOCOUNT ON

INSERT INTO Employees( ExtId, LastName, FirstName,
   Title, Salary, JobDesc )
   VALUES( ExtId, LastName, FirstName,
   Title, Salary, JobDesc )

IF ERROR  0 RETURN 0
RETURN IDENTITY
GO

CREATE PROCEDURE SetEmployeeNotes
Id int,
Notes ntext
AS
SET NOCOUNT ON

UPDATE Employees SET
  Notes = Notes,
  DateModified = getdate()
WHERE Id = Id
GO

?php

if( !extension_loaded('odbtp') ) dl('odbtp.so');

$con = odbtp_connect( 'odbtpsvr.somewhere.com',
  'DRIVER={SQL
Server};SERVER=sqlsvr.somewhere.com;UID=myuid;PWD=mypwd;DATABASE=OdbtpTest;'
 ) or die;

odbtp_set_attr( ODB_ATTR_TRANSACTIONS, ODB_TXN_READCOMMITTED ) or die;

$qry1 = odbtp_query( TRUNCATE TABLE 

[PHP-DB] Performance problems?

2002-11-01 Thread Leif K-Brooks
I've been optimizing scripts in an attempt to speed my friend's site up, 
and I believe I've found the source of the performance problems.  When I 
comment the following page load time changes from around 6 seconds to 
less than .5 of a second.

   if($loggedin){
   $events = mysql_query(select * from events where 
whofor='{$userinfo['id']}' order by id desc limit 1);
   if(mysql_num_rows($events) == 1){
   $events = mysql_fetch_array($events);
   print  END
   p align=centera 
href={$basepath}doevent.php?id={$events['id']}{$events['message']}/a/p
   END;
   }
   }

This code checks for events (new mail, etc.) that the user may have and 
dispays them.  Any idea on what makes it perform this badly?
--

The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



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



[PHP-DB] Re: Performance problems?

2002-11-01 Thread Manuel Lemos
Hello,

On 11/02/2002 03:21 AM, Leif K-Brooks wrote:

I've been optimizing scripts in an attempt to speed my friend's site up, 
and I believe I've found the source of the performance problems.  When I 
comment the following page load time changes from around 6 seconds to 
less than .5 of a second.

   if($loggedin){
   $events = mysql_query(select * from events where 
whofor='{$userinfo['id']}' order by id desc limit 1);
   if(mysql_num_rows($events) == 1){
   $events = mysql_fetch_array($events);
   print  END
   p align=centera 
href={$basepath}doevent.php?id={$events['id']}{$events['message']}/a/p 

   END;
   }
   }

This code checks for events (new mail, etc.) that the user may have and 
dispays them.  Any idea on what makes it perform this badly?

The order by clause is the killer. It forces the server to rebuild the 
whole table in memory just to returned the results sorted. If you just 
want the highest id, use MAX(id) .


--

Regards,
Manuel Lemos


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



Re: [PHP-DB] Re: Performance problems?

2002-11-01 Thread Leif K-Brooks
Aha - thanks.  The problem is, I also need to retrieve other data 
asscociated with it.  I'll alter the table to order by id, but is there 
anything long-term I can do?

Manuel Lemos wrote:

Hello,

On 11/02/2002 03:21 AM, Leif K-Brooks wrote:


I've been optimizing scripts in an attempt to speed my friend's site 
up, and I believe I've found the source of the performance problems.  
When I comment the following page load time changes from around 6 
seconds to less than .5 of a second.

   if($loggedin){
   $events = mysql_query(select * from events where 
whofor='{$userinfo['id']}' order by id desc limit 1);
   if(mysql_num_rows($events) == 1){
   $events = mysql_fetch_array($events);
   print  END
   p align=centera 
href={$basepath}doevent.php?id={$events['id']}{$events['message']}/a/p 

   END;
   }
   }

This code checks for events (new mail, etc.) that the user may have 
and dispays them.  Any idea on what makes it perform this badly?


The order by clause is the killer. It forces the server to rebuild the 
whole table in memory just to returned the results sorted. If you just 
want the highest id, use MAX(id) .



--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




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




[PHP-DB] Re: ODBTP, a possible solution for MS-SQL and other databases

2002-11-01 Thread l0t3k
Robert,
  this seems like an excellent idea. you should present in PHP-DEV, though,
since this NG is primarily for userland PHP users, not low-level PHP
developers.

l0t3k
Robert Twitty [EMAIL PROTECTED] wrote in message
news:003101c28233$9d1ece60$9b00a8c0;bobawa...
 Hello

 I have been using PHP for about 9 months, and have chosen it as my primary
 scripting language for web applications.   I have and still use ASP and
JSP.
 IMHO, PHP is superior and easier to use than those languages except in one
 area that is important to me,  which is the ability to access MS SQL
Server
 7.0 / 2000 databases from a UNIX box.  Out of the box PHP provides great
 support for MySQL and PostgreSQL, and at this time I have no desire to use
 them because I do not believe that they are ready for  prime time.  The
 open source solution that is always recommended for UNIX-based PHP /
MS-SQL
 connectivity is freeTDS, and unfortunately I found it to be quite lacking
in
 its capabilities and useless in certain situations.   Another alternative
 was to use a commercial ODBC driver management system on UNIX.  Sadly, it
 was not in the budget for this endeavor, and the PHP odbc extensions could
 use some work in terms of ease of use.

 Because I was determined to use PHP (I really dislike using JSP / JDBC on
 UNIX, and  IIS / ASP is out of the question), I decided to create my own
 solution.  Since I have a substantial amount of experience in programming
 directly with the Win32 ODBC API and TCP/IP,  I decided to create a
service
 that runs on a Win32 platform that can communicate with any platform via
 TCP/IP.  The service uses a home grown protocol that allows a client to
 access any database that the service can see via the ODBC drivers that are
 installed on the computer which it resides.  In other words, it allows a
PHP
 client on UNIX to access a database using the ODBC drivers installed on a
 Windows NT / 2000 server.  It is nothing more than a middle man service
for
 Win32 ODBC.  The name of the service is called ODBTP (Open Database
 Transport Protocol),  and no there is not a RFC for this protocol.  Thus
 far, I have successfully accessed MS-SQL, Oracle and Sybase databases via
 ODBTP.

 ODBTP consists of a Windows NT / 2000 service application, an ODBTP client
 library that can be used to create  Win32 or UNIX clients,  and a PHP
 extension module that was created with the library.   ODBTP has the
 following features:

 * Multi-client servicing
 * True connection pooling (not persistent connections)
 * Client reserved connections (virtual connections for stateless web
 clients)
 * Supports all data types, including nvarchar, ntext, varchar(255),
 char(255), datetime, and bigint.
 * No big-endian / little-endian problems.
 * Server-side data binding.
 * Stored procedure execution, parameter passing (including NULL's) and
 output retrieval.
 * Transactions, i.e., supports commits and rollbacks under any transaction
 isolation level.
 * UNICODE data is processed using UTF-8 encoding (important since PHP
 strings are not UNICODE)
 * Can retrieve query results sent in XML format.
 * Verbose error reporting, all ODBC error messages are sent to client.
 * No discovered memory leaks or buffer overflow possibilities.
 * Designed to be as easy as possible to use with PHP

 I am new to this mailing list, and it appears that PHP is predominantly
used
 for MySQL and PostgreSQL, and thus I am not sure if ODBTP is of any
interest
 to most people on this list.  My original intent was not to release ODBTP
to
 the public (I really don't have the time to maintain freeware),  but if
 there is a substantial interest I will release it to the public.  I am
 curious to see how well it performs in other environments.

 -- bob

 The following is a table, stored procedures and a php script that uses
ODBTP
 to initialize the table with data.

 CREATE TABLE dbo.Employees (
  Id int IDENTITY (1, 1) NOT NULL ,
  ExtId numeric (15,0) NOT NULL ,
  LastName varchar (50) NOT NULL ,
  FirstName varchar (50) NOT NULL ,
  Title varchar (256) NOT NULL ,
  Salary money NOT NULL ,
  JobDesc varchar (3000) NULL ,
  Notes ntext NULL ,
  Active bit NOT NULL ,
  DateEntered datetime NOT NULL ,
  DateModified datetime NOT NULL ,
  CONSTRAINT PKCL_Employees_Id PRIMARY KEY  CLUSTERED (
   Id
  )
 )

 CREATE PROCEDURE AddEmployee
 @ExtId numeric(15,0),
 @LastName varchar(50),
 @FirstName varchar(50),
 @Title varchar(256),
 @Salary money,
 @JobDesc varchar(3000) = 'Job not defined'
 AS
 SET NOCOUNT ON

 INSERT INTO Employees( ExtId, LastName, FirstName,
Title, Salary, JobDesc )
VALUES( @ExtId, @LastName, @FirstName,
@Title, @Salary, @JobDesc )

 IF @@ERROR  0 RETURN 0
 RETURN @@IDENTITY
 GO

 CREATE PROCEDURE SetEmployeeNotes
 @Id int,
 @Notes ntext
 AS
 SET NOCOUNT ON

 UPDATE Employees SET
   Notes = @Notes,
   DateModified =