View Full Version : Please Help
Drugs
09-08-2006, 11:58 AM
Just before i say this, all people that help me will recieve the shoutbox with admin panel etc. free of charge when it is fully done ;D
Basically this is the default text of the content.txt;
<font size="1" face="Verdana">
<b>Shoutbox cleared by Ryan..</b></font><br> <br>
<font size="1" face="verdana">
<b>Message From Ryan {Admin}</b><br>Just a quick note to say if anyone named 'Admin' or 'Moderator' or something along the lines of trying to make out they are a staff member says anything, it is not really from a member of staff, staff will speak in announcements like this, not in the form of a normal shoutout, thanks..</b>
</font><br><br>
<font size="1" face="verdana">
<b>Message From Ryan {Admin}</b><br>Hey, thanks for coming to PixelResources, please do not abuse the ShoutBox as it is put here for your use, so do not abuse it, or we may have to remove it, enjoy the site, Ryan..</b>
</font><br><br>
<font size="1" face="verdana">
<i>We reserve the right to ban your IP if found abusing the Shoutbox</i>
</font><br><br>
<font size="1" face="verdana">
<i>© PixelResources 2006 - 2007</i>
</font><br><br>
And basically, when the shoutbox gets full i go into content.txt and overwrite all the content in there with that.
I want like a button or link which i can place in the admin panel for the shoutbox which just overwrites all the shoutbox content with that when clicked, thanks.
Edited by ---MAD--- (forum moderator): Thread locked as it has gone off topic, thanks :).
Colin-Roberts
09-08-2006, 12:07 PM
$myFile = "testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "basic text here\n";
fwrite($fh, $stringData);
fclose($fh);
just run this file everytime you want to empty shoutbox and were it says basic text here put the text you want to add after it emptys
Drugs
09-08-2006, 12:10 PM
Colin where do i put that though?
Hold on a sec
Right i have this;
<?php
if($_COOKIE['in'] == "1"){}
else{
die("You are not authrised to view this page.");
}
?>
Put it in ;D
Edit: I see where your coming from, when i run the page it deleted shoutbox, i was looking for a button so when you click on the button it then runs that so like on.click it runs that.
Colin-Roberts
09-08-2006, 12:11 PM
new file
Shoutdelete.php
$myFile = "content.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "<font size="1" face="Verdana">
<b>Shoutbox cleared by Ryan..</b></font><br> <br>
<font size="1" face="verdana">
<b>Message From Ryan {Admin}</b><br>Just a quick note to say if anyone named 'Admin' or 'Moderator' or something along the lines of trying to make out they are a staff member says anything, it is not really from a member of staff, staff will speak in announcements like this, not in the form of a normal shoutout, thanks..</b>
</font><br><br>
<font size="1" face="verdana">
<b>Message From Ryan {Admin}</b><br>Hey, thanks for coming to PixelResources, please do not abuse the ShoutBox as it is put here for your use, so do not abuse it, or we may have to remove it, enjoy the site, Ryan..</b>
</font><br><br>
<font size="1" face="verdana">
<i>We reserve the right to ban your IP if found abusing the Shoutbox</i>
</font><br><br>
<font size="1" face="verdana">
<i>© PixelResources 2006 - 2007</i>
</font><br><br>\n";
fwrite($fh, $stringData);
fclose($fh);
Drugs
09-08-2006, 12:15 PM
Theres something wrong with this; $stringData = "<font size="1" face="Verdana">
Colin-Roberts
09-08-2006, 12:28 PM
only works with plain text the font codes and bold italic dont work.
Drugs
09-08-2006, 12:34 PM
they must do somehow i seen it before.
Colin-Roberts
09-08-2006, 12:38 PM
for font you could use .css file but the bold and italic i dont know unless theres php equlents of bbcode
Fujitsu
09-08-2006, 12:49 PM
You do \" instead of "
$myFile = "content.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "<font size=\"1\" face=\"Verdana\">
<b>Shoutbox cleared by Ryan..</b></font><br> <br>
<font size=\"1\" face=\"verdana\">
<b>Message From Ryan {Admin}</b><br>Just a quick note to say if anyone named 'Admin' or 'Moderator' or something along the lines of trying to make out they are a staff member says anything, it is not really from a member of staff, staff will speak in announcements like this, not in the form of a normal shoutout, thanks..</b>
</font><br><br>
<font size=\"1\" face=\"verdana\">
<b>Message From Ryan {Admin}</b><br>Hey, thanks for coming to PixelResources, please do not abuse the ShoutBox as it is put here for your use, so do not abuse it, or we may have to remove it, enjoy the site, Ryan..</b>
</font><br><br>
<font size=\"1\" face=\"verdana\">
<i>We reserve the right to ban your IP if found abusing the Shoutbox</i>
</font><br><br>
<font size=\"1\" face=\"verdana\">
<i>© PixelResources 2006 - 2007</i>
</font><br><br>\n";
fwrite($fh, $stringData);
fclose($fh);
Drugs
09-08-2006, 01:05 PM
Fujitsu i will try that now.
Edit: Fujitsu your so awesome it works.
Fujitsu
09-08-2006, 01:12 PM
Whats your next admin panel feature going to be?
Drugs
09-08-2006, 01:18 PM
Ok wanna help me? I need a form field, where you type in a username and a password and it adds it to the log.txt file which i will CHMOD to 777.
The file is like this;
Ryan||password||
So it will need to to post a new user in there so say if in the username form i put 'Demo' and in the password form i put 'Password' i would like the result in the log.txt file to be this;
Demo||Password||
Ryan||ryanspassword||
Thanks dude.
Edit: I might be able to do this myself.
Colin-Roberts
09-08-2006, 01:19 PM
lol i should get the admin panel and so should fujiti
this work ryan
??
The first thing you need to know how to do is use the fopen() fread() and fwrite() functions. After that you must build a data parser. Here is the one I use for my flatfile member system:
Code:
$file = "storage.dat";
$file = file($file);
foreach($file as $Key => $Val)
{
//explode that data into a new array:
$Data[$Key] = explode("||", $Val);
}
Next you would make the member list page, that is quite simple, just loop through with the data given above. Here is the whole code I use for an output situation. A sample data file and run file will be included aswell, call this output.php:
Code:
<?php
function ffdisplay($Lines, $rows){
$Lines = file($Lines);
foreach($Lines as $Key => $Val)
{
//explode that data into a new array:
$Data[$Key] = explode("||", $Val);
}
echo "Layout:<br>";
for($a = 0; $a < $rows; $a++)
{
if($a != "0"){
echo '||';
}
echo ''.$Data[0][$a].'';
}
echo "<br>------------------------<br>";
for($K = 1; $K < sizeof($Lines); $K++)
{
echo '<p>';
for($a = 0; $a < $rows; $a++)
{
echo ''.$Data[0][$a].': '.$Data[$K][$a].'<br>';
}
echo '</p>';
}
}
?>
Now lets make your data page.
Code:
Username||Age||Password
colin ||13||some md5 data
somebody really cool||20||some md5 data
That has the data, as you can see, the first line contains a sample of the page layout, this script is built for that, some scripts won't be. Here is the test.php page. That should be saved as sample.dat.
Code:
<?php
include("output.php");
ffdisplay("sample.dat", "2");
?>
Now you need to build the fwrite function, I just briefed you on the bases of the code.
Drugs
09-08-2006, 01:23 PM
You will lmao.
I am doing the add user bit now.
Feature ATM
Admin Panel Features
Add announcement.
Add action.
Admin shout.
Admin coloured name.
List of admins.
Shoutbox Features
HTML Disabled.
Very easily customised.
Smilie feature.
More coming soon ;D
Fujitsu
09-08-2006, 01:25 PM
New Code Posted: See Most Recent Post, It Makes The Output Look Better
Colin-Roberts
09-08-2006, 01:30 PM
lol fujitsu you make my elaborate scripts look bad.
Fujitsu
09-08-2006, 01:33 PM
<?php
$username = $_GET["username"];
$password = $_GET["password"];
$out = fopen("log.txt", "a");
if (!$out) {
print("Error opening file, CHMOD to 777.");
exit;
}
fputs ($out,implode,("\n"));
fwrite($out,"<b>Username Tried:</b> $username<br><b>Password Tried:</b> $password<br><br>");
fclose($out);
?>
That one would be better as it puts 2 line breaks after the output, making it easier to read.
Colin-Roberts
09-08-2006, 01:35 PM
ryan you should have a word filter also.
Drugs
09-08-2006, 01:37 PM
LOL Fujitsu you don't even have a form to add it..
I have this so far;
createuser.php
<html>
<head>
<title>PixelResources User Creator</title>
</head>
<body>
<?php
if($_COOKIE['in'] == "1"){}
else{
die("You are not authrised to view this page.");
}
?>
<font size=1> <font face='verdana'>
<b>Add an admin</b><br><br>
<FORM name="shout" action="adduser.php" method="POST">
Username;<br>
<INPUT TYPE="TEXT" name="name" size="20"><br><br>
Password;<br>
<INPUT TYPE="TEXT" name="message" size="20"><br><br>
<br><br>
<INPUT TYPE="Submit" name="submit" value="Create Admin" size="20">
</FORM>
<br>
</font>
<?php
// Copyright 2006 - 2007 PixelResources
?>
</body>
</html>
And adduser.php;
<?php
$name = $_POST['name'];
$website = $_POST['website'];
$message = $_POST['message'];
if(empty($name) OR empty($message))
{
echo "
<script language='javascript'>
alert('Please fill in both the Username and the Password fields...');
</script>
";
}
else
{
echo "
<script language='javascript'>
alert('The user was successfully created...');
</script>
";
$name = ($name);
$message = ($message);
$tag = ("<font size=\"1\" face=\"Verdana\">
$name||$message||<br>");
$read = fopen("/users/log.txt", "r");
$contents = fread($read, filesize('/users/log.txt'));
fclose($read);
$write = fopen("/users/log.txt", "w");
fwrite($write, "$tag $contents");
fclose($write);
}
print "<meta http-equiv=\"refresh\" content=\"0;adminindex.php\">";
// Copyright 2006 - 2007 PixelResources
?>
Yet because the folder users which the log.txt folder is in passworded via .htaccess it is unable to write, even though it is CHMOD'ed to 777, this is the error i get once the i press Add User.
http://img98.imageshack.us/img98/3470/errortv6.png
Fujitsu
09-08-2006, 01:38 PM
That was the code to log access attempts...
Colin-Roberts
09-08-2006, 01:42 PM
you could always do it easy way. password protect the admin directory using cpanel
Drugs
09-08-2006, 01:42 PM
Nooo i am trying to make a form where you type in a username and password and it adds it to log.txt so it makes a user.
Try and fix my code ;D
Fujitsu
09-08-2006, 01:45 PM
I know! 1 Sec
Colin-Roberts
09-08-2006, 01:48 PM
<html>
<head>
<title>PixelResources User Creator</title>
</head>
<body>
<?php
if($_COOKIE['in'] == "1"){}
else{
die("You are not authrised to view this page.");
}
?>
<font size=1> <font face='verdana'>
<b>Add an admin</b><br><br>
<FORM name="shout" action="adduser.php" method="POST">
Username;<br>
<INPUT TYPE="TEXT" name="name" size="20"><br><br>
Password;<br>
<INPUT TYPE="TEXT" name="password" size="20"><br><br>
<br><br>
<INPUT TYPE="Submit" name="submit" value="Create Admin" size="20">
</FORM>
<br>
</font>
<?php
// Copyright 2006 - 2007 PixelResources
?>
</body>
</html>
<?php
$name = $_POST['name'];
$password = $_POST['password'];
if(empty($name) OR empty($password))
{
echo "
<script language='javascript'>
alert('Please fill in both the Username and the Password fields...');
</script>
";
}
else
{
echo "
<script language='javascript'>
alert('The user was successfully created...');
</script>
$write = fopen("/users/log.txt", "w");
fwrite($write, "$name $password");
fclose($write);
}
(this part below makes no sense)
";
$name = ($name);
$message = ($message);
$tag = ("<font size=\"1\" face=\"Verdana\">
$name||$message||<br>");
$read = fopen("/users/log.txt", "r");
$contents = fread($read, filesize('/users/log.txt'));
fclose($read);
print "<meta http-equiv=\"refresh\" content=\"0;adminindex.php\">";
// Copyright 2006 - 2007 PixelResources
?>
Fujitsu
09-08-2006, 01:49 PM
OK make adduser.php
<?php
$name = $_POST['name'];
$website = $_POST['website'];
$message = $_POST['message'];
if(empty($name) OR empty($message))
{
echo "
<script language='javascript'>
alert('Please fill in both the Username and the Password fields...');
</script>
";
}
else
{
echo "
<script language='javascript'>
alert('The user was successfully created...');
</script>
";
$name = ($name);
$message = ($message);
$tag = ("<font size=\"1\" face=\"Verdana\">
$name||$message||<br>");
$read = fopen("users/log.txt", "r");
$contents = fread($read, filesize('users/log.txt'));
fclose($read);
$write = fopen("users/log.txt", "w");
fwrite($write, "$tag $contents");
fclose($write);
}
print "<meta http-equiv=\"refresh\" content=\"0;adminindex.php\">";
// Copyright 2006 - 2007 PixelResources
?>
Drugs
09-08-2006, 02:02 PM
YEy thankyou Fujitsu it works ;D
Colin-Roberts
09-08-2006, 02:04 PM
lol stupid fujitsu make dots look bad again
what's next page ryan?
Fujitsu
09-08-2006, 02:05 PM
Lolsor.
A4AOwen (Forum Moderator) - Please do not post pointlessly.
Drugs
09-08-2006, 02:05 PM
Yep i need a word filter next, help me please Fujitsu...
Edit: also anyone who wants to have a look in the admin panel PM me your MSN.
Colin-Roberts
09-08-2006, 02:10 PM
function filter($msg)
{
$bad_words = explode(',', "tomato,lettuce,carrot,potato,broccoli,cucumber,pea" );
foreach ($bad_words as $naughty)
{
$msg = eregi_replace($naughty, "****", $msg);
}
return $msg;
}
credit to mentor
Fujitsu
09-08-2006, 02:11 PM
Full Code:
http://www.habboxforum.com/showthread.php?goto=newpost&t=204001
By Mentor
Drugs
09-08-2006, 02:12 PM
Where would i put that though? When you post it tell me which code to post and then you can add it to the code.
Colin-Roberts
09-08-2006, 02:14 PM
addtag.php is the code we need
You would edit the post code so it parses the message before its submitted.
Fujitsu
09-08-2006, 02:18 PM
In addtag.php put
function filter($message)
{
$bad_words = explode(',', "tomato,lettuce,carrot,potato,broccoli,cucumber,pea" );
foreach ($bad_words as $naughty)
{
$message = eregi_replace($naughty, "****", $message);
}
return $message;
}
then put
$input = "$message";
$output = filter($input);
echo $output;
Add me on msn, *Removed*
A4AOwen (Forum Moderator) - Please do not post your personal information.
Drugs
09-08-2006, 02:19 PM
Someone add it to this please <3
<?php
$name = $_POST['name'];
$website = $_POST['website'];
$message = $_POST['message'];
if(empty($name) OR empty($message))
{
echo "
<script language='javascript'>
alert('You need to fill out both of the form fields...');
</script>
";
}
else
{
echo "
<script language='javascript'>
alert('Thanks for your message $name...');
</script>
";
$name = htmlspecialchars($name);
$message = htmlspecialchars($message);
$tag = ("<font size=\"1\" face=\"Verdana\">
<b>$name</b>: $message </font><br><br>");
$read = fopen("content.txt", "r");
$contents = fread($read, filesize('content.txt'));
fclose($read);
$write = fopen("content.txt", "w");
fwrite($write, "$tag $contents");
fclose($write);
}
print "<meta http-equiv=\"refresh\" content=\"0;index.php\">";
// Copyright 2006 - 2007 PixelResources
?>
Colin-Roberts
09-08-2006, 02:20 PM
function filter($msg)
{
$bad_words = explode(',', "tomato,lettuce,carrot,potato,broccoli,cucumber,pea" );
foreach ($bad_words as $naughty)
{
$msg = eregi_replace($naughty, "****", $msg);
}
return $msg;
}
you don't need the php codes fujit unless you were tryi ng to do php code box.
Colin-Roberts
09-08-2006, 02:22 PM
i think its this.
<?php
$name = $_POST['name'];
$message = $_POST['message'];
if(empty($name) OR empty($message))
{
echo "
<script language='javascript'>
alert('You need to fill out both of the form fields...');
</script>
";
}
else
{
echo "
<script language='javascript'>
alert('Thanks for your message $name...');
</script>
";
$name = htmlspecialchars($name);
$message = htmlspecialchars($message);
$tag = ("<font size=\"1\" face=\"Verdana\">
<b>$name</b>: $message </font><br><br>");
function filter($name)
{
$bad_words = explode(',', "****,****,ect" );
foreach ($bad_words as $naughty)
{
$msg = eregi_replace($naughty, "****", $name);
}
return $name;
}
function filter($message)
{
$bad_words = explode(',', "tomato,lettuce,carrot,potato,broccoli,cucumber,pea" );
foreach ($bad_words as $naughty)
{
$msg = eregi_replace($naughty, "****", $message);
}
return $message;
}
$read = fopen("content.txt", "r");
$contents = fread($read, filesize('content.txt'));
fclose($read);
$write = fopen("content.txt", "w");
fwrite($write, "$tag $contents");
fclose($write);
}
print "<meta http-equiv=\"refresh\" content=\"0;index.php\">";
// Copyright 2006 - 2007 PixelResources
?>
Fujitsu
09-08-2006, 02:24 PM
<?php
$name = $_POST['name'];
$website = $_POST['website'];
$message = $_POST['message'];
if(empty($name) OR empty($message))
{
echo "
<script language='javascript'>
alert('You need to fill out both of the form fields...');
</script>
";
}
else
{
echo "
<script language='javascript'>
alert('Thanks for your message $name...');
</script>
";
$name = htmlspecialchars($name);
$message = htmlspecialchars($message);
$tag = ("<font size=\"1\" face=\"Verdana\">
<b>$name</b>: $message </font><br><br>");
function filter($tag)
{
$bad_words = explode(',', "tomato,lettuce,carrot,potato,broccoli,cucumber,pea" );
foreach ($bad_words as $naughty)
{
$tag = eregi_replace($naughty, "****", $tag);
}
return $tag;
}
function filter2($contents)
{
$bad_words = explode(',', "tomato,lettuce,carrot,potato,broccoli,cucumber,pea" );
foreach ($bad_words as $naughty)
{
$contents = eregi_replace($naughty, "****", $contents);
}
return $contents;
}
$input = $contents;
$output = filter($input);
echo $output;
$input = $tag;
$output = filter($input);
echo $output;
$read = fopen("content.txt", "r");
$contents = fread($read, filesize('content.txt'));
fclose($read);
$write = fopen("content.txt", "w");
fwrite($write, "$tag $contents");
fclose($write);
}
print "<meta http-equiv=\"refresh\" content=\"0;index.php\">";
// Copyright 2006 - 2007 PixelResources
?>
Colin-Roberts
09-08-2006, 02:28 PM
fujitsu how can you filter the variable tag and content shouldnt it be name and message?
Fujitsu
09-08-2006, 02:39 PM
<?php
$name = $_POST['name'];
$website = $_POST['website'];
$message = $_POST['message'];
if(empty($name) OR empty($message))
{
echo "
<script language='javascript'>
alert('You need to fill out both of the form fields...');
</script>
";
}
else
{
echo "
<script language='javascript'>
alert('Thanks for your message $name...');
</script>
";
$name = htmlspecialchars($name);
$message = htmlspecialchars($message);
$tag = ("<font size=\"1\" face=\"Verdana\">
<b>$name</b>: $message </font><br><br>");
function filter($tag)
{
$bad_words = explode(',', "tomato,lettuce,carrot,potato,broccoli,cucumber,pea" );
foreach ($bad_words as $naughty)
{
$tag = eregi_replace($naughty, "****", $tag);
}
return $tag;
}
function filter2($contents)
{
$bad_words = explode(',', "tomato,lettuce,carrot,potato,broccoli,cucumber,pea" );
foreach ($bad_words as $naughty)
{
$contents = eregi_replace($naughty, "****", $contents);
}
return $contents;
}
$read = fopen("content.txt", "r");
$contents = fread($read, filesize('content.txt'));
fclose($read);
$write = fopen("content.txt", "w");
fwrite($write, "$tag $contents $input = $contents; $output = filter($input)");
fclose($write);
}
print "<meta http-equiv=\"refresh\" content=\"0;index.php\">";
// Copyright 2006 - 2007 PixelResources
?>
Colin-Roberts
09-08-2006, 02:52 PM
still doesnt work
Fujitsu
09-08-2006, 03:22 PM
Well done for pointing out the obvious. Anyway we're working on admin panel at the moment.
ClubTime
09-08-2006, 05:03 PM
Well done for pointing out the obvious. Anyway we're working on admin panel at the moment.
We're or you are? Lol
A4AOwen (Forum Moderator) - Please do not post off topic.
Fujitsu
09-08-2006, 05:06 PM
I'm doing admin, Ryan's doing Mod.
A4AOwen (Forum Moderator) - Please do not post off topic.
ClubTime
09-08-2006, 05:08 PM
Kay Lol
A4AOwen (Forum Moderator) - Please do not post off topic.
Fujitsu
09-08-2006, 05:12 PM
Whats you LOLing about?
A4AOwen (Forum Moderator) - Please do not post off topic.
ClubTime
09-08-2006, 05:41 PM
That you doing all the work for him. Are you getting anything out of it?
A4AOwen (Forum Moderator) - Please do not post off topic.
Colin-Roberts
09-08-2006, 06:00 PM
fujitsu is a nice guy unliek you chris.
Edited by ---MAD--- (forum moderator): Please stay on topic, thanks :).
Fujitsu
09-08-2006, 06:03 PM
I've had 3 infractions so far FGS. Mods are going power mad now. And like loads of my posts have been edited.
Edited by ---MAD--- (forum moderator): Please stay on topic, thanks :). Read the forum rules if you are not sure why you are getting infractions/post edits. If you still think a moderator has done something wrong, contact Baving the forum manager, thanks again :).
I've had 3 infractions so far FGS. Mods are going power mad now. And like loads of my posts have been edited.
I guess you are from Habbo Forum because you used infractions ;o Also Habbo Forum moderators are worst. I got banned for posting a link to www.bittorrent.com ''/
Edited by ---MAD--- (forum moderator): Please stay on topic, thanks :).
Colin-Roberts
09-08-2006, 06:44 PM
thats what habbox mods call them i got 2 so far.
Edited by ---MAD--- (forum moderator): Please stay on topic, thanks :).
Fujitsu
09-08-2006, 06:47 PM
LOL Tom. I guess the ban reason was 'Illegal Content' or something stupid. Because bittorrent.com is very illegal. Not.
Edited by ---MAD--- (forum moderator): Please stay on topic, thanks :).
LOL Tom. I guess the ban reason was 'Illegal Content' or something stupid. Because bittorrent.com is very illegal. Not.
The ban was for posting links to sites that contain/link to illegal content.
Edited by ---MAD--- (forum moderator): Please stay on topic, thanks :).
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.