Jump to content

roflmycrisps

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Posts posted by roflmycrisps

  1. Hi!

     

    I have a text area on my webpage which takes in user php scripts and produces an output in an adjacent window. I am trying to find out how I can auto include some php tags into the input text area so that the user doesn't have to keep typing them in every time.

     

    <form name="form1" method="post" ACTION="editor.php">
    		       	<textarea rows="10" cols="60" id="code" name="code"></textarea>
    		   		<span class="submitbutton">Test code</span>
    		       </form>
    

     

    Thanks in advance,

    Jay

  2. Hi,

     

    Thanks for your replies. Yes xyph, essentially I am to create a very basic parser. I want users to be able to enter a php script in the input box, enter submit button, and the output of this script appear in the output text area. The reason I am using regex is because my tutor has told me to, however, I did have an other idea.

     

    I was considering the idea of capturing and writing the scripts which users enter into a temporary php file on the server, and running a shell_exec function to run the file as a program and then grab the output and print it into the output area. However, im not entirely sure how to go about doing this.

     

    To answer your other two questions, yes I do need to make sure everything is within <?php and ?> tags and eventually I will need to check the scripts for errors!

     

    Any advice on how you would tackle this?

     

    Thanks in advance!

    Jamie

  3. Hi,

     

    I'm fairly new to PHP and regex, however, I am required to use it in my uni project.

     

    The project consists of an editor which a user will be able to enter php scripts into, and an output area where all script outputs will be displayed once the user has clicked the submit button.

     

    At the moment I am trying to use regex to search for variables in a script, and in this particular case maths functions. e.g. :

     

    user enters:

    <?php

    $a=5;

    $b=6;

    $c=$a+$b;

    echo $c;

    ?>

     

    I want to search for the variables in the script and their values and perform mathematical functions on the regex matches. In this case the output area would just display: 11 .

     

    I have already sorted printing echo statements, however, I am struggling on this section. Any help would be appreciated.

     

    Thanks

     

     

×
×
  • 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.