This script should allow a user to upload an image, When I click on submit button nothing happens
here is the script:
upload_image.php
<?
session_start();
require_once("php_inc.php");
include("header_inc.php");
db_connect();
//Function to Upload Image to Profile
if (session_is_registered(username))
{
$valid_user = $_SESSION[username];
do_html_heading("Image upload");
member_menu();
?>
<h2>Upload image</h2>
<?
print "<font class='text'>Upload limit is " . floor($set_piclimit / 1024) . " kb.</font><p />";
if (!isset($_POST['submit']))
{
print "From here you can upload a picture to your profile. Please note that the image
can be no larger than " . floor($set_piclimit / 1024) . " in size, and will be scaled
down to fit as thumbnail.";
}
print "<form method='POST' action='upload_image.php' enctype='multipart/form-data'>";
?>
<INPUT TYPE="hidden" name="pictures_siteid" value="<? echo $pictures_siteid ?>" />
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="<? echo $set_piclimit ?>" />
<?
if (isset($_POST['submit']))
{
if($photo_size)
{
// Get file extension
$ext=substr($photo_name,-4);
$file_without_ext=substr($photo_name,0,-4);
// Allowed file takes
if (strcasecmp($ext,".jpg") || strcasecmp($ext,".gif"))
{
if(is_uploaded_file($photo))
{
$rand = rand(200,19999999);
$photo_name = $rand . $photo_name;
$photo_name_large = $rand . $file_without_ext . "_large" . $ext;
$photo_name_small = $rand . $file_without_ext . "_small" . $ext;
move_uploaded_file($photo,"upload_images/$photo_name");
if ($set_magic)
{
// your own path in the strings below. On Linux, you can normally just type convert
$command = "convert -quality $set_magic_q -size $set_orgsize -scale $set_orgsize upload_images/$photo_name upload_images/$photo_name";
$res = exec($command);
$command = "convert -quality $set_magic_q -size $set_thmbsize -scale $set_thmbsize upload_images/$photo_name upload_images/$photo_name_small";
$res = exec($command);
}
// Tell the database that picture is uploaded
$string = "UPDATE user set image = '$photo_name' where username = '$valid_user'";
$result_done= mysql_query($string);
if ($result_done)
{
print("<p />Done!<br \>The image is uploaded !<p />");
print("<img src='upload_images/$photo_name'>");
}
}
}
else
{
die("Please, only .gif or .jpg images.");
}
}
else if($photo_name != "" && $photo_size == "0")
{
die("The picture is 0 kb.");
}
else
{
print "No picture choosen for upload.";
}
}
?>
<p />
<br />
Image file (click Browse to look on your computer for image):<br />
<input name="photo" type="file" /><br />
<input type="submit" name="submit" value="Upload image" />
</form>
<?
}
require("footer_inc.php");
?>
Variables included in settings_inc.php
<?
//Settings for Image uploader
$set_thmbsize="100x100";
$set_orgsize="250x250";
$set_piclimit="90000";
$set_banlist="";
$set_magic="on";
$set_magic_q="80";
$set_magic_q="80";
?>
any suggestions would be appreciated

upload_image.php
<?
session_start();
require_once("php_inc.php");
include("header_inc.php");
db_connect();
//Function to Upload Image to Profile
if (session_is_registered(username))
{
$valid_user = $_SESSION[username];
do_html_heading("Image upload");
member_menu();
?>
<h2>Upload image</h2>
<?
print "<font class='text'>Upload limit is " . floor($set_piclimit / 1024) . " kb.</font><p />";
if (!isset($_POST['submit']))
{
print "From here you can upload a picture to your profile. Please note that the image
can be no larger than " . floor($set_piclimit / 1024) . " in size, and will be scaled
down to fit as thumbnail.";
}
print "<form method='POST' action='upload_image.php' enctype='multipart/form-data'>";
?>
<INPUT TYPE="hidden" name="pictures_siteid" value="<? echo $pictures_siteid ?>" />
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="<? echo $set_piclimit ?>" />
<?
if (isset($_POST['submit']))
{
if($photo_size)
{
// Get file extension
$ext=substr($photo_name,-4);
$file_without_ext=substr($photo_name,0,-4);
// Allowed file takes
if (strcasecmp($ext,".jpg") || strcasecmp($ext,".gif"))
{
if(is_uploaded_file($photo))
{
$rand = rand(200,19999999);
$photo_name = $rand . $photo_name;
$photo_name_large = $rand . $file_without_ext . "_large" . $ext;
$photo_name_small = $rand . $file_without_ext . "_small" . $ext;
move_uploaded_file($photo,"upload_images/$photo_name");
if ($set_magic)
{
// your own path in the strings below. On Linux, you can normally just type convert
$command = "convert -quality $set_magic_q -size $set_orgsize -scale $set_orgsize upload_images/$photo_name upload_images/$photo_name";
$res = exec($command);
$command = "convert -quality $set_magic_q -size $set_thmbsize -scale $set_thmbsize upload_images/$photo_name upload_images/$photo_name_small";
$res = exec($command);
}
// Tell the database that picture is uploaded
$string = "UPDATE user set image = '$photo_name' where username = '$valid_user'";
$result_done= mysql_query($string);
if ($result_done)
{
print("<p />Done!<br \>The image is uploaded !<p />");
print("<img src='upload_images/$photo_name'>");
}
}
}
else
{
die("Please, only .gif or .jpg images.");
}
}
else if($photo_name != "" && $photo_size == "0")
{
die("The picture is 0 kb.");
}
else
{
print "No picture choosen for upload.";
}
}
?>
<p />
<br />
Image file (click Browse to look on your computer for image):<br />
<input name="photo" type="file" /><br />
<input type="submit" name="submit" value="Upload image" />
</form>
<?
}
require("footer_inc.php");
?>
Variables included in settings_inc.php
<?
//Settings for Image uploader
$set_thmbsize="100x100";
$set_orgsize="250x250";
$set_piclimit="90000";
$set_banlist="";
$set_magic="on";
$set_magic_q="80";
$set_magic_q="80";
?>
any suggestions would be appreciated