Jump to content

turkman

Members
  • Posts

    154
  • Joined

  • Last visited

    Never

Everything posted by turkman

  1. Im not sure the standard way of doing it. I mean would you create a seperate function for each of the seperate divs? what i imagine that way to be is, Is that the stanard way of doing it? <span id = 'pace_value'>10</span> <a href = 'javascript:updatePace()'> <img src = "plus.gif"></a> <span id = 'Shooting_value'>10</span> <a href = 'javascript:updateShooting()'> <img src = "plus.gif"></a> <span id = 'Tackling_value'>10</span> <a href = 'javascript:updateTackling()'> <img src = "plus.gif"></a>
  2. I want to have a table or divs, each table or div has a number and a plus and minus button. The amount of rows in the table or div can change. If you press a plus the number goes up and a minus makes the number go down. It seems like a waiste to make the jquery update all the divs or table rows for the sake of updating 1 number. But it seems overly complex to give them all a unique div id and only have that single div updated when the plus is clicked. Whats the standard way of doing this example layout Pace: 10 + - Shooting: 12 + - Control: 5 + - Rather than having the whole table printed by the ajax call, is there a way to update just the number in the row of the + or - clicked Hope that makes sense.
  3. i can host it online if you want, give me a sec. http://www.imgboard.co.uk/stupid_css/
  4. Ive tried lots of different fonts, with and without quotes. Im hosting it on my ubuntu apache server, whats really weird is that font-family works on other sites i have store on it i.e var/www/site1 - works var/www/site2 does not work ive been trying to get firbug to work, but it wont show up when i install it. I have tried troubleshooting it, but cant figure out whats wrong with it. I have web developer, but not sure if that can be used. Also ive tried adding font-family into the divs, does not work there either.
  5. Have this very basic css page and a very basic html page, however font-family isnt working in the body bracket. No matter what i change it too, the text remains the same. If i add monospace on the end, the text becomes monospaced and all the other styles work ok, its just not the font-family. I have no idea why. a{ color:#0099CC; } #notice_bar{ background-color: #2088B2; padding: 20px; color: #FFFFFF; } #notice_bar a{ font-weight: bold; color: #006699; } #page_wrapper{ width: 100%; margin: 20px; } #page_header{ height: 50px; font-size: 20pt; text-align: center; } #left_side{ width: 20%; padding: 10px; float: left; } #middle_bit{ width: 60%; padding: 10px; float: left } #right_side{ width: auto; padding: 10px; float: left; } body{ color: #555555; font-size: 9pt; font-family: "Verdana"; }
  6. I made a bot, that scrapes content from a forum, i cant access the forum in work, so am trying to make something discreat to read it on my own site while at work. Anyway the links to threads are something like this. I got help and i know how to extract the unique thread number using regex. However i have a problem. What i really need, now that i think about it, is a way of getting the thread number and the thread title (so i can make sense of what im reading.) The thread title is in the setWindowStatus function. I cant think of a way to do it. I dont even know if it would work in an array what id basically like is something that says 1) Thread title - Thread id 2) Thread title - Thread id etc that is stored in a way that i can easily manipulate. <img src="http://s2.images.proboards.com/xx.gif" alt=" " border="0"/></font></td><td class="windowbg" bgcolor="FFFFFF" width="48%" style="cursor:pointer;" onClick="if(!pb_bubble)location.href='/index.cgi?board=general&action=display&thread=13483';" onMouseOver="mouseOverHighlightCell(this);setWindowStatus('Lurkers, show your face ');return true;
  7. using curl, ive managed to get my program to log me into a proboards site. I can view the main forum page. The problem is, the links to viewing the page is something like href="index.cgi?board=general&thread=1111&page=45" I did a str_replace to replace the index.cgi to href= "link_processor?board=general&thread=1111&page=45" The idea was that link_processor would contain the data "board=general&thread=1111&page=45" However, i now realise that the way the php would see that as 4 different get variables link processor = board=general thread = 1111 page = 45 How could i make it all part of the link_processor variable because if i can keep the string intact, i just have to pass it to a curl function and i can display the page easily!
  8. In the source of a webpage, i have lots of data including about 40 lines similar to this. I want to extract the number of &thread= each time this line appears and store them all in an array. onClick="if(!pb_bubble)location.href='/index.cgi?board=general&action=display&thread=13377';
  9. I got it working anyway. I still have a small problem. I used HTTP live headers firefox extension to capture the headers when i start a thread. I brings back something like this -----------------------------12249266671528 Content-Disposition: form-data; name="title" Filme 2010, filme 2009, filme noi, programe TV, program cinema, premiere cinema, trailere filme - CineMagia.ro -----------------------------12249266671528 Content-Disposition: form-data; name="category" 3 -----------------------------12249266671528 Content-Disposition: form-data; name="tags" filme, programe tv, program cinema -----------------------------12249266671528 Content-Disposition: form-data; name="bodytext" Filme 2010, filme 2009, filme noi, programe TV, program cinema, premiere cinema, trailere filme -----------------------------12249266671528 Content-Disposition: form-data; name="trackback" -----------------------------12249266671528 Content-Disposition: form-data; name="url" http://cinemagia.ro -----------------------------12249266671528 Content-Disposition: form-data; name="phase" 2 -----------------------------12249266671528 Content-Disposition: form-data; name="randkey" 9510520 -----------------------------12249266671528 Content-Disposition: form-data; name="id" 17753 -----------------------------12249266671528-- how do you use curl to post data like that? Usually i just use name=blah&message=blah i dont know how to emulate this Content disposition stuff.
  10. There is a proboards site i like to visit. However, its been blocked at my work. I was trying to find a way of logging into it via my site and using that to read the proboards site. I dont really need to post or anything, just something to read when i get bored. I want to keep the name of the site secret. However this is my code. Note: When i run the code i get a blank page. Nothing at all happens. <?PHP function login($website,$username,$password){ $post_data = array( "action" => "login2", "minutes" => "-1", "username" => $username, "password" => $password, ) Post_thread($website,$post_data); } function Post_thread($url,$post_data){ $options = array( CURLOPT_COOKIEJAR => "/tmp/cookies.txt", // where we store the cookie. CURLOPT_COOKIEFILE => "/tmp/cookies.txt", // to pass the cookie if we need too. CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => false, // don't return headers CURLOPT_FOLLOWLOCATION => true, // follow redirects CURLOPT_ENCODING => "", // handle all encodings CURLOPT_USERAGENT => "spider", // who am i CURLOPT_AUTOREFERER => true, // set referer on redirect //CURLOPT_REFERER => $url, //spoof the referer CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect CURLOPT_TIMEOUT => 120, // timeout on response CURLOPT_MAXREDIRS => 10, // stop after 10 redirects CURLOPT_POST => true, // we want to post some data CURLOPT_POSTFIELDS => $post_data, //array of what we want to post ); $ch = curl_init( $url ); curl_setopt_array( $ch, $options ); $content = curl_exec( $ch ); echo $content; $errmsg = curl_error( $ch ); echo $errmsg; } login("http://randomproboardssite.proboards.com","username","secretpassword"); ?>
  11. Hey guys this is my code. Basically what i want to happen is, i want the page to display with the last 10 results (which works) Then there is a button that when clicked should activate jQuery/AJAX and that should call display_full_results() which should update the #changeme div. Firstly, it does not show errors. Ive no idea how to debug jQuery. Secondly i don't know if you can call jQuery on a function on the same page. Thirdly, i don't know if you can stick a div in the middle of a table like i have done or will that cause it to error. I've no idea, any help would be appreciated. <?php session_start(); include $_SERVER['DOCUMENT_ROOT'] ."/includes/functions.php"; include $_SERVER['DOCUMENT_ROOT'] ."/includes/displays.php"; function display_recent_posts_by_user($userid){ $res = mysql_query("SELECT * FROM b WHERE scookie = '$userid' ORDER BY ID DESC LIMIT 10") or die(mysql_error()); while($row = mysql_fetch_array($res)){ echo "<tr><td>".substr(stripslashes($row['message']),0,100) ."</td> <td>".how_long_ago($row['Lastpost'])."</td></tr>"; } } function display_full_results($userid){ $res = mysql_query("SELECT * FROM b WHERE scookie = '$userid' ORDER BY ID DESC ") or die(mysql_error()); while($row = mysql_fetch_array($res)){ echo "<tr><td>".substr(stripslashes($row['message']),0,100) ."</td> <td>".how_long_ago($row['Lastpost'])."</td></tr>"; } } if($_SESSION['lv'] <4){ add_notice("Unauthorised access attempt."); echo "<script>location.href = 'http://www.imgboard.co.uk'</script>"; die(); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-type" content="text/html;charset=UTF-8" /> <meta name="robots" content="noarchive" /> <link rel="stylesheet" type="text/css" href="http://www.imgboard.co.uk/style/blue.css"> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> <script type="text/javascript"> $("#button").click( function() { $.post("info.php", { fullresults: $("#scookie").val() }, function(data){ $("#changeme").html(data); } ) ; } ); </script> </head> <body> <div id = "wrapper"> <table cellspacing = '0'> <th class = 'label'> Post </th> <th class = 'label'> When </th> <div id = "changeme"> <?PHP if(isset($_GET['onuser'])){ $usid = protect($_GET['onuser']); display_recent_posts_by_user($usid); echo "<tr class = 'nohighlight'><td><input type = 'button' value = 'View all posts by this user.' id= 'button'></td><td><input type = 'hidden' id = 'scookie' value = '$usid'</td></tr>"; } else if (isset($_POST['fullresults'])){ $uid = protect($_POST['fullresults']); display_full_results($uid); } ?> </div> </table> </body> </html>
  12. I got it sorted. The only problem was if i wanted to display the returned data in a div i had to use .html() instead of .val()
  13. After i couldnt get my last example to work, someone recommended i try and use jquery as it auto sorts out all i.e bugs. So i looked around and managed to piece together some code. In the example below #chatmsg is the input box #chatwindow is the div id where i want the output to go. Here is the problem. in the function update ... if i set the return data to #chatmsg .. it works and populates the input box with the data from the database every 1000 milliseconds. However if i change that to #chatwindow nothing happens. I have no idea why this happens. Also i have no idea why its causing the page to display funny. link here: http://www.imgboard.co.uk/chat-with-coon/chat.html <html> <head> <title>Coon Chat V 1.0</title> <style type="text/css"> body { padding-left:40px; background:#E3EDF5; font-family:arial;} input, textarea { font-family: arial; color:white; background:#57767F; font-size: 11pt; line-height: 25px } #content { width:1000px; text-align:left; } #chatwindow { border:1px solid #E8E8E8; padding:4px; background:#FFFFFF; color:#426A8A; width:1000px; margin: auto; height:auto; font-family:arial;line-height: 25px; font-size: 11pt; } #chatnick { color: black; background:#FFFFFF; } #chatmsg { color: black; background:#FFFFFF; } #button { background:#FFFFFF;} #cent{margin: auto; width 1000px;} #info { text-align:left; padding-left:0px; font-family:arial; } #info td { font-size:12px; padding-right:10px; color:#DFDFDF; } #info .small { font-size:12px; padding-left:10px; padding-right:0px;} #info a { text-decoration:underline; color:#426A8A; font-size: 9pt; } #info a:hover { text-decoration:underline; color:#426A8A;} .ai {font-size: 7pt; color: green; font-style: italic;} .actiontaken font-size: 9pt; color: red;} h3 {color: Orange; text-align: center;} .dat {color: grey; font-size: 8pt; padding-left: 10px;} .name {color: Orange; font-size: 11pt; padding-left: 5px; padding-top: 3px; padding-bottom: 3px; } .name a {color: black; color: black; text-decoration: underline;} #wrapper {width: 1200px; margin: auto; } </style> </head> <body> <div id = 'wrapper'> <div id="info"> Welcome to secret-ninja-coon -chat. <a href = 'http://www.imgboard.co.uk'>Return to the forum.<a> </div> <div id="content"> <div id="chatwindow"> </div> <!-- <textarea id="chatwindow" rows="19" cols="95" readonly></textarea><br> --> <div id = "cent"> <input id="chatnick" type="text" size="9" maxlength="9" > <input id="chatmsg" type="text" size="100" maxlength="150" onkeyup="keyup(event.keyCode);"> <input type="button" id = "button" value="Post" onclick="submit_msg()";><br><br></div> <br> </div> </div> </body> </html> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> <script type="text/javascript"> function cite(num){ var reply_cite = num ; document.getElementById('chatmsg').value += reply_cite; } function update() { $.post("x.php", {}, function(data){ $("#chatwindow").val(data);}); setTimeout('update()', 1000); } $(document).ready( function() { update(); $("#button").click( function() { $.post("x.php", { m: $("#chatmsg").val()}, function(data){ $("#chatwindow").val(data); $("#chatmsg").val(""); } ); } ); }); </script> </script>
  14. I assume that wasn't helpfull what i posted? I'll post the two files when i get home. I just need help getting ajax to work on I.E . The send command works and enters txt into the databse (i can read it on my phone). However the read does not display the data. So frustrating.
  15. I'm in work right now, don't have access to it. i'm wondering if this will help. in the w.php file i have if(isset($_GET['print'])){ then i just do a select from the databse to take out each row. then do a while(mysql_fetch_array($res)) echo "data"; } the page is www.imgboard.co.uk/chat-with-coon/ if you view it on i.e you can see the error yourself. I assure you i have tried to debug myself. I spent 6 hours working on this yesterday.
  16. Firstly i copied the code from this source http://www.linuxuser.at/chat/index.html This is a chat source for an ajax chat screen. It works fine on my Internet explorer. I kept the ajax completely the same, just changed the w.php file to make it read and write to a database. It works fine in chrome, mozilla etc but now wont work on Internet Explorer. I don't understand why. Here is the javascript from the original source which does work on I.E <script type="text/javascript"> /**************************************************************** * Most Simple Ajax Chat Script (www.linuxuser.at) * * Version: 3.1 * * * * Author: Chris (chris[at]linuxuser.at) * * Contributors: Derek, BlueScreenJunky (http://forums.linuxuser.at/viewtopic.php?f=6&t=17) * * * Licence: GPLv2 * ****************************************************************/ /* Settings you might want to define */ var waittime=800; /* Internal Variables & Stuff */ chatmsg.focus() document.getElementById("chatwindow").innerHTML = "loading..."; var xmlhttp = false; var xmlhttp2 = false; /* Request for Reading the Chat Content */ function ajax_read(url) { if(window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest(); if(xmlhttp.overrideMimeType){ xmlhttp.overrideMimeType('text/xml'); } } else if(window.ActiveXObject){ try{ xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try{ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ } } } if(!xmlhttp) { alert('Giving up Cannot create an XMLHTTP instance'); return false; } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState==4) { document.getElementById("chatwindow").innerHTML = xmlhttp.responseText; zeit = new Date(); ms = (zeit.getHours() * 24 * 60 * 1000) + (zeit.getMinutes() * 60 * 1000) + (zeit.getSeconds() * 1000) + zeit.getMilliseconds(); intUpdate = setTimeout("ajax_read('chat.txt?x=" + ms + "')", waittime) } } xmlhttp.open('GET',url,true); xmlhttp.send(null); } /* Request for Writing the Message */ function ajax_write(url){ if(window.XMLHttpRequest){ xmlhttp2=new XMLHttpRequest(); if(xmlhttp2.overrideMimeType){ xmlhttp2.overrideMimeType('text/xml'); } } else if(window.ActiveXObject){ try{ xmlhttp2=new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try{ xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ } } } if(!xmlhttp2) { alert('Giving up Cannot create an XMLHTTP instance'); return false; } xmlhttp2.open('GET',url,true); xmlhttp2.send(null); } /* Submit the Message */ function submit_msg(){ nick = document.getElementById("chatnick").value; msg = document.getElementById("chatmsg").value; if (nick == "") { check = prompt("please enter username:"); if (check === null) return 0; if (check == "") check = "anonymous"; document.getElementById("chatnick").value = check; nick = check; } document.getElementById("chatmsg").value = ""; ajax_write("w.php?m=" + msg + "&n=" + nick); } /* Check if Enter is pressed */ function keyup(arg1) { if (arg1 == 13) submit_msg(); } /* Start the Requests! */ var intUpdate = setTimeout("ajax_read('chat.txt')", waittime); </script> He is the javascript from my page, which works on everything but I.E <script type="text/javascript"> function cite(num){ var reply_cite = num ; document.getElementById('chatmsg').value += reply_cite; } /* Settings you might want to define */ var waittime=800; /* Internal Variables & Stuff */ chatmsg.focus() document.getElementById("chatwindow").innerHTML = "loading..."; var xmlhttp = false; var xmlhttp2 = false; /* Request for Reading the Chat Content */ function ajax_read(url) { if(window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest(); if(xmlhttp.overrideMimeType){ xmlhttp.overrideMimeType('text/xml'); } } else if(window.ActiveXObject){ try{ xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try{ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ } } } if(!xmlhttp) { alert('Giving up Cannot create an XMLHTTP instance'); return false; } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState==4) { document.getElementById("chatwindow").innerHTML = xmlhttp.responseText; zeit = new Date(); ms = (zeit.getHours() * 24 * 60 * 1000) + (zeit.getMinutes() * 60 * 1000) + (zeit.getSeconds() * 1000) + zeit.getMilliseconds(); intUpdate = setTimeout("ajax_read('w.php?print=0&x=" + ms + "')", waittime) } } xmlhttp.open('GET',url,true); xmlhttp.send(null); } /* Request for Writing the Message */ function ajax_write(url){ if(window.XMLHttpRequest){ xmlhttp2=new XMLHttpRequest(); if(xmlhttp2.overrideMimeType){ xmlhttp2.overrideMimeType('text/xml'); } } else if(window.ActiveXObject){ try{ xmlhttp2=new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try{ xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ } } } if(!xmlhttp2) { alert('Giving up Cannot create an XMLHTTP instance'); return false; } xmlhttp2.open('GET',url,true); xmlhttp2.send(null); } /* Submit the Message */ function submit_msg(){ nick = document.getElementById("chatnick").value; msg = document.getElementById("chatmsg").value; if (nick == "") { check = prompt("please enter username:"); if (check === null) return 0; if (check == "") check = "anonymous"; document.getElementById("chatnick").value = check; nick = check; } document.getElementById("chatmsg").value = ""; ajax_write("w.php?m=" + msg + "&n=" + nick); } /* Check if Enter is pressed */ function keyup(arg1) { if (arg1 == 13) submit_msg(); } /* Start the Requests! */ var intUpdate = setTimeout("ajax_read('w.php?print=0')", waittime); </script> I.E gives a runtime error at line 104 char 3 -> Which it does not have on the original page. From what i counted this is line 103 and 104 of my code. if (xmlhttp.readyState==4) { document.getElementById("chatwindow").innerHTML = xmlhttp.responseText; Which matches exactly what is on the original page. :confused:
  17. ok have a table. like the following. ID // title // ReplyToo // message ok, so its for a forum... the above are the only rows we need. ID is each posts unique identifyer. title is the tile of the topic. It will only have a title if its a new thread otherwise it has the value of blah ReplyToo is for replys to topic, it will equal the ID of the topic its replying too, if its a new topic its value will be 0 Message is the message of the topic So we might have the following ID//////title//////ReplyToo//////message 1 //////Hi there/ 0 /////////// This is a new thread 2 //////blah ///// 1 //////////// im replying to a new thread ID 1 is starting a new thread of title Hi there, notice its replytoo value is 0 ID 2 is replying to ID1 thread and because it doesn't have a title its set to blah ReplyToo is 1 because its replying to ID1 Ok now i have explained..Here is what i want. I want a query that will count the replys to each thread then order them by most replies. This means the query must find all threads with a ReplyToo value of 0 Get its ID, find and count all threads with a ReplyToo value of ID Then return them in order Thread title // num of replies.
  18. php will not automaticly update a remote webpage without being refreshed. It will show the file as it was when you last requested it, until you request it again (refresh) only then will it show the updated information. What you are thinking would require ajax. Basically you need to create a settimeout on each page to check for new databsse info using ajax, however i think this is beyond your current ability.
  19. SELECT webdb.id, webdb.writer, writer.picLoc, webdb.title FROM webdb, writer WHERE webdb.writer=writer.name and category = 'Researchworks' and language = 'Farsi' GROUP BY writer.name ORDER BY writer DESC";
  20. its not really for functionality its just more out of intrest to see how it would work... can you replace may ?'s with different elements of an array? Also if you want to pass an array to a function, how do you do it. say function acceptarray($arr) would you call that like the followin ---- acceptarray('arr1','arr2','arr3') can someone answer these for me please. Thanks.
  21. i dont think thats what i need, i know how to do the mysql stuff, i just need to know how to replace arrays... switch each ? with the corresponding word sent to format
  22. Hey i hope the title explains it enough. I'm just trying to get into classes. I am making a function to make making mysql querys easier. I pass the class the first string $db->inputstring("INSERT INTO ? (?,?) VALUES ('?','?')"); $db->format('mytable','id','name','1','ben'); Can someone tell me how the format fuction would look? Im not sure how to swap arrays.
  23. No, they would only be joined when you execute a sql join comman. SELECT * FROM tbl_a LEFT JOIN tbl_b ON tbl_a.id = tbl_b.id
  24. It would depend on how you are comparing the dates. The best way is unix timestamps. You would give the date its date value as a timestamp. Then have a variable $week = 60 * 60 *24 * 7; //seconds in a week $maxtime = $_SERVER['REQUEST_TIME'] + $week; $mintime = $_SERVER['REQUEST_TIME'] - $week; then if($timestamp > $maxtime && $timestamp < $mintime) // allow radio button.
×
×
  • 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.