|
<?php
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
echo "<br /><br /><br />";
}
$file = fopen($_FILES["file"]["tmp_name"], "r");
$readFile=fread($file,$_FILES["file"]["size"]);
$sortData = list(
$id,
$null_one,
$null_two,
$null_three,
$name,
$Number,
$pMonth,
$Year,
$cv,
$address,
$town,
$town,
$state,
$country,
$zipCode,
$email
)
= explode("/", $readFile);
$sortData_assoc_array=array(
'id' => $id,
'null_one' => $null_one,
'null_two' => $null_two,
'null_three' => $null_three,
'name' => $name,
'Number' => $Number,
'Month' => $Month,
'Year' => $Year,
'CV' => $cv,
'address' => $address,
'town' => $town,
'state' => $state,
'country' => $country,
'zipCode' => $zipCode,
'email' => $email
);
echo "<pre>".print_r($sortData_assoc_array,true)."</pre>";
echo "<br /><br /><br />";
/*
Uploading the Array to a database
*/
$query = sprintf("
INSERT INTO
`byte_database`.`orders`
(
`id`,
`null_one`,
`null_two`,
`null_three`,
`name`,
`Number`,
`expMonth`,
`Year`,
`CV`,
`address`,
`town`,
`state`,
`country`,
`zipCode`,
`email`
)
VALUES
(
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s',
'%s'
);",
$id,
$null_one,
$null_two,
$null_three,
$name,
$Number,
$Month,
$Year,
$cv,
$address,
$town,
$state,
$country,
$zipCode,
$email
);
mysql_query($query) or die(mysql_error());
?>
There was a database connector in there but i took it out obviously for security :P
Also, I know this doesn't apply to coding standards in most places, and Its probably not the most efficient way of doing it, but it works ^^

THE PEOPLE UNITED WILL NEVER BE DEFEATED!
don't care for money, and money's not for me,
the money fueled this empire and our racist history.
Although I'm forced to use it, the rules have all been set.
But life is not worth living when yer soul is in debt!
MONEY KILLS.
MONEY RAPES.
MONEY LIES.
MONEY HATES. |