DevioLab CRYPTO TRADING AUTOMATION
LIVE
AUTOMATED CRYPTO TRADING • BINANCE
Автоматизуйте свій криптопортфель
Торгові боти DevioLab аналізують крипторинок, автоматично відкривають і закривають позиції та керують вашим портфелем на Binance 24/7.
CRYPTO 80 Bots
BINANCE Spot Trading
TRADING 24 / 7
Спробувати DevioLab
deviolab.com

Інформація про навчальний заклад

ВУЗ:
Національний університет Львівська політехніка
Інститут:
Не вказано
Факультет:
Не вказано
Кафедра:
Не вказано

Інформація про роботу

Рік:
2015
Тип роботи:
Інші
Предмет:
Об’єктно-орієнтоване програмування
Група:
КН

Частина тексту файла (без зображень, графіків і формул):

Міністерство освіти і науки України Національний університет “Львівська політехніка” Кафедра ПЗ Пояснювальна записка до курсової роботи з дисципліни “Об’єктно-орієнтоване програмування” на тему: “Динамічний форум”. Львів 2006 Довідникова програмна інтернет система ─ Форум. Завдання. Курсова робота повинна включати в себе можливість додавання записів, повинна бути передбачена можливість видалення записів; елементи ООП (об’єктно-орієнтованого програмування), які забезпечуються за допомогою мови PHP; зовнішній вигляд інтернет-сторінки, що забезпечується мовою HTML чи JAVA-скриптами. Виконання поставленого завдання. Вступ. Форум має лінійну тсруктуру. При перегляді теми можна прочитати всі повідомлення підряд зверху вниз і між повідомленнями немає ніякої службової інформації, лише ледь помітні горизонтальні лінії. При створенні нової теми чи додаванні повідомлення в тему вона “випливає” на перше місце в списку тем. Створений також режим адміністрування, у якому можна налаштувати зовнішній вигляд та внутрішні функції форуму. Текст програми. Дана курсова робота розроблялася в основному засобами мови програмування PHP і її текст складається з багатьох файлів. Текст кожного з них подано нижче. Файл .htaccess. Файл connect.inc повинен бути захищений засобами Apache за допомогою .htaccess, директива Files. <Files connect.inc> order allow,deny deny from all </Files> <Files .htaccess> order allow,deny deny from all </Files> Файл index.php. Цей файл використовується під’єднання основного скрипту, шо розмішений у файлі forum.php і для виведення привітання „Welcome to our forum”. <html> <head> <title> Forum </title> </head> <body> <font style="background: #479E47; color: white; margin: 0px 0 4px 0; font: normal 18px sans-serif; padding: 4px 2px 4px 4px; width: 100%">Welcome to our forum</font><br> <center> <? $f_incl_script="forum.php"; include($f_incl_script); ?> </center> </body> </html> Файл forum.php. Цей файл – це php-скрипт, який є основним файлом що відображає форум і підключає додаткові файли потрібні для роботи і адміністрування форуму. Ці файли розташовані в папці incl. <? if (empty($f_incl_script)) { $f_for_relative=""; } else { $f_for_relative=dirname($f_incl_script)."/"; } $forchangelines="one"; $showemails=trim(file_get_contents($f_for_relative."conf/showemails.txt")); include($f_for_relative."incl/scandir.php"); include($f_for_relative."incl/smilies.php"); if (empty($_GET['pagenum'])) { $_GET['pagenum']=0; } echo "\n \n \n <!-- Free forum provided by: ".file_get_contents($f_for_relative.'admin/conf/supporturl.txt')." -->\n \n \n"; echo "<link href=\"".$f_for_relative."templ/styles/".file_get_contents($f_for_relative."conf/css.txt").".css\" type=text/css rel=stylesheet>"; $layarr=file($f_for_relative."templ/layouts/".file_get_contents($f_for_relative."conf/layout.txt").".txt"); $f_top=$layarr[1]; $f_pre=$layarr[3]; $f_pre_two=$layarr[5]; $f_after=$layarr[7]; $f_bottom=$layarr[9]; $f_separ=$layarr[11]; $f_postinfoend=$layarr[13]; $f_posts_pre=$layarr[15]; $f_posts_after=$layarr[17]; $f_postr_pre=$layarr[19]; $f_postr_after=$layarr[21]; $f_beforeposttable=$layarr[23]; $f_afterposttable=$layarr[25]; $f_numofthispage=$layarr[27]; $f_numofthispage_end=$layarr[29]; $f_postnewsubj=$layarr[31]; $f_postnewreply=$layarr[33]; $f_smilies=$layarr[35]; if (empty($_GET['act'])) { $_GET['act']="subj"; } $f_messonpage=file_get_contents($f_for_relative."conf/messonpage.txt"); if ($_GET['act']=="subj") { // SHOW TOPICS START echo $f_top; $scandir=$f_for_relative."mess"; get_dir_files(); $filesoutput=$filearray; @sort($filesoutput); $filesoutput=@array_reverse($filesoutput); $f_i=$_GET['pagenum']*$f_messonpage; if (count($filesoutput)-$f_i>$f_messonpage) { $f_till=$f_i+$f_messonpage; } else { $f_till=count($filesoutput); $f_i=$_GET['pagenum']*$f_messonpage; } while ($f_i<$f_till) { if (is_dir($f_for_relative."mess/".$filesoutput[$f_i])) { if ($forchangelines=="one") { echo $f_pre; $forchangelines="two"; } else { echo $f_pre_two; $forchangelines="one"; } echo "<a href=?act=choosesubj&&id=".$filesoutput[$f_i]." class=f_link>"; $f_subj=stripslashes(file_get_contents($f_for_relative."mess/".$filesoutput[$f_i]."/topic.txt")); echo smilies($f_subj); echo "</a>"; echo $f_separ; echo substr($filesoutput[$f_i], 4, 2)."/".substr($filesoutput[$f_i], 6, 2)."/".substr($filesoutput[$f_i], 2, 2)." ".substr($filesoutput[$f_i], 8, 2).":".substr($filesoutput[$f_i], 10, 2).":".substr($filesoutput[$f_i], 12, 2); echo " by: "; echo stripslashes(file_get_contents($f_for_relative."mess/".$filesoutput[$f_i]."/addedby.txt")); if ($showemails=="yes") { echo " ("; echo stripslashes(file_get_contents($f_for_relative."mess/".$filesoutput[$f_i]."/email.txt")); echo ")"; } echo ","; echo " views: ".stripslashes(file_get_contents($f_for_relative."mess/".$filesoutput[$f_i]."/views.txt")); echo ","; unset($numofposts); unset($filearray); $scandir=$f_for_relative."mess/".$filesoutput[$f_i]."/mess"; get_dir_files(); $numofposts=count($filearray); echo " posts: "; echo $numofposts; echo $f_postinfoend; echo $f_after; } $f_i++; } echo $f_bottom; // start the pagenumbers links if (count($filesoutput)>$f_messonpage) { if ($_GET['pagenum']!=0) { $f_i_bef=0; while($f_i_bef<$_GET['pagenum']) { $f_i_toshow=$f_i_bef+1; echo "<a href=\"?act=subj&&pagenum=".$f_i_bef."\" class=f_pagenums>".$f_i_toshow."</a>"; $f_i_bef++; } } } echo $f_numofthispage; echo $_GET['pagenum']+1; echo $f_numofthispage_end; $f_pagenumnext=$_GET['pagenum']+1; if (count($filesoutput)>$f_messonpage*$f_pagenumnext) { $f_i_aft=$f_pagenumnext; while($f_i_aft*$f_messonpage<count($filesoutput)) { $f_i_toshow=$f_i_aft+1; echo "<a href=\"?act=subj&&pagenum=".$f_i_aft."\" class=f_pagenums>".$f_i_toshow."</a>"; $f_i_aft++; } } // end of the pagenumbers links // start new subject ?> <SCRIPT language=javascript> function validate() { if (add_subj.name.value == "") { alert("Your name, please!"); return false; } if (add_subj.email.value == "") { alert("Your email, please!"); return false; } if (add_subj.mess.value == "") { alert("And where is the subject?"); return false; } return true; } function smilies() { window.open("<? echo $f_for_relative;?>incl/opensmilies.php", "smilies", "toolbar=no, menubar=no, location=no, status=no, scrollbars=yes, width=20, height=500, left=100, top=200"); } </script> <? echo $f_postnewsubj; echo "<form action=\"".$f_for_relative."incl/addsubject.php\" method=post name=add_subj onsubmit=\"return validate();\" class=form_class>"; echo "<table><tr><td><font class=f_wordb4form>Name: </font></td><td><input type=text name=\"name\" class=f_text_form maxlength=22></td></tr>"; echo "<tr><td><font class=f_wordb4form>Email: </font></td><td><input type=text name=\"email\" class=f_text_form maxlength=50></td></tr>"; echo "<tr><td><font class=f_wordb4form>Message:</font></td><td><textarea class=addsubj name=mess>Your subject goes here</textarea><a href=\"javascript: smilies();\" class=smilies_link>".$f_smilies."</a></td></tr>"; echo "<tr><td>&nbsp;</td><td><input type=submit value=\"Add Subject\" class=f_submit_button></td></tr></table>"; echo "</font>"; // \"#\" onClick= // end of new subject // END OF SHOW TOPICS } if ($_GET['act']=="choosesubj") { // START OF SHOW POSTINGS echo str_replace("<!-- don't change this comment -->", "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'], $f_beforeposttable); $postviews=file_get_contents($f_for_relative."mess/".$_GET['id']."/views.txt"); $postviews++; $inputfp=fopen($f_for_relative."mess/".$_GET['id']."/views.txt", "w"); $inputnew=fputs($inputfp, $postviews); fclose($inputfp); echo $f_top; echo $f_pre; echo $f_posts_pre; $f_subj=stripslashes(file_get_contents($f_for_relative."mess/".$_GET['id']."/topic.txt")); echo smilies($f_subj); echo $f_posts_after; echo $f_separ; echo substr($_GET['id'], 4, 2)."/".substr($_GET['id'], 6, 2)."/".substr($_GET['id'], 2, 2)." ".substr($_GET['id'], 8, 2).":".substr($_GET['id'], 10, 2).":".substr($_GET['id'], 12, 2); echo " by: "; echo stripslashes(file_get_contents($f_for_relative."mess/".$_GET['id']."/addedby.txt")); if ($showemails=="yes") { echo " ("; echo stripslashes(file_get_contents($f_for_relative."mess/".$_GET['id']."/email.txt")); echo ")"; } echo ","; echo " views: ".stripslashes(file_get_contents($f_for_relative."mess/".$_GET['id']."/views.txt")); echo ","; unset($numofposts); unset($filearray); unset($numofposts); $scandir=$f_for_relative."mess/".$_GET['id']."/mess/"; get_dir_files(); $numofposts=count($filearray); echo " posts: "; echo $numofposts; echo $f_postinfoend; echo $f_after; unset($filearray); unset($filesoutput); unset($numofposts); $scandir=$f_for_relative."mess/".$_GET['id']."/mess"; get_dir_files(); $filesoutput=$filearray; @sort($filesoutput); $filesoutput=@array_reverse($filesoutput); $f_i=$_GET['pagenum']*$f_messonpage; if (count($filesoutput)-$f_i>$f_messonpage) { $f_till=$f_i+$f_messonpage; } else { $f_till=count($filesoutput); $f_i=$_GET['pagenum']*$f_messonpage; } while ($f_i<$f_till) { echo $f_pre_two; echo $f_postr_pre; $f_subj=stripslashes(file_get_contents($f_for_relative."mess/".$_GET['id']."/mess/".$filesoutput[$f_i]."/mess.txt")); echo smilies($f_subj); echo $f_postr_after; echo $f_separ; echo substr($filesoutput[$f_i], 4, 2)."/".substr($filesoutput[$f_i], 6, 2)."/".substr($filesoutput[$f_i], 2, 2)." ".substr($filesoutput[$f_i], 8, 2).":".substr($filesoutput[$f_i], 10, 2).":".substr($filesoutput[$f_i], 12, 2); echo " by: "; echo stripslashes(file_get_contents($f_for_relative."mess/".$_GET['id']."/mess/".$filesoutput[$f_i]."/addedby.txt")); if ($showemails=="yes") { echo " ("; echo stripslashes(file_get_contents($f_for_relative."mess/".$_GET['id']."/mess/".$filesoutput[$f_i]."/email.txt")); echo ")"; } echo $f_postinfoend; echo $f_after; $f_i++; } echo $f_bottom; // start the pagenumbers links if (count($filesoutput)>$f_messonpage) { if ($_GET['pagenum']!=0) { $f_i_bef=0; while($f_i_bef<$_GET['pagenum']) { $f_i_toshow=$f_i_bef+1; echo "<a href=\"?act=choosesubj&&id=".$_GET['id']."&&pagenum=".$f_i_bef."\" class=f_pagenums>".$f_i_toshow."</a>"; $f_i_bef++; } } } echo $f_numofthispage; echo $_GET['pagenum']+1; echo $f_numofthispage_end; $f_pagenumnext=$_GET['pagenum']+1; if (count($filesoutput)>$f_messonpage*$f_pagenumnext) { $f_i_aft=$f_pagenumnext; while($f_i_aft*$f_messonpage<count($filesoutput)) { $f_i_toshow=$f_i_aft+1; echo "<a href=\"?act=choosesubj&&id=".$_GET['id']."&&pagenum=".$f_i_aft."\" class=f_pagenums>".$f_i_toshow."</a>"; $f_i_aft++; } } // end of the pagenumbers links echo str_replace("<!-- don't change this comment -->", "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'], $f_afterposttable); // start new post ?> <SCRIPT language=javascript> function validate() { if (add_subj.name.value == "") { alert("Your name, please!"); return false; } if (add_subj.email.value == "") { alert("Your email, please!"); return false; } if (add_subj.mess.value == "") { alert("And where is the subject?"); return false; } return true; } function smilies() { window.open("<? echo $f_for_relative;?>incl/opensmilies.php", "smilies", "toolbar=no, menubar=no, location=no, status=no, scrollbars=yes, width=20, height=500, left=100, top=200"); } </script> <? echo $f_postnewreply; echo "<form action=\"".$f_for_relative."incl/addpost.php\" method=post name=add_subj onsubmit=\"return validate();\" class=form_class>"; echo "<table><tr><td><font class=f_wordb4form>Name: </font></td><td><input type=text name=\"name\" class=f_text_form maxlength=22></td></tr>"; echo "<tr><td><font class=f_wordb4form>Email: </font></td><td><input type=text name=\"email\" class=f_text_form maxlength=50></td></tr>"; echo "<tr><td><font class=f_wordb4form>Message: </font></td><td><textarea class=addsubj name=mess>Your reply goes here</textarea><a href=\"javascript: smilies();\" class=smilies_link>Smilies</a></td></tr>"; echo "<input type=hidden name=id value=".$_GET['id'].">"; echo "<tr><td>&nbsp;</td><td><input type=submit value=\"Post a Reply\" class=f_submit_button></td></tr></table>"; echo "</form>"; // end of new post //END OF SHOW POSTINGS } ?> Файл connect.inc. Цей файл ─ це PHP-скрипт який додає відповідь на вибрану тему. <? $MessLength=trim(file_get_contents("../conf/replylength.txt")); $err[1] = "Invalid e-mail"; $err[2] = "The subject cannot be longer than ".$MessLength." characters!"; function output_err($num) { global $err; ?> <center><h1>Error!</h1></center> <p><?=$err[$num];?> <? exit(); } if (!preg_match("/[0-9a-z_]+@[0-9a-z_^\.]+\.[a-z]{2,3}/i", $_POST['email'])) { output_err(1); } $_POST['email']=substr($_POST['email'], 0, 50); if (trim(file_get_contents("../conf/safeemails.txt"))=="yes") { $_POST['email']=str_replace("@"," at ",$_POST['email']); $_POST['email']=str_replace("."," dot ",$_POST['email']); } $_POST['name']=strip_tags($_POST['name']); $tagsallowedarr=file("../conf/tagsallowed.txt"); $tagsallowedstr=implode(", ", $tagsallowedarr); $_POST['mess']=strip_tags($_POST['mess'], $tagsallowedstr); $_POST['mess']=str_replace("\n","<br>",$_POST['mess']); if (strlen($_POST['mess'])>$MessLength) output_err(2); $_POST['name']=substr($_POST['name'], 0, 22); $mess_time="20".date('y').date('m').date('d').date('H').date('i').date('s'); mkdir("../mess/".$_POST['id']."/mess/".$mess_time); include("badwords.php"); $_POST['mess']=badwords($_POST['mess']); // For size of mess dir; $sizeformessdir=0; $sizeformessdir=strlen($_POST['name'])+strlen($_POST['email'])+strlen($_POST['mess']); if (!file_exists("../conf/sizeofmessdir.txt")) { $fp = fopen("../conf/sizeofmessdir.txt", "w"); $buffer = fputs($fp, "0"); fclose($fp); } $sizeformessdir=$sizeformessdir+file_get_contents("../conf/sizeofmessdir.txt"); $fp = fopen("../conf/sizeofmessdir.txt", "w"); $buffer = fputs($fp, $sizeformessdir); fclose($fp); // For size of mess dir END; $fp = fopen("../mess/".$_POST['id']."/mess/".$mess_time."/addedby.txt", "w"); $buffer = fputs($fp, $_POST['name']); fclose($fp); $fp = fopen("../mess/".$_POST['id']."/mess/".$mess_time."/email.txt", "w"); $buffer = fputs($fp, $_POST['email']); fclose($fp); $fp = fopen("../mess/".$_POST['id']."/mess/".$mess_time."/mess.txt", "w"); $buffer = fputs($fp, $_POST['mess']); fclose($fp); $if_notifyarr=file("../conf/notifynewreply.txt"); if (trim($if_notifyarr[0])=="yes") { $messtomail=substr($mess_time, 4, 2)."/".substr($mess_time, 6, 2)."/".substr($mess_time, 2, 2)." ".substr($mess_time, 8, 2).":".substr($mess_time, 10, 2).":".substr($mess_time, 12, 2)." ".$_POST['name']."(".$_POST['email']."): ".$_POST['mess']; if (trim($if_notifyarr[2])-17<strlen($messtomail)) { $messtomail=substr($messtomail, 0, $if_notifyarr[2]-20).".."; } $messtomail=stripslashes($messtomail); mail($if_notifyarr[1], "New forum reply added", $messtomail); } $backlocation= $_SERVER['HTTP_REFERER']; if (headers_sent()) { echo "The reply has been saved<br><form action=".$backlocation." method=get><input type=submit value=\"Go to forum\"</form>"; } else { header("Location: ".$backlocation); } ?> Файл addsubject.php. Цей файл ─ це PHP-скрипт який додає нову тему. <? $MessLength=trim(file_get_contents("../conf/messlength.txt")); $err[1] = "Invalid e-mail"; $err[2] = "The subject cannot be longer than ".$MessLength." characters!"; function output_err($num) { global $err; ?> <center><h1>Error!</h1></center> <p><?=$err[$num];?> <? exit(); } if (!preg_match("/[0-9a-z_]+@[0-9a-z_^\.]+\.[a-z]{2,3}/i", $_POST['email'])) { output_err(1); } $_POST['email']=substr($_POST['email'], 0, 50); if (trim(file_get_contents("../conf/safeemails.txt"))=="yes") { $_POST['email']=str_replace("@"," at ",$_POST['email']); $_POST['email']=str_replace("."," dot ",$_POST['email']); } $_POST['name']=strip_tags($_POST['name']); $tagsallowedarr=file("../conf/tagsallowed.txt"); $tagsallowedstr=implode(", ", $tagsallowedarr); $_POST['mess']=strip_tags($_POST['mess'], $tagsallowedstr); $_POST['mess']=str_replace("\n","<br>",$_POST['mess']); if (strlen($_POST['mess'])>$MessLength) output_err(2); $_POST['name']=substr($_POST['name'], 0, 22); include("badwords.php"); $_POST['mess']=badwords($_POST['mess']); // For size of mess dir; $sizeformessdir=0; $sizeformessdir=strlen($_POST['name'])+strlen($_POST['email'])+strlen($_POST['mess'])+6; if (!file_exists("../conf/sizeofmessdir.txt")) { $fp = fopen("../conf/sizeofmessdir.txt", "w"); $buffer = fputs($fp, "0"); fclose($fp); } $sizeformessdir=$sizeformessdir+file_get_contents("../conf/sizeofmessdir.txt"); $fp = fopen("../conf/sizeofmessdir.txt", "w"); $buffer = fputs($fp, $sizeformessdir); fclose($fp); // For size of mess dir END; if (file_get_contents("../conf/sizeofmessdir.txt")>file_get_contents("../conf/maxsizeofmessdir.txt")) { include("messdircleanup.php"); } $mess_time="20".date('y').date('m').date('d').date('H').date('i').date('s'); mkdir("../mess/".$mess_time); mkdir("../mess/".$mess_time."/mess"); $fp = fopen("../mess/".$mess_time."/addedby.txt", "w"); $buffer = fputs($fp, $_POST['name']); fclose($fp); $fp = fopen("../mess/".$mess_time."/email.txt", "w"); $buffer = fputs($fp, $_POST['email']); fclose($fp); $fp = fopen("../mess/".$mess_time."/topic.txt", "w"); $buffer = fputs($fp, $_POST['mess']); fclose($fp); $fp = fopen("../mess/".$mess_time."/views.txt", "w"); $buffer = fputs($fp, "0"); fclose($fp); $if_notifyarr=file("../conf/notifynewsubj.txt"); if (trim($if_notifyarr[0])=="yes") { $messtomail=substr($mess_time, 4, 2)."/".substr($mess_time, 6, 2)."/".substr($mess_time, 2, 2)." ".substr($mess_time, 8, 2).":".substr($mess_time, 10, 2).":".substr($mess_time, 12, 2)." ".$_POST['name']."(".$_POST['email']."): ".$_POST['mess']; if (trim($if_notifyarr[2])-17<strlen($messtomail)) { $messtomail=substr($messtomail, 0, $if_notifyarr[2]-20).".."; } $messtomail=stripslashes($messtomail); mail($if_notifyarr[1], "New forum subject", $messtomail); } $nogets=explode("?", $_SERVER['HTTP_REFERER']); $backlocation=$nogets[0]; if (headers_sent()) { echo "The new subject has been saved<br><form action=".$backlocation." method=get><input type=submit value=\"Go to forum\"</form>"; } else { header("Location: ".$backlocation); } ?> Файл badwords.php. Цей файл ─ це PHP-скрипт, який виконує перевірку на погані слова і заміняє їх заданими альтернативами. <? function badwords($checkthis) { $badwords_arr=file("../conf/badwords.txt"); $i_badw=0; while ($i_badw<count($badwords_arr)) { $badwords_arr[$i_badw]=trim($badwords_arr[$i_badw]); $i_badw++; } $replwith=trim(file_get_contents("../conf/badwordsrepl.txt")); $checked=str_replace($badwords_arr, $replwith, $checkthis); return $checked; } ?> Файл index.php. Цей файл забезпечує перегляд списку тем і показує список 20 тем по сторінках. Читає дані з таблиці topics. В кінці сторінки є форма для вводу нової теми, яка викликає скрипт newtopic.php. <? include("scandir.php"); function fixthemessdirsize($whatfile) { $alreadymessdirsize=file_get_contents("../conf/sizeofmessdir.txt"); $newmessdirsize=$alreadymessdirsize-filesize($whatfile); $fp = fopen("../conf/sizeofmessdir.txt", "w"); $buffer = fputs($fp, $newmessdirsize); fclose($fp); unlink($whatfile); } function cleanmess($dir) { if($objs = glob($dir."/*")){ foreach($objs as $obj) { is_dir($obj)? cleanmess($obj) : fixthemessdirsize($obj); } } rmdir($dir); } while (file_get_contents("../conf/sizeofmessdir.txt")>file_get_contents("../conf/maxsizeofmessdir.txt")) { $scandir="../mess/"; get_dir_files(); $filearray=array_reverse($filearray); $numofoldestdir=count($filearray)-1; $oldestdir=$filearray[$numofoldestdir]; cleanmess("../mess/".$oldestdir); } Файл messdircleanup.php. Цей файл виконує очистку папки з повідомленнями. <? include("scandir.php"); function fixthemessdirsize($whatfile) { $alreadymessdirsize=file_get_contents("../conf/sizeofmessdir.txt"); $newmessdirsize=$alreadymessdirsize-filesize($whatfile); $fp = fopen("../conf/sizeofmessdir.txt", "w"); $buffer = fputs($fp, $newmessdirsize); fclose($fp); unlink($whatfile); } function cleanmess($dir) { if($objs = glob($dir."/*")){ foreach($objs as $obj) { is_dir($obj)? cleanmess($obj) : fixthemessdirsize($obj); } } rmdir($dir); } while (file_get_contents("../conf/sizeofmessdir.txt")>file_get_contents("../conf/maxsizeofmessdir.txt")) { $scandir="../mess/"; get_dir_files(); $filearray=array_reverse($filearray); $numofoldestdir=count($filearray)-1; $oldestdir=$filearray[$numofoldestdir]; cleanmess("../mess/".$oldestdir); } Файл opensmiles.php. Цей фал вставляє потрібне позначення смайлика. <SCRIPT language=javascript> function dosmile(smilecode) { window.opener.document.add_subj.mess.value=window.opener.document.add_subj.mess.value+smilecode; window.opener.set_focus(); return false; } </script> <? $smiliestype=trim(file_get_contents("../conf/smilies.txt")); include("../templ/smilies/".$smiliestype."/codes.txt"); $sm_type=array_keys($smilies); $sm_i=0; while ($sm_i<count($smilies)) { echo "<a href=\"javascript: dosmile('".$sm_type[$sm_i]."')\"><img src=\"../templ/smilies/".$smiliestype."/img/".$smilies[$sm_type[$sm_i]]."\" border=0></a><br>"; $sm_i++; } ?> Файл security.php. Цей файл сканує вміст заданої папки ї записує отримані дані в масив. <? function get_dir_files() { global $filearray, $scandir, $messdir, $magicpath; $i=0; if ($handle = opendir($scandir)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $filearray[$i]=$file; $i++; } } closedir($handle); } @sort($filearray); } ?> Файл smilies.php. Цей файл заміняє позначення смайлика на сам малюнок. body { margin: 20px; background-image: url(background.gif); } A:link {color: #3333FF}: visited {color: #333366}:active {color: #0000CC} .lbg { border-bottom: 1px solid #EEE; border-left: 1px solid #EEE; } .fld { border: 1px outset #CCC; background-color: #FFF; } .bbl { border-bottom: 1px solid #CCC; border-left: 1px solid #CCC; } .tbl { border-top: 1px solid #CCC; border-left: 1px solid #EEE; } .btn { border: 1px solid #999; background-color: #EEE; } Файл manageposts.php. Цей файл використовується при адмініструванні для видалення тем чи відповідей. <? if (!empty($_POST['pass'])) { $_SESSION['pass']=$_POST['pass']; } include("conf/pass.php"); if (!empty($_SESSION['pass'])) { if ($_SESSION['pass']==$goodpass) { $forchangelines="one"; $showemails=trim(file_get_contents($f_for_relative."conf/showemails.txt")); include($f_for_relative."incl/scandir.php"); include($f_for_relative."incl/smilies.php"); if (empty($_GET['pagenum'])) { $_GET['pagenum']=0; } echo "<link href=\"".$f_for_relative."templ/styles/".file_get_contents($f_for_relative."conf/css.txt").".css\" type=text/css rel=stylesheet>"; $layarr=file($f_for_relative."templ/layouts/".file_get_contents($f_for_relative."conf/layout.txt").".txt"); $f_top=$layarr[1]; $f_pre=$layarr[3]; $f_pre_two=$layarr[5]; $f_after=$layarr[7]; $f_bottom=$layarr[9]; $f_separ=$layarr[11]; $f_postinfoend=$layarr[13]; $f_posts_pre=$layarr[15]; $f_posts_after=$layarr[17]; $f_postr_pre=$layarr[19]; $f_postr_after=$layarr[21]; $f_beforeposttable=$layarr[23]; $f_afterposttable=$layarr[25]; $f_numofthispage=$layarr[27]; $f_numofthispage_end=$layarr[29]; $f_postnewsubj=$layarr[31]; $f_postnewreply=$layarr[33]; $f_smilies=$layarr[35]; if (empty($_GET['f_man_act'])) { $_GET['f_man_act']="subj"; } if ($_GET['f_man_act']=="subj") { echo "Subjects<br>"; } else { echo "Replies<br>"; } $f_messonpage=file_get_contents($f_for_relative."conf/messonpage.txt"); if ($_GET['f_man_act']=="subj") { // SHOW TOPICS START echo "<form action=\"?act=del_subj\" method=post name=form_del_subj>"; echo $f_top; $scandir=$f_for_relative."mess"; get_dir_files(); $filesoutput=$filearray; @sort($filesoutput); $filesoutput=@array_reverse($filesoutput); $f_i=$_GET['pagenum']*$f_messonpage; if (count($filesoutput)-$f_i>$f_messonpage) { $f_till=$f_i+$f_messonpage; } else { $f_till=count($filesoutput); $f_i=$_GET['pagenum']*$f_messonpage; } $try_this_arr=Array(); while ($f_i<$f_till) { if (is_dir($f_for_relative."mess/".$filesoutput[$f_i])) { if ($forchangelines=="one") { echo $f_pre; $forchangelines="two"; } else { echo $f_pre_two; $forchangelines="one"; } echo "<input type=checkbox name=del_this_thing-".$filesoutput[$f_i].">"; echo "<a href=?act=manageposts&&f_man_act=choosesubj&&id=".$filesoutput[$f_i]." class=f_link>"; $f_subj=stripslashes(file_get_contents($f_for_relative."mess/".$filesoutput[$f_i]."/topic.txt")); echo smilies($f_subj); echo "</a>"; echo $f_separ; echo substr($filesoutput[$f_i], 4, 2)."/".substr($filesoutput[$f_i], 6, 2)."/".substr($filesoutput[$f_i], 2, 2)." ".substr($filesoutput[$f_i], 8, 2).":".substr($filesoutput[$f_i], 10, 2).":".substr($filesoutput[$f_i], 12, 2); echo " by: "; echo stripslashes(file_get_contents($f_for_relative."mess/".$filesoutput[$f_i]."/addedby.txt")); if ($showemails=="yes") { echo " ("; echo stripslashes(file_get_contents($f_for_relative."mess/".$filesoutput[$f_i]."/email.txt")); echo ")"; } echo ","; echo " views: ".stripslashes(file_get_contents($f_for_relative."mess/".$filesoutput[$f_i]."/views.txt")); echo ","; unset($numofposts); unset($filearray); $scandir=$f_for_relative."mess/".$filesoutput[$f_i]."/mess"; get_dir_files(); $numofposts=count($filearray); echo " posts: "; echo $numofposts; echo $f_postinfoend; echo $f_after; } $f_i++; } echo $f_bottom; // start the pagenumbers links if (count($filesoutput)>$f_messonpage) { if ($_GET['pagenum']!=0) { $f_i_bef=0; while($f_i_bef<$_GET['pagenum']) { $f_i_toshow=$f_i_bef+1; echo "<a href=\"?act=manageposts&&f_man_act=subj&&pagenum=".$f_i_bef."\" class=f_pagenums>".$f_i_toshow."</a>"; $f_i_bef++; } } } echo $f_numofthispage; echo $_GET['pagenum']+1; echo $f_numofthispage_end; $f_pagenumnext=$_GET['pagenum']+1; if (count($filesoutput)>$f_messonpage*$f_pagenumnext) { $f_i_aft=$f_pagenumnext; while($f_i_aft*$f_messonpage<count($filesoutput)) { $f_i_toshow=$f_i_aft+1; echo "<a href=\"?act=manageposts&&f_man_act=subj&&pagenum=".$f_i_aft."\" class=f_pagenums>".$f_i_toshow."</a>"; $f_i_aft++; } } // end of the pagenumbers links echo "<br><input type=submit value=\"Delete checked subjects\">"; // echo "<input type=hidden value=".$arr_to_del." name=post_arr>"; echo "</form>"; // END OF SHOW TOPICS } if ($_GET['f_man_act']=="choosesubj") { // START OF SHOW POSTINGS echo "<form action=\"?act=del_reply\" method=post name=form_del_reply>"; $postviews=file_get_contents($f_for_relative."mess/".$_GET['id']."/views.txt"); $postviews++; $inputfp=fopen($f_for_relative."mess/".$_GET['id']."/views.txt", "w"); $inputnew=fputs($inputfp, $postviews); fclose($inputfp); echo $f_top; echo $f_pre; echo $f_posts_pre; $f_subj=stripslashes(file_get_contents($f_for_relative."mess/".$_GET['id']."/topic.txt")); echo smilies($f_subj); echo $f_posts_after; echo $f_separ; echo substr($_GET['id'], 4, 2)."/".substr($_GET['id'], 6, 2)."/".substr($_GET['id'], 2, 2)." ".substr($_GET['id'], 8, 2).":".substr($_GET['id'], 10, 2).":".substr($_GET['id'], 12, 2); echo " by: "; echo stripslashes(file_get_contents($f_for_relative."mess/".$_GET['id']."/addedby.txt")); if ($showemails=="yes") { echo " ("; echo stripslashes(file_get_contents($f_for_relative."mess/".$_GET['id']."/email.txt")); echo ")"; } echo ","; echo " views: ".stripslashes(file_get_contents($f_for_relative."mess/".$_GET['id']."/views.txt")); echo ","; unset($numofposts); unset($filearray); unset($numofposts); $scandir=$f_for_relative."mess/".$_GET['id']."/mess/"; get_dir_files(); $numofposts=count($filearray); echo " posts: "; echo $numofposts; echo $f_postinfoend; echo $f_after; unset($filearray); unset($filesoutput); unset($numofposts); $scandir=$f_for_relative."mess/".$_GET['id']."/mess"; get_dir_files(); $filesoutput=$filearray; @sort($filesoutput); $filesoutput=@array_reverse($filesoutput); $f_i=$_GET['pagenum']*$f_messonpage; if (count($filesoutput)-$f_i>$f_messonpage) { $f_till=$f_i+$f_messonpage; } else { $f_till=count($filesoutput); $f_i=$_GET['pagenum']*$f_messonpage; } $try_this_arr=Array(); while ($f_i<$f_till) { echo $f_pre_two; echo $f_postr_pre; echo "<input type=checkbox name=del_this_thing-".$filesoutput[$f_i].">"; $f_subj=stripslashes(file_get_contents($f_for_relative."mess/".$_GET['id']."/mess/".$filesoutput[$f_i]."/mess.txt")); echo smilies($f_subj); echo $f_postr_after; echo $f_separ; echo substr($filesoutput[$f_i], 4, 2)."/".substr($filesoutput[$f_i], 6, 2)."/".substr($filesoutput[$f_i], 2, 2)." ".substr($filesoutput[$f_i], 8, 2).":".substr($filesoutput[$f_i], 10, 2).":".substr($filesoutput[$f_i], 12, 2); echo " by: "; echo stripslashes(file_get_contents($f_for_relative."mess/".$_GET['id']."/mess/".$filesoutput[$f_i]."/addedby.txt")); if ($showemails=="yes") { echo " ("; echo stripslashes(file_get_contents($f_for_relative."mess/".$_GET['id']."/mess/".$filesoutput[$f_i]."/email.txt")); echo ")"; } echo $f_postinfoend; echo $f_after; $f_i++; } echo $f_bottom; // start the pagenumbers links if (count($filesoutput)>$f_messonpage) { if ($_GET['pagenum']!=0) { $f_i_bef=0; while($f_i_bef<$_GET['pagenum']) { $f_i_toshow=$f_i_bef+1; echo "<a href=\"?act=manageposts&&f_man_act=choosesubj&&id=".$_GET['id']."&&pagenum=".$f_i_bef."\" class=f_pagenums>".$f_i_toshow."</a>"; $f_i_bef++; } } } echo $f_numofthispage; echo $_GET['pagenum']+1; echo $f_numofthispage_end; $f_pagenumnext=$_GET['pagenum']+1; if (count($filesoutput)>$f_messonpage*$f_pagenumnext) { $f_i_aft=$f_pagenumnext; while($f_i_aft*$f_messonpage<count($filesoutput)) { $f_i_toshow=$f_i_aft+1; echo "<a href=\"?act=manageposts&&f_man_act=choosesubj&&id=".$_GET['id']."&&pagenum=".$f_i_aft."\" class=f_pagenums>".$f_i_toshow."</a>"; $f_i_aft++; } } // end of the pagenumbers links echo "<br><input type=submit value=\"Delete checked replies\">"; echo "<input type=hidden name=subj_id value=\"".$_GET['id']."\">"; echo "</form>"; //END OF SHOW POSTINGS } // password check end } } ?> Файл index.php. Цей файл виконує виводить вікно для перевірки пароля адміністратора <? session_start(); session_destroy(); session_unset(); ?> <html> <head> </head> <body> <center> <form action="manage.php" method=post> Password: <input type=password name="pass"><br> <input type=submit value="Enter"> </form> </center> </body> </html> Файл manage.php. Цей файл призначений для адміністрування форуму. <? session_start(); if (!empty($_POST['pass'])) { $_SESSION['pass']=$_POST['pass']; } include("conf/pass.php"); function commonhead() { ?> <html> <head> <title> Forum admin manager </title> </head> <body> <center> <link href="img/style.css" type=text/css rel=stylesheet> <table border=0 cellspacing=5> <tr> <td> <a href="manage.php?act=changepassform">Change password</a> </td> <td> <a href="manage.php?act=gensettings">General Settings</a> </td> <td> <a href="manage.php?act=appear">Appearence</a> </td> <td> <a href="manage.php?act=manageposts">Manage Posts</a> </td> <td> <a href="index.php">Log out</a> </td> </tr> </table> <? } function commonend() { ?> <br> </center> </body> </html> <? } if (!empty($_SESSION['pass'])) { if ($_SESSION['pass']==$goodpass) { // FUNCTIONS function rmdirr($dir) { if($objs = glob($dir."/*")){ foreach($objs as $obj) { is_dir($obj)? rmdirr($obj) : unlink($obj); } } rmdir($dir); } //Show default page in "admin" mode if (empty($_GET['act'])) { $_GET['act']="appear"; } if ($_GET['act']=="appear") { commonhead(); include("../incl/scandir.php"); ?> Change layout and style of your forum.<br> <? if (!empty($_POST['submit1'])) { $_POST['submit']=$_POST['submit1']; } // Activate layout Start: if (!empty($_POST['submit']) && $_POST['submit']=="Activate") { $fp = fopen("../conf/layout.txt", "w"); $buffer = fputs($fp, trim($_POST['ch_layout'])); fclose($fp); echo "Active layout is: \"".trim($_POST['ch_layout'])."\"<br>"; } // Activate layout End. // Activate style Start: if (!empty($_POST['submit']) && $_POST['submit']=="Activate Style") { $fp = fopen("../conf/css.txt", "w"); $buffer = fputs($fp, trim($_POST['ch_style'])); fclose($fp); echo "Active style is: \"".trim($_POST['ch_style'])."\"<br>"; } // Activate style End. // Delete layout Start: if (!empty($_POST['submit']) && $_POST['submit']=="Delete") { unlink("../templ/layouts/".$_POST['ch_layout'].".txt"); echo "The lyout \"".trim($_POST['ch_layout'])."\" has been deleted<br>"; // Delete layout End. // Delete style Start: if (!empty($_POST['submit']) && $_POST['submit']=="Delete Style") { unlink("../templ/styles/".$_POST['ch_style'].".css"); echo "The style \"".trim($_POST['ch_style'])."\" has been deleted<br>"; } // Delete style End. // Edit through Copy Layout Start: if (!empty($_POST['submit']) && $_POST['submit']=="Edit through copy") { $forcopyl=explode("_", $_POST['ch_layout']); $n_l_arr=$forcopyl; $i_newname=0; $new_layout_n=$_POST['ch_layout']; while (file_exists("../templ/layouts/".$new_layout_n.".txt")) { if (count($forcopyl)==1) { $new_layout_n=$_POST['ch_layout']."_".$i_newname; } else { // $sub_untill=strlen($_POST['ch_layout'])-strlen($forcopyl[count($forcopyl)-1]); // $new_layout_n=substr($_POST['ch_layout'], 0, $sub_untill)."_".$i_newname; $n_l_arr[count($n_l_arr)-1]=$i_newname; $new_layout_n=implode("_", $n_l_arr); // $new_layout_n=implode("_", $new_layout_n); } $i_newname++; } copy("../templ/layouts/".$_POST['ch_layout'].".txt", "../templ/layouts/".$new_layout_n.".txt"); ?> <form action="manage.php?act=appear" method=post name="form"> <input type=hidden name="submit1" value="Edit"> <input type=hidden name="ch_layout" value="<? echo $new_layout_n; ?>"> <input type=submit value="Click here to go to the next step" name=hmm> </form> <script language=javascript> function subm() { document.form.submit(); } subm(); </script> <? echo "You want to copy this layout \"".trim($_POST['ch_layout'])."\"<br>"; } // Edit through Copy Layout End. // Edit through Copy Style Start: if (!empty($_POST['submit']) && $_POST['submit']=="Edit Style through copy") { $forcopyl=explode("_", $_POST['ch_style']); $n_l_arr=$forcopyl; $i_newname=0; $new_style_n=$_POST['ch_style']; while (file_exists("../templ/styles/".$new_style_n.".css")) { if (count($forcopyl)==1) { $new_style_n=$_POST['ch_style']."_".$i_newname; } else { // $sub_untill=strlen($_POST['ch_style'])-strlen($forcopyl[count($forcopyl)-1]); // $new_style_n=substr($_POST['ch_style'], 0, $sub_untill)."_".$i_newname; $n_l_arr[count($n_l_arr)-1]=$i_newname; $new_style_n=implode("_", $n_l_arr); // $new_style_n=implode("_", $new_style_n); } $i_newname++; } copy("../templ/styles/".$_POST['ch_style'].".css", "../templ/styles/".$new_style_n.".css"); ?> <form action="manage.php?act=appear" method=post name="form"> <input type=hidden name="submit1" value="Edit Style"> <input type=hidden name="ch_style" value="<? echo $new_style_n; ?>"> <input type=submit value="Click here to go to the next step" name=hmm> </form> <script language=javascript> function subm() { document.form.submit(); } subm(); </script> <? echo "You want to copy this style \"".trim($_POST['ch_style'])."\"<br>"; } // Edit through Copy Style End. // Save Layout Start: if (!empty($_POST['submit']) && $_POST['submit']=="Save changes to this layout") { // get the array with sv_lt_arr_.. names $i_postarr=0; $i_narr=0; while ($i_postarr<count($_POST)) { if (key_exists("sv_lt_arr_".$i_postarr, $_POST)) { $sv_lt_newarr[$i_narr]=str_replace("\n", "", stripslashes($_POST["sv_lt_arr_".$i_postarr])); if ($sv_lt_newarr[$i_narr]=="") { $sv_lt_newarr[$i_narr]=" "; } $i_narr++; } $i_postarr++; } $lt_input=implode("\n", $sv_lt_newarr); $fp = fopen("../templ/layouts/".$_POST['layout_name'].".txt", "w"); $buffer = fputs($fp, $lt_input); fclose($fp); echo "Save layout<br>"; } // Save Layout End. // Save Style Start: if (!empty($_POST['submit']) && $_POST['submit']=="Save changes to this style") { $st_input=$_POST['sv_st']; $fp = fopen("../templ/styles/".$_POST['style_name'].".css", "w"); $buffer = fputs($fp, $st_input); fclose($fp); echo "Changes to this style have been saved.<br>"; } // Save Style End. if (empty($_POST['submit']) || $_POST['submit']!="Edit" && $_POST['submit']!="Edit Style") { // to protect from Edit; // Layouts line start $scandir="../templ/layouts"; get_dir_files(); ?> <form action="manage.php?act=appear" method=post> <? $i_am=0; echo "Current active layout: <select name=ch_layout>"; $for_selctd_check=trim(file_get_contents("../conf/layout.txt")); while ($i_am<count($filearray)) { echo "<option"; if ($for_selctd_check==basename($filearray[$i_am], ".txt")) echo " selected"; echo ">"; echo basename($filearray[$i_am], ".txt"); echo "</option>"; $i_am++; } echo "</select>"; echo "<input type=submit name=submit value=\"Activate\" class=f_submit_b>"; echo "<input type=submit name=submit value=\"Edit through copy\" class=f_submit_b>"; echo "<input type=submit name=submit value=\"Edit\" class=f_submit_b>"; echo "<input type=submit name=submit value=\"Delete\" class=f_submit_b>"; echo "</form>"; // Layouts line end // Styles line start $scandir="../templ/styles"; get_dir_files(); ?> <form action="manage.php?act=appear" method=post> <? $i_am=0; echo "Current active style: <select name=ch_style>"; $for_selctd_check=trim(file_get_contents("../conf/css.txt")); while ($i_am<count($filearray)) { echo "<option"; if ($for_selctd_check==basename($filearray[$i_am], ".css")) echo " selected"; echo ">"; echo basename($filearray[$i_am], ".css"); echo "</option>"; $i_am++; } echo "</select>"; echo "<input type=submit name=submit value=\"Activate Style\" class=f_submit_b>"; echo "<input type=submit name=submit value=\"Edit Style through copy\" class=f_submit_b>"; echo "<input type=submit name=submit value=\"Edit Style\" class=f_submit_b>"; echo "<input type=submit name=submit value=\"Delete Style\" class=f_submit_b>"; echo "</form>"; // Layouts line end commonend(); } // Edit Layout Start: if (!empty($_POST['submit']) && $_POST['submit']=="Edit") { $layout_ed_arr=file("../templ/layouts/".$_POST['ch_layout'].".txt"); echo "The name of the chosen layout is: \"".trim($_POST['ch_layout'])."\"<br>"; echo "The version of this layout is: ".$layout_ed_arr[0]."."; echo "<form action=\"manage.php?act=appear\" method=post>"; echo "<input type=hidden name=sv_lt_arr_0 value=\"".$layout_ed_arr[0]."\">"; echo "<input type=hidden name=layout_name value=\"".$_POST['ch_layout']."\">"; echo "<table>"; $i_ltedit=1; while ($i_ltedit<count($layout_ed_arr)) { echo "<tr><td width=250>"; $i_lteditplusone=$i_ltedit+1; echo $layout_ed_arr[$i_lteditplusone]; echo "<input type=hidden name=\"sv_lt_arr_".$i_lteditplusone."\" value=\"".$layout_ed_arr[$i_lteditplusone]."\">"; echo ": </td><td width=250>"; echo "<textarea class=textarea name=sv_lt_arr_".$i_ltedit.">".stripslashes($layout_ed_arr[$i_ltedit])."</textarea>"; echo "</td></tr>"; $i_ltedit=$i_ltedit+2; } echo "<tr><td>&nbsp</td><td><input type=submit value=\"Save changes to this layout\" class=f_submit_b name=\"submit\"></td><tr>"; echo "</table></form>"; commonend(); } // Edit Layout End. // Edit Style Start: if (!empty($_POST['submit']) && $_POST['submit']=="Edit Style") { echo "The name of the chosen style is: \"".trim($_POST['ch_style'])."\"<br>"; echo "<form action=\"manage.php?act=appear\" method=post>"; echo "<input type=hidden name=style_name value=\"".$_POST['ch_style']."\">"; echo "<table>"; echo "<tr><td width=550>"; echo "<textarea class=textarea_foreditstyle name=sv_st>".stripslashes(trim(file_get_contents("../templ/styles/".$_POST['ch_style'].".css")))."</textarea>"; echo "</td></tr>"; echo "<tr><td><input type=submit value=\"Save changes to this style\" class=f_submit_b name=\"submit\"></td><tr>"; echo "</table></form>"; commonend(); } // Edit Style End. } if ($_GET['act']=="changepassform") { commonhead(); echo "Change password<br>"; ?> <form action="manage.php?act=changepass" method=post> New password: <input type=password class=f_inputtext name="newpass"><br> <input type=submit value="Enter" class=f_submit_b> </form> <? commonend(); } if ($_GET['act']=="gensettings") { commonhead(); ?> General Settings<br> <form action="manage.php?act=changegensettings" method=post> <table width=500> <tr> <td> Max subject length: </td> <td><input type=text class=f_inputtext name="maxsubjlength" value="<? echo trim(file_get_contents("../conf/messlength.txt")); ?>"> </td> </tr> <tr> <td> Max reply length: </td> <td> <input type=text class=f_inputtext name="maxreplylength" value="<? echo trim(file_get_contents("../conf/replylength.txt")); ?>"> </td> </tr> <tr> <td> Max subjects/replies per one page: </td> <td> <input type=text class=f_inputtext name="maxmessonpage" value="<? echo trim(file_get_contents("../conf/messonpage.txt")); ?>"> </td> </tr> <tr> <td style="BORDER-top: #808080 1px solid; BORDER-left: #808080 1px solid"> Notify me about new subjects by email: </td> <td style="BORDER-top: #808080 1px solid; BORDER-right: #808080 1px solid"> <select name="subjemailyes"><option value="yes" <? $forselected=file("../conf/notifynewsubj.txt"); if (trim($forselected[0])=="yes") { echo "selected"; } ?> >Yes</option><option value="no" <? if (trim($forselected[0])=="no") { echo "selected"; } ?> >No</option></select> </td> </tr> <tr> <td> on this email: </td> <td> <input type=text class=f_inputtext name="emailforsubj" value="<? echo trim($forselected[1]); ?>"> </td> </tr> <tr> <td style="BORDER-bottom: #808080 1px solid; BORDER-left: #808080 1px solid"> max message length for this email: </td> <td style="BORDER-bottom: #808080 1px solid; BORDER-right: #808080 1px solid"> <input type=text class=f_inputtext name="maxemailforsubj" value="<? echo trim($forselected[2]); ?>"> </td> </tr> <tr> <td style="BORDER-top: #808080 1px solid; BORDER-left: #808080 1px solid"> Notify me about new posts by email: </td> <td style="BORDER-top: #808080 1px solid; BORDER-right: #808080 1px solid"> <select name="postemailyes"><option value="yes" <? $forselected=file("../conf/notifynewreply.txt"); if (trim($forselected[0])=="yes") { echo "selected"; } ?> >Yes</option><option value="no" <? if (trim($forselected[0])=="no") { echo "selected"; } ?> >No</option></select> </td> </tr> <tr> <td> on this email: </td> <td> <input type=text class=f_inputtext name="emailforpost" value="<? echo trim($forselected[1]); ?>"> </td> </tr> <tr> <td style="BORDER-bottom: #808080 1px solid; BORDER-left: #808080 1px solid"> max message length for this email: </td> <td style="BORDER-bottom: #808080 1px solid; BORDER-right: #808080 1px solid"> <input type=text class=f_inputtext name="maxemailforpost" value="<? echo trim($forselected[2]); ?>"> </td> </tr> <tr> <td> Safe emails:<br> (to protect your emails from spammers turn this on) </td> <td> <select name="safeemails"><option value="yes" <? $forselected=file_get_contents("../conf/safeemails.txt"); if (trim($forselected)=="yes") { echo "selected"; } ?> >Yes</option><option value="no" <? if (trim($forselected)=="no") { echo "selected"; } ?> >No</option></select> </td> </tr> <tr> <td> Show emails on forum: </td> <td> <select name="showemails"><option value="yes" <? $forselected=file_get_contents("../conf/showemails.txt"); if (trim($forselected)=="yes") { echo "selected"; } ?> >Yes</option><option value="no" <? if (trim($forselected)=="no") { echo "selected"; } ?> >No</option></select> </td> </tr> <tr> <td> Max size for all messages (bytes): </td> <td> <input type=text class=f_inputtext name="maxmessdirsize" value="<? echo trim(file_get_contents("../conf/maxsizeofmessdir.txt")); ?>"> </td> </tr> <tr> <td> Tags allowed for posts: </td> <td> <textarea class=textarea name="tagsallowed"> <? $tags_allow_arr=file("../conf/tagsallowed.txt"); $tags_allow_expl=implode("", $tags_allow_arr); $tags_to_show=str_replace("\n", "", $tags_allow_expl); echo $tags_to_show; ?> </textarea> </td> </tr> <tr> <td> Search for these badwords: </td> <td> <textarea class=textarea name="badwsearch"> <? $badw_arr=file("../conf/badwords.txt"); $badw_str=implode(", ", $badw_arr); $badw_to_show=str_replace("\n", "", $badw_str); echo $badw_to_show; ?> </textarea> </td> </tr> <tr> <td> Replace badwords with this: </td> <td> <input type=text class=f_inputtext name="replacebadwords" value="<? echo trim(file_get_contents("../conf/badwordsrepl.txt")); ?>"> </td> </tr> <tr> <td> <input type=submit value="Save" class=f_submit_b> </td> <td> &nbsp </td> </tr> </table> </form> <? commonend(); } if ($_GET['act']=="changegensettings") { commonhead(); if (!empty($_POST['maxsubjlength']) && is_numeric($_POST['maxsubjlength']) && !empty($_POST['maxreplylength']) && is_numeric($_POST['maxreplylength']) && !empty($_POST['maxmessonpage']) && is_numeric($_POST['maxmessonpage']) && !empty($_POST['subjemailyes']) && !empty($_POST['postemailyes']) && !empty($_POST['safeemails']) && !empty($_POST['showemails'])) { $fp = fopen("../conf/messlength.txt", "w"); $buffer = fputs($fp, $_POST['maxsubjlength']); fclose($fp); $fp = fopen("../conf/replylength.txt", "w"); $buffer = fputs($fp, $_POST['maxreplylength']); fclose($fp); $fp = fopen("../conf/messonpage.txt", "w"); $buffer = fputs($fp, $_POST['maxmessonpage']); fclose($fp); if ($_POST['subjemailyes']=="yes" && preg_match("/[0-9a-z_]+@[0-9a-z_^\.]+[a-z]{2,3}/i", $_POST['emailforsubj']) && is_numeric($_POST['maxemailforsubj']) && !empty($_POST['safeemails'])) { $notifysubj="yes\n".$_POST['emailforsubj']."\n".$_POST['maxemailforsubj']; } else { // If Don't notify about subjects by email if (empty($_POST['maxemailforsubj'])) { $_POST['maxemailforsubj']=" "; } if (empty($_POST['emailforsubj'])) { $_POST['emailforsubj']=" "; } $notifysubj="no\n".$_POST['emailforsubj']."\n".$_POST['maxemailforsubj']; } $fp = fopen("../conf/notifynewsubj.txt", "w"); $buffer = fputs($fp, $notifysubj); fclose($fp); if ($_POST['postemailyes']=="yes" && preg_match("/[0-9a-z_]+@[0-9a-z_^\.]+[a-z]{2,3}/i", $_POST['emailforpost']) && is_numeric($_POST['maxemailforpost']) && !empty($_POST['maxemailforpost'])) { $notifypost="yes\n".$_POST['emailforpost']."\n".$_POST['maxemailforpost']; } else { // If Don't notify about posts by email if (empty($_POST['maxemailforpost'])) { $_POST['maxemailforpost']=" "; } if (empty($_POST['emailforpost'])) { $_POST['emailforpost']=" "; } $notifypost="no\n".$_POST['emailforpost']."\n".$_POST['maxemailforpost']; } $fp = fopen("../conf/notifynewreply.txt", "w"); $buffer = fputs($fp, $notifypost); fclose($fp); $fp = fopen("../conf/safeemails.txt", "w"); $buffer = fputs($fp, $_POST['safeemails']); fclose($fp); $fp = fopen("../conf/showemails.txt", "w"); $buffer = fputs($fp, $_POST['showemails']); fclose($fp); $fp = fopen("../conf/maxsizeofmessdir.txt", "w"); $buffer = fputs($fp, $_POST['maxmessdirsize']); fclose($fp); // tagsallowed $tags_allow_search=array("\n", ",", " "); $fixtagsallow=str_replace($tags_allow_search, "", $_POST['tagsallowed']); $fixtagsexpl=explode("><", $fixtagsallow); $fixtagsimpl=implode(">\n<", $fixtagsexpl); $fp = fopen("../conf/tagsallowed.txt", "w"); $buffer = fputs($fp, $fixtagsimpl); fclose($fp); // BAD WORDS SEARCH $badw_search="\n"; $fixbadw=str_replace($badw_search, "", $_POST['badwsearch']); $fixbadwexpl=explode(", ", $fixbadw); $fixbadwimpl=implode("\n", $fixbadwexpl); $fp = fopen("../conf/badwords.txt", "w"); $buffer = fputs($fp, $fixbadwimpl); fclose($fp); // REPLACE BAD WORDS WITH $_POST['replacebadwords']=trim($_POST['replacebadwords']); $fp = fopen("../conf/badwordsrepl.txt", "w"); $buffer = fputs($fp, $_POST['replacebadwords']); fclose($fp); echo "The general settings have been saved sucessfully!"; } else { echo "Error!"; } commonend(); } if ($_GET['act']=="changepass") { commonhead(); $newpassinput="<? \$goodpass=\"".$_POST['newpass']."\";?>"; $fp = fopen("conf/pass.php", "w"); $buffer = fputs($fp, $newpassinput); fclose($fp); $_SESSION['pass']=$_POST['newpass']; echo "The new password has been changed sucessfully!"; commonend(); } if ($_GET['act']=="manageposts") { commonhead(); echo "Manage posts<br>"; $f_for_relative="../"; include("incl/manageposts.php"); commonend(); } if ($_GET['act']=="del_subj") { commonhead(); echo "The subject(s) deleted successfully<br>"; $i_del_th=0; $del_keys_arr=array_keys($_POST); while($i_del_th<count($_POST)) { if (substr($del_keys_arr[$i_del_th], 0, 15)=="del_this_thing-") { $what_to_del="../mess/".substr($del_keys_arr[$i_del_th], 15, 28); rmdirr($what_to_del); } $i_del_th++; } commonend(); } if ($_GET['act']=="del_reply") { commonhead(); echo "The reply(ies) deleted successfully<br>"; $i_del_th=0; $del_keys_arr=array_keys($_POST); while($i_del_th<count($_POST)) { if (substr($del_keys_arr[$i_del_th], 0, 15)=="del_this_thing-") { $what_to_del="../mess/".$_POST['subj_id']."/mess/".substr($del_keys_arr[$i_del_th], 15, 28); rmdirr($what_to_del); } $i_del_th++; } commonend(); } if ($_GET['act']=="downloadstyles") { copy($url_for_support."/support/downnew/txt/styles.txt", "tempstorage/newstyles.php"); if (headers_sent()) { echo "Please, click Next to proceed to the next step."; echo "<form action=\"manage.php?act=shownewstyles\" method=p
Антиботан аватар за замовчуванням

2015

Коментарі

Ви не можете залишити коментар. Для цього, будь ласка, увійдіть або зареєструйтесь.

Ділись своїми роботами та отримуй миттєві бонуси!

Нічого не вибрано
0%

Оголошення від адміністратора

Антиботан аватар за замовчуванням

Подякувати Студентському архіву довільною сумою

Admin

26.02.2023 12:38

Дякуємо, що користуєтесь нашим архівом!