时间:2021-07-01 10:21:17 帮助过:22人阅读
War-game -Add Your score
War game - add your score
include 'error_report.php';
$photo_dir='images/';
if(!empty($_POST['submit']))
{
$first_name=$_POST['first_name'];
$last_name=$_POST['last_name'];
$score=$_POST['score'];
if(!file_exists($photo_dir))
{
mkdir($photo_dir);
}
if($_FILES['image_upload']['error']>0)
{
echo 'Error:'.$_FILES['image_upload']['error'].'
';
}
else{
$dbc=mysqli_connect('localhost','root','pengyu2408','score_list')or die('error in connet');
$query="INSERT INTO score_lis(first_name,last_name,score) VALUES('$first_name','$last_name','$score')";
mysqli_query($dbc,$query)or die('error_2');
$gpy=move_uploaded_file($_FILES['image_upload']['tmp_name'],$photo_dir.$_FILES['image_upload']['name']);
echo 'Thanks for adding your new high score!
';
echo 'FIRST_NAME:'.$first_name.'
';
';
echo 'LAST_NAME:'.$last_name.'
echo 'Score:'.$score.'
';
echo '';
echo '<<Back to hight score
';
//clear the score data to clear the form
$firet_name="";
$last_name="";
mysqli_close($dbc);
}
}
?>