Jump to content
MakeWebGames

Voting Issues


hobbes
 Share

Recommended Posts

Quick question in regards to the voting mod for mccode. It was working fine for a long time until suddenly one day, I get this. I haven't touched a thing and now it's giving me problems.

Warning: Cannot modify header information - headers already sent by (output started at /global_func.php:414) in /votextop.php on line 3

After some googling, I read that it has to do with empty space before and after the <?php and ?>. The only thing is, I don't have empty space anywhere in the voteblabla.php script. I'm very confused as this was working fine until recently. This is what I have and the error lies in the header, "if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }"

 

<?php

require "global_func.php";

if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }

$userid=$_SESSION['userid'];

include "config.php";

global $_CONFIG;

define("MONO_ON", 1);

require "class/class_db_{$_CONFIG['driver']}.php";

$db=new database;

$db->configure($_CONFIG['hostname'],

$_CONFIG['username'],

$_CONFIG['password'],

$_CONFIG['database'],

$_CONFIG['persistent']);

$db->connect();

$c=$db->connection_id;

$is=$db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid");

$ir=$db->fetch_row($is);

$q=$db->query("SELECT * FROM votes WHERE userid=$userid AND list='xtop'");

if($db->num_rows($q))

{

print "You have already voted at Xtreme Top 100 today!";

}

else

{

$db->query("INSERT INTO votes values ($userid,'xtop')");

$db->query("UPDATE users SET crystals=crystals+5 WHERE userid=$userid");

header("Location:http://www.xtremetop100.com/in.php?site=1132237581");

exit;

}

?>

Any idea what's going on or what all of a sudden happened?

Link to comment
Share on other sites

Re: Voting Issues

Predefine the session_start();

 

<?php
require "global_func.php";
session_start();
if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }
$userid=$_SESSION['userid'];
include "config.php";
global $_CONFIG;
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
$db=new database;
$db->configure($_CONFIG['hostname'],
$_CONFIG['username'],
$_CONFIG['password'],
$_CONFIG['database'],
$_CONFIG['persistent']);
$db->connect();
$c=$db->connection_id;
$is=$db->query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid");
$ir=$db->fetch_row($is);
$q=$db->query("SELECT * FROM votes WHERE userid=$userid AND list='xtop'");
if($db->num_rows($q))
{
print "You have already voted at Xtreme Top 100 today!";
}
else
{
$db->query("INSERT INTO votes values ($userid,'xtop')");
$db->query("UPDATE users SET crystals=crystals+5 WHERE userid=$userid");
header("Location:http://www.xtremetop100.com/in.php?site=1132237581");
exit;
}
?>

 

I would say:

 

Advanced Voting: $15

Description:

Sick and tired of adding new vote site's via the webpage and adding new file's then when you want to take it off you need to delete the links etc? Well then this is the mod for you, it allow's you to edit, delete, add new vote site's. This also counts how many votes per day and total vote's. Allows you to give crystals & money

Made by me.

Link to comment
Share on other sites

Re: Voting Issues

I'm gonna throw this one out there, and maybe it should be posted in mod requests, but how hard would it be to script the same idea, but with donator packs, so donator packs can be set up in the staff menu? would it be more trickier due to the paypal scripts?

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

 Share

×
×
  • Create New...