Προς το περιεχόμενο

Προτεινόμενες αναρτήσεις

Δημοσ.

καλήμερα παιδιά έχω φτιάξει μια φόρμα που χρειάστηκα για να ανεβάζουν αρχεία pdf οι χρήστες παρακάτω βάζω τον κωδικά μου σε php.

το πρόβλημα μου είναι ότι πρόσφατα δέχθηκα επίθεση με χάκαραν και ο σερβερ που το έχω μου έκλεισε την υπηρεσία και μου μου είπε ότι πρέπει να φτιάξω την ασφάλεια της φόρμας για να ζητήσω να μου το ξανά ανοίξουν. μήπως γνωρίζει κάποιος μέσα σε αυτό τον κωδικά να κολλήσω κάτι που να το κάνει πιο safe? σκέφτηκα να βάλω αρχικά google recaptcha επίσης κάποιον έλεγχο που να μην αφήνει να ανεβαίνουν εκτελέσιμα αρχεία. γενικά ότι ιδέα έχετε θα ήταν ευπρόσδεκτη μιας και οι γνώσεις μου δεν είναι καλές

<?php
header('Content-type: text/html; charset=UTF-8');
mb_internal_encoding('UTF-8');
function getUnique(){
    $sql ="SELECT PaperID FROM test";
    $result=mysql_query($sql);
   $return=0;
    while ($row = mysql_fetch_assoc($result)) {
        foreach ($row as $key => $value) {
         $split = explode("-", $value);
            if($split[1]>$return){
                $return=$split[1];
            }       
        }
    }
$variable=3;
 return sprintf("%'03d", $return+1);
    
}





$uniquenessName='test2018';
/* Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password) */
$link = mysql_connect('mysqlcluster7','beta_form','Kbi#rf4d!') or die(mysql_error());
mysql_select_db('betaform') or die(mysql_error());

 
// Check connection
 if($link === false){
    die("ERROR: Could not connect. " . mysqli_connect_error());
}

// attempt insert query execution
$firstname = $_POST["firstname"];
$lastname = $_POST["lastname"];
$Country = $_POST["Country"];
$fileToUpload = basename($_FILES["fileToUpload"]["name"]);
$Select_the_Area_of_Your_Paper = $_POST["Select_the_Area_of_Your_Paper"];
$publication_date = date('Y-m-d H:i:s');
$email = $_POST["email"];
$alternative_email = $_POST["alternative_email"];
$Academic_Title = $_POST["Academic_Title"];
$Authors_of_the_Paper= $_POST["Authors_of_the_Paper"];
$Title_of_the_Paper= $_POST["Title_of_the_Paper"];
$Emails_of_all_the_Authors= $_POST["Emails_of_all_the_Authors"];
$Keywords_of_your_Paper= $_POST["Keywords_of_your_Paper"];
$Title_of_Special_Session= $_POST["Title_of_Special_Session"];
$Abstract = $_POST["Abstract"];
$Address = $_POST["Address"];
$Telephone_Number = $_POST["Telephone_Number"];


$Abstract1=str_replace("'"," ", $Abstract);
$firstname1=str_replace("'"," ", $firstname);
$lastname1=str_replace("'"," ", $lastname);
$Title_of_the_Paper1=str_replace("'"," ", $Title_of_the_Paper);
$Keywords_of_your_Paper1=str_replace("'"," ", $Keywords_of_your_Paper);
$Address1=str_replace("'"," ", $Address);
$Title_of_Special_Session1=str_replace("'"," ", $Title_of_Special_Session);
$Authors_of_the_Paper1=str_replace("'"," ", $Authors_of_the_Paper);


$sql ="SELECT PaperID FROM test";
$PaperID='';
$result=mysql_query($sql);
$isEmpty=true;
while ($row = mysql_fetch_assoc($result)) {
    foreach ($row as $key => $value) {
        if(!empty($value)){
            $isEmpty=false;
        }
    }
}
if($isEmpty){
   $PaperID=$uniquenessName.'-001';
}else{
    $uniquenessNum=getUnique();
    $PaperID=$uniquenessName.'-'.$uniquenessNum;
}
$newFileToUpload=$PaperID.'.pdf';
$sql = "INSERT INTO apsac (firstname,lastname,Country,PaperID, fileToUpload, Select_the_Area_of_Your_Paper, publication_date, email, alternative_email, Academic_Title, Authors_of_the_Paper, Title_of_the_Paper, Emails_of_all_the_Authors, Abstract, Keywords_of_your_Paper, Title_of_Special_Session, Address, Telephone_Number) VALUES ('$firstname1','$lastname1','$Country','$PaperID', '$newFileToUpload', '$Select_the_Area_of_Your_Paper', '$publication_date', '$email',' $alternative_email', '$Academic_Title', '$Authors_of_the_Paper1', '$Title_of_the_Paper1', '$Emails_of_all_the_Authors', '$Abstract1', '$Keywords_of_your_Paper1', '$Title_of_Special_Session1', '$Address1', '$Telephone_Number')";






// Check if image file is a actual image or fake image


$target_dir = "../uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$fileType = pathinfo($target_file,PATHINFO_EXTENSION);
$inputFile=$target_dir .$PaperID.'.'.$fileType;
if(isset($_POST["submit"])) {
    $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
    if($check !== false) {
        //echo "File is an image - " . $check["mime"] . ".";
        $uploadOk = 1;
    } else {
        //echo "File is not an image.";
        $uploadOk = 0;
    }
}
// Check if file already exists
//if (file_exists($fileType)) {
    //echo "Sorry, file already exists.";
  //  $uploadOk = 0;
//}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 10000000) {
    //echo "Sorry, your file is too large.";
    $uploadOk = 0;
}

// Allow certain file formats
if($fileType != "doc" && $fileType != "docx" && $fileType != "rtf"
&& $fileType != "pdf" ) {
   // echo "Sorry, only DOC, DOCX, RTF & PDF files are allowed.<br>";
    $uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if (!mysql_query($sql)) {
    header('Location: '.' ./index.php?success=error');
   // echo "Your file was not uploaded.";
// if everything is ok, try to upload file
} else {
    if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $inputFile)) {
       header('Location: '.' ./index.php?success='.$PaperID); 
       
       
       
       
       
 // email send to user
		$uni= $PaperID;
		$title= $Title_of_the_Paper;
		$aaa= 'http://test.org.uk/form/apsac-form/uploads/';
		$eimailuser=$email;
		$name=$firstname.' '.$lastname;
		$sunedrio="test 2018";
		$email_from = '[email protected]';//<== update the email address
		$email_subject = "Submission to $sunedrio";
		$email_body = "Dear Prof./Dr. $name\nThank you for uploading your paper to $sunedrio. Your paper Title is $title and the ID is $uni.\nYou will be contacted soon regarding the evaluation results\n\nBest Regards\n$sunedrio";

						
		$file = $PaperID.'.'.$fileType;
		$Topic = $Select_the_Area_of_Your_Paper;
		
								
		$email_body2 = "Ανέβηκε νέο paper για το $sunedrio\nΌνομα Author: $name\nE-mail: $eimailuser\nPaperID: $uni\nΤίτλος paper: $title\nTopic: $Topic\n\nΠατήστε εδώ για να δείτε το paper:\n$aaa$file";

		$to2 ='[email protected]' ;
		$to = $eimailuser;//<== update the email address
		$headers = "From: $email_from \r\n";
		$headers .= "Reply-To: $visitor_email \r\n";
		//Send the email!
			mail($to,$email_subject,$email_body,$headers);
			mail($to2,$email_subject,$email_body2,$headers);
		//done. redirect to thank-you page.





//  email send to user Function to validate against any email injection attempts
function IsInjected($str)
{
  $injections = array('(\n+)',
              '(\r+)',
              '(\t+)',
              '(%0A+)',
              '(%0D+)',
              '(%08+)',
              '(%09+)'
              );
  $inject = join('|', $injections);
  $inject = "/$inject/i";
  if(preg_match($inject,$str))
    {
    return true;
  }
  else
    {
    return false;
  }
}
       
       
       
       
    }
}



 
 
 
 
 
 
// close connection
mysql_close($link);

?>
</body>
</html>

 και παρακάτω έχω το html 

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Add Record Form</title>

<link rel="stylesheet" type="text/css" href="css.css">
</head>



<body>
<?php 

if(isset($_GET['success'])){
	if ($_GET['success']!=error){
		
		 ?> 
		 
		
		 
		 <div class="poos"><center><img src = "mnm.png"><h2>Upload successfully your ID is: <?php header("Refresh: 15; url=index.php"); echo ($_GET['success'])?> </h2></center></div><?php

	}elseif($_GET['success']==error){	
		?>		<div class="poos"><center><img src = "sorry.png"><h3>We apologize article was not uploaded successfully!<br> Please<br> <a href="../upload-form/"><button type="button" class="btn btn-primary btn-lg raised">Try again</button></a></h3><?php
	}
}else{


	?>

<link rel="stylesheet" type="text/css" href="css.css">
<div id="content">
    <h1>Upload Your Paper</h1>
	
	
	<form action="insert2.php" method="post" enctype="multipart/form-data">
        		
		<div class="form-group">
            <label for="firstname">First Name :</label><br>
       <input type="text" name="firstname" class="form-control" placeholder="First Name..." required>
	    </div>
        <div class="form-group">
            <label for="lastname">Last Name :</label><br>
       <input type="text" name="lastname" class="form-control" placeholder="Last Name..." required>
	    </div>
		
		           <div class="form-group selectpicker show-menu-arrow">
<label for="Country">Select Country:</label>  
<select class="form-control" name="Country" id="Country"  placeholder="" required>  
    <option value="">--Country--</option>
    <option value="Afghanistan">Afghanistan</option>
    <option value="Albania">Albania</option>
    <option value="Algeria">Algeria</option>
    <option value="American Samoa">American Samoa</option>
    <option value="Andorra">Andorra</option>
    <option value="Angola">Angola</option>
    <option value="Anguilla">Anguilla</option>
    <option value="Antartica">Antarctica</option>
    <option value="Antigua and Barbuda">Antigua and Barbuda</option>
    <option value="Argentina">Argentina</option>
    <option value="Armenia">Armenia</option>
    <option value="Aruba">Aruba</option>
    <option value="Australia">Australia</option>
    <option value="Austria">Austria</option>
    <option value="Azerbaijan">Azerbaijan</option>
    <option value="Bahamas">Bahamas</option>
    <option value="Bahrain">Bahrain</option>
    <option value="Bangladesh">Bangladesh</option>
    <option value="Barbados">Barbados</option>
    <option value="Belarus">Belarus</option>
    <option value="Belgium">Belgium</option>
    <option value="Belize">Belize</option>
    <option value="Benin">Benin</option>
    <option value="Bermuda">Bermuda</option>
    <option value="Bhutan">Bhutan</option>
    <option value="Bolivia">Bolivia</option>
    <option value="Bosnia and Herzegowina">Bosnia and Herzegowina</option>
    <option value="Botswana">Botswana</option>
    <option value="Bouvet Island">Bouvet Island</option>
    <option value="Brazil">Brazil</option>
    <option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
    <option value="Brunei Darussalam">Brunei Darussalam</option>
    <option value="Bulgaria">Bulgaria</option>
    <option value="Burkina Faso">Burkina Faso</option>
    <option value="Burundi">Burundi</option>
    <option value="Cambodia">Cambodia</option>
    <option value="Cameroon">Cameroon</option>
    <option value="Canada">Canada</option>
    <option value="Cape Verde">Cape Verde</option>
    <option value="Cayman Islands">Cayman Islands</option>
    <option value="Central African Republic">Central African Republic</option>
    <option value="Chad">Chad</option>
    <option value="Chile">Chile</option>
    <option value="China">China</option>
    <option value="Christmas Island">Christmas Island</option>
    <option value="Cocos Islands">Cocos (Keeling) Islands</option>
    <option value="Colombia">Colombia</option>
    <option value="Comoros">Comoros</option>
    <option value="Congo">Congo</option>
    <option value="Congo">Congo, the Democratic Republic of the</option>
    <option value="Cook Islands">Cook Islands</option>
    <option value="Costa Rica">Costa Rica</option>
    <option value="Cota D'Ivoire">Cote d'Ivoire</option>
    <option value="Croatia">Croatia (Hrvatska)</option>
    <option value="Cuba">Cuba</option>
    <option value="Cyprus">Cyprus</option>
    <option value="Czech Republic">Czech Republic</option>
    <option value="Denmark">Denmark</option>
    <option value="Djibouti">Djibouti</option>
    <option value="Dominica">Dominica</option>
    <option value="Dominican Republic">Dominican Republic</option>
    <option value="East Timor">East Timor</option>
    <option value="Ecuador">Ecuador</option>
    <option value="Egypt">Egypt</option>
    <option value="El Salvador">El Salvador</option>
    <option value="Equatorial Guinea">Equatorial Guinea</option>
    <option value="Eritrea">Eritrea</option>
    <option value="Estonia">Estonia</option>
    <option value="Ethiopia">Ethiopia</option>
    <option value="Falkland Islands">Falkland Islands (Malvinas)</option>
    <option value="Faroe Islands">Faroe Islands</option>
    <option value="Fiji">Fiji</option>
    <option value="Finland">Finland</option>
    <option value="France">France</option>
    <option value="France Metropolitan">France, Metropolitan</option>
    <option value="French Guiana">French Guiana</option>
    <option value="French Polynesia">French Polynesia</option>
    <option value="French Southern Territories">French Southern Territories</option>
    <option value="Gabon">Gabon</option>
    <option value="Gambia">Gambia</option>
    <option value="Georgia">Georgia</option>
    <option value="Germany">Germany</option>
    <option value="Ghana">Ghana</option>
    <option value="Gibraltar">Gibraltar</option>
    <option value="Greece">Greece</option>
    <option value="Greenland">Greenland</option>
    <option value="Grenada">Grenada</option>
    <option value="Guadeloupe">Guadeloupe</option>
    <option value="Guam">Guam</option>
    <option value="Guatemala">Guatemala</option>
    <option value="Guinea">Guinea</option>
    <option value="Guinea-Bissau">Guinea-Bissau</option>
    <option value="Guyana">Guyana</option>
    <option value="Haiti">Haiti</option>
    <option value="Heard and McDonald Islands">Heard and Mc Donald Islands</option>
    <option value="Holy See">Holy See (Vatican City State)</option>
    <option value="Honduras">Honduras</option>
    <option value="Hong Kong">Hong Kong</option>
    <option value="Hungary">Hungary</option>
    <option value="Iceland">Iceland</option>
    <option value="India">India</option>
    <option value="Indonesia">Indonesia</option>
    <option value="Iran">Iran (Islamic Republic of)</option>
    <option value="Iraq">Iraq</option>
    <option value="Ireland">Ireland</option>
    <option value="Israel">Israel</option>
    <option value="Italy">Italy</option>
    <option value="Jamaica">Jamaica</option>
    <option value="Japan">Japan</option>
    <option value="Jordan">Jordan</option>
    <option value="Kazakhstan">Kazakhstan</option>
    <option value="Kenya">Kenya</option>
    <option value="Kiribati">Kiribati</option>
    <option value="Democratic People's Republic of Korea">Korea, Democratic People's Republic of</option>
    <option value="Korea">Korea, Republic of</option>
    <option value="Kuwait">Kuwait</option>
    <option value="Kyrgyzstan">Kyrgyzstan</option>
    <option value="Lao">Lao People's Democratic Republic</option>
    <option value="Latvia">Latvia</option>
    <option value="Lebanon">Lebanon</option>
    <option value="Lesotho">Lesotho</option>
    <option value="Liberia">Liberia</option>
    <option value="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</option>
    <option value="Liechtenstein">Liechtenstein</option>
    <option value="Lithuania">Lithuania</option>
    <option value="Luxembourg">Luxembourg</option>
    <option value="Macau">Macau</option>
    <option value="Macedonia">Macedonia, The Former Yugoslav Republic of</option>
    <option value="Madagascar">Madagascar</option>
    <option value="Malawi">Malawi</option>
    <option value="Malaysia">Malaysia</option>
    <option value="Maldives">Maldives</option>
    <option value="Mali">Mali</option>
    <option value="Malta">Malta</option>
    <option value="Marshall Islands">Marshall Islands</option>
    <option value="Martinique">Martinique</option>
    <option value="Mauritania">Mauritania</option>
    <option value="Mauritius">Mauritius</option>
    <option value="Mayotte">Mayotte</option>
    <option value="Mexico">Mexico</option>
    <option value="Micronesia">Micronesia, Federated States of</option>
    <option value="Moldova">Moldova, Republic of</option>
    <option value="Monaco">Monaco</option>
    <option value="Mongolia">Mongolia</option>
    <option value="Montserrat">Montserrat</option>
    <option value="Morocco">Morocco</option>
    <option value="Mozambique">Mozambique</option>
    <option value="Myanmar">Myanmar</option>
    <option value="Namibia">Namibia</option>
    <option value="Nauru">Nauru</option>
    <option value="Nepal">Nepal</option>
    <option value="Netherlands">Netherlands</option>
    <option value="Netherlands Antilles">Netherlands Antilles</option>
    <option value="New Caledonia">New Caledonia</option>
    <option value="New Zealand">New Zealand</option>
    <option value="Nicaragua">Nicaragua</option>
    <option value="Niger">Niger</option>
    <option value="Nigeria">Nigeria</option>
    <option value="Niue">Niue</option>
    <option value="Norfolk Island">Norfolk Island</option>
    <option value="Northern Mariana Islands">Northern Mariana Islands</option>
    <option value="Norway">Norway</option>
    <option value="Oman">Oman</option>
    <option value="Pakistan">Pakistan</option>
    <option value="Palau">Palau</option>
    <option value="Panama">Panama</option>
    <option value="Papua New Guinea">Papua New Guinea</option>
    <option value="Paraguay">Paraguay</option>
    <option value="Peru">Peru</option>
    <option value="Philippines">Philippines</option>
    <option value="Pitcairn">Pitcairn</option>
    <option value="Poland">Poland</option>
    <option value="Portugal">Portugal</option>
    <option value="Puerto Rico">Puerto Rico</option>
    <option value="Qatar">Qatar</option>
    <option value="Reunion">Reunion</option>
    <option value="Romania">Romania</option>
    <option value="Russia">Russian Federation</option>
    <option value="Rwanda">Rwanda</option>
    <option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option> 
    <option value="Saint LUCIA">Saint LUCIA</option>
    <option value="Saint Vincent">Saint Vincent and the Grenadines</option>
    <option value="Samoa">Samoa</option>
    <option value="San Marino">San Marino</option>
    <option value="Sao Tome and Principe">Sao Tome and Principe</option> 
    <option value="Saudi Arabia">Saudi Arabia</option>
    <option value="Senegal">Senegal</option>
    <option value="Seychelles">Seychelles</option>
    <option value="Sierra">Sierra Leone</option>
    <option value="Singapore">Singapore</option>
    <option value="Slovakia">Slovakia (Slovak Republic)</option>
    <option value="Slovenia">Slovenia</option>
    <option value="Solomon Islands">Solomon Islands</option>
    <option value="Somalia">Somalia</option>
    <option value="South Africa">South Africa</option>
    <option value="South Georgia">South Georgia and the South Sandwich Islands</option>
    <option value="Spain">Spain</option>
    <option value="SriLanka">Sri Lanka</option>
    <option value="St. Helena">St. Helena</option>
    <option value="St. Pierre and Miguelon">St. Pierre and Miquelon</option>
    <option value="Sudan">Sudan</option>
    <option value="Suriname">Suriname</option>
    <option value="Svalbard">Svalbard and Jan Mayen Islands</option>
    <option value="Swaziland">Swaziland</option>
    <option value="Sweden">Sweden</option>
    <option value="Switzerland">Switzerland</option>
    <option value="Syria">Syrian Arab Republic</option>
    <option value="Taiwan">Taiwan, Province of China</option>
    <option value="Tajikistan">Tajikistan</option>
    <option value="Tanzania">Tanzania, United Republic of</option>
    <option value="Thailand">Thailand</option>
    <option value="Togo">Togo</option>
    <option value="Tokelau">Tokelau</option>
    <option value="Tonga">Tonga</option>
    <option value="Trinidad and Tobago">Trinidad and Tobago</option>
    <option value="Tunisia">Tunisia</option>
    <option value="Turkey">Turkey</option>
    <option value="Turkmenistan">Turkmenistan</option>
    <option value="Turks and Caicos">Turks and Caicos Islands</option>
    <option value="Tuvalu">Tuvalu</option>
    <option value="Uganda">Uganda</option>
    <option value="Ukraine">Ukraine</option>
    <option value="United Arab Emirates">United Arab Emirates</option>
    <option value="United Kingdom">United Kingdom</option>
    <option value="United States">United States</option>
    <option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option>
    <option value="Uruguay">Uruguay</option>
    <option value="Uzbekistan">Uzbekistan</option>
    <option value="Vanuatu">Vanuatu</option>
    <option value="Venezuela">Venezuela</option>
    <option value="Vietnam">Viet Nam</option>
    <option value="Virgin Islands (British)">Virgin Islands (British)</option>
    <option value="Virgin Islands (U.S)">Virgin Islands (U.S.)</option>
    <option value="Wallis and Futana Islands">Wallis and Futuna Islands</option>
    <option value="Western Sahara">Western Sahara</option>
    <option value="Yemen">Yemen</option>
    <option value="Yugoslavia">Yugoslavia</option>
    <option value="Zambia">Zambia</option>
    <option value="Zimbabwe">Zimbabwe</option>
</select></div>

	
		
		<div class="form-group">
            <label for="Academic Title" placeholder="" required>Academic Title :</label><br>
		<input type="checkbox" name="Academic Title" class="poss" value="Professor"> Professor<br>
		<input type="checkbox" name="Academic Title" class="poss" value="Associate Professor" > Associate Professor<br>
		<input type="checkbox" name="Academic Title" class="poss" value="Assistant Professor"> Assistant Professor<br>
		<input type="checkbox" name="Academic Title" class="poss" value="Lecturer" > Lecturer<br>
		<input type="checkbox" name="Academic Title" class="poss" value="Post-Doc Researcher (with Ph.D.)"> Post-Doc Researcher<br> (with Ph.D.)<br>
		<input type="checkbox" name="Academic Title" class="poss" value="Doctor (Ph.D. holder)" > Doctor (Ph.D. holder)<br>
		<input type="checkbox" name="Academic Title" class="poss" value="Ph.D. Candidate" > Ph.D. Candidate<br>
		<input type="checkbox" name="Academic Title" class="poss" value="Student"> Student<br>
		<input type="checkbox" name="Academic Title" class="poss" value="Other"> Other<br></div>
        
		
		<div class="form-group">
            <label for="email">Email</label>
            <input type="email" name="email" class="form-control" id="email" placeholder="[email protected]" required>
        </div>
		
         <div class="form-group">
            <label for="alternative_email">Alternative Email(s) :</label><br>
       <input type="text" name="alternative_email" class="form-control" placeholder="Please provide alternative email(s), if available...">
	    </div>
        
		<div class="form-group">
            <label for="Address">Address:</label><br><br>
       <textarea cols="50" rows="4" class="form-control" name="Address" placeholder="Street Address,Street Address Line2,City,State/Province,Postal/Zip Code,Country..." required></textarea></div>
		
        <div class="form-group">
           <label for="Telephone_Number">Telephone Number :</label>
         <input type="text" name="Telephone_Number" class="form-control" placeholder="" required>
        </div>
        
		
		<div class="form-group">
           <label for="Authors of the Paper">Authors of the Paper :</label>
         <input type="text" name="Authors of the Paper" class="form-control" placeholder="First Name Last Name,First Name Last Name..." required>
        </div>
		
		<div class="form-group">
            <label for="Title of the Paper">Title of the Paper :</label>
         <input type="text" name="Title of the Paper" class="form-control" placeholder="Title of the Paper..." required>
        </div>
		
		<div class="form-group">
           <label for="Emails of all the Authors">Emails of all the Authors :</label>
         <input type="text" name="Emails of all the Authors" class="form-control" placeholder="Email,Email..." required>
        </div>
		
		<div class="form-group">
            <label for="Abstract">Abstract: </label><br>
       <textarea cols="50" rows="4" class="form-control" name="Abstract" placeholder="Abstract..." required></textarea></div>
		
		<div class="form-group">
            <label for="Keywords of your Paper">Keywords of your Paper :</label><br>
         <input type="text" name="Keywords of your Paper" class="form-control" placeholder="Keywords of your Paper..." required>
        </div>
		
		
		<div class="form-group">
            <label for="Select the Area of Your Paper">Select the Area of Your Paper :</label><br>
		 <input type="checkbox" name="Select the Area of Your Paper" class="poss" value="Applied Physics"> Applied Physics<br>
		<input type="checkbox" name="Select the Area of Your Paper" class="poss" value="System Science"> System Science<br>
		<!--<input type="checkbox" name="Select the Area of Your Paper" class="poss" value="Systems"> Systems<br>
		<input type="checkbox" name="Select the Area of Your Paper" class="poss"  value="Communications"> Communications<br>
		<input type="checkbox" name="Select the Area of Your Paper" class="poss" value="Signal Processing"> Signal Processing<br>-->
		<input type="checkbox" name="Select the Area of Your Paper" class="poss" value="Computers"> Computers<br>
        </div>
		
		
      <div class="form-group">
            <label for="fileToUpload">Select file to upload :<br>(Please, upload .doc (preferably) or .pdf file)</label><br>
     <input type="file" name="fileToUpload" class="form-control" id="fileToUpload" placeholder="" required></div><br>
        
		<div class="form-group">
            <label for="Title of Special Session">Title of Special Session<br> (optional, only if you want to include your paper in some<br> special session, workshop, minisymposium):</label><br><br>
       <textarea cols="50" rows="4" class="form-control" name="Title of Special Session"></textarea></div>
      
        
        <button type="submit" class="btn btn-primary subposs">Submit</button>
    </form></div></div>
	
	<?php }?>
	

	</body>
</html>
	

 

Δημοσ. (επεξεργασμένο)

μπορεις να ενισχύσεις το επίπεδο ασφάλειας σου σε 3 επίπεδα:

- ανεβασμα αρχείων

πέρα απο την καταλήξεις να ελέγχεις και το mime type.

- φόρμα

πρόσθεσε ελέγχους εγκυρότητας δεδομένων με regular expressions

πχ. ο τηλ αριθμός μπορεί να είναι string μόνο αριθμών με κενά

- βαση

πριν χρησιμοποιησεις τα δεδομενα της φορμας που εχεις σε μεταβλητες εφαρμοσε sanitizing όπου έχει νόημα

αυτά τα λίγα για την ώρα

Επεξ/σία από mrkra
Δημοσ.
On 02/09/2018 at 13:28, takis1984 said:

Σίγουρα google recaptcha. Επίσης αν googlaρεις θα βρεις πολλά κομμάτια κώδικα που σου προσφέρουν ασφάλεια σε φόρμες php.

Δες και στο stackoverflow

https://stackoverflow.com/questions/1283352/what-is-the-correct-way-to-make-web-form-input-safe-for-a-variety-of-contexts

Δεν είναι δυνατόν ποτέ να "προσφέρεις ασφάλεια σε φόρμες" γενικά και αόριστα, πόσο μάλλον κάνοντας copy paste.

Η απάντηση που δίνεις λινκ είναι κακή και γραμμένη από άνθρωπο που δεν καταλαβαίνει την ασφάλεια.

Pro tip, όταν κάποιος βάζει στην ίδια πρόταση τις λέξεις ασφάλεια και sanitisation και το αποκαλεί αυτό λύση καταλαβαίνεις πως απλά δεν ξέρει και επαναλαμβάνει πράγματα που διάβασε χωρίς να αντιλαμβάνεται το πρόβλημα.

  • 2 εβδομάδες αργότερα...
Δημοσ.
Στις 5/9/2018 στις 11:29 ΠΜ, defacer είπε

Δεν είναι δυνατόν ποτέ να "προσφέρεις ασφάλεια σε φόρμες" γενικά και αόριστα, πόσο μάλλον κάνοντας copy paste.

Η απάντηση που δίνεις λινκ είναι κακή και γραμμένη από άνθρωπο που δεν καταλαβαίνει την ασφάλεια.

Pro tip, όταν κάποιος βάζει στην ίδια πρόταση τις λέξεις ασφάλεια και sanitisation και το αποκαλεί αυτό λύση καταλαβαίνεις πως απλά δεν ξέρει και επαναλαμβάνει πράγματα που διάβασε χωρίς να αντιλαμβάνεται το πρόβλημα.

Έδωσα ένα παράδειγμα από που μπορεί να βρει πράγματα να διαβάσει αν χρειαστεί αυτό ήταν απλά ένα post. Υπάρχουν χιλιάδες άλλες πηγές και φυσικά πρέπει να κάτσεις να διαβάσεις όταν θες να παρέχεις ασφάλεια σε μια δικιά σου φόρμα.  Το link είναι απλά ένα παράδειγμα.... Το να γράψεις τον κώδικα της φόρμας δεν γίνεται με copy paste. Αλλά καλό είναι διαβάσεις. Και δεν είπα κάνε copy paste είπα δες και στο stackoverflow. Το link όντως δεν ειναι το καλύτερο (δεν είχα χρόνο να ψάξω καλα) αλλά αν διαβάσεις και ψάξεις βρίσκεις καλύτερες λύσεις.

Δημοσ.

Το πιο καραμπινάτο λάθος σου είναι που δεν φυλάγεσαι καθόλου για SQL injection. Με λίγα λόγια οι χρήστες μπορούν αντί για πχ το firstname τους να γράψουν κώδικα και θα τρέξει κανονικά αλλάζοντας το query σου:

$sql = "INSERT INTO apsac (firstname,lastname,Country,PaperID, fileToUpload, Select_the_Area_of_Your_Paper, publication_date, email, alternative_email, Academic_Title, Authors_of_the_Paper, Title_of_the_Paper, Emails_of_all_the_Authors, Abstract, Keywords_of_your_Paper, Title_of_Special_Session, Address, Telephone_Number) VALUES ('$firstname1','$lastname1','$Country','$PaperID', '$newFileToUpload', '$Select_the_Area_of_Your_Paper', '$publication_date', '$email',' $alternative_email', '$Academic_Title', '$Authors_of_the_Paper1', '$Title_of_the_Paper1', '$Emails_of_all_the_Authors', '$Abstract1', '$Keywords_of_your_Paper1', '$Title_of_Special_Session1', '$Address1', '$Telephone_Number')";

Χρησιμοποίησε prepared statements για αρχή

Δημιουργήστε ένα λογαριασμό ή συνδεθείτε για να σχολιάσετε

Πρέπει να είστε μέλος για να αφήσετε σχόλιο

Δημιουργία λογαριασμού

Εγγραφείτε με νέο λογαριασμό στην κοινότητα μας. Είναι πανεύκολο!

Δημιουργία νέου λογαριασμού

Σύνδεση

Έχετε ήδη λογαριασμό; Συνδεθείτε εδώ.

Συνδεθείτε τώρα
  • Δημιουργία νέου...