Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Problem z deklaracją funkcji
robal94
post
Post #1





Grupa: Zarejestrowani
Postów: 150
Pomógł: 2
Dołączył: 14.06.2009
Skąd: Czestochowa

Ostrzeżenie: (0%)
-----


Witam! Mam napisaną stronę z formularzem ze skryptem który po wciśnięciu przycisku sprawdź sprawdza czy dany urzytkownik istnieje. Oto cały kod strony:
  1. $ilpoczta=0;
  2. $login=$_SESSION['login'];
  3. $zamiana = array('ą', 'Ą', 'ć', 'Ć', 'ł', 'Ł', 'ó', 'Ó', 'ś', 'Ś', 'ę', 'Ę', 'ń', 'Ń', 'ż', 'Ż', 'ź', 'Ź', 'ˆ' );
  4. $cenzura = array('^a^', '^A^', '^c^', '^C^', '^l^', '^L^', '^o^',' ^O^', '^s^', '^S^', '^e^', '^E^', '^n^', '^N^','^z^', '^Z^','^x^','^X^', '^*c*^');
  5. $tytul =str_replace( $cenzura, $zamiana, $tytul );
  6. $klucze =str_replace( $cenzura, $zamiana, $klucze );
  7. $opis =str_replace( $cenzura, $zamiana, $opis );
  8. $name='index';
  9. mysql_connect('localhost', 'epamiec_robal94', 'logika94');
  10. mysql_select_db('epamiec_epamiec');
  11. $zapytanie=mysql_query("select * FROM klucze WHERE name='$name'");
  12. while($row = mysql_fetch_array($zapytanie)){
  13. $opis= str_replace( $cenzura, $zamiana, $row['opis']);
  14. $klucze= str_replace( $cenzura, $zamiana, $row['klucze']);
  15. $tytul = str_replace( $cenzura, $zamiana, $row['tytul']);
  16. $tresc = str_replace( $cenzura, $zamiana, $row['tresc']);
  17. }
  18. $cz1 = fread(fopen("index1.php", "r"), filesize("index1.php"));
  19. $cz2 = fread(fopen("index2.php", "r"), filesize("index2.php"));
  20. $cz3 = fread(fopen("index3.php", "r"), filesize("index3.php"));
  21. $log1 = fread(fopen("log1.php", "r"), filesize("log1.php"));
  22. $log2 = fread(fopen("log2.php", "r"), filesize("log2.php"));
  23. $poczta=mysql_query("select status From poczta Where adresat='$login'");
  24. while($row = mysql_fetch_array($poczta)){
  25.  
  26. if($row['status'] == 1){
  27. $ilpoczta++;
  28. }
  29.  
  30. }
  31.  
  32.  
  33. ?>
  34. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//PL">
  35. <HTML>
  36. <HEAD>
  37. <title><?echo $tytul;?></title>
  38. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  39. <meta name="Description" content="<?echo $opis?>" />
  40. <meta name="Keywords" content="<?echo $klucze;?>" />
  41. <meta http-equiv="Content-Language" content="pl" />
  42. <meta name="Author" content="Tobiasz Boral" />
  43. <meta name="Robots" content="all" />
  44. <link rel="stylesheet" href="style.css" type="text/css" />
  45. <link rel="shortcut icon" href="gif/epamiec.ico" type="image/x-icon" />
  46. <script type="text/javascript" src="moduly.js"></SCRIPT>
  47. <script type="text/javascript">
  48. function funkcja(){
  49. var formlularz = document.forms['nowawiad'].elements['adresat'].value;
  50. var ajaxRequest;
  51.  
  52. try{
  53.  
  54. ajaxRequest = new XMLHttpRequest();
  55. } catch (e){
  56.  
  57. try{
  58. ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
  59. } catch (e) {
  60. try{
  61. ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
  62. } catch (e){
  63.  
  64. alert("Twoja ptzeglądarka nie obsługuje AJAX'a!");
  65. return false;
  66. }
  67. }
  68. }
  69.  
  70. ajaxRequest.onreadystatechange = function(){
  71. if(ajaxRequest.readyState == 4){
  72. var zmienna = ajaxRequest.responseText;
  73. if(zmienna == 0){
  74. var el;
  75. el = document.getElementById('zle');
  76. el.innerHTML = 'Uzytkownik nie istnieje!';
  77.  
  78.  
  79. }
  80. else{
  81. var el;
  82. el = document.getElementById('button');
  83. el.innerHTML = '<button type="sumbit">Wyślij</button>';
  84.  
  85. }
  86.  
  87. }
  88. ajaxRequest.open("GET", 'mysql_adresat.php?adresat='+formularz+'', true);
  89. ajaxRequest.send(null);
  90.  
  91. }
  92. </SCRIPT>
  93.  
  94. </HEAD>
  95. <BODY onLoad="onload();" >
  96. <?echo $cz1;?>
  97. <div id="logowanie">
  98. <?php
  99. if($_SESSION['status'] == 0){
  100. echo $log1;
  101. }
  102. elseif($_SESSION['status'] > 0){
  103. echo "<b css='log'>Witaj ",$login,"!</b><br><a href='skrzynka.php' css='wiad'>Wiadomości(",$ilpoczta,")</a><br>",$log2;
  104.  
  105. }
  106. ?>
  107. </div>
  108. <?echo $cz2;?>
  109. <div id="srodek">
  110. <div id="text">
  111. <form id="nowawiad" css="nowawiad" method="post" action="skrzynka.php?wyslij=1">
  112. Adresat:<input type="text" name="adresat" value="<?echo $_GET['adresat']?>"/><div id="zle"></div><br>
  113. Tytuł :<input type="text" name="tytul" size="40" /><br>
  114. <textarea name="tresc" cols="50" rows="20"> </textarea><br>
  115. <div id="button"><button type="button" onClick="funkcja();">Sprawdź</button></div>
  116. </form>
  117.  
  118.  
  119. </div>
  120. </div>
  121. <?echo $cz3;
  122.  
  123. </BODY>
  124. </HTML>


Jednak nie działa! Konsola google chrome mówi mi że funckja "funkca" jest niezdeklarowana! O co chodzi?

Edit: Dodatkowo wyświetla jeszcze: Uncaught SyntaxError: Unexpected end of input

Ten post edytował robal94 8.10.2010, 11:33:36
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 18.09.2025 - 06:42