\n"); echo("
"); echo("Post Info:
"); $c2g_info = $_REQUEST['c2g_info']; list($c2g_date, $c2g_ip) = explode('|', $c2g_info); echo(date("F j, Y, g:i a", $c2g_date)); echo("
\n"); list($c2g_ip1, $c2g_ip2, $c2g_ip3, $c2g_ip4) = c2g_getip($c2g_ip); if ($_REQUEST['c2g_full'] && time() - $_REQUEST['c2g_full'] < 1000) { } else { $c2g_ip4 = '***'; } echo("IP: $c2g_ip1.$c2g_ip2.$c2g_ip3.$c2g_ip4

\n"); echo("(close)"); echo("
"); exit(); } if ($c2g_op == 'saveconf') { $c2g_conf['lines'] = $_REQUEST['c2g_l']; $c2g_conf['defname'] = $_REQUEST['c2g_dn']; $c2g_upass = $_REQUEST['c2g_upass']; c2g_saveconf($c2g_conf); $c2g_url = 'http://' . $_SERVER["HTTP_HOST"] . $PHP_SELF . '?c2g_op=conf'; header("Location: http://chatter.flooble.com/c2g/confframe.php?cu=" . urlencode($c2g_url)); exit(); } if ($c2g_op == 'conf') { $c2g_cop = $_REQUEST['c2g_cop']; c2g_startpage(); if (!$c2g_upass) { $c2g_upass = $_REQUEST['c2g_upass']; } if (!c2g_checkpass($c2g_upass)) { c2g_showlogin(); c2g_endpage(); exit(); } if ($c2g_cop == 'del') { $c2g_delnum = $_REQUEST['c2g_delnum']; c2g_delentry($c2g_delnum); } if (!c2g_testconf() || $c2g_cop == 'path') { c2g_showpathdialog(); } else if ($c2g_cop == 'code') { c2g_showcodedialog(); } else { c2g_showconfdialog(); } c2g_endpage(); $c2g_dontshow = true; } else if ($c2g_op == 'savepath') { $c2g_newp = $_REQUEST['c2g_p']; $c2g_p1 = $_REQUEST['c2g_p1']; $c2g_p2 = $_REQUEST['c2g_p2']; if (!$c2g_upass) { $c2g_upass = $_REQUEST['c2g_upass']; } if ($c2g_p1 != $c2g_p2) { $op = "&c2g_p1=$c2g_p1&c2g_p2=$c2g_p2"; } else { c2g_setfilepath($c2g_newp, crypt($c2g_p1, 'chatter2go'), $c2g_p1); } $c2g_url = 'http://' . $_SERVER["HTTP_HOST"] . $PHP_SELF . '?c2g_op=conf&c2g_cop=path' . $op; header("Location: http://chatter.flooble.com/c2g/confframe.php?cu=" . urlencode($c2g_url)); exit(); } else if ($c2g_op == 'post') { c2g_post(); $c2g_url = $_REQUEST['c2g_url']; if ($c2g_url) { header("Location: $c2g_url"); exit(); } } if (!$c2g_dontshow) { c2g_writeHeader(); c2g_show_content(); c2g_show_form(); } function c2g_printfunction($full = '') { global $PHP_SELF; if ($full == 1) { $full = '&c2g_full=' . time(); } $url = 'http://' . $_SERVER["HTTP_HOST"] . $PHP_SELF; $popup = " function c2g_showInfo(info) { window.open('$url?c2g_op=info$full&c2g_info=' + info, '', 'width=200, height=120'); } "; c2g_write_js($popup); } function c2g_show_content() { global $PHP_SELF, $c2g_datafile, $c2g_filepath, $c2g_configloaded; if (! $c2g_configloaded) { $c2g_url = 'http://' . $_SERVER["HTTP_HOST"] . $PHP_SELF . '?c2g_op=conf'; c2g_write("chatter2go must first be configured.
" . "Configure now"); return; } c2g_printfunction(); $fp = @fopen($c2g_filepath . $c2g_datafile, 'r'); if (!$fp) { c2g_write('Post messages here.'); return; } $line = 0; while ($str = fgets($fp, 1024)) { $msg[$line] = preg_replace("/\n/", '', $str); $line++; if ($line == 3) { $line = 0; c2g_write("[$msg[0]] " . "$msg[2]
\n"); } } @fclose($fp); } function c2g_show_form() { global $PHP_SELF, $c2g_namecookie, $c2g_conf, $c2g_configloaded, $c2g_js; if (!$c2g_configloaded) { return; } $name = $_REQUEST[$c2g_namecookie]; if (!$name) { $name = $c2g_conf['defname']; } $c2g_url = 'http://' . $_SERVER["HTTP_HOST"] . $PHP_SELF . '?c2g_op=conf'; $url = "http://chatter.flooble.com/c2g/confframe.php?cu=" . urlencode($c2g_url); c2g_write(''); if ($c2g_js) { c2g_write(''); } c2g_write('' . '' . '' . '' . '
Name:
' . ' !
'); } function c2g_post() { global $c2g_datafile, $c2g_filepath, $c2g_conf, $c2g_namecookie, $REMOTE_ADDR; $c2g_m = trim(stripslashes($_REQUEST['c2g_m'])); $c2g_m = preg_replace("//", ">", $c2g_m); $c2g_n = trim(stripslashes($_REQUEST['c2g_n'])); if (!$c2g_n || !$c2g_m) return; $num = 0; $lines = Array(); if ($fp = @fopen($c2g_filepath . $c2g_datafile, 'r')) { while ($str = fgets($fp, 1024)) { array_push($lines, $str); $num++; } fclose($fp); } $info = time() . '|' . c2g_hideip($REMOTE_ADDR); if ($c2g_m == trim($lines[$num-1])) return; array_push($lines, $c2g_n . "\n"); array_push($lines, $info . "\n"); array_push($lines, $c2g_m . "\n"); while ($num+3 > $c2g_conf['lines'] * 3) { array_shift($lines); $num--; } $fp = fopen($c2g_filepath . $c2g_datafile, 'w'); foreach ($lines as $line) { fputs($fp, $line); } fclose($fp); setCookie($c2g_namecookie, $c2g_n); } function c2g_write($str) { global $c2g_js; if (! $c2g_js) { echo($str); } else { $str = ereg_replace('\\\\', '\\\\\\\\', $str); $str = ereg_replace("'", "\\'", $str); $str = ereg_replace("\r", "", $str); foreach (split("\n", $str) as $s) { echo("document.write('$s".'\n'."');\n"); } } } function c2g_write_js($param) { global $c2g_js; if ($c2g_js) { echo($param); } else { echo(""); } } function c2g_writeHeader() { global $c2g_js; $ctype='text/html'; if ($c2g_js) { $ctype='application/x-javascript'; } header("Content-type: $ctype"); header("P3P: CP=\"NOI DSP COR CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT STA PRE OTC\n\""); header("Expired: Mon, 26 Jul 1997 05:00:00 GMT"); header("Pragma: no-cache"); } function c2g_testconf() { global $c2g_filepath, $c2g_conffile; if ($fp = @fopen($c2g_filepath . $c2g_conffile, 'a')) { fclose($fp); return true; } return false; } function c2g_testself() { if ($fp = @fopen($_SERVER["SCRIPT_FILENAME"], 'a')) { fclose($fp); return true; } return false; } function c2g_startpage($title = '') { ?> flooble chatter2go
In order to access configuration options, please first log in to your chatter2go by entering your password. If you have forgotten your password, you will have to manually edit the chatter2go.php script, and change the first line with text to say $c2g_pass = '';.

The password you entered is incorrect.

Password:

Current configuration path is not writable! (' . 'More info' . ')' . "\n"; } if (!c2g_testself()) { $warning .= '
  • Chatter2go does not have the right to change itself. ' . 'Cannot change file path or password. (' . 'More info' . ')' . "\n"; } if ($c2g_p1 != $c2g_p2) { $warning .= '
  • The password you entered did not match confirmation. ' . '' . "\n"; } ?>
    Help Please select a path to which chatter2go can save its configuration and data files. Note that this must be a directory on disk, in which chatter2go will have the permission to create files.

    Note: Changing this path will cause all your settings to be discarded, and messages to be lost.

    File Path:
    If you wish, you may change the administrative password by entering a new password twice. Leave the fields blank if you do not wish to change the password.
    You need to define a password to use to access chatter2go's administrative features (such as set-up, deleting posts, etc) Please enter a password below:
    Password:
    Confirm:
    Proceed to Set-Up >>

    Help Your chatter2go code:
    Use this HTML code to insert the chatter2go into your web page.

    Current configuration path is not writable! Make sure that' . '
    ' . $c2g_filepath . $c2g_conffile . '
    can be written by the script user.

    ' . '(Change config path' . "\n"; } c2g_printfunction(1); ?>
    Help Configure your chatter2go using the form below:
    (Get Insertion Code | Change data path / password)

    Lines:
    Default name:


    Version :
    $c2g_pass
    " . crypt($pass, 'chatter2go')); return ($c2g_pass == crypt($pass, 'chatter2go')); } function c2g_saveconf($props) { global $c2g_filepath, $c2g_conffile; if (! $fp = @fopen($c2g_filepath . $c2g_conffile, 'w')) { // echo("CANNOT SAVE!"); return; } foreach(array_keys($props) as $prop) { fputs($fp, $prop . " = " . $props[$prop] . "\n"); } fclose($fp); } function c2g_loadconf() { global $c2g_filepath, $c2g_conffile, $c2g_conf, $c2g_configloaded; if (! $fp = @fopen($c2g_filepath . $c2g_conffile, 'r')) { // echo("CANNOT LOAD! $c2g_falepath" . $c2g_conffile); return; } while ($line = fgets($fp, 1024)) { if (preg_match("/^([^= ]*)\s*=\s*(.*)$/", $line, $matches)) { list(, $name, $val) = $matches; // echo("[$name] -> [$val]
    \n"); $c2g_conf[$name] = $val; // echo($c2g_conf[$name] . "
    \n"); } } fclose($fp); $c2g_configloaded = 1; } function c2g_listentries() { global $PHP_SELF, $c2g_datafile, $c2g_filepath, $c2g_configloaded, $c2g_upass; if (! $c2g_configloaded) { $c2g_url = 'http://' . $_SERVER["HTTP_HOST"] . $PHP_SELF . '?c2g_op=conf'; c2g_write("chatter2go must first be configured.
    " . "Configure now"); return; } $fp = @fopen($c2g_filepath . $c2g_datafile, 'r'); if (!$fp) { c2g_write('Post messages here.'); return; } $line = 0; $i=0; while ($str = fgets($fp, 1024)) { $msg[$line] = preg_replace("/\n/", '', $str); $line++; if ($line == 3) { $i++; $line = 0; echo(" "); echo("[$msg[0]] " . "$msg[2]
    \n"); } } @fclose($fp); } function c2g_delentry($delnum) { global $c2g_datafile, $c2g_filepath, $c2g_conf; $num = 0; $lines = Array(); if ($fp = @fopen($c2g_filepath . $c2g_datafile, 'r')) { while ($str = fgets($fp, 1024)) { array_push($lines, $str); $num++; } fclose($fp); } $fp = fopen($c2g_filepath . $c2g_datafile, 'w'); $i = 0; foreach ($lines as $line) { if ($i < 3*($delnum-1) || $i >= 3*$delnum) { fputs($fp, $line); } $i++; } fclose($fp); } function c2g_hideip($addr) { list($a,$b,$c,$d) = explode('.', $addr); $val = $d +($c*256) + ($b*65536) + ($a*16777216); return $val; } function c2g_getip($val) { $vorig = $val; $val = floor($val / 256); $d = $vorig - ($val*256); $c = $val % 256; $val = floor($val/256); $b = $val % 256; $a = floor($val/256); return array($a, $b, $c, $d); } ?>