Jump to content

Regex Noob | hiding email & phone number?


bnovak

Recommended Posts

(sorry mods, the conversation looks like it needed to be moved out of javascript land  :shrug: )

 

This is probably going to be laugably easy for someone, but I'm totally green with PHP code and could really use a hand with this.

 

I've got a forum on my site that members to the site can post to (as well as visitors, as a "guest post") but I would like to X out or hide email addresses and phone numbers that may get posted in the forum body to non-registered guests. I don't mind if regstered (paying) users can see them but I definently need the non-paying public to have them hidden somehow.

 

The pages are all PHP based on an HTML template system - I was originally thinking java as I could run the code based on an IFEQ tag, but someone pointed out that there's not much security there, and recommended regex php.

 

I've looked through the word filters, which are close, but I need it to be somewhat dynamic for the email addresses.

 

Does this make sense to anyone, and any ideas how to get it working?

 

code from the page

{
 content_buffer_start();
}
 action_listener("call_header", "forum/postlisting.php");
 global $values;
}
?>
<style type="text/css">
    .forumtable {
        border-collapse: collapse;
        font-size: 11px;
        width: 100%;
    } .forumtable th {
        border-bottom: 1px solid #ccc;
        background: #f5f5f5;
        text-align:left;
    } .forumtable td {
        border-bottom: 1px solid #ccc;
    }
    .forum-header{
        font-weight:bold;
        font-size:16px;
    }
</style>  <?
$temp_from = $_GET['from'];
$_GET['from'] = 0;
?> 
<?
# Normal Loop start
$tmplistings = $listings;
$tempc = $c;
$tmploopttype = $looptype;
array_push($GLOBALS['values_stack'], $values);
$c = -1;
$looptype = 'normal';
$listings = get_listing_results("forum_post", false, true);
foreach($listings as $values){
    $c++;

?>
    <div class="forum-header"><table width="100%">            <tbody><tr><td><a href="http://www.enrollerconnect.com/forum">Enroller Connect Forums</a> > <a href="<?=$GLOBALS[HTTP_DOMAIN]?>/forum/topicdisplay.php?if_topicid=<?=get_tag($values, 'topicid' )?>&empty_parentid=1&topic=<?=urlencode($_GET["topic"])?>"><?=$_GET["topic"]?></a> > <?=get_tag($values, 'title' )?></td><td align="right" width="200" class="forum-header-link"><img align="absmiddle" src="<?=$GLOBALS[HTTP_DOMAIN]?>/images/add.png" alt="" />                 <a href="<?=$GLOBALS[HTTP_DOMAIN]?>/forum/forum_post.php?parentid=<?=get_tag($values, 'id' )?>&topicid=<?=get_tag($values, 'topicid' )?>&title=RE:+<?=urlencode(get_tag($values, 'title' )) ?>">Reply this post</a></td></tr>        </tbody></table></div>    <br /> 
<?}
# Loop End
$listings = $tmplistings;
$values = array_pop($GLOBALS['values_stack']);
$c = $tempc;
if($itemline && $looptype == 'table'){
  echo "</td></tr></table>";
  $itemline=$tmpitemline;
}else{
  echo "";
}
$looptype = $tmploopttype;
?>
<?
$_GET['from'] = $temp_from;
?> 
<?
# Normal Loop start
$tmplistings = $listings;
$tempc = $c;
$tmploopttype = $looptype;
array_push($GLOBALS['values_stack'], $values);
$c = -1;
$looptype = 'normal';
$listings = get_listing_results("forum_post", false, false);
foreach($listings as $values){
    $c++;

?>
  <table cellspacing="0" cellpadding="3" width="100%" id="post-<?=get_tag($values, 'id' )?>">     <tbody><tr>         <td width="90" valign="top"><?  if(get_tag($values, "login", false, true) === ""){?>                 <img width="80" src="<?=$GLOBALS[HTTP_DOMAIN]?>/images/no_picture.png" alt="" />                 <br />                 Posted By:<br /> <strong><?=get_tag($values, 'name' )?> </strong><?  }else{ ?>                 <a href="<?=$GLOBALS[HTTP_DOMAIN]?>/profile/details.php?if_login=<?=get_tag($values, 'login' )?>">                     <div style="overflow:hidden; width:80px; height:80px; "><img  align="absmiddle" border="0" src="<?=get_tag($values, 'profilePicture' )?>" width="80" /></div>                 </a>                 <br />                 <b>User: </b><a href="<?=$GLOBALS[HTTP_DOMAIN]?>/profile/details.php?if_login=<?=get_tag($values, 'login' )?>"><?=get_tag($values, 'username' )?></a><br />                 <b>Posts: </b><?=count_user_posts($values[login_relation])?><br />                 <?  if(check_owner($values)){ ?>                     <img align="absmiddle" src="<?=$GLOBALS[HTTP_DOMAIN]?>/images/pencil.png" alt="" /> <a href="<?=$GLOBALS[HTTP_DOMAIN]?>/forum/forum_post_update.php?if_id=<?=get_tag($values, 'id' )?>">Edit post</a><br /><?  } ?>             <?  } ?><br />         Posted On<br /><?=format_date(get_tag($values, 'added' ), "F d, Y") ?></td>         <td valign="top"><table cellspacing="0" cellpadding="4" class="forumtable">                 <tbody><tr>                     <th><?  if(get_tag($values, "title", false, true) === ""){?>                             RE: <?=$values["parentid_relation"]["title"] ?>                         <?  }else{ ?>                             <?=get_tag($values, 'title' )?>                         <?  } ?></th>                 </tr>                 <tr>                     <td style="border-bottom: medium none;"><?=get_tag($values, 'post' )?></td>                 </tr>             </tbody></table></td>     </tr> </tbody></table> <hr style="border-width: 1px medium medium; border-style: solid none none; border-color: rgb(204, 204, 204) -moz-use-text-color -moz-use-text-color;" /> 
<?}
# Loop End
$listings = $tmplistings;
$values = array_pop($GLOBALS['values_stack']);
$c = $tempc;
if($itemline && $looptype == 'table'){
  echo "</td></tr></table>";
  $itemline=$tmpitemline;
}else{
  echo "";
}
$looptype = $tmploopttype;
?>
<?=print_paging(false, false)?><div style="text-align: center;"><br /><br /><? include_template(LIVE_PATH.'advertisements/google_leaderboard.php', true) ?></div><br />
<?php
if(!$GLOBALS[plain_content]){
 action_listener("call_footer", "forum/postlisting.php");
if(!$noheader){
 content_buffer_end();
}
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.