Jump to content

squiblo

Members
  • Posts

    483
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by squiblo

  1. The following code is what I have already done, but I have just realised that the way I have done this will not enable me to display the online users in alphabetical order, I do not know a way how to do this. Any help or suggestions? Thanks $friend_query = mysql_query("SELECT * FROM friend_request WHERE user='{$user_id}'"); $friend_id_array = ""; while($row = mysql_fetch_assoc($friend_query)) { $friend_id = $row['friend_id']; $more_query = mysql_query("SELECT * FROM friend_request WHERE friend_id='{$user_id}'"); while($row_more = mysql_fetch_assoc($more_query)) { $more_friend_id = $row_more['user']; //all friends in an array $friend_id_array = $friend_id_array.$friend_id."/".$more_friend_id; $friend_id_array = explode('/', $friend_id_array); $friend_count = count($friend_id_array); //how many of the friends are online $online_count = 0; for($i=0;$i<$friend_count;$i++) { $query_online = mysql_query("SELECT loggedin, fname, mname, lname FROM users WHERE id='{$friend_id_array[$i]}'"); //get loggedin and names $row = mysql_fetch_assoc($query_online); $loggedin = $row['loggedin']; if($loggedin == "1") //if logged in { $online_count++; // final number off people online } } } }
  2. Check out the small attached PHP file (change file extension to HTML if you download it), open it on your web browser. I don't believe I need to explain what is wrong, other than it is a bit buggy and the moving div does not stay within limit sometimes. Thanks [attachment deleted by admin]
  3. How have you uploaded the file? simply dragged and dropped it into a folder or uploaded it using a form?
  4. Hi, anybody know of any software to help me find loop holes in my website, such as a query that could be injected or whatever, thanks
  5. Like this?.... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- saved from url=(0070)http://luke.breuer.com/tutorial/javascript-drag-and-drop-tutorial.aspx --> <style type="text/css"> .drag {border: 1px solid black; background-color: rgb(240, 240, 240); position: relative; padding: 5px; cursor: move; height:30px; width:50px} </style> <div id="ttt" style="border:1px solid red;width:300px;height:500px"> <img class="drag" src="./JavaScript Drag and Drop Tutorial_files/drag_image.png" alt="drag image"> </div> <pre id="debug">NON-draggable element clicked</pre> <script language="JavaScript" type="text/javascript"> <!-- // this is simply a shortcut for the eyes and fingers function $(id) { return document.getElementById(id); } var _startX = 0; // mouse starting positions var _startY = 0; var _offsetX = 0; // current element offset var _offsetY = 0; var _dragElement; // needs to be passed from OnMouseDown to OnMouseMove var _oldZIndex = 0; // we temporarily increase the z-index during drag var _debug = $('debug'); // makes life easier InitDragDrop(); function InitDragDrop() { document.onmousedown = OnMouseDown; document.onmouseup = OnMouseUp; } function OnMouseDown(e) { // IE is retarded and doesn't pass the event object if (e == null) e = window.event; // IE uses srcElement, others use target var target = e.target != null ? e.target : e.srcElement; _debug.innerHTML = target.className == 'drag' ? 'draggable element clicked' : 'NON-draggable element clicked'; // for IE, left click == 1 // for Firefox, left click == 0 if ((e.button == 1 && window.event != null || e.button == 0) && target.className == 'drag') { // grab the mouse position _startX = e.clientX; _startY = e.clientY; // grab the clicked element's position _offsetX = ExtractNumber(target.style.left); _offsetY = ExtractNumber(target.style.top); // bring the clicked element to the front while it is being dragged _oldZIndex = target.style.zIndex; target.style.zIndex = 10000; // we need to access the element in OnMouseMove _dragElement = target; // tell our code to start moving the element with the mouse document.onmousemove = OnMouseMove; // cancel out any text selections document.body.focus(); // prevent text selection in IE document.onselectstart = function () { return false; }; // prevent IE from trying to drag an image target.ondragstart = function() { return false; }; // prevent text selection (except IE) return false; } } function ExtractNumber(value) { var n = parseInt(value); return n == null || isNaN(n) ? 0 : n; } function OnMouseMove(e) { if (e == null) var e = window.event; if((_offsetX + e.clientX - _startX <= 300 - 60)&&(_offsetX + e.clientX - _startX >= 0)) { if((_offsetY + e.clientY - _startY <= 500 - 40)&&(_offsetY + e.clientY - _startY >= 0)) { // this is the actual "drag code" _dragElement.style.left = (_offsetX + e.clientX - _startX) + 'px'; _dragElement.style.top = (_offsetY + e.clientY - _startY) + 'px'; _debug.innerHTML = '(' + _dragElement.style.left + ', ' + _dragElement.style.top + ')'; } } } function OnMouseUp(e) { if (_dragElement != null) { _dragElement.style.zIndex = _oldZIndex; // we're done with these events until the next OnMouseDown document.onmousemove = null; document.onselectstart = null; _dragElement.ondragstart = null; // this is how we know we're not dragging _dragElement = null; _debug.innerHTML = 'mouse up'; } } //--> </script> </body></html>
  6. try... .menu a:hover { background-image:url(../images/menu_hover.jpg); margin-right:-14px;padding-bottom:10px; padding-top:8px; padding-left:7px; padding-right:7px; text-decoration:none; font-size:16px;}
  7. Also if you would like to ask me any questions about the project, please feel free to ask at any time.
  8. save the excel file as a web page, a few google searches will give you an idea what to do
  9. About Me Hi, firstly let me introduce myself. My name is Liam O'Connor and I'm 17 years old, 18 soon (quite excited) living in the UK and I've been learning how to makes websites ever since I was 16. Within the last 2 years I have taught myself (x)HTML/CSS, PHP/MySQL, JavaScript/Ajax to a good standard. I'm currently at college doing a Computing Networking and Security Extended Diploma. The Project I have been working on a website for many months now that I REALLY love doing. When ready for launch the website will be a simple social networking website that lets users communicate in groups or one-on-one, also users will be able to create chats on the topics they like to talk about and personalise them to how they like. What have I done so far? Within the last few months I have created a well working chat system that allows many users to communicate together, and many features within the chat such as emoticons, change status (online, busy, away), control of font size, sound alerts, chat comments, and a thumb rating system. What could you do? If you are interested to help develop a website like this one (for free) in your own time, please contact me and let me know a little about you and what you think you would be able to offer. There is no rush to get this project finished and put live for the world to see so there would be no pressure on you. If you are not interested in developing the website but you believe you have some wise words of wisdom please share them with me or if you believe you can help in any other way please let me know. Please check out the image below Thanks [attachment deleted by admin]
  10. This is the full php file, $user_id is from an included file session_start(); include('../../../connect.php'); include('../../../global.php'); include('../../../functions.php'); $chat = mysql_real_escape_string($_POST['data']); $query = mysql_query("SELECT * FROM chat_likes WHERE chat_name='{$chat}' AND user_id='{$user_id}'") or file_error($file_name, mysql_error()); while($row = mysql_fetch_assoc($query)) { if(mysql_num_rows($query)==1) { $user = $row['user_id']; $likes = $row['likes']; if(($user == $user_id)&&($likes == "0")) { $query = mysql_query("UPDATE chat_likes SET likes='1' WHERE chat_name='{$chat}' AND user_id='{$user_id}'") or file_error($file_name, mysql_error()); } } else { $query = mysql_query("INSERT INTO chat_likes VALUES('{$chat}', '{$user_id}', '1')") or file_error($file_name, mysql_error()); } } [attachment deleted by admin]
  11. When I echo my results, the results on screen are what I expect
  12. $query = mysql_query("SELECT * FROM chat_likes WHERE chat_name='{$chat}' AND user_id='{$user_id}'"); while($row = mysql_fetch_assoc($query)) // line 10 { // } I do not understand why I am getting this error, the table and field names are correct.
  13. Thanks DavidAM, just one thing, how do I get 'LikesVotes', 'DislikeVotes' and 'TotalVotes' into php variables
  14. Is there a built in function to remove empty array values for example: change Array ( [0] => Bob [1] => [2] => Ryan [3] => Jane ) to Array ( [0] => Bob [1] => Ryan [2] => Jane ) Thanks
  15. Unfortunately I do not know how to make a cron, so I looked for a generator, that only went down to minutes not seconds I'm not having much luck
  16. Hello, what I want to do is call a function every X seconds, I can do this when staying on 1 page without navigating off, but my problem is that I want to call the function every X seconds even if the user is moving from page to page and I do not know how this can be done. For example I want to call the function every 20 seconds, I am on the homepage for 10 seconds, then move to the help page, then I only have to wait another 10 seconds before the function is called. Any help? Thanks
  17. I'm having trouble thinking of the best way to set up a table for a like a dislike function, a user can like or dislike something but only once, they cannot like the same thing twice. What will be the best way to set up this table? The data recorded will be: Id (auto increment), thing being like, user id, like or dislike. Thanks [attachment deleted by admin]
  18. Any ideas that come to mind anybody?
  19. The session is ended but to other users the database is saying that user is still logged in.
  20. OK, I'm nearing the end of a very long chat project and I have one last hurdle to jump, I've saved this task to the near end because I thought it would be a problem as I have no idea what to do or where to start. The problem is exactly what is said in the subject title. I have looked into JavaScript options such as "onbeforeunload" but that is just BAD. The login is controlled by sessions, so when the user closes the browser, the session is ended, but data in the database says different, cookies are not an option I'm afraid. I've had an idea that if I create a special account (or a few) and always leave these accounts logged in, they can check if a user has been inactive for a certain period of time, and then run queries to change things, I know this sound odd but maybe I will not have to create these accounts but general accounts that people make will be able to do this for me, without them even knowing. Please help, any ideas, suggestions, logic or methods that you think will help will be great. Thanks.
  21. Im doing something wrong, something simple but I dont know what.... this line is just not working setInterval("read_chat(" + chatname + "," + number + ")", 500); Thanks
  22. In some codes I have seen, I have noticed an "@" before a function is called, e.g... @flush(); What is the reason for this?
  23. I recommend using "htmlentities()" before posting the data
  24. if your message contains "&" it will not work properly, it is like the start of another GET
×
×
  • 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.