Page 1 of 1

Quick Question!!!

Posted: Tue Oct 08, 2002 8:44 pm
by compwiz61985
Hello! I have a script! I would like to have the output of the script to be placed into a Iframe or anything else so it have a scrollbar! This way i can have the output at a max hight of 300 and if its any bigger a scroller is made to scroll throught it! What tag or whatever will do this???

Part of script needing editing as followed!
but full one can be DL at http://net-xperience.org/download/SB.zip



Code: Select all

<script Language="JavaScript">
<!--
function popup(url, name, width, height)
&#123;
settings=
"toolbar=no,location=no,directories=no,"+
"status=no,menubar=no,scrollbars=yes,"+
"resizable=yes,width="+width+",height="+height;

MyNewWindow=window.open(url,name,settings);
&#125;

function x () &#123;
return;
&#125;

function DoSmilie(addSmilie) &#123;

var addSmilie;
var revisedMessage;
var currentMessage = document.form1.comment.value;
revisedMessage = currentMessage+addSmilie;
document.form1.comment.value=revisedMessage;
document.form1.comment.focus();
return;
&#125;

//-->
</script>
<?php
/************************************************************************/
/* PHP-NUKE: ShoutBlock									*/
/* ================================                                     */
/*                                                                      */
/* Copyright (c) 2002 by Quiecom		                              */
/* http://www.Quiecom.com                                               */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation                                         */
/************************************************************************/

//Basic Page Junk here//
if (eregi("block-Counter.php",$PHP_SELF)) &#123;
    Header("Location: index.php");
    die();
&#125;

include("config.php");
include("modules/Qshoutblock/functions.php");




//Testing of submit//
if($Submit == "shout")&#123;
	$test = 0;
	$yr = date(Y); 
	$mnth = date(m); 
	$dy = date(d); 
	$day = "$mnth-$dy-$yr";
	$h = date(g); 
	$m = date(i); 
	$ap = date(a); 
	$time = "$h:$m:$ap";


//Code testing, adding security with each process :) //
	
	//lots of little tests	
	$num = strlen($comment);
	if($num < 2)&#123; $error ="toshort"; &#125;
	
	
	if($num > 2500)&#123; $error="tolong"; &#125;
	
	if(!$comment)&#123; $error ="notext"; &#125;
	
	if($conf&#1111;2] == $comment)&#123; $error ="sameposting"; &#125;
	
	//no more XSS....more or less...needs work..//
	if (eregi("javascript:(.*)", $comment))
		&#123; $error = "javascript"; &#125;
	
	
	//add test to ensure all images have close tag on them, and $comment is not longer then 200char//
	$needle1 = "<";
	$needle2 = ">";
	$oore1 = count(explode($needle1,$comment)) - 1;
	$oore2 = count(explode($needle2,$comment)) - 1;
	$done = $oore1 + $oore2;
	if(1 & $done)&#123; $error ="oddnumberofbrackets"; &#125;

	//Fix people entering urls.
	$comment = ereg_replace("(&#1111;^ ]&#123;42&#125;)","\\1",$comment);
	$comment = str_replace('<', '<', $comment);
	$comment = str_replace('>', '>', $comment);

		//Fix log words
	//$comment = wordwrap( $comment, 21, " ", 1);
		if (eregi("\&#1111;\/url\](.*)", $comment))&#123;
		$splits=explode(" ",$comment);
		$maxchar = 21;
		
		foreach($splits as $split)&#123;
		
			if(!eregi("http", $split))&#123;
			$len=(strlen($split));
			if($len>$maxchar)&#123; 
			$comment=$comment." ".$split; &#125;&#125; 
		&#125;
		
		&#125; else &#123; $comment = wordwrap( $comment, 21, " ", 1); &#125;
	
	
	if($conf&#1111;10] == "yes")&#123;
	//Allow for URL tags
	if (eregi("\&#1111;url\](.*)", $comment))
		&#123; $url = "1"; &#125;
		
	if (eregi("\&#1111;\/url\](.*)", $comment))
		&#123; $url2 = "1"; 
	if (!eregi("http://(.*)", $comment))
		&#123; $error = "nohttpinurl"; &#125;
	if (!eregi("\.(.*)", $comment))
		&#123; $error = "nodotinurl"; &#125;
	&#125;
	
	if($url && $url2)&#123;
	$comment = ereg_replace("\&#1111;url\]","<a href=",$comment);
	$comment = ereg_replace("\&#1111;\/url\]",">url<\/a>",$comment);
	&#125;
	&#125; else &#123;
	if (eregi("\&#1111;url\](.*)", $comment))
		&#123; $error = "urlpostingnoallowed"; &#125;
	&#125;
	


	//Icons from database
	$eresult = sql_query("select * from ".$prefix."_quiecom_shoutblock_emoticons", $dbi);
	while ($emoticons = mysql_fetch_row($eresult))&#123;
	$comment = str_replace($emoticons&#1111;1],$emoticons&#1111;2],$comment);&#125;
	
	//do ipblock test then error if on list
	if($conf&#1111;6] == "yes")&#123;
	$ipresult = sql_query("select * from ".$prefix."_quiecom_shoutblock_ipblock", $dbi);
	while ($badips = mysql_fetch_row($ipresult))&#123;
	if($REMOTE_ADDR == $badips&#1111;1])
	$error ="bannedip";&#125;
	&#125;
	
	//do name test then error if on list
	if($conf&#1111;7] == "yes")&#123;
	$nameresult = sql_query("select * from ".$prefix."_quiecom_shoutblock_nameblock", $dbi);
	while ($badname = mysql_fetch_row($nameresult))&#123;
	if($username == $badname&#1111;1])
	$error ="bannedusername";&#125;
	&#125;
	
	//look for bad words, then censor them.
	//need to make this case insensitive.
	if($conf&#1111;8] == "yes")&#123;
	
	$cresult = sql_query("select * from ".$prefix."_quiecom_shoutblock_censor", $dbi);
	while ($censor = mysql_fetch_row($cresult))&#123;
	$one = strtolower($censor&#1111;1]);
	$two = strtolower($censor&#1111;2]);
	$comment = strtolower($comment);
	$comment = " $comment";
	$comment = str_replace($one,$two,$comment);	&#125;
	&#125;
	
	
	
	//if error just reload page, else add posting.
	if($error)&#123;
	print "error: $error";
	//Header("Location: index.php");
	&#125; else &#123;
	sql_query("INSERT INTO ".$prefix."_quiecom_shoutblock (id,name,comment,date,time ) VALUES ('0','$username ','$comment','$day','$time')",$dbi);
	Header("Location: index.php");
	exit;&#125;
	&#125;
?>

<?php
//Display Content From here on down//
$query = "select * from ".$prefix."_quiecom_shoutblock order by id DESC LIMIT $conf&#1111;5]";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());

$content .= "<br>";
$content .= "<form name="form1" method="post" action="">";
  $content .= "<table style="table-layout:fixed" width="$conf&#1111;9]" border="0" align=center>";
    $flag = 1;
	while ($row = mysql_fetch_row($result))&#123; 	
	if($flag == 1)&#123; $bgcolor = "$conf&#1111;1]"; &#125;
	if($flag == 2)&#123; $bgcolor = "$conf&#1111;2]"; &#125;
	$content .= "<tr>";
      $content .= "<td bgcolor=$bgcolor>";
	  
	  if ($username == "Anonymous") &#123;
	   $content .= "<b>$row&#1111;1]:</b> $row&#1111;2]<br>";&#125;
	  else &#123; $content .= "<a href="/modules.php?name=Your_Account&op=userinfo&uname=$row&#1111;1]"><b>$row&#1111;1]:</b></a>  $row&#1111;2]<br>"; &#125;
	  
	  if($conf&#1111;3] == "yes") &#123; $content .= "$row&#1111;3]"; &#125; 
	  if($conf&#1111;4] == "yes") &#123; $content .= "$row&#1111;4]"; &#125;
	  $content .= "</td>";
    $content .= "</tr>";
    if($flag == 1)
		&#123; $flag = 2; &#125;
	elseif($flag == 2)
		&#123; $flag =1; &#125;
		
	&#125;
    //Allow Anonymous visitors to shout
	if($conf&#1111;12] == "no")&#123;
	
	if ($username == "Anonymous") &#123;
	$content .= "<tr>";
       $content .= "<td><br><div align=center>Only Registered Users can Shout<br><a href="/modules.php?name=Your_Account">Create/Login</a><br></div></td>";
    	$content .= "</tr>";
	&#125; 
	else &#123;
	$content .= "<tr>";
      $content .= "<td>";
        $content .= "<input type="text" name="comment">";
      $content .= "</td>";
    	$content .= "</tr>";
    	$content .= "<tr>";
      $content .= "<td>";
        $content .= "<input type="submit" name="Submit" value="shout"><br>";
	  $nameresult = sql_query("select * from ".$prefix."_quiecom_shoutblock_emoticons", $dbi);
	  while ($emoticons = mysql_fetch_row($nameresult))&#123;
		$emoticons&#1111;2] = str_replace('=', '=/', $emoticons&#1111;2]);
		$emoticons&#1111;3] = str_replace('>', '', $emoticons&#1111;2]);
		$content .= "<A href="javascript: x()" onClick="DoSmilie(' $emoticons&#1111;1] ');">$emoticons&#1111;3] border="0" alt="$emoticons&#1111;1]" hspace="2" vspace="2"></A>";
	  &#125;	 
	$content .= "</td>";
    	$content .= "</tr>";
	&#125;	
	&#125; 
	
	else &#123;
	$content .= "<tr>";
      $content .= "<td>";
        $content .= "<input type="text" name="comment">";
      $content .= "</td>";
    	$content .= "</tr>";
    	$content .= "<tr>";
      $content .= "<td>";
        $content .= "<input type="submit" name="Submit" value="shout"><br>";
	  $nameresult = sql_query("select * from ".$prefix."_quiecom_shoutblock_emoticons", $dbi);
	  while ($emoticons = mysql_fetch_row($nameresult))&#123;
		$emoticons&#1111;2] = str_replace('=', '=/', $emoticons&#1111;2]);
		$emoticons&#1111;3] = str_replace('>', '', $emoticons&#1111;2]);
		$content .= "<A href="javascript: x()" onClick="DoSmilie(' $emoticons&#1111;1] ');">$emoticons&#1111;3] border="0" alt="$emoticons&#1111;1]" hspace="2" vspace="2"></A>";
	  &#125;	 
	$content .= "</td>";
    	$content .= "</tr>";
	&#125;
	
  $content .= "</table>";
$content .= "</form>";
?>

Posted: Tue Oct 08, 2002 8:47 pm
by hob_goblin
try this:

Code: Select all

<div style="
	border:0;
	height:300px;
	width:100%;
	overflow:auto;">

</div>
now, just put what you want to scroll inside the <div>...</div> tags

Posted: Tue Oct 08, 2002 8:57 pm
by compwiz61985
That dose not seem to work! If I put it in the <?php I get tht it had a unexpected "<" If its out side nothing happenes but a large void in the page everything is pushed from! Any ideas???

Posted: Tue Oct 08, 2002 8:59 pm
by hob_goblin
okay, try this then:

Code: Select all

echo '<div style=" 
   border:0; 
   height:300px; 
   width:100%; 
   overflow:auto;">';

// ECHO THE STUFF YOU WANT INSIDE IT HERE

echo '</div> ';

Posted: Tue Oct 08, 2002 9:06 pm
by compwiz61985
nope that don't work eather! Makes a void!

Posted: Tue Oct 08, 2002 9:10 pm
by hob_goblin
compwiz61985 wrote:nope that don't work eather! Makes a void!
Are you actually putting what you want in there like i instructed? or just copying it into your code..

Posted: Wed Oct 09, 2002 2:47 pm
by compwiz61985
It nowlooks likethis! Tell me whats wrong!

Code: Select all

<script Language="JavaScript">
<!--
function popup(url, name, width, height)
&#123;
settings=
"toolbar=no,location=no,directories=no,"+
"status=no,menubar=no,scrollbars=yes,"+
"resizable=yes,width="+width+",height="+height;

MyNewWindow=window.open(url,name,settings);
&#125;

function x () &#123;
return;
&#125;

function DoSmilie(addSmilie) &#123;

var addSmilie;
var revisedMessage;
var currentMessage = document.form1.comment.value;
revisedMessage = currentMessage+addSmilie;
document.form1.comment.value=revisedMessage;
document.form1.comment.focus();
return;
&#125;

//-->
</script>

<?php
echo '<div style=" 
   border:0; 
   height:300px;
   width:100%; 
   overflow:auto;">';
/************************************************************************/
/* PHP-NUKE: ShoutBlock									*/
/* ================================                                     */
/*                                                                      */
/* Copyright (c) 2002 by Quiecom		                              */
/* http://www.Quiecom.com                                               */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation                                         */
/************************************************************************/

//Basic Page Junk here//
if (eregi("block-Counter.php",$PHP_SELF)) &#123;
    Header("Location: index.php");
    die();
&#125;

include("config.php");
include("modules/Qshoutblock/functions.php");




//Testing of submit//
if($Submit == "shout")&#123;
	$test = 0;
	$yr = date(Y); 
	$mnth = date(m); 
	$dy = date(d); 
	$day = "$mnth-$dy-$yr";
	$h = date(g); 
	$m = date(i); 
	$ap = date(a); 
	$time = "$h:$m:$ap";


//Code testing, adding security with each process :) //
	
	//lots of little tests	
	$num = strlen($comment);
	if($num < 2)&#123; $error ="toshort"; &#125;
	
	
	if($num > 2500)&#123; $error="tolong"; &#125;
	
	if(!$comment)&#123; $error ="notext"; &#125;
	
	if($conf&#1111;2] == $comment)&#123; $error ="sameposting"; &#125;
	
	//no more XSS....more or less...needs work..//
	if (eregi("javascript:(.*)", $comment))
		&#123; $error = "javascript"; &#125;
	
	
	//add test to ensure all images have close tag on them, and $comment is not longer then 200char//
	$needle1 = "<";
	$needle2 = ">";
	$oore1 = count(explode($needle1,$comment)) - 1;
	$oore2 = count(explode($needle2,$comment)) - 1;
	$done = $oore1 + $oore2;
	if(1 & $done)&#123; $error ="oddnumberofbrackets"; &#125;

	//Fix people entering urls.
	$comment = ereg_replace("(&#1111;^ ]&#123;42&#125;)","\\1",$comment);
	$comment = str_replace('<', '<', $comment);
	$comment = str_replace('>', '>', $comment);

		//Fix log words
	//$comment = wordwrap( $comment, 21, " ", 1);
		if (eregi("\&#1111;\/url\](.*)", $comment))&#123;
		$splits=explode(" ",$comment);
		$maxchar = 21;
		
		foreach($splits as $split)&#123;
		
			if(!eregi("http", $split))&#123;
			$len=(strlen($split));
			if($len>$maxchar)&#123; 
			$comment=$comment." ".$split; &#125;&#125; 
		&#125;
		
		&#125; else &#123; $comment = wordwrap( $comment, 21, " ", 1); &#125;
	
	
	if($conf&#1111;10] == "yes")&#123;
	//Allow for URL tags
	if (eregi("\&#1111;url\](.*)", $comment))
		&#123; $url = "1"; &#125;
		
	if (eregi("\&#1111;\/url\](.*)", $comment))
		&#123; $url2 = "1"; 
	if (!eregi("http://(.*)", $comment))
		&#123; $error = "nohttpinurl"; &#125;
	if (!eregi("\.(.*)", $comment))
		&#123; $error = "nodotinurl"; &#125;
	&#125;
	
	if($url && $url2)&#123;
	$comment = ereg_replace("\&#1111;url\]","<a href=",$comment);
	$comment = ereg_replace("\&#1111;\/url\]",">url<\/a>",$comment);
	&#125;
	&#125; else &#123;
	if (eregi("\&#1111;url\](.*)", $comment))
		&#123; $error = "urlpostingnoallowed"; &#125;
	&#125;
	


	//Icons from database
	$eresult = sql_query("select * from ".$prefix."_quiecom_shoutblock_emoticons", $dbi);
	while ($emoticons = mysql_fetch_row($eresult))&#123;
	$comment = str_replace($emoticons&#1111;1],$emoticons&#1111;2],$comment);&#125;
	
	//do ipblock test then error if on list
	if($conf&#1111;6] == "yes")&#123;
	$ipresult = sql_query("select * from ".$prefix."_quiecom_shoutblock_ipblock", $dbi);
	while ($badips = mysql_fetch_row($ipresult))&#123;
	if($REMOTE_ADDR == $badips&#1111;1])
	$error ="bannedip";&#125;
	&#125;
	
	//do name test then error if on list
	if($conf&#1111;7] == "yes")&#123;
	$nameresult = sql_query("select * from ".$prefix."_quiecom_shoutblock_nameblock", $dbi);
	while ($badname = mysql_fetch_row($nameresult))&#123;
	if($username == $badname&#1111;1])
	$error ="bannedusername";&#125;
	&#125;
	
	//look for bad words, then censor them.
	//need to make this case insensitive.
	if($conf&#1111;8] == "yes")&#123;
	
	$cresult = sql_query("select * from ".$prefix."_quiecom_shoutblock_censor", $dbi);
	while ($censor = mysql_fetch_row($cresult))&#123;
	$one = strtolower($censor&#1111;1]);
	$two = strtolower($censor&#1111;2]);
	$comment = strtolower($comment);
	$comment = " $comment";
	$comment = str_replace($one,$two,$comment);	&#125;
	&#125;
	
	
	
	//if error just reload page, else add posting.
	if($error)&#123;
	print "error: $error";
	//Header("Location: index.php");
	&#125; else &#123;
	sql_query("INSERT INTO ".$prefix."_quiecom_shoutblock (id,name,comment,date,time ) VALUES ('0','$username ','$comment','$day','$time')",$dbi);
	Header("Location: index.php");
	exit;&#125;
	&#125;
?>

<?php
//Display Content From here on down//
$query = "select * from ".$prefix."_quiecom_shoutblock order by id DESC LIMIT $conf&#1111;5]";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());

$content .= "<br>";
$content .= "<form name="form1" method="post" action="">";
  $content .= "<table style="table-layout:fixed" width="$conf&#1111;9]" border="0" align=center>";
    $flag = 1;
	while ($row = mysql_fetch_row($result))&#123; 	
	if($flag == 1)&#123; $bgcolor = "$conf&#1111;1]"; &#125;
	if($flag == 2)&#123; $bgcolor = "$conf&#1111;2]"; &#125;
	$content .= "<tr>";
      $content .= "<td bgcolor=$bgcolor>";
	  
	  if ($username == "Anonymous") &#123;
	   $content .= "<b>$row&#1111;1]:</b> $row&#1111;2]<br>";&#125;
	  else &#123; $content .= "<a href="/modules.php?name=Your_Account&op=userinfo&uname=$row&#1111;1]"><b>$row&#1111;1]:</b></a>  $row&#1111;2]<br>"; &#125;
	  
	  if($conf&#1111;3] == "yes") &#123; $content .= "$row&#1111;3]"; &#125; 
	  if($conf&#1111;4] == "yes") &#123; $content .= "$row&#1111;4]"; &#125;
	  $content .= "</td>";
    $content .= "</tr>";
    if($flag == 1)
		&#123; $flag = 2; &#125;
	elseif($flag == 2)
		&#123; $flag =1; &#125;
		
	&#125;
    //Allow Anonymous visitors to shout
	if($conf&#1111;12] == "no")&#123;
	
	if ($username == "Anonymous") &#123;
	$content .= "<tr>";
       $content .= "<td><br><div align=center>Only Registered Users can Shout<br><a href="/modules.php?name=Your_Account">Create/Login</a><br></div></td>";
    	$content .= "</tr>";
	&#125; 
	else &#123;
	$content .= "<tr>";
      $content .= "<td>";
        $content .= "<input type="text" name="comment">";
      $content .= "</td>";
    	$content .= "</tr>";
    	$content .= "<tr>";
      $content .= "<td>";
        $content .= "<input type="submit" name="Submit" value="shout"><br>";
	  $nameresult = sql_query("select * from ".$prefix."_quiecom_shoutblock_emoticons", $dbi);
	  while ($emoticons = mysql_fetch_row($nameresult))&#123;
		$emoticons&#1111;2] = str_replace('=', '=/', $emoticons&#1111;2]);
		$emoticons&#1111;3] = str_replace('>', '', $emoticons&#1111;2]);
		$content .= "<A href="javascript: x()" onClick="DoSmilie(' $emoticons&#1111;1] ');">$emoticons&#1111;3] border="0" alt="$emoticons&#1111;1]" hspace="2" vspace="2"></A>";
	  &#125;	 
	$content .= "</td>";
    	$content .= "</tr>";
	&#125;	
	&#125; 
	
	else &#123;
	$content .= "<tr>";
      $content .= "<td>";
        $content .= "<input type="text" name="comment">";
      $content .= "</td>";
    	$content .= "</tr>";
    	$content .= "<tr>";
      $content .= "<td>";
        $content .= "<input type="submit" name="Submit" value="shout"><br>";
	  $nameresult = sql_query("select * from ".$prefix."_quiecom_shoutblock_emoticons", $dbi);
	  while ($emoticons = mysql_fetch_row($nameresult))&#123;
		$emoticons&#1111;2] = str_replace('=', '=/', $emoticons&#1111;2]);
		$emoticons&#1111;3] = str_replace('>', '', $emoticons&#1111;2]);
		$content .= "<A href="javascript: x()" onClick="DoSmilie(' $emoticons&#1111;1] ');">$emoticons&#1111;3] border="0" alt="$emoticons&#1111;1]" hspace="2" vspace="2"></A>";
	  &#125;	 
	$content .= "</td>";
    	$content .= "</tr>";
	&#125;
	
  $content .= "</table>";
$content .= "</form>";
echo '</div> ';
?>

Posted: Wed Oct 09, 2002 4:08 pm
by Coco
well for one you shouldnt have an echo before a header("location:") statement

Posted: Wed Oct 09, 2002 5:08 pm
by hob_goblin
and change

Code: Select all

echo '</div> ';
to

Code: Select all

echo $content.'</div> ';

Posted: Thu Oct 10, 2002 8:36 pm
by compwiz61985
No That don't work eather!

Parse error: parse error, unexpected '<' in /home/net-xper/public_html/blocks/block-ShoutBlock.php on line 54

Code: Select all

include("config.php");
include("modules/Qshoutblock/functions.php");
// line 54 is below
&lt;div style=" 
   border:0; 
   height:300;
   width:500; 
   overflow:auto;"&gt;;

//Testing of submit//
if($Submit == "shout"){

Posted: Fri Oct 11, 2002 1:47 am
by twigletmac
First of all that's a lot of code to continue posting and expecting people to read through especially since you've put it into [syntax=php][/syntax] tags and not [syntax=php][/syntax] tags which would at least give some code highlighting. There are 269 lines of code and the error says it is occuring on line 54 so we really don't much more than up to line 60 and considering it's all comments and things you haven't changed, posting up to line 49 was also a bit pointless. Please narrow down your problem better next time.

(Have truncated post being refered to)

Mac

Posted: Fri Oct 11, 2002 1:52 am
by twigletmac
Ok now that I've got that out of the way, you need to echo the div tag you put in or close and then open the PHP tags around it so:

Code: Select all

echo '&lt;div style="border:0; height:300; width:500; overflow:auto;"&gt;';
or

Code: Select all

? &gt;
&lt;div style=" 
   border:0; 
   height:300; 
   width:500; 
   overflow:auto;"&gt;; 
&lt;?php
(There shouldn't be a space between the ? and the > on the first line but it won't show if I don't put one in.)

Mac

Posted: Fri Oct 11, 2002 5:40 am
by Coco
and as twig normally would say....
we aint a script writing service, if you arent prepared to learn the coding (which clearly you arent) either take phpnuke as its default or pay someone to do it for you

we are all happy to help people who have problems with what they are learning

Posted: Fri Oct 11, 2002 2:37 pm
by compwiz61985
Its working! Thank U all for the help! I think I have learned some new stuff from this! Thanx!