Follow us on Twitter!
Society leans ever heavily on computers, if you have the power to take out computers you can take out society. - cubeman372
Thursday, April 17, 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: 17
Guests Online: 17
Members Online: 0

Registered Members: 82822
Newest Member: TheBunter
Latest Articles
View Thread

HellBound Hackers | Computer General | Webmasters Lounge

Author

if else echo


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 20-05-07 09:12
Okay, my CMS is going great .. But ... I need help with one little thing ...
Okay, my news system pulls the news out of a database. So the origional code i made was
Code
print ("$content");



(content was defined earlyer in the document)
Okay, so you might have guessed if $content contained any php, the script would fail and nothing would be displayed.... So .. I added an extra collum to my sql table called ifphp .... if the content had php in it i must set ifphp to 1 and otherwise leave it null ..... So .. I need help making my script to use this .. as i keep getting errors ....

Code
if ($ifphp==1){
$content;
} else {
   echo $content;
}




Any ideas???


Author

RE: if else echo


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 20-05-07 09:25
Change it back and don't put php in news posts?


Author

RE: if else echo


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 20-05-07 09:54
*sighs* k


Author

RE: if else echo


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 20-05-07 10:04
if ( ifphp == 1 )
eval ( $content );
else
echo $content;


Author

RE: if else echo


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 20-05-07 10:35
missed out an }
But now nothing comes up Sad




Edited by on 20-05-07 10:38
Author

RE: if else echo


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 20-05-07 10:53
I got a better idea ... can anyone help me mod this script
<?php
include "config.php";
?>
Code
<html>
<?php
$id = $_GET['id'];
database_connect();
$query = "SELECT * from content
          WHERE id = $id";
$error = mysql_error();
if (!$result = mysql_query($query)) {
    print "$error";
   exit;
   }

while($row = mysql_fetch_object($result)){
  $content = $row->text;
  print("$content");
   }
 
?>




So that I can also link directly to pages and open them in iframe "centerframe" instead


Author

RE: if else echo


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 20-05-07 11:06
how about

if ($phpif==1)
$id2 = ($text);
else
$id2 = ("page.php?id=$id\"Wink;



Author

RE: if else echo


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 20-05-07 12:31
Where does $text come from?

Can you explain exactly what you are trying to do and show the entire source