Announcement

Collapse
No announcement yet.

How do I get this file to display in a textbox?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I get this file to display in a textbox?

    I am trying to get this to display the files contents. All that shows up when I run the script is the word 'Array'. What the hell am I doing wrong here?

    Code:
    	if($viewlog =="view"  && $superadmin == 1) {
    
    			if($log == view) {
    
    			fclose($filepointer);
    
    
    			$filename = "logs/activity_log.txt"; //This is where the script logs admin activities to a file.
    			$filepointer = fopen($filename, "r");
    			$contents = file($filename);
    			fclose($filepointer);
    	
    			echo ("
    				
    			<table  width=\"75%\" bgcolor=\"#000000\" border=\"0\" align=\"center\" cellspacing=\"1\" cellpadding=\"3\">
    			<tr> 
    		   <td bgcolor=\"#eeeeee\" colspan=\"2\"> 
    		   <div align=\"center\"><font face=\"Tahoma\" size=\"-2\"><font color=\"#000000\"><b>View/Modify the Admin Log</b></font></font></div>
    		   </td>
    		   </tr>
    		   <tr align=\"center\"> 
    		   <td bgcolor=\"#ffffff\" width=\"75%\"> <font face=\"Tahoma\" size=\"1\">
    		   <textarea onmouseover=\"this.focus()\" name=\"ticket\" cols=\"100\" rows=\"25\">$contents</textarea>
    		   This text area contains the contents of the activity_log.txt file which stores ALL admin activity.</font> 
    		   </td>
    		   </tr>
    				 
    			
    			");
    
    	}
    
    exit();

  • #2
    if($viewlog =="view" && $superadmin == 1) {

    if($log == view) {

    fclose($filepointer);




    echo "

    <table width=\"75%\" bgcolor=\"#000000\" border=\"0\" align=\"center\" cellspacing=\"1\" cellpadding=\"3\">
    <tr>
    <td bgcolor=\"#eeeeee\" colspan=\"2\">
    <div align=\"center\"><font face=\"Tahoma\" size=\"-2\"><font color=\"#000000\"><b>View/Modify the Admin Log</b></font></font></div>
    </td>
    </tr>
    <tr align=\"center\">
    <td bgcolor=\"#ffffff\" width=\"75%\"> <font face=\"Tahoma\" size=\"1\">
    <textarea onmouseover=\"this.focus()\" name=\"ticket\" cols=\"100\" rows=\"25\">";

    include "logs/activity_log.txt";

    echo "
    </textarea>
    This text area contains the contents of the activity_log.txt file which stores ALL admin activity.</font>
    </td>
    </tr>


    ";

    }

    exit();

    Comment


    • #3


      Damn that's a hell of alot easier than what I was trying. How clever, thanks bro!

      ONE MORE THING THOUGH!!! Is there a way to display a link that will actually 'PRINT' the contents of the text box to your default printer?

      I know there javascript is involved, but that's about it.

      Comment


      • #4
        Question: How do I print JavaScript output?

        Answer: JavaScript programs cannot directly access printers. However, the user can print out everything on the Web page, including the output of JavaScript programs, by using the File | Print menu of the browser (or the keyboard shortcut, e.g. Ctrl+P on Windows systems).



        not my answer but the one ur lookin for

        Comment


        • #5
          Java

          I use the following to bring up the print dialog for MS clients on a form that I use. In my form processing script, it displays the pretty form, which must be printed and signed, so I fig why not bring up the dialog for them

          <body OnLoad="window.print()">

          Simple yet effective

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...
          X