Jump to content

xRhysx

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

xRhysx's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. i use other stuff with the bbcode, not only the php tags. i can't think of any other way to do it either, stripping out only the php to highlight it.
  2. [!--quoteo(post=354966:date=Mar 14 2006, 05:52 PM:name=obsidian)--][div class=\'quotetop\']QUOTE(obsidian @ Mar 14 2006, 05:52 PM) [snapback]354966[/snapback][/div][div class=\'quotemain\'][!--quotec--] the issue is that you must TELL highlight_string() to return the value. by default, it only returns a TRUE or FALSE, so to run echo on it, you need to specify it to return the new string: [code] echo highlight_string(convert_bbcodes( $content ), true); [/code] hope this helps [/quote] no, because that will highlight all of the tutorial. the tutorials contain html aswell, and this causes html to show, not formatted. i need it to select only the php parts, and highlight that bit. i'm using bbcode [php [/code] tags for php code. i've done these files anyway. example: [a href=\"http://www.mfwp.net/test/test.php\" target=\"_blank\"]here[/a] test.php [code]<?php $dbhost = "localhost"; $dbuser = "*****"; $dbpass = "*****"; $dbname = "*****"; $connection = mysql_connect($dbhost, $dbuser, $dbpass) or die (mysql_error()); mysql_select_db($dbname, $connection) or die (mysql_error()); $query = "SELECT * FROM tutorials WHERE category = 'test'"; $result = mysql_query($query, $connection) or die (mysql_error()); $data = mysql_fetch_array($result); $content = nl2br($data['content']); $title = $data['title']; include("bbcode.php"); echo "$title<br><br>"; echo convert_bbcodes( $content ); ?>[/code] bbcode.php [code]<?php $bb_codes = array(   '[code]' => '<table width="100%" border="1" cellpadding="3" cellspacing="0" bordercolor="#111111" style="border-collapse: collapse" />   <tr>     <td bgcolor="#DFDFFF" /><strong>CODE</strong></td>   </tr>   <tr>     <td>',   '[/code]' => '</td></tr></table>' ); function convert_bbcodes( $t ) { $search = array_keys( $GLOBALS['bb_codes'] ); $t = str_replace( $search, $GLOBALS['bb_codes'], $t ); $t = eregi_replace("\\[php\\]([^\\[]*)\\[/php\\]", "&lt;?php<br>".highlight_string('\\1', true)."<br>?&gt;",$t); return $t; } ?>[/code] database tutorial: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]hey this is the output i get from the highlight_string function. all tutorials are placed into a database like this. also bbcode tags are used, which might be the problem, it's echo'ing the highlight_string, which i don't think likes being echo'ed. anyway, examples. you'll see how this is done in the code. [codetag] [code=php:0]echo "my text or tutorial here, in this format.";[/code] [/codetag][/quote] hopefully, you'll understand the problem i have, and come up with a soloution. thanks.
  3. i'll make 2 example files and post the code in a bit...
  4. i'm trying to make a tutorial page look really neat, by using the highlight_string() function in php. it doesen't seem to work, i've tried it in so many ways. maybe because of the way it's doing things. i'll explain... the tutorials are in a database. i'm using a bbcode.php to put in bold text, smilies etc.. and [code=php:0][/code] for the php tags, as it has problems with echo'ing these (obviously lol). at the end it returns the edited string. i'm using echo convert_bbcodes( $content ); to show the tutorial, with all the editited text. i've placed highlight_string() in both files the bbcode and tutorials files, i've placed it everywhere. eg: echo highlight_string(convert_bbcodes( $content )); echo convert_bbcodes(highlight_string( $content )); everytime i've tried it, i either get an error, or it shows the html. any help?
  5. Soon I will be making a membership system for my website. I will be requiring users to activate their accounts incase of a fake email address. I'm not quite sure how to make the users account delete itself within 24 hours if it is not not activated. Like the Invision Power Board does, it asks you to activate your account within 24 hours or it's deleted. Thanks for any help.
  6. i think i see the problem.. try using the code below. <?php session_start(); require_once('Connections/tbbdb.php'); // *** Validate request to login to this site. if(!session_is_registered('loginUsername')) { $loginFormAction = $_SERVER['PHP_SELF']; if (isset($_GET['accesscheck'])) { $accesscheck = $_GET['accesscheck']; session_register('accesscheck'); } if (isset($_POST['username'])) { $loginUsername=$_POST['username']; $password=$_POST['password']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "index.php"; $MM_redirectLoginFailed = "login_bad.php"; $MM_redirecttoReferrer = false; mysql_select_db($database_tbbdb, $tbbdb); $LoginRS__query=sprintf("SELECT username, password FROM users WHERE username='%s' AND password='%s'", get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password)); $LoginRS = mysql_query($LoginRS__query, $tbbdb) or die(mysql_error()); $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = ""; //declare two session variables and assign them session_register('loginUsername'); session_register('loginStrGroup'); if (isset($_SESSION['PrevUrl']) && false) { session_register('MM_redirectLoginSuccess'); } header("Location: " . $_SESSION['MM_redirectLoginSuccess'] ); } else { header("Location: ". $MM_redirectLoginFailed ); } } ?> <form name="form1" method="POST" action="<?php echo $loginFormAction; ?>"> Username: <input name="username" type="text" id="username"> Password: <input name="password" type="text" id="password"> <input type="submit" name="Submit" value="Submit"> </form> i think thats all that needs fixing. the main error i found was session_start(); was not the first function in the php tags. remember, session_start(); must become before ANYTHING in your php code for it to work. try this
×
×
  • 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.