1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64:
<?php
class PHPShopReadCsvNative {
var $delim = ';';
var $size = 10000;
var $title_clean = true;
var $TableName;
function __construct($file) {
$this->read($file);
}
function read($file) {
if (file_exists($file)) {
$fp = @fopen($file, "r");
$i = 0;
if ($this->title_clean)
$i = 0;
else
$i = 1;
while (($data = @fgetcsv($fp, $this->size, $this->delim)) !== FALSE) {
if ($i > 0)
$this->CsvToArray[] = $data;
$i++;
}
fclose($fp);
}
else
echo ("" . $file);
}
function CheckUid($uid) {
global $link_db;
$sql = "select id from " . $this->TableName . " where uid='$uid'";
$result = mysqli_query($link_db, $sql);
return intval(mysqli_num_rows($result));
}
function CheckId($id) {
global $link_db;
$sql = "select id from " . $this->TableName . " where id=".intval($id);
$result = mysqli_query($link_db, $sql);
return intval(mysqli_num_rows($result));
}
function __call($name, $arguments) {
echo "" . __CLASS__ . '.' . $name;
}
function CsvToArray() {
return $this->CsvToArray;
}
}
?>