summaryrefslogtreecommitdiff
path: root/0.2.2/push.pl
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2013-04-06 13:14:47 +0200
committerPaul Buetow <paul@buetow.org>2013-04-06 13:14:47 +0200
commit630af0ed6c0af69c7df2e45aef7a87722a3c00c0 (patch)
treead76f850278b090f7e5c26561035d19c320400cc /0.2.2/push.pl
parent2860b03f00e48264ed15c132ad90b240ebe6070b (diff)
tagging ychat-perl-legacyychat-perl-legacy
Diffstat (limited to '0.2.2/push.pl')
-rw-r--r--0.2.2/push.pl85
1 files changed, 85 insertions, 0 deletions
diff --git a/0.2.2/push.pl b/0.2.2/push.pl
new file mode 100644
index 0000000..5489592
--- /dev/null
+++ b/0.2.2/push.pl
@@ -0,0 +1,85 @@
+#!/usr/bin/perl -w
+use CGI;
+$q = new CGI;
+
+print
+ $q->header; # HTML-Header erzeugen
+
+require config;
+
+&secure_checkip($alias);
+
+########################################
+##ANFANG DER ZU STREAMENDEN HTML-DATEI##
+########################################
+
+print <<END;
+<html>
+ <head>
+ <script language="JavaScript">
+ <!--
+ scrolling=true;
+ function scroll_wnd() {
+ if (scrolling != false) {
+ window.scroll(1, 500000);
+ }
+ window.setTimeout("scroll_wnd()", 100);
+ }
+ scroll_wnd();
+ //-->
+ </script>
+ </head>
+<body bgcolor=000000 link=FFFFFF alink=FFFFEF vlink=FFFFEF>
+END
+
+$| = 1; # Cache von Perl ausschalten
+
+#############################
+##BEGRÜSSUNGSTEXT SCHREIBEN##
+#############################
+
+my $msgfile;
+
+ print
+ $q->font( { -size=>1,
+ -color=>"ffffff",
+ -face=>"arial"},
+ "$title Copyright by Paul C. Bütow 2k $tmp\n");
+
+if ($var eq "push_logs_html") {
+ $msgfile = $tmp;
+ print "<hr><font size=2 color=ffffff face=arial>";
+} elsif ($var eq "clear_screen") {
+ $msgfile = "data/msgs/$alias";
+ &write_file_new($msgfile);
+ print DATEI $q->br;
+ close DATEI;
+} else {
+ $msgfile = "data/msgs/$alias";
+ print $q->br;
+}
+
+open (MSGFILE, $msgfile);
+
+#################################
+##ENDLOSSCHLEIFE FÜR DEN STREAM##
+#################################
+
+my ($times,$online) = (0,"false");
+for (;;) {
+ for ($curpos = tell(MSGFILE); <MSGFILE>; $curpos = tell(MSGFILE)) {
+ print $_ ;
+ }
+ $times++;
+ if ($times > 29) { # Nach 30 Sekunden
+ print "\n<!--PING//-->"; # Ping zum Browser senden
+ $times = 0; # Sekundenzahl auf 0 zurücksetzen
+ $online = "true" if (-e "data/online/users/$alias");
+ if ($online eq "false") {
+ print "<font size=2 color=red>Aus technischen Gründen bitte auf <a href=\"push.pl?alias=$alias&room=$room&var=clear_screen\">Weiterchatten</a> klicken.</font>";
+ exit;
+ }
+ }
+ sleep 1;
+ seek(MSGFILE, $curpos, 0); # Position wiederherstellen
+}