Jump to content

BillyBoB

Members
  • Posts

    630
  • Joined

  • Last visited

    Never

Everything posted by BillyBoB

  1. Barand, the OP has a space in explodes first parameter.
  2. Ah I guess we learn new things everyday... I didn't know about that function.
  3. I would try something like: <?php $ex2[0] = $ex[0]; //Saving the info inside ex[0] optional $ex2[1] = $ex[1]; //Saving the info inside ex[1] optional $ex[0] = ''; $ex[1] = ''; $newstring = implode(' ', $ex); ?>
  4. http://www.quirksmode.org/js/keys.html Seriously use google.
  5. I have a completely built bbcode parser. But if you want to know how I did the [co de] part its pretty easy. I cannot post it though because it splits with their parser. [attachment deleted by admin]
  6. Actually include() is a very basic php command. If you are looking to learn php you need to look in every resource before coming to a help forum. A couple of places to look: First and foremost- http://google.com http://php.net There are many more but google and php.net are the best.... Afterthought: w3c has nothing to do with php standards.
  7. If you are still looking for your answer please try zanus' suggestion.
  8. He isn't trying to compare them. He is trying to set them while looping through the database tables. OP you should try this: <?php $query_g = "SELECT id, name, title, member_no, email FROM ithf_groups WHERE title = '$title'"; $result_g= mysql_query($query_g) or die ("Could not perform query: ".mysql_error()); while ($row_g = mysql_fetch_array($result_g)){ print $row_g['id']."-".$row_g['name']."-".$row_g['member_no']."-".$row_g['email']."<br>"; } php?>
  9. Wow can't believe I didn't catch that also..... now even I feel stupid.
  10. You are only selecting name, title, member_no, and email from your database in your query. You are trying to use id, name, member_no, and email. You are missing your id in the select.
  11. innerHTML isn't a proper way to fill in an object. innHTML is a string you cannot replace an object with a string in javascript. http://slayeroffice.com/articles/innerHTML_alternatives/ This is a great resource for what you are looking for.
  12. How are you doing a BBCODE conversion in html?
  13. RewriteRule ^browse/([a-zA-Z0-9]+)/?$ index.php?module=albums&action=$1 Try that.
  14. I'm officially going to stop coding while I'm tired. I messed up on the send variable.
  15. I am creating a chat for my upcoming game and I am trying to build the users list. Javascript: function getUsers(divId, userId) { obj = document.getElementById(divId); if (userReq.readyState == 4 || userReq.readyState == 0) { userReq.open("GET", "../includes/getUsers.php?anticache=0", true); userReq.onreadystatechange = function() { alert(userReq.readyState + " - " + userReq.status); if (userReq.readyState == 4 && userReq.status == 200) { so_clearInnerHTML(obj); var xmldoc = userReq.responseXML; var user_nodes = xmldoc.getElementsByTagName("user"); var n_users = user_nodes.length for (i = 0; i < n_users; i++) { var id_node = user_nodes[i].getElementsByTagName("id"); var name_node = user_nodes[i].getElementsByTagName("name"); var perms_node = user_nodes[i].getElementsByTagName("perms"); eDIV = document.createElement('div'); if(perms_node[0].firstChild.nodeValue==1) { eIMG = document.createElement('img'); eIMG.setAttribute('src', '../images/icons/ModHammer.jpg'); eIMG.setAttribute('alt', 'Moderator'); eDiv.appendChild(eIMG); } if(id_node[0].firstChild.nodeValue==userId) { eDiv.appendChild(document.createTextNode(name_node[0].firstChild.nodeValue)); }else{ eAnchor = document.createElement('a'); eAnchor.onclick = function() { UserPopup(event) }; eAnchor.appendChild(document.createTextNode(name_node[0].firstChild.nodeValue)); eDiv.appendChild(eAnchor); } obj.appendChild(eDiv); } } } receiveReq.send(null); alert('hi'); } uTimer = setTimeout('getUsers(\'UserNames\',\''+userId+'\')', 2000); } PHP: <?php require_once("functions.php"); require_once("objects.php"); $db = new Database("syck_polkamon"); $db->connectDB("syck","4<N#ly11TGn<"); //Send some headers to keep the user's browser from caching the response. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" ); header("Cache-Control: no-cache, must-revalidate" ); header("Pragma: no-cache" ); header("Content-Type: application/xml; charset=utf-8"); //Create the XML response. $xml = '<?xml version="1.0" ?><root>'; /*<user><id></id><name></name><perms></perms></user>*/ $i = 0; $sql = mysql_query("SELECT * FROM `chat_users`"); while($info = mysql_fetch_array($sql)) { $id[$i] = $info['id']; $i++; } $i = 0; foreach($id as $uid) { $sql = mysql_query("SELECT * FROM `user_profiles` WHERE `id` = '$uid'"); $info[$i] = mysql_fetch_array($sql); $i++; } $j = 0; $h = 0; foreach($info as $user) { $sql = mysql_query("SELECT * FROM `user_files` WHERE `id` = '$user[id]'"); $inf = mysql_fetch_array($sql); if($inf['perms']==1) { $mods[$j] = $user; $j++; }else{ $regs[$h] = $user; $h++; } } if($mods[0]) { foreach($mods as $mod) { $xml .= '<user>'; $xml .= '<id>' . $mod['id'] . '</id>'; $xml .= '<name>' . $mod['username'] . '</name>'; $xml .= '<perms>1</perms>'; $xml .= '</user>'; } } if($regs[0]) { foreach($regs as $reg) { $xml .= '<user>'; $xml .= '<id>' . $reg['id'] . '</id>'; $xml .= '<name>' . $reg['username'] . '</name>'; $xml .= '<perms>0</perms>'; $xml .= '</user>'; } } $xml .= '</root>'; echo $xml; ?> The php works fine http://syckgamingleague.com/includes/getUsers.php but for some reason the ajax isn't pulling that info.... as you can see I have it alert the status and readyState but these do not alert at all so it has to be around that line Thanks in advance
  16. WOW I feel so stupid. but atleast I figured it out... I didn't call the value of the nodes... I am soo tired and dumb.
  17. I am creating a chat script for my upcoming game and when I send for the username/time/message it fills all three variables with object HTMLCollection.. Here's the code. javascript: var sendReq = getXmlHttpRequestObject(); var receiveReq = getXmlHttpRequestObject(); var lastMessage = 0; var mTimer; function getXmlHttpRequestObject() { if (window.XMLHttpRequest) { return new XMLHttpRequest(); } else if(window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } } function getMessages(chatRoomId, divId) { obj = document.getElementById(divId); if (receiveReq.readyState == 4 || receiveReq.readyState == 0) { receiveReq.open("GET", '../includes/getMessages.php?crid=' + chatRoomId + '&lm=' + lastMessage, true); receiveReq.onreadystatechange = function() { alert(receiveReq.readyState + " - " + receiveReq.status); if (receiveReq.readyState == 4 && receiveReq.status == 200) { var xmldoc = receiveReq.responseXML; var message_nodes = xmldoc.getElementsByTagName("message"); var n_messages = message_nodes.length for (i = 0; i < n_messages; i++) { var user_node = message_nodes[i].getElementsByTagName("user"); var text_node = message_nodes[i].getElementsByTagName("text"); var time_node = message_nodes[i].getElementsByTagName("time"); lastMessage = (message_nodes[i].getAttribute('id')); eDIV = document.createElement("div"); eDIV.setAttribute("class","FullMessage"); eAnchor = document.createElement("a"); eAnchor.setAttribute("href","#"); eAnchor.setAttribute("target","_blank"); eAnchor.appendChild(document.createTextNode(user_node)); eDIV.appendChild(eAnchor); eDIV.appendChild(document.createTextNode(" (" + time_node + "): " + text_node)); obj.appendChild(eDIV); /*<div class="FullMessage"><a href="#" target="_blank">alyis</a> (9:25 AM): Hi everyone this is my first message in the chat room.</div>*/ } mTimer = setTimeout('getMessages(' + chatRoomId + ',' + divId + ');',2000); } } receiveReq.send(null); } } HTML: <body onload="scrollBottom('ChatRoom'); getMessages('1','ChatRoom');"> Second HTML peice: <div id="ChatRoom"> </div> PHP: <?php require_once("functions.php"); require_once("objects.php"); $db = new Database("syck_polkamon"); $db->connectDB("syck","4<N#ly11TGn<"); //Send some headers to keep the user's browser from caching the response. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" ); header("Cache-Control: no-cache, must-revalidate" ); header("Pragma: no-cache" ); header("Content-Type: application/xml; charset=utf-8"); //Create the XML response. $xml = '<?xml version="1.0" ?><root>'; if($_GET['lm']==0) { $sql = mysql_query("SELECT * FROM `chat_terminal` WHERE `chatid` = '$_GET[crid]' ORDER BY `timesent` DESC LIMIT 20"); while($info = mysql_fetch_array($sql)) { $xml .= '<message id="' . $info['id'] . '">'; $sql2 = mysql_query("SELECT * FROM `user_profiles` WHERE `id` = '$info[userid]'"); $info2 = mysql_fetch_array($sql2); $xml .= '<user>' . htmlspecialchars($info2['username']) . '</user>'; $xml .= '<text>' . htmlspecialchars($info['message']) . '</text>'; $time = getDBDate('g:i A', $info['timesent']); $xml .= '<time>' . $time . '</time>'; $xml .= '</message>'; } }else{ $sql = mysql_query("SELECT * FROM `chat_terminal` WHERE `chatid` = '$_GET[crid]' AND `id` > '$_GET[lm]' ORDER BY `timesent` DESC"); while($info = mysql_fetch_array($sql)) { $xml .= '<message id="' . $info['id'] . '">'; $sql2 = mysql_query("SELECT * FROM `user_profiles` WHERE `id` = '$info[userid]'"); $info2 = mysql_fetch_array($sql2); $xml .= '<user>' . htmlspecialchars($info2['username']) . '</user>'; $xml .= '<text>' . htmlspecialchars($info['message']) . '</text>'; $time = getDBDate('g:i A', $info['timesent']); $xml .= '<time>' . $time . '</time>'; $xml .= '</message>'; } } $xml .= '</root>'; echo $xml; ?> It displays: [object HTMLCollection] ([object HTMLCollection]): [object HTMLCollection] Thanks in advance.
  18. I have a popup which is named tooltip the css for it is: #tooltip { position: absolute; display: none; visibility: hidden; background-color: #1a1a1a; border: 1px solid #282828; } The HTML for it is: <div id="tooltip" onmouseout="closeTT();"></div> And the Javascript is: function tooltip(e) { obj = document.getElementById('tooltip'); obj.style.visibility = 'visible'; obj.style.display = 'block'; obj.style.backgroundcolor = '#1a1a1a'; var posx = 0; var posy = 0; posx = e.clientX + document.body.scrollLeft; posy = e.clientY + document.body.scrollTop - 5; obj.style.left = posx + "px"; obj.style.top = posy + "px"; obj.innerHTML = "Private Chat<br/>Ban"; } function closeTT() { obj = document.getElementById('tooltip'); obj.style.visibility = 'hidden'; obj.style.display = 'none'; obj.style.left = '0px'; obj.style.top = '0px'; obj.innerHTML = ""; } I am using it like: <div><a onclick="tooltip(event);">alyis</a></div> This on a click opens the tooltip just fine. I am having problems in the innerHTML when I put a <br /> in it it doesn't seem to want to break. If you would like to see it in action goto http://syckgamingleague.com/ login using the credentials Username: Test Password: test123 and click Chat at the top. Then click alyis where the users are all displayed and the popup box comes up next to your mouse. Im having one other problem also: when you scroll the page down then click the user name the popup box pops up at the top of the page instead of by your mouse...
  19. Oh yea that... I was confused I don't exactly know why it is that way I just put my form one div under the inputs... its fits in perfectly with the rest of the code and I don't get errors... I would do: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <form action="index.php"> <div> <input type="text" id="field1" name="field1" /> </div> </form> </body> </html>
  20. BillyBoB

    Frames???

    Here's what w3.org has to say about frames. "The disadvantages of using frames are: * The web developer must keep track of more HTML documents * It is difficult to print the entire page" I don't use them they aren't web 2.0 material. - in my opinion.
  21. Post a source because I haven't ever seen this information ever.
  22. It doesn't have to include block level elements. The elements you put in your script are for looks.
  23. I have a div inside a div that should align somehow to the top corner. In Firefox/IE which are the main browsers the div is automatically aligned to the bottom. In Opera/Safari the div is automatically aligned to center. I have the problem of aligning both to top. When I add a simple top: -29px it works for Firefox/IE but then it is too far for Safari/Opera. I really would like them to work for all browsers. The css is: #ChatTabs { width: 100%; height: 39px; text-align: left; } .ChatTab { width: 96px; height: 28px; background: url('../images/ChatTab.jpg') no-repeat; padding: 11px 0px 0px 21px; margin-right: 4px; float: left; } .ChatClose { display: inline; width: 5px; height: 5px; padding-right: 2px; float: right; } .CloseBtn { background: url('../images/icons/CloseUp.jpg') no-repeat; } .CloseBtn:hover { background: url('../images/icons/CloseDown.jpg') no-repeat; } The html is: <div id="ChatTabs"> <div class="ChatTab">Main Channel</div> <div class="ChatTab">alyis<div class="ChatClose"><a href="#"><img src="../images/spacer.gif" alt="Close" style="width: 5px;" class="CloseBtn"></img></a></div></div> <div class="ChatTab">fluidman<div class="ChatClose"><a href="#"><img src="../images/spacer.gif" alt="Close" style="width: 5px;" class="CloseBtn"></img></a></div></div> </div> If you would like to see a live demo then go to http://syckgamingleague.com/ and sign-in username: Test. Password: test123. Then click chat at top.
  24. AJAX isn't a language at all. Its the concept of using the XMLHttpRequest object from javascript to work with php. The language you would want to learn is PHP and Javascript those are what runs the concept of ajax. PHP isn't the only language that runs with it but PHP is the easiest to learn in my opinion. I am currently reading Beginning Ajax with PHP From Novice to Professional by Lee Babin its a pretty good book I would advise it to you. You can find the book online as well as at a book store.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.