{"id":111,"date":"2014-01-29T10:26:05","date_gmt":"2014-01-29T10:26:05","guid":{"rendered":"http:\/\/www.fax.squaredisc.com\/?p=111"},"modified":"2014-01-29T10:26:05","modified_gmt":"2014-01-29T10:26:05","slug":"rnd-php","status":"publish","type":"post","link":"http:\/\/www.fax.squaredisc.com\/?p=111","title":{"rendered":"rnd.php"},"content":{"rendered":"<p>Here&#8217;s a simple &amp; dirty <strong>php<\/strong> script to generate a string of random characters, with customisable character option and length &#8211; useful for creating strong passwords!<\/p>\n<p>How to use:<\/p>\n<blockquote>\n<pre>squaredisc.com\/rnd.php?option=5&amp;length=30<\/pre>\n<\/blockquote>\n<p><a href=\"http:\/\/www.squaredisc.com\/rnd.php\" target=\"_blank\">squaredisc.com\/rnd.php<\/a><\/p>\n<span class=\"collapseomatic \" id=\"id8683\"  title=\"<strong>rnd.php<\/strong>\"><strong>rnd.php<\/strong><\/span><div id=\"target-id8683\" class=\"collapseomatic_content \"><\/p>\n<pre>&lt;?php\r\n$length = $_GET['length'];\r\n$option = $_GET['option'];\r\nif($length==\"\")$length=\"30\";\r\nif($option==\"\")$option=\"5\";\r\n$domain = $_SERVER['SERVER_NAME'];\r\n$page = $_SERVER[\"PHP_SELF\"];\r\n$eg = $domain.$page;\r\nfunction randomPassword() {\r\n        $length = $_GET['length'];\r\n        $option = $_GET['option'];\r\n        if($length==\"\")$length=\"30\";\r\n        if($option==\"\")$option=\"5\";\r\n        $rnd1 = \"abcdefghijklmnopqrstuvwxyz\";\r\n        $rnd2 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\r\n        $rnd3 = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\";\r\n        $rnd4 = \"0123456789\";\r\n        $rnd5 = \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\";\r\n        $rnd6 = \"`\u00ac!\u00a3$%^&amp;*()_+-={}[];'#:@~,.\/?\\|\";\r\n        $rnd7 = \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`\u00ac!\u00a3$%^&amp;*()_+-={}[];'#:@~,.\/?\\|\";\r\n        if($option==\"1\")$alphabet=$rnd1;\r\n        if($option==\"2\")$alphabet=$rnd2;\r\n        if($option==\"3\")$alphabet=$rnd3;\r\n        if($option==\"4\")$alphabet=$rnd4;\r\n        if($option==\"5\")$alphabet=$rnd5;\r\n        if($option==\"6\")$alphabet=$rnd6;\r\n        if($option==\"7\")$alphabet=$rnd7;\r\n        $pass = array();\r\n        $alphaLength = strlen($alphabet) - 1;\r\n        for ($i = 0; $i &lt; $length; $i++) {\r\n                $n = rand(0, $alphaLength);\r\n                $pass[] = $alphabet[$n];\r\n        }\r\n        return implode($pass);\r\n}\r\nif($option==\"1\")$rnd1=randomPassword();\r\nif($option==\"2\")$rnd2=randomPassword();\r\nif($option==\"3\")$rnd3=randomPassword();\r\nif($option==\"4\")$rnd4=randomPassword();\r\nif($option==\"5\")$rnd5=randomPassword();\r\nif($option==\"6\")$rnd6=randomPassword();\r\nif($option==\"7\")$rnd7=randomPassword();\r\nif($option==\"1\")$b1a=\"&lt;b&gt;\";\r\nif($option==\"2\")$b2a=\"&lt;b&gt;\";\r\nif($option==\"3\")$b3a=\"&lt;b&gt;\";\r\nif($option==\"4\")$b4a=\"&lt;b&gt;\";\r\nif($option==\"5\")$b5a=\"&lt;b&gt;\";\r\nif($option==\"6\")$b6a=\"&lt;b&gt;\";\r\nif($option==\"7\")$b7a=\"&lt;b&gt;\";\r\nif($option==\"1\")$b1b=\"&lt;\/b&gt;\";\r\nif($option==\"2\")$b2b=\"&lt;\/b&gt;\";\r\nif($option==\"3\")$b3b=\"&lt;\/b&gt;\";\r\nif($option==\"4\")$b4b=\"&lt;\/b&gt;\";\r\nif($option==\"5\")$b5b=\"&lt;\/b&gt;\";\r\nif($option==\"6\")$b6b=\"&lt;\/b&gt;\";\r\nif($option==\"7\")$b7b=\"&lt;\/b&gt;\";\r\n$td1 = \"&lt;td width='125' valign='top'&gt;\";\r\n$td2 = \"&lt;td width='875' valign='top'&gt;\";\r\necho \"&lt;table width='1000' align='left'&gt;\";\r\necho \"&lt;tr&gt;$td1 &lt;b&gt;&lt;u&gt;Options:&lt;\/u&gt;&lt;\/b&gt; &lt;\/td&gt;$td2 &lt;b&gt;&lt;u&gt;eg:&lt;\/u&gt; &amp;nbsp;&amp;nbsp; $eg?option=5&amp;length=30&lt;\/b&gt;&lt;\/td&gt;&lt;\/tr&gt;\";\r\necho \"&lt;tr&gt;$td1 $b1a 1) lowercase: $b1b&lt;\/td&gt;$td2 $b1a $rnd1 $b1b&lt;\/td&gt;&lt;\/tr&gt;\";\r\necho \"&lt;tr&gt;$td1 $b2a 2) UPPERCASE: $b2b&lt;\/td&gt;$td2 $b2a $rnd2 $b2b&lt;\/td&gt;&lt;\/tr&gt;\";\r\necho \"&lt;tr&gt;$td1 $b3a 3) Letters: $b3b&lt;\/td&gt;$td2 $b3a $rnd3 $b3b&lt;\/td&gt;&lt;\/tr&gt;\";\r\necho \"&lt;tr&gt;$td1 $b4a 4) Numbers: $b4b&lt;\/td&gt;$td2 $b4a $rnd4 $b4b&lt;\/td&gt;&lt;\/tr&gt;\";\r\necho \"&lt;tr&gt;$td1 $b5a 5) 3+4: $b5b&lt;\/td&gt;$td2 $b5a $rnd5 $b5b&lt;\/td&gt;&lt;\/tr&gt;\";\r\necho \"&lt;tr&gt;$td1 $b6a 6) Symbols: $b6b&lt;\/td&gt;$td2 $b6a $rnd6 $b6b&lt;\/td&gt;&lt;\/tr&gt;\";\r\necho \"&lt;tr&gt;$td1 $b7a 7) 5+6: $b7b&lt;\/td&gt;$td2 $b7a $rnd7 $b7b&lt;\/td&gt;&lt;\/tr&gt;\";\r\necho \"&lt;\/table&gt;\";\r\n?&gt;<\/pre>\n<p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a simple &amp; dirty php script to generate a string of random characters, with customisable character option and length &#8211; useful for creating strong passwords! How to use: squaredisc.com\/rnd.php?option=5&amp;length=30 squaredisc.com\/rnd.php<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[7],"_links":{"self":[{"href":"http:\/\/www.fax.squaredisc.com\/index.php?rest_route=\/wp\/v2\/posts\/111"}],"collection":[{"href":"http:\/\/www.fax.squaredisc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.fax.squaredisc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.fax.squaredisc.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.fax.squaredisc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=111"}],"version-history":[{"count":21,"href":"http:\/\/www.fax.squaredisc.com\/index.php?rest_route=\/wp\/v2\/posts\/111\/revisions"}],"predecessor-version":[{"id":132,"href":"http:\/\/www.fax.squaredisc.com\/index.php?rest_route=\/wp\/v2\/posts\/111\/revisions\/132"}],"wp:attachment":[{"href":"http:\/\/www.fax.squaredisc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.fax.squaredisc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=111"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.fax.squaredisc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}