Follow us on Twitter!
Don't judge the unknown - Grindordie
Sunday, April 20, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 24
Guests Online: 23
Members Online: 1

Registered Members: 82843
Newest Member: hx47
Latest Articles
View Thread

HellBound Hackers | Computer General | Webmasters Lounge

Author

link to view source code


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 12-09-07 17:39
hey guys

im trying to help one of my friends code some stuff on his site, and one of the things that he wants, is to have a link at the bottom of every page to show the source

any idea's on how to do thisQ

cheers

engelavdod


Author

RE: link to view source code

spyware
Member



Posts: 4192
Location: The Netherlands
Joined: 14.04.07
Rank:
God
Warn Level: 90
Posted on 12-09-07 17:59
Save every page as a .phps file and link to that.



img507.imageshack.us/img507/3580/spynewsig3il1.png
"The chowner of property." - Zeph
[small]
Widespread intellectual and moral docility may be convenient for leaders in the short term,
but it is suicidal for nations in the long term.
- Carl Sagan
“Since the grid is inescapable, what were the earlier lasers about? Does the corridor have a sense of humor?” - Ebert
[/s
http://bitsofspy.net
Author

RE: link to view source code


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 12-09-07 18:19
for viewing html source, where you show the source in div id=test:
Code

function showsource() {
document.getElementById("test").innerHTML="<plaintext>"+document.getElementsByTagName("html")[0].innerHTML+"</plaintext>";
}








Edited by on 12-09-07 18:20
Author

RE: link to view source code

spyware
Member



Posts: 4192
Location: The Netherlands
Joined: 14.04.07
Rank:
God
Warn Level: 90
Posted on 12-09-07 18:23
mr noob wrote:
for viewing html source, where you show the source in div id=test:
Code

function showsource() {
document.getElementById("test").innerHTML="<plaintext>"+document.getElementsByTagName("html")[0].innerHTML+"</plaintext>";
}





Might I point out that this is quite an ugly solution? If you use this be SURE to color tags on way or the other.



img507.imageshack.us/img507/3580/spynewsig3il1.png
"The chowner of property." - Zeph
[small]
Widespread intellectual and moral docility may be convenient for leaders in the short term,
but it is suicidal for nations in the long term.
- Carl Sagan
“Since the grid is inescapable, what were the earlier lasers about? Does the corridor have a sense of humor?” - Ebert
[/s
http://bitsofspy.net
Author

RE: link to view source code


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 12-09-07 18:27
who gives a fuck if its ugly, the source is what he wanted, the source is what he got ^^


Author

RE: link to view source code


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 12-09-07 18:37
The following works in Firefox:

Precede the href property of the anchor tag (< a >Wink with "view-source:". Smile



Author

RE: link to view source code

SySTeM
Member

Your avatar

Posts: 1524
Location: England, UK
Joined: 27.07.05
Rank:
HBH Guru
Posted on 12-09-07 18:57
Just use PHP's highlight_file() function


img138.imageshack.us/img138/6527/sig2ak1.jpg
www.hellboundhackers.org/sig/r/2783.png

http://www.elites0ft.com/
Author

RE: link to view source code


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 12-09-07 22:08
I agree with system_meltdown that he's not talking about html

Code

<?php

$disallowed = array( "config.php", "private.php" ); //More as needed
foreach ( $disallowed as $file ) if ( $_GET["f"] == $file ) die( "Not allowed to view that file" );
show_source( $_GET["f"] );

?>





OR

Code

<?php

if ( $_GET["source"] == "yes" ) die( show_source( __FILE__ ) );

?>






Author

RE: link to view source code

mido
Member

Your avatar

Posts: 613
Location: Cairo, Egypt
Joined: 27.01.07
Rank:
Monster
Posted on 12-09-07 23:01
Can't you use AJAX? (xmlHTTPrequest).


www.hellboundhackers.org/sig/r/16019.png

mido_eg3[at]hotmail.com
Author

RE: link to view source code

SySTeM
Member

Your avatar

Posts: 1524
Location: England, UK
Joined: 27.07.05
Rank:
HBH Guru
Posted on 12-09-07 23:12
Or you could use in_array, rather than using a foreach loop


img138.imageshack.us/img138/6527/sig2ak1.jpg
www.hellboundhackers.org/sig/r/2783.png

http://www.elites0ft.com/