[PHP-DB] Re: $_POST["mypassword"]; ***Undefined index: mypassword

2007-05-15 Thread Chetan Graham
To All,
I am so thankful to Dimiter, Bedul, Chris and Mikael for their input in
this issue of mine.
I spent at least three full crazy, frustrating long days and nights
working this so-called problem only to find out it is simply the PHP
parser looking at a "moment in time" with the login.php function.  After
running the script, the incredible PHP "mind" saw two 'empty' and
'unlabeled' containers amongst all the other 'properly' dressed containers
and whatnot, that happened to be associated with the $_POST array.
This to my mind is a bit of a bug.  For you all see that it is 'normal'
that certain functions and resources are only 'holding' values for as long
as they 'have' to.  Their nature is to be empty, and ready to take another
value for as long as the contract is called for, and not a microsecond
longer.
So the PHP trigger_error()(generated in PHP code like an E_WARNING) is
simply not able to hold itself back from commenting on issues such as
this.

Anyway, I learned things I would have never learned this soon and rewrote
these function about twenty times looking for a better way.  God, I love
coding!
Blessings,
Chetanji -(a he)

Bedul wrote:
it seem the poster already have the answer..
what he/she going to do was how to save username and pass on session.

thx for your help

> [ taking php-windows out again :P ]
>
> bedul wrote:
 > the problem is right here (said on error msg):
 > session_register("myusername"); session_register("mypassword");
 >
 > u should use session_register("myusername") after declare the name.
 > i taken from my php chm
 >
 > It is currently impossible to register resource variables in a session.
For example, you cannot create a connection to a database and store the
connection id as a session variable and expect the connection to still be
valid the next time the session is restored. PHP functions that return a
resource are identified by having a return type of resource in their
function definition. A list of functions that return resources are available
in the resource types appendix.
 >
 > if you understand what statement above.. conguration, if not.. don't
shock.. me either.
>
> You can't store database connections in a session.
>
> Ie you can't:
>
> $connection = mysql_connect();
>
> $_SESSION['DbConnection'] = $connection;
>
>
> because the HTTP protocol (and thus PHP) is stateless - you don't know
> where the next connection is coming from or even if there is another
> connection coming.
>
> If there is another HTTP request, you have no way of linking request '1'
> (where the database connection was set up) to request '47' in the chain.

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



[PHP-DB] PHP to md5 the $var before it reaches MySQL's gen query log

2007-05-12 Thread Chetan Graham
Greetings to All,
I am having difficulty in 'md5'ing a $var in a function before it is
placed into the ("INSERT INTO table...

The whole point is I don't want the MySQL DB logs showing my $var's
password and username 'before' it is encrypted by MySQL's md5.

When MySQL receives PHP's encrypted $var the log shows query INSERT with
the 32 bits but it is not inserted into the DB.

MySQL will not accept the $var's in the code that is commented out.
It shows no errors by the way.
MySQL accepts what is shown, but this is not as I explained what I want.
Thanks In Advance,
Chetan

 mysql_query("CREATE TABLE IF NOT EXISTS docproedit (
  id int(11) NOT NULL auto_increment,
  username BLOB NOT NULL default '',
  password BLOB NOT NULL default '',
  TimeEnter timestamp,
  PRIMARY KEY (id)
   )
  ENGINE=MyISAM;")or die('Create Died' . mysql_error());



New User Added!";
?>

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



[PHP-DB] Re: MySQL5037srv//PHP522//WIN2KSP4//IISV5//***MySQL ERRORS

2007-05-08 Thread Chetan Graham
Thanks for everyone's indulgence, I figured out the problem.
simple syntax around the INSERT as follows with the mysql_query.

mysql_query("INSERT INTO docprouser (id,valid,password
VALUES('root','y',md5('ksobhinyai'))");

Blessings,
Chetan


> I am having problems with the MySQL DB.  It started with this command from
> a call in a PHP script...
>
> "INSERT INTO docprouser (id,valid,password)VALUES
> ('user5','Y',md5('ksobhinyai'));" or die(mysql_error());"
>
> The script actually connects with the DB fine and no errors at all.  You
> can see the screen output in the attatched text file.  However, there is
> no new entry in DB.
>
> Upon looking at the error log for the specified time I get:
>
> **Query Execute Thread cannot connect to MySQL **
>
> However, if I cut/paste the above into the query window of GUI it executes
> just fine, and shows the record written.
>
> I've dnloaded the latest OBDC connector and set up correctly.
> I've googled the MySQL errors to no avail.
> TCP/IP is active on pc.
> The tables were even created with this script.
>
> I'm beyond frustrated, as two days now have been stuck with this DB
> problem.  I just spent the last five or six hours deleting the DB off the
> server and reloading it several times which cleared up several previous
> problems.  Now, it comes down to this one.
>
> Any help would be appreciated.
> Blessings,
> Chetan

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



[PHP-DB] MySQL5037srv//PHP522//WIN2KSP4//IISV5//***MySQL ERRORS

2007-05-07 Thread Chetan Graham
Hi to All,

I am having problems with the MySQL DB.  It started with this command from
a call in a PHP script...

"INSERT INTO docprouser (id,valid,password)VALUES
('user5','Y',md5('ksobhinyai'));" or die(mysql_error());"

The script actually connects with the DB fine and no errors at all.  You
can see the screen output in the attatched text file.  However, there is
no new entry in DB.

Upon looking at the error log for the specified time I get:

**Query Execute Thread cannot connect to MySQL **

However, if I cut/paste the above into the query window of GUI it executes
just fine, and shows the record written.

I've dnloaded the latest OBDC connector and set up correctly.
I've googled the MySQL errors to no avail.
TCP/IP is active on pc.
The tables were even created with this script.

I'm beyond frustrated, as two days now have been stuck with this DB
problem.  I just spent the last five or six hours deleting the DB off the
server and reloading it several times which cleared up several previous
problems.  Now, it comes down to this one.

Any help would be appreciated.
Blessings,
Chetan-ONE-Connected to Server! $dtime";
  
  
  if (!mysql_select_db($db,$con)){
   echo "Unable to select aims site DB" . mysql_error();
 exit;
  }echo "-TWO-Connected to aims site DB! $dtime"; 
 
 
//*
 //-- JUST TRYING TO STUFF DATA INTO DB,  TO SEE IF IT WORKS
 
//*
 //--  AS PROCESS IN WRITING LARGER PROGRAM
 
//*
 

 mysql_query("CREATE TABLE IF NOT EXISTS docprouser ( 
 p_id int(11) NOT NULL auto_increment, 
 id varchar(20), 
 valid enum('y','n'), 
 password BLOB null, 
 timeEnter timestamp, 
 PRIMARY KEY (p_id)
 )
 ENGINE=MyISAM COMMENT='logon user & password';") or die('Create 
Died' . mysql_error());
 
 echo "-THREE-Step before data insertion into docprouser 
table! $dtime";


  "INSERT INTO docprouser 
(id,valid,password)VALUES('user5','Y',md5('ksobhinyai'));" or 
die(mysql_error()); "INSERT INTO docprouser 
(id,valid,password)VALUES('admin','Y',md5('srimatre'));" or die(mysql_error());
 "INSERT INTO docprouser (id,valid,password)VALUES
 
('user1','Y',md5('lalitambikayai'));" or die(mysql_error());
 "INSERT INTO docprouser 
(id,valid,password)VALUES('user2','Y',md5('hrdyayai'));" or die(mysql_error());
 "INSERT INTO docprouser 
(id,valid,password)VALUES('user3','Y',md5('ramyayai'));" or die(mysql_error());
 "INSERT INTO docprouser 
(id,valid,password)VALUES('user4','Y',md5('avaradayai'));" or 
die(mysql_error());
 "INSERT INTO docprouser 
(id,valid,password)VALUES('user5','Y',md5('ksobhinyai'));" or 
die(mysql_error());
 
 echo "-FOUR-Inserted data into docprouser 
table! $dtime";
 
if ($query="SELECT id, password FROM docprouser WHERE 'valid' = 
'y'") {
   $result = mysql_query($query);
 while ($logdata = mysql_fetch_row($result)) {
print("$logdata[0] $logdata[1]\n");
break;
   }
}
else   {
echo "-FIVE-There is no data in docprouser table!  We 
have a problem???! $dtime"; 
break;
   }


 echo 'Congratulations, database or table(s) have been 
created!
 You may now read the latest mail http://news.php.net/group.php?group=php.db";>PHP.NET';
?>
**
BELOW IS THE SCREEN OUTPUT FROM ABOVE PHP PROGRAM
**

-ONE-Connected to Server!10:52am
-TWO-Connected to aims site DB!10:52am
-THREE-Step before data insertion into docprouser table!10:52am
-FOUR-Inserted data into docprouser table!10:52am

Congratulations, database or table(s) have been created!

You may now read the latest mail PHP.NET
-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DB] [sory] Re: [PHP-DB] Re: [PHP-WIN] automatic-click flash?

2007-05-07 Thread Chetan Graham

Bedul wrote:
>sorry.. that's pure my fault.. i should type for php-win
>my mail setting are always to send to php-db

>that's wont happen again

>> Why do you keep cc'ing the php-db list with responses
>> that have nothing
>> to do with the list?
>>

What is so funny Bedul, is the very next post after this apology of
yours for loving your PHP.mail.lists has nothing to do with DB's...
it's is about HTML code. So on it goesI've always enjoyed your upbeat
attitude about different peoples needs in the php.mail.lists.
Bravo Bedul.

http://news.php.net/php.db/43555  HTML question in the DB list.

There have to be rules in mail forums. Yes, but once started it
becomes a living thing that works just fine.  Sure, lets limit the
straying into 'other' zones where it would be better posted in the
'correct' one.
But, lets also be reasonable.

I've seen the most objectionable items in this list that have nothing
to do with DB's , somehow a door gets left open and the undercurrents
of the world come in uninvited.

Let us try to see the good in every action,
Blessings,
Chetan

Why even a broken clock is correct twice a day!

I've also noted nobody posts to them as well.  Is anybody hurt? who knows.
 I doubt it.  And certainly Bedul's posts are fine.

Has anyone ever noticed that when too many rules are enforced that people
walk away?


  http://news.php.net/php.db/43555

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



Re: [PHP-DB] Storing 4KB jpeg images on hospital web server

2007-03-08 Thread Chetan Graham
>  i do know there's no problem upload 4kb img to database
> but is different case for.. 1mb pic.. it always fail.
>> >>
>> >> CREATE TABLE image (
>> >> image_id int(10) unsigned NOT NULL auto_increment,
>> >> image_type varchar(50) NOT NULL default '',
> my application said is header
> 
>
>> >> image longblob NOT NULL,
>> >> image_size bigint(20) NOT NULL default '0',
> u don't need size.. since is able to count/strlen from image
> -
>
>> >> image_name varchar(255) NOT NULL default '',
>> >> image_date datetime NOT NULL default '-00-00 00:00:00',
>> >> UNIQUE KEY image_id (image_id)
>> >> );
>> >>
> what u mention above, i suggest to use cms like jomlaa

Chetan wrote: I googled the jomlaa(when I first saw it I automatically
thought you were speaking your native nepalise language or something. 
Indeed it is like mambo.  I will download either one and look into the CMS
aspect of it.
Back to the Hospital website.  Now the Web Boss wants to put the images in
the DB.  I do feel the webserver folders would simply and well.
However, we do what the boss says.
Again, thankyou all for your quick and wonderful help.
Blessings, Chetan
>

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



Re: [PHP-DB] Storing 4KB jpeg images on hospital web server

2007-03-07 Thread Chetan Graham
> Chetan Graham wrote:
>> Hi to All,
>>
>> There is a page on our hospitals website where a patient can look at the
>> choice of different doctors with their credentials, publications,
>> hobbies,
>> etc.Each doctor has or will have a 3-4KB jpeg image as well.
>>
>> We are using MySQL5.0.2.7 with PHP5.2.1
>> My question concerns the following:
>> The existing table's fields with one for the image:
>>
>> TABLE finddoc
>> id-int,not null, auto inc., unsigned,
>> name varchar(25),
>> desig varchar(30),
>> dept varchar(20),
>> email varchar(50),
>> image varchar(6000),
>> qualification varchar(100),
>> publications longtext,
>> areaofinterest longtext, not null,
>> achievements longtext not null,
>>
>> My job is to develop a page where a admin user can create and edit
>> existing doctor profiles. My question is about the image uploading part.
>> I have a feeling the one field given to me for images is quite limited.
>> Would it not be better to add another table with all the image info.
>> such
>> as the following?
>>
>> CREATE TABLE image (
>> image_id int(10) unsigned NOT NULL auto_increment,
>> image_type varchar(50) NOT NULL default '',
>> image longblob NOT NULL,
>> image_size bigint(20) NOT NULL default '0',
>> image_name varchar(255) NOT NULL default '',
>> image_date datetime NOT NULL default '-00-00 00:00:00',
>> UNIQUE KEY image_id (image_id)
>> );
>>
>> This will give greater control of the images or better manipulation of
>> data.
>> If it is recommended by you php/mysql higher souls to add a table such
>> as
>> this.  Then I have more questions.  Or perhaps the existing table is
>> fine.
>> One might guess I inherited this project.
>
> Do you need to store the image in the database (either for security
> reasons or something like replication) ?
>***Chetan writes:Actually the DB table 'finddoc' holds data for all
fields except the 'image' field.  In this field, right now,  it only
holds the reference to the web folder where the images are stored. All
the doctors images are in the same folder.  The problem is my job is to
bring all the profiles up to the current level of doctors in the
hospital.  We have close to 300 doctors right now working.

This is the reason I was thinking of actually putting the images in the
DB.  However, whatever is easier and just as effective.  Please let me
know if this has any bearing on your unexpected and excellent observation
of using the web server's file folders.  You might want to check out the
web site as it is now.  Only a small percentage of the doctors are listed
and not many photo's at all.


http://www.aimshospital.org/findadoc/find-a-doctor.php?id=47

>
> Maybe it would be easier to store them in a folder for each doctor on
> the server directly rather than in the DB.
>
> eg create a doctor_images/{doctor_id}/ folder and upload the images
> there.. then you don't have to worry about the db etc.
>
> --Thank you for your quick and to the point reply. I have something to
consider an about face in the design!  Chetan
> Postgresql & php tutorials
> http://www.designmagick.com/
>

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



[PHP-DB] Storing 4KB jpeg images on hospital web server

2007-03-07 Thread Chetan Graham
Hi to All,

There is a page on our hospitals website where a patient can look at the
choice of different doctors with their credentials, publications, hobbies,
etc.Each doctor has or will have a 3-4KB jpeg image as well.

We are using MySQL5.0.2.7 with PHP5.2.1
My question concerns the following:
The existing table's fields with one for the image:

TABLE finddoc
id-int,not null, auto inc., unsigned,
name varchar(25),
desig varchar(30),
dept varchar(20),
email varchar(50),
image varchar(6000),
qualification varchar(100),
publications longtext,
areaofinterest longtext, not null,
achievements longtext not null,

My job is to develop a page where a admin user can create and edit
existing doctor profiles. My question is about the image uploading part.
I have a feeling the one field given to me for images is quite limited. 
Would it not be better to add another table with all the image info. such
as the following?

CREATE TABLE image (
image_id int(10) unsigned NOT NULL auto_increment,
image_type varchar(50) NOT NULL default '',
image longblob NOT NULL,
image_size bigint(20) NOT NULL default '0',
image_name varchar(255) NOT NULL default '',
image_date datetime NOT NULL default '-00-00 00:00:00',
UNIQUE KEY image_id (image_id)
);

This will give greater control of the images or better manipulation of data.
If it is recommended by you php/mysql higher souls to add a table such as
this.  Then I have more questions.  Or perhaps the existing table is fine.
One might guess I inherited this project.
Blessings,
Chetan

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