Jump to content

scarhand

Members
  • Posts

    382
  • Joined

  • Last visited

Everything posted by scarhand

  1. i would say some of the most important things: - url rewriting to display dynamic as static - keywords in <title> tags - keywords in <h1> tags - backlinks backlinks backlinks
  2. actually its now only going to be around 200,000 and i have to insert, and it has to be 1 by 1 because its done through a for loop
  3. Your logic makes absolutely no sense. If someone has cracked the password it doesn't matter how many times you use the md5 function to protect it. Using one-way encryption one time is enough.
  4. inserting 3 things into each row 1 is a 5-30 character sentence 1 is another 5-30 character sentence 1 is a bunch of content, up to about 5000 characters
  5. will there be any major problems if i use a for loop, which could insert up to 1 million queries into the database?
  6. say i have a string like this: "joe samson is an elf - rpg gamers" and i want to get "joe samson" and "an elf" out of the string so $name = "joe samson" $class = "an elf" now the name and the class will vary. also, they could be more than 1 or 2 words in length each. i need help extracting this: "(a) is (b) - rpg gamers" $name = (a) $class = (b) would preg_replace be best for this? can i get some examples?
  7. nevermind, figured it out using file_get_contents()
  8. I'm just trying to get the content within the <title> tags, and then the content within the <body> tags. I already made a script which loops through each html file in the main directory. (there is a massive amount of pages). I'm reading up on output buffering right now.
  9. Is there a function that will allow me to do this? I want to copy the entire text contents of one of my pages and then paste them into a database. I am trying to get static page content for one of my clients sites to become editable...so I need to get his content into a database...
  10. im trying to get this code to, on form submission, check in a mysql database if their IP exists and then show a message under the submit button. if it exists, show a message under the submit button that says "you already reported this" if it doesnt exist, show a message that says "you havent reported this" heres what i have so far that doesnt work: the page with the form: <form method="post" onsubmit="sendReport(); return false;"> <input type="submit" value="Click here to report"> </form> <div id="reportmsg"></div> the javascript/ajax: function ajaxFunction() { var ajaxRequest; try { ajaxRequest = new XMLHttpRequest(); } catch (e) { try { ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { // browser does not support alert("Browser does not support Shoutbox requests."); return false; } } } return ajaxRequest; } function handleReportResponse() { if (htmlRequest.readyState==4 && htmlRequest.status==200) { document.getElementById("reportmsg").innerHTML = htmlRequest.responseText; } } function sendReport() { htmlRequest = ajaxFunction(); htmlRequest.open('POST', 'report.php'); htmlRequest.onreadystatechange = handleReportResponse; htmlRequest.send(null); } the php script: <?php include "connect.php"; // connect to the database $ip = $_SERVER["REMOTE_ADDR"]; $sql = mysql_query("SELECT * FROM reports WHERE ip='$ip'") $sql_count = mysql_num_rows($sql); if ($sql_count != 0) echo "You have already reported"; else echo "You have not reported"; ?>
  11. Try using this instead: <?php $hid_firstname = "&$hid_firstname_$i"; $hid_lastname = "&$hid_lastname_$i"; ?> should work.
  12. first off, what you have is extremely dangerous you MUST use mysql_real_escape_string for any $_POST values unless you have gone through lengths that ensures characters entered could not be malicious secondly, youre using 2 different variables. "$Type" is NOT the same as "$type". variables are case sensitive, that is why it is not working.
  13. session_start(); must be at the top of EVERY script
  14. copy and paste the contents of that web site into a text file and have the text file become an array using some simple php code laziness gets you nowhere when it comes to programming
  15. i have made some improvements: <?php $ref = $_SERVER['HTTP_REFERER']; $url = explode("/",$ref); $surl = $url[2]; $found = ereg('\www.',$surl); if ($found) $url = $surl; else $url = "www.$surl"; if (!empty($surl) && $url != "www.mysite.com") { $sql = mysql_query("SELECT * FROM referer WHERE url='$ref'"); $sql_count = mysql_num_rows($sql); if ($sql_count == 1) { mysql_query("UPDATE referer SET hits=hits+1 WHERE url='$ref'"); } else { mysql_query("INSERT INTO referer (url, hits) VALUES ('$ref', '1')"); } } ?>
  16. Can any gurus think of a better way to write this? <?php $referer = $_SERVER['HTTP_REFERER']; $preg_referer = preg_replace("/(http:\/\/(.*)\/)[\S]*/", "\\1", $referer); if (!empty($referer) && $preg_referer != "http://www.mysite.com/" && $preg_referer != "http://mysite.com/") { $sql = mysql_query("SELECT * FROM referer WHERE url='$referer'"); $sql_count = mysql_num_rows($sql); if ($sql_count != 0) { mysql_query("UPDATE referer SET hits=hits+1 WHERE url='$referer'"); } else { mysql_query("INSERT INTO referer (url, hits) VALUES ('$referer', '1')"); } } ?> basically all i want it to do is update/insert the referer into the DB as long as it doesnt come from my own URL. this works but I am wondering if there is a better way of doing it.
  17. I want them to be dynamic to the letter size. I know I can easily do it without spans, but I want it to be dynamic. Heres the finished code: CSS: .menuletter a { background: url(images/menu_letter_bg_noh.gif) repeat-x; font-weight: bold; text-align: center; color: #ffffff; text-decoration: none; line-height: 20px; cursor: pointer; display: block; } .menuletter a span { background: url(images/menu_letter_l_noh.gif) left top no-repeat; display: block; } .menuletter a span span { background: url(images/menu_letter_r_noh.gif) right top no-repeat; padding: 0px 6px 0px 6px; height: 20px; } .menuletter a:hover { background: url(images/menu_letter_bg_h.gif) repeat-x; color: #000000; } .menuletter a:hover span { background: url(images/menu_letter_l_h.gif) left top no-repeat; } .menuletter a:hover span span { background: url(images/menu_letter_r_h.gif) right top no-repeat; } HTML: <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="menuletter"><a href="guitar-tabs/1"><span><span>#</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/a"><span><span>A</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/b"><span><span>B</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/c"><span><span>C</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/d"><span><span>D</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/e"><span><span>E</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/f"><span><span>F</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/g"><span><span>G</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/h"><span><span>H</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/i"><span><span>I</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/j"><span><span>J</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/k"><span><span>K</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/l"><span><span>L</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/m"><span><span>M</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/n"><span><span>N</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/o"><span><span>O</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/p"><span><span>P</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/q"><span><span>Q</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/r"><span><span>R</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/s"><span><span>S</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/t"><span><span>T</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/u"><span><span>U</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/v"><span><span>V</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/w"><span><span>W</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/x"><span><span>X</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/y"><span><span>Y</span></span></a></td> <td class="menuletter"><a href="guitar-tabs/z"><span><span>Z</span></span></a></td> </tr> </table>
  18. try this <?php $query = "INSERT INTO jtablegrid ($tmp_name) VALUES ('$link')"; ?> you can use variables inside double quotes, thats the difference between single and double quotes.
  19. yes there is a need for 2 spans the TD for the background image repeating-x, the 1 span for the top left corner, and the other span for the top right corner.
  20. No, the reason you are using tables, is because it seemed the easiest solution to implement that "seemed" to work in all browsers. But clearly it doesn't. Because FF messes up. If it doesn't work in FF, its not good. The solution? Use a floated list. This would improve search engine optimization as well. It should work IE6 +, Opera, FF, Safari, and every other darn browser that's "modernized." If you need help, just holler out. i actually ended up fixing it by using SPANs inside the <A> instead of DIVs (which was causing the problem, and also did not validate).
  21. having a problem here, the cookie doesnt seem to truly expire unless i navigate away from the page heres my code for the section of my header which handles logging out: <?php // check log out page if ($page_title1 == 'Log Out') { if (isset($_COOKIE['username']) || isset($_COOKIE['password'])) { setcookie(username, 'username', time() - 10); setcookie(password, 'password', time() - 10); } unset($_SESSION['username']); unset($_SESSION['password']); session_destroy(); } ?> now it doesn't seem to expire the cookie unless i click a link or navigate away from the log out page...any help?
×
×
  • 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.