Javascript Error? Objects Null - php

I made an upload page and php script for it that is an AJAX script but i'm getting some errors in Firebug and my upload percentage isn't being returned, so far i am only able to do one upload in firefox and the script won't even work in chrome.
here is my code:
<?php
session_start();
include ('../Connect/Connect.php');
$User = $_SESSION['User'];
if(isset($User))
{
}
else
{
header("location:../");
}
$Connect -> close();
?>
<!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>
<link rel="stylesheet" href="../StyleSheets/StyleSheet.css" />
<link rel="stylesheet" href="../JQueryUI/css/black-tie/jquery-ui-1.10.1.custom.min.css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>TeraShare</title>
<script type="text/javascript" src="../JQuery/JQuery.js"></script>
<script type="text/javascript" src="../JQueryUI/js/jquery-ui-1.10.1.custom.min.js"></script>
<script type="text/javascript" src="../Scripts/JavaScript.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
var UploadB = $('#Submit');
UploadB.click(function(event)
{
event.preventDefault();
event.stopPropagation();
var Data = new FormData();
var Files = document.getElementById('Files');
for(var I = 0; I < Files.files.length; ++I)
{
var FilesName = Files.files[I].name;
Data.append('File[]', Files.files[I]);
}
var Request = XMLHttpRequest();
Request.upload.addEventListener('progress', function(event)
{
if(event.lengthComputable)
{
var Percent = event.loaded / event.total;
Progress = document.getElementById('#Progress');
while(Progress.hasChildNodes())
{
Progress.removeChild(Progress.firstChild);
}
Progress.appendChild(document.createTextNode(Math.round(Percent * 100) + '%'));
}
});
Request.upload.addEventListener('load', function(event)
{
Progress.style.display = 'none';
});
Request.upload.addEventListener('error', function(event)
{
alert('Upload Failed.');
});
Request.open('POST', 'Upload.php');
Request.setRequestHeader('Cache-Control', 'no-cache');
Progress.style.display = 'block';
Request.send(Data);
});
});
</script>
</head>
<body>
<div id="Wrapper">
<div id="Menu">
<div id="Logo"><img src="../Pictures/Logo.png" /></div>
<div id="Buttons">
<div class="Button" title="LogOut">LogOut</div>
<div class="Button" id="Upload" title="Upload">Upload</div>
<div class="Button" id="CFolder" title="Upload">Create Folder</div>
<div class="Button" id="Store" title="Store">Store</div>
<div class="Button" title="Menu"><?php echo $User; ?> <span class="Triangle"></span></div>
</div>
</div>
<div id="Content">
<div id="Fix">
<div id="UForm">
<form action="" method="post" enctype="multipart/form-data">
<input type="file" id="Files" name="File[]" multiple="multiple" />
<input type="submit" name="Submit" class="AB" id="Submit" value="Upload!" />
<div id="Progress"></div>
</form>
</div>
</div>
</div>
</div>
</body>
</html>
php script:
<?php
session_start();
include('../Connect/Connect.php');
$User = $_SESSION['User'];
$Token = $_POST['Token'];
$Files = $_FILES['File'];
if(isset($User))
{
if(!empty($Files))
{
for($X = 0; $X < count($Files['name']); $X++)
{
$Name = $Files['name'][$X];
$TMP = $Files['tmp_name'][$X];
move_uploaded_file($TMP, '../Users/HARAJLI98/' . $Name);
}
}
}
else
{
header("location:../");
}
$Connect->close();
?>

Document.getElementById needs the physical string of the ID, you don't need to specify that it's an ID.
You are mixing up javascript and jQuery. In jQuery, $.("#Progress") would work because the $ function doesn't know whether you are looking or an ID or a class.
This:
Progress = document.getElementById('#Progress');
should be this:
Progress = document.getElementById('Progress');
or this:
Progress = $("#Progress");

Related

PHP-How to add an "Enter passcode" screen before user accesses website

So I have a chatting site in PHP, but the problem is that anyone can access any "chatroom". Is there a way to add an "Enter passcode" text box to the site before they are able to access the real thing? And if possible I would prefer not using those JavaScript pop-ups. And for the people who really want to help, I don't need any CSS.
My code:
index.php:
<?php
session_start();
if(isset($_GET['logout'])){
//Simple exit message
$logout_message = "<div class='msgln'><span class='left-info'>User <b class='user-name-left'>". $_SESSION['name'] ."</b> has left the chat session.</span><br></div>";
file_put_contents("log.html", $logout_message, FILE_APPEND | LOCK_EX);
session_destroy();
header("Location: ../../index.php"); //Redirect the user
}
if(isset($_POST['enter'])){
if($_POST['name'] != ""){
$_SESSION['name'] = stripslashes(htmlspecialchars($_POST['name']));
}
else{
echo '<span class="error">Please type in a name</span>';
}
}
function loginForm(){
echo
'<div id="loginform">
<p>Please enter your name to continue!</p>
<form action="index.php" method="post">
<label for="name">Name —</label>
<input type="text" name="name" id="name" />
<input type="submit" name="enter" id="enter" value="Enter" />
</form>
</div>';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title> Chat</title>
<meta name="description" content=" Chat Application" />
<link rel="stylesheet" href="../../css/chat.css" />
</head>
<body>
<?php
if(!isset($_SESSION['name'])){
loginForm();
}
else {
?>
<div id="wrapper">
<div id="menu">
<p class="welcome">Welcome, <b><?php echo $_SESSION['name']; ?></b></p>
<p class="logout"><a id="exit" href="#">Exit Chat</a></p>
</div>
<div id="chatbox">
<?php
if(file_exists("log.html") && filesize("log.html") > 0){
$contents = file_get_contents("log.html");
echo $contents;
}
?>
</div>
<form name="message" action="">
<input name="usermsg" type="text" id="usermsg" />
<input name="submitmsg" type="submit" id="submitmsg" value="Send" />
</form>
</div>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript">
// jQuery Document
$(document).ready(function () {
$("#submitmsg").click(function () {
var clientmsg = $("#usermsg").val();
$.post("post.php", { text: clientmsg });
$("#usermsg").val("");
return false;
});
function loadLog() {
var oldscrollHeight = $("#chatbox")[0].scrollHeight - 20; //Scroll height before the request
$.ajax({
url: "log.html",
cache: false,
success: function (html) {
$("#chatbox").html(html); //Insert chat log into the #chatbox div
//Auto-scroll
var newscrollHeight = $("#chatbox")[0].scrollHeight - 20; //Scroll height after the request
if(newscrollHeight > oldscrollHeight){
$("#chatbox").animate({ scrollTop: newscrollHeight }, 'normal'); //Autoscroll to bottom of div
}
}
});
}
setInterval (loadLog, 2500);
$("#exit").click(function () {
var exit = confirm("Are you sure you want to end the session?");
if (exit == true) {
window.location = "index.php?logout=true";
}
});
});
</script>
</body>
</html>
<?php
}
?>
post.php:
<?php
session_start();
if(isset($_SESSION['name'])){
$text = $_POST['text'];
$text_message = "<div class='msgln'><span class='chat-time'>".date("g:i A")."</span> <b class='user-name'>".$_SESSION['name']."</b> ".stripslashes(htmlspecialchars($text))."<br></div>";
file_put_contents("log.html", $text_message, FILE_APPEND | LOCK_EX);
}
?>

Form validation to see if the email already excists in the MySQL database

At the moment I have a form (PHP & jQuery) with validations. I want to add a validation to check if the email address of a new user is already in the MySQL database or not.
At the moment there are 3 (IF) validations already for the name and email in jQuery:
function validate() {
var output = true;
$(".signup-error").html('');
if($("#personal-field").css('display') != 'none') {
if(!($("#name").val())) {
output = false;
$("#name-error").html("Name required!");
}
if(!($("#email").val())) {
output = false;
$("#email-error").html("Email required!");
}
if(!$("#email").val().match(/^([\w-\.]+#([\w-]+\.)+[\w-]{2,4})?$/)) {
$("#email-error").html("Invalid Email!");
output = false;
}
I would like to have a 4th one to check if the email address is already in the MySQL database.
The complete PHP file with jQuery:
<?php
include 'db_connection.php';
if(isset($_POST['finish'])){
$name = '"'.$dbConnection->real_escape_string($_POST['name']).'"';
$email = '"'.$dbConnection->real_escape_string($_POST['email']).'"';
$password = '"'.password_hash($dbConnection->real_escape_string($_POST['password']), PASSWORD_DEFAULT).'"';
$gender = '"'.$dbConnection->real_escape_string($_POST['gender']).'"';
$sqlInsertUser = $dbConnection->query("INSERT INTO users (name, password, email, gender) VALUES($name, $password, $email, $gender)");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" href="css/reset.css" />
<link rel="stylesheet" href="css/text.css" />
<link rel="stylesheet" href="css/960.css" />
<link rel="stylesheet" href="css/demo.css" />
<script src="scripts/jquery-1.10.2.js"></script>
<style>
CSS CODE
</style>
<script>
function validate() {
var output = true;
$(".signup-error").html('');
if($("#personal-field").css('display') != 'none') {
if(!($("#name").val())) {
output = false;
$("#name-error").html("Name required!");
}
if(!($("#email").val())) {
output = false;
$("#email-error").html("Email required!");
}
if(!$("#email").val().match(/^([\w-\.]+#([\w-]+\.)+[\w-]{2,4})?$/)) {
$("#email-error").html("Invalid Email!");
output = false;
}
}
if($("#password-field").css('display') != 'none') {
if(!($("#user-password").val())) {
output = false;
$("#password-error").html("Password required!");
}
if(!($("#confirm-password").val())) {
output = false;
$("#confirm-password-error").html("Confirm password required!");
}
if($("#user-password").val() != $("#confirm-password").val()) {
output = false;
$("#confirm-password-error").html("Password not matched!");
}
}
return output;
}
$(document).ready(function() {
$("#next").click(function(){
var output = validate();
if(output) {
var current = $(".active");
var next = $(".active").next("li");
if(next.length>0) {
$("#"+current.attr("id")+"-field").hide();
$("#"+next.attr("id")+"-field").show();
$("#back").show();
$("#finish").hide();
$(".active").removeClass("active");
next.addClass("active");
if($(".active").attr("id") == $("li").last().attr("id")) {
$("#next").hide();
$("#finish").show();
}
}
}
});
$("#back").click(function(){
var current = $(".active");
var prev = $(".active").prev("li");
if(prev.length>0) {
$("#"+current.attr("id")+"-field").hide();
$("#"+prev.attr("id")+"-field").show();
$("#next").show();
$("#finish").hide();
$(".active").removeClass("active");
prev.addClass("active");
if($(".active").attr("id") == $("li").first().attr("id")) {
$("#back").hide();
}
}
});
});
</script>
</head>
<body>
<div class="container_12">
<div class="grid_8">
<p>
TEXT<br>TEXT<br>TEXT<br>TEXT<br>TEXT
</p>
</div>
<div class="grid_4">
<p>Register new FC Magnate</p>
<div class="message"><?php if(isset($message)) echo $message; ?></div>
<ul id="signup-step">
<li id="personal" class="active">Personal Detail</li>
<li id="password">Password</li>
<li id="general">General</li>
</ul>
<form name="frmRegistration" id="signup-form" method="post">
<div id="personal-field">
<label>Name</label><span id="name-error" class="signup-error"></span>
<div><input type="text" name="name" id="name" class="demoInputBox"/></div>
<label>Email</label><span id="email-error" class="signup-error"></span>
<div><input type="text" name="email" id="email" class="demoInputBox" /></div>
</div>
<div id="password-field" style="display:none;">
<label>Enter Password</label><span id="password-error" class="signup-error"></span>
<div><input type="password" name="password" id="user-password" class="demoInputBox" /></div>
<label>Re-enter Password</label><span id="confirm-password-error" class="signup-error"></span>
<div><input type="password" name="confirm-password" id="confirm-password" class="demoInputBox" /></div>
</div>
<div id="general-field" style="display:none;">
<label>Gender</label>
<div>
<select name="gender" id="gender" class="demoInputBox">
<option value="female">Female</option>
<option value="male">Male</option>
</select></div>
</div>
<div>
<input class="btnAction" type="button" name="back" id="back" value="Back" style="display:none;">
<input class="btnAction" type="button" name="next" id="next" value="Next" >
<input class="btnAction" type="submit" name="finish" id="finish" value="Finish" style="display:none;">
</div>
</form>
</div>
The "db_connection.php" file:
<?php
define('_HOST_NAME', 'localhost');
define('_DATABASE_USER_NAME', 'root');
define('_DATABASE_PASSWORD', '****');
define('_DATABASE_NAME', '****');
$dbConnection = new mysqli(_HOST_NAME, _DATABASE_USER_NAME, _DATABASE_PASSWORD, _DATABASE_NAME);
if ($dbConnection->connect_error) {
trigger_error('Connection Failed: ' . $dbConnection->connect_error, E_USER_ERROR);
}
?>
I tried to create this validation from other examples that were given here on the website. But, no success. Please, it would be great if somebody could help me a little further.
UPDATE: With the help of Suyog I changed the files. But, it doesn't seem to work yet. Here are the files that I use at the moment: fcmagnate.com/files.zip
The form works till the moment the validation of the email address in the database starts, than it stops.
You will have to make use of JQuery AJAX for this.
Write a function in AJAX to send email to php gage where we will check the existance of email.
<script>
function checkEmail(eMail)
{
$.ajax({
url: 'check_email.php',
data: {emailId: eMail},
type: 'post',
success: function (data) {
if(data == '1')
return false;
else
return true;
}
});
}
</script>
Then you can call this function
<script>
function validate()
{
var output = true;
$(".signup-error").html('');
if($("#personal-field").css('display') != 'none')
{
if(!($("#name").val()))
{
output = false;
$("#name-error").html("Name required!");
}
if(!($("#email").val()))
{
output = false;
$("#email-error").html("Email required!");
}
if(!$("#email").val().match(/^([\w-\.]+#([\w-]+\.)+[\w-]{2,4})?$/))
{
$("#email-error").html("Invalid Email!");
output = false;
}
if(!checkEmail($("#email").val()))
{
$("#email-error").html("Email already exist!");
output = false;
}
}
}
</script>
Youe check_email.php file will contain the code as follows
<?php
include 'db_connection.php';
if(isset($_POST['emailId']))
{
$email = '"'.$dbConnection->real_escape_string($_POST['emailId']).'"';
$sqlCheckEmail = $dbConnection->query("SELECT user_id FROM users WHERE LOWER(email) like LOWER('%".$email."%')");
if($sqlCheckEmail->num_rows == 1)
echo '1';
else
echo '0';
}
?>
Use Ajax jQuery.ajax on client side to communicate with server side reusing your php code mentioned.

How to insert into MySQL HTML Form data?

I checked a lot of articles and I don't understand it how to insert data into a MySQL table. What is wrong? I guess that my Ajax request is already wrong.
I would be happy to get help!!!
I did not write programs since 20 years. My coding is for sure not good, but I need to get it running.
Any help would be very appreciated!
The code that follows does not INSERT INTO and does not UPDATE. Why?
Here is the source:
articles.php
<!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" dir="ltr" lang="en-US">
<head>
<meta charset="UTF-8" />
<title>SoB - Administration</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript" src="js/scroll.js"></script>
<script type="text/javascript" src="js/producttemplate.js"></script>
<script type="text/javascript" src="js/jquery.js" ></script>
<style type="text/css">.buttonarea: (\a)</style>
<script type="text/javascript">
<!--
var js_string;
document.getElementById("recordWrite").disabled = true;
var lastPreviousNext = "";
var date = new Date();
var mysqlDateTime;
var yyyy = date.getFullYear();
var mm = date.getMonth() + 1;
var dd = date.getDate();
var hh = date.getHours();
var min = date.getMinutes();
var ss = date.getSeconds();
mysqlDateTime = yyyy + '-' + mm + '-' + dd + ' ' + hh + ':' + min + ':' + ss;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// No submit by onclick
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
elem = document.getElementById('buttonID');
function stop(e) {
e.preventDefault(); // browser - don't act!
e.stopPropagation(); // bubbling - stop
return false; // added for completeness
}
elem.addEventListener('click', stop, false);
// this handler will work
elem.addEventListener('click', function() { alert('I still work') }, false);
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function jsRecordInsertWrite()
{
document.getElementById('formheadline').innerHTML = 'Article Database - I save the new item';
document.getElementById("recordWrite").disabled = true;
js_articles[0]=""; // set auto increment id to NULL
// ... the AJAX request is successful
var updatePage = function (response) {
alert("insert record successful");
};
// ... the AJAX request fail
var printError = function (req, status, err) {
alert("insert record failed");
};
// Create an object to describe the AJAX request
var ajaxOptions = {
url: 'writearticle.php',
dataType: 'json',
success: updatePage,
error: printError
};
// Initiate the request!
$.ajax(ajaxOptions);
}
// -->
</SCRIPT>
</head>
<body class="page page-id-11505 page-template-default" onload="jsRecordCurrent();">
<div id="page-wrap">
<?php
include('includes/header.html');
?>
<div id="container-main">
<div id="main-content">
<div class="post" id="post-11505">
<title>SoB - Administration</title>
<div class="entry">
<form id="form_articles" method="post" action="<?= $_SERVER['PHP_SELF'] ?>" name="form_articles">
<table border="0" cellpadding="0" cellspacing="5">
<tr>
<td align="right">
<span style="padding-right:20px">Item</span>
</td>
<td>
<input id="Item" name="Item" type="text" maxlength="100" size="25"/>
</td>
</tr>
<tr>
<td align="right">
<span style="padding-right:20px">Item Category</span>
</td>
<td>
<input name="ItemCategory" type="text" maxlength="100" size="25" />
</td>
</tr>
<tr id="buttonarea">
<td align="right" colspan="2">
<hr noshade="noshade" />
<input id="recordInsertWrite" type="button" name="recordInsertWrite" value=" Save New Record " onclick="jsRecordInsertWrite()" />
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<div id="aside">
</div>
</div> <!-- End of main container -->
</div><!-- END Page Wrap -->
</body>
</html>
writearticle.php
<?php
$link = mysql_connect('test.test.com:3306', 'admin0', 'star1star1star0');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db('sob', $link);
if (!$db_selected) {
die ('Can\'t use foo : ' . mysql_error());
}
// Escape user inputs for security
$ID = mysql_real_escape_string($_POST['ID']);
$Item = mysql_real_escape_string($_POST['Item']);
$ItemCategory = mysql_real_escape_string($_POST['ItemCategory']);
if('$ID' == '')
{
$sql = "INSERT into articles values(NULL,'$Item','$ItemCategory')";
$query = mysql_query($sql);
if(!$query)
{
echo '<script type="text/javascript">alert("error");</script>';
}
else
{
echo '<script type="text/javascript">alert("ok");</script>';
}
}
else
{
$sql = "UPDATE articles SET Item='$Item',ItemCategory='$ItemCategory')";
$query = mysql_query($sql);
if(!$query)
{
echo '<script type="text/javascript">alert("update error");</script>';
}
else
{
echo '<script type="text/javascript">alert("update ok");</script>';
}
}
?>

my Codeigniter form with ajax return all page

In my project I user ajax to process form. Now i want to get Post data to process. I use Javascript when Jquery is not allowed. But Ajax return whole page, how can I fix that.
My controller :
class Form extends Controller {
function __construct() {
parent :: __construct();
$this->load->model('Form_model');
}
function index() {
$this->loadForm();
}
function loadForm() {
$this->load->view('form_view');
}
function ajax_add_form_content() {
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == "XMLHttpRequest") {
echo $_POST['fullname'] . '+' . $_POST['subject'];
} else {
echo '0';
}
}
}
And my view :
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Form view</title>
<script language="JavaScript" type="text/javascript">
function ajax_post(){
var hr = new XMLHttpRequest();
var url = "<?php echo base_url().'index.php/form/ajax_add_form_content'?>";
var fn = document.getElementById("txtFullName").value;
var ln = document.getElementById("txtSubject").value;
var vars = "fullname="+fn+"&subject="+ln;
hr.open("POST", url, true);
hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
hr.onreadystatechange = function() {
if(hr.readyState == 4 && hr.status == 200) {
var return_data = hr.responseText;
document.getElementById("status").innerHTML = return_data;
}
}
hr.send(vars);
document.getElementById("status").innerHTML = "processing...";
return false;
}
</script>
</head>
<body>
<div id="form">
<span id='status' ></span>
<form class="form" method="post">
<p class="formName">contact</p>
<p class="formDesc">contact us</p>
<div class="form_elements">
<div class="textField">
<label>Full name</label>
<input id="txtFullName" class="inputText required" type="text" maxlength="255" size="28" name="txtFullName">
</div>
<div class="textField">
<label>Subject</label>
<input id="txtSubject" class="inputText required" type="text" maxlength="255" size="28" name="txtSubject">
</div>
</div>
<div class="form_submit">
<input id="btnSubmit" type="submit" value="Send" name="btnSubmit" onClick="javascript:ajax_post();">
</div>
</form>
<div id='display'>
</div>
</div>
</div>
</body>
</html>
Thanks for any help !
Please try this
in your controller
function ajax_add_form_content() {
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == "XMLHttpRequest") {
echo $_POST['fullname'] . '+' . $_POST['subject'];
} else {
echo '0';
}
exit;
}
I would recommend You to use ie Chrome inspector to see whether You send request to the proper url.
Additionally instead of using $_SERVER variables You can use method from CI library $this->input->is_ajax_request().

print_r($_REQUEST) not showing all datas after showing few datas

print_r($_REQUEST) is not showing all the datas after redirecting from a page from which form is being submitted. In the redirected page it is showing some datas but not all.In the localhost all the requested datas are showing fine,but in the server the problem is occurring.
I have created a php.ini & put max_execution_time = 160; post_max_size = 250M; into the file & uploaded it in the server. But still couldn't get any solution.
Here is code. Actually some page are included after checking condition and then the form is being submitted after filling fields.
include("configuration.php");
if(isset($_REQUEST["save_update"]) && $_REQUEST["save_update"]!="")
{
include("quotation_save.php");
header("location:http://mpsinfoservices.com/projects/topline/quotation.php?enquiry_id=".$_REQUEST["enquiry_id"]."&displaying_id=".$_REQUEST["displaying_id"]);
}
$enqid = $_REQUEST["enquiry_id"];
$displaying_id = $_REQUEST["displaying_id"];
$len_of_disp = strlen($displaying_id);
/*if(preg_match('/E/',$displaying_id))
{
echo substr($displaying_id,0,6);
echo "<br/>".substr($displaying_id,strlen(substr($displaying_id,0,6)));
if(preg_match('/F/',substr($displaying_id,strlen(substr($displaying_id,0,6)))))
$ch_from_find_str = 'F';
$find_str = substr($displaying_id,0,7);
$ch_from_find_str = substr($find_str,6,1);
}
if(preg_match('/PKG/',$displaying_id))
{
$find_str = substr($displaying_id,0,9);
echo $find_str;
}
*/
$sql_enquiry = mysql_query("SELECT * FROM `enquiry_master` WHERE `id`='".$enqid."' AND `displaying_id`='".$displaying_id."'");
$row_enquiry = mysql_fetch_assoc($sql_enquiry);
$sql_client_info = mysql_query("SELECT * FROM `client_info` WHERE `client_id`='".$row_enquiry['customer_id']."'");
$row_client_info = mysql_fetch_assoc($sql_client_info);
?>
<link type="text/css" href="css/cupertino/jquery-ui-1.8.21.custom.css" rel="stylesheet" />
<link type="text/css" href="css/jquery.dataTables_themeroller.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="js/function.js"></script>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<link type="text/css" href="css/style.css" rel="stylesheet">
<style>
.client_name
{
border:none;
}
.client_name_mouseover
{
border:1px solid #000;
}
</style>
</head>
<body>
<?php include("includes/header.php"); ?>
<div id="page-container">
<?php
include("includes/left_menu.php");
?>
<div id="page_content" style="float:left;">
<div style="margin-top:25px;">
<div style="padding-top:10px;">
<div style="color:#000;font-weight:bold;font-size:12px;font-family:verdana;">Client Details</div>
<div>Name:- <input type="text" name="client_name" id="client_name" class="client_name" value="<?php echo $row_client_info["client_firstname"].$row_client_info["client_middlename"].$row_client_info["client_lastname"];?>" readonly="readonly"/></div>
<div>Email:- <?php echo $row_client_info["client_email_id"]; ?>
</div>
<div>
<?php
$sql_quotation_insert_status = mysql_query("SELECT `status` FROM `quotation_insert_status` WHERE `enquiry_id`='".$enqid."'");
if( mysql_num_rows($sql_quotation_insert_status)>0)
{
$res_quotation_insert_status = "insert";
}
else
{
$res_quotation_insert_status = "";
}
?>
<form name="quotation" class="quotationfrm" method="post" enctype="multipart/form-data" action="quotation.php">
<input type="hidden" name="displaying_id" value="<?php echo $displaying_id; ?>"/>
<input type="hidden" name="enquiry_id" value="<?php echo $enqid; ?>"/>
<input type="hidden" name="save_update" <?php if($res_quotation_insert_status=="insert"){?>value="update" <?php } if($res_quotation_insert_status==""){?> value="save_quotation" <?php } ?>/>
<?php
if(preg_match('/E/',$displaying_id))
{
if(preg_match('/F/',substr($displaying_id,strlen(substr($displaying_id,0,6)))))
{
include("quotation/flight_quotation.php");
}
if(preg_match('/T/',substr($displaying_id,strlen(substr($displaying_id,0,6)))))
{
include("quotation/train_quotation.php");
}
if(preg_match('/H/',substr($displaying_id,strlen(substr($displaying_id,0,6)))))
{
include("quotation/hotel_quotation2.php");
}
if(preg_match('/CC/',substr($displaying_id,strlen(substr($displaying_id,0,6)))))
{
include("quotation/carrental_quotation.php");
}
if(preg_match('/I/',substr($displaying_id,strlen(substr($displaying_id,0,6)))))
{
include("quotation/insurance_quotation.php");
}
if(preg_match('/V/',substr($displaying_id,strlen(substr($displaying_id,0,6)))))
{
include("quotation/visa_quotation.php");
}
if(preg_match('/CR/',substr($displaying_id,strlen(substr($displaying_id,0,6)))))
{
include("quotation/cruise_quotation.php");
}
}
if(preg_match('/PKG/',$displaying_id))
{
if(preg_match('/H/',substr($displaying_id,strlen(substr($displaying_id,0,7)))))
{
include("quotation/hotel_quotation2.php");
}
include("quotation/package_quotation.php");
if(preg_match('/F/',substr($displaying_id,strlen(substr($displaying_id,0,7)))))
{
include("quotation/flight_quotation.php");
}
if(preg_match('/V/',substr($displaying_id,strlen(substr($displaying_id,0,7)))))
{
include("quotation/visa_quotation.php");
}
if(preg_match('/T/',substr($displaying_id,strlen(substr($displaying_id,0,7)))))
{
include("quotation/train_quotation.php");
}
if(preg_match('/CC/',substr($displaying_id,strlen(substr($displaying_id,0,7)))))
{
include("quotation/carrental_quotation.php");
}
if(preg_match('/I/',substr($displaying_id,strlen(substr($displaying_id,0,7)))))
{
include("quotation/insurance_quotation.php");
}
if(preg_match('/CR/',substr($displaying_id,strlen(substr($displaying_id,0,7)))))
{
include("quotation/cruise_quotation.php");
}
}
?>
<input type="button" class="save_quotation" <?php if($res_quotation_insert_status=="insert"){?> value="Update" <?php } if($res_quotation_insert_status==""){ ?> value="Save The Quotation" <?php } ?> style="margin-top:20px;" <?php if($res_quotation_insert_status=="insert"){ ?> name="save" <?php } if($res_quotation_insert_status==""){ ?> name="update" <?php } ?>/>
<?php if($res_quotation_insert_status=="insert"){?>
<input type="button" class="sendQuotation" value="Send Quotation"/>
<?php
}
?>
</form>
</div>
</div>
<script>
$(function(){
var no=0;
$("form").each(function(){
no++;
});
var suc = 0;
$("#client_name").live("mouseover",function(){
$(this).removeClass("client_name");
$(this).addClass("client_name_mouseover");
});
$("#client_name").live("mouseout",function(){
$(this).removeClass("client_name_mouseover");
$(this).addClass("client_name");
});
$(".mail_to_client").live("click",function(){
$.post("flight_quotation_mail.php?enquiry_id=<?php echo $enqid; ?>",$(".flight_quotation_frm").serialize(),function(data){
if(data=="success")
{
suc++;
}
if(no==suc)
{
$.post("mail_to_client.php?enquiry_id=<?php echo $enqid; ?>");
}
});
$.post("train_quotation_mail.php?enquiry_id=<?php echo $enqid; ?>",$(".train_quotation_frm").serialize(),function(data){
if(data=="success")
{
suc++;
}
if(no==suc)
{
$.post("mail_to_client.php?enquiry_id=<?php echo $enqid; ?>");
}
});
/*$.post("hotel_quotation_mail.php?enquiry_id=<?php echo $enqid; ?>",$(".hotel_quotation_frm").serialize(),function(data){
if(data=="success")
{
suc++;
}
if(no==suc)
{
$.post("mail_to_client.php?enquiry_id=<?php echo $enqid; ?>");
}
});*/
});
$(".save_quotation").live("click",function(){
$(".quotationfrm").submit();
});
$(".sendQuotation").live("click",function(){
for(var instanceName in CKEDITOR.instances)
CKEDITOR.instances[instanceName].updateElement();
var formData = $(".quotationfrm").serialize();
$.post("quotation_pdf.php",function(){
window.open("quotation_pdf.php?"+formData);
});
});
});
</script>
In some cases due to html elements in the data it will render only few, try checking View Source of that page.
The content and order of $_REQUEST is affected by variables_order directive in php.ini (see Description of core php.ini directives)
So, it is possible, that on your production environment value of variables-order directive differs from that in your development environment (localhost).
For example, set variables_order = "GPCS" in order to have G-$_GET, P-$_POST, C-$_COOKIE, S-$_SERVER arrays and all values from that arrays in $_REQUEST.

Categories