Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update includes/core_class.php

Reduced the validate_post() method's code.
  • Loading branch information...
commit 930d287443dbb1589f0c207eda57033d6ed6d473 1 parent 04b7314
@Scroph Scroph authored
Showing with 2 additions and 27 deletions.
  1. +2 −27 includes/core_class.php
View
29 includes/core_class.php
@@ -5,33 +5,8 @@ class Core {
// Function to validate the post data
function validate_post($data)
{
- // Counter variable
- $counter = 0;
-
- // Validate the hostname
- if(isset($data['hostname']) AND !empty($data['hostname'])) {
- $counter++;
- }
- // Validate the username
- if(isset($data['username']) AND !empty($data['username'])) {
- $counter++;
- }
- // Validate the password
- if(isset($data['password']) AND !empty($data['password'])) {
- // pass
- }
- // Validate the database
- if(isset($data['database']) AND !empty($data['database'])) {
- $counter++;
- }
-
- // Check if all the required fields have been entered
- if($counter == '3') {
- return true;
- }
- else {
- return false;
- }
+ /* Validating the hostname, the database name and the username. The password is optional. */
+ return !empty($data['hostname']) && !empty($data['username']) && !empty($data['database']);
}
// Function to show an error
Please sign in to comment.
Something went wrong with that request. Please try again.