Why image is not saved to the database? - javascript

I am trying to do a register page where a user must fill up its details and upload a picture of its choice. When i pressed the registered button, i have the following errors : "( ! ) Notice: Undefined index: image in /strath-cis/2018/SmartCommute/php/register.php " and "( ! ) Warning: file_get_contents(): Filename cannot be empty in /strath-cis/2018/SmartCommute/php/register.php "
On my database I do have a field called "image" of type BLOB.
I am sure that my details to connect with my database are correct.
Do anyone have a clue why this is happening?
Bellow is my code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta name="mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<link rel="stylesheet" type="text/css" href="../css/normalize.css"/>
<link rel="stylesheet" type="text/css" href="../css/register_css.css"/>
<title>Smart Commute</title>
</head>
<body>
<header id="headerBar">Smart Commute - Register</header>
<form class="needs-validation" novalidate action="" method="post">
<p><input type="file" accept="image/*" name="image" id="file" onchange="loadFile(event)" style="display: none;"></p>
<p><label for="file" style="cursor: pointer;">Upload Image</label></p>
<p><img id="output" width="200" /></p>
<script>
var loadFile = function(event) {
var image = document.getElementById('output');
image.src = URL.createObjectURL(event.target.files[0]);
};
</script>
<p>Name: <input type="text" class="form-control" name="name" id="name" placeholder="John Doe" autocomplete="off" value="<?php if(isset($_POST['Register'])){echo $_POST['name'];} ?>" required></p>
<p>Email: <input type="text" class="form-control" name="email" id="email" placeholder="fake#mail.com" autocomplete="off" value="<?php if(isset($_POST['Register'])){echo $_POST['email'];} ?>" required></p>
<p>Password: <input type="password" class="form-control" name="password" id="password" placeholder="Enter password" autocomplete="off" value="<?php if(isset($_POST['Register'])){echo $_POST['password'];} ?>" required></p>
<br><br>
<!-- <input type="submit" value="Submit" name="Register">-->
<button name="Register">Register</button>
</form>
</body>
</html>
<?php
session_start();
if (isset($_POST['Register']) && isset($_POST["image"]) ) {
if (empty($_POST['password']) || preg_match('/\s/', $_POST['password'])) {
echo "No spaces allowed in new password!";
} else {
include("../include/db_config.php");
include("../include/db_connect.php");
// image file directory
$image = addslashes(file_get_contents($_FILES['image']['tmp_name'])); //SQL I
$name = mysqli_real_escape_string($db, $_POST['name']);
$email = mysqli_real_escape_string($db, $_POST['email']);
$password = mysqli_real_escape_string($db, $_POST['password']);
$encryptedPassword = md5($password);
$sql = "SELECT * FROM `cs317madt`.`useracc` WHERE `email` = '$email'";
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
$result = $db->query($sql);
if (mysqli_num_rows($result) == 1) {
echo "User already exists";
} else {
$sql2 = "INSERT INTO `cs317madt`.`useracc` (`id`,`name`,`password`,`email`, `image`) VALUES (NULL, '$name', '$encryptedPassword', '$email','$image');";
if ($result2 = $db->query($sql2)) {
header("location: ../php/home.php");
$_SESSION['logged-in'] = true;
$_SESSION['name'] = $name;
} else {
echo "Something went wrong with creating your account!";
}
}
} else {
echo "Invalid email! Please enter a valid email";
}
}
}
?>

When you are uploading a file, you need to include an enctype="multipart/form-data" attribute to the <form> tag. Have a quick read on the php's manual about file uploads.. You'll notice there is a Note section that explicitly mentions this.
So, for example:
<form enctype="multipart/form-data" class="needs-validation" novalidate action="" method="post">

Related

HTML alert gets displayed before hitting the submit button [duplicate]

This question already has answers here:
Checking if form has been submitted - PHP
(9 answers)
Closed 7 months ago.
i have been trying to create a login page linked to a database . I have created an alert which is supposed to be displayed after invalid login or empty login but it gets displayed
right after the login page is loader(i.e. before any submission) .For example as soon as the page loads it displays an alert which says"Username password cannot be empty" .I want this alert to be shown after the user hits the submit button.Please Help.Here's the
image
Here's the code:
<?php
//error
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once "config.php";
session_start();
if (isset($_SESSION['username'])) {
header('location: home.php');
exit;
}
$username = "";
$password = $err = "";
if (isset($_POST)) {
if (empty(trim($_POST['username'])) || empty(trim($_POST['password']))) {
$err = "Username or Password cannot be blank";
} else {
$username = trim($_POST['username']);
$password = trim($_POST['password']);
}
if (empty($err)) {
echo "in";
$sql = "SELECT id,username,password FROM users where username=?";
$stmt = mysqli_prepare($conn, $sql);
mysqli_stmt_bind_param($stmt, "s", $param_username);
$param_username = $username;
if (mysqli_stmt_execute($stmt)) {
mysqli_stmt_store_result($stmt);
//if username exists
if (mysqli_stmt_num_rows($stmt) == 1) {
mysqli_stmt_bind_result($stmt, $id, $username, $hashed_password);
if (mysqli_stmt_fetch($stmt)) {
if (password_verify($password, $hashed_password)) {
//password correct
session_start();
$_SESSION['username'] = $username;
$_SESSION['id'] = $id;
$_SESSION['loggedin'] = true;
header("location: home.php");
}
}
} else {
$err = "Invalid Username or Password";
}
}
}
}
?>
Here's HTML:
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Spotify</title>
<link rel="stylesheet" href="style1.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Varela+Round&display=swap" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
</head>
<body class="bds">
<nav>
<ul>
<a>
<li class="brand"><img class="hello" src="./images/logo.png" alt="Spotify">Spotify</li>
<div class="buttons">
<button class="home">Home</button>
<button class="home">About</button>
</div>
<div class="logbutton">
<button class="loginbutt">Register</button>
</div>
</ul>
</nav>
<div class="container mt-4">
<h3>Login Here</h3>
<hr>
<form action="" method="post">
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="text" name="username" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter Username">
<small id="emailHelp" class="form-text text-muted">We'll never share your details with anyone else.</small>
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" name="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
</div>
<br>
<?php
if (!empty(trim($err))) {
echo "<div id='warningus' class='alert alert-warning alert-dismissible fade show' role='alert'>
<strong>Holy guacamole!</strong> " . $err . "
<button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button>
</div>";
$err="";
}
?>
<br>
<button type="submit" class="btn btn-primary">Log in</button>
</form>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
</body>
</html>
Create an input with type="hidden" and give it a name and value. Then check for that input to determine if the page is loaded after a submit.

PHP Display Shell Command Output in a box in Real Time

I have the following code which asks for input then applies shell.sh $folderPath $bits $group2
And I would like to have a box where it displays the output of my script exactly how it would've looked if I ran in in a terminal.
How do I do that?
Below is my code.
<?php
if (isset($_GET['folderPath']) && !empty($_GET['folderPath']) && file_exists($_GET['folderPath'])
&& is_dir($_GET['folderPath']) && isset($_GET['bits']) && isset($_GET['group2'])) {
$folderPath = $_GET['folderPath'];
$bits = $_GET['bits'];
$group2 = $_GET['group2'];
$run = shell_exec("shell.sh $folderPath $bits $group2");
echo "shell.sh $folderPath $bits $group2";
var_dump($run);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
</head>
<body>
<form action="">
<label for="folderPath">Folder Path:</label>
<input type="text" id="folderPath" name="folderPath">
<br></br>
<fieldset id="bits">
<p>Please Choose bits: </p>
<input type="radio" value="8bits" name="bits"> 8bits <br>
<input type="radio" value="16bits" name="bits"> 16bits <br>
</fieldset>
<br></br>
<fieldset id="audio-type">
<p>Please Choose Type: </p>
<input type="radio" value="C12" name="group2"> C12 <br>
<input type="radio" value="LR" name="group2"> LR <br>
</fieldset>
<input class = "submitButton" type="submit" value="Submit">
</body>
</html>
First of all, you need to send your form data somewhere. In your case, it is your same script.
<form method="GET" action="path/to/my/script.php">
Secondly, shell_exec() returns output of executed command. You already wrote the code.
$path = $_GET['folderPath'];
$bits = $_GET['bits'];
$group2 = $_GET['group2'];
$output = shell_exec("shell.sh $path $bits $group2");
Thirdly, display the output where you want.
<div><?php print $output; ?></div>

invisible recaptcha v2 not checking required input fields

I am adding an invisible recaptcha; for some reason, it doesn't check for required fields anymore. Previously, I would get a notification from Chrome stating that the fields can't be empty. Now, it's just ignoring this and letting me submit empty forms.
I am submitting requests using ajax. My guess is that the data-callback is not meant to be used to send ajax requests.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Submit a quote</title>
<link rel="stylesheet" href="../css/style.css">
<link rel="stylesheet" href="../css/forms.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="../js/quotes/ajax.js"></script>
<meta name="description" content="Submit your awesome quote today!">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#0aff0a">
<meta name="msapplication-navbutton-color" content="#0aff0a">
<meta name="apple-mobile-web-app-status-bar-style" content="#0aff0a">
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
</head>
<body>
<div id="status-message"></div>
<div class="container">
<form id="form" action="../php/quoteSubmit.php" method="post">
<h3>Submit your quote</h3>
<fieldset>
<textarea rows="20" name="quote" title="quotes" placeholder="Type your quote here...." tabindex="5" required></textarea>
</fieldset>
<fieldset>
<input placeholder="Author" name="author" title="quotes" type="text" tabindex="1" required>
</fieldset>
<fieldset>
<!--<button name="submit" type="submit" id="contact-submit">Submit</button>-->
<button name="submit" type="submit" id="contact-submit" class="g-recaptcha" data-callback="onSubmit" data-sitekey="6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI">Submit</button>
</fieldset>
</form>
</div>
<script>
function onSubmit(e) {
//$("#form").submit(function (e) {
var url = $("#form").attr('action'); // the script where you handle the form input.
ajaxSendData(url, $("#form").serialize());
//});
}
</script>
</body>
</html>
It seems the submit action is cancelled as well.
$("#form").submit(function (e) {
var url = $("#form").attr('action');
ajaxSendData(url, $("#form").serialize());
e.preventDefault();
});
The above snippet only triggers when not using the recaptcha API.
How would I properly send an ajax request to a PHP page?
My full code (if needed):
<?php
include_once "connect.php";
session_start();
if(isset($_POST["quote"], $_POST["author"], $_POST["g-recaptcha-response"])){
if(!isValid()){
http_response_code(400);
exit();
}
$stmt = $conn->prepare("INSERT INTO pending (quote, author) VALUES (?, ?)");
$stmt->bind_param("ss", $quote, $author);
$quote = htmlspecialchars($_POST["quote"]);
$author = htmlspecialchars($_POST["author"]);
$stmt->execute();
echo"Added to pending! Thank you for submitting";
$stmt->close();
$conn->close();
//$_SESSION["lastRequest"] = time();
}else{
http_response_code(400);
exit();
}
function isValid()
{
try {
$url = 'https://www.google.com/recaptcha/api/siteverify';
$data = ['secret' => '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe',
'response' => $_POST['g-recaptcha-response'],
'remoteip' => $_SERVER['REMOTE_ADDR']];
$options = [
'http' => [
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
]
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if($decoded = json_decode($result, true)){
return $decoded['success'];
}
}
catch (Exception $e) {
return null;
}
}
Try to put the recaptcha in separate div
<div class="g-recaptcha" data-sitekey="6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI"></div>
function onSubmit(e) {
//$("#form").submit(function (e) {
var url = $("#form").attr('action'); // the script where you handle the form input.
ajaxSendData(url, $("#form").serialize());
//});
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://www.google.com/recaptcha/api.js"></script>
<div id="status-message"></div>
<div class="container">
<form id="form" action="../php/quoteSubmit.php" method="post">
<h3>Submit your quote</h3>
<fieldset>
<textarea rows="20" name="quote" title="quotes" placeholder="Type your quote here...." tabindex="5" required></textarea>
</fieldset>
<fieldset>
<input placeholder="Author" name="author" title="quotes" type="text" tabindex="1" required>
</fieldset>
<fieldset>
<!--<button name="submit" type="submit" id="contact-submit">Submit</button>-->
<div class="g-recaptcha" data-sitekey="6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI"></div>
<button name="submit" type="submit" id="contact-submit" data-callback="onSubmit">Submit</button>
</fieldset>
</form>
</div>

AJAX Load and PHP Error

I have created a simple form which submits data to the database.
I want to use Ajax so that when submit is pressed, a loading bar shows and then takes you to the success! page after a few seconds. How do i go about this?
Also the following code gives me the following error, what do i need to fix - SOLVED:
Notice: Undefined index: command in F:\xamppnew\htdocs\web\billing.php on line 5
Code:
<?php
include "storescripts/connect_to_mysql.php";
session_start();
if ($_REQUEST['command']=='update'){
$name=$_REQUEST['name'];
$email=$_REQUEST['email'];
$address=$_REQUEST['address'];
$phone=$_REQUEST['phone'];
$item_id = $_SESSION['item_id'];
$quantityorder = $each_item['quantity'] = $_SESSION['quantity1'];
$cartTotal = $_SESSION['cartTotal'];
// Add this product into the database now
$sql = mysqli_query($link,"insert into transactions values('','$item_id','$quantityorder','$cartTotal','$name','$address','$email','$phone')");
die('Thank You! your order has been placed!');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="style/style.css" type="text/css" media="screen" />
<title>Billing Info</title>
<script language="javascript">
function isNumberKey(evt){
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
</script>
<script language="javascript">
function validate(){
var f=document.form1;
if(f.name.value=='' || f.email.value=='' || f.address.value=='' || f.phone.value=='' ){
alert('You have not filled in all fields');
f.name.focus();
return false;
}
f.command.value='update';
f.submit();
}
</script>
</head>
<body>
<div align="center" id="mainWrapper">
<?php include_once("template_header.php");?>
<div id="pageContent">
<div style="margin:24px; text-align:left;">
<br />
<form name="form1" onsubmit="return validate()">
<input type="hidden" name="command" />
<div align="center">
<h1 align="center">Billing Info</h1>
<table border="0" cellpadding="2px">
<tr><td>Product ID:</td><td><?php echo $item_id = $_SESSION['item_id'];?></td></tr>
<tr><td>Total Quantity:</td><td><?php echo $each_item['quantity'] = $_SESSION['quantity1']; ?></td></tr>
<tr><td>Order Total:</td><td>£<?php echo $cartTotal = $_SESSION['cartTotal'];?></td></tr>
<tr><td>Your Name:</td><td><input type="text" name="name" /></td></tr>
<tr><td>Address:</td><td><input type="text" name="address" /></td></tr>
<tr><td>Email:</td><td><input type="text" name="email" /></td></tr>
<tr><td>Phone:</td><td><input type="text" name="phone" onkeypress='return isNumberKey(event)' /></td></tr>
<tr><td> </td><td><input type="submit" value="Place Order" /></td></tr>
</table>
</div>
</div>
<?php include_once("template_footer.php");?>
</form>
</body>
</html>
<!--================================== code for "stack_ajax.php" start here ==================================-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/external_css.css">
<script type="text/javascript" src="jquery_src/jquery-1.11.0.min.js"></script>
<script type="text/javascript">
function validate(){
var f=document.form1;
if(f.name.value=='' || f.email.value=='' || f.address.value=='' || f.phone.value=='' ){
alert('You have not filled in all fields');
f.name.focus();
return false;
}
f.command.value='update';
postData = $("#form1").serializeArray( );
$.ajax({
type : "POST",
data : postData,
dataType : "html",
url : "ajax_response.php",
async : true,
beforeSend : function( ) {
$("#ajax_image_div").show();
},
success : function(data, textStatus, xhr) {
ajax_response_status = parseInt(data, 10);
if(ajax_response_status)
window.location.href='success_message.php';
else
window.location.href='failed_message.php';
},
error : function(xhr, textStatus, errorThrown) {
alert(textStatus);
},
complete : function(jqXHR, textStatus) {
$("#ajax_image_div").hide();
}
});
return true;
}
function isNumberKey(evt){
var charCode = (evt.which) ? evt.which : evt.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
</script>
<link rel="stylesheet" href="style/style.css" type="text/css" media="screen" />
</head>
<title>Billing Info</title>
<body>
<div id='ajax_image_div' style="display:none;">
<img id="ajax_loader_image" style="vertical-align:middle" src='image/ajax_loader.gif'>
</div>
<div align="center" id="mainWrapper">
<div id="pageContent">
<div style="margin:24px; text-align:left;">
<br/>
<div align="center">
<form id="form1" name="form1" method="POST" action="" autocomplete="off" enctype="multipart/form-data">
<input type="hidden" name="command" />
<h1 align="center">Billing Info</h1>
<table border="0" cellpadding="2px">
<tr><td>Your Name:</td><td><input type="text" name="name" id="user_name" /></td></tr>
<tr><td>Address:</td><td><input type="text" name="address" /></td></tr>
<tr><td>Email:</td><td><input type="text" name="email" /></td></tr>
<tr><td>Phone:</td><td><input type="text" name="phone" onkeypress='return isNumberKey(event)' /></td></tr>
<tr><td> </td><td><input type="button" name="submit" value="Place Order" onClick="return validate()"/></td></tr>
</table>
</form>
</div>
</div>
</div>
</div>
</body>
</html>
<!--================================== code for "stack_ajax.php" end here ==================================-->
<!--============================== code for "ajax_response.php" start here ==============================-->
<?php
/*
Note : I made changes in your HTML form ( You can add session variable by yourself ) and delete following lines
1. <?php include_once("template_header.php");?>
2. <?php include_once("template_footer.php");?>
*/
sleep(3); /* Wait for 3 seconds before executing below code, by doing so
you will be able to see "AJAX LOADER" on the page.
*/
/* print_r($_POST); // You will get all the FORM input data in this array. */
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$address = $_REQUEST['address'];
$phone = $_REQUEST['phone'];
$item_id = $_SESSION['item_id'];
$quantityorder = $each_item['quantity'] = $_SESSION['quantity1'];
$cartTotal = $_SESSION['cartTotal'];
// Add this product into the database now
$sql = mysqli_query(
$link,
"insert
into
transactions
values
('','$item_id','$quantityorder','$cartTotal','$name','$address','$email','$phone')"
);
if( $sql )
echo 1; /* When SQL query will execute successfully. */
else
echo 0; /* When SQL query will not execute successfully. */
exit;
?>
<!--============================== code for "ajax_response.php" end here ==============================-->
/* ================================== code for "external_css.css" start here ==================================*/
#ajax_image_div {
top:30%;
left:30%;
width:50%;
height:50%;
position:absolute;
z-index:999;
}
#mainWrapper {
width:100%;
height:100%;
position:absolute;
}
#ajax_loader_image {
position:relative;
top:35%;
left:35%;
}
/* ================================== code for "external_css.css" end here ==================================*/
<!-- ============================= code for "success_message.php" start here ============================= -->
<?php
echo 'Thank You! your order has been placed!';
?>
<!-- ============================= code for "success_message.php" end here ============================= -->
<!-- ============================= code for "failed_message.php" start here ============================= -->
<?php
echo 'An error occurred, please try after some time ';
?>
<!-- ============================= code for "failed_message.php" end here ============================= -->
<!--
Note : make sure your directory structure must be same as below
php_ajax ( create a folder with "php_ajax" and put all the code inside it )
1. css [ create a folder with "css" name ]
A. external_css.css
2. image [create a folder with "image" name]
A. ajax_loader.gif [ You may download it using internet :-) ]
3. jquery_src [ [create a folder with "jquery_src" name]]
A. jquery-1.11.0.min.js [ jQuery framework, you may download it using internet ]
4. ajax_response.php
5. failed_message.php
6. stack_ajax.php
7. success_message.php
Let me know if you have any problem after implementing this. I put all the codes in separate files to
make DEBUG task very easy.
-->

How do I validate CSV file format using onclick function?

How can I validate my CSV format and I am using "required" in my html form to validate null value. I try to use onclick function to validate using alert box but alert box not function after I add php code inside javascript. Below is my code. Can anyone suggest a solution to me?
<?php
require_once "lib/base.inc.php";
?>
<script>
function storeQueEmail(){
<?php
$file = $_FILES[csv][tmp_name];
$handle = fopen($file,"r");
//loop through the csv file and insert into database
do {
if ($data[0]) {
$record['contact_first'] = $data[0];
$record['contact_last'] = $data[1];
$record['contact_email'] = $data[2];
$record['subject'] = $_REQUEST['subject'];
$record['message'] = $_REQUEST['message'];
$record['status'] = 0;
$oAdminEmail->insertQueEmail($record);
}
} while ($data = fgetcsv($handle,1000,",","'"));
?>;
alert('jyfkyugu');
window.location.href="cronjob_sendemail.php";
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Import a CSV File with PHP & MySQL</title>
</head>
<body>
<form action="" method="post" enctype="multipart/form-data" name="form1" id="form1" >
Subject : <br/>
<input type="text" name="subject" id="subject" required/> <br/>
Choose your file: <br />
<input name="csv" type="file"id="csv" required/> <br/>
Content : <br/>
<textarea name="message" cols="50" rows="10" required></textarea><br/>
<input type="submit" name="submit" value="Submit" onclick="storeQueEmail()"/>
</form>
</body>
</html>

Categories

Resources