Jump to content

Dynamic Image and Data Upload Simultaneously


ivoilic

Recommended Posts

Ok so I have a form to submits to a .php file that creates an image.  This works fine, but I also want the info from the form to be sent to MySQL database.  The problem is that something in a script I "required" called core.inc.php is interfering and so no image is output.  Here is core.inc.php:

<?php
ob_start();
session_start();
$current_file = $_SERVER['SCRIPT_NAME'];

if(isset($_SERVER['HTTP_REFERER'])&&!empty($_SERVER['HTTP_REFERER'])) {
$http_referer = $_SERVER['HTTP_REFERER'];
}

function loggedin() {
if(isset($_SESSION['user_id'])&&!empty($_SESSION['user_id'])) {
	return true;
} else {
	return false;
}
}

function getuserfield($field) {
$query="SELECT `$field` FROM `Users` WHERE `id`='".$_SESSION['user_id']."'";
if($query_run=mysql_query($query)) {
	if($query_result = mysql_result($query_run, 0, $field)) {
		return $query_result;	
	}
}
}

?>

 

Here is the code for the image creating .php file:

<?php
require 'connect.inc.php';
require 'core.inc.php';
$title = $_REQUEST['title'] ;
$user_id = getuserfield('id');
$query = "INSERT INTO `---` VALUES ('".mysql_real_escape_string($title)."','".mysql_real_escape_string($user_id)."')";
$query_run = mysql_query($query);
//There is some more code in here obviously, but it's irrelevant 
header('Content-type: image/png');
imagepng($image_f);
imagedestroy($image_f)

 

Can anybody give me some idea of what is conflicting or what I can do to fix it?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.