Author Topic: intergrate light irc  (Read 2498 times)

Offline -Dave

  • Semi-Newbie
  • *
  • Posts: 16
intergrate light irc
« on: May 02, 2018, 06:31:32 AM »
hi all iam after a hand i have been away from smf for a few years and would like a hand on intergrate chat to smf  this is what i have now will this work  or do i have to redo it all again

Code: [Select]
$nick $temp;

$db_server 'localhost';
$db_name 'mngaazhv_xxxxx';
$db_user 'mngaazhv_xxxxx ';
$db_passwd 'xxxxxxxx';

$link mysql_connect($db_server$db_user$db_passwd);

$qry "SELECT id_member FROM `smf_members` WHERE member_name = '$nick'";
$result mysql_query($qry);

if(mysql_num_rows($result) > ) {
$row mysql_fetch_array($result);
$id $row['id_member'];

$qry "SELECT location, avatar, gender FROM `smf_members` WHERE id_member = " $id;
$res mysql_query($qry);

$str = array();

$row mysql_fetch_array($res);
$str["pix"] = "<img src='" $row["avatar"] . "' /><br />";
$str["location"] = "Location: " .$row["location"] . "<br />";
$str["realname"] = "Username: " $nick "<br />";

if($row["gender"]==1) {
$str["gender"] = "Gender: Male<br />";
} else if ($row["gender"]==2) {
$str["gender"] = "Gender: Female<br />";
} else {
$str["gender"] = "Gender: N/A<br />"

echo "<div style='margin: 0 auto';>";
echo $str["pix"];
echo $str["realname"];
echo $str["gender"];
echo $str["location"];
echo "</div>";


i am running 2.0.15 with ezportal  on main site
cheers dave
« Last Edit: May 02, 2018, 09:36:14 AM by Kindred »

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 59,505
  • Gender: Male
    • Kindred-999 on GitHub
Re: intergrate light irc
« Reply #1 on: May 02, 2018, 09:38:31 AM »
well, one thing that I see immediately is the mysql_connect.

That has been deprecated.

but, this script is distinctly insecure...   you should not be defining the connection information or directly connecting to the database like that.
Use SSI and the defined SMF clean SQL queries.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."