How to prevent "Anonymous" to add shouts?

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   How to prevent "Anonymous" to add shouts?
Tendency
CZ Super Newbie
 Codezwiz Site Donator
Tendency has been a member for over 20 year's 20 Year Member
usa.gif florida.gif
Occupation: Longshoreman
Age: 54
Gender: Male
Fav. Sports Team: Dallas Cowboys
Website:
Status: Offline
Joined: Nov 25, 2003
0.01 posts per day
Posts: 97
Points: 9,373
  MSN Messenger 
I want to stop "Anonymous" posters from using my shoutbox. Can someone look at this code and figure out how to make people login to the site to post shouts?

include("mainfile.php");
cookiedecode($user);
$username = $cookie[1];
if ($username == "") {
$username = "Anonymous";
}
// Define database connection details
include("config.php");
mysql_connect($dbhost, $dbuname, $dbpass);
@mysql_select_db($dbname);
$table = "".$prefix."_flashshout";
// Attempt to connect to MySQL server
$link = @mysql_connect($dbhost, $dbuname, $dbpass);

// If the connection was unsuccessful...
if (!$link)
{
// Report error to Flash and exit
    print "&result=Fail";
    print "&errorMsg=" . urlencode("Could not connect to server");
    exit;
}

// Attempt to connect to MySQL server
$link = @mysql_connect($dbhost, $dbuname, $dbpass);

// If the connection was unsuccessful...
if (!$link)
{
// Report error to Flash and exit
    print "&result=Fail";
    print "&errorMsg=" . urlencode("Could not connect to database");
    exit;
}

// Attempt to select database. If unsuccessfull...
if (!@mysql_select_db($dbname))
{
// Report error to Flash and exit
    print "&result=Fail";
    print "&errorMsg=" . urlencode("Could not select $dbname database");
    exit;
}

// Fetch the current time
$posted = time();
$flashshoutTitle = ereg_replace("[^A-Za-z0-9 ]", "", $flashshoutTitle);
//$flashshoutBody = ereg_replace("[^A-Za-z0-9 \@\.\-\/\']", "", $flashshoutBody);
$flashshoutTitle = stripslashes($flashshoutTitle);
//$flashshoutBody = stripslashes($flashshoutBody);
// Build Query
if ($Submit == "Yes") {
$query = "INSERT INTO ".$prefix."_flashshout (ip, title, body, posted)
          VALUES('$REMOTE_ADDR', '$username', '$flashshoutBody', $posted)";
}
// Execute Query
$result = @mysql_query($query);

// If query was successful
if ($result) {

// Report success back to Flash movie
    print "&result=Okay";
}
else
{
// Otherwise, tell Flash we have an error
    print "&result=Fail";
    print "&errorMsg=" . urlencode("Couldn't add posts");
}

// Close the connection
mysql_close($link);

?>



Back to top Reply with quote
#2   re: How to prevent "Anonymous" to add shouts?
_Aerospace_Eng_
CZ Active Member
_Aerospace_Eng_ has been a member for over 19 year's 19 Year Member
usa.gif
Age: 38
Gender: Male
Status: Offline
Joined: Nov 09, 2004
0.03 posts per day
Posts: 200
Points: 10,133
   
y not just make ur shoutbox available to registered members? which u can set in your admin control panel




_________________
Back to top Reply with quote
#3   re: How to prevent "Anonymous" to add shouts?
Tendency
CZ Super Newbie
 Codezwiz Site Donator
Tendency has been a member for over 20 year's 20 Year Member
usa.gif florida.gif
Occupation: Longshoreman
Age: 54
Gender: Male
Fav. Sports Team: Dallas Cowboys
Website:
Status: Offline
Joined: Nov 25, 2003
0.01 posts per day
Posts: 97
Points: 9,373
  MSN Messenger 
I want the shoutbox to show all the time.



Back to top Reply with quote
#4   re: How to prevent "Anonymous" to add shouts?
echo
CZ Wiz
 Codezwiz Site Donator
echo has been a member for over 20 year's 20 Year Member
Gender: Male
Status: Offline
Joined: Oct 04, 2003
0.15 posts per day
Posts: 1147
Points: 93
   
Is this an Mtechnik shout box? If so do this-
Courtesy of Beanbag Wrestling:

Open addshout.php

find:
$username = "Anonymous"; 
}


Add After:
else {


So it looks like:

$username = "Anonymous"; 
} else {


Find:
?>


Add above:
}


Close addshout.php

This next step is optional... its if you want the username to say
"Registered Users Only" instead of "Anonymous"

Open blocks/block-FSB-center.php

Find:
$username = "Anonymous";


Change To:
$username = "Registered Users Only";


Close blocks/block-FSB-center.php


Back to top Reply with quote
#5   re: How to prevent "Anonymous" to add shouts?
Tendency
CZ Super Newbie
 Codezwiz Site Donator
Tendency has been a member for over 20 year's 20 Year Member
usa.gif florida.gif
Occupation: Longshoreman
Age: 54
Gender: Male
Fav. Sports Team: Dallas Cowboys
Website:
Status: Offline
Joined: Nov 25, 2003
0.01 posts per day
Posts: 97
Points: 9,373
  MSN Messenger 
Thanks echo, that did the trick. thanks to beanbag wrestling as well!!



Back to top Reply with quote
#6   re: How to prevent "Anonymous" to add shouts?
echo
CZ Wiz
 Codezwiz Site Donator
echo has been a member for over 20 year's 20 Year Member
Gender: Male
Status: Offline
Joined: Oct 04, 2003
0.15 posts per day
Posts: 1147
Points: 93
   
Your welcome.



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

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 cannot download files in this forum