Click to See Complete Forum and Search --> : Forum building help...


Pages : [1] 2 3

spykemitchell
09-18-2003, 12:21 PM
I need some help buling a forum/BB. I have designed a script that lets people post messages but not threads. I want a script that does not use MySQL (preferably a .dat file) where people can post a new thread (i need to be able to easily customise the layout, preferably all in tables) which also creates the appropriate file for the entrys. I just need it to create the file (i will write the code i just need it to create a file with that code in it).

I hope that made sense. I am designing a website for a band street team and i really want this to work but i am having serious difficulty.

If anyone can help please tell me. If you need to see the message script please just ask...

Jona
09-18-2003, 12:28 PM
Hmm, I'm too used to using MySQL rather than text files... Could you provide a little more deatial as to what you have done so far?

[J]ona

pyro
09-18-2003, 12:40 PM
Are you using separate .dat files for each thread? If so, look at the info at http://us4.php.net/manual/en/function.fopen.php

spykemitchell
09-18-2003, 12:40 PM
So far i have the main forum screen which says, welcome to the forum, please select a topic.. followed by a list of topics...

//I want it to take you from this topic to a list of threads which anyone can post (using a .dat file) then upon clicking on this it takes you to the add entry screen//

which i have allready done using a .dat file to store entrys. I need the script to create a file identical to my message script with a coresponding .dat file for logging the entrys. I thought about editing my message script to make it do this but i am a bit of a novice and i can't figure out a way to do it.

The section in // is the bit i can't do...

Please help....

spykemitchell
09-18-2003, 12:43 PM
yeah i am using seperate .dat and php files for each thread but i need the script to create these files for me when a new thread is posted.

spykemitchell
09-18-2003, 01:25 PM
This is an example of the layout i wish to use...



<center>
<TABLE width="550" cellpadding=0 cellspacing=1 border=0>
<TR bgcolor='#df9d24'>
<TD>
<TABLE width="100%" cellpadding=4 cellspacing=1 border=0>
<TR><TD bgcolor='#000000' colspan=3>
<FONT SIZE="1" FACE="verdana" COLOR="#ffffff"><A HREF="/himforum.php?do=add_form&page=1"><FONT SIZE="1" FACE="verdana" COLOR="#ffffff">Click here to post new thread...</a></FONT></B>
</TD></TR>
<TR><TD bgcolor='#000000' align='right' valign='top'><FONT SIZE=2 FACE='verdana' color='#ffffff' Size='2'>1</FONT></TD><TD bgcolor='#000000' width='535'><a href="himforum.php" onmouseover="self.status=''; return true" onmouseout="self.status='' ; return true"><FONT SIZE='2' color='#df8d24'><u>Thread 1</u></font></a></FONT></TD></TR><TR><TD bgcolor='#000000' align='right' valign='top'><FONT SIZE=2 FACE='verdana' color='#ffffff' Size='2'>2</FONT></TD><TD bgcolor='#000000' width='535'><FONT SIZE='2' color='#df9d24'>Thread 2</font></FONT></TD></TR><TR><TD colspan=3 bgcolor='#000000' align='center'><FONT SIZE='1' FACE='verdana' color='#ffffff'>Page 1 of 1</FONT></TD></TR> </TABLE>
</TD>
</TR>
</TABLE>

Jona
09-18-2003, 01:38 PM
Man, it's so much easier with a database... Do you even have one? If you do, are you sure you don't want to use it? :p (Not to discourage your already made choice, but just wondering. :D)

[J]ona

spykemitchell
09-18-2003, 01:44 PM
I dont actually have any webspace at the moment and i don't know how to install a MySQL database into abyss... I like what iahve done but if you think it will be too difficult to keep alon this line then i may have to change...

Jona
09-18-2003, 02:03 PM
Not too difficult--just thought it would be easier if you had one. That's all.

[J]ona

spykemitchell
09-18-2003, 02:08 PM
If it's not that difficult could you please explain it to me?

I could show you the script i have allready done and see if you could edit it to do the thing i want it to?

It's a massive script so i could email you it. It is way to big to put in one of these forum messages....

Jona
09-18-2003, 02:12 PM
No, that's all right. It's kind of a multiple-file matter, to me anyways. What I normally do is make an /inc/ folder and include my funtions, headers, and footers in there, that way the only basic thing that's in my "visible" pages's source code is code, and just about only code. (If you caught all that, basically I just use more than one file to call from each file so I don't have to do main things that I'll need for basically every page, and thus I can edit the headers.php file in the inc/ folder and it will update all of the pages.)

[J]ona

spykemitchell
09-18-2003, 02:17 PM
I didn't understand that...

Like i said, i'm not very good at PHP and files thats why i'm not using a MySQL database....

I really need you to explain what i need to do in a language i understand...

Sorry i am too much of a dumbass....

Jona
09-18-2003, 02:36 PM
Ha, no one is perfect. ;)

Okay, let's get to a little coding... Hmm, this will be an intereseting process. Since you'll be using static files, rather than a database. I've never done this without a database... How do you plan to go about naming the .dat and PHP files? Random numbers (10 characters in length)? The PHP file would have to be named the same as the .dat file, so each PHP file would have to search for itself and replace the .php extension with .dat to select which .dat file will be read. Then, once that is decided, we'll need to write to the file the person's post, and delimit it with some character (preferably a combination, and keep the text in quotes). Then we'll parse it when it's displayed.

Sound good? I'll use this basic logic to see if I can come up with something, then I'll let you know what I come up with... As long as you're willing to learn along with me. :p

[J]ona

spykemitchell
09-18-2003, 03:07 PM
Sounds great!!!!!!!

I understand that they need to be named the same and numbers is robably the best bet, I'll attatch the script and you can look at it and see if there is anyway i can do it....

I really want to learn PHP and this script is just one i found and edited a bit...

I will have to go for tonight but i hope to continue the lesson tomorow! :p

Thankyou for offering to help!

Spyke.

spykemitchell
09-18-2003, 03:11 PM
Worked it out... Phew this is hard...

Jona
09-18-2003, 03:12 PM
I'll work on it, and fill you in tomorrow. It actually looks like it won't be that hard. I'm kind of almost done with the post page. :p

[J]ona

Jona
09-18-2003, 07:13 PM
I've done the programming, you could probably figure the rest out, but you better be pleased with it. :D Let me know if there's anything you'd like me to add to it (excluding banning capabilities, since there is no registration). I've limited the total amount of posts to 200.

http://cmm.sonoracabinets.com/dat_forum/

[J]ona

spykemitchell
09-19-2003, 11:15 AM
Oh my god thats amazing!!!

Is there anyway to name the threads other than Thread 1 / Thread 2 etc...

I though it might be possible to call it from the script in which the posts are held?

Thankyou for helping!!!!

Also could you please post a .Zip file with all the required files and scripts in it then i can download + Customise it!!!!

Spyke.

Jona
09-19-2003, 11:19 AM
Don't thank me yet, I haven't decided on how many hundreds of dollars I am going to charge you for this...

lol, no I'm just kidding. It's free, ha ha. :p I bet I had you goin', eh? :D

All right, seriously though, what I have for the main page where it shows the posts is just a for() loop. I'll have to code it to show the subjects for it to say that in the title... So it will take a little more work, but it shouldn't be too difficult.

By the way, HTML is allowed on it, so people can screw up the "non-database forum" by posting <!-- or something in their posts. Also, the ' and " characters turn into \' and \" because I didn't do any formatting on the way that anything looks, lol. I'll fix it up to be much better in the future, however, and probably reply to this post with the updates...

[J]ona

spykemitchell
09-19-2003, 11:33 AM
Great...

Is there any way to stop the HTML coding like <!--comment-->
because people will seriously mess it up if i cant stop that...

I saw a script which can be assigned to text areas to ban certain characters so i could try banning the < character so people wouldn't be able to code any html...

what do you think???

I saw it in javascript, i don't know if it can be converted into PHP?

Spyke.

Jona
09-19-2003, 11:41 AM
Yes, it can be fixed in PHP. This will come in the next version. As I said, those updates will be posted in this thread. I've attached version 1.0 of the script, and will work on it more later on today (for me, it is quite early--near lunch time). A few updates will be: to disable HTML, PHP, etc., to "pretty it up" so that it looks nicer, to set up UBB code, to set up smileys, to make all CSS external so that one can edit a single CSS file and it will update all pages.

[J]ona

spykemitchell
09-19-2003, 11:54 AM
Bloody hell, i must have inspired you or something!

You must love PHP... :p

Thankyou for doing all this for me, It's brilliant!!!

Enjoy your lunch!

Jona
09-19-2003, 11:56 AM
Ha ha, yes I enjoy it very much! :) In about two hours I'll come back on here and do some more work on it. Glad to be of help. :)

[J]ona

spykemitchell
09-19-2003, 11:59 AM
By the way in the zip file there were'nt any .dat files, do i need to create those myself????

Spyke.

Jona
09-19-2003, 12:00 PM
Nope, the server automatically creates them on its own, if the file doesn't exist.

[J]ona

spykemitchell
09-19-2003, 12:05 PM
Oh, it doesn't seem to work when i tried it, I have PHP installed and all (went through all that with Pyro) but i get messages at the top like

Notice: Undefined index: starat in C:\Program Files\Abyss Web Server\htdocs\forum\index.php on line 2

Notice: Undefined index: endat in C:\Program Files\Abyss Web Server\htdocs\forum\index.php on line 3

On the index page and

Notice: Undefined index: action in C:\Program Files\Abyss Web Server\htdocs\forum\post.php on line 2

on the add thread page with no submit button and in the text area

</text></p>
<p><input type="submit" value=" Post! "></p>
</div></form>
</body>
</html>

I sorted the text area one but i don't see why i am getting the error messages at the top?

pyro
09-19-2003, 12:09 PM
On index.php, change this:

<?php
$startat = $_GET["starat"];
$limit = $_GET["endat"];
if(!isset($starat)){ $startat = 1; }
if(!isset($limit)){ $limit = 10; }
?>to:

<?php
if(!isset($_GET["starat"])) {
$startat = 1;
}
else {
$startat = $_GET["starat"];
}
if(!isset($_GET["endat"])) {
$limit = 10;
}
else {
$limit = $_GET["endat"];
}
?>Note that other pages have this same problem...

spykemitchell
09-19-2003, 12:31 PM
Thankyou for that Pyro, I have changed all of the files and i am now customising the look.

I now have a bit of an HTML question but it is only quick so i will post it here,

On my original table layout (see above) i used colspans to get the layout i wanted, when i try to use them on the index, reply and so forth Jona wrote they refuse to work? any reason why or is it me being a bit short sighted and missing the obvious mistake?

pyro
09-19-2003, 12:37 PM
I'd be curious what "they refuse to work" is supposed to mean... They must have been programmed wrong, if it doesn't work.

spykemitchell
09-19-2003, 12:44 PM
Yeah, hangon, i will post a zip file with 2 html documets in them, one with jona's layout, one with mine and you can compare (I will have taken them both from the view source of our PHP documents...

pyro
09-19-2003, 12:47 PM
They look quite similar to me... The only real difference is with the borders, and the fact that your has an extra row on the bottom.

spykemitchell
09-19-2003, 01:07 PM
Yeah i can add an extra row but the borders are weird and i can't work out how to make them look the same as mine?

pyro
09-19-2003, 01:21 PM
You'll just need to use something like this:

<style type="text/css">
table {
border-collapse: collapse;
}
td {
border: 1px solid #f60;
}
</style>
</head>
<body>
<table>
<tr>
<td>test 1</td>
<td>test 2</td>
</tr>
<tr>
<td>test 3</td>
<td>test 4</td>
</tr>
</table>

Jona
09-19-2003, 01:22 PM
I used CSS, rather than HTML attributes for the tables.

Also, the problem with the startat and endat stuff worked for me, so perhaps you have a differnet version of PHP or something?

[J]ona

spykemitchell
09-19-2003, 01:32 PM
Ah.. CSS, i never got round to learning it when i started this project so now i am turning all my formatting into CSS (44 pages) bugger :mad:

Yeah i must have an older version of PHP, i downloaded mine from php.net though?

Jona
09-19-2003, 01:36 PM
I have PHP running on a server (online), so I don't know if it really is the version difference or not... Just thought that may be the problem, but I could be wrong. Apparently you're running this off of your local hard drive, rather than off of a server... I never set up the filesystem for the server on my computer, so I can't do any of that stuff on the local disk. :p (Yes, I am too lazy... I figure, when you have a server online, why bother? lol.)

[J]ona

spykemitchell
09-19-2003, 01:47 PM
I prefer to cobble my site all together before uploading it to the server rather than having the works "UNDER CONSTRUCTION" across my site but maybe yours is all finished, i don't know...

Jona
09-19-2003, 01:48 PM
It's finished, all right! (http://cmm.sonoracabinets.com/) ;)

[J]ona

spykemitchell
09-19-2003, 02:30 PM
Wow can you email me it in a zip file?

My email addy is darkstarskateboarder@hotmail.com

Also i had another idea, in the threads page there is a number down the left hand side, could i do the same with the message screen (reply.php) but make it so that text can be put in there instead of a number and have HTML enabled???

I don't know if this is possible and you have done loads for me allready so you don't have to do it but i thought it would be quite cool!!

Spyke.

Jona
09-19-2003, 02:32 PM
I don't fully understand your last request, but if you look at it online, you'll see that I've updated it quite a bit.

[J]ona

pyro
09-19-2003, 03:06 PM
I could be mistaken, but it looks like you were having a bit of trouble with the slashes... It's quite easy with stripslashes() (http://www.php.net/stripslashes). ;)

Jona
09-19-2003, 03:09 PM
Yah, I know... I kind of realized that after I used str_replace(), though. :p No need to change it, is there?

[J]ona

spykemitchell
09-19-2003, 03:09 PM
Thats great,

What i meant was, on the index.php screen there is a column headed post#. would it be possible to put that column in the posts section (read.php) but make i writable to like the left hand column in read.php where text can be placed just like the comments column?

I hope that made sense, this on html should be allowed in though. I have a plan that want to see if i can make work but i need that column to be customisable.....

i hope you understand now,




-Post #-Comments... ----------Post By...-
l--------l------------------------l------------l
l-1------l-Hello------------------l--Spyke---l
l--------l------------------------l------------l
l--------l------------------------l------------l
l--------l------------------------l------------l
l--------l------------------------l------------l
l--------l------------------------l------------l
l--------l------------------------l------------l
l--------l------------------------l------------l
^
l
This column can be edited like the comments column.

Jona
09-19-2003, 03:15 PM
Uhhhhh... Not really. :rolleyes:

(C'mon, give aggies a break! lol.)

[J]ona

spykemitchell
09-19-2003, 03:19 PM
Ok, sorry, i could probably do it myself but i will more than likely mess it up...

If you open the dat_forum you see 4 columns, Post # , Subject, Replies, Posted By Yes?

Then when a thread is clicked you get, 2 columns, Comments and posted by. I now want to create 3 columns,

(New column, Comments, Posted by in that order)

In this new column i want to make it editable like the comments but with Html code enabled? Ce'st Possible Non??

Can it be done?

Spyke.

Jona
09-19-2003, 03:20 PM
I think I understand now, but what would you need that for?

[J]ona

spykemitchell
09-19-2003, 03:28 PM
well i intend to turn it into a sort of avatar menu where you can pick an image from a drop down menu and can place it into the column but it will be a little more advanced than that....

Jona
09-19-2003, 03:34 PM
Originally posted by spykemitchell
well i intend to turn it into a sort of avatar menu where you can pick an image from a drop down menu and can place it into the column but it will be a little more advanced than that....

That would require either cookies or a login device...

[J]ona

spykemitchell
09-19-2003, 03:40 PM
Thats not what i mean, it is basically a drop down menu from which anyone visiting can choose an image to go with their post. sorry, i didn't really mean an avatar, if you look at the threads list of this forum you will see that on the far left there are pictures telling you wheter it is an anouncement, full, new etc...

I intend to do that sort of thing but slightly less complicated...

Jona
09-19-2003, 03:42 PM
Oh, I see. Yes, that is possible...

[J]ona

spykemitchell
09-19-2003, 03:56 PM
Great, Can you post the files for me to download please?

I have made some changes to the old design you did but it isn't quite as good as your re-make....

I played with the stripslashes() function like Pyro said and almost got it to work... Oh well...

pyro
09-19-2003, 04:06 PM
Originally posted by Jona
No need to change it, is there?I would. It will be more reliable. For instance, did you test you str_replace() on a windows server? When working with slashes (or better, backslashes), it is usually different on a windows server than it is on a *nix server.

Jona
09-19-2003, 04:59 PM
...At which time I will use stripslashes(). :D

[J]ona

spykemitchell
09-19-2003, 05:53 PM
I am going to have to go soon so if you cant post it tonight then i will be online tomorow...

spykemitchell
09-19-2003, 05:59 PM
Did you know that when you click the post reply you get the following error...
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/justin/public_html/cmm/dat_forum/reply.php on line 3
Everything except that seems to work...

Jona
09-19-2003, 07:07 PM
Ah yes, that was disabled while I ate dinner. :D It's fixed now, and the forum now only lacks validation and UBB code. (You do want UBB code, like this forum, correct?)

By the way, could you edit your post so that the code isn't in the UBB code tags? It stretches the page... :rolleyes:

[J]ona

spykemitchell
09-20-2003, 05:32 AM
What's UBB Code? Like Smiles and Url links etc...

spykemitchell
09-20-2003, 05:35 AM
I though you would be able to add images to any post (even replys)

:D :p

Jona
09-20-2003, 11:44 AM
UBB code is Ultimate Bulletin Board Code and is the most commonly used hybrid of HTML. This forum uses UBBC (that's how I have font=arial, color=maroon) and etcetera.

Um, if each reply could have a different image, it would take too much bandwidth for my server (already has two sites on it, and this forum, and I'm programming another forum, and it may have another site on it soon--which I will need to move off of the server). I don't really think it necessary to have images for each reply, since there are only two. :p

[J]ona

spykemitchell
09-20-2003, 11:57 AM
If you could help me to do it myself then, i don't mind it going on my server and i intend to use more than 2 images andit is quite important to do this for the site i am making.

I will show you it when it is finished, that is just the last thing i want to do. I'm not to bothered about UBB Code.

Spyke.

Jona
09-20-2003, 11:59 AM
Well, if that's the last thing you want, I'll work on it when I get the time. :)

[J]ona

spykemitchell
09-20-2003, 12:13 PM
Thanks, your the best...

I know i used the depreciated font tag which i shouldn't have in my style post but i though i did a good job saying i only learnt it yesterday...

:p

Jona
09-20-2003, 12:18 PM
Yes, truly not bad for one day of learning, as you say. :)

I've completed it, and will attach a .zip file soon... You can look at it online to see. :)

[J]ona

spykemitchell
09-20-2003, 12:21 PM
Thankyou, i have looked at it and added my post!

Yes, great, post the zip file soon or sendit to me through PM or email or whatever.

I'm not really fussed.

By the way, i tried to redeem my self on the Style post after Pyro's abuse! ;)

Jona
09-20-2003, 12:24 PM
Well, pyro (as many others, myself and AdamBrill included), used to not be such a "validationist." None of us really knew what "valid HTML" was (from what I understand, anyway), and we totally had screwed code. :p But, thanks to Charles (mainly, but there were others like Robert Wellock and Niket that helped out a great deal), we've all learned something new, important, and vital. :)

It will take a second for me to setup the .zip file... I'll post it here as an attachment when it's done, though.

[J]ona

Jona
09-20-2003, 12:37 PM
I hope you're happy! :D

[J]ona

spykemitchell
09-20-2003, 01:04 PM
Yes Thats Excellent Thank you...

5 Pages! We did allright with this post didn't we!

Spyke.

Jona
09-20-2003, 01:09 PM
I'd like to ask something of you, if I may. Could you put a link or something at the bottom of the main page of the forum, linking to CMM? Something like, Powered by: CMM (and make it link to http://cmm.sonoracabinets.com/). If you'd like, you can use the banner on the main page of http://markandkelly.bravepages.com/

Thanks.

[J]ona

spykemitchell
09-20-2003, 01:14 PM
Yeah i'll put a link, sure...

On the page i have a credits section aswell, i'll mention it in that ...

Just though i would point out an error aswell, When you reply to a thread you get the following message in the Picture column,

Notice: Undefined offset: 3 in C:\Program Files\Abyss Web Server\htdocs\forum\read.php on line 41

Notice: Undefined offset: 3 in C:\Program Files\Abyss Web Server\htdocs\forum\read.php on line 42

This may be one of those things to do with having different versions of PHP,

Pyro sorted it last time PYRO! WHERE ARE YOU?

Just though i would mention it...

Jona
09-20-2003, 01:24 PM
Hmm, that would have to do with the array's third value... If have an if statement in there to check if it exists, so you shouldn't be getting any notices.

[J]ona

spykemitchell
09-20-2003, 01:27 PM
If have an if statement in there to check if it exists, so you shouldn't be getting any notices

Erm... Help!

I'm confused again...

Jona
09-20-2003, 01:32 PM
Hmm, well, I'll see what I can do... I'll post any suggestions...

[J]ona

spykemitchell
09-20-2003, 01:40 PM
Sorry i'm not very good at php. I'm trying to learn from the scripts you have done.

Thankyou.

Jona
09-20-2003, 01:57 PM
Try using this:


if(isset($realReply[3])){
echo("<img src=\"$realReply[3]\">");
}
if(isset($realReply[2]) && !isset($realReply[3])){
echo("<img src=\"$realReply[2]\">");
}


Instead of this...


if($realReply[3]){
echo("<img src=\"$realReply[3]\">");
}
if($realReply[2] && !$realReply[3]){
echo("<img src=\"$realReply[2]\">");
}


[J]ona

spykemitchell
09-20-2003, 02:03 PM
Worked! Thanks... Sorry tookso long to reply, i have been customising it.

How can i customise the reply screen, i have customised the postscreen to how i want but i can't find the code that displays the form in reply.php

I hope you know what i mean....

spykemitchell
09-20-2003, 02:13 PM
Oh hang on, Dopey me is looking at the wrong part of the script...

What a dumbass... :) :p

Jona
09-20-2003, 02:16 PM
To customize reply.php's form, you can edit the first HTML code you see...

Don't worry about replying after twenty minutes from my last reply, I do it all the time. (See?) :D

[J]ona

spykemitchell
09-20-2003, 04:04 PM
I don't know if you are still around but when you managed to ban certain characters e.g \ and < > etc. is there anyway i can ban certain words from the name and comments fields?

Spyke.

Jona
09-20-2003, 04:43 PM
You mean word censoring? Would you like to replace a bad word with a different word, or display an error saying that there should be no cussing in the posts?

[J]ona

spykemitchell
09-20-2003, 04:48 PM
The no Cursin screen so if you type in an illegal word it will echo() something like, You have typed an illegal word or whatever and return you to the reply / post screen (with all the fields cleared).

I also want to do it in the name field aswell as the comments field so i can ban words like, Administrator and Moderator etc...

Spyke.

Jona
09-20-2003, 04:50 PM
Erm, right... I'll get to work on it...

[J]ona

spykemitchell
09-20-2003, 04:50 PM
Oh... Thanks... That was the fastest reply yet!

spykemitchell
09-21-2003, 03:14 PM
Could you post the file with the word censorship for me to download please Jona!

The forum is w00t!

Jona
09-21-2003, 06:02 PM
Teh fourm is teh rullz0rs. ;)

I'll upload version 1.3 once I reverse the posting direction (new posts on top, rather than on bottom). It will take a bit more code, so I probably won't have it done until Monday. Sorry, I'm not able to be on much on Sundays.

[J]ona

spykemitchell
09-22-2003, 11:42 AM
I know what you mean....

Uhhhhhhhh.................

Pwnage Foervre!

Jona
09-22-2003, 11:46 AM
Also, just so you're aware of the times that I'm online... Monday through Saturday from 2pm CST to 11pm CST (and a lot of times 'til 1am CST). Yes, school takes all day up until 2pm. :( Ah well, from 6am to 2pm, I do school.

[J]ona

pyro
09-22-2003, 11:49 AM
Umm... It's 11:50 AM CST right now... :p

spykemitchell
09-22-2003, 11:59 AM
6.00 AM To 2 PM?

I do it from 8.30 to 4.00! Why does your start so early???

Jona
09-22-2003, 12:07 PM
Originally posted by pyro
Umm... It's 11:50 AM CST right now... :p

Well, um, that's 'cause... Uhh... Don't tell anyone, but I finish my classes and homework early, but my last class starts after lunch. :D

My school starts and ends early 'cause I'm lucky. I mean, I'm homeschooled. ;)

[J]ona

spykemitchell
09-22-2003, 12:09 PM
Oh...

How old are you then?

Going a bit off the subject here....

Jona
09-22-2003, 12:20 PM
Yes, we don't need to go off-topic... PM me if you wish... I'm fourteen.

[J]ona

spykemitchell
09-22-2003, 03:28 PM
Have you got any further with the forum yet?

Jona
09-22-2003, 04:34 PM
Originally posted by spykemitchell
Have you got any further with the forum yet?

Take a look at it. ;) You tell me.

[J]ona

Jona
09-22-2003, 04:58 PM
Is there anything else you "need" or want before I prepare to upload version 1.4? :D

[J]ona

spykemitchell
09-23-2003, 11:02 AM
Is it easy to customise te banned words list and can i turn off certain parts of the UBB code???

Jona
09-23-2003, 11:15 AM
Uhhh... Now you want me to write a whole PHP-library for UBB, eh? lol. You can edit the word list in the array $badWords. You must have at least a small amount of knowledge of Regular Expressions to edit them, however, since you will get a parse error if you make a mistake.

[J]ona

spykemitchell
09-23-2003, 11:26 AM
What do you mean small knowledge? I just want to turn off images in UBB code, I dont mind font colours and Urls...

I love your new Avatar BTW...

Jona
09-23-2003, 11:29 AM
Ah yes, the avatar is the Oystinator. :D

Now you want me to disable images?! Okay, look, come up with a list of all of the UBB code that you want, and then post it.

[J]ona

spykemitchell
09-23-2003, 11:31 AM
On hotscriptsa i saw a script that will let you edit UBB code...

Hot Scripts UBB Replacer (http://www.hotscripts.com/Detailed/9462.html)

Is this the sort of thing you used or have you done it another way?

Do you think i could use this script with the forum (me personally, set it up myself and everything)?

spykemitchell
09-23-2003, 11:34 AM
I also read that it is as easy as putting,

$output = str_replace("",'<b>',$output);
$output = str_replace("",'</b>',$output);
$output = str_replace("",'<i>',$output);
$output = str_replace("",'</i>',$output);
$output = str_replace("",'<img src=\"',$output);
$output = str_replace("",'\">',$output);

In the correct places, If so i'm sure i would be able to edit it, In the zip file maybe you could put some quidelines for me so i could try it my self,

Who is the Oystinator?

pyro
09-23-2003, 11:39 AM
That code might be enough, if you want a very lame UBB code parser... For instance, it will allow you to open a [b] tag and not close it, thus making a whole lot more than what you wanted to turn bold...

Jona
09-23-2003, 11:39 AM
No, I have not used or copied scripts from anywhere--I did all of this from scratch.

You could possibly edit the script to get UBB to work, if you think you can. The code you posted is similar to the code I have in the forum, but I only have images enabled.

[J]ona

spykemitchell
09-23-2003, 11:42 AM
Oh, if you comment the section where the images are turned on i'm sure i could do it myself...

pyro
09-23-2003, 11:42 AM
I did look at it (via hitting the quote button) and what I said above still hold true...

Jona
09-23-2003, 11:42 AM
I understand what it's "supposed" to look like, and you actually can post the actual code (for example [b] and [/b]).

By the way, I dunno who the Oystinator is...

[J]ona

spykemitchell
09-23-2003, 11:43 AM
What's wrong with it then?

Jona
09-23-2003, 11:45 AM
Originally posted by spykemitchell
What's wrong with it then?

If you put <b> in a Web page, and never end it with </b>, it will end up making everything on the page after the <b> to be bold.

[J]ona

pyro
09-23-2003, 11:45 AM
To use brackets in your post, just type &amp;#91; for [ and &amp;#93; for ] (doesn't work within PHP code blocks)

spykemitchell
09-23-2003, 11:49 AM
I know that about <b> tags and so forth, i'm not stupid.

So what you are saying is that if the poster doesn't close the bracket then it will make the whole page bold???

How can i resolve this?

How have you done it Jona?

pyro
09-23-2003, 11:52 AM
You just need to use a regexp to make sure there is a closing [/b] tag, and if not, don't turn it to bold.

Jona
09-23-2003, 11:55 AM
Originally posted by spykemitchell
How can i resolve this?

How have you done it Jona?

As pyro said (basically), Regular Expressions are the answer to all of your problems!

I haven't done it yet, because I still need that list of the UBB you want enabled.

[J]ona

spykemitchell
09-23-2003, 12:01 PM
Can you just set up the regularexpressions bit and tell me how to do it myself because it's the only way i will learn and belive me i really do want to!

:)

pyro
09-23-2003, 12:03 PM
You could also read up on it yourself: http://us4.php.net/pcre

spykemitchell
09-23-2003, 12:04 PM
By the way someone called nevermore has messed up your forum and tried to post what looks like a link to a porn pic...

Seriously messed up the way it functions in a thread...

Jona
09-23-2003, 12:11 PM
Already time for a trim() and a ban, it looks like... hehe

[J]ona

spykemitchell
09-23-2003, 12:12 PM
good idea...

Jona
09-23-2003, 12:15 PM
Hmm, looks like I'll need to do a bit of work for a ban-ability... I'll work on it when I get back from my last school class. :D I fixed the anonymous posting, though. (Forgot to trim() the posts before validating, lol.)

[J]ona

Nevermore
09-23-2003, 12:16 PM
That was (partially) me... although not the porn part, that was my friend. Who is now in pain. And I'm only doing it to show you a problem that needs fixing:

You can post anonymously.

Jona
09-23-2003, 12:16 PM
I fixed it, thanks for reminding me. :p

[J]ona

Nevermore
09-23-2003, 12:17 PM
Sorry about mucking things up btw, I know how annoying it is. If you don't mind the intrusion I would like to help you fix it.

Jona
09-23-2003, 12:19 PM
Originally posted by cijori
Sorry about mucking things up btw, I know how annoying it is. If you don't mind the intrusion I would like to help you fix it.

It's no problem. You can do whatever you like--just don't cut me short on bandwidth! :p

Peeshie out, I'll be back in a few hours...

[J]ona

spykemitchell
09-23-2003, 12:25 PM
She didn't fix it as well as you may have hoped...

how were you posting anonymously, with a space in the post?

spykemitchell
09-23-2003, 12:28 PM
Are you intending on Ban and Deleting Capabilities Jona?

Nevermore
09-23-2003, 12:29 PM
Here's the problem: The way you are singling out replies is with the [REPLY] tag in the message.

pyro
09-23-2003, 12:39 PM
Also, you currently just replace | with nothing... What if I want to use a pipe in my message?

spykemitchell
09-23-2003, 12:43 PM
Yeah i figured that out nbt long ago...

Also if you create an external document with the same form as in the post.php you vcan do allsorts with it... Not good.

Check out the Google Post...

Jona
09-23-2003, 01:30 PM
Thanks guys, I'll fix both of those...

Spyke, I may decide to have banning capabilities, but perhaps not...

[J]ona

spykemitchell
09-23-2003, 02:17 PM
Perhaps Not Why?

Too difficult?

Jona
09-23-2003, 02:28 PM
Originally posted by spykemitchell
Perhaps Not Why? Too difficult?

It's a lot of work... Not too difficult, but it's a whole 'nother script to write...

Cirjori, Adam, Pyro, give it your best shot now (as far as replies go). I think I've got it fixed. You can even try your little "new input" JavaScript hack if you like--it didn't work when I tested it. :p

Let me know when and if you find something--just don't screw around with new posts, 'cause I haven't even started on those yet... (Well, a little but not much.)

[J]ona

spykemitchell
09-23-2003, 02:30 PM
Oi!

It was my new input javascript hack and i made it work...

Jona
09-23-2003, 02:33 PM
I've made it so that you can put anything you want as your avatar--but you can't mess up the page.

[J]ona

spykemitchell
09-23-2003, 02:34 PM
How do you stop people doing that and expanding the table,

that's the challenge...

Jona
09-23-2003, 02:36 PM
I left it that way on purpose, I said. If it stretches the page, well... you have a point there. o_O What do you want to do? Make it so that only the two selections can be chosen?

[J]ona

spykemitchell
09-23-2003, 02:38 PM
Well yeah, if you can make it so that only the entrys in the drop down menu can be used then that would be great...

If they do put in one not like that it should just tkae them back to the compose new message script...

spykemitchell
09-23-2003, 02:46 PM
Erm...

Dont mean to be rude but evey message you post says custom avatars are disabled...

Jona
09-23-2003, 02:47 PM
I'm working on it, but I have to go...

[J]ona

spykemitchell
09-23-2003, 02:53 PM
Ok fine then....

BTW my Avatar hack worked on the post new thread bit...

Sorry about that...

Also i think i have found a way to remotely delete threads...

I'll keep shtum at the moment though...

Nevermore
09-23-2003, 04:05 PM
1) Blocking by IP isn't hard. If you want to do it I can do the script. On my site I just log every user that views the pages along with what they do, then you can ban by ip.
2) To stop custom avatars mucking up the pages, how about just making them a fixed size?

Jona
09-23-2003, 04:26 PM
Cirjori, I know how to ban people via IPs, lol. (AOL and CompuServe users though, when banned, cause other users of that ISP to be banned as well, because of the system they use.) I will do it some other time, though. About the avatar, I had thought about that, but Spyke said he wanted it so that only the selected avatars would work...

Spyke, I said in my previous reply that I had not worked out any bugs in the new post script.

[J]ona

Nevermore
09-23-2003, 04:29 PM
It is possible to get the internal ips of the machines about 80% of the time.

Jona
09-23-2003, 04:30 PM
Cool. How much do you know about it?

[J]ona

AdamBrill
09-23-2003, 04:39 PM
Originally posted by cijori
It is possible to get the internal ips of the machines about 80% of the time. However, if I'm not mistaken, the internal IPs are almost always dynamic, which would defeat the purpose of banning the IP... ;)

Jona
09-23-2003, 04:43 PM
Well, my little brothers are forcing me to play video games so they can watch, so I have to go for a few... I think I fixed the new posts, but I may have missed something. Test it, please. :)

I'll work on banning later.

[J]ona

Nevermore
09-24-2003, 01:07 AM
As I understood it, internal IPs are always fixed, and it's the external ip that can be changed.

Well, my little brothers are forcing me to play video games so they can watch

Sounds terrible...:D

spykemitchell
09-24-2003, 11:07 AM
Been busy haven't we...

The deleting thing i haven't got to work yet but i have managed to find out that the .dat files are possible to delete remotely. Is there any way they could be put in a password protected database that requires the person deleting the posts to put in a password?

That's a w00t idea... Deleting posts by the administrator... Probably be quite difficult though to make it secure...

I dunno, what do you think...

Nevermore
09-24-2003, 11:16 AM
Put them in another directory and chmod it to 333 (I think) and then use another script to get the info from the .dat files.

spykemitchell
09-24-2003, 11:29 AM
i don't know much about chmod but i belive that is a good idea...

Nevermore
09-24-2003, 11:31 AM
If I've got the number right then that would let scripts access the files but not users.

spykemitchell
09-24-2003, 11:45 AM
What if the user creates a script to do this?

This is why i want to do things like disable right click etc...

AdamBrill
09-24-2003, 11:49 AM
Originally posted by spykemitchell
This is why i want to do things like disable right click etc... I just thought I would point out that disabling the right click would not help with ANYTHING. It doesn't help with security, it doesn't help to hide the source, and it doesn't help save your images. Overall, it is a pain for the users and it doesn't help anything anyway...

Nevermore
09-24-2003, 11:58 AM
The script will have to be on your server to have access.

AdamBrill
09-24-2003, 12:32 PM
Actually, the best solution for this problem would be to put the files below the document root. That way you can't access them with anything except the script on your server. Just chmoding isn't enough to keep an experience hacker from doing damage...

Nevermore
09-24-2003, 12:54 PM
How can anyone access the files without a fault in your script - which would allow access to the files wherever they are.

Jona
09-24-2003, 01:07 PM
I've been hard at sleep--not at work. :p

First of all, would someone please point out the "exact" procedure of which to use to remove the .dat files? I have created no deletion function. The only way I've removed any of the files is by manually removing them--no coding was involved...

[J]ona

Nevermore
09-24-2003, 01:15 PM
<?php
$filename=$_POST['file'];
$password=$_POST['pass'];
if($password=="hi") {
unlink($filename) or die("Could not delete that file. Check the filename.");
}
else echo "Incorrect Password";
?>

spykemitchell
09-24-2003, 01:16 PM
I haven't exactly figured out how to do it but i belive it is possible through the original script i posted for you just by specifying the Url of the .dat file...

(see first page for attatchment)

Yeah, i was reading up on the chmod thing and that seemed to be a good idea...

Can you do that??

Nevermore
09-24-2003, 01:18 PM
Oh, and I forgot to mention you need t chmod the files to a value that gives scripts access to delete them with a script.

Jona
09-24-2003, 01:18 PM
Cirjori, I know how to set up a password script, but I was wondering how one would remove a .dat file from the server without access to the actual files. Could you explain that?

Yes, spykemitchell, I can CHMOD files.

[J]ona

spykemitchell
09-24-2003, 01:35 PM
i didn't mean chmod files, realise that even i can do that and i am a idiot...

I meant ca you delete them from the server with a script, maybe i should have made that clearer...

"spykemitchell" <- THATS MY NAME! NOT MY USERNAME! REALLY IT IS! MY REAL NAME ISN'T SPYKE, NO IT IS spykemitchell!

Jona
09-24-2003, 01:38 PM
Originally posted by spykemitchell
I meant ca you delete them from the server with a script, maybe i should have made that clearer...

Originally posted by Jona (me!)
I know how to set up a password script...

That implied (or at least was supposed to imply) removing the files as well...

[J]ona

spykemitchell
09-24-2003, 01:42 PM
what was?

you've lost me now...

Jona
09-24-2003, 01:45 PM
I meant I knew how to make a password/login script and how to delete files in PHP, and how to CHMOD them.

[J]ona

spykemitchell
09-24-2003, 01:51 PM
oh i see...

Nevermore
09-25-2003, 11:06 AM
Originally posted by Jona
Cirjori, I know how to set up a password script, but I was wondering how one would remove a .dat file from the server without access to the actual files. Could you explain that?
Originally posted by Jona
I meant I knew how to make a password/login script and how to delete files in PHP, and how to CHMOD them.


So what did you want help with?

Jona
09-25-2003, 11:53 AM
It was mentioned that someone (without access to the server files) could remove files from that folder on the server by using this "forum." How, then, would they do that, and how do you suggest I fix it?

[J]ona

AdamBrill
09-25-2003, 12:03 PM
Jona, you could one of two things:

1. Put the files in a password protected folder(protected with .htaccess) or

2. Put them below the document root directory.

That way no one will have access to the actual files(just in case they can find a way to delete them). And, if you want to, you could also chmod the files to only allow for server access, but I would just put them in a protected folder or below the document root...

Jona
09-25-2003, 12:08 PM
All right--new terminology here. "Below the document root" means what, exactly?

[J]ona

Nevermore
09-25-2003, 01:03 PM
In a directory higher than the current one. e.g. if your forum is in www/forum/ you might put the files in www/ or preferably even higher. However, although I do not know what the actual bug was, (you'll have to talk to spyke), if the bug was in the code, this won't make any difference.

spykemitchell
09-25-2003, 01:19 PM
It wasn't a bug in the code, i created a new php document based on other .dat deleting scripts and managed to access them but my computer crashed the other night and i lost a lotr of stuff so i can't test it.

I belive that putting it below the root directory will probably do it though as i just created a script to do it, not a bug in your script. Chmoding it may also be a good idea.

Jona
09-25-2003, 01:20 PM
Yes, I am not completely sure what spyke says could be the issue here, since I've fixed everything thus far, and no one has found any more security holes since yesterday (and I have fixed all of those).

I will, though, set up the .dat files in a secure folder, in case there are any possibly threats.

[J]ona

Jona
09-25-2003, 01:22 PM
Originally posted by spykemitchell
It wasn't a bug in the code, i created a new php document based on other .dat deleting scripts and managed to access them but my computer crashed the other night and i lost a lotr of stuff so i can't test it.

I belive that putting it below the root directory will probably do it though as i just created a script to do it, not a bug in your script. Chmoding it may also be a good idea.

Uhh...? :confused: Please explain more clearly, and post any script you have written which had done this, so that I may ensure that it will not happen (although I will set it in a secure folder, I still want to know what you did). I will be gone for about an hour, but will check back as soon as I can.
Thanks,

[J]ona

spykemitchell
09-25-2003, 01:27 PM
No, what you have done will be fine from what i can tell.

Sorry my posts aren't that specific, i'm tring to do about 10things at once. I can't post the script, like i said my computer died not long ago but i can tell you that i found out the deleting capabilities from a script called ardguest .dat guestbook. If you search that in google or whatever the script will come up and you will be able to see the deleting things...

Yeah. Are you going to do deleting and banning capabilities???

Nevermore
09-25-2003, 01:55 PM
I don't think the danger of people discovering your ftp password and uploading their own scripts is one you can really avoid.

spykemitchell
09-25-2003, 02:13 PM
Mmmm....

Thats what i thought. Yeah my script would only work if it was on the server. It would show the posts with the option to delete it but i couldn't.

Spyke.

Jona
09-25-2003, 02:20 PM
Very well, then. I will set up a login script with abilities to ban/delete messages, after I put the .dat files in a secure folder.

[J]ona

Jona
09-25-2003, 02:57 PM
I've put all of the .dat files in a new directory under the dat_forum directory and password-protected it (with something no one would ever guess). My script still works without having to use a password, though--do I need to edit the CHMOD still?

[J]ona

Nevermore
09-25-2003, 03:03 PM
You can't protect your files from your scripts. Anything you do to stop your scripts being used in an incorrect manner will stop them altogether.

Jona
09-25-2003, 03:16 PM
That's what I figured--so the question still remains: what do I do? :p

Sorry, I've never had a problem like this before, and believe it or not, I started PHP a few months ago, and haven't really even had much time to work on programming in it.

[J]ona

Jona
09-25-2003, 07:12 PM
Well, while awaiting a reply, I have made name and IP banning abilities, and have an IP and name log file, that records each username an IP has used... I set it up so that you can delete posts. Previously, however, if there were three posts, and I removed the first one, no posts would display. I have fixed that now, though. :)

Big improvement!

[J]ona

Nevermore
09-26-2003, 01:28 AM
Originally posted by Jona
[font=arial][color=maroon]That's what I figured--so the question still remains: what do I do? :p

Since people can only muck around with your files if their is a problem with your scripts, you just have to make sure there aren't any bugs to be exploited.


Woah, 12 pages...

Jona
09-26-2003, 10:49 AM
Meaning that we're cool until or unless someone finds something that could screw it up, right? I've set all of the files that are read from and written to in a different directory which is password protected, so I'm pretty sure we're all good now. :cool:

Twelve pages...?

[J]ona

AdamBrill
09-26-2003, 11:30 AM
Originally posted by Jona
Twelve pages...? ...is this thread's length. ;)

Jona
09-26-2003, 11:32 AM
I don't know where you people get the idea that it's twelve pages. We're on the fifth page...

Oh wait, I just remembered--I have my preferences show fourty posts per page. :p

[J]ona

Jona
09-26-2003, 11:34 AM
Also, just so all of ya know I posted the updates on this newer version in the forum itself. I also posted possible updates for the next version (1.5). Let me know if you come up with any other ideas... :)

[J]ona

AdamBrill
09-26-2003, 12:11 PM
Originally posted by Jona
Oh wait, I just remembered--I have my preferences show fourty posts per page. :p LOL, I do to. :p I just figured that must be what he meant... :D

Jona
09-26-2003, 12:15 PM
Uhhhhhhhhhhh.... Same here. :p

Now then, back to the topic... :rolleyes:
I'm attaching version 1.4 (where v1.2 and v1.3 came in, I have no clue, but this is the version after those non-existent ones. I guess I just never put the two previous versions in a .zip file! :eek: ), let me know what you peoplayzieashoi's people think...

[J]ona

spykemitchell
09-26-2003, 12:30 PM
Right, back from school, now gonna test out your new forum script...

Gimme a few mins...

spykemitchell
09-26-2003, 12:37 PM
First Problems....

When a new post is made the following errors occur...


Warning: filesize(): Stat failed for data/name_ban.dat (errno=2 - No such file or directory) in C:\Program Files\Abyss Web Server\htdocs\forum\post.php on line 82

Warning: fread(): supplied argument is not a valid stream resource in C:\Program Files\Abyss Web Server\htdocs\forum\post.php on line 82

Warning: fclose(): supplied argument is not a valid stream resource in C:\Program Files\Abyss Web Server\htdocs\forum\post.php on line 89

Warning: filesize(): Stat failed for data/ip_ban.dat (errno=2 - No such file or directory) in C:\Program Files\Abyss Web Server\htdocs\forum\post.php on line 92

Warning: fread(): supplied argument is not a valid stream resource in C:\Program Files\Abyss Web Server\htdocs\forum\post.php on line 92

Warning: fclose(): supplied argument is not a valid stream resource in C:\Program Files\Abyss Web Server\htdocs\forum\post.php on line 99

Warning: filesize(): Stat failed for data/ip_log.dat (errno=2 - No such file or directory) in C:\Program Files\Abyss Web Server\htdocs\forum\post.php on line 102

Warning: fread(): supplied argument is not a valid stream resource in C:\Program Files\Abyss Web Server\htdocs\forum\post.php on line 102

Warning: fwrite(): supplied argument is not a valid stream resource in C:\Program Files\Abyss Web Server\htdocs\forum\post.php on line 105

Warning: fclose(): supplied argument is not a valid stream resource in C:\Program Files\Abyss Web Server\htdocs\forum\post.php on line 108

Warning: fwrite(): supplied argument is not a valid stream resource in C:\Program Files\Abyss Web Server\htdocs\forum\post.php on line 121

Warning: fclose(): supplied argument is not a valid stream resource in C:\Program Files\Abyss Web Server\htdocs\forum\post.php on line 122

Thats A LOT!!!

I like the new colour scheme though (as if that matters). What would be the point of banning usernames?

It seems a bit of an odd thing to do seeing as people don't use a username in it... Does that seem odd to you or are you keeping secrets....

14 pages soon...
Over 1000 views

We are doing good!

Nevermore
09-26-2003, 12:51 PM
You could use it if someone is using a particular username offensively.

Jona
09-26-2003, 12:58 PM
Create a subfolder named data and CHMOD it to 700, then create the following new files:

ip_ban.dat
name_ban.dat
ip_log.dat


[J]ona

spykemitchell
09-26-2003, 01:18 PM
i dont have any webspace at the moment and i run all my scripts and websites off abyss personal server. Is there anyway i can use CHMOD's In Abyss?

Jona
09-26-2003, 01:38 PM
If you're only going to have it on our computer, and not have it accessible to the world (as long as your computer isn't a server itself), it isn't necessary to CHMOD the folder--but when you put it online, make sure you do.

[J]ona

spykemitchell
09-26-2003, 02:25 PM
Yeah, sorry, me being dumb again...

:(

Jona
09-26-2003, 02:29 PM
Originally posted by spykemitchell
Yeah, sorry, me being dumb again...

:(

Oh come on! Get real, man. It's not like we're worried about you being "dumb," which is actually not even true. It's just that you simply didn't understand something. No one is perfect, and no one expects you to be better than you possibly can be. We're here to help you out. Do you think that we've done all this just for ourselves? It's just human nature to hate to admit that you didn't know something or you were wrong--but it's known as humiliation. Chill out; I don't expect you to know more than you do know. I just expect you to be willing to learn, and you are, and have been learning. You asked the question, the post is yours, you can continue to ask questions, and we will help. :)

[J]ona

spykemitchell
09-26-2003, 02:41 PM
New error message....

In the read.php document, in a new replys avatar section the following errors are shown,

Notice: Undefined offset: 3 in C:\Program Files\Abyss Web Server\htdocs\forum\read.php on line 39

Notice: Undefined offset: 3 in C:\Program Files\Abyss Web Server\htdocs\forum\read.php on line 40

I think i know what is wrong but have no idea how to set it right...

:confused: :(

p.s. I actually was being dumb... I just wasn't thinking...

Brain is addled from playing guitar too loud!

Jona
09-26-2003, 02:51 PM
Uhhhh... o_O
Kicked in the pants! OK, where do ya get the error? (Where does it show up on the page?) And do the errors affect the rest of the page, or are they just there?

[J]ona

spykemitchell
09-26-2003, 03:06 PM
They are pretty much just there...

They are in the Avatar TD just above the image. When you choose an picture from the post new thread screen you don't get the message. Only when you select an image from the reply scree and post it do you get the messages...

Understand?

I really wasn't thinking when I was wondering how to CHMOD a local file?!? No, I'll accept it, I'm not dumb...



:p

Jona
09-26-2003, 03:20 PM
Reply? o_O You said you got the errors on read.php.

[J]ona

spykemitchell
09-26-2003, 03:36 PM
Yeah the errors are displayed on read.php but they are obviously caused by reply.php because there are no error messages in the icon field when you choose an icon with a new post...

Jona
09-26-2003, 04:23 PM
Hmm, well, it's hard to debug without looking at the code. Make sure you don't have any parse/syntax errors anywhere (like a missing quote or something). Have you changed any of the code?

[J]ona

spykemitchell
09-26-2003, 04:41 PM
I have a little but i have checked it andi don't think it will make any difference but i will post the code for read and reply and you can have a look...

spykemitchell
09-26-2003, 05:16 PM
BTW Your stopping of custom avatars is not working, i think we need something that will check that the image file is one specified in a list and if it isn't then it should make you go back or something like that...

I dunno... Its 10 past 11 at night here and i need some sleep...

Jona
09-26-2003, 05:34 PM
SPECIAL NOTE TO EVERYONE:

I am not going to be disabling the custom avatars!!!

I don't know how many times I've said that, but I hope you understood it that time. :rolleyes:

[J]ona

spykemitchell
09-26-2003, 05:42 PM
Right then.... Cleared that up...

Is it possible to disable them anyway? Can anyone help me with this because it is something i want to do and i Want to do it myself with a little help. Please someone help, i just want it for smileys tye things and not for people to put on great hulking stupid images that ruin the design of my page...

Jona
09-26-2003, 05:46 PM
It's already set up so that any image they use will be the proper size, even if the actual image is much larger...

In any case, what you would do is something like this, after the variable $icon = $_POST["icon"]; is declared...


$allowImgs = array("pwn_explosion_avatar.jpg", "flag.gif"); // images to allow

for($npx=0; $npx<=count($allowImgs); $npx++){
if($icon !== $allowImgs[$npx]){
echo("<p><b>Custom Avatars are Disabled</b></p>\n</body></html>");
exit;}
}


[J]ona

Jona
09-26-2003, 06:41 PM
Um, I don't know why you'd get that error. I didn't test the script, but it doesn't look like there should be anything wrong. I guess it's just your localhost again. :rolleyes: Hmm, well, it's probably actually in the reply.php file, since you added some JavaScript in there. Double check with that stuff--try taking it out, see what happens. That's probably affecting it, not sure, though.

[J]ona

spykemitchell
09-27-2003, 04:28 AM
I'VE BEEN LEARNING!!!!!

I fixed the problem all by myself, there were some brackets missing!

Yay Me! :D :p

Nevermore
09-27-2003, 04:31 AM
Nice one!

spykemitchell
09-27-2003, 05:24 AM
Can anyone see what is wrong with the block custom avatars script?

I've tried it and it blocks custom avatars but also blocks the specified safe images...

I've read it over and can't see what is really wrong with it but there is something...

Anyone think they know what it is???

Nevermore
09-27-2003, 07:49 AM
The problem is that the avatar would have to match all of the options specified for the avatars, when obviously it can only match one. Try this: (untested, but I'm confident...)



$allowImgs = array("pwn_explosion_avatar.jpg", "flag.gif"); // images to allow



for($npx=0; $npx<=count($allowImgs); $npx++){

if($icon == $allowImgs[$npx]){

$imgyes=true;

exit;}

}
if($imgyes!=true) echo("<p><b>Custom Avatars are Disabled</b></p>\n</body></html>");

spykemitchell
09-28-2003, 02:17 PM
Thanks, Haven't had time to test it because i have been away 4 the weekend but i will test it tomorow...

Thanks.

Nevermore
09-29-2003, 01:32 AM
Do you have UBB code working yet? If not, give me the name of the variable holding the body of the message when it's posted, and I'll write you some regular expressions.

Nevermore
09-29-2003, 01:42 AM
Oops, I left part of Jona's original script in their by accident.



$allowImgs = array("pwn_explosion_avatar.jpg", "flag.gif"); // images to allow







for($npx=0; $npx<=count($allowImgs); $npx++){



if($icon == $allowImgs[$npx]){



$imgyes=true;

}



}

if($imgyes!=true) {echo("<p><b>Custom Avatars are Disabled</b></p>\n</body></html>");
exit;}

spykemitchell
09-29-2003, 11:12 AM
Thankyou that would be great...

I'm no big shot at PHP as we have allready established so if you explain what you mean by the variable holding the main body of the message that would really help me learn.

spykemitchell
09-29-2003, 11:43 AM
Tested ad you didn't do too bad...

When you pick an avatar/image that is not specified as being "Good"

You get this message...


Notice: Undefined offset: 2 in C:\Program Files\Abyss Web Server\htdocs\forum\original v.4\post.php on line 77

Notice: Undefined variable: imgyes in C:\Program Files\Abyss Web Server\htdocs\forum\original v.4\post.php on line 81


Custom Avatars are Disabled


Only 2 errors but doing the right thing...

When you choose an image that is allowed /"good" you get...

Notice: Undefined offset: 2 in C:\Program Files\Abyss Web Server\htdocs\forum\original v.4\post.php on line 77
Message posted!

Spyke|Test Thread 6|Test Thread 6|flag.gif

Return to main

Not too bad, what do you think is wrong?

Nevermore
09-29-2003, 11:48 AM
I'll work it out. Could you post the whole script please? I've attached a version of the script you gave me that should allow UBB code.
By the variable holding the main body I meant $words, which holds the text that the user typed into the body box of the posting form.

This gives you [b]Text[/b] for bold, [i]Text[/i] for italics, [u]Text[/u] for underlined, [img]Source[/img] for images, [url=link]Text[/url] for
hyperlinks, [email]Address[/email] for email links, [code]Text[/code] for code, [quote]Text[/quote] for quotes, [font=font]Text[/font] for fonts (font families) and [color=colour]Text[/color] for colours. Give it a go.

spykemitchell
09-29-2003, 11:59 AM
Ok, thanks i'll test that in a mo,

I have posted the script 4 custom avatar blocking, i only added it to post.php to test the script. I can add it to reply.php if you want though.

Nevermore
09-29-2003, 12:08 PM
The script you posted doesn't contain the avatar blocking code. I need the code exactly as it was when it errored please. If you don't have that code could you add the code again and tell me where it errors.

spykemitchell
09-29-2003, 12:15 PM
Tested the ubb code you created, itworks....

thankyou...

Nevermore
09-29-2003, 12:16 PM
Which works? If the Avatar thing works, then you don't need to thank me, I didn't change it!

Jona
09-29-2003, 12:25 PM
Looks like you've got it goin' for ya', Kirjori. Hehe, well, I need to put pyro, AdamBrill and you in the credits. :p

[J]ona

spykemitchell
09-29-2003, 12:32 PM
Can the UBB COde be done for Reply, i have tried but get 2 error messages? I think i may need to change some things..

By the way, as you have to remove the stripslashes function, does that decrease security?

I have posted reply.php for you...

spykemitchell
09-29-2003, 12:35 PM
I say i have posted it, what i meant to say was, i forgot this time but i will put it in next time...

Nevermore
09-29-2003, 12:41 PM
What were the errors?

Nevermore
09-29-2003, 12:46 PM
OK, I've taken a guess at what was the problem, whoever wrote this script used different variable names to the other... Try this file.
Are you still having problems with the custom Avatars thing, and can I please have a link to your forum so I can take a look. That will also mean if you have any more problems I can look at the error messages.

edit: I didn't see your question about stripslashes first time round, but here's the answer: Why did you have to remove it? No, it doesn't decrease security, but you might have some slashes in your text where there is an apostrophe, backslash etc... Why can't you use stripslashes?

spykemitchell
09-29-2003, 12:58 PM
I cannot give you a link to my forum because it is being creates offline but i can post my entire script (Minus the avatars thing) and you can have a look!

Nevermore
09-29-2003, 01:01 PM
Does the Avatars thing work? Sure, the scripts would be cool. Anything in particular you want me to look at?

spykemitchell
09-29-2003, 01:44 PM
The avatars thing does not work, sorry, forgot to mention that...

In the attatched file there is my entire forum, just activate index.php to run it. I just would like you to have a look at the avatars thing and see if it will work thats all. It will not work for me.

Nevermore
09-29-2003, 02:50 PM
Here's your forum. I've disabled custom avatars and added UBB code support for all posts. I've also checked through, and you need to make sure there is always something in the log files or the scripts will error. I've also improved the notification of post success. (If that makes any sense... post a message and you'll see what I mean.) If you need any more help, post again.

spykemitchell
09-29-2003, 03:18 PM
Thanks for that, it is loads better. An error for you to check out, this is written to the top of the echo() where it tells you your message after you have posted it in reply.php.

Notice: Undefined offset: 8 in C:\Program Files\Abyss Web Server\htdocs\forum\original v.4\reply.php on line 121

I have attatched the script....

Nevermore
09-30-2003, 01:28 AM
I couldn't find the problem. If it is still posting, just throwing errors for no apparrent reason, then use this script; I've turned off error display. If not, then it's time to pester Pyro...

spykemitchell
09-30-2003, 11:16 AM
Nope, it still shows the error...

PYRO!!!!!! WHERE ARE YOU????

HELP PYRO!

pyro
09-30-2003, 11:23 AM
When using count() (http://us4.php.net/manual/en/function.count.php) and arrays, we must remember that arrays start at 0 while count() returns the number of values in the array. So, the loop tried to loop through one more value than they array contained. Change line 121 to:

for($npx=0; $npx<count($allowImgs); $npx++) {or:

for($npx=0; $npx<=count($allowImgs)-1; $npx++) {

Nevermore
09-30-2003, 11:30 AM
Thanks Pyro! :D

pyro
09-30-2003, 11:38 AM
Sure thing... :)

spykemitchell
09-30-2003, 11:39 AM
Thanks Pyro, Don't suppose you could post the original line because my computer or whatever it is allways states the wrong line number when displaying errors.

Also, i the $badWords array it only matches the case so i could type a swear word all in lower case and be told i'm not allowed to o that but if it is typed in capitals or a mixture of capitals and lowercase it accepts it. Also, is it possible to make it ignore hyphens or spaces between the letters so if the letters D A M N occur in any form e.g. d,/A-- m^"N (using damn as a friendly example) it would block that too?

pyro
09-30-2003, 11:57 AM
The original line was

for($npx=0; $npx<=count($allowImgs); $npx++){

Also, yes, you could write a regexp to disallow d,/A-- m^"N, but it would also disallow something like damen which is not a swear...

spykemitchell
09-30-2003, 12:00 PM
Good Point... I need to at least make it recognise that it is in mixed capitals so that it doesn't have to match the case...

pyro
09-30-2003, 12:08 PM
Just add an i flag to the regexp...

Nevermore
09-30-2003, 12:19 PM
At the moment it isn't a regular expression (I don't think), it's just a basic text match. (no slashes at the start and end of the pattern). I would have thought the easiest thing to do would be to change this code:

if(preg_match($badWords[$m], $msg)){$badWordsExist=true;}
if(preg_match($badWords[$m], $name)){$badWordsExist=true;}


To this:

if(preg_match($badWords[$m], strtolower($msg))){$badWordsExist=true;}
if(preg_match($badWords[$m], strtolower($name))){$badWordsExist=true;}
Since in my experience regular expressions are hard and that is easy.

Correct me if I'm wrong, Pyro...

Jona
09-30-2003, 12:26 PM
My RegExps look like this:


/\bbad_word\b/i


The i means "ignore case."

[J]ona

Nevermore
09-30-2003, 12:35 PM
Your regexps (or at least the version he's using) are:

if(preg_match($badWords[$m], $msg)){$badWordsExist=true;}
if(preg_match($badWords[$m], $name)){$badWordsExist=true;}


Could he have an old version?

pyro
09-30-2003, 12:43 PM
$badWords[$m] must contain the opening and closing delimiter for the regexp. If so, just add an i after each one. Also, strtolower() wouldn't work all that well, as daMn would still pass.

Ok, just took a quick look at that reply.php file, and it looks like the i flag is already set, so it should replace them regardless of case.

Jona
09-30-2003, 12:44 PM
Yes, $badWords[] is an array containing strings of the RegExps themselves, and I just looped through them.

[J]ona

Nevermore
09-30-2003, 12:52 PM
Odd that it wasn't then. Spyke, does it work or not?

And Pyro, I thought strtolower converted the whole string to lower case? From the PHP manual:


Returns string with all alphabetic characters converted to lowercase.

What am I missing here?

spykemitchell
09-30-2003, 12:57 PM
Actually, the regexp were missing the "i" in them...

I just added them... All Ok Now...

Nevermore
09-30-2003, 01:04 PM
As long as it works. Hey Jona, how many of the things in your readme are you working on? Only I'll work on any you aren't. I dunno why, but this 'project' is way more interesting than anything else I do...

And anyone know how the php syntax highlighting is done in forums? Is it just a massive regExp, or is there an easier way?

spykemitchell
09-30-2003, 01:20 PM
Tell you what!

If you like a challeng you can create a signup and login password system for it like this site (HE HE, He'll never do it)
replacing the name input with the username in a hidden input!

Bet you can't do that can you!

:p

Jona
09-30-2003, 01:21 PM
Work on anything you want, since right now I'm busy working on a site for a Game Development company. :D Just tell me what you're working on.

I think PHP.net has some source code on the PHP syntax highlighting... You might want to look for that. It may also be on Zend's Web site (http://zend.com/).

[J]ona

Jona
09-30-2003, 01:22 PM
Originally posted by spykemitchell
Tell you what!

If you like a challeng you can create a signup and login password system for it like this site (HE HE, He'll never do it)
replacing the name input with the username in a hidden input!

Bet you can't do that can you!

:p

That is insecure, as anyone can select view-source and find the hidden inputs. Instead, you would use a .dat file for usernames and their corresponding passwords, but the files must be in the data/ folder and the folder must be password-protected.

[J]ona