coverland914 wrote:
> I have an apache/mysql/php system set up where I work on their
> intranet and have a form that inputs data through `date', `status',
> `issue', `area', `type',  and `name' to a database named
> correctiveactions and table named correctiveactions_tbl.   This is a
> two form input process where the first form has text boxes with a drop
> down for `status' (incomplete as default) to make a query later on
> status items (incomplete vs complete) an easier task w/integrity to
> the query. 
>
> On my second form, I check to make sure the required text boxes are
> not left blank using this piece of code:
> <?
> require_once('generic_connect.php');
> $DBName = "correctiveactions";
> $table = "correctiveactions_tbl";
>  
> $ud_id=$_POST['ud_id'];
> $ud_date=$_POST['ud_date'];
> $ud_status=$_POST['ud_status'];
> $ud_issue=$_POST['ud_issue'];
> $ud_area=$_POST['ud_area'];
> $ud_type=$_POST['ud_type'];
> $ud_name=$_POST['ud_name'];
>
> if (!$ud_issue || !$ud_area || !$ud_type || !$ud_name)
>   {
>      echo 'You have not entered all the required fields.  Please click
> your Browser BACK button, complete the form and try again.';
>      exit;
>   }
>
> Next, and here's the puzzle for me but I'm pretty sure it's doable. 
> If I wanted to add 2 text fields on that first form to ensure someone
> doing an update was who they said they were.  I'd add `updater' and
> `passwordd' (intentionally misspelled) so on the 2nd page, they'd
> probably follow the rest of the $_POST variables as follows:
>
> $updater = $_POST['updater'];
> $passwordd = $_POST['passwordd'];
>
> So in short, I'd want to check for blank text boxes and echo an error
> message if there were any and then query a `password_tbl' within the
> correctiveactions database to ensure someone doing an update was in
> there prior to allowing an update of the database records  (so proceed
> to update on IF and echo an error message similar to the blank text
> fields ELSE IF &#61514;.  My update portion of the code is as follows and I'm
> hopeful that someone might be able to help me with the password query
> part of the code that takes place between checking for the `blank
> fields' check and proceeding to the `update' code.  So far the process
> works very well, just haven't been able to put together the query
> successfully that checks the password_tbl as the 2nd step prior to
> updating.
>
> mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to
> database"); // make connection to database
> mysql_select_db($DBName) or die("Unable to select database $DBName");
> // select database
>
> mysql_query("UPDATE correctiveactions_tbl SET date='$ud_date',
> status='$ud_status', issue='$ud_issue', area='$ud_area', type='$ud_type'
>       WHERE id='$ud_id'") or die("Update Error: ".mysql_error());
>
> Thanks VERY much for any help,
>
> Chris
>   
07142007 1214 GMT-6 DST

You can do
if(isset($_POST['password']) {

to see if the password is set. Then you can check to see how many 
characters are present. If there is 1 or less, then that is a bad 
password and they need to try again.

wade

Reply via email to