Jump to content

sKunKbad

Members
  • Posts

    1,832
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by sKunKbad

  1. My son really messed up one of my computers this week. He is 4 years old, and we let him play video games online. He does pretty good, but if he gets a pop-up, or accidentally right clicks something, he just clicks the first thing he sees. He somehow messed up the user permissions or user accounts on my work PC, and I had to use system restore to get back to normal. So, I'm at home, and this PC is off limits, but I'd like to make a user account that is perfect for him. He should only be able to go to a select 3 or 4 websites, play his games, and that's it. I don't want him to be able to do anything else, but I don't know if this is possible to set up. Ideally, if his account is logged into, it would automatically bring up Firefox with his favorite website as the home page. I have looked at user accounts in the control panel, but they don't seem to offer this detail of control, unless I am missing something. I'm not a sophisticated windows guru, so I need to be pointed in the right direction. Previously I had a dual boot set-up, with Ubuntu and XP, and Ubuntu was great for him because it requires a password to do anything to the system. I'd like at least this level of control from XP. Any help is appreciated.
  2. One of the websites that I maintain is on a server where I can fopen() anything on the server. There are a few hundred websites on there, and I don't believe I should have access to go into them, but I wanted to test so that I could improve my own security. "fopening" these files reveals ALL code, even php code / asp code. Is there a way that I can protect the site I am working on from other people "fopening"? Should I contact the host and have them do something? Server is a windows server if it makes a difference. Is this bad enough to where I should change hosts?
  3. Once again, I figured out my solution. I modified an existing script that I found, and it works perfectly for me. Here is my script in case anyone should need something similar in the future: <?php $min_chars = "3"; // Min. chars that must be entered to perform the search $max_chars = "30"; // Max. chars that can be submited to perform the search $default_val = "Search"; // Default value in searchfield $limit_hits = array("5","10","25","50","100"); // How many hits should be displayed, to suppress the select-menu simply use one value in the array --> array("100") $message_1 = "Invalid Search!"; // Invalid searchterm $message_2 = "Please enter at least $min_chars characters, but not more than $max_chars characters."; // Invalid searchterm long ($min_chars/$max_chars) $message_3= "Your search results for:"; // Headline searchresults $message_4 = "Your search had no results. "; // No hits $message_5 = "results"; // Hits $message_6 = "Match case"; // Match case $no_title = "Untitled"; // This should be displayed if no title or empty title is found in file $limit_extracts = ""; // How many extratcts per file do you like to display. Default: "" --> every extract, alternative: 'integer' e.g. "3" $byte_size = "51200"; // How many bytes per file should be searched? Reduce to increase speed //ini_set("error_reporting", "2047"); // Debugger function search_headline($_POST, $message_3) { //This function simply creates the h1 header that says, "Your search results for: '.........' @$keyword=$_POST['keyword']; @$action=$_POST['action']; if($action == "SEARCH") echo "<h2 class=\"firstContent\" style=\"border:none; border-bottom:1px dashed #C3D2DC; padding-bottom:5px;\">$message_3 '<i>".htmlentities(stripslashes($keyword))."</i>'</h2>"; } function search_error($_POST, $min_chars, $max_chars, $message_1, $message_2, $limit_hits) { //This function checks that the search was of valid character length, and validates the limit specified by the form. global $_POST; @$keyword=$_POST['keyword']; @$action=$_POST['action']; @$limit=$_POST['limit']; if($action == "SEARCH") { if(strlen($keyword)<$min_chars||strlen($keyword)>$max_chars||!in_array ($limit, $limit_hits)) { echo "<p><b>$message_1</b><br />$message_2</p>"; $_POST['action'] = "ERROR"; } } } function search_dir($message_1, $message_2, $no_title, $limit_extracts, $byte_size, $_POST) { global $count_hits; @$keyword=$_POST['keyword']; @$action=$_POST['action']; @$limit=$_POST['limit']; @$case=$_POST['case']; if($action == "SEARCH") { require "menuList.inc.php"; preg_match_all("|href=\".*\"|",$menu, $matches); $pageList = array("index.php"); for ($i=1;$i<count($matches[0]);$i++){ $match = preg_split("|\"|",$matches[0]["$i"]); $pageList[] = $match[1]; } if($count_hits>=$limit) { //and stop if the limit of hits has already been reached. break; } foreach($pageList as $page){ $fd = fopen("$page", "r"); $contents = fread($fd, $byte_size); $chopped = explode("<!-- SEARCH BOUNDARY -->",$contents); $text = strip_tags($chopped[1]); $keyword_html = htmlentities($keyword); if($case) { // if match case option was selected then apply case sensitive matching or not $do=strstr($text, $keyword)||strstr($text, $keyword_html); } else { $do=stristr($text, $keyword)||stristr($text, $keyword_html); } if($do) { //if a match was found $count_hits++; // add one to the count if(preg_match_all("=<title[^>]*>(.*)</title>=siU", $contents, $titel)) { // if there is a title add the title to the $titel array if(!$titel[1][0]) $link_title=$no_title; else $link_title=$titel[1][0]; } else { $link_title=$no_title; } echo "<p class=\"itemP\"><a href=\"$page\" class=\"result\">$count_hits. $link_title</a><br />"; // Creates a link to the file $auszug = strip_tags($text); $keyword = preg_quote($keyword); $keyword = str_replace("/","\/","$keyword"); $keyword_html = preg_quote($keyword_html); $keyword_html = str_replace("/","\/","$keyword_html"); echo "<span class=\"extract\">"; if(preg_match_all("/((\s\S*){0,3})($keyword|$keyword_html)((\s?\S*){0,3})/i", $auszug, $match, PREG_SET_ORDER)); { if(!$limit_extracts) $number=count($match); else $number=$limit_extracts; for ($h=0;$h<$number;$h++) { if (!empty($match[$h][3])) printf("<i><b>..</b> %s<b>%s</b>%s <b>..</b></i>", $match[$h][1], $match[$h][3], $match[$h][4]); } } echo "</span></p>"; flush(); } fclose($fd); } @closedir($handle); } } function search_no_hits($_POST, $count_hits, $message_4) { @$action=$_POST['action']; if($action == "SEARCH" && $count_hits<1) echo "<p class=\"result\">$message_4</p>"; } search_headline($_POST, $message_3); search_error($_POST, $min_chars, $max_chars, $message_1, $message_2, $limit_hits); search_dir($message_1, $message_2, $no_title, $limit_extracts, $byte_size, $_POST); search_no_hits($_POST, $count_hits, $message_4); ?>
  4. I'm making a search script that is not database related. When a match is found for the search term, I'd like to have a listing such as: PAGE TITLE ...this is the neighboring text located near the search term. this is more text, so that people can see it in context... I have the script to the point where I can list the page titles of pages that the search term occurs in, but I'm not quite sure how to go about extracting some of the neighboring text so that people can see it in context. Any suggestions? I don't want to turn my site, which is small, into a database driven site just for search capabilites. I already have a yahoo search on the site, but would like to try to build my own. This is what I have so far: <?php //a search term for testing purposes - later to be imported via POST and validated/filtered $searchPost = "Brian's"; $searchPost = trim($searchPost); $searchText = preg_quote($searchPost); echo "$searchText<br />"; //the following code makes an array of file names to search from the menuList.inc.php require "menuList.inc.php"; preg_match_all("|href=\".*\"|",$menu, $matches); $pageList = array("index.php"); for ($i=1;$i<count($matches[0]);$i++){ $match = preg_split("|\"|",$matches[0]["$i"]); $pageList[] = $match[1]; } //This is the list of files that will be searched echo "<pre>"; print_r($pageList); echo "</pre>"; //search each file from the $pageList array, and determine if the $searchText is present foreach($pageList as $page){ $handle = fopen("$page", "r"); $contents = fread($handle, filesize($page)); $text = explode("<!-- SEARCH BOUNDARY -->",$contents); $stripped_text = strip_tags($text[1]); if(preg_match("|\b$searchText\b|i",$stripped_text)){ $found[] = $page; } } //this is the array of files in which the search term was found. echo "<pre>"; print_r($found); echo "</pre>"; ?>
  5. I'm just trying to make a non-database search for files/pages on my website. I'm not really sure if this is the way to do it, but this is the direction I'm currently headed. Feel free to make suggestions. <?php //a search term for testing purposes - later to be imported via POST and validated/filtered $searchText = "avneri"; //the following code makes an array of file names to search from the menuList.inc.php require "menuList.inc.php"; preg_match_all("|href=\".*\"|",$menu, $matches); $pageList = array("index.php"); for ($i=1;$i<count($matches[0]);$i++){ $match = preg_split("|\"|",$matches[0]["$i"]); $pageList[] = $match[1]; } //This is the list of files that will be searched echo "<pre>"; print_r($pageList); echo "</pre>"; //search each file from the $pageList array, and determine if the $searchText is present foreach($pageList as $page){ $handle = fopen("$page", "r"); $contents = fread($handle, filesize($page)); if(preg_match("|\\b$searchText\\b|i",$contents)){ $found[] = $page; } } //this is the array of files in which the search term was found. echo "<pre>"; print_r($found); echo "</pre>"; ?> menuList.inc.php: <?php $menu=<<<MENU <ul> <li class="sect first">Site Menu</li> <li class="item"><a title="Brian's Web Design - Home Page" href="http://www.brianswebdesign.com/">Home</a></li> <li class="item"><a title="Brian's recent website portfolio" href="portfolio.php">Portfolio</a></li> <li class="item"><a title="Information about Brian" href="about.php">About</a></li> <li class="item"><a title="Frequently Asked Questions" href="faq.php">FAQs</a></li> <li class="item"><a title="Contact Brian" href="contact.php">Contact</a></li> <li class="item"><a title="Get an Estimate" href="estimates.php">Get an Estimate</a></li> <li class="item"><a title="Accessibility Statement" href="accessibility.php">Accessibility</a></li> </ul> MENU; ?>
  6. I've got a preg match that works: if(preg_match("|$searchText|i",$contents)){ but if I add ^ and $ like this: if(preg_match("|^$searchText$|i",$contents)){ it stops working.
  7. There probably is, but you should post in the MySQL forum.
  8. Do you mean all in one query?
  9. Well, it's all fixed now. Like a miracle, it just works! I didn't even do anything!
  10. I have a Google Webmasters Tools account, which is verified for site ownership by placing either a meta tag in the home page, or by uploading a special file into the root directory. I have done both of these, but regardless of verification method, Google is saying that there is an error with the DNS that is preventing the verification process from being completed. What's strange is that the site had been verified for a long time, and it has only been within the last day that it lost its verification. So, I contacted my host, and they said: His response sounded like the issue should have been resolved, but Google will still not let me verify. I used a free online DNS checker, and it seemed to show that the DNS was ok. Domain I checked was www.tv-sewingcenter.com . I guess I'm wondering if anyone else has run into a problem like this, or if anyone with real DNS experience can tell me what's wrong with the DNS. The website itself is still functioning perfectly... So all of this got me worrying about whether or not the search results for the site would be effected by this DNS issue. The site has good search results for all of the searches we would feel are important, and it would be devastating to our small business if the site was taken out of the search results because Google no longer sees it. Any advice or insight is appreciated.
  11. Making a picture gallery is simple. While I don't have the 12 images, try this code that has background colors to simulate the pictures: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head><title>Another Experiment</title> <style type="text/css"> #centering { width:800px; margin:0px auto; } #wrapper { float:left; width:800px; } .image { float:left; width:200px; height:200px; } </style> </head> <body> <div id="centering"> <div id="wrapper"> <div class="image" style="background-color:red;"> </div> <div class="image" style="background-color:green;"> </div> <div class="image" style="background-color:yellow;"> </div> <div class="image" style="background-color:blue;"> </div> <div class="image" style="background-color:black;"> </div> <div class="image" style="background-color:pink;"> </div> <div class="image" style="background-color:white;"> </div> <div class="image" style="background-color:red;"> </div> <div class="image" style="background-color:green;"> </div> <div class="image" style="background-color:yellow;"> </div> <div class="image" style="background-color:blue;"> </div> <div class="image" style="background-color:black;"> </div> </div> </div> </body> </html>
  12. I added this: style="display:block; width:300px; overflow:hidden;" to the td where the longest hyperlink resides, and it worked for me in FF2. 300px is just an example. You'd be better off giving each td a class, so that you can apply the style in an internal or external style sheet.
  13. use a standard link, but use a javascript onclick event with window.location=""
  14. The origin of my name goes way back to my very first AOL screenname, which was probably 15 years ago now. I no longer use AOL, but the skunk legacy lives on. The last letter has been changed though. The original name was "skunkbag", which would reference a container of marijuana. When I decided to go completely sober (>7 years ago), I changed the name. At that time, I no longer felt that it was appropriate to have a name that sounded like I was a drug user. Skunk(.*) has always been my choice of screen names and account names. It's easy to remember, both for me and the people that I chat with/communicate with. Variations have been skunk, skunk4Christ, sKunK007, and skunkBrian, but I currently only use skunkbad.
  15. Having an understanding of OOP, and php5's built in classes, is essential in my opinion. Also, there are so many free classes floating around out there, that not knowing how to use them is a real disadvantage to a beginner.
  16. foreach ($oldArray as $key => $value){ $newArray[] = $value; }
  17. You can use a simple ajax request. Search around for "ajax basics".
  18. echo $new_cats instead of $cats on your test page or after return.
  19. Solved my own problem. I needed to place extra php.ini files into certain directories that were not inheriting the php.ini in the root.
  20. When doing ajax requests, you must make sure they are going to the same domain. www.yourdomain is a different domain than the non-www version according to FF. I had problems with this once, and this was the case.
  21. I have commented out the default charset in my php.ini file and have also added AddDefaultCharset Off to an .htaccess file but for some reason a charset is being added to the header. Any ideas?
  22. $_SESSION['cart'][2][] = 'some option'; will add 'some option' to the product in the array shown. I would create an options array inside the product array, that way you can loop through the options when outputting: $pid = 1; $_SESSION['cart']["$pid"]['options'][] = 'chrome'; $_SESSION['cart']["$pid"]['options'][] = 'gold plated'; $_SESSION['cart']["$pid"]['options'][] = 'diamond encrusted'; check the array with print_r(), and you will see that they have been added to the product options array
  23. My first hand experience with variable variables was that I was in here a while back trying to use them and it was said that it couldn't be done...
  24. can you paste the formatted print_r. Until I fixed it, the output wasn't in pre tags. Take a look up there ^
  25. Nothing would surprise me with the hosting issues I've dealt with lately.
×
×
  • 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.