Friday, January 24, 2014

Department database design (7) - add new user






C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\ubc_surgery_pub\scripts\manage\common.php, line 1437 add
 <label style="display: block; float: left;">Location: <br />
    <input name="email" type="text" value="<?php echo $userinfo['room']?>" ></label>
line 1352 change
function addnewpersonwithdept($userid, $title, $firstname, $lastname, $honorifics,  $deptid, $email)
to
 function addnewpersonwithdept($title, $firstname, $lastname, $honorifics,  $room, $deptid, $email)
line 1359 add
                         . "', room='" . mysql_real_escape_string($room)
In users table:
line 1354 remove $userid
userid was changed to int(11) unsigned auto increment, room changed from varchar(32) to text.
line 2802, add
function countPubsPerUser1($userids){
  $userids = mysql_real_escape_string($userids);
  $q = "SELECT COUNT(*) AS cnt, userlist FROM PUBLICATIONS WHERE FIND_IN_SET('$userids',userlist)";
  if(!($res = mysql_query($q, connectpubsdb())))
    return false;
  while($row = mysql_fetch_assoc($res)){
      $counts= $row['cnt'];
  }
  return $counts;
}

C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\ubc_surgery_pub\scripts\personal\index.php, line 113 change
 $res = mysql_query("SELECT userid FROM USERS WHERE email='" . mysql_real_escape_string(stripslashes($email)) . "' LIMIT 1", connectpubsdb());
to
 $res = mysql_query("SELECT userid FROM USERS WHERE firstname='" . mysql_real_escape_string(stripslashes($firstname)) . "' AND lastname='". mysql_real_escape_string(stripslashes($lastname)) ."' LIMIT 1", connectpubsdb());
   line 166 change
addnewpersonwithdept(stripslashes($userid), stripslashes($title), stripslashes($firstname), stripslashes($lastname), stripslashes($honorifics), stripslashes($deptid), stripslashes($email));
to
 addnewpersonwithdept( stripslashes($title), stripslashes($firstname), stripslashes($lastname), stripslashes($honorifics), stripslashes($room), stripslashes($deptid), stripslashes($email));
line 82 add
  if(!isset($room))
    $room=$_REQUEST['room'];
  
line 177 changed to
echo "<p class='simplepaddedmessagebox'>Created a new user record, with Last name <strong>$lastname</strong> and first name <strong>$firstname</strong>.</p>"; 
 C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\ubc_surgery_pub\scripts\people\listallusers.php, line 28 change
 $line .= '(department: <a href="'.$depts[$row['deptid']]['depturl'].'">'.$depts[$row['deptid']]['NAME'].'</a>'; 
to
  $line .= '(department: '.$depts[$row['deptid']]['NAME'].'</a>';
 line 40 add
     $numpublished = countPubsPerUser1($row['userid']);
      $line .= ',number of publications: '.$numpublished;

C:\Users\jiansen\Desktop\CAS\jiansen_dir\www_cesei0_mobile\ubc_surgery_pub\scripts\query\index.php, line 243 change
   // $wh .= "userlist LIKE '%$v%' OR ";
to
   $wh .= "FIND_IN_SET('$v',userlist) OR ";

No comments:

Post a Comment