Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


problem[PHP]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
deleted user 111213
Grandmaster Cheater
Reputation: 0

Joined: 09 Nov 2007
Posts: 714

PostPosted: Sun Feb 15, 2009 3:01 pm    Post subject: problem[PHP] Reply with quote

Code:
<?php

if (!$_POST['submit']) {
    echo "Invalid Usage of file!\n";
} else {
    $tid = $_GET['id'];
    $msg = $_POST['reply'];

    if (!$tid) {
        echo "You did not supply a topic to reply to!\n";
    } else {
        $sql = "SELECT * FROM forum_topics WHERE id='$tid'";
        $res = mysql_query($sql) or die(mysql_error());
        if (mysql_num_rows($res) == 0) {
            echo "This topic does not exist!\n";
        } else {
            $row = mysql_fetch_assoc($res);
            $sql2 = "SELECT admin FROM forum_sub_cats WHERE id='{$row['cid']}'";
            $res2 = mysql_query($sql2) or die(mysql_error());
            $row2 = mysql_fetch_assoc($res2);
            if ($row2['admin'] == 1 && $admin_user_level == 0) {
                echo "You cannot post here, this is because you are not an admin!\n";
            } else {
                if (!$msg) {
                    echo "You did not supply a message for the reply!\n";
                } else {
                    if (strlen($msg) < 10 || strlen($msg) > 500) {
                        echo "Your reply must be between 10 and 500 characters!\n";
                    } else {
                        $date = date("m-d-y") . " at " . date("h:i:s");
                        $time = time();
                        $sql3 = "INSERT INTO `forum_replies` (`tid`,`uid`,`message`,`date`,`time`) VALUES('" .
                            $tid . "','" . $_SESSION['uid'] . "','" . $msg . "','" . $date . "','" . $time .
                            "')";
                        $res3 = mysql_query($sql3) or die(mysql_error());
                        $sql4 = "UPDATE `forum_topics` SET `time`='" . time() . "' WHERE `id`='" . $tid . "'";
                        $res4 = mysql_query($sql4) or die(mysql_error());
                        header("Location: index.php?act=topic&id=" . $tid);
                    }
                }
            }
        }
    }
}

?>


it gives me the error
Quote:

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/matt/public_html/forum/index.php:16) in /usr/home/matt/public_html/forum/includes/reply.php on line 38


no idea how to fix it.
Back to top
View user's profile Send private message
BanMe
Master Cheater
Reputation: 0

Joined: 29 Nov 2005
Posts: 375
Location: Farmington NH, USA

PostPosted: Sun Feb 15, 2009 3:12 pm    Post subject: Reply with quote

http://www.w3schools.com/php/func_http_header.asp

maybe you should read this but i can see your problem right off the bat ;]

as per this quote

Quote:

It is important to notice that header() must be called before any actual output is sent (In PHP 4 and later, you can use output buffering to solve this problem):


ps i dont know php ;p

regards BanMe

_________________
don't +rep me..i do not wish to have "status" or "recognition" from you or anyone.. thank you.
Back to top
View user's profile Send private message MSN Messenger
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Sun Feb 15, 2009 4:52 pm    Post subject: Reply with quote

Put you header at the top or do that before you use echo();
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites