Вот это главный скрипт, он использует мусуку, а самой базы с полями нет!!! Может поможете???
# getting the SID;
function get_sid($length = 32, $pool = \'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz_=+-Uu??Ee??OoUuOoUu\')
{
mt_srand ((double) microtime() * 1000000);
$unique_id = \'\';
for ($index = 0; $index < $length; $index++)
{
$unique_id .= substr($pool, (mt_rand()%(strlen($pool))), 1);
}
return $unique_id;
}
require(\'authenticate.php\');
$link = mysql_connect("localhost", "consul", "password") or die("Произошла фатальная ошибка");
mysql_select_db("consul") or die("Произошла фатальная ошибка");
if ($action != "")
{
if (($id_human == "") or (($id_human != "") and !(my_authent($id_human, $sid))))
{
$query = "select id_human from people where email = \'$email\'";
$result = mysql_query($query) or die("Произошла фатальная ошибка");
$row = mysql_fetch_row($result);
$id_human = $row[0];
}
if (($id_human != "") and (my_authent($id_human, $sid)))
{
$query = "update people set name=\'$name\', surname=\'$surname\', m_name=\'$m_name\', email=\'$email\', phone=\'$phone\', fax=\'$fax\', company=\'$company\', pass=\'$pass\', position=\'$position\', phone_code=\'$phone_code\', fax_code=\'$fax_code\' where id_human=$id_human";
$result = mysql_query($query) or die("Произошла фатальная ошибка");
}
else if ($id_human == "")
{
$query = "insert into people(name, surname, m_name, email, phone, fax, company, pass, position, phone_code, fax_code) values(\'$name\', \'$surname\', \'$m_name\', \'$email\', \'$phone\', \'$fax\', \'$company\', \'$pass\', \'$position\', \'$phone_code\', \'$fax_code\')";
$result = mysql_query($query) or die("Произошла фатальная ошибка");
$id_human = mysql_insert_id();
}
else
{
header("Location:
http://".$_SERVER[\'HTTP_HOST\'].dirname($_SERVER[\'PHP_SELF\'])."/anketa.php"); exit;
}
$query = "select count(*) from anketa_parts where id_human = ".$id_human;
$result = mysql_query($query) or die("Произошла фатальная ошибка");
$row = mysql_fetch_row($result);
if ($row[0] == 0)
{
for ($part = 1; $part <= 6; $part++)
{
$query = "insert into anketa_parts(id_human, part, filled) values($id_human,$part,0)";
$result = mysql_query($query) or die("Произошла фатальная ошибка");
}
}
$query = "select count(*) from anketa where id_human = ".$id_human;
$result = mysql_query($query) or die("Произошла фатальная ошибка");
$row = mysql_fetch_row($result);
if ($row[0] == 0) $query = "insert into anketa(id_human,ictypetrade,ictypeproduction,ictypefinance,ictypeconstruction,ictypeservices,ictypeother,hasbp,numbprod,hasprofprod,profprod1,profprod2,profprod3,profprod4,ventactivity1,ventactivity2,ventactivity3,ventactivity4,shitactivity1,shitactivity2,shitactivity3,shitactivity4,typemanagement,typeownership,numbworkers,numbworkplan,reasonnumbworkplan) values($id_human,\'$ictypetrade\',\'$ictypeproduction\',\'$ictypefinance\',\'$ictypeconstruction\',\'$ictypeservices\',\'$ictypeother\',\'$hasbp\',\'$numbprod\',\'$hasprofprod\',\'$profprod1\',\'$profprod2\',\'$profprod3\',\'$profprod4\',\'$ventactivity1\',\'$ventactivity2\',\'$ventactivity3\',\'$ventactivity4\',\'$shitactivity1\',\'$shitactivity2\',\'$shitactivity3\',\'$shitactivity4\',\'$typemanagement\',\'$typeownership\',\'$numbworkers\',\'$numbworkplan\',\'$reasonnumbworkplan\')";
else $query = "update anketa set ictypetrade=\'$ictypetrade\',ictypeproduction=\'$ictypeproduction\',ictypefinance=\'$ictypefinance\',ictypeconstruction=\'$ictypeconstruction\',ictypeservices=\'$ictypeservices\',ictypeother=\'$ictypeother\',hasbp=\'$hasbp\',numbprod=\'$numbprod\',hasprofprod=\'$hasprofprod\',profprod1=\'$profprod1\',profprod2=\'$profprod2\',profprod3=\'$profprod3\',profprod4=\'$profprod4\',ventactivity1=\'$ventactivity1\',ventactivity2=\'$ventactivity2\',ventactivity3=\'$ventactivity3\',ventactivity4=\'$ventactivity4\',shitactivity1=\'$shitactivity1\',shitactivity2=\'$shitactivity2\',shitactivity3=\'$shitactivity3\',shitactivity4=\'$shitactivity4\',typemanagement=\'$typemanagement\',typeownership=\'$typeownership\',numbworkers=\'$numbworkers\',numbworkplan=\'$numbworkplan\',reasonnumbworkplan=\'$reasonnumbworkplan\' where id_human=$id_human";
$result = mysql_query($query) or die("Произошла фатальная ошибка");
$query = "update anketa_parts set filled = 1 where id_human=$id_human and part = 1";
$result = mysql_query($query) or die("Произошла фатальная ошибка");
$sid = get_sid();
if (file_exists(getcwd()."/sid/$id_human.php"))
{
$fp = fopen(getcwd()."/sid/$id_human.php", "w");
ftruncate($fp, 0);
fclose($fp);
}
else
{
$f = tempnam(getcwd()."/sid", "$id_human");
rename($f, "$row[1].php");
}
$fp = fopen(getcwd()."/sid/$id_human.php", "w");
fwrite($fp, $sid);
fclose($fp);
setcookie("sid", $sid);
setcookie("id_human", $id_human, time()+3600*24*90);
if ($action == 2) {header("Location:
http://".$_SERVER[\'HTTP_HOST\'].dirname($_SERVER[\'PHP_SELF\'])."/anketa2.php"); exit;}
if ($action == "ws") {header("Location:
http://".$_SERVER[\'HTTP_HOST\'].dirname($_SERVER[\'PHP_SELF\'])."/workplace.php"); exit;}
}
else if (my_authent($id_human, $sid))
{
$query = "select company, pass, name, surname, phone, m_name, email, fax, phone_code, fax_code, position from people where id_human = $id_human";
$result = mysql_query($query) or die("Произошла фатальная ошибка");
$row = mysql_fetch_assoc($result);
$company = $row["company"];
$pass = $row["pass"];
$name = $row["name"];
$surname = $row["surname"];
$phone = $row["phone"];
$m_name = $row["m_name"];
$email = $row["email"];
$fax = $row["fax"];
$phone_code = $row["phone_code"];
$fax_code = $row["fax_code"];
$position = $row["position"];
$query = "select ictypetrade,ictypeproduction,ictypefinance,ictypeconstruction,ictypeservices,ictypeother,hasbp,numbprod,hasprofprod,profprod1,profprod2,profprod3,profprod4,ventactivity1,ventactivity2,ventactivity3,ventactivity4,shitactivity1,shitactivity2,shitactivity3,shitactivity4,typemanagement,typeownership,numbworkers,numbworkplan,reasonnumbworkplan from anketa where id_human=$id_human";
$result = mysql_query($query) or die("Произошла фатальная ошибка");
$row = mysql_fetch_assoc($result);
$ictypetrade = $row["ictypetrade"];
$ictypeproduction = $row["ictypeproduction"];
$ictypefinance = $row["ictypefinance"];
$ictypeconstruction = $row["ictypeconstruction"];
$ictypeservices = $row["ictypeservices"];
$ictypeother = $row["ictypeother"];
$hasbp = $row["hasbp"];
$numbprod = $row["numbprod"];
$hasprofprod = $row["hasprofprod"];
$profprod1 = $row["profprod1"];
$profprod2 = $row["profprod2"];
$profprod3 = $row["profprod3"];
$profprod4 = $row["profprod4"];
$ventactivity1 = $row["ventactivity1"];
$ventactivity2 = $row["ventactivity2"];
$ventactivity3 = $row["ventactivity3"];
$ventactivity4 = $row["ventactivity4"];
$shitactivity1 = $row["shitactivity1"];
$shitactivity2 = $row["shitactivity2"];
$shitactivity3 = $row["shitactivity3"];
$shitactivity4 = $row["shitactivity4"];
$typemanagement = $row["typemanagement"];
$typeownership = $row["typeownership"];
$numbworkers = $row["numbworkers"];
$numbworkplan = $row["numbworkplan"];
$reasonnumbworkplan = $row["reasonnumbworkplan"];
}
mysql_close($link);
?>
ЕвроКонсалтинГ - анкета партнера
![]("../images/c1_top.gif") |