how can i limit the size of a picture being uploaded?
if($signup==1){
if($pword!=$pwordb){
$error=1; $instruct="<font class=error>Please make sure your passwords match:</font>";
}
if($uname=="" || $email=="" || $pword=="" || $pwordb=="" || $fname=="" || $lname=="" || $zip==""){
$error=1; $instruct="<font class=error>Please fill out all the fields:</font>";
}
if($terms==""){
$error=1; $instruct="<font class=error>You must agree to the terms:</font>";
}
if($ageverify==""){
$error=1; $instruct="<font class=error>You must agree to being 18 or over, if you are not over 18, please visit <a href=http://www.disney.com>Disney</a></font>";
}
$sql = "SELECT * FROM users";
$result = @mysql_query($sql) or die("couldn't execute query .".mysql_error());
while($row = mysql_fetch_array($result)) {
if($uname==$row{'username'}){
$error=1; $instruct="<font class=error>That username is already in use:</font>";
}
if($email==$row{'email'}){
$error=1; $instruct="<font class=error>That email is already in use:</font>";
}
}
if (@is_uploaded_file($_FILES["userfile"]["tmp_name"])) {
} else {
$error=1; $instruct="<font class=error>Image Upload Failed!</font>";
}
if($error!=1){
$code=time();
$nextid=0;
$sql="SELECT * FROM pictures";
$result = @mysql_query($sql) or die("couldn't execute query $sql.".mysql_error());
while($row = mysql_fetch_array($result)) {
if($row{'index'}>$nextid){ $nextid=$row{'index'}; }
}
list($junk,$extension)=split("[.]",$_FILES["userfile"]["name"]);
copy($_FILES["userfile"]["tmp_name"], "$path/userimages/" . "mypic$nextid.$extension");
echo "<b><font class=error>Image Succesfully Uploaded</font><br>";
$filename="userimages/"."mypic$nextid.$extension";
$headers = "From: donotreply@hoefax.com" . "\r\n" .
"Reply-To: donotreply@hoefax.com" . "\r\n" .
"X-Mailer: PHP/" . phpversion();
$message="$fname $lname,
Welcome to Hoefax.com! Your just one step away from your account. Simply follow the link below to activate your account!
http://www.hoefax.com/activate.php?username=$uname&code=$code
Please note that your username and password are case sensitive.
Username: $uname
Password: $pword
Please note that your username and password are case sensitive.
Thank you,
Hoe Fax Staff\n\n";
$subject="Welcome to Hoefax";
mail($email, $subject, $message, $headers);
$sql = "INSERT INTO userpending (username,password,email,firstname,lastname,zipcode,location,national,gender,bday,bmonth,byear,marital,hereto,code,pic) VALUES (\"$uname\",\"$pword\",\"$email\",\"$fname\",\"$lname\",\"$zip\",\"$location\",\"$national\",\"$gender\",\"$bday\",\"$bmonth\",\"$byear\",\"$marital\",\"$hereto\",\"$code\",\"$filename\");";
$result = @mysql_query($sql) or die("couldn't execute query .".mysql_error());
echo "<Font class=error>An Email has been sent to your account for you to complete your registration!\n";
}
?>
<? } ?>