Chickenz Posted February 11, 2004 Report Share Posted February 11, 2004 Manaa riiciibaa jau peec dienas darba ir viena news sisteema kuru uzcepu ar savaam suuda rocinjaaam taa satur ip banoshanu raxtu administreeshanu un adminu loginu! news glabaajas uz mysql un scripts ira viegli saprotams!!! Vajag jums taadu!?!?!? Link to comment Share on other sites More sharing options...
Gacha Posted February 11, 2004 Report Share Posted February 11, 2004 Vari jau ielikt. Gribeos apskatiities kaa citi to taisa. Link to comment Share on other sites More sharing options...
sviesc Posted February 12, 2004 Report Share Posted February 12, 2004 dod tik šurp aplūkosim ko esi saraxtijis- patestesim Link to comment Share on other sites More sharing options...
Chickenz Posted February 15, 2004 Author Report Share Posted February 15, 2004 tjipa te ir: uzmaniigi izlasiet un saraxtiet attieciigajos failos!!! index.php saturs: <? include("incl/config.php"); mysql_connect($hosts, $users, $passw) or die('Nevar piesleegties servuxam!'); mysql_select_db("main") or die('Nevar piesleegties db!'); $ip=$_SERVER['REMOTE_ADDR']; $query = mysql_query("SELECT reason FROM bans WHERE ip = '$ip'"); if (mysql_num_rows($query) > 0) { while ($row = mysql_fetch_array($query)) {$reason = $row['reason'];} die ("<font color=\"#990000\" size=\"2\" face=\"verdana\"><b>Sorry vecais tev ir bans!!!<br>Iemesls:</b> $reason</font>");} ?> <html> <head> <LINK href="style.css" type="text/css" rel="stylesheet"> <title>JOOOO RAXTIII...</title> </head> <body oncontextmenu="return false"> <table width="659" cellpadding="3"> <tr> <td><?news();?></td> <td valign="top"> <table align="right" width="250"> <tr> <td bgcolor="#990000" class="list"><b> Paareejie raxti:</b></td> </tr><?list_other_news();?> </table> </td> </tr> </table> </body> </html> <?mysql_close();?> incl/config.php saturs: <? #------------------------------ MYSQL configs... $hosts = 'localhost'; $users = 'Chickenz'; $passw = 'kaka'; $main_db = 'main'; $banu_tab = 'bans'; $news_tab = 'news'; #------------------------------ citi mainiigie... $datums = date("d.m.y, H:i"); $ip = $_SERVER['REMOTE_ADDR']; $raxtu_skaic="3"; #---------- raxtu skaits ko raadiis saakumaa... #------------------------------ datuma f-ja... function datums() { switch(date(l)) { case Monday:echo "Pirmdiena"; break; case Tuesday:echo "Otrdiena"; break; case Wednesday:echo "Treðdiena"; break; case Thurstday:echo "Ceturtdiena"; break; case Friday:echo "Piektdiena"; break; case Saturday:echo "Sestdiena"; break; case Sunday:echo "Svçtdiena"; break;} echo " "; $datums=date(j); echo "$datums."; switch(date(F)) { case January:echo "Janvâris"; break; case February:echo "Februâris"; break; case March:echo "Marts"; break; case April:echo "Aprîlis"; break; case May:echo "Maijs"; break; case June:echo "Jûnijs"; break; case July:echo "Jûlijs"; break; case August:echo "Augusts"; break; case September:echo "Septembris"; break; case October:echo "Oktobris"; break; case November:echo "Novembris"; break; case December:echo "Decembris"; break;} } #------------------------------ zinju funkcijas... function news(){ if (isset($_GET['news'])){ $news = $_GET['news']; $db=mysql_query("SELECT * FROM news where `id`=$news"); if (!$db) {echo( mysql_error());} else { while ($row = mysql_fetch_array($db)) { $autors = $row["autors"]; $laiks = $row["laiks"]; $virsraksts = $row["virsraksts"]; $apraksts = $row["apraksts"]; $raksts = $row['raksts']; $bilde = $row["bilde"]; echo ?> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="400"> <tr> <td class="vispar" width="400" colspan="2"><?=$virsraksts;?></td> </tr> <tr> <td width="112" class="td"><img src="<?=$bilde;?>" width="100" height="115" border="1"></td> <td class="text" width="288"><div align="justify"><?=$apraksts;?></div></td> </tr> <tr> <td class="td_bottom" width="112"><font color="#444444"><b><?=$autors;?></b></font></td> <td class="td_bottom" width="288" align="right"><font color="#AAAAAA"><?=$laiks;?></font></td> </tr> <tr> <td bgcolor="#EEEEEE" width="400" class="td" colspan="2"><?=$raksts;?></td> </tr> </table> <? }}} else{ echo ?> <? $db=mysql_query("SELECT * FROM news ORDER BY `id` DESC limit 0, 3"); if (!$db) {echo( mysql_error());} else { while ($row = mysql_fetch_array($db)) { $autors = $row['autors']; $laiks = $row['laiks']; $virsraksts = $row['virsraksts']; $apraksts = $row["apraksts"]; $raksts = $row['raksts']; $bilde = $row['bilde']; $id = $row['id']; echo?> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="400"> <tr> <td class="header" width="400" colspan="2"><a href="?news=<?=$id;?>"><?=$virsraksts;?></a></td> </tr> <tr> <td width="112" class="td"><img src="<?=$bilde;?>" width="100" height="115" border="1"></td> <td class="text" width="288"><div align="justify"><?=$apraksts;?></div></td> </tr> <tr> <td class="td_bottom" width="112"><font color="#444444"><b><?=$autors;?></b></font></td> <td class="td_bottom" width="288" align="right"><font color="#AAAAAA"><?=$laiks;?></font></td> </tr> </table> <?}}}} function list_other_news(){ $db2=mysql_query("SELECT * FROM news ORDER BY `id` DESC limit 3,999"); if (!$db2) {echo( mysql_error());} else { while ($row = mysql_fetch_array($db2)) { $virsraksts = $row['virsraksts']; $id = $row['id']; echo?> <tr> <td class="td_bottom" bgcolor="#FFFFFF" width="400"><b><a href="?news=<?=$id;?>"><?=$virsraksts;?></a></b></td> </tr> <?}}}?> style.css saturs: Body { font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; font-size : 11px; } .header A:Link { font-size : 12 px; font-weight : bold; color : #804040; text-decoration : none; } .header A:Visited { font-size : 12 px; font-weight : bold; color : #804040; text-decoration : none; } .header A:Active { font-size : 12 px; font-weight : bold; color : Maroon; text-decoration : underline; } .header A:Hover { font-size : 12 px; font-weight : bold; color : Maroon; text-decoration : underline; } .td{ font-size : 10 px; padding : 3; } .list{ font-size : 12 px; color: #FFFFFF; padding : 1; } .text{ font-size : 11 px; } .td_bottom{ padding : 1; font-size : 11 px; border-bottom : #CCCCCC 1px solid; } .all{ border-top: #333333 1px solid; border-bottom: #333333 1px solid; font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; font-size : 10px; color : #444444; padding : 1; } .input{ border: #222222 1px solid; font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; font-size : 10px; background-color : #EEEEEE; color : #333333; padding : 1; width: 200; } .input2{ border: #222222 1px solid; font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; font-size : 10px; background-color : #FFFFFF; color : #333333; padding : 1; width: 20; } .vispar { font-size : 12 px; font-weight : bold; color : #804040; } .textarea1{ border: #222222 1px solid; font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; font-size : 10px; background-color : #EEEEEE; color : #333333; padding : 1; width: 200; height: 50; } .del { font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; font-size : 10px; color : #333333; } .textarea2{ border: #222222 1px solid; font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; font-size : 10px; background-color : #EEEEEE; color : #333333; padding : 1; width: 300; height: 100; } .b1{ border: #222222 1px solid; font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; font-size : 10px; background-color : #FFFFFF; color : #333333; width: 100; } A:visited { Font-size : 10px; color : #000000; font-family : Verdana; text-decoration: none; } A:active { Font-size : 10px; color : #AA0000; font-family : Verdana; text-decoration: underline; } A:link { Font-size : 10px; color : #000000; font-family : Verdana; text-decoration: none; } A:hover { Color: #AA0000; font-size: 10px; font-family: Verdana; text-decoration: underline; } admin/imageupload.php saturs: <? if (($_SERVER['PHP_AUTH_USER']!="Chickenz")||($_SERVER['PHP_AUTH_PW']!="kaka")) { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); echo "<font color=\"red\" face=\"verdana\" size=\"2\">Sorry vecais, tu neesi admins!!!</font>";die;} else{ ?> <html> <head> <meta http-equiv="Content-Language" content="lv"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1257"> <LINK href="../style.css" type="text/css" rel="stylesheet"> <title>Failu upload!</title> </head> <body> <table border="0" cellpadding="0" cellspacing="5" style="border-collapse: collapse" width="500" class="sad_l"> <tr><FORM ENCTYPE="multipart/form-data" ACTION="imageupload.php" METHOD="POST"> <td align="center" width="450" colspan="2"><?echo "<b>Sveiks {$_SERVER['PHP_AUTH_USER']}!!!</b>";?></td> </tr> <tr> <td align="center" width="100"> </td> <td align="center" width="400"> </td> </tr> <tr> <td align="center" width="100">Fails:</td> <td align="center" width="400"><INPUT TYPE="file" NAME="userfile" class="input" size="20"> <INPUT TYPE="submit" VALUE="OK" class="b1"></td> </tr> <tr> <td align="center" width="450" colspan="2"> </td> </tr> <tr> <td align="center" width="450" colspan="2"> <?php extract($_POST, EXTR_SKIP); $dir = "../img/"; $msize = 1024000; if (!isset($HTTP_POST_FILES['userfile'])) exit; if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) { if ($HTTP_POST_FILES['userfile']['size']>$msize){ echo "Fails ir pârâk liels<br>"; exit; } if (($HTTP_POST_FILES['userfile']['type']=="image/gif")|| ($HTTP_POST_FILES['userfile']['type']=="image/pjpeg")|| ($HTTP_POST_FILES['userfile']['type']=="image/jpeg")|| ($HTTP_POST_FILES['userfile']['type']=="image/bmp")|| ($HTTP_POST_FILES['userfile']['type']=="image/png")) { if (file_exists($dir . $HTTP_POST_FILES['userfile']['name'])){ $res = copy($HTTP_POST_FILES['userfile']['tmp_name'], $dir . $HTTP_POST_FILES['userfile']['name']); echo "<b>$realname</b> Ðâds fails jau existç!!!";exit;} $res = copy($HTTP_POST_FILES['userfile']['tmp_name'], $dir . $HTTP_POST_FILES['userfile']['name']); if (!$res){ echo "<b>$realname</b>Failu nav iespçjams aploudot!!! :(<br>";exit;} else{echo "<b>Fails veiksmîgi aploudoc!!!</b><br><br>"; } echo "Faila nosaukums: <b>".$HTTP_POST_FILES['userfile']['name']."</b><br>"; echo "Faila izmçrs: <b>".round($HTTP_POST_FILES['userfile']['size']/1024) ." KB</b><br>"; echo "Faila tips:<b> ".$HTTP_POST_FILES['userfile']['type']."</b><br>"; } else { echo "Neatïauts faila tips<br>"; exit; }} ?> </td> </tr> <tr> <td align="center" width="450" colspan="2"><? echo "<br><b>Direktorijâ $dir ir ðâdi faili:<br><br></b>"; $handle = opendir($dir); while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo "$file<br>"; } } closedir($handle); ?> <br><br><a href="index.php">Atpakaï</a> </td> </tr> </table> </FORM> </body> </html> <?}?> admin/bans.php saturs: <? include("../incl/config.php"); if (($_SERVER['PHP_AUTH_USER']!="Chickenz")||($_SERVER['PHP_AUTH_PW']!="kaka")) { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); echo "<font color=\"red\" face=\"verdana\" size=\"2\">Sorry vecais, tu neesi admins!!!</font>";die;} else{ mysql_connect($hosts,$users,$passw) or die("Neizdevâs piekonektçties datubâzei!"); mysql_select_db($main_db); ?> <html> <head> <title>Banu administrçðana</title> <META http-equiv="Content-Type" content="text/html; charset=windows-1257"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1257"> <LINK href="../style.css" type="text/css" rel="stylesheet"> </head> <body> <div align="center"> <? if (ISSET($_GET['dzest'])){ $dzest = $_GET['dzest']; mysql_query("DELETE FROM bans WHERE ip = '$dzest'") or die ("Dzçst neizdevâs!"); } if (ISSET($_POST['pievienot'])){ $ip_adrese = $_POST['ip_adrese']; $iemesls = $_POST['iemesls']; mysql_query("INSERT INTO bans (ip,reason) VALUES ('$ip_adrese','$iemesls')") or die ("Pievienot neizdevâs!"); } ?> <table width="300" border="0" cellspacing="0" cellpadding="2" class="text"> <form name="forma" method="post" action="<?$PHP_SELF;?>"><tr> <td colspan="2" align="center" bgcolor="#EEEEEE" class="vispar">Banu pievienoðana</td> </tr> <tr> <td width="77">IP adrese:</td> <td width="213"> <input name="ip_adrese" type="text" size="15" maxlength="35" class="input"> </td> </tr> <tr> <td>Iemesls:</td> <td><input name="iemesls" type="text" size="30" maxlength="50" class="input"></td> </tr> <tr align="center"> <td colspan="2"><input type="submit" name="pievienot" value="Pievienot" class="b1"></td> </tr></form> </table><BR> <table width="300" border="0" cellspacing="0" cellpadding="2" class="text"> <tr> <td colspan="3" align="center" bgcolor="#EEEEEE" class="vispar">Banu dzçðana</td> </tr> <? $query = mysql_query("SELECT * FROM bans"); if (mysql_num_rows($query) > 0) { while ($row = mysql_fetch_array($query)) { $ban_ip = $row['ip']; $ban_reason = $row['reason']; echo "<tr><td> ".$ban_ip." </td><td> ".$ban_reason."</td><td><a href='?dzest=".$ban_ip."'>dzçst</a></td></tr>"; } } else {echo "<tr><td colspan='3'>Vçl nav nobanota neviena IP adrese!</td></tr>";} ?> </table> </div> </body> </html> <? } ?> admin/index.php saturs: <? extract($_POST, EXTR_SKIP); include ("../incl/config.php"); if (($_SERVER['PHP_AUTH_USER']!="Chickenz")||($_SERVER['PHP_AUTH_PW']!="kaka")) { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); echo "<font color=\"red\" face=\"verdana\" size=\"2\">Sorry vecais, tu neesi admins!!!</font>";die;} else{ include("config.php"); mysql_connect($hosts,$users,$passw) or die("NAv iespçjams pieslçgties Servukam!!!"); mysql_select_db($main_db) or die("Nav iespçjams pieslçgties DB!!!"); ?> <html> <head> <meta http-equiv="Content-Language" content="lv"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1257"> <LINK href="../style.css" type="text/css" rel="stylesheet"> <title>Administrçðanas sistçma!</title> </head> <body> <? $dirs = "../img/"; $dir = "img/"; if (isset($submit)){ if((!$autors) ||(!$virsraxts)||(!$apraxts)||(!$raxts)||(!$bilde)){echo "aizpildi visus lauciòus! <meta http-equiv=\"refresh\" content=\"2; URL=index.php\">";} else { $raxts = ereg_replace("\n","<br>",$raxts); mysql_query("INSERT INTO `news` (`autors`, `laiks`, `ip`,`virsraksts`,`apraksts`,`raksts`,`bilde`) VALUES ('$autors', '$datums','$ip','$virsraxts','$apraxts','$raxts','$dir$bilde')") or die("Nav iespçjams turpinât procesu jo: " . mysql_error()); echo "Raxts veiksmîgi pievienoc!<meta http-equiv=\"refresh\" content=\"2; URL=../index.php\">"; } } elseif(isset($delete)){ if(!$del){ echo "ieraxti dzçðamâ raxta numuru!"; } else {mysql_query("DELETE FROM `$news_tab` WHERE id=$del"); echo "Raxts veiksmîgi izdzçsts!<meta http-equiv=\"refresh\" content=\"2; URL=../index.php\">";}} else{ echo?> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="800" class="sad_l"> <tr><form method="POST" action="<?$php_self;?>"><td width="500">Autors:</td> <td rowspan="17" width="300" valign="top"> Ðî ir raxtu administrçðanas sistçma kurâ Tu vari pievienot jaunus raxtus ðai mâjas lapai.<br> Instrukcijas:<br>lauciòâ apraksts jâraxta raxta îss apraksts (liidz 400 simbolu ne vairaak!!!), ja vçlamâs bildes nava tad spied uz linka<br><br><br> <table width="300" border="0" cellspacing="5" class="del" bgcolor="#EEEEEE"> <tr><td >Lai izdzçstu kâdu raxtu uzmanîgi apskaties kâds ir ðî raxta kârtas numurs un ieraksti to <b>↓</b> tur... <br><br>Dzçst: <input type="text" class="input2" name="del"> raxtu <input type="submit" value="DzÇsT" class="b1" name="delete"> </td></tr> </table> </td></tr> <tr><td width="500"><input type="text" name="autors" size="20" maxlength="14" class="input"></td></tr> <tr><td width="500"> </td></tr> <tr><td width="500">virsraxts:</td></tr> <tr><td width="500"><input type="text" name="virsraxts" size="20" maxlength="59" class="input"></td></tr> <tr><td width="500"> </td></tr> <tr><td width="500">Apraxts:</td></tr> <tr><td width="500"><textarea rows="4" name="apraxts" cols="20" class="textarea1"></textarea></td></tr> <tr><td width="500"> </td></tr> <tr><td width="500">Pac raxts:</td></tr> <tr><td width="500"><textarea name="raxts" class="textarea2"></textarea></td></tr> <tr><td width="500"> </td></tr> <tr><td width="500">Virsraxta bildes nosaukums:</td></tr> <tr><td width="500"><br><a href="imageupload.php">Ja gribi pievienot jaunu bildi tad spied ðeit...</a> <table width="265" border="0" cellspacing="0" class="text"> <?echo "<br><b>Direktorijâ $dir ir ðâdi faili:<br><br></b>"; $handle = opendir($dirs); while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo " <tr><td width=\"150\"><input type=\"radio\" name=\"bilde\" value=\"$file\"> $file </td> <td width=\"115\"><img src=\"../img/$file\"></tr>";}} closedir($handle);?></table> <table width="300" border="0" cellspacing="5" class="text" bgcolor="#EEEEEE"> <tr><td> </td></tr> <tr><td><input type="submit" value="OK" name="submit" class="b1"></td></tr> </table> </form> <? }mysql_close(); ?> </body> </html> <?}?> mysql datubaazes main sql kods: CREATE TABLE `bans` ( `ip` varchar(255) NOT NULL default '', `reason` varchar(255) default NULL ) CREATE TABLE `news` ( `id` int(11) NOT NULL auto_increment, `autors` varchar(255) NOT NULL default '', `laiks` varchar(255) NOT NULL default '', `ip` varchar(255) NOT NULL default '', `virsraksts` varchar(255) NOT NULL default '0', `apraksts` text NOT NULL, `raksts` text NOT NULL, `bilde` varchar(255) NOT NULL default '', PRIMARY KEY (`id`) ) Link to comment Share on other sites More sharing options...
Chickenz Posted February 15, 2004 Author Report Share Posted February 15, 2004 Briidinu neesu testeejis uz kaadaam citaam sisteemaam vai kompjiem man iet ar register globals = off, mysql 3.23 un php ar kaut kaadu 3-šo!!! Es tur autortiesiibas neliku kaa arii kautkaadus "Shis ir Chickenz skripc..." utt. jo tos taapat visi likvidee... PRIECAAJIETIES... :D Link to comment Share on other sites More sharing options...
Gacha Posted February 15, 2004 Report Share Posted February 15, 2004 Es nupat saaku veidot savu miniforuminju. Bet man problemas ar linku veidoshanu. Nezinu isti ka straadaa, lai buutu [1] [2] [3] utt Link to comment Share on other sites More sharing options...
Kaklz Posted February 15, 2004 Report Share Posted February 15, 2004 Briidinu neesu testeejis uz kaadaam citaam sisteemaam vai kompjiem man iet ar register globals = off, mysql 3.23 un php ar kaut kaadu 3-šo!!!Es tur autortiesiibas neliku kaa arii kautkaadus "Shis ir Chickenz skripc..." utt. jo tos taapat visi likvidee... PRIECAAJIETIES... :D varēji jau nu cieņas pēc salikt visu normālā zip failā un uzlikt downloadam. Link to comment Share on other sites More sharing options...
AntiXakep Posted February 18, 2004 Report Share Posted February 18, 2004 japalur ! Link to comment Share on other sites More sharing options...
рпр Posted February 18, 2004 Report Share Posted February 18, 2004 nevajag aizmirst, ka ir taada lieta kaa http://paste.php.lv/ Link to comment Share on other sites More sharing options...
AntiXakep Posted February 19, 2004 Report Share Posted February 19, 2004 aha loti gruti kodu ierubit! :blink: Link to comment Share on other sites More sharing options...
sviesc Posted February 19, 2004 Report Share Posted February 19, 2004 nākam reiz kad raxti kodus pārbaudi kas i kur vis ko vajag moš pāraxi savu kodu mysql_connect($hosts, $users, $passw) or die('Nevar piesleegties servuxam!');mysql_select_db("main") or die('Nevar piesleegties db!'); kas tas main i domāc ban vai news tabula neviens nevar īsti saprast Link to comment Share on other sites More sharing options...
lame Posted February 19, 2004 Report Share Posted February 19, 2004 BTW uzbrauciens ne pa teemu :) Shajaa gadiijumaa main ir datubaazes nosaukums... Ja gribi zinaat tabulas nosaukumu, tad skaties SELECT'us nākam reiz kad raxti kodus pārbaudi kas i kur vis ko vajag moš pāraxi savu kodu mysql_connect($hosts, $users, $passw) or die('Nevar piesleegties servuxam!');mysql_select_db("main") or die('Nevar piesleegties db!'); kas tas main i domāc ban vai news tabula neviens nevar īsti saprast Link to comment Share on other sites More sharing options...
Chickenz Posted February 21, 2004 Author Report Share Posted February 21, 2004 Nu isakiet domas par scriptu - ir normāls? ;) Link to comment Share on other sites More sharing options...
AntiXakep Posted February 22, 2004 Report Share Posted February 22, 2004 nesu testejis! butu labi ja tu kodu iemestu paste.php.lv Link to comment Share on other sites More sharing options...
Chickenz Posted March 6, 2004 Author Report Share Posted March 6, 2004 paste.lv smird jo tur veel peec tam ir jaaattiira no suuda rindu numeraacijas... Link to comment Share on other sites More sharing options...
Recommended Posts