Title: Writing code requests
Last modified: February 25, 2023

---

# Writing code requests

 *  Resolved [Terry J](https://wordpress.org/support/users/texasbiz/)
 * (@texasbiz)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/writing-code-requests/)
 * Your plugin is great, thank you for sharing.
 * If I go to playground and enter in prompt: write php code for simple text file
   based cms
 * I end up with jumbled up code like:
 *     ```wp-block-code
       $title = "My CMS";$content = "Welcome to my content management system.";echo "<h1>".$title."</h1>";echo $content;$title = "My CMS";$body = "This is my content";$fp = fopen("content.txt", "w");fwrite($fp, $title."\n".$body);fclose($fp);echo "Done";$file = "content.txt";$content = file_get_contents($file);echo $content;$file = "content.txt";$content = file_get_contents($file);if (isset($_POST['content'])) { $content = $_POST['content']; file_put_contents($file, $content);}?><form action="" method="post"> <textarea name="content" rows="10" cols="100"><?php echo $content; ?></textarea><br> <input type="submit" value="Save"></form><?php$text_file = 'text.txt';$text = file_get_contents($text_file);echo $text;<?php$file = 'file.txt';$content = file_get_contents($file);$lines = explode("\n", $content);$data = array();foreach($lines as $line) { $line = trim($line); if(!empty($line)) { list($key, $value) = explode("=", $line); $data[$key] = $value; }}?>$title = " Simple Text File CMS";$content = "This is a simple text file CMS.";$footer = "Thank you for using Simple Text File CMS!";?>$title = "My Simple CMS";$content = "Welcome to my simple CMS!";if (isset($_GET['page'])) { $page = $_GET['page'];} else { $page = 'home';}if ($page == 'home') { echo $title; echo $content;} elseif ($page == 'about') { echo "About My Simple CMS";} else { echo "404 - Page Not Found";}
       ```
   
 * Is your plugin not designed to write code?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [senols](https://wordpress.org/support/users/senols/)
 * (@senols)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/writing-code-requests/#post-16504770)
 * Hi [@texasbiz](https://wordpress.org/support/users/texasbiz/)
 * Our plugin uses OpenAI GPT-3 models. So all responses are coming from there. 
   It is not something that our plugin can control.
 *  Thread Starter [Terry J](https://wordpress.org/support/users/texasbiz/)
 * (@texasbiz)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/writing-code-requests/#post-16504792)
 * Of course you can format the output from the ai engine. I am using another ai
   plugin here from wordpress.org and code output is just fine:
 *     ```wp-block-code
       <?php 
   
       // create a form to allow user to choose a file
       echo '<form action="" method="post" enctype="multipart/form-data">
           <input type="file" name="fileToUpload" id="fileToUpload">
           <input type="submit" value="Upload File" name="submit">
       </form>';
   
       if (isset($_POST['submit'])) {
   
           // get file details
           $fileName = $_FILES['fileToUpload']['name'];
           $fileSize = $_FILES['fileToUpload']['size'];
           $fileTmpName = $_FILES['fileToUpload']['tmp_name'];
           $fileType = $_FILES['fileToUpload']['type'];
           $fileError = $_FILES['fileToUpload']['error'];
           $fileExt = explode('.',$fileName);
           $fileActualExt = strtolower(end($fileExt));
   
           // allowed file types
           $allowed = array('enc');
   
           // check for errors
           if ($fileError !== 0) {
               echo "An error occurred";
           }
           else {
               // check file type
               if (in_array($fileActualExt, $allowed)) {
                   // read file contents
                   $fileContent = file_get_contents($fileTmpName);
   
                   // decode content using base64_decode
                   $decodedContent = base64_decode($fileContent);
   
                   // decrypt content using openssl
                   $key = "your_key_here";
                   $decryptedContent = openssl_decrypt($decodedContent, 'aes-256-cbc', $key);
   
                   // echo decrypted content
                   echo $decryptedContent;
               }
               else {
                   echo "Invalid file type";
               }
           }
       }
   
       ?>
       ```
   
 * You can use the playground at openai and the out is formatted too.
 * I can write a simple PHP CURL script that outputs formatted code.
 * Anyway, wishing you the best.
 *  Plugin Author [senols](https://wordpress.org/support/users/senols/)
 * (@senols)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/writing-code-requests/#post-16504797)
 * Ahh got it
 * Ok will format the output in coming releases 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Writing code requests’ is closed to new replies.

 * ![](https://ps.w.org/gpt3-ai-content-generator/assets/icon-256x256.png?rev=3454929)
 * [AI Puffer – Chat. Create. Automate. (formerly AI Power)](https://wordpress.org/plugins/gpt3-ai-content-generator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gpt3-ai-content-generator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gpt3-ai-content-generator/)
 * [Active Topics](https://wordpress.org/support/plugin/gpt3-ai-content-generator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gpt3-ai-content-generator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gpt3-ai-content-generator/reviews/)

## Tags

 * [code](https://wordpress.org/support/topic-tag/code/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 5 replies
 * 2 participants
 * Last reply from: [senols](https://wordpress.org/support/users/senols/)
 * Last activity: [3 years, 3 months ago](https://wordpress.org/support/topic/writing-code-requests/#post-16504797)
 * Status: resolved