php5 header ERROR!

Started on the old forum in May 2009 · view the original in the archive · old links redirect here

8 replies · 1,219 views · started 17 years ago · 1 min read

7 participants
doriann Developer · 94 posts #1

IM USE THIS SCRIPT FOR DOWNLOAD

<?php include("config.php"); include("core.php"); connectdb(); $id = $_GET['id']; $action = $_GET["action"]; $sid = $_GET["sid"]; $downloads = mysql_fetch_array(mysql_query("SELECT downloads FROM ibwf_vault WHERE id='".$id."'")); $incresedownload = $downloads[0] + 1; mysql_query("UPDATE ibwf_vault SET downloads='".$incresedownload."' WHERE id='".$id."'"); $link = mysql_fetch_array(mysql_query("SELECT itemurl FROM ibwf_vault WHERE id='".$id."'")); header("Location:$link[0]"); ?>

more when access the page to download the file shows the following error Warning: Cannot modify header information -headers already sent by (output started at /home/....

how to solve this problem? What could I pass the correct script I use php5 on pages

DoRiAnN DaMoN

coder programmer http://www.plugadoz.net

synergyx2009 Developer · 86 posts #3

ive seen this problem before, give us the whole warning message. It usually happens when your page header("Location:....."); is set above all your code. you r then running your script executing code below this and outputing to a location. This being said you are sending header info once and then trying to send it again.

im not sure if this would work but try and put your location near the code you want to execute. also clean up on white space.

|Dont forget to say thanx|

modfiles Developer · 200 posts #4
header("Location:$link[0]");

should be place above youre header or after <?php

<?php
header("Location:$link[0]");
?>
<-- HEADER -->
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>Some Title Here</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8"/>
<style type="text/css">
#some css here
</style></head><body>
Anshul Senior · 296 posts #6

doriann wrote: IM USE THIS SCRIPT FOR DOWNLOAD

<?php include("config.php"); include("core.php"); connectdb(); $id = $_GET['id']; $action = $_GET["action"]; $sid = $_GET["sid"]; $downloads = mysql_fetch_array(mysql_query("SELECT downloads FROM ibwf_vault WHERE id='".$id."'")); $incresedownload = $downloads[0] + 1; mysql_query("UPDATE ibwf_vault SET downloads='".$incresedownload."' WHERE id='".$id."'"); $link = mysql_fetch_array(mysql_query("SELECT itemurl FROM ibwf_vault WHERE id='".$id."'")); header("Location:$link[0]"); ?>

more when access the page to download the file shows the following error Warning: Cannot modify header information -headers already sent by (output started at /home/....

how to solve this problem? What could I pass the correct script I use php5 on pages

try this

<?
$SERVERmysql = "localhost";
$DB = "";
$DB_USER = "";
$DB_PASS = "";
$link = mysql_connect($SERVERmysql, $DB_USER, $DB_PASS) or die("Could not connect");
$db_id = mysql_select_db($DB, $link) or die("Could not db");

$id = $_GET['id'];

$d = mysql_fetch_assoc(mysql_query("SELECT itemurl FROM `ibwf_vault` WHERE `id` = '".$id."'"));

if(file_exists($d['itemurl']))
{
	$load_write = mysql_query("UPDATE ibwf_vault SET downloads=`downloads` + 1  WHERE id='".$id."'");
	$dpath = trim($d['itemurl']);
	header('Location: '.$dpath.'');
}

?> 
alesh Lead · 604 posts #8

i also had the same problem but....

i wanted 2 add some our letters 2 my script (šđčćž) but without entering it as HTML characters.... so 2 do tht i had 2 save tht *.php file as UTF-8 encoding... soon as i did tht i had error Cannot modify header information -headers already sent by bla bla bla bla

sooooo i gave up LoL

i just enter those letters as HTML characters.... f#$k it was a job 2 do but i WOULD still want 2 know how 2 avoid tht bcuz i use hangman script without šđčćž letters and its sumkind confusing 2 play without those letters...

eeeeerrr....

Anshul Senior · 296 posts #9

Hmm post it coding here 🙂

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close