Simple Machines Community Forum

Customizing SMF => Bridges and Integrations => Topic started by: -Dave on May 02, 2018, 06:31:32 AM

Title: intergrate light irc
Post by: -Dave 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]
<?php
    $temp 
trim($_GET['nicks']);
$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);
mysql_select_db($db_name);

$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='http://www.xxxxx.com/avatars/" $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>";
}

mysql_close($link);
?>

i am running 2.0.15 with ezportal  on main site
cheers dave
Title: Re: intergrate light irc
Post by: Kindred 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.