I only looked at the res script so far and I noticed you can cut out some duplicate code and cut down the queries by one by changing this:
Code:
if($slot[0]>-1 && $slot[0]<5)
{
$res3 = mssql_query("SELECT * FROM [dbo].[UserMaxGrow] WHERE UserUID IN (SELECT UserUID FROM dbo.Chars WHERE UserID='$login')");
$country = mssql_fetch_array($res3);
if ( $country['Country'] == 0 ) {
$res4 = mssql_query("SELECT family FROM [dbo].[Chars] WHERE charname='$toon'");
$family = mssql_fetch_array($res4);
echo "Family = $family[0] <br />";
if ( $family[0] == 0 || $family[0] == 1)
{
mssql_query("UPDATE dbo.Chars SET Del=0, Slot=$slot[0] , Map=42 , PosX=63 , PosZ=57 , DeleteDate=NULL WHERE CharName = '$toon'");
echo "$toon was successfully resurrected</font>";
}
else
echo "Faction Error: Cannot ressurect UoF toon on AoL";
}
else if( $country['Country'] == 1) {
$res4 = mssql_query("SELECT family FROM [dbo].[Chars] WHERE charname='$toon'");
$family = mssql_fetch_array($res4);
if ( $family[0] == 2 || $family[0] == 3)
{
mssql_query("UPDATE dbo.Chars SET Del=0, Slot=$slot[0] , Map=42 , PosX=63 , PosZ=57 , DeleteDate=NULL WHERE CharName = '$toon'");
echo "$toon was successfully resurrected</font>";
}
else
echo "Faction Error: Cannot ressurect AoL toon on UoF";
}
else
echo "Faction error";
}
else
echo "No slot avaliable";
To something like this:
Code:
if($slot[0]>-1 && $slot[0]<5){
$res3 = mssql_query("SELECT umg.Country, c.Family FROM [dbo].[UserMaxGrow] AS umg INNER JOIN [dbo].[Chars] AS c ON umg.UserUID = c.UserUID WHERE c.UserID = '$login' AND c.CharName = '$toon'");
$result = mssql_fetch_array($res3);
if($result['Country'] == 0 || $result['Country'] == 1){
if($result['Family'] >= 0 && $result['Family'] <= 3){
mssql_query("UPDATE dbo.Chars SET Del=0, Slot=$slot[0], Map=42, PosX=63 , PosZ=57, DeleteDate=NULL WHERE CharName = '$toon'");
echo "$toon was successfully resurrected</font>";
}else{
if($result['Family'] == 0 || $result['Family'] == 1){
echo "Faction Error: Cannot ressurect UoF toon on AoL";
}else if($result['Family'] == 2 || $result['Family'] == 3){
echo "Faction Error: Cannot ressurect AoL toon on UoF";
}
}
}else{
echo "Faction error";
}
}else{
echo "No slot available";
}
Generally it is considered bad practice to use SELECT *, because you are returning more data than you are actually using, unless you are using ALL columns. It is better to specifically ask for the columns you want.
I would suggest using joins instead of sub queries when possible as well. Take a look at my $res3 query as an example.
Also I would use dictionary indexes instead of array indexes when asking for data from query results, otherwise you are asking for trouble if the order ever changes.
How come you chose to echo some of the html, but not all of it, or vice versa?
Overall the res script looks good. It also appears to be secure also which is the most important part. I didn't actually test anything though, just browsed through the script.