Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
Help: dodavanje link-replace u shoutbox...

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side
View previous topic :: View next topic  
Author Message
JBR



Joined: 07 Sep 2003
Posts: 44
Location: zlovenie

PostPosted: 17.12.2005 12:13    Post subject: Help: dodavanje link-replace u shoutbox... Add user to your forum ignore list Reply with quote

Zdravo...pre nekoliko godina sam pronašo ovaj simple shoutbox i od lika koji ga uradio zatražio, da ubaci ovaj kako se kaže link-replace, znači, kad upišeš u text www.nešto.org, to se avtomatski linkuje...e sad, to radi, al radi samo za 'www.' a ne i za http://nešto.org...

Taj programer je vanished, i ja nemam pojma kako bi to implementirao, a meni je to fejvorit shoutbox...

Fajlova ima samo dvoje, view_shouts.php i shouts.php (i shout.txt al dobro...), no mysql i to...pa sad, ako pejstam kod ovdje, može možda neki zen majstor bacit oko, pa mi kaže rešjenje, ako nije to u domeni 'da naravno, nije problema, 500kuna'... Smile Rolling Eyes

view_shouts.php - im lazy, pa pejstam sve...

Code:
<?

################################
##                            ##
##        Wi.Shout.v1         ##
##  By: PowerfulSquid (Joe)   ##
## http://www.webimpulse.net  ##
##                            ##
## All code in this script is ##
## Copyright &copy; 2002 by        ##
## Joe Novalany.              ##
##                            ##
################################

// SHOW THE DATE AND TIME IN MESSAGES?

$show_date="yes";

/////////////////////////////
##     SMILEY LINKS        ##
## ----------------------  ##
##                         ##
## If you wish to not use  ##
## Smiley images, simply   ##
## change $smiles to yes   ##
## instead of no.          ##
/////////////////////////////

$smiles="yes";

$smile=array(

":)",
":(",
">(",
";)",
":link:",
":D",
":roll:",
":laugh:",
":dead:",
":cool:",
":o",
":no:",
":smilewink:",
"8o",
":evil:",
":ß",
":worship:",
":yes:",
":borg:",
":cry:",
":dazed:",
":exclaim:",
":fuckyou:",
":heart:",
":idea:",
":question:",
":rek1:",
":rek2:"

);

$image=array(

"<img src=smile.gif>",
"<img src=sad.gif>",
"<img src=mad.gif>",
"<img src=wink.gif>",
"<img src=link.gif>",
"<img src=biggrin.gif>",
"<img src=rolleyes.gif>",
"<img src=laugh.gif>",
"<img src=dead.gif>",
"<img src=cool.gif>",
"<img src=bigeek.gif>",
"<img src=no.gif>",
"<img src=smilewinkgrin.gif>",
"<img src=suprised.gif>",
"<img src=twisted.gif>",
"<img src=vomit.gif>",
"<img src=worship.gif>",
"<img src=yes.gif>",
"<img src=borg.gif>",
"<img src=cry.gif>",
"<img src=dazed.gif>",
"<img src=exclaim.gif>",
"<img src=fuckyou.gif>",
"<img src=heart.gif>",
"<img src=idea.gif>",
"<img src=question.gif>"
);


/////////////////
## FONT COLORS ##
/////////////////

$timecolor="#888888";
$namecolor="#333333";
$message_color="#000000";
$input_font_color="#cc0000";

///////////////////////
## SCROLL BAR COLORS (IE 5.5+ ONLY) ##
///////////////////////

$face="#cccccc";
$shadow="white";
$highlight="white";
$_3dlight="#666666";
$darkshadow="#666666";
$track="#cccccc";
$arrow="black";


/////////////////
## LINK COLORS ##
/////////////////

$link_color="#cc0000";
$active_link="#cc0000";
$visited_link="#cc0000";
$hover_link="#E9E9E9";

///////////////////////
## BACKGROUND COLORS ##
///////////////////////

$bgcolor="#E9E9E9";
$input_bgcolor="#E9E9E9";

//////////////////////////////////////////
## ALTERNATING BACKGROUND TABLE COLORS ##
//////////////////////////////////////////

$alt_table1="#E9E9E9";
$alt_table2="#E9E9E9";

//////////////////////////////////
## FILE NAME WHERE DATA IS HELD ##
//////////////////////////////////

$filename="shout.txt";

//////////////////////////////////
#####  END OF COLOR CONFIGURATION  #####
///////////////////////////////////

///////////////////////////////////////////////////////////
#### BEGIN OF CSS CONFIGURATION. DO NOT CHANGE THE PHP ####
#### WITHIN THE CSS UNLESS YOU KNOW WHAT YOU ARE       ####
#### DOING. ONLY CHANGE BORDERS, FONTS, AND SIZES.     ####
///////////////////////////////////////////////////////////

$fp=fopen($filename, "r");
echo "<body bgcolor=".$bgcolor.">
   <style>
   table {
   font-family: verdana,sans-serif; color: ".$message_color."; font-size: 10px;width:280px
   }
   
   a:link {
      font-family: Verdana,sans-serif; color:".$link_color." ;font-size: 10px; font-style: none; text-decoration:none
   }
   
   a:active {
      font-family: Verdana,sans-serif; color:".$active_link."; font-size: 10px; font-style: none; text-decoration:none
   }
   
   a:visited {
      font-family: Verdana,sans-serif; color:".$visited_link."; font-size: 10px; font-style: none ; text-decoration:none
   }
   
   a:hover {
      font-family: Verdana,sans-serif; color:".$hover_link."; font-size: 10px; font-style: none; text-decoration:none
   }

   input {
   font-family: Verdana,sans-serif; font-size: 10px; color: ".$input_font_color."; background-color:".$input_bgcolor.";
   }
   
  body {
       scrollbar-face-color: ".$face.";
       scrollbar-shadow-color: ".$shadow.";
       scrollbar-highlight-color: ".$highlight.";
       scrollbar-3dlight-color: ".$_3dlight.";
       scrollbar-darkshadow-color: ".$darkshadow.";
       scrollbar-track-color: ".$track.";
       scrollbar-arrow-color: ".$arrow."; }


   </style>";

///////////////////////////////////
#### END OF CSS CONFIGURATION ####
//////////////////////////////////


//////////////////////////////////////////////////
#### DO NOT CHANGE ANYTHING BEYOND THIS POINT ####
#### UNLESS YOU KNOW WHAT YOU ARE DOING       ####
//////////////////////////////////////////////////

echo "<form method=get action=shout.php>

<table width=100% border=0>

<tr>
<td>Name <input type=text size=20 name=name maxlength=13>
</td>
<td>Website <input type=text size=23 name=site value=http://>
</td>
</tr>

</table>

<table width=100% border=0>

<tr>
<td>Text <br>
  <input type=text name=comment size=47 maxlength=200>
</td>
</tr>

<tr>
<td>
  <input type=submit value=SHOUT! size=20 >&nbsp;<a href='.../shoutbox_wi/smilies.html'>Smilies</a>
</td>
</tr>
</form>";

if(filesize($filename)==0)
{
}
else
{

while (!feof($fp))
{
$entries=fgetcsv($fp, 900, "\t");

$entries[0]=strip_tags($entries[0]);
$entries[1]=strip_tags($entries[1]);
$entries[2]=strip_tags($entries[2]);
$entries[3]=strip_tags($entries[3]);

$color=$color+1;

if ($smiles=="yes")
{
$entries[2]=str_replace($smile,$image,$entries[2]);
}


$num=$color/2;

$y=(integer)$num;

if($num==$y)
{

$echo_date = "<div align=center><table width=100% border=0 bgcolor=".$alt_table2." ><tr><td><font color=".$timecolor."><i>sent: ".$entries[3]."</i></font></td></tr></table></div>";

 if ($show_date == "yes")
   {
   echo $echo_date;
   }
 
  echo "<div align=center><table width=100% border=0 bgcolor=".$alt_table2."><tr>";
}

if($num<>$y)
{

$echo_date = "<div align=center><table width=100% border=0 bgcolor=".$alt_table1."><tr><td><font color=".$timecolor."><i>below sent: ".$entries[3]."</i></font></td></tr></table></div>";

 if ($show_date == "yes")
   {
   echo $echo_date;
   }

echo "<div align=center><table width=100% border=0 bgcolor=".$alt_table1."><tr>";
}

if($entries[1]=="http://" || $entries[1]=="")
{
echo "<td width=100% valign=top><b><font color=".$namecolor.">".$entries[0]."</font>&nbsp;:&nbsp;</b>";
$commentsA= explode(" ", $entries[2]);

for($x=0;$x<count($commentsA);$x++)
{
   if(substr($commentsA[$x],0,4) == "www." || substr($commentsA[$x],0,11) == "http://www.")
   {
   $replace=$commentsA[$x];
   if(substr($commentsA[$x],0,11) == "http://www.")
   {
      $r_w="<a href=".$commentsA[$x]." target=_blank>".$commentsA[$x]."</a>";
   }
   else
   {
      $r_w="<a href=http://".$commentsA[$x]." target=_blank>".$commentsA[$x]."</a>";
   }
   $commentsB=str_replace($replace,$r_w,$commentsA[$x]);

   echo $commentsB." ";

   }
   else
   {
      echo $commentsA[$x]." ";
   }
}

echo "</td></tr>";
}
else
{
echo "<td width=100% valign=top><b><a href=".$entries[1]." target=_blank>".$entries[0]."</a>&nbsp;:&nbsp;</b>";
$commentsA= explode(" ", $entries[2]);

for($x=0;$x<count($commentsA);$x++)
{
   if(substr($commentsA[$x],0,4) == "www." || substr($commentsA[$x],0,11) == "http://www.")
   {
   $replace=$commentsA[$x];
   if(substr($commentsA[$x],0,11) == "http://www.")
   {
      $r_w="<a href=".$commentsA[$x]." target=_blank>".$commentsA[$x]."</a>";
   }
   else
   {
      $r_w="<a href=http://".$commentsA[$x]." target=_blank>".$commentsA[$x]."</a>";
   }
   $commentsB=str_replace($replace,$r_w,$commentsA[$x]);

   echo $commentsB." ";

   }
   else
   {
      echo $commentsA[$x]." ";
   }
}
echo "</td></tr>";
}

  echo "</table></center></div>";

}

fclose($fp);

}
?>


....shouts.php

Code:
<?

$date=date("M j Y g:i a");
$comment=StripSlashes($comment);

$nameA=$_GET['name'];
$siteA=$_GET['site'];
$commentA=$_GET['comment'];

if($nameA=="" && $siteA=="http://" && $commentA=="")
{
echo"<font face=verdana size=1 color=#000000>You did not enter any information!
<br><a href=view_shouts.php>Return</a></font>";
exit;
}

if($nameA=="" && $siteA=="" && $commentA=="")
{
echo"<font face=verdana size=1 color=#000000>You did not enter any information!
<br><a href=view_shouts.php>Return</a></font>";
exit;
}

if($nameA=="")
{
echo"<font face=verdana size=1 color=#000000>Please enter your name!
<br><a href=view_shouts.php>Return</a></font>";
exit;
}

if($commentA=="")
{
echo"<font face=verdana size=1 color=#000000>Please enter your comment!
<br><a href=view_shouts.php>Return</a></font>";
exit;
}


$filename="shout.txt";

$read=file("$filename");
if (filesize($filename)==0)
{
$data=$nameA."\t".$siteA."\t".$commentA."\t".$date;
}
if (filesize($filename)>0)
{
$data=$nameA."\t".$siteA."\t".$commentA."\t".$date."\n";
}

$fp=fopen($filename, "w");
fwrite($fp,$data);

$total = count($read);
for ($i = 0; $i <= $total; $i++)
{
   fwrite($fp, "$read[$i]");
}


fclose($fp);
?>

<META HTTP-EQUIV=refresh content=0;URL=view_shouts.php>


muchas grazias!

_________________
Ni vsaka shkoljka shkoljka...
Back to top
View user's profile Send private message Send e-mail
scip



Joined: 19 May 2005
Posts: 25
Location: osijek

PostPosted: 17.12.2005 16:47    Post subject: Add user to your forum ignore list Reply with quote

od oka:
u view_shouts.php promjeni
substr($commentsA[$x],0,11) == "http://www."
u
substr($commentsA[$x],0,7) == "http://"

imas na valjda 4 mjesta ...

_________________
Let Your Bookmarks Define You ..
Back to top
View user's profile Send private message
JBR



Joined: 07 Sep 2003
Posts: 44
Location: zlovenie

PostPosted: 18.12.2005 12:51    Post subject: Add user to your forum ignore list Reply with quote

Hmm, da to sam i ja probavao prije, ali ako to uradim i upišem samo 'www.blah.bla' u shout tekst, onda mi to neče linkat...znači, kad neko upiše 'http://' ili 'www.' ili 'http://www.', to mi treba da se linka...probat ču sutra, nisam siguran, tako da sad govorim iz glave...
tx enivej...

_________________
Ni vsaka shkoljka shkoljka...
Back to top
View user's profile Send private message Send e-mail
scip



Joined: 19 May 2005
Posts: 25
Location: osijek

PostPosted: 18.12.2005 17:06    Post subject: Add user to your forum ignore list Reply with quote

tako linka sve sto pocinje sa www. ili http:// (ovo ukljucuje i http://www.) ; samo zamijeni sva 4.

_________________
Let Your Bookmarks Define You ..
Back to top
View user's profile Send private message
JBR



Joined: 07 Sep 2003
Posts: 44
Location: zlovenie

PostPosted: 20.12.2005 12:56    Post subject: Add user to your forum ignore list Reply with quote

ok, probat ču, al me net j#$%, tako da za nekoliko dana, pa javim ovdje jel uspjelo...hvala još jednom...

_________________
Ni vsaka shkoljka shkoljka...
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group