Smileys for Web Chat Manager 2.0

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mikefoo
Forum Newbie
Posts: 5
Joined: Mon Jul 08, 2002 8:02 pm
Location: Malaysia
Contact:

Smileys for Web Chat Manager 2.0

Post by mikefoo »

Hi,
Anyone of you here is using Web Chat Manager 2.0? (http://www.webscriptworld.com/scripts/wcm.phtml) Or anyone here is interested to help me out? Please give me a source code or teach me what should I do to add in "Smiley" for the chat box. Thanks and greatly appreciate your help!!
lc
Forum Contributor
Posts: 188
Joined: Tue Apr 23, 2002 6:45 pm
Location: Netherlands

Post by lc »

I dunno much about the way webchat works but couldn't you do something like an ereg_replace(":)", "<img src=blabla", "$the_chat_line");
mikefoo
Forum Newbie
Posts: 5
Joined: Mon Jul 08, 2002 8:02 pm
Location: Malaysia
Contact:

Post by mikefoo »

Hi friend,
Thanks for your help. Anyway, I'm really too new to PHP. I used to be with HTML until I found PHP is quite powerful if associate with HTML. Anyway, can you please teach me where to include this code? Below is the script... And, thanks for your kind help!!

send.php
-----------
<?

if (file_exists("vars.php")):
include("vars.php");
endif;

?>

<HTML>
<HEAD>
<TITLE><? echo "$title"; ?></TITLE>
</HEAD>

<?
echo "<body bgcolor=\"$bgcolor\" text=\"$text\" link=\"$link\" vlink=\"$vlink\" alink=\"$alink\">";
echo "<font face=\"$font\" size=\"$size\">";
?>

<form method="post" action="main.php" target="main" onsubmit="this.chat.value=this.chatvis.value;this.chatvis.value='';this.chatvis.focus();">
<input type="hidden" name="username" value="<? echo "$username"; ?>">
<input type="hidden" name="uid" value="<? echo "$uid"; ?>">
<input type="hidden" name="msg" value="post">
<input type="hidden" name="chat" value="">
<input name="chatvis" type="text" size="50" maxlength="300">

<select name="fcolor">

<?

$cartFile = File("colors.txt");
$length = sizeof($cartFile);
$i = 0;
while ($i < $length):
$tok = strtok($cartFile[$i],"|");
$code = $tok;
$tok = strtok("|");
$color = $tok;

echo "<option value=\"$code\">$color";
$i++;
endwhile;

?>
<select>

<input type="submit" value="Send">
</form>

</BODY>
</HTML>
mikefoo
Forum Newbie
Posts: 5
Joined: Mon Jul 08, 2002 8:02 pm
Location: Malaysia
Contact:

Post by mikefoo »

Please... anyone is willing to help me? :( :cry:
User avatar
RandomEngy
Forum Contributor
Posts: 173
Joined: Wed Jun 26, 2002 3:24 pm
Contact:

Post by RandomEngy »

Post the code to main.php . This page only sends the data; it does not process it.
mikefoo
Forum Newbie
Posts: 5
Joined: Mon Jul 08, 2002 8:02 pm
Location: Malaysia
Contact:

Post by mikefoo »

Dear friends,
Thanks for your help and finally I solved the smileys problem by adding in $chat = str_replace(":))", "<img src='/chatroom/img/surprised.gif'>", $chat);

Anyway, I guess I need your help again. I want to create ranking for my members, which the ranking is controlled by me and I'll edit my member's file directly from my computer to select how many stars should he/she has. My question is, how can I make the stars display beside the Ranking column? I'll create few files like 1star.gif, 2stars.gif, 3stars.gif. Thanks and appreciate your help! Below is the code


profile.php
----------------
<?

if (file_exists("vars.php")):
include("vars.php");
endif;

?>

<html>
<head>
<title><? echo "$title"; ?></title>
</head>

<?
echo "<body bgcolor=\"$bgcolor\" text=\"$text\" link=\"$link\" vlink=\"$vlink\" alink=\"$alink\">";
echo "<font face=\"$font\" size=\"$size\">";
?>

<?
if (file_exists("users/$username.php")):
include("users/$username.php");
endif;
?>

<center>
<P>
<table width="450" border="1" cellspacing="0" cellpadding="5" bordercolor="<? echo "$bordercolor"; ?>" bordercolorlight="<? echo "$bordercolor"; ?>" bordercolordark="<? echo "$bordercolor"; ?>">
<!--DWLayoutTable-->
<tr>
<td width="115"><? echo "<font face=\"$font\" size=\"$size\" color=\"$color\">"; ?>Screen
Name:</td>
<td width="309"><? echo "<font face=\"$font\" size=\"$size\">"; ?><? echo "$username"; ?>&nbsp;</td>
</tr>
<tr>
<td><? echo "<font face=\"$font\" size=\"$size\" color=\"$color\">"; ?>Ranking
:</td>
<td><? echo "<font face=\"$font\" size=\"$size\">"; ?><? echo "$ranking"; ?>&nbsp;</td>
</tr>
<tr>
<td><? echo "<font face=\"$font\" size=\"$size\" color=\"$color\">"; ?>Name:</td>
<td><? echo "<font face=\"$font\" size=\"$size\">"; ?><? echo "$name"; ?>&nbsp;</td>
</tr>
<tr>
<td><? echo "<font face=\"$font\" size=\"$size\" color=\"$color\">"; ?>Age:</td>
<td><? echo "<font face=\"$font\" size=\"$size\">"; ?><? echo "$age"; ?>&nbsp;</td>
</tr>
<tr>
<td><? echo "<font face=\"$font\" size=\"$size\" color=\"$color\">"; ?>Sex:</td>
<td><? echo "<font face=\"$font\" size=\"$size\">"; ?><? echo "$sex"; ?>&nbsp;
</td>
</tr>
<tr>
<td><? echo "<font face=\"$font\" size=\"$size\" color=\"$color\">"; ?>Email:</td>
<td><? echo "<font face=\"$font\" size=\"$size\">"; ?><a href="mailto:<? echo "$email1"; ?>"><? echo "$email1"; ?></a>&nbsp;</td>
</tr>
<tr>
<td><? echo "<font face=\"$font\" size=\"$size\" color=\"$color\">"; ?>City:</td>
<td><? echo "<font face=\"$font\" size=\"$size\">"; ?><? echo "$city"; ?>&nbsp;</td>
</tr>
<tr>
<td><? echo "<font face=\"$font\" size=\"$size\" color=\"$color\">"; ?>Country:</td>
<td><? echo "<font face=\"$font\" size=\"$size\">"; ?><? echo "$country"; ?>&nbsp;</td>
</tr>
<tr>
<td><? echo "<font face=\"$font\" size=\"$size\" color=\"$color\">"; ?>Web
Site URL:</td>
<td><? echo "<font face=\"$font\" size=\"$size\">"; ?><? echo "<a href=\"$url\" target=\"new\">$url</a>"; ?>&nbsp;</td>
</tr>
<tr>
<td valign="top"><? echo "<font face=\"$font\" size=\"$size\" color=\"$color\">"; ?>About
Me:</td>
<td><? echo "<font face=\"$font\" size=\"$size\">"; ?><? echo "$descrip"; ?>&nbsp;
</td>
</tr>
</table>
</center>

</body>
</html>


guest.php (member file)
--------------------------
<?
$username = "guest";
$ranking = "Founder";
$user = "";
$passwd = "abcdefghijklmnop";
$pass = "";
$name = "Anonymous";
$age = "111";
$sex = "Male";
$email = "someone@abc.com";
$email1 = "someone@abc.com";
$city = "LA";
$country = "Mars";
$url = "http://nationalzoo.tk";
$descrip = "";
?>[/b]
User avatar
RandomEngy
Forum Contributor
Posts: 173
Joined: Wed Jun 26, 2002 3:24 pm
Contact:

Post by RandomEngy »

Here's a snippet that may help:

Code: Select all

<?php

function write_rating($rating)
&#123;
  $result = "";
  for( $i = 0; $i < $rating; $i++)
    $result .= "<img src="images/star.gif">";
  echo $result;
&#125;

?>
lc
Forum Contributor
Posts: 188
Joined: Tue Apr 23, 2002 6:45 pm
Location: Netherlands

Post by lc »

Just create a variable in the member's file and refer to that.

Do something like $member_stars as variable.. enter a 1, 2, or 3 as it's value and create a check where you want it to be displayed.. check like...

Code: Select all

<?php
echo "<img src=";
if ($member_stars == "1")&#123;
echo "star1.gif";
&#125;
elseif ($member_stars == "2")&#123;
echo "star2.gif";
&#125;
see?
Post Reply