Jump to content

Archived

This topic is now archived and is closed to further replies.

runnerjp

shoutbox!!

Recommended Posts

hey all...ok i have this code to retrieve the shouts posted and then its displaed as a marquee

[quote]<?php
#################################
include("shoutbox/config/config.php");
#################################

mysql_connect($host,$dbuser,$dbpass) or die(mysql_error());
// Select the database.
mysql_select_db($dbname) or die(mysql_error());
$query = "SELECT message, author, eml FROM shoutbox order by id DESC LIMIT 1";
$result = mysql_query($query);
$marquee = "";
while($r=mysql_fetch_array($result))
{
  $marquee.= $r[message]. '<a href=\"$r[eml]\">'. $r[author]. '</a>'";
}
echo "<marquee><font size='3'>". $marquee. "</font></marqee>";[/quote]

rite but the shout box i have saves the stuff in a textbox...it has instructions to make it mysql but very complex.... anyways is their away to retrieve the posts from the txt file??

Share this post


Link to post
Share on other sites
[quote author=runnerjp link=topic=104529.msg416968#msg416968 date=1155754168]
hey all...ok i have this code to retrieve the shouts posted and then its displaed as a marquee

rite but the shout box i have saves the stuff in a textbox...it has instructions to make it mysql but very complex.... anyways is their away to retrieve the posts from the txt file??
[/quote]

Ok, so you're using someone else's code for storing shouts, but you have no idea how to get the shouts out for display?

That's your punishment for using code you don't comprehend. ;D

Nah, I'll help you out. Just show me a couple of lines of the text file.

This is, however a good time to give you my take on using other people's code.

My advice is, don't. I could give you plenty of reasons, and others might argue with me (framework?), but I think it's generally only a good idea if you can be sure you understand every line of code in it, and know exactly how it works.

That means, when I do write the code for you to display your shouts, you will have to figure out how it works.

Code snippets aren't lego blocks.  :P

Share this post


Link to post
Share on other sites
lol well actually the code was helped m,ade by ppl on here :P


gimme a sec to get info u need :D

Share this post


Link to post
Share on other sites
Like I said, I need a couple of lines from the file.

Alternatively, show me the code that assembles the string it writes. If you know were that is. ::)

[quote]lol well actually the code was [s]helped[/s] [u]made[/u] by ppl on here[/quote]

Code snippets aren't lego blocks. Did I mention that?  ;)

Share this post


Link to post
Share on other sites
hha yer ur point is true



lol i dnt know where it is.... any idea where i might find it >???

Share this post


Link to post
Share on other sites
Hell, as far as I'm concerned, you 'fell through'.

You've got 84 posts but you can't even locate string assembly in a simple shoutbox script?

Learn PHP, code snippets REALLY aren't lego blocks.  :(

Share this post


Link to post
Share on other sites
nooooooooo please i need to do this.... is it the code that is writin instead of the text like this 
MA%253D%253D%7CMA%253D%253D%7C%7CMQ%253D

Share this post


Link to post
Share on other sites
Oh, a) Stop wining, if you want people to do something for you, there is a freelance forum. And b) Help us help you! Post a couple of the lines of sample info from the text file.

Share this post


Link to post
Share on other sites
sorry  :)


here u go
[quote]MA%253D%253D%7CMA%253D%253D%7C%7CMQ%253D%253D%7CUm9i%7C%7CMg%253D%253D%7CaHR0cDovL3d3dy5rdWhhYy5jby51aw%253D%253D%7C%7CMw%253D%253D%7CODMuMTAwLjE5My4xNw%253D%253D%7C%7CNA%253D%253D%7CSVwnbGwgZG8gZ3JhZmZpdGkgaWYgeW91IHNpbmcgdG8gbWUgaW4gZnJlbmNo%7C%7CNQ%253D%253D%7CMTE1NTc2MDg0MA%253D%253D [/quote]

Share this post


Link to post
Share on other sites
Thats a sample line from inside the text file? :|

Ok, well lets see the part that writes to the text file.

Share this post


Link to post
Share on other sites
ohh ok
here is index bit
[code]include("./config.php");
include("./lang.php");

// array_to_string and string_to_array functions
// originally by daenders AT yahoo DOT com on php.net
function array_to_string($array) {
  $retval = '';
  foreach ($array as $index => $value) {
      $retval .= urlencode(base64_encode($index)) . '|' . urlencode(base64_encode($value)) . '||';
  }
  return urlencode(substr($retval, 0, -2));
}

function string_to_array($string) {
  $retval = array();
  $string = urldecode($string);
  $tmp_array = explode('||', $string);
  foreach ($tmp_array as $tmp_val) {
      list($index, $value) = explode('|', $tmp_val);
      $retval[base64_decode(urldecode($index))] = base64_decode(urldecode($value));
  }
  return $retval;
}
function check_words($string,$banwordz) {
  for($i=0;$i<sizeof($banwordz);$i++){
    $string=eregi_replace($banwordz[$i], "****", $string);
  }
  return $string;
}
function check_ip($bannedipz) {
  $isokay = true;
  foreach($bannedipz as $banip) {
    if ($_SERVER['REMOTE_ADDR'] == $banip) {
      $isokay = false;
    }
  }
  return $isokay;
}
function getTagName($text,$cnt)
{
        while(($cnt < strlen($text))&&(eregi("[^a-z0-9]",substr($text,$cnt,1))))$cnt++;
        $tagNameStart=$cnt;
        while(($cnt < strlen($text))&&(!eregi("[^a-z0-9]",substr($text,$cnt,1))))$cnt++;
        return substr($text,$tagNameStart,$cnt-$tagNameStart);
}
function getTagEnd($text,$cnt)
{
        return strpos($text,">",$cnt);
}
function closeUnclosedTags($text)
{
        $openedTags=array();
        $cnt=0;
        while(($cnt < strlen($text))&&(true))
        {
                if(substr($text,$cnt,2)=="</")
                {
                        $tagEnd=getTagEnd($text,$cnt);
                        $tagName=getTagName($text,$cnt);
                        $lastOpenedTag=array_pop($openedTags);
                        if($lastOpenedTag==NULL)
                        {
                                //error: no tag was opened - delete the close tag
                                $text=substr($text,0,$cnt).substr($text,$tagEnd+1);
                        }elseif($lastOpenedTag!=$tagName){
                                //error: closing unopened tag (possible cross-nesting) - return the original opened tag and delete the close tag
                                array_push($openedTags,$lastOpenedTag);
                                $text=substr($text,0,$cnt).substr($text,$tagEnd+1);
                        }else{ $cnt=$tagEnd+1; }
                }elseif(substr($text,$cnt,1)=="<"){
                        $tagEnd=getTagEnd($text,$cnt);
                        $tagName=getTagName($text,$cnt);
                        if(substr($text,$tagEnd-1,1)!="/")array_push($openedTags,$tagName);
                        $cnt=$tagEnd+1;
                }else{
                        $cnt++;
                }
        }
        while(count($openedTags)>0)$text.="</".array_pop($openedTags).">";
        return $text;
}
function parse_smileys($string) {
$smileylist = array();
$i = 0;
if ($handle = opendir('./smileys/')) {
  while (false !== ($file = readdir($handle))) {
      if ($file != "." && $file != "..") {
          $smileylist[$i] = str_replace(".gif", "", $file);
          $i++;
      }
  }
  closedir($handle);
}
foreach ($smileylist as $smileycheck){
        $string = str_replace(":".$smileycheck.":", "<img src=\"smileys/".$smileycheck.".gif\" />", $string);
}
return $string;
}

[/code]

Share this post


Link to post
Share on other sites
I cant actually see any part of the script which writes to a file...perhaps im just blind.

Share this post


Link to post
Share on other sites
really i swear it should b their
what would an expample little bit of the code be??

Share this post


Link to post
Share on other sites
i found it but 4 sum reason it wnt let me post it on here so  i slapped it on website [url=http://www.runnerselite.com/phpfreaks.html]www.runnerselite.com/phpfreaks.html[/url]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.