MyBB Community Forums

Full Version: Displaying the user in the field, greeting
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Today I downloaded a 'Greetings Online v2.1 v2.1' and would like to change that when I send greetings to the nickname is the same as the forum did not write what we want in the field already is just the nick of the forum, I used $ mybb-> user ['username '] but it is a mistake

<?php

define("IN_MYBB", 1);

require_once "./global.php";
require_once "./inc/init.php";

$options = $_GET[go];

if (($_GET[f]=="iframe") or ($options=="add")) $config->files = './';
else if (!$_GET[f]) $config->files = './pozdroonline/';

(@include($config->files.'config.php')) or die('Spróbuj ./pozdro.php?f=iframe');
(@include($config->files.'function.php')) or die('Brak pliku '.$config->files.'function.php');
(@include($config->files.'baza/ustawienia.php')) or die('Brak pliku '.$config->files.'baza/ustawienia.php');

head();

if ($options=="add") {
	function form($info='', $req='') {
		if (($info) and ($req)) {
			info($info, $req);
			echo '<p></p>';
		}

		echo '<form action="pozdro.php?go=add" method="post">
		<table border="0" height="200" width="100%">
		  <center><tr>
		    <td class="trow1">Kto pozdrawia:</b><br><input type="text" name="nick" value="'.$mybb->user['uid'].'" disabled="disabled" size="40"></td>
		  </tr></center>
		  <center><tr>
		    <td class="trow2">Tre¶ć pozdrowień:</b><br><textarea name="tresc" rows="3" cols="30"></textarea></td>
		  </tr></center>
		  <center><tr>
		    <td><input type="submit" value="Wy¶lij Pozdrowienie" class="psik" name="send"></td>
		  </tr></center>
		</table>
	      </form>';
	}

	if ($_POST[send]) {
		echo '<table border="0" height="325" width="100%">
		  <tr>
		    <td>';

			$file = file('baza/pozdro.dat');
			$file = array_reverse($file);
			$wiersz = explode('||',$file[0]);

			$pozdro->id = $wiersz[0] + 1;
			$pozdro->date = date("Y-m-d H:i:s");
			$pozdro->nick = htmlspecialchars($_POST[nick]);
			$pozdro->tresc = htmlspecialchars($_POST[tresc]);
			$pozdro->ip = htmlspecialchars($_SERVER[REMOTE_ADDR]);

			if (!$file = @fopen('baza/pozdro.dat', 'ab')) form('Nie można dodać nowych pozdrowień!','error');
			else if (!$pozdro->tresc) form('Nie wpisałe¶ tre¶ci pozdrowienia!','error');
			else if (strlen($pozdro->tresc)>$config->znak) form('Zbyt długa tre¶ć pozdrowienia!','error');
			else {
				if ($config->moder=="1") $status = 0;
				else $status = 1;

				fwrite($file, $pozdro->id."||".$pozdro->nick."||".$pozdro->tresc."||".$pozdro->date."||".$pozdro->ip."||".$status."||\n");
				fclose($file);
				info('Pozdrowienia zostały wysłane!','ok');
			}

		    echo '</td>
		  </tr>
		  <tr>
		    <td height="20" class="stopka"><a href="http://serious-rp.xaa.pl/announcements.php?aid=1"><font color="red"><b>Regulamin serwera i forum</b></font></a></td>
		  </tr>
		</table>';
	}
	else form();
} else {
	echo '<table class="tible">
	  <tr>
	    <td width="'.$config->szer.'">';
		if (file_exists($config->files.'baza/pozdro.dat')) {
			if ($file=@file($config->files.'baza/pozdro.dat')) {
				echo '<marquee scrollamount="'.$config->speed.'" width="'.$config->szer.'">';

				$is = 0;
				for ($i=0; $i<count($file); $i++) {
					$wiersz = explode('||', $file[$i]);
					if ($wiersz[5]==1) {
						$ex = explode(" ",$wiersz[3]);
						$tresc = $config->thems;
						$co = array('{nick}', '{tresc}', '{data}', '{godzina}');
						$naco = array($wiersz[1], $wiersz[2], $ex[0], $ex[1]);
						$tresc = str_replace($co, $naco, $tresc);
						$pozdro[] = array("id"=>"$wiersz[id]", "tresc"=>"$tresc");
						$is++;
					}
				}

				if ($is!==0) {
					if ($config->sort==1) rsort($pozdro);
					else sort($pozdro);

					if ((count($pozdro)>$config->ile) and ($config->ile!=="0")) $ile = $config->ile;
					else $ile = count($pozdro);

					for ($i=0; $i<$ile; $i++) {
						$dane = $pozdro[$i];
						echo $dane[tresc];
					}
				} else echo '<center><font color="red"><b>Brak pozdrowień!</b></font></center>';
			} else echo '<center><font color="red"><b>Brak pozdrowień!</b></font></center>';
		} else echo '<center><font color="red"><b>Brak pliku z pozdrowieniami!</b></font></center>';

}

bottom();

output_page($out);
         
?>
So I suggest to rewrite the code under $ mybb

echo of laughter in MyBB, this here is not used

is something like $ templates and templates