Example #1
0
 $imlines = file($imfn);
 //$hwm=getagenthwmanufacturers();
 echo "<b>Updating DB with={$imfn}</b>";
 foreach ($imlines as $line_num => $line) {
     if ($line_num == 0 && $_POST['skip1st']) {
         continue;
     }
     $cols = explode($delim, $line);
     //hw manufacturer
     if (gethwmanufacturerbyname($cols[$name2fno['manufacturer']]) != -1) {
         $hwman_old[] = trim($cols[$name2fno['manufacturer']]);
     } else {
         $hwman_new[] = trim($cols[$name2fno['manufacturer']]);
     }
     //users
     if (getuserbyname($cols[$name2fno['owner']]) != -1) {
         $user_old[] = trim($cols[$name2fno['owner']]);
     } else {
         $user_new[] = trim($cols[$name2fno['owner']]);
     }
     //itemtypes
     if (getitemtypeidbyname($cols[$name2fno['itemtype']]) >= 0) {
         $itypes_old[] = trim($cols[$name2fno['itemtype']]);
     } else {
         $itypes_new[] = trim($cols[$name2fno['itemtype']]);
     }
     //statustypes
     if (getstatustypeidbyname($cols[$name2fno['status']]) >= 0) {
         $stypes_old[] = trim($cols[$name2fno['status']]);
     } else {
         $stypes_new[] = trim($cols[$name2fno['status']]);
Example #2
0
     header("Location: {$scriptname}");
     //eat get parameters
 } elseif (isset($_POST['authusername'])) {
     //logging in
     $username = $_POST['authusername'];
     $password = $_POST['authpassword'];
     if ($settings['useldap'] && $username != 'admin') {
         $r = connect_to_ldap_server($settings['ldap_server'], $username, $password, $settings['ldap_dn']);
         //echo "HERE. r=".var_dump($r)."\n";
         if ($r == false) {
             $authstatus = 0;
             $authmsg = "Wrong Password";
         } else {
             $rnd = mt_rand();
             //create a random
             $u = getuserbyname($username);
             if ($u == -1) {
                 //user not found, it's an LDAP user, add him
                 db_execute2($dbh, "INSERT into users (username,cookie1,usertype) values (:username,:cookie1,:usertype)", array('username' => $username, 'cookie1' => $rnd, 'usertype' => 2));
             }
             db_exec($dbh, "UPDATE users set cookie1='{$rnd}' where username='******'", 1, 1);
             setcookie("itdbcookie1", $rnd, time() + 3600 * 24 * 2, $wscriptdir);
             //random number set for two days
             setcookie("itdbuser", $username, time() + 3600 * 24 * 60, $wscriptdir);
             //username
             $authstatus = 1;
             $authmsg = "User Authenticated";
         }
     }
     if (!$authstatus) {
         //try local users