Location: PHPKode > projects > VampMan: V:tR Character Manager > vampman-1.0.2/phpnuke/modules/charactersheet/submit.php
<?php

if ( !eregi( "modules.php", $_SERVER['PHP_SELF'] ) ) {
   die( "You can't access this file directly ..." );
}

$form_error = false;
$form_warning = false;
$giant = false;
$dwarf = false;
$size = 5;
$speed = 5;
$coilblood = 0;

$strings = $pre['string'];
$digits = $pre['digits'];


include("modules/$module_name/includes/checkvars.php");


$query1 = "INSERT INTO ".$prefix."_character_characters (charid,userid";

$query2 = "VALUES('','$userid'";



foreach( $all as $a)
{
	$query1.=",$a";
	$query2.=",'${$a}'";
}

$query1.=") ";
$query2.=")";

//echo $query1.$query2."<br>";

sql_query($query1.$query2,$dbi);
//echo mysql_error($dbi)."<br>";

$charid = mysql_insert_id ($dbi);


//echo $charid."<br>";
foreach($extra as $key => $values)
{
//echo $key."<br>";
$objectnum = ${$values['name']."num"};

if($objectnum == "")
 $objectnum = 0;

//echo $objectnum."<br>";

for($m = 0; $m < $objectnum; $m++) {
$objectname = $values['name'].$m;

$objectlist[$m][$values['name']] = ${$objectname};
if(!ctype_digit($objectlist[$m][$values['name']])) $objectlist[$m][$values['name']] = 0;
if($values['hasdots'])
{
	$objectdotname = $values['name'].'dots'.$m;
	$objectlist[$m]['dots'] = ${$objectdotname};
	if(!ctype_digit($objectlist[$m]['dots'])) $objectlist[$m]['dots'] = 0;
}

if($values['hasvalue'])
{
	$objectvaluename = $values['name'].'value'.$m;
	$objectlist[$m]['value'] = addslashes(stripslashes(${$objectvaluename}));
}





$temp = get_value($objectlist[$m][$values['name']],$values['name'],$values['name']."table");
if($temp == "Giant")
{	$giant = true;
	$size++;

}

if($temp == "Dwarf")
{
       	$dwarf = true;
		$size--;
}

if($temp == "Blood Potency")
{
	$potencymerit = $objectlist[$m]['dots'];
}


if($temp == "Coil of Blood" && $objectlist[$m]['dots'] > 0)
	$coilblood = 1;


}


for($m = 0; $m < $objectnum; $m++){
$query = "INSERT INTO ".$prefix."_character_".$values['name']."s (id,charid,".$values['name2']."id";
if($values['hasdots'])
	$query .= ",dots";
if($values['hasvalue'])
	$query .= ",value";

$query.= ") VALUES('',"
."'$charid',"
."'".$objectlist[$m][$values['name']]."'";
if($values['hasdots'])
	$query.=",'".$objectlist[$m]['dots']."'";
if($values['hasvalue'])
	$query.=",'".$objectlist[$m]['value']."'";

$query .= ")";
sql_query($query,$dbi);
//echo $query."<br>";
}






unset ($objectlist);
unset ($objectnum);

 }






if($clan != "Mortal" && $clan != "Ghoul" && $clan != "")
{
	$vampire = true;
}

if($vampire)
{
	$potency = 1;}

else {
	$potency = 0;
}

$potency += $potencymerit;

$health = $size + $stam;
$speed = $str + $dex + 5;
$willpower = $res + $comp;
$init = $dex + $comp;

if($wits < $dex)
	$defense = $wits;
else
	$defense = $dex;

switch($potency)
{


case 0:
	$maxvitae = 0;
	break;
case 1:
	$maxvitae = 10;
	break;
case 2:
	$maxvitae = 11;
	break;
case 3:
	$maxvitae = 12;
	break;
case 4:
	$maxvitae = 13;
	break;
case 5:
	$maxvitae = 14;
	break;
case 6:
	$maxvitae = 15;
	break;
case 7:
	$maxvitae = 20;
	break;
case 8:
	$maxvitae = 30;
	break;
case 9:
	$maxvitae = 50;
	break;
case 10:
	$maxvitae = 100;
	break;
}

$curvitae = $maxvitae - 1;
if($coilblood)
{
	$maxdays = $res;
}
else
{
	$maxdays = 0;
}

$vxpquery = "select xp from ".$prefix."_character_bp where bp = '$potency'";
$result = sql_query($vxpquery,$dbi);

if(!sql_num_rows($result))
	$vxp = -1;
else
	list($vxp) = sql_fetch_array($result);





$query = "UPDATE ".$prefix."_character_characters SET vampire = '$vampire', potency = '$potency',size = '$size', health = '$health', speed = '$speed', willpower = '$willpower', willpowertemp = '$willpower', init = '$init', defense = '$defense', humanity = '7',currentvitae = '$curvitae', maxvitae = '$maxvitae', dayscur = '$maxdays', daysmax = '$maxdays', pubhash = md5( CONCAT( '$charname', rand( ) ) ), vxp = '$vxp' where charid = '$charid'";
$result = sql_query($query,$dbi);
//echo $query."<br>";
//echo mysql_error();
echo _submitted."<br>"._discusswithst;


?>
Return current item: VampMan: V:tR Character Manager