Jump to content


Photo

shoutbox!!


  • Please log in to reply
18 replies to this topic

#1 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 16 August 2006 - 06:49 PM

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

<?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>";


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??

#2 448191

448191
  • Staff Alumni
  • Advanced Member
  • 3,545 posts
  • LocationNetherlands

Posted 16 August 2006 - 08:14 PM

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??


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

#3 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 16 August 2006 - 08:16 PM

lol well actually the code was helped m,ade by ppl on here :P


gimme a sec to get info u need :D

#4 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 16 August 2006 - 08:19 PM

ok so what do i need to send you.....thanks soooo much 4 duin this :D:D:D:D

#5 448191

448191
  • Staff Alumni
  • Advanced Member
  • 3,545 posts
  • LocationNetherlands

Posted 16 August 2006 - 08:52 PM

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. ::)

lol well actually the code was helped made by ppl on here


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



#6 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 16 August 2006 - 08:54 PM

hha yer ur point is true



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

#7 448191

448191
  • Staff Alumni
  • Advanced Member
  • 3,545 posts
  • LocationNetherlands

Posted 16 August 2006 - 09:08 PM

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.  :(

#8 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 16 August 2006 - 09:13 PM

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

#9 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 16 August 2006 - 09:26 PM

pllleeeaaasssseeeeeeeeee hhhheeelllpppppp

#10 GingerRobot

GingerRobot
  • Staff Alumni
  • Advanced Member
  • 4,086 posts
  • LocationUK

Posted 16 August 2006 - 09:34 PM

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.

#11 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 16 August 2006 - 09:36 PM

sorry  :)


here u go

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



#12 GingerRobot

GingerRobot
  • Staff Alumni
  • Advanced Member
  • 4,086 posts
  • LocationUK

Posted 16 August 2006 - 09:39 PM

Thats a sample line from inside the text file? :|

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

#13 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 16 August 2006 - 09:45 PM

ohh ok
here is index bit
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;
}



#14 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 17 August 2006 - 12:41 PM

?

#15 GingerRobot

GingerRobot
  • Staff Alumni
  • Advanced Member
  • 4,086 posts
  • LocationUK

Posted 17 August 2006 - 01:32 PM

I cant actually see any part of the script which writes to a file...perhaps im just blind.

#16 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 17 August 2006 - 01:38 PM

really i swear it should b their
what would an expample little bit of the code be??

#17 GingerRobot

GingerRobot
  • Staff Alumni
  • Advanced Member
  • 4,086 posts
  • LocationUK

Posted 17 August 2006 - 01:41 PM

You would be using the fwrite() function.

#18 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 17 August 2006 - 02:10 PM

i found it but 4 sum reason it wnt let me post it on here so  i slapped it on website www.runnerselite.com/phpfreaks.html

#19 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 17 August 2006 - 03:02 PM

is it any help?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users