Jump to content

[SOLVED] Double insertion into MySQL


timmah1

Recommended Posts

Can anybody tell me why this inserts everything twice?

 

<?php
if(isset($_SESSION['SESS_LOGGEDIN']) == TRUE)
{
require("config.php");

$_SERVER['FULL_URL'] = 'http';
if($_SERVER['HTTPS']=='on'){$_SERVER['FULL_URL'] .=  's';}
$_SERVER['FULL_URL'] .=  '://';
if($_SERVER['SERVER_PORT']!='80') $_SERVER['FULL_URL'] .=  $_SERVER['HTTP_HOST'].':'.$_SERVER['SERVER_PORT'].$_SERVER['SCRIPT_NAME'];
else
$_SERVER['FULL_URL'] .=  $_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
if($_SERVER['QUERY_STRING']>' '){$_SERVER['FULL_URL'] .=  '?'.$_SERVER['QUERY_STRING'];}


if($_SERVER['FULL_URL'] == $config_basedir."editInfo.php"){
	$page = "edit info";
	$action = "Edited personal and or company info";
	}
elseif($_SERVER['FULL_URL'] == $config_basedir."history.php"){
	$page = "view history";
	$action = "Viewed personal history";
	}
elseif($_SERVER['FULL_URL'] == $config_basedir."logout.php"){
	$page = "logout";
	$action = "Logged out of site";
	}
elseif($_POST['login']){
	$page = "login";
	$action = "Logged into site";
	}
elseif($_SERVER['FULL_URL'] == $config_basedir."index.php"){
	$page = "home";
	$action = "Went to home page";
	}

$history = "INSERT INTO history1(user_id, history_date, page, history, action) VALUES(
				'" .$_SESSION['SESS_USERID']. "',
				NOW(),
				'" .$_SERVER['FULL_URL']. "',
				'$page',
				'$action' ); ";
				mysql_query($history)
				or die("Sorry, there was a problem creating your history ".mysql_error());	
}
?>

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/111857-solved-double-insertion-into-mysql/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.