Jump to content

QuickOldCar

Staff Alumni
  • Posts

    2,972
  • Joined

  • Last visited

  • Days Won

    28

Everything posted by QuickOldCar

  1. Well here's the best way by far. I guess can even do sets of the 26 letters as well, something like show single letters, then show 2 letters, then show 3 letters and so on , but just do them in ranges so don't have to produce what you don't need. <?php $how_many_you_want = 50000;//each number will add an extra line/sequential alphabet string function seqAlphabet($numbers) { $alphabet = ''; while($numbers >= 1) { $numbers = $numbers - 1; $alphabet = chr(($numbers % 26)+97) . $alphabet; $numbers = $numbers / 26; } return $alphabet; } $string_position = range('1',$how_many_you_want); foreach ($string_position as $position) { echo seqAlphabet($position) . "<br />"; } ?>
  2. Yeah is always so many ways to do something. For my site I let them upload any image they want and I created a thumbnailer and also bmp converter. I show them in a max determined size of width to height of what I set the display I want. Can see a few results here: http://get.blogdns.com/dynaindex/thumb-create.php?size=200&rotate=0&text=Quick&textsize=6&textcolor=aqua&crop=1.1&bordermargin=0&borderwidth=2&bordercolor=silver&imgsource=http://get.blogdns.com/dynaindex/images/1292136471-lightningquick200a.gif or http://get.blogdns.com/dynaindex/thumb-create.php?size=200&rotate=0&text=Quickie&textsize=6&textcolor=aqua&crop=1.1&bordermargin=0&borderwidth=2&bordercolor=silver&imgsource=http://get.blogdns.com/dynaindex/images/1292137389-quickswingeddemon.jpg
  3. Make a field in a database for the user,save the path/image name into the field. Make a central folder for avatar images. So when the user uploads their image you can then delete the old image if wanted, maybe let them use external links if wanted.
  4. Well I could see wanting to generate maybe words or numbers at random. But like the above persons said expect the server to just puke,exhaust, time out or w/e else with trying that many. It's just too many to produce. Now maybe if did in itsy bitsy steps and started saving either to text files or a database, then maybe you can. I sat here writing up something you can at least play with to try to suit your needs. Maybe it can give you some ideas, the end result I limited it to just showing words with length of 3, so if changed that to 2 or 1 would see the others. <?php $positions = 1; $i = 0; for ($i = 0;$i<$positions;$i++) { foreach ( range('a','z') as $alphabet) { $the_alphabet[] = $alphabet; } } if (++$i == $positions) break; foreach($the_alphabet as $k1 =>$v1){ $words[]=$v1; foreach($the_alphabet as $k2 => $v2){ $words[]=$v2; $words[]="$v1$v2"; foreach($the_alphabet as $k3 => $v3){ $words[]=$v3; $words[]="$v1$v2$v3"; $words[]="$v1$v3$v2"; } } } $words = array_unique($words); sort($words); foreach($words as $word){ $word_length = strlen($word); if ($word_length == 3) { //try 2 or 1 echo "$word<br>"; } } ?>
  5. The easiest way is to name that file calculator.php, and everything works. But you should be able to just remove the path and would execute same page. This is your line echo "<form action=\"".$path."\" method=\"post\" >"; So make it this echo "<form action='' method=\"post\" >"; Or the complete with just the file as the post location value <?php $heightcm=$_POST["heightcm"]; $weightkg=$_POST["weightkg"]; if ($heightcm!="" && $weightkg!="") { $heightm = $heightcm / 100; $bmi=round($weightkg / ($heightm*$heightm),1); echo "Heigth, m: ".$heightm."<br />"; echo "Weigth, kg: ".$weightkg."<br />"; echo "Body Mass Index (BMI): ".$bmi."<br />"; echo "<strong>"; if ($bmi<16.5) {echo "Severely Underweight</strong><br />";} if ($bmi>=16.5 && $bmi<=18.4) {echo "Underweight</strong><br />";} if ($bmi>=18.5 && $bmi<=24.9) {echo "Normal</strong><br />";} if ($bmi>=25 && $bmi<=29.9) {echo "Overweight</strong><br />";} if ($bmi>=30 && $bmi<=34.9) {echo "Obese Class I</strong><br />";} if ($bmi>=35 && $bmi<=39.9) {echo "Obese Class II</strong><br />";} if ($bmi>=40) {echo "Obese Class III</strong><br />";} echo "<br />"; } $domain = $_SERVER['HTTP_HOST']; $path = $_SERVER['SCRIPT_NAME']; $queryString = $_SERVER['QUERY_STRING']; $url = "http://" . $domain . $path; $url3 = "http://" . $domain . $_SERVER['REQUEST_URI']; $mystring1="?"; $s1=strpos($url3,$mystring1); if($s1==0) {$url2=$url3;} if($s1!=0) {$url2=substr($url3,0,$s1);} $path = $url2; //1 foot = 0.3048 meters //1 inch = 2.54 centimeters //1 pound = 0.45359237 kilograms $n1=230; echo "<table style=\"width: 100%\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\"><tr><td valign=\"top\">"; //echo "<h3>BMI Calculator</h3>"; echo "<form action='calculator.php' method=\"post\" >"; //or even this //echo "<form action='http://domain.com/calculator.php' method=\"post\" >"; echo "<strong>Height</strong><br />"; echo "<select name=\"heightcm\" >"; for ($i=30; $i<=$n1; $i++){ echo "<option value=\"$i\">".$i." cm / ".floor($i / 30.48)." ft ".round(($i-(floor($i / 30.48)*30.48)) / 2.54, 1)." in </option>";} echo "</select>"; echo "<br />"; echo "<strong>Weight</strong><br />"; echo "<select name=\"weightkg\" >"; for ($i=30; $i<=$n1; $i++){ echo "<option value=\"$i\">".$i." kg / ".round($i / 0.45359237,2)." pounds </option>";} echo "</select>"; echo "<br />"; //echo "<input name=\"searchterm\" type=text size=\"27\" class=\"ns1\">"; echo "<br />"; echo "<input type=\"submit\" value=\"Calculate\" name=\"B1\">"; echo "</form><br />"; //DON'T REMOVE THIS LINK - DO NOT VIOLATE GNU/GPL LICENSE!!! echo "<a href=\"http://nutritioncaloriecounter.com\">Nutrition Calorie Counter</a>"; //DON'T REMOVE THIS LINK - DO NOT VIOLATE GNU/GPL LICENSE!!! echo "</td></tr></table>"; ?>
  6. You may need to think out a system for yourself that works best for your situation. Maybe explain what exactly doing as a whole in this project, what the exact purpose of generating all these url's are and when they are called upon and how often. As for your question, if the server doesn't have to do as much work is always better. If you are pulling a 1 gig+ file each time, I would think of alternate ways of doing this, like run it once and save groups of five into arrays or like i said just start saving each into a mysql database structure for future use. 3 fields for words for each part and just pulling a random 5 from that would work also. I could think of one way for you of doing this the same as you have with less usage, lets say you have a folder named like randoms. Then inside the folder 3 more folders named urls,titles,tld, in each of those folders start naming text files as 1.txt, 2.txt, 3.txt, 4.txt and so on. Basically splitting up your huge 1 gig+ lists into smaller chunks. I would think can even use the titles/words or whatever for both the domain name and also the titles if wanted, unless need specific. Make the calling of the name of the file a random number variable something like $random_number.txt I'm pretty sure can do something like mt_rand and floor of the file and get just a few lines, but I would think still counting the lines in a 1 gig + file still takes usage. Well right now I have no time, have to fix my sisters busted furnace, but maybe within next few days I'll write up a complete system using multiple text files and have as a download for everyone. I been wanting to make a more advanced system with jumbling words for domain creations and then save the domains created into alphabetical lists and broken up into say 100,000 per file. I have a system now that uses mysql, basically i insert a new word in, adds all 500 or w/e tld or sld's for that domain,checks alive or dead. Didn't seem very efficient calling to mysql each time so I stopped that project for now. It was something I was deciding how I really want it done, save just alive..or all, which even dead sites have value for buying new domains but to save every possible combination seem ludicrous. I can't even do the math on that, url's can be 255 positions and also is 500+tld and sld's, mix that with a combination of every single letter and number and that's an insane amount. The reason why gonna make something a bit more dynamic so is no need to save every possible combination, but with a cost of server usage versus storage space. So I'll post when I do this.
  7. Well being just 1 to 8 I can see why. <?php $number = rand(1,5000)-1;//1 is minumum number, 5000 is the maximum echo $number; ?> Can even get crazy with this by running a for loop to create a random numbers array, then shuffle_array() and from that array pull a random result.
  8. Try psexec, is part of the pstools suite. http://technet.microsoft.com/en-us/sysinternals/bb897553 Also go to apache service in control panel and allow interaction with desktop. Set any login credentials as well. Ant other questions about psexec can be answered in the psexec forums.
  9. Grabbing many 1 gig files a lot certainly is not good. When reading from a text file it must read the entire contents. You should generate these and save them into a database for reuse. This is why databases were made. It's more efficient than flat files. Another possible option is to load the words into a database in fields, and grab just a random 5 each from those.
  10. That's what makes this interesting to me and keep doing it. The challenge. Is multiple ways to accomplish the same goal, sometimes have to be creative about it. Some ways may do the job but either slow or undesired results, so try a different way. So it's finally what needed and we can move on?
  11. Version using title showing instead of the link. <?php $domain_array = array("myspace","digg","google","phpfreaks","php","classic","tvcountdown","eight","nine","word8","word3","people","word9","anotherdomain","hello","funny","great","cool","nice"); //is about 500 tld and sld's that exist $tld_array = array("com","net","org","biz","info","edu","mobi","co.uk"); $title_array = array("one","two","three","four","five","six","seven","eight","nine","word8","word3","word4","word9","anotherword","hello","funny","great","cool","nice"); shuffle($domain_array); shuffle($title_array); shuffle($tld_array); $i = 0; foreach ($domain_array as $domain) { $domain = trim($domain); foreach ($title_array as $title) { $title = trim($title); foreach ($tld_array as $tld) { $tlds = trim($tld); $links[] = "<a href='http://$domain.$tlds/$title'>$title</a>"; } } } shuffle($links);//shuffle random //sort($links);//sort in order //array_unique($links);//remove any duplicates foreach ($links as $link){ echo "$link<br />"; if (++$i == 5) break;//if comment this line or set number higher will see more results } ?>
  12. May want to use http://simplehtmldom.sourceforge.net/ but also curl to resolve the urls first. If look into dom I feel that alongside curl can do what you need to. Or just everything in curl, up to you.
  13. Use curl http://php.net/manual/en/book.curl.php
  14. Because this could benefit others and also is an interest of mine. I had some time so went ahead and did the create random url's, tld's and also the words. But I will say I'll do nothing more to this as this should be able to get done what you needed, if not start trying to make the changes you need to it. remove comment for sort, array_unique if you need that. comment the for line to see all results or change the number. Good luck with it. <?php $domain_array = array("myspace","digg","google","phpfreaks","php","classic","tvcountdown","eight","nine","music","tv","people","game","poems","forum","funny","great","cool","nice"); //is about 500 tld and sld's that exist $tld_array = array("com","net","org","biz","info","edu","mobi","co.uk"); $title_array = array("one","two","three","four","five","six","seven","eight","nine","word8","word3","word4","word9","anotherword","hello","funny","great","cool","nice"); shuffle($domain_array); shuffle($title_array); shuffle($tld_array); $i = 0; foreach ($domain_array as $domain) { $domain = trim($domain); foreach ($title_array as $title) { $title = trim($title); foreach ($tld_array as $tld) { $tlds = trim($tld); $links[] = "$domain.$tlds/$title"; } } } shuffle($links);//shuffle random //sort($links);//sort in order //array_unique($links);//remove any duplicates foreach ($links as $make_link){ $make_link = "http://$make_link"; $link = "<a href='$make_link'>$make_link</a>"; echo "$link<br />"; if (++$i == 5) break;//if comment this line or set number higher will see more results } ?> As for the xml, look into making an rss feed with php, is plenty of tutorials. It would be best to make a new post so others can help and see what you needed.
  15. This is a help forum really, not a do it for you. The people here are to assist in the code you have and find errors. I don't mind helping a little, or even sometimes more, but your making this into a complete advanced script for yourself without giving effort it seems. I think you need to learn php at least a little. http://php.net/manual/en/index.php Or can visit the freelance section. http://www.phpfreaks.com/forums/php-freelancing/
  16. Maybe would like to show your title and not the full url. <?php $titles_array = array("one","two","three","four","five","six","seven","eight","nine","word8","word3","word4","word9","anotherword","hello","funny","great","cool","nice"); shuffle($titles_array); $i = 0; foreach ($titles_array as $titles => $title) { $title = trim($title); $make_link = "http://example.com/$title"; $link = "<a href='$make_link'>$title</a>"; echo "$link<br />"; if (++$i == 5) break; } ?>
  17. This fine for you? <?php $titles_array = array("one","two","three","four","five","six","seven","eight","nine","word8","word3","word4","word9","anotherword","hello","funny","great","cool","nice"); shuffle($titles_array); $i = 0; foreach ($titles_array as $titles => $title) { $title = trim($title); $title = "http://example.com/$title"; $link = "<a href='$title'>$title</a>"; echo "$link<br />"; if (++$i == 5) break; } ?>
  18. If you are getting these values from a database, you can add this to end of the select statement. order by rand() LIMIT 5 But if still doing from text like I think you are.... The easiest way found to get random results from an array is shuffle($words_array); If doing random then no need to sort the array, so remove this. asort($words_array); Here's a simple way I came up with. Is so many ways to do this. <?php $words_array = array("one","two","three","four","five","six","seven","eight","nine","word8","word3","word4","word9","anotherword","hello","funny","great","cool","nice"); shuffle($words_array); $i = 0; foreach ($words_array as $words => $word) { $word = trim($word); echo "http://example.com/$word<br />"; if (++$i == 5) break; } ?>
  19. I posted just what you need in another post. http://www.phpfreaks.com/forums/php-coding-help/getting-the-path/msg1506898/#msg1506898
  20. ok, so here is what I got. I made the sample array of words can delete. Replace the text file names to what you want. A brief description: Get array of words from a text file, sort them in order, I echo so can see the results, create a new url_array of the results, print the array info, implode the array with line break and insert into a text file. I suppose if need anything different can easily modify it. <?php //generate urls from words array so can see it work /*$words_array = array("one","two","three","four","five","six","seven","eight","nine","word8","word3","word4","word9","anotherword","hello","funny","great","cool","nice"); */ $my_word_file = "wordfile1.txt"; $write_file = "urls1.txt"; //getting from text file section if (file_exists($my_word_file)) { $words_array = file($my_word_file); asort($words_array);//sort the array foreach ($words_array as $word) { $word = trim($word); echo "http://example.com/$word<br />"; $url_array[] = "http://example.com/$word"; } //see array values from $url_array print_r($url_array); //write to a text file $write = fopen($write_file, 'w'); $new_urls = implode("\r\n",$url_array); fputs($write, $new_urls); fclose($write); } else { echo "File does not exist"; } ?>
  21. I made a url generator. http://dynaindex.com/keyword-navigation What this does is will accept up to 10 keywords and mix them into the most common domains up to 4 keyword positions. Then I have it check alive and dead, display some info and a thumb if alive. Although I made it do a lot more than just make them there, it started off a word generator, then a domain generator and so on. But i do have other stuff that can surely do what you need. I will say it took a pretty long time to accomplish, if needed any help just shoot me a message and I'll see what I can do. Here is what you can do to get what you need done. The text file with words include as an array and variables, can do a count so you know how many are making. Then for each word in the array you echo it or make that a new array to save to database or text files, not sure what doing with them. So with a for ++ using count of words array, append your http://example.com/ to the front. If I got a bit of time I can write something simple up. I gotta do a few things first.
  22. And also make many email accounts and with different email providers.
  23. Yeah is many ways, the funny thing is I missed my semicolon for the echo on the href, but it still worked in this simple example. Here's the fixed. <?php //added these to test them, uncomment one //$result = "Swinging Ship"; //$result = "Roller Coaster"; //$result = "Ice Blast"; if ($result == "Swinging Ship") { $go_to_page = "Swing.php"; } elseif ($result == "Roller Coaster") { $go_to_page = "Roller.php"; } elseif ($result == "Ice Blast") { $go_to_page = "Ice.php"; } else { $go_to_page = "./"; //a default location to go? $result = "HOME"; } echo "<a href='$go_to_page'>$result</a>"; ?>
  24. Here is a simple add text to a png image code for you. Can pass your values to this script from your function instead of duplicating the gd image code every spot. Is numerous ways to do this. <?php //sample usages if name file text-image.php,also full url's preferable //<img src="./text-image.php?text=Name&imagelocation=./image/picture.png" /> header('Content-type: image/png'); $text = "No Name"; $text = mysql_real_escape_string($_GET['text']); //$imagelocation = "image/quickdemon.png"; $imagelocation = mysql_real_escape_string($_GET['imagelocation']); $im = imagecreatefrompng($imagelocation); $color = imagecolorallocate($im, 128, 192, 128);//these 3 numbers change the color $font = 'font.ttf';//use any font and point to the ttf file $fontsize = 10;//size of font $size = imagettfbbox($fontsize, 0, $font, $text); //calculate the pixel of the string $dx = (imagesx($im)) - (abs($size[2]-$size[0])) - 20; //calculate the location to start the text imagettftext($im, $fontsize, 0, $dx, 13, $color, $font, $text);//merge it all imagepng($im);//create it imagedestroy($im);//destroy it ?>
×
×
  • 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.