see php code

cmsms
content management system made simple

is there a way to see the php code when logging on to admin using a browser
LVL 1
rgb192Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Darude1234Commented:
Want do you mean exactly? PHP-scripts are executed on the server so they can't display the code by default.
However there are ways to display php code of script for example:

<?php
     if (isset($_GET['file'])) 
       {
         $page = highlight_file ($_GET['file'], TRUE); 
         $page = str_replace ( 
         array ( '<code>', '/code>', '','</ are >','<font color ="'), 
         array ( '<pre style="padding:1em;border:2px solid black;overflow:scroll">', '/pre>', '','</span>','<span style = "color:' ), $page); 
         echo $page;
       } 
  ?>

Open in new window


Save this file as show_code.php and include it from the page you want to show the code in for example:
<?php
include("show_code.php?file=anyphpfile.php");
?>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rgb192Author Commented:
I wish I could do that,
but I can only use the browser.

0
Darude1234Commented:
Do you mean that you don't have access to the server/php files?
You can only display the php-files if you have access to the server. It's not that you can view a php-file of a random website that is running php.
That would be a big security leak ;)
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Ray PaseurCommented:
When a browser (called a "client") makes a request for a page from a server (called a "server") the server prepares a response string including headers and browser output.  Browsers use HTML to mark up and format the data from the server.  PHP scripts generate this HTML on the server, and then the server sends the HTML to the client machine.  The PHP code is never sent, just the HTML statements it generates.

But good news: http://www.cmsmadesimple.org/ is open source, so you can grab a copy and install it on your local machine.  Then you can see the PHP code.

My own IDE goes like this.  I use TextPad or NotePad++ to write PHP code.  When I am ready to test, I upload the PHP code to a URL on my server using an FTP client.  Then I visit the URL and see what the PHP code creates.  I do not need to see the PHP code on the server because I have a copy of it in front of me on my machine.

HTH, ~Ray
0
rgb192Author Commented:
May not be a security risk because i am Given browser admin access to files and filemanager. Could I download the php files and view them on my computer.
0
Ray PaseurCommented:
Could I download the php files and view them on my computer.

Yes, if you have "read" access to the files.  And you can replace the files if you have "write" access.  There are any number of FTP clients that can help with this.
0
rgb192Author Commented:
one answer is to create a browser script another answer is to just use ftp.
both work, thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.