jamesxg1 Posted November 15, 2009 Share Posted November 15, 2009 Hiya peeps, I have this class, <?php ob_start(); class Build { private $subcat; private $gallerysubcat; private $id; private $template; function Catagory() { $this->CatagorySQL = "SELECT * FROM `gallerycats`"; $this->CatagorySQL = mysql_query($this->CatagorySQL) or trigger_error('Site faliure error: ' . mysql_error(), E_USER_ERROR); while($catagory = mysql_fetch_array($this->CatagorySQL)) { echo '<option name="' . $catagory['name'] . '" id="' . $catagory['id'] . '" value="' . $catagory['subcat'] . '">' . $catagory['name'] . '</option>'; } } function SubCatagory($subcat) { $this->subcat = mysql_real_escape_string(trim(addslashes(strip_tags($subcat)))); $this->CatagorySQL = "SELECT * FROM `gallerysubcats` WHERE id = '$this->subcat'"; $this->CatagorySQL = mysql_query($this->CatagorySQL) or trigger_error('Site faliure error: ' . mysql_error(), E_USER_ERROR); while($subcatagory = mysql_fetch_array($this->CatagorySQL)) { echo '<option name="' . $subcatagory['name'] . '" id="' . $subcatagory['id'] . '" value="' . $subcatagory['id'] . '">' . $subcatagory['name'] . '</option>'; } } function GallerySubCatagory($gallerysubcat) { $this->gallerysubcat = mysql_real_escape_string(trim(addslashes(strip_tags($gallerysubcat)))); $this->CatagorySQL = "SELECT * FROM `gallery` WHERE subcat = '$this->gallerysubcat'"; $this->CatagorySQL = mysql_query($this->CatagorySQL) or trigger_error('Site faliure error: ' . mysql_error(), E_USER_ERROR); while($gallerysubcatagory = mysql_fetch_array($this->CatagorySQL)) { echo '<li>'; echo '<a href="start.php?step=1&tid=' . $gallerysubcatagory['id'] . '">'; echo '<img src="assets/templates/images/' . $gallerysubcatagory['photo'] . '" alt="description" />'; echo '<img src="assets/templates/images/' . $gallerysubcatagory['photo'] . '" alt="description" class="preview" />'; echo '</a>'; echo '</li>'; } } function CatagoryGetPhoto($id) { $this->id = mysql_real_escape_string(trim(addslashes(strip_tags($id)))); $this->PhotoCatagorySQL = "SELECT * FROM `gallery` WHERE id = '$this->id'"; $this->PhotoCatagorySQL = mysql_query($this->PhotoCatagorySQL) or trigger_error('Site faliure error: ' . mysql_error(), E_USER_ERROR); while($gallery = mysql_fetch_array($this->CatagorySQL)) { return($gallery['photo']); } } function Initiate($template) { $this->rand = 'finals/' . rand(0000000, 99999999) . '_' . rand(0000000, 99999999) . '_draft'; $this->errors = '0'; if(mkdir($this->rand, 0777, true)) { if(is_dir($this->rand)){ $this->system = $this->rand . '/system'; mkdir($this->system, 0644, true); $this->templatedir = $this->rand . '/templates'; $this->templatefiles = array('/html', '/images', '/css', '/js'); foreach($this->templatefiles as $this->templatedo) { mkdir($this->templatedir.$this->templatedo, 0644, true); } $this->parentsf = array('/system', '/templates'); foreach($this->parentsf as $this->parents) { if(!is_dir($this->rand.$this->parents)) { echo 'ERROR: There seems to be a problem with your site.'; $this->errors = '1'; } } $this->selectedtemplate = $template; $this->folders = array('/images/' => 'templates', '/html/' => 'templates', '/css/' => 'templates', '/js/' => 'templates'); foreach($this->folders as $this->folder => $this->parent) { $this->files = array(); if ($this->handle = opendir('assets/' . $this->parent . '/' . $this->selectedtemplate . '/' . $this->folder)) { while (false !== ($this->file = readdir($this->handle))) { if ($this->file != "." && $this->file != "..") { $this->files[] = $this->file; foreach($this->files as $this->cop) { $this->directory = $this->rand . '/' . $this->parent . $this->folder . $this->cop; $this->path = 'assets/' . $this->parent . '/' . $this->selectedtemplate . $this->folder . $this->cop; copy($this->path,$this->directory); } } } closedir($this->handle); } } $this->indexcontent = "<?php include 'templates/header.html'; if(isset(\$_GET['p'])) { if(!empty(\$_GET['p'])) { include 'templates/' . \$_GET['p'] . '.html'; } else { include 'templates/error.html'; } } else { include 'templates/index.html'; } include 'templates/footer.html'; ?>"; if (!$this->indexopen = fopen($this->rand . "/index.php", "w")) { echo 'ERROR: There seems to be a problem with your site.'; $this->errors = '1'; } else { if(fwrite($this->indexopen, $this->indexcontent) === FALSE) { echo 'ERROR: There seems to be a problem with your site.'; $this->errors = '1'; } } } else { echo 'ERROR: There seems to be a problem with your site.'; $this->errors = '1'; } } else { echo 'ERROR: We cannot complete the making of your site'; $this->errors = '1'; } if($this->errors == '0') { header('Location: start.php?step=2'); } } } ob_flush(); ?> when it redirects me to step 2 i get this, Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\xampp\xampp\htdocs\build\main_assets\template\header.html:31) in C:\Program Files\xampp\xampp\htdocs\build\main_assets\system\build.php on line 192 Anyone know why ? Cheers. James. Link to comment https://forums.phpfreaks.com/topic/181621-solved-headers-error/ Share on other sites More sharing options...
Mchl Posted November 15, 2009 Share Posted November 15, 2009 What's in line 31 of header.html ? Link to comment https://forums.phpfreaks.com/topic/181621-solved-headers-error/#findComment-957997 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.