<TITLE>DI user info</TITLE>
<BODY BGcolor=BLACK TEXT=WHITE ALINK=WHITE VLINK=WHITE LINK=WHITE>

<!
$sock=msqlConnect();
if ($sock<0) {
   echo("<CENTER><TABLE WIDTH=400 BORDER=2 BGCOLOR=RED>\n");
   echo("<TR><TD>\n<BR><CENTER>$ERRMSG</CENTER><BR>\n</TD></TR>\n</TABLE>\n");
   exit(0);
   }

if (msqlSelectDB($sock, "AR")<0) {
   echo("<CENTER><TABLE WIDTH=400 BORDER=2 BGCOLOR=RED>\n");
   echo("<TR><TD>\n<BR><CENTER>$ERRMSG</CENTER><BR>\n</TD></TR>\n</TABLE>\n");
   exit(0);
   }


if (msqlQuery($sock, "SELECT * FROM ar_users WHERE nmbr=$nmbr")<0) {
   echo("<CENTER><TABLE WIDTH=400 BORDER=2 BGCOLOR=RED>\n");
   echo("<TR><TD>\n<BR><CENTER>$ERRMSG</CENTER><BR>\n</TD></TR>\n</TABLE>\n");
   exit(0);
   }
$fd=msqlStoreResult();
$data=msqlFetchRow($fd);

if (#$data==0) {
   $greska="Sorry, this user has been deleted.<BR>Probably in last few minutes.";
   echo("<CENTER><TABLE WIDTH=400 BORDER=2 BGCOLOR=RED>\n");
   echo("<TR><TD>\n<BR><CENTER>$greska</CENTER><BR>\n</TD></TR>\n</TABLE>\n");
   exit(0);
   }

   $user=$data[1]; $password=$data[2]; $ppassword=$data[2]; $name=$data[3];
   $surname=$data[4]; $title=(int)$data[5]; $usr_other_title=$data[6]; 
   $job_title=(int)$data[7]; $h_street=$data[8]; 
   $h_city=$data[9]; $h_country=$data[11]; $h_zip=$data[10];
   $h_phone=$data[12]; $company=$data[13];  $dept=$data[14];
   $w_street=$data[15];  $w_city=$data[16]; $w_zip=$data[17];
   $w_country=$data[18];  $w_phone1=$data[19]; $fax=$data[21];
   $w_phone2=$data[20]; $w_account=$data[22]; $account=$data[23]; 
   $home_page=$data[26]; $email1=$data[24]; $email2=$data[25];
   $di_page=(int)$data[28];

if (msqlQuery($sock, "SELECT * FROM title ORDER BY nmbr")<0) {
   echo("<CENTER><TABLE WIDTH=400 BORDER=2 BGCOLOR=RED>\n");
   echo("<TR><TD>\n<BR><CENTER>$ERRMSG</CENTER><BR>\n</TD></TR>\n</TABLE>\n");
   exit(0);
   }
$fd=msqlStoreResult();
$data=msqlFetchRow($fd);
$i=0;
$title_n[0]=0;
$title_s[0]="Other";
$title_l[0]="Other";
while(#$data>0) {
   $i= $i + 1;
   $title_n[$i]=(int)$data[0];
   $title_s[$i]=$data[1];
   $title_l[$i]=$data[2];
   $data=msqlFetchRow($fd);
   }
msqlFreeResult($fd);
$title_num=$i;

if (msqlQuery($sock, "SELECT * FROM job_title ORDER BY nmbr")<0) {
   echo("<CENTER><TABLE WIDTH=400 BORDER=2 BGCOLOR=RED>\n");
   echo("<TR><TD>\n<BR><CENTER>$ERRMSG</CENTER><BR>\n</TD></TR>\n</TABLE>\n");
   exit(0);
   }
$fd=msqlStoreResult();
$data=msqlFetchRow($fd);
$i=0;
$jobtitle_n[0]=0;
$jobtitle_s[0]="None";
$jobtitle_l[0]="None";
while(#$data>0) {
   $i= $i + 1;
   $jobtitle_n[$i]=(int)$data[0];
   $jobtitle_s[$i]=$data[1];
   $jobtitle_l[$i]=$data[2];
   $data=msqlFetchRow($fd);
   }
msqlFreeResult($fd);
$jobtitle_num=$i;

$err="";


$time=time();
$cur_year=unixtime2year($time);

echo("<FORM ACTION=\"update.msql\">\n");
echo("<INPUT TYPE=\"hidden\" NAME=\"nmbr\" VALUE=\"$nmbr\">\n");
echo("<table width=720 cellpadding=0 cellspacing=0 border=0>\n");
echo("<td width=100><HR SIZE=5></TD><TD COLSPAN=2 WIDTH=620><hr size=5></td></tr>\n");
if ($err!="") {
   echo("<TR><TD COLSPAN=3><CENTER>\n<TABLE WIDTH=400 BORDER=2 BGCOLOR=RED>\n");
   echo("<TR><TD>\n<BR><CENTER>$err</CENTER><BR>\n</TD></TR>\n</TABLE>\n</TD></TR>\n");
   echo("<TR><TD COLSPAN=3><HR SIZE=5></TD></TR>\n");
   }
echo("<tr>\n");
echo("<tr><td WIDTH=100></td><td valign=top colspan=2>Now choose a <b>AR Username</b> - up to 20 characters (no spaces)<br>and case-sensitive.\n");
echo("You will also need to choose a <b>Password</b> - at least 5 characters long and case-sensitive.</td>\n");
echo("</tr>\n");
echo("<tr>\n");
echo("<td align=right valign=top><font size=+1 color=red>&nbsp;&nbsp;&nbsp;Username</font></td><td valign=top colspan=2><input maxlength=\"20\" name=\"user\" type=\"text\" value=\"$user\" size=\"20\"></input></td>\n");
echo("</tr>\n");
echo("<input name=\"chng\" type=\"hidden\" value=\"OK\"></input>\n");
echo("<tr>\n");
echo("<td align=right valign=top><font size=+1 color=red>Password</font></td><td valign=\"top\" colspan=2><input name=\"password\" type=\"password\" value=\"$password\" size=\"20\"></input></td>\n");
echo("</tr>\n");
echo("<tr>\n");
echo("<td align=right valign=top><font size=+1 color=red>Verify <br>password</font></td><td valign=top colspan=2><input name=\"ppassword\" type=\"password\" value=\"$ppassword\" size=\"20\"></input></td>\n");
echo("</tr>\n");
echo("<tr>\n");
echo("<td></td><td colspan=2><hr size=5></td>\n");
echo("</tr>\n");
echo("<TR><TD>First Name:</TD><TD><INPUT name=\"name\"  value=\"$name\" SIZE=30></TD></TR>\n");
echo("<TR><TD>Last name:</TD><TD><INPUT name=\"surname\" value=\"$surname\" SIZE=30></TD></TR>\n");
echo("<TR><TD>Title</td><td>\n");
echo("<select name=\"usr_title\">\n");

$i=0;
while($i<=$title_num) {
   $chkd="";
   if ((int)$title==(int)$title_n[$i]) {
      $chkd="SELECTED";
      }
   echo("   <OPTION VALUE=\"$title_n[$i]\" $chkd>$title_s[$i]</OPTION>\n");
   $i=$i + 1;
   }

echo("</select>\n");
echo("<input name=\"usr_other_title\" type=\"text\" value=\"$usr_other_title\" size=\"10\"> (If \"Other\")</input></td>\n");
echo("</tr>\n");
echo("<TR><TD>Job title:</TD><TD>\n");
echo("<select name=\"job_title\">\n");

$i=0;
while($i<=$jobtitle_num) {
   $chkd="";
   if ((int)$job_title==$jobtitle_n[$i]) {
      $chkd="SELECTED";
      }
   echo("   <OPTION VALUE=\"$jobtitle_n[$i]\" $chkd>$jobtitle_s[$i]</OPTION>\n");
   $i=$i + 1;
   }

echo("</select>\n");
echo("</TD>\n");
echo("</tr>\n");
echo("<tr>\n");
echo("<tr><td></td><td colspan=4><hr size=5></td>\n");
echo("</tr>\n");
echo("<TR><TD COLSPAN=2><BR>Home Address:</TD></TR>\n");
echo("<TR><TD>Address: </TD><TD><INPUT name=\"h_street\" value=\"$h_street\" SIZE=30></TD></TR>\n");
echo("<TR><TD>City:     </TD><TD><INPUT name=\"h_city\" value=\"$h_city\" SIZE=20></TD></TR>\n");
echo("<TR><TD>Zip:      </TD><TD><INPUT name=\"h_zip\" value=\"$h_zip\" SIZE=10></TD></TR>\n");
echo("<TR><TD>Country:  </TD><TD><INPUT name=\"h_country\" value=\"$h_country\" SIZE=20></TD></TR>\n");
echo("<TR><TD>Phone:    </TD><TD><INPUT name=\"h_phone\" value=\"$h_phone\" SIZE=20></TD></TR>\n");
echo("<TR><TD COLSPAN=2><BR>Business Address:</TD></TR>\n");
echo("<TR><TD>Company:  </TD><TD><INPUT name=\"company\" value=\"$company\" SIZE=30></TD></TR>\n");
echo("<TR><TD>Department:</TD><TD><INPUT name=\"dept\" value=\"$dept\" SIZE=30></TD></TR>\n");
echo("<TR><TD>Address:  </TD><TD><INPUT name=\"w_street\" value=\"$w_street\" SIZE=30></TD></TR>\n");
echo("<TR><TD>City:     </TD><TD><INPUT name=\"w_city\" value=\"$w_city\" SIZE=20></TD></TR>\n");
echo("<TR><TD>Zip:      </TD><TD><INPUT name=\"w_zip\" value=\"$w_zip\" SIZE=10></TD></TR>\n");
echo("<TR><TD>Country:  </TD><TD><INPUT name=\"w_country\" value=\"$w_country\" SIZE=20></TD></TR>\n");
echo("<TR><TD>Phone:    </TD><TD><INPUT name=\"w_phone1\" value=\"$w_phone1\" SIZE=20></TD></TR>\n");
echo("<TR><TD>Other phone:</TD><TD><INPUT name=\"w_phone2\" value=\"$w_phone2\" SIZE=20></TD></TR>\n");
echo("<TR><TD>Fax:      </TD><TD><INPUT name=\"fax\" value=\"$fax\" SIZE=20></TD></TR>\n");
echo("<TR><TD COLSPAN=2><BR><FONT SIZE=4>Account Data:</FONT></TD></TR>\n");
echo("<TR><TD>Business Acc:</TD><TD><INPUT name=\"w_account\" value=\"$w_account\" SIZE=30></TD></TR>\n");
echo("<TR><TD>Personal Acc:</TD><TD><INPUT name=\"account\" value=\"$account\" SIZE=30></TD></TR>\n");
echo("<TR><TD COLSPAN=2><BR></TD></TR>\n");
echo("<TR><TD>E-mail 1:   </TD><TD><INPUT name=\"email1\" value=\"$email1\" SIZE=30></TD></TR>\n");
echo("<TR><TD>E-mail 2:   </TD><TD><INPUT name=\"email2\" value=\"$email2\" SIZE=30></TD></TR>\n");
echo("<TR><TD>Home Page:</TD><TD><INPUT name=\"home_page\" value=\"$home_page\" SIZE=30></TD></TR>\n");
$dip=""; if ((int)$di_page==1) { $dip="CHECKED"; }
echo("<TR><TD>DI Page:</TD><TD><INPUT name=\"di_page\" VALUE=\"1\" TYPE=\"checkbox\" $dip></INPUT></TD></TR>\n");
echo("<TR><TD COLSPAN=2><BR></TD></TR>\n");
echo("</tr>\n");
echo("<tr><TD><HR SIZE=5></td><td colspan=4><hr size=5></td>\n");
echo("</tr>\n");
echo("<TR><TD COLSPAN=3><INPUT TYPE=\"reset\" VALUE=\"Clear fileds\">\n");
echo("<INPUT TYPE=\"submit\" VALUE=\"Submit data\"></TD></TR>\n");
echo("</TD></TR>\n");
echo("</TABLE>\n</FORM>");

>

</BODY>
</HTML>
