Jump to content

improve


miqyk

Recommended Posts

You need to validate the form

 

-Check if the information entered is correct (e.g. " Weight and Height must be in this form { 5 ' 10 } )

-Check the file sizes

-Check if fields are empty

-Check if the string is too long, or too short

-Validate the email format

-Prevent floods

-Validate the bank details

...etc

 

- Sql injections

- Strip html tags...

 

 

 

<?php
include "config.php";
$uploaddir = 'photo/'; 
$uploaddir1 = 'fullphoto/'; 
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']); 
$uploadfile1 = $uploaddir1 . basename($_FILES['userfile1']['name']); 

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { 
   echo "File is valid, and was successfully uploaded.\n"; }


if (move_uploaded_file($_FILES['userfile1']['tmp_name'], $uploadfile1)) { 
   echo "File is valid, and was successfully uploaded.\n"; }

$strresult=$_POST{"result"};
$strname=$_POST{"name"};
$strdate=$_POST{"date"};
$stridno=$_POST{"idno"};
$ppphoto= basename($_FILES['userfile']['name']);   //gets the base name
$flphoto= basename($_FILES['userfile1']['name']);   //gets the base name
$strgender=$_POST{"gender"};
$strmarital=$_POST{"marital"};
$strage=$_POST{"age"};
$straddress=$_POST{"address"};
$strtelno=$_POST{"telno"};
$stremail=$_POST{"email"};
$strppno=$_POST{"ppno"};
$strreligion=$_POST{"religion"};
$strarea=$_POST{"area"};
$strbranch=$_POST{"branch"};
$stryears=$_POST{"years"};
$strrank=$_POST{"rank"};
$strdischarge=$_POST{"discharge"};
$strcurrent=$_POST{"current"};
$stracademic=$_POST{"academic"};
$strcertification=$_POST{"certification"};
$strskill=$_POST{"skill"};
$strlevel=$_POST{"level"};
$strdl=$_POST{"dl"};
$strservice=$_POST{"service"};
$strheight=$_POST{"height"};
$strweight=$_POST{"weight"};
$strtumors=$_POST{"tumors"};
$strmigraine=$_POST{"migraine"};
$strmental=$_POST{"mental"};
$streye=$_POST{"eye"};
$strasthma=$_POST{"asthma"};
$strarterial=$_POST{"arterial"};
$strliver=$_POST{"liver"};
$strdiabetis=$_POST{"diabetis"};
$strurinary=$_POST{"urinary"};
$strbones=$_POST{"bones"};
$strback=$_POST{"back"};
$strskin=$_POST{"skin"};
$strpregnancy=$_POST{"pregnancy"};
$strhiv=$_POST{"hiv"};
$strprescription=$_POST{"prescription"};
$strregular=$_POST{"regular"};
$strppvalid=$_POST{"ppvalid"};
$bankname=$_POST["bankname"];
$bankbranch=$_POST["bankbranch"];
$beneficiary=$_POST["beneficiary"];
$swiftcode=$_POST["swiftcode"];
$accountnumber=$_POST["accountnumber"];
$strnokname=$_POST["nokname"];
$strnokrel=$_POST["nokrel"];
$strnoktel=$_POST["noktel"];
$strnokadd=$_POST["nokadd"];

$query = "INSERT INTO info(id,name,dob,idno,marital,gender,age,ppno,ppvalid,religion,address,telno,email,nokname,nokrel,noktel,nokadd,branch,years,area,discharge,service,rank,current,academic,certification,skills,dl,level,height,weight,tumors,migraine,mental,eye,asthma,arterial,liver,diabetis,urinary,bones,back,skin,pregnancy,hiv,prescription,regular,result,passportphoto,fulllengthphoto,bankname,bankbranch,beneficiary,swiftcode,accountnumber) 

VALUES('','$strname','$strdate','$stridno','$strmarital','$strgender','$strage','$strppno','$strppvalid','$strreligion','$straddress','$strtelno','$stremail','$strnokname','$strnokrel','$strnoktel','$strnokadd','$strbranch','$stryears','$strarea','$strdischarge','$strservice','$strrank','$strcurrent','$stracademic','$strcertification','$strskill','$strdl','$strlevel','$strheight','$strweight','$strtumors','$strmigraine','$strmental','$streye','$strasthma','$strarterial','$strliver','$strdiabetis','$strurinary','$strbones','$strback','$strskin','$strpregnancy','$strhiv','$strprescription','$strregular','','$ppphoto','$flphoto','$bankname','$bankbranch','$beneficiary','$swiftcode','$accountnumber')";
// execute query
$result = mysql_query($query) 
or die ("Error in query: $query. " . mysql_error());


?>
<a href="deploy.php">Depolyment Packet</a>

Link to comment
https://forums.phpfreaks.com/topic/67217-improve/#findComment-343299
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.