Web Hosting Talk







View Full Version : help with php code


-Edward-
04-14-2003, 05:48 AM
Hi,

How would i change this code to allow certain users to have html rights? i want to be able to give html rights to certain people but not all!


$mesg = " ".$mesg;
$mesg = check_uppercase($mesg);
$mesg = htmlspecialchars($mesg);
$mesg = addURLS($mesg);
$mesg_parts = array();
$mesg_parts = split("<",$mesg);
for ($i=0;$i<count($mesg_parts);$i++)
{
if ($i%2)
{
list ($m_tag, $m_text) = split(">",$mesg_parts[$i]);
$mesg_parts[$i] = $m_tag.">".mesg2html($m_text);
}
else
{
$mesg_parts[$i] = mesg2html($mesg_parts[$i]);
}
}
$mesg = implode("<",$mesg_parts);


$t_color = $registered_colors[$user_color][1];
$def_color = $registered_colors[$default_color][1];
if (strpos($mesg, "/me ") == 1)
$messages_to_show[] = array("time"=>my_time(), "room_id"=>$room_id, "from"=>"","to"=>"","body"=>"<font color=\"$def_color\">$user_name " . trim(substr($mesg, 5)) . "</font>");
else
$messages_to_show[] = array("time"=>my_time(), "room_id"=>$room_id, "from"=>($colorize_nicks)?"<font color=\"$t_color\">$user_name</font>":$user_name, "to"=>$rndNumTest, "body"=>"<font color=\"$t_color\">".trim($mesg)."</font>");

$to_robot = strip_tags($mesg);
$w_rob_name = $rooms[$room_id]["bot"];
if (!$whisper) {
include($ld_engine_path."robot_get_answers.php");
}
include($engine_path."messages_put.php");
if ($mess_stat == 1 && !$error) {
$fp = fopen($data_path."mess_stat.dat", "a+");
flock($fp, LOCK_EX);
fseek($fp,0);
$normal_messages = intval(str_replace("\n","",@fgets($fp,1024)));
$private_messages = intval(str_replace("\n","",@fgets($fp,1024)));
if ($whisper)$private_messages++;
else $normal_messages++;
ftruncate($fp,0);
fwrite($fp,$normal_messages."\n".$private_messages);
fflush($fp);
flock($fp, LOCK_UN);
fclose($fp);
}
}
}

null
04-14-2003, 07:11 PM
Sorry dude, but I think nobody will answer your question because php code is too big and this will take a lot of time to answer your question. Try to offer $10 next time and you'll see how fast people will help you :D

null

digitok
04-14-2003, 08:23 PM
How is the PHP going to know which people are allowed to use HTML code?

Do you have some kind of login script / admin area?

More information please. And like null said, try offering even
a small amount of money and you'll get more responses.

Lippy
04-14-2003, 11:34 PM
Use a database to store users and passwords then use a quiery to check to see if that user has access to do those acts before allowing them to go further.