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
<?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) > 0 ) {
$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
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.