[JS/PHP] Hulp

Gestart doorShahiem0 reacties46 weergaven

1 berichten · pagina 1 van 1

Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hi,

Ik heb een chatscript maar op de een of andere manier voegt hij het niet toe in de database.
Als ik op OK druk dan gebeurt er niks, terwijl hij dat wel moet doen.

In de submit.php heb ik een query, maar daar ligt het niet aan denk ik.

Wie kan me hierbij helpen biggrin
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/class"]class[/URL] chat
[COLOR= #007700]{
    function[/COLOR] show[COLOR= #007700]([/COLOR][COLOR= #0000BB]$a[/COLOR][COLOR= #007700])
    {[/COLOR]
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$a[/COLOR][COLOR= #007700])>[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700])
        {[/COLOR]
            [COLOR= #0000BB]$a[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array_reverse"]array_reverse[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$a[/COLOR][COLOR= #007700]);[/COLOR]
            
            [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$a[/COLOR][COLOR= #007700])<[/COLOR][COLOR= #0000BB]9[/COLOR][COLOR= #007700])[/COLOR]
                [COLOR= #0000BB]$end[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$a[/COLOR][COLOR= #007700]);[/COLOR]
            [URL="http://www.php.net/else"]else[/URL]
                [COLOR= #0000BB]$end[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]9[/COLOR][COLOR= #007700];[/COLOR]
                
            [URL="http://www.php.net/for"]for[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700];[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]<[/COLOR][COLOR= #0000BB]$end[/COLOR][COLOR= #007700];[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]++)
            {[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<p><font size=2 color=red>[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$a[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</font>: [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$a[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$i[/COLOR][COLOR= #007700]][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]</p>[/COLOR][COLOR= #007700];
            }
        }
    }
    
    function[/COLOR] main[COLOR= #007700]()
    {[/COLOR]
       ?>
       <html>
       <head>
        <script language="JavaScript">
           function createRequestObject() 
           {
                 var request_;
                 var browser = navigator.appName;
                 
            if(browser == "Microsoft Internet Explorer")
            {
                 request_ = new ActiveXObject("Microsoft.XMLHTTP");
            }
            else
            {
                 request_ = new XMLHttpRequest();
            }
                 return request_;
           }
            
            var http = new Array();
            var http2 = new Array();
            
            function getInfo()
            {
            
                var curDateTime = new Date();
                http[curDateTime] = createRequestObject();
                
                http[curDateTime].open(get, efresh.php);
                
                http[curDateTime].onreadystatechange = function(){
                    if (http[curDateTime].readyState == 4) 
                    {
                        if (http[curDateTime].status == 200 || http[curDateTime].status == 304) 
                        {
                                var response = http[curDateTime].responseText;
                             document.getElementById(view_ajax).innerHTML = response;
                        }
                    }
                }
            
                 http[curDateTime].send(null);
            }
            
               function getInfo2()
            {
                var curDateTime = new Date();
                http2[curDateTime] = createRequestObject();
                http2[curDateTime].open(get, submit.php?chat=+ document.ajax.chat.value);
                http2[curDateTime].send(null);
            }
            
            function send()
            {
                 getInfo2();
                 document.ajax.chat.value=" ";
            }    
            
            function go()
            {
                 getInfo();
                 window.setTimeout("go()", 2000);
            }
            
            </script>
            </head>
            <body onLoad="go()">
                <div id="view_ajax" style="overflow = auto; width: 500px; height: 300px; border: 1px;" align="left">
                </div>
                    
                <br />
                <form action="JavaScript: send()" method="get" name="ajax">
                     <input type="text" name="chat" />&nbsp;
                     <input type="button" value="OK" onclick="send()" />
                </form>
            </body>
            </html>
        [COLOR= #0000BB]<?php[/COLOR]
        [COLOR= #007700]}
}[/COLOR]
[COLOR= #0000BB]$chat[/COLOR] [COLOR= #007700]= new[/COLOR] chat[COLOR= #007700]();[/COLOR]
[COLOR= #0000BB]$chat[/COLOR][COLOR= #007700]->[/COLOR]main[COLOR= #007700]();[/COLOR]
?>
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren