[PHP-DB] Patch to access oracle in Red Hat....

2002-02-05 Thread Paulo Cesar

Hi people...

I use PHP 4 with Red Hat 7 and a Oracle DB, but I can´t find the extensions to access 
the oracle db 
In php.net I found the DLL for Win NT/2000 but I didn't find the files for Linux.

Paulo Cesar



[PHP-DB] Username

2002-02-05 Thread Jennifer Downey

Hi,

It's me bothering you great helpers again! Wondering if you can help me?
I know I am missing something stupid cause I am taking this pretty much
straight out
of  the PHP 4 Bible.

Here is my table dump:


CREATE TABLE users (
  uid int(10) unsigned NOT NULL auto_increment,
  name varchar(20) NOT NULL default '',
  password varchar(20) NOT NULL default '',
  class tinyint(3) unsigned NOT NULL default '0',
  realname varchar(40) default NULL,
  email varchar(50) NOT NULL default '',
  sex enum('Male','Female') default NULL,
  session varchar(15) NOT NULL default '',
  dateregistered datetime NOT NULL default '-00-00 00:00:00',
  dateactivated datetime NOT NULL default '-00-00 00:00:00',
  lastvisit datetime NOT NULL default '-00-00 00:00:00',
  logins int(10) unsigned NOT NULL default '0',
  points int(11) NOT NULL default '1000',
  PRIMARY KEY  (uid),
  UNIQUE KEY name (name,email)
) TYPE=MyISAM;


Here is the php code:

?
// include the database configuration
includeconfig.php;
// connect to database
mysql_connect($db[host],$db[user],$db[password]);
mysql_select_db($db[database])  or die (sorry I couldn't connect to the
database.);

// if no connect then exit
// exit;

// if connect successful

?
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN

html
head
titleUntitled/title
/head
body
?
?
if(!IsSet($stage))
  {
?

Please fill out the form below to get an account.
FORM METHOD=POST ACTION=te.php
Username:BRINPUT TYPE=TEXT NAME=name SIZE=15BR
input type=hidden name=stage value=1
INPUT TYPE=SUBMIT
/form
?
$query = INSERT INTO users (uid, name) VALUES(NULL, $name);
$result = mysql_query($query);
if($result == 0)
print(There has been a problem.);
else
print(Your information has been recorded.);
}
 ?
/body
/html

All I want is to get the username into the database.
As soon as test.php shows in browser, the Username, submit button and box ar
e there but also
it prints the There has been a problem. right off the bat. Now I know
there are misprints in the book
and I hope I was smart enough to catch them but maybe not. can someone
please tell me what I have
done wrong?

Thanks for all your time.

Jennifer Downey



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




[PHP-DB] File Uploading... Two problems...

2002-02-05 Thread Todd Williamsen

I have been successfully able to upload the files to the server and its path
stored in the database..

Now I have two small issues...

1.  How would I automate the file naming otherwise errors will fly (can't
copy file... blah blah)

2.  The second part is the most annoying.  It seems that I cannot get the
script to put the files into a directory I specify only where the script
resides.  I thought it was a permission issue, but the folder has been chmod
to 777 and it still won't do it...

Directory structure

home
web
recruiter  --- folder where the scripts reside
resumes --  the destination where I want the uploaded files to
reside

here is the code...

?

// if $img_name isn't empty, try to copy the file
if ($img1_name != ) {

 // copy the file to a directory or
 //die and print an error message

 // NOTE! if you're on a Windows machine,
 // use Windows pathnames, like so:
 // copy($img1, C:\\some\\directory\\path\\$img1_name);

 copy($img1,
home/sites/madden.williamsen.net/web/recruiter/resumes/$img1_name)
  or die(Couldn't copy the file!);

} else {

 // if $img_name was empty, die and let us know why
 die(No input file specified);

}

?

thanks




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




Re: [PHP-DB] Username

2002-02-05 Thread Robert Weeks

What exactly is the error message? Did you change config.php to use the name
of your database and your username  password?

I've found the articles at devshed to be helpful in the past. This
particular one has a pretty good explaination of setting up a user
authentication system:

http://www.devshed.com/Server_Side/PHP/TimeIsMoney/TimeIsMoney1/page1.html

Robert


On 2/5/02 9:50 AM, Jennifer Downey [EMAIL PROTECTED] wrote:

 All I want is to get the username into the database.
 As soon as test.php shows in browser, the Username, submit button and box ar
 e there but also
 it prints the There has been a problem. right off the bat. Now I know
 there are misprints in the book
 and I hope I was smart enough to catch them but maybe not. can someone
 please tell me what I have
 done wrong?
 
 Thanks for all your time.
 
 Jennifer Downey
 
 


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




Re: [PHP-DB] File Uploading... Two problems...

2002-02-05 Thread Robert Weeks

On 2/5/02 9:58 AM, Todd Williamsen [EMAIL PROTECTED] wrote:
 Now I have two small issues...
 
 1.  How would I automate the file naming otherwise errors will fly (can't
 copy file... blah blah)

You could replace the file name with a randomly generated number. There are
a number of ways to generate random numbers in PHP. Try this for starters:

http://www.php.net/manual/en/function.mt-rand.php
 
 2.  The second part is the most annoying.  It seems that I cannot get the
 script to put the files into a directory I specify only where the script
 resides.  I thought it was a permission issue, but the folder has been chmod
 to 777 and it still won't do it...

You need the path from root to the directory. Now you have:

home/sites/madden.williamsen.net/web/recruiter/resumes/$img1_name

You need a forward slash before home:

/home/sites/madden.williamsen.net/web/recruiter/resumes/$img1_name

Instead of using chmod 777 (ick!) you should change the ownership of the
file to be owned by the web server user which is usually nobody you can do
this with the chown command from the command line.

Robert
 
 Directory structure
 
 home
   web
   recruiter  --- folder where the scripts reside
   resumes --  the destination where I want the uploaded files to
 reside
 
 here is the code...
 
 ?
 
 // if $img_name isn't empty, try to copy the file
 if ($img1_name != ) {
 
 // copy the file to a directory or
 //die and print an error message
 
 // NOTE! if you're on a Windows machine,
 // use Windows pathnames, like so:
 // copy($img1, C:\\some\\directory\\path\\$img1_name);
 
 copy($img1,
 home/sites/madden.williamsen.net/web/recruiter/resumes/$img1_name)
 or die(Couldn't copy the file!);
 
 } else {
 
 // if $img_name was empty, die and let us know why
 die(No input file specified);
 
 }
 
 ?
 
 thanks
 
 
 


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




Re: [PHP-DB] Username

2002-02-05 Thread Jennifer Downey

I am not getting an error message. The te.php is connecting to the data
base. Just not doing what I want
it to.

While that is a very good tutorial (if I was just logging in) but it has
nothing to do with inserting information
into the database via a form.

But thanks for the tut. It will come in handy when I get to that point in my
learning stage.
Jen


Robert Weeks [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 What exactly is the error message? Did you change config.php to use the
name
 of your database and your username  password?

 I've found the articles at devshed to be helpful in the past. This
 particular one has a pretty good explaination of setting up a user
 authentication system:

 http://www.devshed.com/Server_Side/PHP/TimeIsMoney/TimeIsMoney1/page1.html

 Robert


 On 2/5/02 9:50 AM, Jennifer Downey [EMAIL PROTECTED] wrote:

  All I want is to get the username into the database.
  As soon as test.php shows in browser, the Username, submit button and
box ar
  e there but also
  it prints the There has been a problem. right off the bat. Now I know
  there are misprints in the book
  and I hope I was smart enough to catch them but maybe not. can someone
  please tell me what I have
  done wrong?
 
  Thanks for all your time.
 
  Jennifer Downey
 
 




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




RE: [PHP-DB] Database Connection

2002-02-05 Thread Andrew Hill

Jerry,

Installing DB2 Client will allow you to use the ODBC functions in PHP, but
be aware that you are not actually using any ODBC Drivers in this instance.
PHP allows hiding of certain database specific functions under a Unified
ODBC that uses the ODBC functions without using true ODBC database
communication.

That being said, you don't need to link --with-iODBC unless you are using
ODBC Drivers, so it's not an issue here.

If Apache doesn't start, I'd check it's logs, but you might be encountering
a situation where the DB2 libraries were in the path at compile time and are
not at Apache start time.  Try setting LD_LIBRARY_PATH environment variable
to include the location of your DB2 Client.

Hope this helps.

Best regards,
Andrew Hill
Director of Technology Evangelism
OpenLink Software  http://www.openlinksw.com
Universal Data Access  Data Integration Technology Providers

 -Original Message-
 From: Jerry [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 05, 2002 10:46 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Database Connection


 Hi,

 I have IBM DB2 V7.2 on a windows 2000 server
 I have IBM DB2 Client/Administration Client Development Client V7.2 on a
 Linux Web Server
 From the Linux server (Command Line) I can connect to the DB2 database
 directly.

 I would like to connect to the DB2 Database through PHP4/Apache

 After compiling PHP with the option
 --with-ibm-db2=/home/db2inst1, Apache
 doesn't start anymore.

 Do I need to install iODBC (or another ODBC) or is it included ?

 Any idea what can cause this problem and how to solve it ?

 Thanks

 Jerry





 --
 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] Username

2002-02-05 Thread DL Neil

Jennifer,

You have a clear idea of what you want done by the script - as guided by the book.
However, do you have a clear idea of what the script is actually seeing - and 
therefore why it is doing what
it's doing?

When debugging, add a heap of ECHO statements to test pertinent values, eg before a 
branch/decision make sure
you KNOW what the value IS (cf what it 'should be').

When you do this, it is most likely that the error/omission will become clear.
=dn


 I am not getting an error message. The te.php is connecting to the data
 base. Just not doing what I want
 it to.

 While that is a very good tutorial (if I was just logging in) but it has
 nothing to do with inserting information
 into the database via a form.

 But thanks for the tut. It will come in handy when I get to that point in my
 learning stage.
 Jen


 Robert Weeks [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  What exactly is the error message? Did you change config.php to use the
 name
  of your database and your username  password?
 
  I've found the articles at devshed to be helpful in the past. This
  particular one has a pretty good explaination of setting up a user
  authentication system:
 
  http://www.devshed.com/Server_Side/PHP/TimeIsMoney/TimeIsMoney1/page1.html
 
  Robert
 
 
  On 2/5/02 9:50 AM, Jennifer Downey [EMAIL PROTECTED] wrote:
 
   All I want is to get the username into the database.
   As soon as test.php shows in browser, the Username, submit button and
 box ar
   e there but also
   it prints the There has been a problem. right off the bat. Now I know
   there are misprints in the book
   and I hope I was smart enough to catch them but maybe not. can someone
   please tell me what I have
   done wrong?
  
   Thanks for all your time.
  
   Jennifer Downey
  
  
 



 --
 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




FW: [PHP-DB] Username

2002-02-05 Thread Tony James

Hi Jennifer

The table defines the uid field as not null.
CREATE TABLE users (
  uid int(10) unsigned NOT NULL auto_increment,
  name varchar(20) NOT NULL default '',
  password varchar(20) NOT NULL default '',
..


However you are trying to insert null into uid field

$query = INSERT INTO users (uid, name) VALUES(NULL, $name);
$result = mysql_query($query);


Since a primary key has to be not null try inserting an empty string instead
of NULL.

HTH

TJ.
-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
Sent: 05 February 2002 14:50
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Username


Hi,

It's me bothering you great helpers again! Wondering if you can help me?
I know I am missing something stupid cause I am taking this pretty much
straight out
of  the PHP 4 Bible.

Here is my table dump:


CREATE TABLE users (
  uid int(10) unsigned NOT NULL auto_increment,
  name varchar(20) NOT NULL default '',
  password varchar(20) NOT NULL default '',
  class tinyint(3) unsigned NOT NULL default '0',
  realname varchar(40) default NULL,
  email varchar(50) NOT NULL default '',
  sex enum('Male','Female') default NULL,
  session varchar(15) NOT NULL default '',
  dateregistered datetime NOT NULL default '-00-00 00:00:00',
  dateactivated datetime NOT NULL default '-00-00 00:00:00',
  lastvisit datetime NOT NULL default '-00-00 00:00:00',
  logins int(10) unsigned NOT NULL default '0',
  points int(11) NOT NULL default '1000',
  PRIMARY KEY  (uid),
  UNIQUE KEY name (name,email)
) TYPE=MyISAM;


Here is the php code:

?
// include the database configuration
includeconfig.php;
// connect to database
mysql_connect($db[host],$db[user],$db[password]);
mysql_select_db($db[database])  or die (sorry I couldn't connect to the
database.);

// if no connect then exit
// exit;

// if connect successful

?
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN

html
head
titleUntitled/title
/head
body
?
?
if(!IsSet($stage))
  {
?

Please fill out the form below to get an account.
FORM METHOD=POST ACTION=te.php
Username:BRINPUT TYPE=TEXT NAME=name SIZE=15BR
input type=hidden name=stage value=1
INPUT TYPE=SUBMIT
/form
?
$query = INSERT INTO users (uid, name) VALUES(NULL, $name);
$result = mysql_query($query);
if($result == 0)
print(There has been a problem.);
else
print(Your information has been recorded.);
}
 ?
/body
/html

All I want is to get the username into the database.
As soon as test.php shows in browser, the Username, submit button and box ar
e there but also
it prints the There has been a problem. right off the bat. Now I know
there are misprints in the book
and I hope I was smart enough to catch them but maybe not. can someone
please tell me what I have
done wrong?

Thanks for all your time.

Jennifer Downey



--
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




FW: [PHP-DB] Username

2002-02-05 Thread Tony James


Hi again

The insert statement is incorrectly positioned within the if statement.

?
if(!IsSet($stage))
 {
?
Please fill out the form below to get an account.
FORM METHOD=POST ACTION=te.php
Username:BRINPUT TYPE=TEXT NAME=name SIZE=15BR
input type=hidden name=stage value=1
INPUT TYPE=SUBMIT
/form
?
$query = INSERT INTO users (uid, name) VALUES(NULL, $name);
$result = mysql_query($query);
if($result == 0)
print(There has been a problem.);
else
print(Your information has been recorded.);
}
 ?

should be

?
if(!IsSet($stage))
{
?
Please fill out the form below to get an account.
FORM METHOD=POST ACTION=te.php
Username:BRINPUT TYPE=TEXT NAME=name SIZE=15BR
input type=hidden name=stage value=1
INPUT TYPE=SUBMIT
/form
?
}
else
{
$query = INSERT INTO users (uid, name) VALUES(NULL, $name);
$result = mysql_query($query);
if($result == 0)
print(There has been a problem.);
else
print(Your information has been recorded.);
}

Again HTH
TJ
 ?




-Original Message-
From: Jennifer Downey [mailto:[EMAIL PROTECTED]]
Sent: 05 February 2002 14:50
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Username


Hi,

It's me bothering you great helpers again! Wondering if you can help me?
I know I am missing something stupid cause I am taking this pretty much
straight out
of  the PHP 4 Bible.

Here is my table dump:


CREATE TABLE users (
  uid int(10) unsigned NOT NULL auto_increment,
  name varchar(20) NOT NULL default '',
  password varchar(20) NOT NULL default '',
  class tinyint(3) unsigned NOT NULL default '0',
  realname varchar(40) default NULL,
  email varchar(50) NOT NULL default '',
  sex enum('Male','Female') default NULL,
  session varchar(15) NOT NULL default '',
  dateregistered datetime NOT NULL default '-00-00 00:00:00',
  dateactivated datetime NOT NULL default '-00-00 00:00:00',
  lastvisit datetime NOT NULL default '-00-00 00:00:00',
  logins int(10) unsigned NOT NULL default '0',
  points int(11) NOT NULL default '1000',
  PRIMARY KEY  (uid),
  UNIQUE KEY name (name,email)
) TYPE=MyISAM;


Here is the php code:

?
// include the database configuration
includeconfig.php;
// connect to database
mysql_connect($db[host],$db[user],$db[password]);
mysql_select_db($db[database])  or die (sorry I couldn't connect to the
database.);

// if no connect then exit
// exit;

// if connect successful

?
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN

html
head
titleUntitled/title
/head
body
?
?
if(!IsSet($stage))
  {
?

Please fill out the form below to get an account.
FORM METHOD=POST ACTION=te.php
Username:BRINPUT TYPE=TEXT NAME=name SIZE=15BR
input type=hidden name=stage value=1
INPUT TYPE=SUBMIT
/form
?
$query = INSERT INTO users (uid, name) VALUES(NULL, $name);
$result = mysql_query($query);
if($result == 0)
print(There has been a problem.);
else
print(Your information has been recorded.);
}
 ?
/body
/html

All I want is to get the username into the database.
As soon as test.php shows in browser, the Username, submit button and box ar
e there but also
it prints the There has been a problem. right off the bat. Now I know
there are misprints in the book
and I hope I was smart enough to catch them but maybe not. can someone
please tell me what I have
done wrong?

Thanks for all your time.

Jennifer Downey



--
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] Username

2002-02-05 Thread Robert Weeks

If you read to part 2 of the tutorial it has quite a bit on inserting data.

The reason there are tutorials and books are to teach the *concepts* behind
what they are showing you.

This is probably what is tripping you up; you create the table with uid as
an integer, auto increment, not null field, then your insert statement tries
to insert NULL into that field.

You need to change this:

$query = INSERT INTO users (uid, name) VALUES(NULL, $name);

To this:

$query = INSERT INTO users (name) VALUES ($name);

Robert


On 2/5/02 10:46 AM, Jennifer Downey [EMAIL PROTECTED] wrote:

 I am not getting an error message. The te.php is connecting to the data
 base. Just not doing what I want
 it to.
 
 While that is a very good tutorial (if I was just logging in) but it has
 nothing to do with inserting information
 into the database via a form.
 
 But thanks for the tut. It will come in handy when I get to that point in my
 learning stage.
 Jen


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




RE: [PHP-DB] File Uploading... Two problems...

2002-02-05 Thread JD Daniels

I believe when PHP saves a file, it is already owned by the web server user.
In my case, nouser. I could not get this behaviour to change.

Normally you should not need to CHMOD or CHOWN anything you upload unless
you need them to be modified by ftp users as well.
Just make sure the folder is writeable by the web server user. (Preferably
not by anybody else... 777 is all bad :)

If you do end up CHMODing:
On SCO, the CHMOD command did not behave like I expected it to... adding the
umask made it all good... ie,

$rand_name=generate_filename(,jpg)

//Save The Uploaded File To Disk
@copy($image,
/home/sites/madden.williamsen.net/web/recruiter/resumes/$rand_name) or
die(Couldn't Save File $image to $rand_name);

(Note beginning slash... Robert helped you there :)

//Give It Perms
umask(0);
chmod(/home/sites/madden.williamsen.net/web/recruiter/resumes/$temp_name,0
600);
(on my SCO box, 600 is the default perms anyway )

Here is my little funtion I use to generate file names: (It is not mine..
but I cant remember who gave it to me :)

function generate_filename ($len = 8,$ext)
{
$nps = ;
mt_srand ((double) microtime() * 100);

 while (strlen($nps)$len)
 {

 $c = chr(mt_rand (0,255));

 if (eregi(^[a-z0-9]$, $c)) $nps = $nps.$c;

 }

$nps.=.$ext;
return ($nps);

}

Of course, depending on what you are doing, completely random names may be
useless... I save them as temporary files to resize them and save them in a
DB with the regular name with special chars stripped out.

JD


-Original Message-
From: Robert Weeks [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 05, 2002 7:19 AM
To: Todd Williamsen; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] File Uploading... Two problems...


On 2/5/02 9:58 AM, Todd Williamsen [EMAIL PROTECTED] wrote:
 Now I have two small issues...

 1.  How would I automate the file naming otherwise errors will fly (can't
 copy file... blah blah)

You could replace the file name with a randomly generated number. There are
a number of ways to generate random numbers in PHP. Try this for starters:

http://www.php.net/manual/en/function.mt-rand.php

 2.  The second part is the most annoying.  It seems that I cannot get the
 script to put the files into a directory I specify only where the script
 resides.  I thought it was a permission issue, but the folder has been
chmod
 to 777 and it still won't do it...

You need the path from root to the directory. Now you have:

home/sites/madden.williamsen.net/web/recruiter/resumes/$img1_name

You need a forward slash before home:

/home/sites/madden.williamsen.net/web/recruiter/resumes/$img1_name

Instead of using chmod 777 (ick!) you should change the ownership of the
file to be owned by the web server user which is usually nobody you can do
this with the chown command from the command line.

Robert

 Directory structure

 home
   web
   recruiter  --- folder where the scripts reside
   resumes --  the destination where I want the uploaded files to
 reside

 here is the code...

 ?

 // if $img_name isn't empty, try to copy the file
 if ($img1_name != ) {

 // copy the file to a directory or
 //die and print an error message

 // NOTE! if you're on a Windows machine,
 // use Windows pathnames, like so:
 // copy($img1, C:\\some\\directory\\path\\$img1_name);

 copy($img1,
 home/sites/madden.williamsen.net/web/recruiter/resumes/$img1_name)
 or die(Couldn't copy the file!);

 } else {

 // if $img_name was empty, die and let us know why
 die(No input file specified);

 }

 ?

 thanks





--
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] Database Connection

2002-02-05 Thread Jerry

Thanks Andrew for your answer.

In the environment variables I have already:

DB2INSTANCE=db2inst1
LD_LIBRARY_PATH=:/home/db2inst1/sqllib/lib

Is it correct ? Or does it need to point to the DB2 Client directory
/usr/IBMdb2/V7.1/lib


Thanks.

Jerry


Andrew Hill [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Jerry,

 Installing DB2 Client will allow you to use the ODBC functions in PHP, but
 be aware that you are not actually using any ODBC Drivers in this
instance.
 PHP allows hiding of certain database specific functions under a Unified
 ODBC that uses the ODBC functions without using true ODBC database
communication.

 That being said, you don't need to link --with-iODBC unless you are using
 ODBC Drivers, so it's not an issue here.

 If Apache doesn't start, I'd check it's logs, but you might be
encountering
 a situation where the DB2 libraries were in the path at compile time and
are
 not at Apache start time.  Try setting LD_LIBRARY_PATH environment
variable
 to include the location of your DB2 Client.

 Andrew Hill

































.



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




Re: [PHP-DB] File Uploading... Two problems...

2002-02-05 Thread Robert Weeks

Yeah,

My chown reference was to chowning the folder that the files are uploaded
to, not the indv. files.

Robert
- Original Message -
From: JD Daniels [EMAIL PROTECTED]
To: Todd Williamsen [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, February 05, 2002 12:21 PM
Subject: RE: [PHP-DB] File Uploading... Two problems...


 I believe when PHP saves a file, it is already owned by the web server
user.
 In my case, nouser. I could not get this behaviour to change.

 Normally you should not need to CHMOD or CHOWN anything you upload unless
 you need them to be modified by ftp users as well.
 Just make sure the folder is writeable by the web server user. (Preferably
 not by anybody else... 777 is all bad :)

 If you do end up CHMODing:
 On SCO, the CHMOD command did not behave like I expected it to... adding
the
 umask made it all good... ie,

 $rand_name=generate_filename(,jpg)

 file://Save The Uploaded File To Disk
 @copy($image,
 /home/sites/madden.williamsen.net/web/recruiter/resumes/$rand_name) or
 die(Couldn't Save File $image to $rand_name);

 (Note beginning slash... Robert helped you there :)

 file://Give It Perms
 umask(0);

chmod(/home/sites/madden.williamsen.net/web/recruiter/resumes/$temp_name,0
 600);
 (on my SCO box, 600 is the default perms anyway )

 Here is my little funtion I use to generate file names: (It is not mine..
 but I cant remember who gave it to me :)

 function generate_filename ($len = 8,$ext)
 {
 $nps = ;
 mt_srand ((double) microtime() * 100);

  while (strlen($nps)$len)
  {

  $c = chr(mt_rand (0,255));

  if (eregi(^[a-z0-9]$, $c)) $nps = $nps.$c;

  }

 $nps.=.$ext;
 return ($nps);

 }

 Of course, depending on what you are doing, completely random names may be
 useless... I save them as temporary files to resize them and save them in
a
 DB with the regular name with special chars stripped out.

 JD


 -Original Message-
 From: Robert Weeks [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 05, 2002 7:19 AM
 To: Todd Williamsen; [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] File Uploading... Two problems...


 On 2/5/02 9:58 AM, Todd Williamsen [EMAIL PROTECTED] wrote:
  Now I have two small issues...
 
  1.  How would I automate the file naming otherwise errors will fly
(can't
  copy file... blah blah)

 You could replace the file name with a randomly generated number. There
are
 a number of ways to generate random numbers in PHP. Try this for starters:

 http://www.php.net/manual/en/function.mt-rand.php

  2.  The second part is the most annoying.  It seems that I cannot get
the
  script to put the files into a directory I specify only where the script
  resides.  I thought it was a permission issue, but the folder has been
 chmod
  to 777 and it still won't do it...

 You need the path from root to the directory. Now you have:

 home/sites/madden.williamsen.net/web/recruiter/resumes/$img1_name

 You need a forward slash before home:

 /home/sites/madden.williamsen.net/web/recruiter/resumes/$img1_name

 Instead of using chmod 777 (ick!) you should change the ownership of the
 file to be owned by the web server user which is usually nobody you can
do
 this with the chown command from the command line.

 Robert
 
  Directory structure
 
  home
web
recruiter  --- folder where the scripts reside
resumes --  the destination where I want the uploaded files
to
  reside
 
  here is the code...
 
  ?
 
  // if $img_name isn't empty, try to copy the file
  if ($img1_name != ) {
 
  // copy the file to a directory or
  file://die and print an error message
 
  // NOTE! if you're on a Windows machine,
  // use Windows pathnames, like so:
  // copy($img1, C:\\some\\directory\\path\\$img1_name);
 
  copy($img1,
  home/sites/madden.williamsen.net/web/recruiter/resumes/$img1_name)
  or die(Couldn't copy the file!);
 
  } else {
 
  // if $img_name was empty, die and let us know why
  die(No input file specified);
 
  }
 
  ?
 
  thanks
 
 
 


 --
 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




RE: [PHP-DB] Database Connection

2002-02-05 Thread Mark Newnham

You need to specify some env variables before you connect: heres what I do.

#

 putenv(LD_LIBRARY_PATH=/home/db2inst1/sqllib/lib);  
 putenv(DB2INSTANCE=db2inst1);   

#

HTH

Mark


-Original Message-
From: Andrew Hill [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 05, 2002 9:43 AM
To: Jerry; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Database Connection


Jerry,

I believe it's the sqllib dir, but you can try the other or experiment with
just /home/db2inst1/sqllib
If created by the DB2 client installer, try applying the environment
variables script: . /home/db2inst1/sqllib/db2profile

Best regards,
Andrew Hill
Director of Technology Evangelism
OpenLink Software  http://www.openlinksw.com
Universal Data Access  Data Integration Technology Providers

 -Original Message-
 From: Jerry [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 05, 2002 11:36 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Database Connection


 Thanks Andrew for your answer.

 In the environment variables I have already:

 DB2INSTANCE=db2inst1
 LD_LIBRARY_PATH=:/home/db2inst1/sqllib/lib

 Is it correct ? Or does it need to point to the DB2 Client directory
 /usr/IBMdb2/V7.1/lib


 Thanks.

 Jerry


 Andrew Hill [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Jerry,

  Installing DB2 Client will allow you to use the ODBC functions
 in PHP, but
  be aware that you are not actually using any ODBC Drivers in this
 instance.
  PHP allows hiding of certain database specific functions under
 a Unified
  ODBC that uses the ODBC functions without using true ODBC database
 communication.

  That being said, you don't need to link --with-iODBC unless you
 are using
  ODBC Drivers, so it's not an issue here.

  If Apache doesn't start, I'd check it's logs, but you might be
 encountering
  a situation where the DB2 libraries were in the path at compile time and
 are
  not at Apache start time.  Try setting LD_LIBRARY_PATH environment
 variable
  to include the location of your DB2 Client.

  Andrew Hill

































 .



 --
 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] PHP Site Statistics

2002-02-05 Thread SpyProductions Support Team


Just installed Les Visiteurs for php site statistic gathering...looks fine.

Anyone have a favorite site statistic script/program in PHP?  I'm
experimenting with different ones to see what I like.

The only disadvantage I can see with Les Visiteurs is having to put a couple
of lines of code in every page you want tracked.  Fine for a new site, but
not so nifty for sites that already exist.

-Mike



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




[PHP-DB] query error...

2002-02-05 Thread jas

Ok what is wrong with this sql statement?
$sql = UPDATE $table_name SET
c_name=\$c_name\,s_addy=\$s_addy\,city=\$city\,state=\state\zip=\zi
p\,phone=\$phone\;

The error I recieve is as follows
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in
/path/to/wwwdemo_change.php3 on line 22

Parse error: parse error in /path/to/wwwdemo_change.php3 on line 22

I have looked on MySQL.com at the update function and it states I can use
the SET under UPDATE for multiple fields separated by a , and it is not
working... Any insight would be great.
Thanks in advance,
Jas



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




Re: [PHP-DB] query error...

2002-02-05 Thread biorn

Try putting single quotes around your variables in your update statement 
instead of the escaped double quotes, they are easier to read. 

Also, were you wanting to update all entries in that table to the same, 
c_name, s_addy, city, state, zip and phone?  If not, you will need to 
add 'where id=$id' (or something along those lines) to your update 
statement.  Otherwise, the way you have it now, it will update every row in 
your database to the same values for the listed fields.  


jas [EMAIL PROTECTED] said:

 Ok what is wrong with this sql statement?
 $sql = UPDATE $table_name SET
 c_name=$c_name,s_addy=$s_addy,city=$city,state=statezip=zi
 p,phone=$phone;
 
 The error I recieve is as follows
 Warning: Unexpected character in input: '' (ASCII=92) state=1 in
 /path/to/wwwdemo_change.php3 on line 22
 
 Parse error: parse error in /path/to/wwwdemo_change.php3 on line 22
 
 I have looked on MySQL.com at the update function and it states I can use
 the SET under UPDATE for multiple fields separated by a , and it is not
 working... Any insight would be great.
 Thanks in advance,
 Jas
 
 
 
 -- 
 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] Re: Sessions

2002-02-05 Thread Joe Van Meer

Hi there, make sure you aren't outputting anything to the browser prior to
sending headers ie the echos on top of page 3. When you register a session
variable you should assign it a value ie:

session_register(mysessionvar);
$mysessionvar = $whateveryouwish;

Also make sure session_start(); is at the top of every page with no space
before.

These should help you out a little. Joe :)


Álvaro muñoz sánchez [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi, all

 First of all, I apologize if this is a dump question but I can't find the
 answer. I'm trying to use sessions to keep the information about user and
 password in a database driven web application. I am trying with a simple
web
 page but I can't make it work correctly. Help me, please.

 Environment: Red Hat Linux 7.2, Apache 1.3.20, PHP 4.0.6
 Web pages:
 Page 1: web page with a form asking for a user name and password.
 Page 2: php page to validate the user name and pass and register them as
 session variables.
 Page 3: php page to show the user name and pass introduced.

 Code:

 Page 2:

 ? session_start(); ?
 ? $sessionid = session_id(); ?
 ? session_register ( $usr, $password, $sessionid); ?

 Page 3

 ? session_start(); ?
 ? echo $GLOBALS[usr]; ?
 ? echo $GLOBALS[password]; ?

 Results:
 Page 2: Opening the session
 Warning: Cannot send session cookie - headers already sent by (output
started
 at /var/www/html/sigma/agenda/index.php:13) in
 /var/www/html/sigma/agenda/index.php on line 27

 Warning: Cannot send session cache limiter - headers already sent (output
 started at /var/www/html/sigma/agenda/index.php:13) in
 /var/www/html/sigma/agenda/index.php on line 27

 Page 3: the same warnings and the value of the session variables is lost.

 Here are my settings for sessions in the php.ini, It could be a
configuration
 mistake.

 session.save_handler = files
 session.save_path = /tmp
 session.use_cookies = 1
 session.name = PHPSESSID
 session.auto_start = 0
 session.cookie_lifetime = 0
 session.cookie_path = /
 session.cookie_domain =
 session.serialize_handler = php
 session.gc_probability = 1
 session.gc_maxlifetime = 1440
 session.referer_check =
 session.entropy_length = 0
 session.entropy_file =
 session.cache_limiter = nocache
 session.cache_expire = 180
 session.use_trans_sid = 1

 I know that questions related to sessions had been treated in the list
before
 but I can't find the answer to this, so I think this must be a very stupid
 question, sorry.


 Thank you very much in advanced.
 --
 -
 Álvar Muñoz Sánchez
 Oficina Verde - UPV
 Información y Documentación
 -



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




Re: [PHP-DB] query error...

2002-02-05 Thread DL Neil

Ok jas

 Ok what is wrong with this sql statement?
 $sql = UPDATE $table_name SET
 c_name=\$c_name\,s_addy=\$s_addy\,city=\$city\,state=\state\zip=\zi
 p\,phone=\$phone\;

insufficient checking:
comma missing between state and zip
 incorrectly escaped before phone
...

 I have looked on MySQL.com at the update function and it states I can use
 the SET under UPDATE for multiple fields separated by a , and it is not
 working... Any insight would be great.

Insight: use ECHO to output $sql to the screen. If the results are less than 
satisfactory, copy-paste the sql
code into native MySQL or a management package, the errmsgs are usually more 
informative/directive.

Regards,
=dn



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




Re: [PHP-DB] query error...

2002-02-05 Thread Miles Thompson

Did you type this out or cut/paste? There was a comma missing between  
state\zip   . Should work when you add the comma.

Add a WHERE condition for the update, otherwise every row will be set to 
these values.
Common practice is to use single quotes around the char variables, saves a 
lot of escaping, keeps things more readable. In connection with this, 
echoing $sql would probably have revealed the missing comma, and don't feel 
badly, we've all done it.

Hope this sees you right - Miles


At 02:43 AM 1/31/2002 -0700, jas wrote:
Ok what is wrong with this sql statement?
$sql = UPDATE $table_name SET
c_name=\$c_name\,s_addy=\$s_addy\,city=\$city\,state=\state\zip=\zi
p\,phone=\$phone\;

The error I recieve is as follows
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in
/path/to/wwwdemo_change.php3 on line 22

Parse error: parse error in /path/to/wwwdemo_change.php3 on line 22

I have looked on MySQL.com at the update function and it states I can use
the SET under UPDATE for multiple fields separated by a , and it is not
working... Any insight would be great.
Thanks in advance,
Jas



--
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] Counting db generate links

2002-02-05 Thread Dave Carrera

Hi All
How do I count how many time a certain link generated in part from my db
has been click so that I can show this number to my visitors as some
kind of hit list, top 10 etc:

I thank you in advance for any help


Dave Carrera
Website Designer
http://www.davecarrera.com
 



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