Hoşgeldin Misafir

Php Chat Sistemi Basit

35izmir

35izmir

🆁🅴🅸🆂🅲🅸🆂🅴🆅🅴🆁
11 Ocak 2018
2,701 Mesaj

Aktiflik

Seviye

Deneyim

TIM / GÖREV:
Canı Sıkılan OrganikPiskos ne yapar temalı 


PHP:
<?php

// TURKHACKS CHAT ODASI 
// OrganikPiskos

if (isset($_GET['enSubmit']) && isset($_GET['uname']) && isset($_GET['rname'])){
 echo'<meta http-equiv="refresh" content="10">';
 $oda=$_GET['rname']; 
 $uname=$_GET['uname'];
 if (!is_dir($oda)) mkdir($oda);
 $files = scandir($oda);
 foreach ($files as $kullanıcı){
  if ($kullanıcı=='.' || $kullanıcı=='..') continue;
  $handle=fopen("$oda/$kullanıcı",'r');
  $time = fread($handle, filesize("$oda/$kullanıcı"));
  fclose($handle);
  if ((time()-$time)>20) unlink("$oda/$kullanıcı");
 }
 $contents='';
 $dosya="$oda.txt";
 if (file_exists($dosya)){
  $handle = fopen($dosya, "r");
  $contents = fread($handle, filesize($dosya));
  fclose($handle); 
 }
 $handle = fopen("$oda/$uname", "w");
 fwrite($handle, time());
 fclose($handle);
 
 $files = scandir($oda);
 $kullanıcılar='';
 foreach ($files as $kullanıcı) if ($kullanıcı!='.' && $kullanıcı!='..') $kullanıcılar.=$kullanıcı."\n";
 
 if (isset($_POST['Send'])){
  $text=$_POST['txt'];
  $contents.="$uname: $text";
  $handle = fopen("$dosya", "a");
  fwrite($handle, "$uname: $text\n");
  fclose($handle);
 }
?>
<body OnLoad="document.myform.txt.focus()">
<form action="" method="post" name="myform">
<table style="border: 1px solid #000000;width: 752px" align="center">
 <tr>
  <td style="font-family: 'Times New Roman', Times, serif;font-size: 17pt;text-align: center;width: 537; color: #2214B9;border-style: solid;border-width: 1px; height: 350px;">
   <textarea readonly="readonly" name="txtchat" style="width: 581px; color: #000000; height: 365px; background-color: background: rgb(63,94,251);
background: radial-gradient(circle, rgba(63,94,251,1) 0%, rgba(252,70,107,1) 100%);; font-family: 'times New Roman', Times, serif; font-size: 12pt;"><?php echo "$oda Turkhacks chat odasına hoşgeldiniz..\n$contents"?> </textarea>
  </td>
  <td style="font-family: 'Times New Roman', Times, serif;font-size: 17pt;text-align: center;color: #2214B9;border-style: solid;border-width: 1px; height: 349px; width: 143px;">
   <textarea readonly="readonly"  contenteditable="false"  name="txtkullanıcılar" style=";width: 163px; height: 365px; background-color:background: rgb(2,0,36);
background: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(25,176,36,1) 35%, rgba(0,212,255,1) 100%);; font-family: 'times New Roman', Times, serif; font-size: 12pt; font-weight: bold; text-align: center;"><?php echo $kullanıcılar?></textarea></td>
 </tr>
 <tr>
  <td style="width: 537; border-style: solid;border-width: 1px;text-align: left; height: 39px; font-size: 14pt;">
  <textarea id="txtt"  name="txt" style="width: 581px; height: 79px; font-family: 'times New Roman', Times, serif; font-size: 12pt"></textarea></td>
  <td style="border-style: solid;border-width: 1px; height: 39px;padding-left: 8px; width: 143px; text-align: center;">
  <input name="Send" style="width: 118px; height: 63px; font-size: 30pt; font-family: 'Times New Roman', Times, serif; color: #19B024;" type="submit" value="Gönder"></td>
 </tr>
</table>
</form>

<?php
}else {
?>
<form method="get" action="">
<table style="border: 1px solid rgb(2,0,36);width: 452px" align="center">
 <tr>
  <td style="font-family: 'Times New Roman', Times, serif;font-size: 17pt;text-align: left; width: 432px; color: #2214B9;;border-style: solid;border-width: 1px;">Nickiniz:</td>
  <td style="border-style: solid; border-width: 1px; font-family: 'Times New Roman', Times, serif; font-size: 17pt; text-align: left; color: #2214B9; width: 430px;">
  <input name="uname" style="font-size: medium; width: 260px; color: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(176,25,25,1) 35%, rgba(0,212,255,1) 100%);"></td>
 </tr>
 <tr>
  <td style="font-family: 'Times New Roman', Times, serif;font-size: 17pt;text-align: left; width: 432px; color: #2214B9;border-style: solid;border-width: 1px;">Oda seç:</td>
  <td style="border-style: solid; border-width: 1px; font-family: 'Times New Roman', Times, serif; font-size: 17pt; text-align: left; color: #2214B9; width: 430px;">
  <select name="rname" style="width: 260px; font-size: medium; color: #B01919;">
  <option selected="">Hacker</option>
  <option>Lamer</option>
  </select></td>
 </tr>
 <tr>
  <td style="font-family: 'Times New Roman', Times, serif;font-size: 17pt;text-align: center; color: #2214B9; border-left-style: solid; border-left-width: 1px; border-right-style: none; border-right-width: medium; border-top-style: solid; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px; padding-top:10px;padding-bottom:10px" colspan="2">
  <input name="enSubmit" style="width: 118px; height: 63px; font-size: 30pt; font-family: 'Times New Roman', Times, serif; color: rgb(131,58,180;" type="submit" value="giris!"></td>
 </tr>
</table>
</form>
<?php
}
?>
<script>
el=document.myform.txtt
    if (typeof el.selectionStart == "number") {
        el.selectionStart = el.selectionEnd = el.value.length;
    } else if (typeof el.createTextRange != "undefined") {
        el.focus();
        var range = el.createTextRange();
        range.collapse(false);
        range.select();
    }</script>


</body>
 

35izmir

35izmir

🆁🅴🅸🆂🅲🅸🆂🅴🆅🅴🆁
11 Ocak 2018
2,701 Mesaj

Aktiflik

Seviye

Deneyim

TIM / GÖREV:
Professional58' Alıntı:
Eline sağlık
Adminlik verme falan yok sanırsam basit birşey olmuş ama iyi yine de emeğine sağlık

zaten veri tabanı falan da yok basit bir sistem ama güzel mirc gibi chat sistemi geliştirmeyi düşünüyorum hali hazırda geliştirdiğim projelerden sıra gelirse yapacağım
 

Professional58

26 Şub 2020
279 Mesaj

Aktiflik

Seviye

Deneyim

TIM / GÖREV:
OrganikPiskos' Alıntı:
Professional58' Alıntı:
Eline sağlık
Adminlik verme falan yok sanırsam basit birşey olmuş ama iyi yine de emeğine sağlık

zaten veri tabanı falan da yok basit bir sistem ama güzel mirc gibi chat sistemi geliştirmeyi düşünüyorum hali hazırda geliştirdiğim projelerden sıra gelirse yapacağım

Kullanıcı hesabı oluşturma/Veritabanı yani ve yönetici/yönetici yardımcısı bir de güzel bir css olsa mükemmel olur :)
 

35izmir

35izmir

🆁🅴🅸🆂🅲🅸🆂🅴🆅🅴🆁
11 Ocak 2018
2,701 Mesaj

Aktiflik

Seviye

Deneyim

TIM / GÖREV:
Professional58' Alıntı:
OrganikPiskos' Alıntı:
Professional58' Alıntı:
Eline sağlık
Adminlik verme falan yok sanırsam basit birşey olmuş ama iyi yine de emeğine sağlık

zaten veri tabanı falan da yok basit bir sistem ama güzel mirc gibi chat sistemi geliştirmeyi düşünüyorum hali hazırda geliştirdiğim projelerden sıra gelirse yapacağım

Kullanıcı hesabı oluşturma/Veritabanı yani ve yönetici/yönetici yardımcısı bir de güzel bir css olsa mükemmel olur :)

ortak birşeyler çıkarabiliriz önemli olan fikir sonra gerisi gelir :D
 

Graves

Graves

Karanlık Özgürlüktür
Moderator
9 Eki 2024
10,447 Mesaj
TIM Görevleri
2

Aktiflik

Seviye

Deneyim

TIM / GÖREV:
Canı Sıkılan OrganikPiskos ne yapar temalı


PHP:
<?php

// TURKHACKS CHAT ODASI
// OrganikPiskos

if (isset($_GET['enSubmit']) && isset($_GET['uname']) && isset($_GET['rname'])){
 echo'<meta http-equiv="refresh" content="10">';
 $oda=$_GET['rname'];
 $uname=$_GET['uname'];
 if (!is_dir($oda)) mkdir($oda);
 $files = scandir($oda);
 foreach ($files as $kullanıcı){
  if ($kullanıcı=='.' || $kullanıcı=='..') continue;
  $handle=fopen("$oda/$kullanıcı",'r');
  $time = fread($handle, filesize("$oda/$kullanıcı"));
  fclose($handle);
  if ((time()-$time)>20) unlink("$oda/$kullanıcı");
 }
 $contents='';
 $dosya="$oda.txt";
 if (file_exists($dosya)){
  $handle = fopen($dosya, "r");
  $contents = fread($handle, filesize($dosya));
  fclose($handle);
 }
 $handle = fopen("$oda/$uname", "w");
 fwrite($handle, time());
 fclose($handle);
 
 $files = scandir($oda);
 $kullanıcılar='';
 foreach ($files as $kullanıcı) if ($kullanıcı!='.' && $kullanıcı!='..') $kullanıcılar.=$kullanıcı."\n";
 
 if (isset($_POST['Send'])){
  $text=$_POST['txt'];
  $contents.="$uname: $text";
  $handle = fopen("$dosya", "a");
  fwrite($handle, "$uname: $text\n");
  fclose($handle);
 }
?>
<body OnLoad="document.myform.txt.focus()">
<form action="" method="post" name="myform">
<table style="border: 1px solid #000000;width: 752px" align="center">
 <tr>
  <td style="font-family: 'Times New Roman', Times, serif;font-size: 17pt;text-align: center;width: 537; color: #2214B9;border-style: solid;border-width: 1px; height: 350px;">
   <textarea readonly="readonly" name="txtchat" style="width: 581px; color: #000000; height: 365px; background-color: background: rgb(63,94,251);
background: radial-gradient(circle, rgba(63,94,251,1) 0%, rgba(252,70,107,1) 100%);; font-family: 'times New Roman', Times, serif; font-size: 12pt;"><?php echo "$oda Turkhacks chat odasına hoşgeldiniz..\n$contents"?> </textarea>
  </td>
  <td style="font-family: 'Times New Roman', Times, serif;font-size: 17pt;text-align: center;color: #2214B9;border-style: solid;border-width: 1px; height: 349px; width: 143px;">
   <textarea readonly="readonly"  contenteditable="false"  name="txtkullanıcılar" style=";width: 163px; height: 365px; background-color:background: rgb(2,0,36);
background: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(25,176,36,1) 35%, rgba(0,212,255,1) 100%);; font-family: 'times New Roman', Times, serif; font-size: 12pt; font-weight: bold; text-align: center;"><?php echo $kullanıcılar?></textarea></td>
 </tr>
 <tr>
  <td style="width: 537; border-style: solid;border-width: 1px;text-align: left; height: 39px; font-size: 14pt;">
  <textarea id="txtt"  name="txt" style="width: 581px; height: 79px; font-family: 'times New Roman', Times, serif; font-size: 12pt"></textarea></td>
  <td style="border-style: solid;border-width: 1px; height: 39px;padding-left: 8px; width: 143px; text-align: center;">
  <input name="Send" style="width: 118px; height: 63px; font-size: 30pt; font-family: 'Times New Roman', Times, serif; color: #19B024;" type="submit" value="Gönder"></td>
 </tr>
</table>
</form>

<?php
}else {
?>
<form method="get" action="">
<table style="border: 1px solid rgb(2,0,36);width: 452px" align="center">
 <tr>
  <td style="font-family: 'Times New Roman', Times, serif;font-size: 17pt;text-align: left; width: 432px; color: #2214B9;;border-style: solid;border-width: 1px;">Nickiniz:</td>
  <td style="border-style: solid; border-width: 1px; font-family: 'Times New Roman', Times, serif; font-size: 17pt; text-align: left; color: #2214B9; width: 430px;">
  <input name="uname" style="font-size: medium; width: 260px; color: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(176,25,25,1) 35%, rgba(0,212,255,1) 100%);"></td>
 </tr>
 <tr>
  <td style="font-family: 'Times New Roman', Times, serif;font-size: 17pt;text-align: left; width: 432px; color: #2214B9;border-style: solid;border-width: 1px;">Oda seç:</td>
  <td style="border-style: solid; border-width: 1px; font-family: 'Times New Roman', Times, serif; font-size: 17pt; text-align: left; color: #2214B9; width: 430px;">
  <select name="rname" style="width: 260px; font-size: medium; color: #B01919;">
  <option selected="">Hacker</option>
  <option>Lamer</option>
  </select></td>
 </tr>
 <tr>
  <td style="font-family: 'Times New Roman', Times, serif;font-size: 17pt;text-align: center; color: #2214B9; border-left-style: solid; border-left-width: 1px; border-right-style: none; border-right-width: medium; border-top-style: solid; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px; padding-top:10px;padding-bottom:10px" colspan="2">
  <input name="enSubmit" style="width: 118px; height: 63px; font-size: 30pt; font-family: 'Times New Roman', Times, serif; color: rgb(131,58,180;" type="submit" value="giris!"></td>
 </tr>
</table>
</form>
<?php
}
?>
<script>
el=document.myform.txtt
    if (typeof el.selectionStart == "number") {
        el.selectionStart = el.selectionEnd = el.value.length;
    } else if (typeof el.createTextRange != "undefined") {
        el.focus();
        var range = el.createTextRange();
        range.collapse(false);
        range.select();
    }</script>


</body>
Eline sağlık