<html> <head> <title>Online PHP Script Execution</title> </head> <body> <?php $f=fopen("webdictionary.txt","r+"); ?> </body> </html>
<?php // define variables and set to empty values $nameErr = $emailErr = $genderErr = $websiteErr = ""; $name = $email = $gender = $comment = $website = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["name"])) { $nameErr = "Name is required"; }else { $name = test_input($_POST["name"]); } if (empty($_POST["email"])) { $emailErr = "Email is required"; }else { $email = test_input($_POST["email"]); // check if e-mail address is well-formed if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailErr = "Invalid email format"; } } if (empty($_POST["website"])) { $website = ""; }else { $website = test_input($_POST["website"]); } if (empty($_POST["comment"])) { $comment = ""; }else { $comment = test_input($_POST["comment"]); } if (empty($_POST["gender"])) { $genderErr = "Gender is required"; }else { $gender = test_input($_POST["gender"]); } } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?> <h2>Absolute classes registration</h2> <p><span class = "error">* required field.</span></p> <form method = "post" action = "<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> <table> <tr> <td>Name:</td> <td><input type = "text" name = "name"> <span class = "error">* <?php echo $nameErr;?></span> </td> </tr> <tr> <td>E-mail: </td> <td><input type = "text" name = "email"> <span class = "error">* <?php echo $emailErr;?></span> </td> </tr> <tr> <td>Time:</td> <td> <input type = "text" name = "website"> <span class = "error"><?php echo $websiteErr;?></span> </td> </tr> <tr> <td>Classes:</td> <td> <textarea name = "comment" rows = "5" cols = "40"></textarea></td> </tr> <tr> <td>Gender:</td> <td> <input type = "radio" name = "gender" value = "female">Female <input type = "radio" name = "gender" value = "male">Male <span class = "error">* <?php echo $genderErr;?></span> </td> </tr> <td> <input type = "submit" name = "submit" value = "Submit"> </td> </table> <?php echo "<h2>Your given values are as:</h2>"; echo $name; echo "<br>"; echo $email; echo "<br>"; echo $website; echo "<br>"; echo $comment; echo "<br>"; echo $gender; ?> ?> </body> </html>
<?php finder(16, 64); function finder($add,$product) { $inside_root = $add*$add - 4*$product; echo("Root = $inside_root\n"); if($inside_root >=0) { $b = ($add + sqrt($inside_root))/2; $a = $add - $b; echo "$a+$b = $add and $a*$b=$product\n"; }else { echo "No real solution\n"; } } ?>
<?php function HexStringToByte($hexString) { $string = hex2bin($hexString); return $string; } function encrypt_string($string='', $key=''){ $iv_size = 16; $iv = "1212121212121212"; $blocksize = 16; $pad = $blocksize - (strlen($string) % $blocksize); $string = $string . str_repeat(chr($pad), $pad); return base64_encode($iv.openssl_encrypt($string, 'aes-128-cbc', $key, OPENSSL_RAW_DATA, $iv)); } function decrypt_string($data, $key) { $ciphertext_dec = base64_decode($data) ; $iv_size = 16; $iv_dec = substr($ciphertext_dec, 0, $iv_size); $ciphertext_dec = substr($ciphertext_dec, $iv_size); return openssl_decrypt($ciphertext_dec, 'aes-128-cbc', $key, OPENSSL_RAW_DATA, $iv_dec); } //$ciphertext = encrypt_string('Neeraj',HexStringToByte('0A6D4D8794371FC45B1E85368E38BE75')); //print_r($ciphertext); $ds = decrypt_string("jhI5nAdyb1qOEjmcB3JvWkrXzfs0jaJJIVMgqaElpdQ=",HexStringToByte('0A6D4D8794371FC45B1E85368E38BE75')); print_r($ds); exit;
<html> <head> <title>Online PHP Script Execution</title> </head> <body> <?php echo "<h1>Hello, PHP!</h1>\n"; $n=10; for ($i=1;$i<=$n;$i++) { for ($j=$n-$i;$j>0;$j--) { echo " "; } for ($j=1;$j<=(2*$i-1);$j++) { echo "*"; } echo "\n"; } $h=1; for ($i=1;$i<$n;$i++) { for ($k=1;$k<=$h;$k++) { echo " "; } $h++; for ($j=1;$j<(2*($n-$i));$j++) { echo "*"; } echo "\n"; } ?> </body> </html>
<?php // EXAMPLE USAGE //sn = "1AB%02X"; $digilist = "0123456789ABCDEFGHJKLMNPQRTUVWXY"; $tempID = NULL; $tempID .= substr($digilist, rand(1, 9), 1); //random number $tempID .= substr($digilist, rand(10, 31), 1); //then a letter $tempID .= substr($digilist, rand(10, 31), 1); //another letter $tempID .= ("%'.02X"); $i=0; for ($i; $i < 99; $i+1) { $tempID = sprintf($tempID, $i); $array = generate($tempID); echo "\n"; echo "ID: " . $array[0]; echo "\n"; echo "Key: " . $array[1]; } // FUNCTION function generate(&$tempID) { $digilist = "0123456789ABCDEFGHJKLMNPQRTUVWXY"; //now we generate a new random ID number using the substrings of the digitList string above $id = NULL; $id .= $tempID; //ok so now we need to generate an MD5 hash of our ID $hash = md5($id); //cycle through the hash 16 (length of key) times (in steps of 2 because each hex bytes is 2 digits long) $i = 0; $key = NULL; for ($i; $i < 32; $i+=2) { //here we convert the next hex value to an integer and perform a bitwise AND operation against '31' //31 is the highest substring value in our digit list. $nextdigit = hexdec(substr($hash, $i, 2)) & 31; //if 'i' is divisable by 8 (every 4 cycles) then we want to add "-" if ((($i % 8) == 0) && ($i > 0)) { $key .= "-".substr($digilist, $nextdigit, 1); } else { $key .= substr($digilist, $nextdigit, 1); } } $array = array($id, $key); //return return $array; } ?>
<?php $html = '<li><li><a href="#">TEXT_1</a></li><a href="#">TEXT_2</a></li>'; function remove_a_from_li($html){ while(preg_match('#<a(.*?)>(.*?)</a>#is', $html) == 1){ $html = preg_replace('@(<li.*?)<a.*?/a>(</li>)@s', '\\1\\2', $html); } return $html; } echo remove_a_from_li($html);
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more