function validateForm(&$errors)
{
    global $input;
    if (!isRequired($input) || !inputLength($input)) {
        $errors[] = 'You must add 10 numbers separated by comma (with no space inbetween).';
    } else {
        if (!validInput($input)) {
            $errors[] = 'Numbers only.';
        }
    }
}
function validateForm(&$errors)
{
    global $firstname, $lastname, $date;
    if (!requiredInput($firstname)) {
        $errors['firstname'][] = 'You must enter your firstname.';
    } else {
        if (!validInput($firstname)) {
            $errors['firstname'][] = 'Your firstname must consist of only latin letters.';
        }
    }
    if (!requiredInput($lastname)) {
        $errors['lastname'][] = 'You must enter your lastname.';
    } else {
        if (!validInput($lastname)) {
            $errors['lastname'][] = 'Your lastname must consist of only latin letters.';
        }
    }
    if (empty($date)) {
        $errors['date'][] = 'You must enter your birth date.';
    }
}
Example #3
0
<head>
<title>Lab1 Calendar</title>
</head>
<body>
<form action="./calendar.php" method="get">
		Enter year: <input name="year"><br /> 
		Enter month: <input name="month"><br />
<input type="submit" value="Show calendar">
	</form>
</body>
</html>
<?php 
if (isset($_GET['month']) && isset($_GET['year'])) {
    $month = $_GET['month'];
    $year = $_GET['year'];
    if (validInput($year, $month)) {
        setCalendar($year, $month);
    } else {
        echo 'Bad input parameters';
    }
}
function validInput($year, $month)
{
    if (is_numeric($year) && is_numeric($month)) {
        if ($year > 1601 && $year < 2399) {
            return true;
        }
    }
    return false;
}
function setCalendar($inYear, $inMonth)
Example #4
0
    if(!$res)
    	echo "not a valid input : ".$input."<br>";
    */
    return $res;
}
function textureName2Id($texture_name)
{
    $requete = "SELECT Id FROM texture WHERE Name='" . $texture_name . "';";
    $resultat = exec_game_db_requete($requete);
    if ($ligne = mysql_fetch_array($resultat)) {
        return $ligne[0];
    }
    echo "texture not found : " . $texture_name;
    return -1;
}
if (!isset($user_login) || !validInput($user_login)) {
    $user_login = "******";
}
$uploaddir = '/home/skeet/cvs/code/mtp-target/user_texture/';
$webdir = '/var/www/';
$uploadfilename = strtolower($_FILES['userfile']['name']);
$uploadcrcflagname = 'update_crc_flag.txt';
$uploadcrcflagfilename = $uploaddir . $uploadcrcflagname;
$uploadfile = $uploaddir . $uploadfilename;
$maxfilesize = 300000;
// some tga are bigger because they add some dumb extra infos
if ($_FILES['userfile']['size'] > $maxfilesize) {
    die("FAILED! The file you tried to upload is too big (can't be more than " . maxfilesize . " bytes)");
}
if (file_exists($uploadfile) || $uploadfilename == "ping_ball_blue.tga") {
    die("FAILED! The file you tried to upload already exists, please, use another name");
Example #5
0
function addnewUser($realName, $userName, $password, $email, $birth)
{
    global $yol1;
    $datem = date("Y-n-j H:i:s");
    if (strlen($realName) < 5 || strlen($userName) < 5 || strlen($email) < 5 || strlen($birth) < 5 || strlen($password) < 5 || strlen($realName) > 30 || strlen($userName) > 15 || strlen($email) > 50 || strlen($birth) > 10 || strlen($password) > 15) {
        return false;
    }
    if ($realName == "" || $userName == "" || $password == "" || $email == "" || $birth == "") {
        return false;
    }
    if (substr_count($password, substr($password, 0, 1)) == strlen($password)) {
        return false;
    }
    if (!validInput($userName) || !validInput($password)) {
        return false;
    }
    $realName = trim(substr(temizle($realName), 0, 30));
    $userName = trim(substr(temizle($userName), 0, 15));
    $password = trim(substr(temizle($password), 0, 15));
    $email = trim(substr(temizle($email), 0, 50));
    $birth = tarihYap(trim(substr(temizle($birth), 0, 10)));
    $sql1 = "Insert into eo_users VALUES (NULL , '{$userName}', '" . sha1($password) . "' , '{$realName}', '{$email}', '{$birth}', '0', '{$datem}','1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1')";
    $result1 = @mysql_query($sql1, $yol1);
    @mysql_free_result($result1);
    return $result1;
}