GFXVoid Graphic Design Forum

Remove Text Formatting
Loading...

» Online Users: 14,663

0 members and 14,663 guests
No Members online

» Site Navigation

 > FAQ

» Stats

Members: 35,442
Threads: 103,075
Posts: 826,688
Top Poster: cc.RadillacVIII (7,429)
Welcome to our newest member, Lekelindids
Page 1 of 4 123 ... LastLast
Results 1 to 10 of 33
  1. #1
    Join Date
    Mar 2005
    Location
    Vancouver, BC, Canada
    Posts
    66

    Default

    Simple Version V2.2c</span>

    OK, this is how to make a shoutbox, flat-files version so there is no need for a MySQL DataBase.

    Features
    -Word Filtering
    -Spam Ban
    -Error Handling
    -Website Display
    -Tag Removal
    -Smilies&#33;


    Requirements:
    PHP 4.x
    FTP access: ability to add folders, files, and set CHMOD properties
    <a href=\'http://www.smartftp.com\' target=\'_blank\'>SmartFTP</a> or a FTP program


    Creating The Script
    Now first off open up one of your favourite editors (dreamweaver optimal) and remove all of the generated code.

    Now copy and paste the following code into the editor:
    Code:
    &#60;?
    
    // Left out be default, shows site when URL not entered
    // &#036;blankurl = &#34;#&#34;;
    
    // Converts any &#60;enter&#62; to &#60;br&#62;
    &#036;username = stripslashes&#40;&#036;username&#41;;
    &#036;message = stripslashes&#40;&#036;message&#41;;
    
    // this makes the PHP get your IP address and turn it into a variable
    &#036;ip = getenv&#40;&#34;REMOTE_ADDR&#34;&#41;;
    
    // this is an array being assigned as a variable
    &#036;assIP = array &#40;&#41;;
    
    // this makes it so if if someone spams, they will be banned
    foreach&#40; &#036;assIP as &#036;temp &#41;
    {
    if &#40;&#036;ip == &#036;temp&#41; {
    echo &#34;Your ip has been banned stop spamming here...&#34;;
    exit;
    }
    }
    
    /* FILTER */
    // Grabs all variables
    global &#036;message;
    
    // To find and remove unwanted content
    if&#40;strstr&#40;&#036;HTTP_POST_VARS&#91;&#39;message&#39;&#93;,&#34;&#60;object&#34;&#41;&#41; {
    header&#40;&#34;Location&#58; error2.php&#34;&#41;;
    die&#40;&#41;;
    }
    if&#40;strstr&#40;&#036;HTTP_POST_VARS&#91;&#39;message&#39;&#93;,&#34;&#60;applet&#34;&#41;&#41; {
    header&#40;&#34;Location&#58; error2.php&#34;&#41;;
    die&#40;&#41;;
    }
    if&#40;strstr&#40;&#036;HTTP_POST_VARS&#91;&#39;message&#39;&#93;,&#34;&#60;meta&#34;&#41;&#41; {
    header&#40;&#34;Location&#58; error2.php&#34;&#41;;
    die&#40;&#41;;
    }
    if&#40;strstr&#40;&#036;HTTP_POST_VARS&#91;&#39;message&#39;&#93;,&#34;&#60;script&#34;&#41;&#41; {
    header&#40;&#34;Location&#58; error2.php&#34;&#41;;
    die&#40;&#41;;
    }
    
    // The strings that replace words into asterisks
    &#036;message = str_replace&#40;&#34;fuck&#34;,&#34;f**k&#34;,&#036;message&#41;;
    &#036;message = str_replace&#40;&#34;ass&#34;,&#34;a*s&#34;,&#036;message&#41;;
    &#036;message = str_replace&#40;&#34;bitch&#34;,&#34;b**h&#34;,&#036;message&#41;;
    &#036;message = str_replace&#40;&#34;nigger&#34;,&#34;n****r&#34;,&#036;message&#41;;
    &#036;message = str_replace&#40;&#34;nigga&#34;,&#34;n***a&#34;,&#036;message&#41;;
    &#036;message = str_replace&#40;&#34;fucker&#34;,&#34;f****r&#34;,&#036;message&#41;;
    &#036;message = str_replace&#40;&#34;chink&#34;,&#34;c***k&#34;,&#036;message&#41;;
    &#036;message = str_replace&#40;&#34;shit&#34;,&#34;s**t&#34;,&#036;message&#41;;
    
    // To find smilies and add the images
    // &#036;message = str_replace&#40;&#34;&#58;&#41;&#34;,&#34;&#60;img src=&#092;&#34;/images/smile.gif&#092;&#34; alt=&#092;&#34;Smile&#092;&#34;&#62;&#34;,&#036;message&#41;;
    // &#036;message = str_replace&#40;&#34;&#58;D&#34;,&#34;&#60;img src=&#092;&#34;/images/smile.gif&#092;&#34; alt=&#092;&#34;Grin&#092;&#34;&#62;&#34;,&#036;message&#41;;
    // &#036;message = str_replace&#40;&#34;&#58;&#40;&#34;,&#34;&#60;img src=&#092;&#34;/images/sad.gif&#092;&#34; alt=&#092;&#34;Sad&#092;&#34;&#62;&#34;,&#036;message&#41;;
    
    // Checking if your name will be used, or your IP address
    if &#40;&#036;username == &#34;name&#34;&#41; {
    &#036;username = &#34;&#036;ip&#34;;
    &#036;URL = &#34;&#34;;
    }
    else {
    &#036;username = &#036;username;
    }
    
    // Checking if you forgot to enter in a message
    if &#40;&#036;message == &#34;message&#34;&#41; {
    header&#40;&#34;Location&#58; error.php&#34;&#41;;
    die&#40;&#41;;
    }
    else {
    &#036;message = &#036;message;
    }
    
    // Checking to see if you want to be Anonymous
    if &#40; empty&#40;&#036;username&#41;&#41; {
    &#036;postname = &#34;Anonymous&#34;;
    }
    else {
    &#036;postname = &#036;username;
    }
    
    // Checking if somone has a URL and if not, dont have a link
    if &#40; empty&#40;&#036;URL&#41;&#41; {
    &#036;nameformat = &#34;&#60;b&#62;&#036;postname&#60;/b&#62;&#34;;
    }
    elseif &#40;&#036;URL == &#34;http&#58;//&#34;&#41; {
    &#036;nameformat = &#34;&#60;b&#62;&#036;postname&#60;/b&#62;&#34;;
    }
    else {
    &#036;nameformat = &#34;&#60;b&#62;&#60;a href=&#092;&#34;&#036;URL&#092;&#34; target=&#092;&#34;_blank&#092;&#34;&#62;&#036;postname&#60;/a&#62;&#60;/b&#62;&#34;;
    }
    
    // Showing that if proper data is entered, show success.
    if &#40; empty&#40;&#036;message&#41;&#41; {
    header&#40;&#34;Location&#58; error.php&#34;&#41;;
    die&#40;&#41;;
    }
    elseif &#40;&#036;message == &#34;Enter Message&#34;&#41; {
    header&#40;&#34;Location&#58; error.php&#34;&#41;;
    die&#40;&#41;;
    }
    else {
    &#036;msg = &#036;message;
    header&#40;&#34;Location&#58; success.php&#34;&#41;;
    }
    
    // Write to the file.
    &#036;logit = &#34;&#036;nameformat » &#036;msg&#60;br&#62;&#092;n&#34;;
    &#036;fp = fopen &#40;&#34;shoutbox.txt&#34;, &#34;a+&#34;&#41;;
    fwrite &#40;&#036;fp, &#036;logit&#41;;
    fclose &#40;&#036;fp&#41;;
    ?&#62;
    Now save that as shoutbox.php and put in a folder on your desktop named shoutbox.

    create a new .php file and name it error.php enter in the following code:
    Code:
    &#60;html&#62;
    &#60;head&#62;
    &#60;title&#62;ERROR&#33;&#60;/title&#62;
    &#60;meta http-equiv=&#34;refresh&#34; content=&#34;3; index.php&#34;&#62;
    &#60;style type=&#34;text/css&#34;&#62;
    &#60;&#33;--
    body {
    font-family&#58; Verdana, Arial, Helvetica, sans-serif;
    color&#58; #FFFFFF;
    font-size&#58;10px;
    border&#58; 1px;
    }
    a&#58;link {
    	font-weight&#58; bold;
    	color&#58; 5A9F00;
    	text-decoration&#58; none;
    }
    a&#58;hover {
    	font-weight&#58; bold;
    	color&#58; #FFFFFF;
    }
    a&#58;visited {
    	color&#58; 5A9F00;
    }
    .style1 {color&#58; #FF0000}
    .style3 {color&#58; #FF0000; font-size&#58; 9; }
    .style4 {
    	color&#58; #CCCCCC;
    	font-weight&#58; bold;
    	font-size&#58; 14px;
    }
    --&#62;
    &#60;/style&#62;
    &#60;/head&#62;
    &#60;body bgcolor=&#34;#262626&#34;&#62;
    &#60;table bgcolor=&#34;#292929&#34; border=&#34;0&#34; align=&#34;center&#34; cellpadding=&#34;3&#34; cellspacing=&#34;0&#34; width=&#34;98%&#34;&#62;
    &#60;tr&#62;
    &#60;td valign=&#34;bottom&#34; style=&#34;background-color&#58; #444444; border&#58; 1px solid #000000&#34;&#62;&#60;div align=&#34;center&#34;&#62;&#60;span class=&#34;style3&#34;&#62;&#60;strong&#62;ERROR&#58;&#60;/strong&#62; No message entered. Press back on your browser to try again. &#60;/span&#62;&#60;/div&#62;&#60;/td&#62;
    &#60;/tr&#62;
    &#60;/table&#62;&#60;br&#62;
    &#60;div align=&#34;center&#34; class=&#34;style1&#34;&#62; 
     *&#60;p&#62;&#60;strong&#62;ERROR&#58;&#60;/strong&#62; No message entered. Press back on your browser to try again. &#60;/p&#62;
     *&#60;p class=&#34;style4&#34;&#62;&#60;a href=&#34;index.php&#34;&#62;Back&#60;/a&#62;&#60;/p&#62;
    &#60;/div&#62;
    
    &#60;/body&#62;
    &#60;/html&#62;
    This requires no custimization so you can just copy and paste.

    Now create another file and call it success.php enter in this code, again no need to edit
    Code:
    &#60;html&#62;
    &#60;head&#62;
    &#60;title&#62;Success&#60;/title&#62;
    &#60;style type=&#34;text/css&#34;&#62;
    &#60;&#33;--
    body {
    font-family&#58; Verdana, Arial, Helvetica, sans-serif;
    color&#58; #FFFFFF;
    font-size&#58;10px;
    border&#58; 1px;
    }
    a&#58;link {
    	font-weight&#58; bold;
    	color&#58; 5A9F00;
    	text-decoration&#58; none;
    }
    a&#58;hover {
    	font-weight&#58; bold;
    	color&#58; #FFFFFF;
    }
    a&#58;visited {
    	color&#58; 5A9F00;
    }
    .style1 {color&#58; #FF0000}
    .style3 {color&#58; #FF0000; font-size&#58; 9; }
    .style4 {
    	color&#58; #CCCCCC;
    	font-weight&#58; bold;
    	font-size&#58; 14px;
    }
    .style5 {color&#58; #00FF00}
    --&#62;
    &#60;/style&#62;
    &#60;/head&#62;
    &#60;body bgcolor=&#34;#262626&#34;&#62;
    &#60;table bgcolor=&#34;#292929&#34; border=&#34;0&#34; align=&#34;center&#34; cellpadding=&#34;3&#34; cellspacing=&#34;0&#34; width=&#34;98%&#34;&#62;
    &#60;tr&#62;
    &#60;td valign=&#34;bottom&#34; style=&#34;background-color&#58; #444444; border&#58; 1px solid #000000&#34;&#62;&#60;div align=&#34;center&#34;&#62;&#60;?php include&#39;shoutbox.txt&#39;; ?&#62;&#60;/div&#62;&#60;/td&#62;
    &#60;/tr&#62;
    &#60;/table&#62;&#60;br&#62;
    &#60;div align=&#34;center&#34; class=&#34;style1&#34;&#62; 
     *&#60;p class=&#34;style5&#34;&#62;&#60;strong&#62;Success&#58;&#60;/strong&#62; You have successfully add your post. Press back to go to index. &#60;/p&#62;
     *&#60;p class=&#34;style4&#34;&#62;&#60;a href=&#34;index.php&#34;&#62;Back&#60;/a&#62;&#60;/p&#62;
    &#60;/div&#62;
    
    &#60;/body&#62;
    &#60;/html&#62;
    Simple enough huh? Now the last file to code its just a form that sends the data to shoutbox.php the only PHP in that file is an "include" think of it as a iframe, it displays a different page on that page.

    Code:
    &#60;html&#62;
    &#60;head&#62;
    &#60;title&#62;ShoutBox 2.2c&#60;/title&#62;
    &#60;style type=&#34;text/css&#34;&#62;
    &#60;&#33;--
    body {
    font-family&#58; Verdana, Arial, Helvetica, sans-serif;
    color&#58; #FFFFFF;
    font-size&#58;10px;
    border&#58; 1px;
    }
    a&#58;link {
    	font-weight&#58; bold;
    	color&#58; 5A9F00;
    	text-decoration&#58; none;
    }
    a&#58;hover {
    	font-weight&#58; bold;
    	color&#58; #FFFFFF;
    }
    a&#58;visited {
    	color&#58; 5A9F00;
    }
    --&#62;
    &#60;/style&#62;
    &#60;/head&#62;
    &#60;body bgcolor=&#34;#262626&#34;&#62;
    &#60;table bgcolor=&#34;#292929&#34; border=&#34;0&#34; align=&#34;center&#34; cellpadding=&#34;3&#34; cellspacing=&#34;0&#34; width=&#34;98%&#34;&#62;
    &#60;tr&#62;
    &#60;td valign=&#34;bottom&#34; style=&#34;background-color&#58; #444444; border&#58; 1px solid #000000&#34;&#62;&#60;font face=&#34;Verdana, Arial, Helvetica, sans-serif&#34; size=&#34;1&#34;&#62;&#60;?php include &#34;shoutbox.txt&#34;; ?&#62;&#60;/font&#62;&#60;/td&#62;
    &#60;/tr&#62;
    &#60;/table&#62;&#60;br&#62;&#60;div align=&#34;center&#34;&#62;
    &#60;form name=&#34;shoutbox&#34; action=&#34;shoutbox.php&#34; method=&#34;post&#34;&#62;
    &#60;div align=&#34;left&#34;&#62;
    &#60;br&#62;
    &#60;input name=&#34;username&#34; type=&#34;text&#34; class=&#34;fields&#34; style=&#34;font-family&#58; verdana; color&#58; #FFFFFF; font-size&#58; 7pt; background-color&#58; #444444; border&#58; 1px solid #000000&#34; value=&#34;name&#34; size=&#34;10&#34; maxlength=&#34;50&#34; onfocus=&#34;if&#40;this.value==&#39;name&#39;&#41; this.value=&#39;&#39;;&#34;&#62;
    &#60;br&#62;
    &#60;input name=&#34;URL&#34; type=&#34;text&#34; class=&#34;fields&#34; style=&#34;font-family&#58; verdana; color&#58; #FFFFFF; font-size&#58; 7pt; background-color&#58; #444444; border&#58; 1px solid #000000&#34; value=&#34;http&#58;//&#34; size=&#34;20&#34; maxlength=&#34;75&#34;&#62;
    &#60;br&#62;
    &#60;textarea name=&#34;message&#34; cols=&#34;40&#34; rows=&#34;10&#34; wrap=&#34;VIRTUAL&#34; class=&#34;fields&#34; style=&#34;font-family&#58; verdana; color&#58; #FFFFFF; font-size&#58; 7pt; background-color&#58; #444444; border&#58; 1px solid #000000&#34; onFocus=&#34;if&#40;this.value==&#39;name&#39;&#41; this.value=&#39;&#39;;&#34;&#62;Enter Message&#60;/textarea&#62;
    &#60;br&#62;
    &#60;input class=&#34;fields&#34; type=&#34;submit&#34; name=&#34;tag&#34; value=&#34;Send&#34; size=&#34;10&#34; style=&#34;font-family&#58; verdana; color&#58; #FFFFFF; font-size&#58; 7pt; background-color&#58; #444444; border&#58; 1px solid #000000&#34;&#62;&#60;input class=&#34;fields&#34; type=&#34;reset&#34; name=&#34;reset&#34; value=&#34;Reset&#34; size=&#34;10&#34; style=&#34;font-family&#58; verdana; color&#58; #FFFFFF; font-size&#58; 7pt; background-color&#58; #444444; border&#58; 1px solid #000000&#34;&#62;HTML is enabled.
    &#60;/div&#62;
    &#60;/form&#62;
    &#60;/div&#62;
    
    &#60;/body&#62;
    &#60;/html&#62;
    Now to create the error file that says that they have used an invalid tag, name this error2.php

    Code:
    &#60;html&#62;
    &#60;head&#62;
    &#60;title&#62;ERROR&#33;&#60;/title&#62;
    &#60;meta http-equiv=&#34;refresh&#34; content=&#34;3; index.php&#34;&#62;
    &#60;style type=&#34;text/css&#34;&#62;
    &#60;&#33;--
    body {
    font-family&#58; Verdana, Arial, Helvetica, sans-serif;
    color&#58; #FFFFFF;
    font-size&#58;10px;
    border&#58; 1px;
    }
    a&#58;link {
    	font-weight&#58; bold;
    	color&#58; 5A9F00;
    	text-decoration&#58; none;
    }
    a&#58;hover {
    	font-weight&#58; bold;
    	color&#58; #FFFFFF;
    }
    a&#58;visited {
    	color&#58; 5A9F00;
    }
    .style1 {color&#58; #FF0000}
    .style3 {color&#58; #FF0000; font-size&#58; 9; }
    .style4 {
    	color&#58; #CCCCCC;
    	font-weight&#58; bold;
    	font-size&#58; 14px;
    }
    --&#62;
    &#60;/style&#62;
    &#60;/head&#62;
    &#60;body bgcolor=&#34;#262626&#34;&#62;
    &#60;table bgcolor=&#34;#292929&#34; border=&#34;0&#34; align=&#34;center&#34; cellpadding=&#34;3&#34; cellspacing=&#34;0&#34; width=&#34;98%&#34;&#62;
    &#60;tr&#62;
    &#60;td valign=&#34;bottom&#34; style=&#34;background-color&#58; #444444; border&#58; 1px solid #000000&#34;&#62;&#60;div align=&#34;center&#34;&#62;&#60;span class=&#34;style3&#34;&#62;&#60;strong&#62;ERROR&#58;&#60;/strong&#62; Restricted HTML Tags Used &#60;/span&#62;&#60;/div&#62;&#60;/td&#62;
    &#60;/tr&#62;
    &#60;/table&#62;&#60;br&#62;
    &#60;div align=&#34;center&#34; class=&#34;style1&#34;&#62; 
     *&#60;p&#62;&#60;strong&#62;ERROR&#58;&#60;/strong&#62; Restricted HTML Tags Used. Press back on your browser to try again. &#60;/p&#62;
     *&#60;p class=&#34;style4&#34;&#62;&#60;a href=&#34;index.php&#34;&#62;Back&#60;/a&#62;&#60;/p&#62;
    &#60;/div&#62;
    
    &#60;/body&#62;
    &#60;/html&#62;
    Now save all of the files under the shoutbox folder on your desktop. Open up notepad and save a file called shoutbox.txt add this to the top, save, and exit out of notepad:
    Code:
    &#60;div align=&#34;left&#34; style=&#34;font-family&#58;Verdana, Arial, Helvetica, sans-serif; color&#58;#FFFFFF; font-size&#58;10px;&#34;&#62;
    Close your editor, take a nap (that means relax, here comes the hard part)


    Upload The Files
    Now open up your FTP Uploader program (SmartFTP is demonstrated)
    <img src=\'http://img50.exs.cx/img50/6798/sbtut014aj.jpg\' border=\'0\' alt=\'user posted image\' />

    Now once you have the information entered press your Enter key and wait for login
    <img src=\'http://img50.exs.cx/img50/6518/sbtut026zx.jpg\' border=\'0\' alt=\'user posted image\' />

    Hopefully you are in your root directory (the directory that is not inside another directory) and press Insert of your keyboard, this (in SmartFTP) creates a new folder/directory name it shoutbox.
    <img src=\'http://img11.exs.cx/img11/1883/sbtut037sv.jpg\' border=\'0\' alt=\'user posted image\' />

    Double click the shoutbox directory and it should open up the directory. From here open up the shoutbox folder on your computer and drag &#39;n&#39; drop the files onto your shoutbox directory:
    <img src=\'http://img11.exs.cx/img11/1778/sbtut044ve.jpg\' border=\'0\' alt=\'user posted image\' />

    now select the shoutbox.txt and press F7 on your keyboard, this will open up the CHMOD commands. Set it to 777 (read, write, execute, for all)
    <img src=\'http://img205.exs.cx/img205/6544/sbtut052qh.jpg\' border=\'0\' alt=\'user posted image\' />

    Now create another folder inside /shoutbox called images, place the smilies you want in there (relative to names in shoutbox.php).

    Close SmartFTP and open up your browser go to your website/shoutbox eg <a href=\'http://yoursite.com/shoutbox\' target=\'_blank\'>http://yoursite.com/shoutbox</a> and enjoy&#33;

    -----------------------

    I hope I helped you all understand the process of taking data, handling it, and storing it without using a DataBase. If you have any questions, ask them here. I might update with a Admin CP script&#33;

    -----------------------

    Online Demo: <a href=\'http://justin.pyro-studios.com/shoutbox\' target=\'_blank\'>http://justin.pyro-studios.com/shoutbox</a> feel free to post what you want&#33; please no biogtry or profanity.
    <span style=\'color:red\'>
    Do Not Abuse&#33;

  2. #2
    Join Date
    Mar 2005
    Location
    Insanity Sq.
    Posts
    3,811

    Default

    holy freaking crap dude thats awesome, great job. so damn complicated&#33;&#33;&#33;&#33;&#33; i might go thru the whole thing sometime
    If you want help...
    Screw you
    If you make sigs...
    Screw you

  3. #3
    Join Date
    Mar 2005
    Location
    Vancouver, BC, Canada
    Posts
    66

    Default

    Thanks&#33; I will post a detailed version going through all of the inner workings of the process, every string will be explained O.o


    Also I will post a open source for ppl to custimize without taking the tutorial (hoping no one needs to skip the tutorial)

  4. #4
    Join Date
    Mar 2005
    Location
    Insanity Sq.
    Posts
    3,811

    Default

    holy shit, a DETAILED ONE???? damn i got my reading for the next week cut out for me
    If you want help...
    Screw you
    If you make sigs...
    Screw you

  5. #5
    Join Date
    Mar 2005
    Location
    Vancouver, BC, Canada
    Posts
    66

    Default

    ROFL&#33;

    You think it&#39;s hard to read?? Try writing it&#33; *drops dead*

  6. #6
    Join Date
    Mar 2005
    Location
    Insanity Sq.
    Posts
    3,811

    Default

    lol i sympathize for ya man
    If you want help...
    Screw you
    If you make sigs...
    Screw you

  7. #7
    Join Date
    Mar 2005
    Location
    Vancouver, BC, Canada
    Posts
    66

    Default

    Please, if you come up with any new versions (such as smilies, word filters, etc.) post them here for all to see. And post the code to add to the existing tutorial

  8. #8
    Join Date
    Mar 2005
    Location
    Vancouver, BC, Canada
    Posts
    66

    Default

    Filter Installed, Big text fixed... uploading and writing tutorial later.

    Tutorial edited to have new code installed.

  9. #9
    Join Date
    Dec 2004
    Location
    GFXVoid
    Posts
    4,412

    Default

    I really like it&#33; What I like most about it, is how it doesnt use MYSQL - which saves a hella lot of time.

    Thanks mate =)

  10. #10
    Join Date
    Dec 2004
    Posts
    1,949

    Default

    WOW is that in depth, thanks a ton if i ever get a domain, ima use this tut for a shoutbox
    Oblivion


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBadvanced CMPS v4.1.1