Warning: mysql_connect(): Access denied for user 'ODBC'@'localhost' (using password: NO) in z:\home\127.0.0.1\www\zimin_feli\index.php on line 73 Could not connect PHP: <?session_start()?> <!doctype html public "-//W3C//DTD HTML 4.0//EN"> <html> <head> <title>Электронно тестирующая система: "система массового обслуживания"</title> <link type="text/css" rel="stylesheet" href="st.css"> </head> <body> <?php $ction=$HTTP_POST_VARS["action"]; if(!empty($action)) { $login=substr($HTTP_POST_VARS['login'],0,24); $login=htmlspecialchars(stripslashes($login)); $password=substr($HTTP_POST_VARS['password'],0,24); $password=htmlspecialchars(stripslashes($password)); $login=trim($login); $password=trim($password); /* Соединение, выбор БД */ mysql_connect("localhost") or die("Could not connect"); mysql_select_db("zimin") or die("Could not select database"); /* Выполнение SQL query на наличия персонны в базе данных*/ $query = "select password_person from personal where login_person like '".$login."'"; $result = mysql_query($query) or die("Query failed or bad login. Try again"); $row=mysql_fetch_row($result); /////////////////------неверен или не введен логин или пароль :-( if (strcasecmp ($row[0],$password)||(empty($password))) { ?> <div style="position:absolute; top:40%;left:40%;width:190px;height:50px;background-color:rgb(211,211,211);border:1px solid rgb(245,30,30);padding:5px;"> <META HTTP-EQUIV='Refresh' CONTENT='10'; URL='index.php'> Проверьте правильность <UL type=circle> <LI>Логина <LI>Пароля </UL> <a href="index.php">Перейти на главную страницу</a><br> </div> <? } /////////////////------усё нормально :-) if (!strcasecmp ($row[0],$password)&&(!empty($password))) { $query = "select name_person,surname_person from personal where login_person like '".$login."'"; $result = mysql_query($query) or die("Query failed or bad login. Try again"); $row=mysql_fetch_row($result); $HTTP_SESSION_VARS['username'] = $row[0]; $HTTP_SESSION_VARS['surname'] = $row[1]; } } if ((empty($action))&&(empty($HTTP_SESSION_VARS['surname']))) { ?> <br> <form action="index.php" method="POST"> <div class="layer_passport"> <input type="hidden" name="action" value="post"> <input type="text" name="login"> <br> <input type="password" name="password"> <br> <input type="submit" name="submit" value="Войти"> <br> Для регистрации пользователя вам необходимо обратиться к администратору </div> </form> <?}?> <?php /* Соединение, выбор БД */ mysql_connect("localhost") or die("Could not connect"); mysql_select_db("zimin") or die("Could not select database"); if ((!empty($HTTP_SESSION_VARS['username']))&&(!empty($HTTP_SESSION_VARS['surname']))) { echo "<img src='files\ban.jpg'>"; $query = "select id_person,name_person,surname_person,login_person,group_person from personal where login_person like '".$login."'"; $result = mysql_query($query) or die("Query failed or bad login. Try again"); $row=mysql_fetch_row($result); echo "<div class='layer_person'>"; echo "<table>"; echo ("<td>Имя: <td>".$row[1]."<br>"); echo ("<tr><td>Фамилия: <td>".$row[2]."<br>"); echo ("<tr><td>Логин: <td>".$row[3]."<br>"); echo ("<tr><td>Группа: <td>".$row[4]."<br>"); echo "</table>"; echo "<a href='test.php?start=0'>Тест 1</a><br>"; echo "<a href='test.php?start=10'>Тест 2</a><br>"; echo "<a href='test.php?start=20'>Тест 3</a><br>"; echo "<a href='test.php?start=30'>Итоговый тест</a>"; echo "<img src='files/person1.jpg'></div>"; $HTTP_SESSION_VARS['id_person'] = $row[0]; $HTTP_SESSION_VARS['username'] = $row[1]; $HTTP_SESSION_VARS['surname'] = $row[2]; $HTTP_SESSION_VARS['login'] = $row[3]; $HTTP_SESSION_VARS['group'] = $row[4]; $row=0; //// первый тест находящийся последним по списку $query = "select result_test, date_test from result1 inner join personal on result1.id_person=personal.id_person where login_person like '".$login."' and number_test=1"; $result = mysql_query($query) or die("Query failed or bad login. Try again"); while ($ro=mysql_fetch_row($result)) {$row=$ro;} echo "<div class='layer_result'><table>"; echo ("<td>Результат <td>первого теста: ".$row[0]."<tr><td>дата сдачи <td>".$row[1]); $HTTP_SESSION_VARS['result_test_1'] = $row[0]; @ $row[0]=""; @ $row[1]=""; $query = "select result_test, date_test from result1 inner join personal on result1.id_person=personal.id_person where login_person like '".$login."' and number_test=2"; $result = mysql_query($query) or die("Query failed or bad login. Try again"); while ($ro=mysql_fetch_row($result)) {$row=$ro;} echo ("<tr><td>Результат <td>второго теста: ".$row[0]."<tr><td>дата сдачи <td>".$row[1]); $HTTP_SESSION_VARS['result_test_2'] = $row[0]; @ $row[0]=""; @ $row[1]=""; $query = "select result_test, date_test from result1 inner join personal on result1.id_person=personal.id_person where login_person like '".$login."' and number_test=3"; $result = mysql_query($query) or die("Query failed or bad login. Try again"); while ($ro=mysql_fetch_row($result)) {$row=$ro;} echo ("<tr><td>Результат <td>третьего теста: ".$row[0]."<tr><td>дата сдачи <td>".$row[1]); $HTTP_SESSION_VARS['result_test_3'] = $row[0]; @ $row[0]=""; @ $row[1]=""; $query = "select result_test, date_test from result1 inner join personal on result1.id_person=personal.id_person where login_person like '".$login."' and number_test=4"; $result = mysql_query($query) or die("Query failed or bad login. Try again"); while ($ro=mysql_fetch_row($result)) {$row=$ro;} echo ("<tr><td>Результат <td>четвертого теста: ".$row[0]."<tr><td>дата сдачи <td>".$row[1]); $HTTP_SESSION_VARS['result_test_4'] = $row[0]; echo "</table></div>"; } //////////---------в типе бэг граунд для индекс пхп if ((empty($action))&&(empty($HTTP_SESSION_VARS['surname']))) { echo "<div style='{z-index:-1;position:absolute;top:50px;left:200px;}'><img src='files\ban2.jpg'></div>"; echo "<div style='{z-index:-1;position:absolute;top:300px;left:200px;}'><img src='files\ban3.jpg'></div>"; } //////////--------- ///справимся без javaScripta используя все тот же прислуувууутууй php ///------главы if ((empty($action))&&(empty($HTTP_SESSION_VARS['surname']))) { echo "<div class='layer_main2'>"; } else { echo "<div class='layer_main'>"; } $query = "select name_part from main"; $result = mysql_query($query) or die("Query failed or bad login. Try again"); $i=1; while ($row=mysql_fetch_row($result)) { echo ("<a href=fail_1.php?part=".$i.">".$row[0]."</a><br>"); $i++; } echo "<img src='files/tutorial1.jpg'></div>"; ///------ /////////-----Глосарий if ((empty($action))&&(empty($HTTP_SESSION_VARS['surname']))) { echo "<div class='layer_glossary2'> <table>"; } else { echo "<div class='layer_glossary'> <table>"; } $query = "select name_letter from glossary"; $result = mysql_query($query) or die("Qtutorial1.jpguery failed or bad login. Try again"); $i=1; while ($row=mysql_fetch_row($result)) { echo ("<td ><a href=fail_2.php?part=".$i.">".$row[0]." </a> "); if (($i%4)==0) echo "<tr>"; $i++; } echo "</table><img src='files/glos1.jpg'></div>"; ////////-------------- ////-----предостовляем права доступа к регистрационной странице if (($HTTP_SESSION_VARS['id_person']==1)&&(!empty($HTTP_SESSION_VARS['surname']))) { echo "<div style='{position:absolute; top:50px;left:500px}'><a href='registration.php'>Регистрация нового пользователя</a></div>"; } ////----- ?> </body> </html>