if statement not working
Posted: Thu Feb 09, 2006 5:58 pm
Hi im new to this but I have this chunk of code, all of it works except my newest added if statement on line 31
which is this
here is the code, does something not look correct?
which is this
Code: Select all
if ($msfc[1]>=$min_usercount)
{Code: Select all
$min_usercount = 13000;
if (isset($_POST[Add]))
{
// check if id is integer
if (!is_numeric($_POST[intMSUserId]))
$error = "Invalid MySpace User ID";
if (is_blocked($_POST[intMSUserId]))
$error = "Your User ID has been blocked from joining the train.";
if ($error =="")
{
// check if id is already in train
$res = mysql_query("select * from users where intMSId='$_POST[intMSUserId]'");
$intrain = mysql_fetch_array($res);
if ($intrain[0] == "")
{
//$msuser = mysql_fetch_array($res);
// http://profile.myspace.com/index.cfm?fu ... dID=426705
$html = file_get_contents("http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendID=$_POST[intMSUserId]");
preg_match("/<span class=\"nametext\">(.*)<\/span>/", $html, $msname);
preg_match("/<td class=\"text\" width=\"193\" bgcolor=\"#ffffff\" height=\"75\" align=\"left\">\"(.*)\"<br>/", $html, $msdata);
preg_match("/has <span class=\"redbtext\">(\d+)<\/span> friends/", $html, $msfc);
preg_match("/(\d+) years old/", $html, $msyo);
preg_match("/ctl00_Main_ctl00_.*<img src=\"(.*)\" border=\"0\" \/><\/a>/", $html, $msimg);
preg_match('#<\s*br(?:\s*/)?>\s*((?:fe)?male)\s*<\s*br(?:\s*/)?>#is',$html,$sex);
$msdata[1] = mysql_escape_string($msdata[1]);
$msname[1] = mysql_escape_string($msname[1]);
if ($msfc[1]>=$min_usercount)
{
if ($msname[1] != "")
{
mysql_query("delete from users where intMSId='$_POST[intMSUserId]'");
$res = mysql_query("insert into users (intMSId, txtMSName, intMSAge, intMSFriends, txtMSText, txtMSImg, sex) values ('$_POST[intMSUserId]', '$msname[1]', '$msyo[1]', '$msfc[1]', '$msdata[1]', '$msimg[1]', '$sex[1]')");
$res = mysql_query("select * from users where intMSId='$_POST[intMSUserId]'");
$msuser = mysql_fetch_array($res);
} else
{
$error = "User doesnt exists";
}
} else
{
// already in the train
$error = "You are already in this train";
}
} else
{
//$error = "Invalid MySpace User ID";
}
}
}