Jump to content

QuickOldCar

Staff Alumni
  • Posts

    2,972
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by QuickOldCar

  1. Do you realize that your title to the links differ from the location of the link, it's off by one, the following description belongs to the link above. Edit: Actually there's different links with different order of descriptions, they are there on the page, just not in correct orders.
  2. The session['rating'] was set to song in the above code, I fixed that, made the array a single combined and delimiter of | and added a little more to it. If you really wanted to you can create a new array, use natsort() to show highest rated songs. <?php session_start(); ?> <html> <head> <title>Song List</title> </head> <body> <form action="" method="POST"> Song: <input type="text" name="song" /> Rating: <select name="rating"> <?php foreach (range(5, 1) as $number) { echo "<option value=\"$number\">$number</option>"; } echo "</select>"; ?> <input type="submit" value="Submit!" /> </form> <?php if (isset($_POST['song']) && isset($_POST['rating'])) { $song = $_POST['song']; $rating = $_POST['rating']; if(!is_array($_SESSION['songlist'])) $_SESSION['songlist'] = array(); $_SESSION['songlist'][] = "$song|$rating";//switch to $rating|$song if using natsort() echo "Your song " . $song . " is rated " . $rating . " stars!"; } echo "<br /><br />"; print_r($_SESSION['songlist']); echo "<br /><br />"; $song_number = -1; foreach($_SESSION['songlist'] as $song_values){ $song_number = $song_number +1; $song_array = explode("|",$_SESSION['songlist'][$song_number]); $show_song = $song_array[0]; $show_rating = $song_array[1]; echo $song_number.": ".$show_song. "-" .$show_rating."<br />"; } ?> </body> </html>
  3. If it's something that is to be done once or twice a day or any timed manner, then a cron job would be better. http://en.wikipedia.org/wiki/Cron If using cpanel http://www.upstartblogger.com/how-to-create-a-cron-job-in-cpanel or from command line using editor such as vim http://adminschoice.com/crontab-quick-reference
  4. the php file you overwrote is very different from what the browsers html output is that you copied. yes it may have looked the same, but now it doesn't do any functions, you need to find the original version of the php file, it has code in it that is needed for the site to function. php runs code and generates it's final output as html, you never see the php code itself.
  5. echo '<td ><a href="' . $images . $big . $file . '" TARGET="_blank"><img src="' . $images . $file . '" /></a></td>';
  6. yup, was just gonna say implode() myself
  7. or even $afname="Gareth"; $alname="B"; $awayoption.="<OPTION VALUE='$afname $alname'>$afname $alname"; can even combine them before like this $afname="Gareth"; $alname="B"; $fullname = "$afname $alname"; $awayoption.="<OPTION VALUE='$fullname'>$fullname";
  8. Also there is no website meta description. <meta name="description" content="Designing wonderful website designs with original alaska photo landscapes for your custom website." />
  9. It's a"pretty" site. I also agree on that image strip. You can call for each image in a script to do resizing, add text and so on with GD, then save and or cache the image.
  10. I use CentOS and Ubuntu Server for my servers. For development I use appserv on a windows box. I would have to say Ubuntu is the better of the 2 due to being more popular and better support in forums if had issues. The only real reason I used CentOS was to run a hosting package that only worked on CentOS 5, Fedora 2,3,4,5,6, RHEL 5. I'd use CentOS again though. http://lxcenter.org/software/hypervm
  11. you have an extra semi-colon after date $new_date = date;( There's still more smart quotes there, open the file in a word editor such as notepad2 and you will see them. http://sourceforge.net/projects/notepad2/ Maq beat me, lol
  12. I made a slight error as I wasn't checking just the host area but the entire url. I made the changes here. For anyone wanting to use this just make a text file named urls.txt in the same folder of this script. Place the urls 1 per line. <?php //check if youtube function function checkYoutube($inserturl) { $inserturl = strtolower(trim($inserturl)); if(substr($inserturl,0,5) != "http:"){ $inserturl = "http://$inserturl"; } $parsedUrl = parse_url($inserturl); $host = trim($parsedUrl['host'] ? $parsedUrl['host'] : array_shift(explode('/', $parsedUrl['path'], 2))); $checkhost = "youtube.com"; // match if(preg_match("/$checkhost/i", $host)){ return TRUE; } else { return FALSE; } } //read a file $my_file = "urls.txt";//change file name to yours if (file_exists($my_file)) { $data = file($my_file); $total = count($data); echo "<br />Total urls: $total<br />"; foreach ($data as $line) { if($line != "" && checkYoutube($line) == TRUE){ $url = trim($line); //making sure any url has the http protocol if(substr($url,0,5) != "http:"){ $url = "http://$url"; } //using curl is better for more options, setting the timeout matters for speed versus accuracy $context = stream_context_create(array( 'http' => array( 'timeout' => 8 ) )); //get the content from url $the_contents = @file_get_contents($url, 0, $context); //alive or dead condition if (empty($the_contents)) { $status = "dead"; $color = "#FF0000"; $title = $url; } else { $status = "alive"; $color = "#00FF00"; preg_match("/<title>(.*)<\/title>/Umis", $the_contents, $title); $title = $title[1]; //$title = htmlspecialchars($title, ENT_QUOTES); //saving data to database } //show results on page echo "<a style='font-size: 20px; background-color: #000000; color: $color;' href='$url' TARGET='_blank'>$title</a><br />"; } } } else { echo "Can't locate $my_file"; } ?>
  13. What you are trying to find out is called a fragment in the url. Here explains how to do it. http://stephenmcintyre.net/blog/fragment-anchor-php/ Alternately you can use forms with a button, hidden field, GET or POST Some examples are here. http://www.w3schools.com/php/php_get.asp http://www.w3schools.com/php/php_post.asp http://www.tizag.com/phpT/postget.php
  14. I see the link was on your own server, but if it wasn't.... If the url contains multiple unknown queries or not a link on your server, you can do this. Grabs just the query, and also finds how many queries, and separates the queries and values. <?php $url = "http://www.youtube.com/watch?v=3fumBcKC6RE&feature=topvideos_music"; $url = trim($url); //add http:// if is not present if (substr($url, 0, 5) != "http:") { $url = "http://$url"; } $query_parse = parse_url($url, PHP_URL_QUERY); $query_chunk = ltrim($query_parse, "?"); $query_array = explode("&", $query_chunk); $query_number = 0; foreach($query_array as $value_chunk){ $query_number = $query_number +1; $query_value_array = explode("=", $value_chunk); $query_value[] = $query_number."|".$query_value_array[0]."|".$query_value_array[1]; } //the complete query echo $query_chunk."<br />"; //queries array foreach($query_value as $query_results){ $results = explode("|", $query_results); $number = $results[0]; $query = $results[1]; $value = $results[2]; echo "<b>$number: Query: </b>".$query."<b>Value: </b>".$value."<br />"; } ?>
  15. Here's a way I came up with. If anyone has better or faster methods tan this I'd love to hear it. I parse the url to find the host, then match against that, you could easily be finding the word youtube or youtube.com in any part of a url. Example would be: http://mysite.com/out.php?url=http://www.youtube.com/movies Stripping the protocol, exploding the / , using $variable[0], and then preg_match also works. If you want fast displaying results on a page in whatever order look into multi-curl. This is the simple method and should find most titles but not all. <?php //check if youtube function function checkYoutube($inserturl) { $inserturl = strtolower(trim($inserturl)); if(substr($inserturl,0,5) != "http:"){ $inserturl = "http://$inserturl"; } $parsedUrl = parse_url($inserturl); $host = trim($parsedUrl['host'] ? $parsedUrl['host'] : array_shift(explode('/', $parsedUrl['path'], 2))); $checkhost = "youtube.com"; // match if(preg_match("/$checkhost/i", $inserturl)){ return TRUE; } else { return FALSE; } } //read a file $my_file = "urls.txt";//change file name to yours if (file_exists($my_file)) { $data = file($my_file); $total = count($data); echo "<br />Total urls: $total<br />"; foreach ($data as $line) { if($line != "" && checkYoutube($line) == TRUE){ $url = trim($line); //making sure any url has the http protocol if(substr($url,0,5) != "http:"){ $url = "http://$url"; } //using curl is better for more options, setting the timeout matters for speed versus accuracy $context = stream_context_create(array( 'http' => array( 'timeout' => 8 ) )); //get the content from url $the_contents = @file_get_contents($url, 0, $context); //alive or dead condition if (empty($the_contents)) { $status = "dead"; $color = "#FF0000"; $title = $url; } else { $status = "alive"; $color = "#00FF00"; preg_match("/<title>(.*)<\/title>/Umis", $the_contents, $title); $title = $title[1]; //$title = htmlspecialchars($title, ENT_QUOTES); //saving data to database } //show results on page echo "<a style='font-size: 20px; background-color: #000000; color: $color;' href='$url' TARGET='_blank'>$title</a><br />"; } } } else { echo "Can't locate $my_file"; } ?>
  16. I can't even get that image with my parser, and I tried to add many exceptions and rules trying to get any type of image. Here is the link and I'll discuss the issues. <img src="RbHttpHandler.ashx?width=313&height=592&fsize=999000&format=jpg&url=http%3A%2F%2Fi.ebayimg.com%2F00%2F%24%28KGrHqN%2C%21jEE2n%28iTLozBNwBPG0bUg%7E%7E0_1.JPG%3Fset_id%3D8800005007" alt=""> Problem one: This is an internal link, there is no ./ ../ or the host before the script name, I'm sure can use some type of pattern and start from the scripts name of RbHttpHandler.ashx, but simple parser isn't going to do that. Problem two: There is no image type extension which simple parser looks for Problem three: If visit these links, You'll see it runs through a script process. http://cgi.ebay.com/RbHttpHandler.ashx?width=313&height=592&fsize=999000&format=jpg&url=http%3A%2F%2Fi.ebayimg.com%2F00%2F%24(KGrHqN%2C!jEE2n(iTLozBNwBPG0bUg~~0_1.JPG And both of these links I can't even connect to see the image. http%3A%2F%2Fi.ebayimg.com%2F00%2F%24%28KGrHqN%2C%21jEE2n%28iTLozBNwBPG0bUg%7E%7E0_1.JPG%3Fset_id%3D8800005007 http%3A%2F%2Fi.ebayimg.com%2F00%2F%24%28KGrHqN%2C%21jEE2n%28iTLozBNwBPG0bUg%7E%7E0_1.JPG I guess ebay is making every effort for people not to scrape their data and use one of their api's.
  17. This will find all the keywords in a string and count them by top keywords counted and also display in alphabetical order. If you need anything different or added...change it. <?php //string of text $text = "instein'in görelilik kuramlari ile gerçeklestigini söylemek yanlis olur. Klasik mekanik çok basarili olmasina karsin, 1800'lü yillarin sonlarina dogru, siyah cisim isimasi, tayf çizgileri, fotoelelektrik etki gibi bir takim olaylari açiklama da yetersiz kalmistir. Açiklamalarin yanlisligi bilim adamlarinin yetersizliginden degil aksine klasik mekanigin yetersizliginden kaynaklaniyordu. Klasik mekanikteki sorunun ne oldugunu anlatmak asiri teknik kaçacaktir"; //function to remove any numbers function remove_numbers($string) { $numbers = array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0"); $string = str_replace($numbers, " ", $string); return $string; } //this removes all numbers...I found numbers to be a pain $text = remove_numbers($text); //languages support for strtolower $text = mb_strtolower($text, 'UTF-8'); //any text or characters to remove from string $text = str_replace(array("~","“","»","«"."¦","_","|",";","<",">","'\'","+","||",".","-","=","!","@","#","$","%","^","&","?",";",":","\r","\n",",","*",'"',"(",")","{","}","/","//","--","—","•",'“','”',"•","..","...","..."), ' ', $text); //if any unwanted items would like to exclude from the array such as common words $unwanted_items = array ("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","an","at","as","the","for","but","you","your","or","of","on","in","he","she","is","en","la","it","no","size","align","td","to","font"); //explode the text into an array by the spaces $text_array = explode(" ",$text); //create a unique list of keywords $unique_list = array_unique($text_array); //setting a minimum and maximum length $min_length = 3; $max_length = 25; //loop through the keywords foreach($unique_list as $keyword_list){ //checks to only show which keywords make it to the final array if(strlen($keyword_list) >= $min_length && strlen($keyword_list) <= $max_length && !is_numeric($keyword_list) && $keyword_list != "" && !in_array(trim($keyword_list), $unwanted_items)) { //trim any whitespace and also rename the variable $keywords = trim($keyword_list); //count how many occurances the keyword has in the string $count = @mb_substr_count($text, $keywords); //make it a new array $counted_keywords[] = "$count|$keywords"; //if want by alphabetical order $keywords_counted[] = "$keywords|$count"; } } //natural order sort the array natsort($counted_keywords); //reverse the array...wtf....no opposite to natsort??? grrr $counted_keywords = array_reverse($counted_keywords); ?> <table border="1"> <tr> <th>Top Count</th> <th>Alphabetical Keyword</th> </tr> <tr> <td> <?php //loop the new array and display foreach($keywords_counted as $by_keyword){ if(strlen($by_keyword) >= $min_length && strlen($by_keyword) <= $max_length && !is_numeric($by_keyword) && $by_keyword != "" && !in_array(trim($by_keyword), $unwanted_items)) { $keywords = trim($by_keyword); $exploded_keywords = explode("|",$keywords); $cnt = $exploded_keywords[1]; $key = $exploded_keywords[0]; if($key != ""){ echo "$key : $cnt<br />"; } } } ?> </td> <td> <?php //sort keywords alphabetical asort($keywords_counted); //loop the keywords foreach($keywords_counted as $by_keyword){ $exploded_keywords = explode("|",$by_keyword); $cntkey = $exploded_keywords[1]; $keycount = $exploded_keywords[0]; if($key != ""){ echo "$keycount : $cntkey<br />"; } } ?> </td> </tr> </table> output would be: Top Count yetersiz : 3 klasik : 3 yetersizliginden : 2 yanlis : 2 mekanik : 2 ile : 2 aiklama : 2 yillarin : 1 yanlisligi : 1 teknik : 1 tayf : 1 takim : 1 sylemek : 1 sorunun : 1 sonlarina : 1 siyah : 1 olur : 1 olmasina : 1 oldugunu : 1 olaylari : 1 mekanikteki : 1 mekanigin : 1 kuramlari : 1 kaynaklaniyordu : 1 karsin : 1 kalmistir : 1 kaacaktir : 1 izgileri : 1 isimasi : 1 instein'in : 1 grelilik : 1 gibi : 1 gereklestigini : 1 fotoelelektrik : 1 etki : 1 dogru : 1 degil : 1 cisim : 1 bir : 1 bilim : 1 basarili : 1 asiri : 1 anlatmak : 1 aksine : 1 aiklamalarin : 1 adamlarinin : 1 Alphabetical Keyword adamlarinin : 1 aiklamalarin : 1 aiklama : 2 aksine : 1 anlatmak : 1 asiri : 1 basarili : 1 bilim : 1 bir : 1 cisim : 1 degil : 1 dogru : 1 etki : 1 fotoelelektrik : 1 gereklestigini : 1 gibi : 1 grelilik : 1 ile : 2 instein'in : 1 isimasi : 1 izgileri : 1 kaacaktir : 1 kalmistir : 1 karsin : 1 kaynaklaniyordu : 1 klasik : 3 kuramlari : 1 mekanigin : 1 mekanikteki : 1 mekanik : 2 olaylari : 1 oldugunu : 1 olmasina : 1 olur : 1 siyah : 1 sonlarina : 1 sorunun : 1 sylemek : 1 takim : 1 tayf : 1 teknik : 1 yanlisligi : 1 yanlis : 2 yetersizliginden : 2 yetersiz : 3 yillarin : 1
  18. Here's something that can read a text file, check all the urls, and place them back into text file. You will see i connect different. I placed the alive/dead in text separated with a | For lines that are merging, see the comment for when data is getting inserted for extra \n <?php //read the text file $my_file = "check-alive-urls.txt"; //name your url text file here //see if exists if (file_exists($my_file)) { //contents of text file $data = file($my_file); //total lines $total = count($data); echo "<br />Total lines: $total<br />"; //loop the data by line foreach ($data as $line) { //skip empty lines if($line != ""){ //explode lines to get each value $explode_lines = explode("|",$line); $url = trim($explode_lines[0]); $status = trim($explode_lines[1]); //making sure any url has the http protocol if(substr($url,0,5) != "http:"){ $url = "http://$url"; } //see how long it takes to connect $time_start = microtime(1); //is best to use a stream context for more options $context = stream_context_create(array( 'http' => array( 'timeout' => 3 ) )); //get the content from url $the_contents = @file_get_contents($url, 0, $context); echo "<hr>"; //alive or dead condition if (empty($the_contents)) { $status = "dead"; } else { $status = "alive"; } //define colors to status and unchecked value if($status == "dead") { $color = "#FF0000"; } elseif($status == "alive") { $color = "#00FF00"; } else { $status = "unchecked"; $color = "#C0C0C0"; } //show results on page echo "<p style='color: $color;'>$status - <a href='$url'>$url</a></p>"; //create array of urls and status for text file $save_urls[] = "$url|$status"; //end of connect time $time_end = microtime(1); $time_elapsed = $time_end - $time_start; echo printf("<br />%f seconds - ", $time_elapsed); echo "</hr>"; } } //prep to save to text file $save_to_file = implode($save_urls,"\n"); //first option appends a file, second option overwrites file //uncomment and comment them for which you need /* //add new lines to end of text file $write = fopen($my_file, 'a+'); $message = $save_to_file; fputs($write, "$message\n"); // that extra \n adds and extra line for next data input fclose($write); */ //note the w, this will overwrite the entire contents of text file $write = fopen($my_file, 'w'); $message = $save_to_file; fputs($write, "$message\n"); // that extra \n adds and extra line for next data input fclose($write); } else { echo "No file to display"; } ?>
  19. I'm sure you are proud to do what you did only being 19. I feel you should place that elsewhere if anywhere at all, just not right up top. I know from experience of my lifetime and in business most people think that the older person is the smarter/wiser person. You showing that you are 19 may not get you as much work. Although I know better than that, some people are just set in their ways. I always see people making sites to promote themselves, unfortunately I rarely see them show off their talents on their own sites. If you can incorporate some cool scripts and tricks into your site to give them a "wow" factor...it may just help. Since some don't like the dark themes, why not do yourself an option to change the sites colors and show some of your skill.
  20. Here's my opinion on websites and making money. If you don't provide a product to sell or a paid service your gonna end up spending more than you make and waste your time. I've had quite a few sites in the past that generated an income, but nothing people would quit their jobs for. My one site had over 10,000 unique visitors daily and just barely covered my server costs. I tried multiple ad companies and other methods, ads just do not make money as they used to. With ad blockers such as adblock, popup blockers, few ads get through to people. I have many friends that have movie,tv sites, even video hosts, if they could barely get by with those then what does that tell you. That mention of the screwdriver site and generate hundreds a month would never happen. Well anyway....I do agree html5 templates could be profitable for you. Creating out of the box html5 websites even better. The problem with wordpress themes is wordpress code changes way too often which means you will have to keep editing your themes. Blah. Plus people are cheap, there are way too many free themes available for them to use instead. When webgl finally becomes standard there with be many more new opportunities as well. WebGL is based on OpenGL ES 2.0 and provides an API for 3D graphics. It uses the HTML5 canvas element and is accessed using Document Object Model interfaces. Automatic memory management is provided as part of the JavaScript language. I'm thinking a virtual world myself, providing I can stream content more efficiently than today's current standards. I feel you have to want to do a website because you want to, and if you can also profit from it that's even better. It may actually generate the income you expect one day if put lots of time and effort into it.
  21. "WampServer is the only packaged solution that will allow you to reproduce your production server." But you are thinking that everyone is going to be using windows. So why not list the AMP versions : LAMP - Linux - Download and installing ubuntu server is most likely the best and easiest way. http://www.ubuntu.com/download/server/download otherwise this tutorial covers it pretty well http://www.lamphowto.com/ CentOS using YUM: Download a copy of CentOS Linux and install it - http://www.centos.org/ Once your CentOS is installed. Open a terminal and type yum install httpd and follow on screen instructions to install apache web server Once apache web server has been installed, type yum install php Once PHP installed successfully, type yum install mysql-server mysql Once everything is finished, type service httpd start to start your apache web server, the screen will show you if web server service successfully started type service mysqld start to start your mysql server LAMP now installed, visit http://localhost in browser AppServ - Windows - http://www.appservnetwork.com/ WAMP - Windows - http://www.wampserver.com/en/ WIMP - Windows with ISS versus Apache - http://www.wimpserver.com/ MAMP - Mac - http://www.mamp.info/en/index.html SAMP - Solaris - http://dlc.sun.com/osol/docs/content/OSDEV/gentextid-207.html OAMP - OpenBSD - http://www.devx.com/opensource/Article/40153 I think this post should get placed into CSS versus website critique.
  22. As for a paid antivirus, I've found the best overall out of all of them is Kaspersky. I like the kaspersky internet security versions http://usa.kaspersky.com/products-services/home-computer-security/internet-security As for free, I vote avast for the win. http://www.avast.com/en-au/free-antivirus-download
  23. "OFFICIAL archive of older Windows executables" The only place that would be is on the applications website if they maintain older versions. Usually they don't keep the older because they made improvements in the code, so they don't want to manage hundreds of versions and support for them. I guess if you need the older version for whatever reason, you have to take a chance and download it elsewhere. I've used: http://sourceforge.net/ https://github.com/repositories http://www.softpedia.com http://download.cnet.com/ http://www.filehippo.com http://www.versiondownload.com/ http://www.oldapps.com/ http://www.old-versions.org/ Among others.
  24. Unless you have some code to go by not many are gonna respond to this. This forum is for helping with php code, not creating it. Make the said values above into a database, also have an approved with values of say y and n. Fetch results from database, Checking if approved or declined if($approved == "n"){ echo $reason; };
×
×
  • 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.