Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- include("minc.php");
- //--------------входной параметр rid rupid
- //----------------------------------------------
- // связывание записей ---> и переход вниз
- //----------------------------------------------
- //--------------------авторизация
- $sql="select * from TINFO I, TATTR A where A.AID=I.AID and A.ACC=2 and RID='$rid' order by A.AID";
- $result=mysql_query($sql);
- echo mysql_error();
- $au_ok=1;
- if (mysql_num_rows($result)!=0)
- {
- $row=mysql_fetch_array($result);
- $login_t=$row["TEXTF"];
- $row=mysql_fetch_array($result);
- $pass_t=$row["TEXTF"];
- if (($login!=$login_t) || ($pass!=$pass_t))
- {
- $au_ok=0;
- }
- //endif
- }
- //endif
- //-----------------------авторизация пароля отдела
- $sql="select TEXTF from TINFO I, TRECORDS R, TRECORDS R1, TRECTYPE RT ".
- " where I.RID=R.RID and I.ATYPE=10+RT.RTID and RT.RTID=R1.RTID ".
- " and R.RID='$rupid' and R1.RID='$rid'";
- $result=mysql_query($sql);
- echo mysql_error();
- if (mysql_num_rows($result)!=0)
- {
- $row=mysql_fetch_array($result);
- $authcode_t=$row["TEXTF"];
- if ($authcode_t!=$authcode)
- {
- print('<form action="linkrecs1.php" method="post"><table bgcolor="#D4D4D4">');
- print('<tr><td bgcolor="#E4E4E4">Код авторизации: </td><td bgcolor="#E4E4E4"><input type="password" name="authcode"></td></tr>');
- print('<input type="hidden" name="login" value='.$login.'>');
- print('<input type="hidden" name="pass" value='.$pass.'>');
- print('<input type="hidden" name="rid" value='.$rid.'>');
- print('<input type="hidden" name="rupid" value='.$rupid.'>');
- print('<tr><td bgcolor="#E4E4E4"><input type="submit" name="submit" value="сохранить"></td>');
- print('<td bgcolor="#E4E4E4"><input type="reset" name="undo"></td></tr>');
- print('</table></form>');
- $au_ok=0;
- }
- //endif
- }
- //endif
- //--------------------------Авторизация прошла успешно
- if ($au_ok==1):
- print('<body onLoad="timer()">');
- $file=fopen("title.html","r");
- $data=fread($file,2000);
- print($data);
- $file=fopen("top.html","r");
- $data=fread($file,2000);
- print($data);
- //-------------------создание связи для тек. записи
- $sql="select G.GDID from TRECORDS R, TRECORDS R1, TRECTYPE RT, TRECTYPE RT1, TGROUPDES G ".
- "WHERE R.RID='$rupid' and R1.RID='$rid' ".
- " and R.RTID=RT.RTID and R1.RTID=RT1.RTID ".
- " and G.RTID=RT.RTID and G.RTID2=RT1.RTID ";
- $result=mysql_query($sql);
- echo mysql_error();
- $row=mysql_fetch_array($result);
- $gdid=$row["GDID"];
- $sql = "SELECT GID FROM TGROUP where RID='$rupid' and GDID='$gdid'";
- $result=mysql_query($sql);
- if (mysql_num_rows($result)==0)
- {
- $sql = "INSERT INTO TGROUP VALUES(NULL,'$rupid','TEST','$gdid')";
- $result=mysql_query($sql);
- echo mysql_error();
- $sql = "UPDATE TRECORDS SET HAVEGR=1 WHERE RID='$rupid'";
- $result=mysql_query($sql);
- echo mysql_error();
- $sql="SELECT MAX(GID) as GID1 FROM TGROUP";
- $result=mysql_query($sql);
- $row=mysql_fetch_array($result);
- $gid1=$row["GID1"];
- }
- else
- {
- $row=mysql_fetch_array($result);
- $gid1=$row["GID"];
- }
- //endif
- $sql="SELECT * FROM TLINK where RID='$rid' and GID='$gid1'";
- $result=mysql_query($sql);
- if (mysql_num_rows($result)==0)
- {
- $sql = "INSERT INTO TLINK VALUES(NULL,'$rid','$gid1',0)";
- $result=mysql_query($sql);
- echo mysql_error();
- }
- //endif
- include("testsp.php");
- print('<script language="JavaScript">');
- $r_str="location.href='recinfo.php?rid=".$rid."&login=".$login."&pass=".$pass."' ;";
- print('function timer() { setTimeout("'.$r_str.'", 5);} </script>');
- print('</body>');
- endif;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement