public static function addContact($formData)
 {
     $link = UserUtility::getDefaultConnection();
     $name = mysqli_escape_string($link, $formData['myname']);
     $email_address = mysqli_escape_string($link, $formData['myemail']);
     $subject = mysqli_escape_string($link, $formData['subject']);
     $comment = mysqli_escape_string($link, $formData['mycomments']);
     $query = "insert into contact set name = '{$name}'," . " email='{$email_address}'," . " subject='{$subject}'," . " comment='{$comment}'";
     $ok = mysqli_query($link, $query);
     return $ok;
 }
Example #2
0
 function Collections()
 {
     $array = array();
     $query = "select * from library where on_shelf = 1 order by title ASC";
     $link = UserUtility::getDefaultDBConnection();
     $result = mysqli_query($link, $query);
     if ($result) {
         while ($row = mysqli_fetch_array($result)) {
             array_push($array, $row);
         }
     } else {
         //Log error
         UserUtility::logMySQLError($link);
     }
     $this->books = $array;
 }
Example #3
0
function isClassRep($regno)
{
    $query = "select * from admins where username = '******'";
    $link = UserUtility::getDefaultDBConnection();
    $result = mysqli_query($link, $query);
    if ($result) {
        return mysqli_num_rows($result) > 0;
    } else {
        return false;
    }
}
        $formerrors = true;
    } else {
        if (empty($myemail)) {
            $err_myemail = '<div class="error">Enter your Email</div>';
            $formerrors = true;
        } else {
            if (empty($subject)) {
                $err_subject = '<div class="error">Enter your country/div>';
                $formerrors = true;
            } else {
                if (empty($mycomments)) {
                    $err_mycomments = '<div class="error">What do you want us to do for you</div>';
                    $formerrors = true;
                } else {
                    $formdata = array('myname' => $myname, 'myemail' => $myemail, 'subject' => $subject, 'mycomments' => $mycomments);
                    UserUtility::addContact($formdata);
                    $msg = 'Thanks for filling out our form <a href="index.php">Back to home page</a> ';
                    $to = "*****@*****.**";
                    $subject = "We need developers";
                    $message = "Our company is in need of two web designers and one java programmer.";
                    //json_encode($formdata);
                    //if(sendMail($to, $subject, $message)){
                    //	$msg = "Thanks for filling out our form";
                    //}else{
                    //	$msg = "Problem sending the message";
                    //} // mail form data
                }
            }
        }
    }
}
Example #5
0
 /**
  * Verifies and changes User's password (This is supported on php version >= 5.5.0)
  * @param type $oldPassword
  * @param type $newPassword1
  * @param type $newPassword2
  * @return type
  * @throws Exception
  */
 public function changePassword($oldPassword, $newPassword1, $newPassword2)
 {
     if ($this->verifyPassword($oldPassword, $this->getUserPassword())) {
         //Check password
         $this->validatePassword($newPassword1);
         $ok = strcmp($newPassword1, $newPassword2) === 0;
         if ($ok) {
             $link = UserUtility::getDefaultDBConnection();
             $pwd = crypt($newPassword1);
             $query = "update users set password='******' where regno='" . $this->getUserID() . "'";
             mysqli_query($link, $query);
             //Log error
             UserUtility::logMySQLError($link);
             //Reload
             $this->userInfo = $this->getUserData();
             $ok = $this->setUserCookies($this->userInfo['regno'], $this->userInfo['password']);
             return $ok;
         } else {
             throw new Exception("Passwords do not match");
         }
     } else {
         throw new Exception("Wrong password");
     }
 }
Example #6
0
 public function plusOneHit($id)
 {
     $query = "update news set hits = hits + 1 where id = '{$id}'";
     $link = UserUtility::getDefaultDBConnection();
     $result = mysqli_query($link, $query);
     //Log error
     UserUtility::logMySQLError($link);
     return $result;
 }
Example #7
0
 function storeFeedBack()
 {
     $link = UserUtility::getDefaultDBConnection();
     $query = "insert INTO feedbacks(ip,message,img,browser,page,is_mobile_browser) VALUES('{$this->ip}','{$this->message}','{$this->img}','{$this->browser}','{$this->url}','{$this->isBrowserMobile}')";
     $result = mysqli_query($link, $query);
     if ($result) {
         return 1;
     } else {
         return 0;
     }
 }
         $formerrors = true;
     } else {
         if (empty($mycompanysite)) {
             $err_mycompanysite = '<div class="error">Enter your company\'s url</div>';
             $formerrors = true;
         } else {
             if (empty($reference)) {
                 $err_reference = '<div class="error">How you hear about us is a required field/div>';
                 $formerrors = true;
             } else {
                 if (empty($mycomments)) {
                     $err_mycomments = '<div class="error">What do you want us to do for you</div>';
                     $formerrors = true;
                 } else {
                     $formdata = array('myname' => $myname, 'myemail' => $myemail, 'myphone_number' => $myphone_number, 'mycountry' => $mycountry, 'mycompanysite' => $mycompanysite, 'reference' => $reference, 'mycomments' => $mycomments);
                     UserUtility::addCompanyRequest($formdata);
                     $msg = 'Thanks for filling out our form <a href="index.php">Back to home page</a> ';
                     $to = "*****@*****.**";
                     $subject = "We need developers";
                     $message = "Our company is in need of two web designers and one java programmer.";
                     //json_encode($formdata);
                     //if(sendMail($to, $subject, $message)){
                     //	$msg = "Thanks for filling out our form";
                     //}else{
                     //	$msg = "Problem sending the message";
                     //} // mail form data
                 }
             }
         }
     }
 }
Example #9
0
 public static function getExecutives($session = "")
 {
     $executives = array();
     $query = "select e.id, u.regno, u.first_name, u.last_name, u.other_names, u.department, u.pic_url, e.post, e.session " . "from users u join executives e " . "on (u.regno = e.user_id) ";
     if (!empty($session)) {
         $query .= "where e.session = '{$session}' ";
     }
     $query .= "order by session desc";
     $link = UserUtility::getDefaultDBConnection();
     $result = mysqli_query($link, $query);
     if ($result) {
         while ($row = mysqli_fetch_array($result)) {
             $executives[] = $row;
         }
     }
     //Log error
     UserUtility::logMySQLError($link);
     return $executives;
 }