Jump to content
MakeWebGames

Weird Problem


HITMAN 17
 Share

Recommended Posts

i have mainmenu2.php installed and on some of my pages it moves look here

http://www.chavsterv1.co.cc/friendslist.php

here is my code can someone tell me whats wrong and what i need to change

<?php
/*-----------------------------------------------------
-- Mono Country v1.0 BETA
-- A product of DBS-entertainment
-- Copyright held 2005 by Dabomstew
-- INDEX.php
-----------------------------------------------------*/
session_start();
require "global_func.php";
if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }
$userid=$_SESSION['userid'];
require "header.php";
$h = new headers;
$h->startheaders();
include "mysql.php";
global $c;
$is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error());
$ir=mysql_fetch_array($is);
check_level();
$fm=money_formatter($ir['money']);
$cm=money_formatter($ir['crystals'],'');
$lv=date('F j, Y, g:i a',$ir['laston']);
$h->userdata($ir,$lv,$fm,$cm);
$h->menuarea();
if($ir['donatordays'] == 0)
{
die("This feature is for donators only.");
}
print "<h3>Friends List</h3>";
switch($_GET['action'])
{
case "add":
add_friend();
break;

case "remove":
remove_friend();
break;

case "ccomment":
change_comment();
break;

default:
friends_list();
break;
}
function friends_list()
{
global $ir,$c,$userid;
print "[url='friendslist.php?action=add']> Add a Friend[/url]

These are the people on your friends list. ";
$q_y=mysql_query("SELECT * FROM friendslist WHERE fl_ADDED=$userid",$c);
print mysql_num_rows($q_y)." people have added you to their list.

Most liked: [";
$q2r=mysql_query("SELECT u.username,count( * ) as cnt,fl.fl_ADDED FROM friendslist fl LEFT JOIN users u on fl.fl_ADDED=u.userid GROUP BY fl.fl_ADDED ORDER BY cnt DESC LIMIT 5",$c) or die(mysql_error());
$r=0;
while($r2r=mysql_fetch_array($q2r))
{
$r++;
if($r > 1) { print " | "; }
print "[url='viewuser.php?u={$r2r[']{$r2r['username']}[/url]";
}
print "]

<table width=90%><tr style='background:gray'> <th>ID</th> <th>Name</th> <th>Mail</th> <th>Send Cash</th> <th>Remove</th> <th>Comment</th> <th>Change Comment</th> <th>Online?</th></tr>";
$q=mysql_query("SELECT fl.*,u.* FROM friendslist fl LEFT JOIN users u ON fl.fl_ADDED=u.userid WHERE fl.fl_ADDER=$userid ORDER BY u.username ASC",$c);
while($r=mysql_fetch_array($q))
{
if($r['laston'] >= time()-15*60) { $on="<font color=green>[b]Online[/b]</font>"; } else { $on="<font color=red>[b]Offline[/b]</font>"; }
$d="";
if($r['donatordays']) { $r['username'] = "<font color=red>{$r['username']}</font>";$d="[img=donator.gif]"; }
if(!$r['fl_COMMENT']) { $r['fl_COMMENT']="N/A"; }
print "<tr> <td>{$r['userid']}</td> <td>[url='viewuser.php?u={$r[']{$r['username']}[/url] $d</td> <td>[url='mailbox.php?action=compose&ID={$r[']Mail[/url]</td> <td>[url='sendcash.php?ID={$r[']Send Cash[/url]</td> <td>[url='friendslist.php?action=remove&f={$r[']Remove[/url]</td> <td>{$r['fl_COMMENT']}</td> <td>[url='friendslist.php?action=ccomment&f={$r[']Change[/url]</td> <td>$on</td></tr></table>";
}
}
function add_friend()
{
global $ir,$c,$userid;
$_POST['ID'] = abs((int) $_POST['ID']);
$_POST['comment']=str_replace(array("<",">","\n"),array("<",">","
"), $_POST['comment']);

if($_POST['ID'])
{
$qc=mysql_query("SELECT * FROM friendslist WHERE fl_ADDER=$userid AND fl_ADDED={$_POST['ID']}",$c);
$q=mysql_query("SELECT * FROM users WHERE userid={$_POST['ID']}",$c);
if(mysql_num_rows($qc))
{
print "You cannot add the same person twice.";
}
else if($userid==$_POST['ID'])
{
print "You cannot be so lonely that you have to try and add yourself.";
}
else if(mysql_num_rows($q)==0)
{
print "Oh no, you're trying to add a ghost.";
}
else
{
mysql_query("INSERT INTO friendslist VALUES('', $userid, {$_POST['ID']}, '{$_POST['comment']}')",$c) or die(mysql_error());
$r=mysql_fetch_array($q);
print "{$r['username']} was added to your friends list.

[url='friendslist.php']> Back[/url]";
}
}
else
{
print "Adding a friend!<form action='friendslist.php?action=add' method='post'>
Friend's ID: <input type='text' name='ID' value='{$_GET['ID']}' />

Comment (optional): 

<textarea name='comment' rows='7' cols='40'></textarea>

<input type='submit' value='Add Friend' /></form>";
}

}
function remove_friend()
{
global $ir,$c,$userid;
mysql_query("DELETE FROM friendslist WHERE fl_ID={$_GET['f']} AND fl_ADDER=$userid",$c);
print "Friends list entry removed!

[url='friendslist.php']> Back[/url]";
}
function change_comment()
{
global $ir,$c,$userid;
$_POST['f'] = abs((int) $_POST['f']);
$_POST['comment']=str_replace(array("<",">","\n"),array("<",">","
"), $_POST['comment']);
if($_POST['comment'])
{
mysql_query("UPDATE friendslist SET fl_COMMENT='{$_POST['comment']}' WHERE fl_ID={$_POST['f']} AND fl_ADDER=$userid",$c);
print "Comment for friend changed!

[url='friendslist.php']> Back[/url]";
}
else
{
$_GET['f'] = abs((int) $_GET['f']);
$q=mysql_query("SELECT * FROM friendslist WHERE fl_ID={$_GET['f']} AND fl_ADDER=$userid",$c);
if(mysql_num_rows($q))
{
$r=mysql_fetch_array($q);
$comment=str_replace(array("<",">","
"), array("<",">","\n"), $r['fl_COMMENT']);
print "Changing a comment.<form action='friendslist.php?action=ccomment' method='post'>
<input type='hidden' name='f' value='{$_GET['f']}' />

Comment: 

<textarea rows='7' cols='40' name='comment'>$comment</textarea>

<input type='submit' value='Change Comment' /></form>";
}
else
{
print "Stop trying to edit comments that aren't yours.";
}
}
}



$h->endpage();
?>
Link to comment
Share on other sites

Guest Anonymous

Re: Weird Problem

Guessing it's just the die("");

use something like...

// global $h; use this if it's in a function.

echo "The text";

$h->endpage();

exit;

Link to comment
Share on other sites

Re: Weird Problem

man if ya show me a screen shot of the way the page is looknig i can help...

cause im sure you added the right menu in the endpage function?

If not..let me know how you did...but seriously i need to see what the page looks like...

I think you are correct on it being a table problem.

Link to comment
Share on other sites

Re: Weird Problem

Try this..

But...only if you added the table for the right menu in the $h->endpage() function..

if it was added somewhere else let me know..

but if it was added there. i think this will work.

 

<?php

/*-----------------------------------------------------
-- Mono Country v1.0 BETA
-- A product of DBS-entertainment
-- Copyright held 2005 by Dabomstew
-- INDEX.php
-----------------------------------------------------*/

session_start();
require "global_func.php";
if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }
$userid=$_SESSION['userid'];
require "header.php";
$h = new headers;
$h->startheaders();
include "mysql.php";
global $c;
$is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error());
$ir=mysql_fetch_array($is);
check_level();
$fm=money_formatter($ir['money']);
$cm=money_formatter($ir['crystals'],'');
$lv=date('F j, Y, g:i a',$ir['laston']);
$h->userdata($ir,$lv,$fm,$cm);
$h->menuarea();


if($ir['donatordays'] == 0)
{
die("This feature is for donators only.");
}

print "
<h3>Friends List</h3>";
switch($_GET['action'])
{
case "add":
add_friend();
break;

case "remove":
remove_friend();
break;

case "ccomment":
change_comment();
break;

default:
friends_list();
break;
}

function friends_list()
{
global $ir,$c,$userid,$h;
print "
[url='friendslist.php?action=add']> Add a Friend[/url]

These are the people on your friends list.";
$q_y=mysql_query("SELECT * FROM friendslist WHERE fl_ADDED=$userid",$c);
print mysql_num_rows($q_y)." people have added you to their list.

Most liked: [";
$q2r=mysql_query("SELECT u.username,count( * ) as cnt,fl.fl_ADDED FROM friendslist fl LEFT JOIN users u on fl.fl_ADDED=u.userid GROUP BY fl.fl_ADDED ORDER BY cnt DESC LIMIT 5",$c) or die(mysql_error());
$r=0;
while($r2r=mysql_fetch_array($q2r))
{
$r++;
if($r > 1) { print " | "; }
print "[url='viewuser.php?u={$r2r[']{$r2r['username']}[/url]";
}
print "]

<table width=90%><tr style='background:gray'> <th>ID</th> <th>Name</th> <th>Mail</th> <th>Send Cash</th> <th>Remove</th> <th>Comment</th> <th>Change Comment</th> <th>Online?</th></tr>";
$q=mysql_query("SELECT fl.*,u.* FROM friendslist fl LEFT JOIN users u ON fl.fl_ADDED=u.userid WHERE fl.fl_ADDER=$userid ORDER BY u.username ASC",$c);
while($r=mysql_fetch_array($q))
{
if($r['laston'] >= time()-15*60) { $on="<font color=green>[b]Online[/b]</font>"; } else { $on="<font color=red>[b]Offline[/b]</font>"; }
$d="";
if($r['donatordays']) { $r['username'] = "<font color=red>{$r['username']}</font>";$d="[img=donator.gif]"; }
if(!$r['fl_COMMENT']) { $r['fl_COMMENT']="N/A"; }
print "<tr> <td>{$r['userid']}</td> <td>[url='viewuser.php?u={$r[']{$r['username']}[/url] $d</td> <td>[url='mailbox.php?action=compose&ID={$r[']Mail[/url]</td> <td>[url='sendcash.php?ID={$r[']Send Cash[/url]</td> <td>[url='friendslist.php?action=remove&f={$r[']Remove[/url]</td> <td>{$r['fl_COMMENT']}</td> <td>[url='friendslist.php?action=ccomment&f={$r[']Change[/url]</td> <td>$on</td></tr></table>";
}
$h->endpage();
exit;
}
function add_friend()
{
global $ir,$c,$userid,$h;
$_POST['ID'] = abs((int) $_POST['ID']);
$_POST['comment']=str_replace(array("<",">","\n"),array("<",">","
"), $_POST['comment']);

if($_POST['ID'])
{
$qc=mysql_query("SELECT * FROM friendslist WHERE fl_ADDER=$userid AND fl_ADDED={$_POST['ID']}",$c);
$q=mysql_query("SELECT * FROM users WHERE userid={$_POST['ID']}",$c);
if(mysql_num_rows($qc))
{
print "You cannot add the same person twice.";
}
else if($userid==$_POST['ID'])
{
print "You cannot be so lonely that you have to try and add yourself.";
}
else if(mysql_num_rows($q)==0)
{
print "Oh no, you're trying to add a ghost.";
}
else
{
mysql_query("INSERT INTO friendslist VALUES('', $userid, {$_POST['ID']}, '{$_POST['comment']}')",$c) or die(mysql_error());
$r=mysql_fetch_array($q);
print "{$r['username']} was added to your friends list.

[url='friendslist.php']> Back[/url]";
}
}
else
{
print "Adding a friend!<form action='friendslist.php?action=add' method='post'>
Friend's ID: <input type='text' name='ID' value='{$_GET['ID']}' />

Comment (optional): 

<textarea name='comment' rows='7' cols='40'></textarea>

<input type='submit' value='Add Friend' /></form>";
}

$h->endpage();
exit;

}
function remove_friend()
{
global $ir,$c,$userid,$h;
mysql_query("DELETE FROM friendslist WHERE fl_ID={$_GET['f']} AND fl_ADDER=$userid",$c);
print "Friends list entry removed!

[url='friendslist.php']> Back[/url]";

$h->endpage();
exit;

}
function change_comment()
{
global $ir,$c,$userid,$h;
$_POST['f'] = abs((int) $_POST['f']);
$_POST['comment']=str_replace(array("<",">","\n"),array("<",">","
"), $_POST['comment']);
if($_POST['comment'])
{
mysql_query("UPDATE friendslist SET fl_COMMENT='{$_POST['comment']}' WHERE fl_ID={$_POST['f']} AND fl_ADDER=$userid",$c);
print "Comment for friend changed!

[url='friendslist.php']> Back[/url]";
}
else
{
$_GET['f'] = abs((int) $_GET['f']);
$q=mysql_query("SELECT * FROM friendslist WHERE fl_ID={$_GET['f']} AND fl_ADDER=$userid",$c);
if(mysql_num_rows($q))
{
$r=mysql_fetch_array($q);
$comment=str_replace(array("<",">","
"), array("<",">","\n"), $r['fl_COMMENT']);
print "Changing a comment.<form action='friendslist.php?action=ccomment' method='post'>
<input type='hidden' name='f' value='{$_GET['f']}' />

Comment: 

<textarea rows='7' cols='40' name='comment'>$comment</textarea>

<input type='submit' value='Change Comment' /></form>";
}
else
{
print "Stop trying to edit comments that aren't yours.";
}
}
}
$h->endpage();



?>
Link to comment
Share on other sites

Re: Weird Problem

 

<?php

/*-----------------------------------------------------
-- Mono Country v1.0 BETA
-- A product of DBS-entertainment
-- Copyright held 2005 by Dabomstew
-- INDEX.php
-----------------------------------------------------*/

session_start();
require "global_func.php";
if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }
$userid=$_SESSION['userid'];
require "header.php";
$h = new headers;
$h->startheaders();
include "mysql.php";
global $c;
$is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error());
$ir=mysql_fetch_array($is);
check_level();
$fm=money_formatter($ir['money']);
$cm=money_formatter($ir['crystals'],'');
$lv=date('F j, Y, g:i a',$ir['laston']);
$h->userdata($ir,$lv,$fm,$cm);
$h->menuarea();


if($ir['donatordays'] == 0)
{
die("This feature is for donators only.");
}

print "
<h3>Friends List</h3>";
switch($_GET['action'])
{
case "add":
add_friend();
break;

case "remove":
remove_friend();
break;

case "ccomment":
change_comment();
break;

default:
friends_list();
break;
}

function friends_list()
{
global $ir,$c,$userid,$h;
print "
[url='friendslist.php?action=add']> Add a Friend[/url]

These are the people on your friends list.";

$q_y=mysql_query("SELECT * FROM friendslist WHERE fl_ADDED=$userid",$c);
print mysql_num_rows($q_y)." people have added you to their list.

Most liked: [";
$q2r=mysql_query("SELECT u.username,count( * ) as cnt,fl.fl_ADDED FROM friendslist fl LEFT JOIN users u on fl.fl_ADDED=u.userid GROUP BY fl.fl_ADDED ORDER BY cnt DESC LIMIT 5",$c) or die(mysql_error());
$r=0;
while($r2r=mysql_fetch_array($q2r))
{
$r++;
if($r > 1) { print " | "; }
print "[url='viewuser.php?u={$r2r[']{$r2r['username']}[/url]";
}
print "]

<table width=90%><tr style='background:gray'> <th>ID</th> <th>Name</th> <th>Mail</th> <th>Send Cash</th> <th>Remove</th> <th>Comment</th> <th>Change Comment</th> <th>Online?</th></tr>";
$q=mysql_query("SELECT fl.*,u.* FROM friendslist fl LEFT JOIN users u ON fl.fl_ADDED=u.userid WHERE fl.fl_ADDER=$userid ORDER BY u.username ASC",$c);
while($r=mysql_fetch_array($q))
{
if($r['laston'] >= time()-15*60) { $on="<font color=green>[b]Online[/b]</font>"; } else { $on="<font color=red>[b]Offline[/b]</font>"; }
$d="";
if($r['donatordays']) { $r['username'] = "<font color=red>{$r['username']}</font>";$d="[img=donator.gif]"; }
if(!$r['fl_COMMENT']) { $r['fl_COMMENT']="N/A"; }
print "<tr> <td>{$r['userid']}</td> <td>[url='viewuser.php?u={$r[']{$r['username']}[/url] $d</td> <td>[url='mailbox.php?action=compose&ID={$r[']Mail[/url]</td> <td>[url='sendcash.php?ID={$r[']Send Cash[/url]</td> <td>[url='friendslist.php?action=remove&f={$r[']Remove[/url]</td> <td>{$r['fl_COMMENT']}</td> <td>[url='friendslist.php?action=ccomment&f={$r[']Change[/url]</td> <td>$on</td></tr></table>";
}
$h->endpage();
exit;
}

function add_friend()
{
global $ir,$c,$userid,$h;
$_POST['ID'] = abs((int) $_POST['ID']);
$_POST['comment']=str_replace(array("<",">","\n"),array("<",">","
"), $_POST['comment']);

if($_POST['ID'])
{
$qc=mysql_query("SELECT * FROM friendslist WHERE fl_ADDER=$userid AND fl_ADDED={$_POST['ID']}",$c);
$q=mysql_query("SELECT * FROM users WHERE userid={$_POST['ID']}",$c);
if(mysql_num_rows($qc))
{
print "You cannot add the same person twice.";
$h->endpage();
exit;
}
if($userid==$_POST['ID'])
{
print "You cannot be so lonely that you have to try and add yourself.";
$h->endpage();
exit;
}
if(mysql_num_rows($q)==0)
{
print "Oh no, you're trying to add a ghost.";
$h->endpage();
exit;
}

mysql_query("INSERT INTO friendslist VALUES('', $userid, {$_POST['ID']}, '{$_POST['comment']}')",$c) or die(mysql_error());
$r=mysql_fetch_array($q);
print "{$r['username']} was added to your friends list.

[url='friendslist.php']> Back[/url]";
$h->endpage();
exit;

}
else
{
print "Adding a friend!<form action='friendslist.php?action=add' method='post'>
Friend's ID: <input type='text' name='ID' value='{$_GET['ID']}' />

Comment (optional): 

<textarea name='comment' rows='7' cols='40'></textarea>

<input type='submit' value='Add Friend' /></form>";
}

$h->endpage();
exit;

}
function remove_friend()
{
global $ir,$c,$userid,$h;
mysql_query("DELETE FROM friendslist WHERE fl_ID={$_GET['f']} AND fl_ADDER=$userid",$c);
print "Friends list entry removed!

[url='friendslist.php']> Back[/url]";

$h->endpage();
exit;

}
function change_comment()
{
global $ir,$c,$userid,$h;
$_POST['f'] = abs((int) $_POST['f']);
$_POST['comment']=str_replace(array("<",">","\n"),array("<",">","
"), $_POST['comment']);
if($_POST['comment'])
{
mysql_query("UPDATE friendslist SET fl_COMMENT='{$_POST['comment']}' WHERE fl_ID={$_POST['f']} AND fl_ADDER=$userid",$c);
print "Comment for friend changed!

[url='friendslist.php']> Back[/url]";
$h->endpage();
exit;
}
else
{
$_GET['f'] = abs((int) $_GET['f']);
$q=mysql_query("SELECT * FROM friendslist WHERE fl_ID={$_GET['f']} AND fl_ADDER=$userid",$c);
if(mysql_num_rows($q))
{
$r=mysql_fetch_array($q);
$comment=str_replace(array("<",">","
"), array("<",">","\n"), $r['fl_COMMENT']);
print "Changing a comment.<form action='friendslist.php?action=ccomment' method='post'>
<input type='hidden' name='f' value='{$_GET['f']}' />

Comment: 

<textarea rows='7' cols='40' name='comment'>$comment</textarea>

<input type='submit' value='Change Comment' /></form>";
$h->endpage();
exit;
}
else
{
print "Stop trying to edit comments that aren't yours.";
}
}

$h->endpage();
}


?>

 

how about that lol

Link to comment
Share on other sites

Re: Weird Problem

 

<?php

/*-----------------------------------------------------
-- Mono Country v1.0 BETA
-- A product of DBS-entertainment
-- Copyright held 2005 by Dabomstew
-- INDEX.php
-----------------------------------------------------*/

session_start();
require "global_func.php";
if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }
$userid=$_SESSION['userid'];
require "header.php";
$h = new headers;
$h->startheaders();
include "mysql.php";
global $c;
$is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error());
$ir=mysql_fetch_array($is);
check_level();
$fm=money_formatter($ir['money']);
$cm=money_formatter($ir['crystals'],'');
$lv=date('F j, Y, g:i a',$ir['laston']);
$h->userdata($ir,$lv,$fm,$cm);
$h->menuarea();


if($ir['donatordays'] == 0)
{
die("This feature is for donators only.");
}

print "
<h3>Friends List</h3>";
switch($_GET['action'])
{
case "add":
add_friend();
break;

case "remove":
remove_friend();
break;

case "ccomment":
change_comment();
break;

default:
friends_list();
break;
}

function friends_list()
{
global $ir,$c,$userid,$h;
print "
[url='friendslist.php?action=add']> Add a Friend[/url]

These are the people on your friends list.";

$q_y=mysql_query("SELECT * FROM friendslist WHERE fl_ADDED=$userid",$c);
print mysql_num_rows($q_y)." people have added you to their list.

Most liked: [";
$q2r=mysql_query("SELECT u.username,count( * ) as cnt,fl.fl_ADDED FROM friendslist fl LEFT JOIN users u on fl.fl_ADDED=u.userid GROUP BY fl.fl_ADDED ORDER BY cnt DESC LIMIT 5",$c) or die(mysql_error());
$r=0;
while($r2r=mysql_fetch_array($q2r))
{
$r++;
if($r > 1) { print " | "; }
print "[url='viewuser.php?u={$r2r[']{$r2r['username']}[/url]";
}
print "]

<table width=90%><tr style='background:gray'> <th>ID</th> <th>Name</th> <th>Mail</th> <th>Send Cash</th> <th>Remove</th> <th>Comment</th> <th>Change Comment</th> <th>Online?</th></tr>";
$q=mysql_query("SELECT fl.*,u.* FROM friendslist fl LEFT JOIN users u ON fl.fl_ADDED=u.userid WHERE fl.fl_ADDER=$userid ORDER BY u.username ASC",$c);
while($r=mysql_fetch_array($q))
{
if($r['laston'] >= time()-15*60) { $on="<font color=green>[b]Online[/b]</font>"; } else { $on="<font color=red>[b]Offline[/b]</font>"; }
$d="";
if($r['donatordays']) { $r['username'] = "<font color=red>{$r['username']}</font>";$d="[img=donator.gif]"; }
if(!$r['fl_COMMENT']) { $r['fl_COMMENT']="N/A"; }
print "<tr> <td>{$r['userid']}</td> <td>[url='viewuser.php?u={$r[']{$r['username']}[/url] $d</td> <td>[url='mailbox.php?action=compose&ID={$r[']Mail[/url]</td> <td>[url='sendcash.php?ID={$r[']Send Cash[/url]</td> <td>[url='friendslist.php?action=remove&f={$r[']Remove[/url]</td> <td>{$r['fl_COMMENT']}</td> <td>[url='friendslist.php?action=ccomment&f={$r[']Change[/url]</td> <td>$on</td></tr></table>";
}
$h->endpage();
exit;
}

function add_friend()
{
global $ir,$c,$userid,$h;
$_POST['ID'] = abs((int) $_POST['ID']);
$_POST['comment']=str_replace(array("<",">","\n"),array("<",">","
"), $_POST['comment']);

if($_POST['ID'])
{
$qc=mysql_query("SELECT * FROM friendslist WHERE fl_ADDER=$userid AND fl_ADDED={$_POST['ID']}",$c);
$q=mysql_query("SELECT * FROM users WHERE userid={$_POST['ID']}",$c);
if(mysql_num_rows($qc))
{
print "You cannot add the same person twice.";
$h->endpage();
exit;
}
if($userid==$_POST['ID'])
{
print "You cannot be so lonely that you have to try and add yourself.";
$h->endpage();
exit;
}
if(mysql_num_rows($q)==0)
{
print "Oh no, you're trying to add a ghost.";
$h->endpage();
exit;
}

mysql_query("INSERT INTO friendslist VALUES('', $userid, {$_POST['ID']}, '{$_POST['comment']}')",$c) or die(mysql_error());
$r=mysql_fetch_array($q);
print "{$r['username']} was added to your friends list.

[url='friendslist.php']> Back[/url]";
$h->endpage();
exit;

}
else
{
print "Adding a friend!<form action='friendslist.php?action=add' method='post'>
Friend's ID: <input type='text' name='ID' value='{$_GET['ID']}' />

Comment (optional): 

<textarea name='comment' rows='7' cols='40'></textarea>

<input type='submit' value='Add Friend' /></form>";
}

$h->endpage();
exit;

}
function remove_friend()
{
global $ir,$c,$userid,$h;
mysql_query("DELETE FROM friendslist WHERE fl_ID={$_GET['f']} AND fl_ADDER=$userid",$c);
print "Friends list entry removed!

[url='friendslist.php']> Back[/url]";

$h->endpage();
exit;

}
function change_comment()
{
global $ir,$c,$userid,$h;
$_POST['f'] = abs((int) $_POST['f']);
$_POST['comment']=str_replace(array("<",">","\n"),array("<",">","
"), $_POST['comment']);
if($_POST['comment'])
{
mysql_query("UPDATE friendslist SET fl_COMMENT='{$_POST['comment']}' WHERE fl_ID={$_POST['f']} AND fl_ADDER=$userid",$c);
print "Comment for friend changed!

[url='friendslist.php']> Back[/url]";
$h->endpage();
exit;
}
else
{
$_GET['f'] = abs((int) $_GET['f']);
$q=mysql_query("SELECT * FROM friendslist WHERE fl_ID={$_GET['f']} AND fl_ADDER=$userid",$c);
if(mysql_num_rows($q))
{
$r=mysql_fetch_array($q);
$comment=str_replace(array("<",">","
"), array("<",">","\n"), $r['fl_COMMENT']);
print "Changing a comment.<form action='friendslist.php?action=ccomment' method='post'>
<input type='hidden' name='f' value='{$_GET['f']}' />

Comment: 

<textarea rows='7' cols='40' name='comment'>$comment</textarea>

<input type='submit' value='Change Comment' /></form>";
$h->endpage();
exit;
}
else
{
print "Stop trying to edit comments that aren't yours.";
}
}

$h->endpage();
}


?>

 

and that, lol...

I changed the last one to this to..

Link to comment
Share on other sites

Re: Weird Problem

 

<?php

/*-----------------------------------------------------
-- Mono Country v1.0 BETA
-- A product of DBS-entertainment
-- Copyright held 2005 by Dabomstew
-- INDEX.php
-----------------------------------------------------*/

session_start();
require "global_func.php";
if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }
$userid=$_SESSION['userid'];
require "header.php";
$h = new headers;
$h->startheaders();
include "mysql.php";
global $c;
$is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error());
$ir=mysql_fetch_array($is);
check_level();
$fm=money_formatter($ir['money']);
$cm=money_formatter($ir['crystals'],'');
$lv=date('F j, Y, g:i a',$ir['laston']);
$h->userdata($ir,$lv,$fm,$cm);
$h->menuarea();


if($ir['donatordays'] == 0)
{
die("This feature is for donators only.");
}

print "
<h3>Friends List</h3>";
switch($_GET['action'])
{
case "add":
add_friend();
break;

case "remove":
remove_friend();
break;

case "ccomment":
change_comment();
break;

default:
friends_list();
break;
}

function friends_list()
{
global $ir,$c,$userid,$h;
print "
[url='friendslist.php?action=add']> Add a Friend[/url]

These are the people on your friends list.";

$q_y=mysql_query("SELECT * FROM friendslist WHERE fl_ADDED=$userid",$c);
print mysql_num_rows($q_y)." people have added you to their list.

Most liked: [";
$q2r=mysql_query("SELECT u.username,count( * ) as cnt,fl.fl_ADDED FROM friendslist fl LEFT JOIN users u on fl.fl_ADDED=u.userid GROUP BY fl.fl_ADDED ORDER BY cnt DESC LIMIT 5",$c) or die(mysql_error());
$r=0;
while($r2r=mysql_fetch_array($q2r))
{
$r++;
if($r > 1) { print " | "; }
print "[url='viewuser.php?u={$r2r[']{$r2r['username']}[/url]";
}
print "]

<table width=90%><tr style='background:gray'> <th>ID</th> <th>Name</th> <th>Mail</th> <th>Send Cash</th> <th>Remove</th> <th>Comment</th> <th>Change Comment</th> <th>Online?</th></tr>";
$q=mysql_query("SELECT fl.*,u.* FROM friendslist fl LEFT JOIN users u ON fl.fl_ADDED=u.userid WHERE fl.fl_ADDER=$userid ORDER BY u.username ASC",$c);
while($r=mysql_fetch_array($q))
{
if($r['laston'] >= time()-15*60) { $on="<font color=green>[b]Online[/b]</font>"; } else { $on="<font color=red>[b]Offline[/b]</font>"; }
$d="";
if($r['donatordays']) { $r['username'] = "<font color=red>{$r['username']}</font>";$d="[img=donator.gif]"; }
if(!$r['fl_COMMENT']) { $r['fl_COMMENT']="N/A"; }
print "<tr> <td>{$r['userid']}</td> <td>[url='viewuser.php?u={$r[']{$r['username']}[/url] $d</td> <td>[url='mailbox.php?action=compose&ID={$r[']Mail[/url]</td> <td>[url='sendcash.php?ID={$r[']Send Cash[/url]</td> <td>[url='friendslist.php?action=remove&f={$r[']Remove[/url]</td> <td>{$r['fl_COMMENT']}</td> <td>[url='friendslist.php?action=ccomment&f={$r[']Change[/url]</td> <td>$on</td></tr>";
}
print"</table>";
$h->endpage();
exit;
}

function add_friend()
{
global $ir,$c,$userid,$h;
$_POST['ID'] = abs((int) $_POST['ID']);
$_POST['comment']=str_replace(array("<",">","\n"),array("<",">","
"), $_POST['comment']);

if($_POST['ID'])
{
$qc=mysql_query("SELECT * FROM friendslist WHERE fl_ADDER=$userid AND fl_ADDED={$_POST['ID']}",$c);
$q=mysql_query("SELECT * FROM users WHERE userid={$_POST['ID']}",$c);
if(mysql_num_rows($qc))
{
print "You cannot add the same person twice.";
$h->endpage();
exit;
}
if($userid==$_POST['ID'])
{
print "You cannot be so lonely that you have to try and add yourself.";
$h->endpage();
exit;
}
if(mysql_num_rows($q)==0)
{
print "Oh no, you're trying to add a ghost.";
$h->endpage();
exit;
}

mysql_query("INSERT INTO friendslist VALUES('', $userid, {$_POST['ID']}, '{$_POST['comment']}')",$c) or die(mysql_error());
$r=mysql_fetch_array($q);
print "{$r['username']} was added to your friends list.

[url='friendslist.php']> Back[/url]";

}
else
{
print "Adding a friend!<form action='friendslist.php?action=add' method='post'>
Friend's ID: <input type='text' name='ID' value='{$_GET['ID']}' />

Comment (optional): 

<textarea name='comment' rows='7' cols='40'></textarea>

<input type='submit' value='Add Friend' /></form>";
}

$h->endpage();
exit;

}
function remove_friend()
{
global $ir,$c,$userid,$h;
mysql_query("DELETE FROM friendslist WHERE fl_ID={$_GET['f']} AND fl_ADDER=$userid",$c);
print "Friends list entry removed!

[url='friendslist.php']> Back[/url]";

$h->endpage();
exit;

}
function change_comment()
{
global $ir,$c,$userid,$h;
$_POST['f'] = abs((int) $_POST['f']);
$_POST['comment']=str_replace(array("<",">","\n"),array("<",">","
"), $_POST['comment']);
if($_POST['comment'])
{
mysql_query("UPDATE friendslist SET fl_COMMENT='{$_POST['comment']}' WHERE fl_ID={$_POST['f']} AND fl_ADDER=$userid",$c);
print "Comment for friend changed!

[url='friendslist.php']> Back[/url]";
}
else
{
$_GET['f'] = abs((int) $_GET['f']);
$q=mysql_query("SELECT * FROM friendslist WHERE fl_ID={$_GET['f']} AND fl_ADDER=$userid",$c);
if(mysql_num_rows($q))
{
$r=mysql_fetch_array($q);
$comment=str_replace(array("<",">","
"), array("<",">","\n"), $r['fl_COMMENT']);
print "Changing a comment.<form action='friendslist.php?action=ccomment' method='post'>
<input type='hidden' name='f' value='{$_GET['f']}' />

Comment: 

<textarea rows='7' cols='40' name='comment'>$comment</textarea>

<input type='submit' value='Change Comment' /></form>";
}
else
{
print "Stop trying to edit comments that aren't yours.";
}
}

$h->endpage();
}


?>

 

try that

Link to comment
Share on other sites

Re: Weird Problem

 

<?php

/*-----------------------------------------------------
-- Mono Country v1.0 BETA
-- A product of DBS-entertainment
-- Copyright held 2005 by Dabomstew
-- INDEX.php
-----------------------------------------------------*/

session_start();
require "global_func.php";
if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }
$userid=$_SESSION['userid'];
require "header.php";
$h = new headers;
$h->startheaders();
include "mysql.php";
global $c;
$is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error());
$ir=mysql_fetch_array($is);
check_level();
$fm=money_formatter($ir['money']);
$cm=money_formatter($ir['crystals'],'');
$lv=date('F j, Y, g:i a',$ir['laston']);
$h->userdata($ir,$lv,$fm,$cm);
$h->menuarea();


if($ir['donatordays'] == 0)
{
die("This feature is for donators only.");
}

print "
<h3>Friends List</h3>";
switch($_GET['action'])
{
case "add":
add_friend();
break;

case "remove":
remove_friend();
break;

case "ccomment":
change_comment();
break;

default:
friends_list();
break;
}

function friends_list()
{
global $ir,$c,$userid,$h;
print "
[url='friendslist.php?action=add']> Add a Friend[/url]

These are the people on your friends list.";

$q_y=mysql_query("SELECT * FROM friendslist WHERE fl_ADDED=$userid",$c);
print mysql_num_rows($q_y)." people have added you to their list.

Most liked: [";
$q2r=mysql_query("SELECT u.username,count( * ) as cnt,fl.fl_ADDED FROM friendslist fl LEFT JOIN users u on fl.fl_ADDED=u.userid GROUP BY fl.fl_ADDED ORDER BY cnt DESC LIMIT 5",$c) or die(mysql_error());
$r=0;
while($r2r=mysql_fetch_array($q2r))
{
$r++;
if($r > 1) { print " | "; }
print "[url='viewuser.php?u={$r2r[']{$r2r['username']}[/url]";
}
print "]

<table width=90%><tr style='background:gray'> <th>ID</th> <th>Name</th> <th>Mail</th> <th>Send Cash</th> <th>Remove</th> <th>Comment</th> <th>Change Comment</th> <th>Online?</th></tr>";
$q=mysql_query("SELECT fl.*,u.* FROM friendslist fl LEFT JOIN users u ON fl.fl_ADDED=u.userid WHERE fl.fl_ADDER=$userid ORDER BY u.username ASC",$c);
while($r=mysql_fetch_array($q))
{
if($r['laston'] >= time()-15*60) { $on="<font color=green>[b]Online[/b]</font>"; } else { $on="<font color=red>[b]Offline[/b]</font>"; }
$d="";
if($r['donatordays']) { $r['username'] = "<font color=red>{$r['username']}</font>";$d="[img=donator.gif]"; }
if(!$r['fl_COMMENT']) { $r['fl_COMMENT']="N/A"; }
print "<tr> <td>{$r['userid']}</td> <td>[url='viewuser.php?u={$r[']{$r['username']}[/url] $d</td> <td>[url='mailbox.php?action=compose&ID={$r[']Mail[/url]</td> <td>[url='sendcash.php?ID={$r[']Send Cash[/url]</td> <td>[url='friendslist.php?action=remove&f={$r[']Remove[/url]</td> <td>{$r['fl_COMMENT']}</td> <td>[url='friendslist.php?action=ccomment&f={$r[']Change[/url]</td> <td>$on</td></tr>";
}
print"</table>";
$h->endpage();
exit;
}

function add_friend()
{
global $ir,$c,$userid,$h;
$_POST['ID'] = abs((int) $_POST['ID']);
$_POST['comment']=str_replace(array("<",">","\n"),array("<",">","
"), $_POST['comment']);

if($_POST['ID'])
{
$qc=mysql_query("SELECT * FROM friendslist WHERE fl_ADDER=$userid AND fl_ADDED={$_POST['ID']}",$c);
$q=mysql_query("SELECT * FROM users WHERE userid={$_POST['ID']}",$c);
if(mysql_num_rows($qc))
{
print "You cannot add the same person twice.";
$h->endpage();
exit;
}
if($userid==$_POST['ID'])
{
print "You cannot be so lonely that you have to try and add yourself.";
$h->endpage();
exit;
}
if(mysql_num_rows($q)==0)
{
print "Oh no, you're trying to add a ghost.";
$h->endpage();
exit;
}

mysql_query("INSERT INTO friendslist VALUES('', $userid, {$_POST['ID']}, '{$_POST['comment']}')",$c) or die(mysql_error());
$r=mysql_fetch_array($q);
print "{$r['username']} was added to your friends list.

[url='friendslist.php']> Back[/url]";

}
else
{
print "Adding a friend!<form action='friendslist.php?action=add' method='post'>
Friend's ID: <input type='text' name='ID' value='{$_GET['ID']}' />

Comment (optional): 

<textarea name='comment' rows='7' cols='40'></textarea>

<input type='submit' value='Add Friend' /></form>";
}

$h->endpage();
exit;

}
function remove_friend()
{
global $ir,$c,$userid,$h;
mysql_query("DELETE FROM friendslist WHERE fl_ID={$_GET['f']} AND fl_ADDER=$userid",$c);
print "Friends list entry removed!

[url='friendslist.php']> Back[/url]";

$h->endpage();
exit;

}
function change_comment()
{
global $ir,$c,$userid,$h;
$_POST['f'] = abs((int) $_POST['f']);
$_POST['comment']=str_replace(array("<",">","\n"),array("<",">","
"), $_POST['comment']);
if($_POST['comment'])
{
mysql_query("UPDATE friendslist SET fl_COMMENT='{$_POST['comment']}' WHERE fl_ID={$_POST['f']} AND fl_ADDER=$userid",$c);
print "Comment for friend changed!

[url='friendslist.php']> Back[/url]";
}
else
{
$_GET['f'] = abs((int) $_GET['f']);
$q=mysql_query("SELECT * FROM friendslist WHERE fl_ID={$_GET['f']} AND fl_ADDER=$userid",$c);
if(mysql_num_rows($q))
{
$r=mysql_fetch_array($q);
$comment=str_replace(array("<",">","
"), array("<",">","\n"), $r['fl_COMMENT']);
print "Changing a comment.<form action='friendslist.php?action=ccomment' method='post'>
<input type='hidden' name='f' value='{$_GET['f']}' />

Comment: 

<textarea rows='7' cols='40' name='comment'>$comment</textarea>

<input type='submit' value='Change Comment' /></form>";
}
else
{
print "Stop trying to edit comments that aren't yours.";
}
}

$h->endpage();
}


?>

 

try that

yes yes yes what did you change

Link to comment
Share on other sites

Re: Weird Problem

actually I didn't take anything out lol. I just changed something. Trust me I have used 3 column templates many times I prefer them over two column and in every page you have to make sure that you have </table> to end that table if not it will place your 3rd column into the table as well.

You had the </table> in there it was just in the wrong place.

you had it as

 

print "<tr> <td>{$r['userid']}</td> <td>[url='viewuser.php?u={$r[']{$r['username']}[/url] $d</td> <td>[url='mailbox.php?action=compose&ID={$r[']Mail[/url]</td> <td>[url='sendcash.php?ID={$r[']Send Cash[/url]</td> <td>[url='friendslist.php?action=remove&f={$r[']Remove[/url]</td> <td>{$r['fl_COMMENT']}</td> <td>[url='friendslist.php?action=ccomment&f={$r[']Change[/url]</td> <td>$on</td></tr></table>";
}
$h->endpage();
exit;
}

 

notice in the code above that the </table> is before the } well in order for it to display correctly then it needed to be after the { like this

 

print "<tr> <td>{$r['userid']}</td> <td>[url='viewuser.php?u={$r[']{$r['username']}[/url] $d</td> <td>[url='mailbox.php?action=compose&ID={$r[']Mail[/url]</td> <td>[url='sendcash.php?ID={$r[']Send Cash[/url]</td> <td>[url='friendslist.php?action=remove&f={$r[']Remove[/url]</td> <td>{$r['fl_COMMENT']}</td> <td>[url='friendslist.php?action=ccomment&f={$r[']Change[/url]</td> <td>$on</td></tr>";
}
print"</table>":
$h->endpage();
exit;
}

 

the other way would have worked correctly had there been anyone on the friends list but after the first person on the friends list the rest of them wouldn't have been included in the table. See what I am getting at. The way I have it it will include everyone inside that table then once its done with all of that it will end the table properly.

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