Pupe64etoo_92
Registered
Системата е на сесий.
Състои се от: 11файла и две папки.
1. ad_rotator.php - Toзи файл ще ви изкарва банерите които сте качили от админ панела.
2. admin.inc.php - В този файл си пишете името и паролата с които ще влизате в админ панела.
3. index.php - Този файл е формата за вход в админ панела.
4. admin.php - Това ви е админ панела.
5. demo.php - Тук можете да видите как ще изглеждат банерите в сайта ви горе, долу, в ляво и дясно.
6. logout.php - Това е файла за изход от системата.
7. redir.php - Файла който търси директорийте за ъплоада тоест двете папки, пътя до тях
8. session.php - Контролния файл който управлява сесията.
9. swf_view.php - Този файл е за гледане на swf файлове тоест клипове ако сте качили като реклама.
10. style.css - Няма нужда да обяснявам.
11. htaccess - Това е файл които премахва ограничението за големината на файла които качвате.
Така и последните два фаила те са папки.
1. /img/
2. /img_settings/
Тези две папки трябва да са с права [csmod] 777.
И така да започваме със кода.
htaccess
ad_rotator.php
admin.inc.php
admin.php
demo
index.php
logout.php
redir.php
session.php
swf_view.php
style.css
Това бяха файловете на системата сега остава и демо да ви дам.
Демото ви на админ панела
Ето ви и демо на аd_rotator.php изглед на банерите само рефлешвате и те се сменят.
http://cs-xipnozademos.net84.net/baner/ad_rotator.php
Демотo за изглед на банерите
Ето ви линк да свалите системата.
Свали системата
Име: demonstraciq
Парола: demonstraciq
Състои се от: 11файла и две папки.
1. ad_rotator.php - Toзи файл ще ви изкарва банерите които сте качили от админ панела.
2. admin.inc.php - В този файл си пишете името и паролата с които ще влизате в админ панела.
3. index.php - Този файл е формата за вход в админ панела.
4. admin.php - Това ви е админ панела.
5. demo.php - Тук можете да видите как ще изглеждат банерите в сайта ви горе, долу, в ляво и дясно.
6. logout.php - Това е файла за изход от системата.
7. redir.php - Файла който търси директорийте за ъплоада тоест двете папки, пътя до тях
8. session.php - Контролния файл който управлява сесията.
9. swf_view.php - Този файл е за гледане на swf файлове тоест клипове ако сте качили като реклама.
10. style.css - Няма нужда да обяснявам.
11. htaccess - Това е файл които премахва ограничението за големината на файла които качвате.
Така и последните два фаила те са папки.
1. /img/
2. /img_settings/
Тези две папки трябва да са с права [csmod] 777.
И така да започваме със кода.
htaccess
Код:
<Files demo.inc.php>
order allow,deny
deny from all
</Files>
<Files admin.inc.php>
order allow,deny
deny from all
</Files>
ad_rotator.php
Код:
<?php
error_reporting (0);
// Get output mode
if ( is_file ( "img_settings/mode.inc" ) )
extract ( parse_ini_file ( "img_settings/mode.inc" ) );
else $mode = 0;
//
function make_seed() {
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((float) $usec * 100000);
}
srand(make_seed());
$randval = rand();
////////////////////////////////
$handle = opendir("./img");
$img_list=array();
while ($file = readdir($handle)) {
if ($file != "." && $file != "..") {
$filetype = explode ( '.', $file );
$filetype = strtolower ( $filetype[1] );
if ( $filetype == 'gif' || $filetype == 'jpg' || $filetype == 'jpeg' || $filetype == 'png' ||
$filetype == 'htm' || $filetype == 'html' || $filetype == 'txt' || $filetype == 'swf') {
$filename = basename ( $file );
$set = parse_ini_file ( "img_settings/" . $filename . ".set" );
if ( $set['enabled'] == 1 || isset ( $_GET['item'] ) ) {
$img_list[] = array ('name'=>"img/$file",'set'=>$set);
}
}
}
}
closedir ($handle);
if ( !empty ( $img_list ) ) {
if ( $mode == 0 ) { // Random mode
$i=sizeof($img_list);
$item=$randval % $i;
}
else { // Consistence mode
if ( is_file ( "img_settings/last.inc" ) )
extract ( parse_ini_file ( "img_settings/last.inc" ) );
else $item = -1;
$item = trim ($item);
if ( isset ( $img_list[$item+1] ) )
$item++;
else $item = 0;
}
// Directly exec
if ( isset ( $_GET['item'] ) )
$item = $_GET['item'];
$unique = uniqid(rand());
$image = $img_list[$item]['name'];
$show = $image . "?" . $unique;
extract ( $img_list[$item]['set'] );
$filename = basename ( $image );
$filetype = explode ( '.', $filename );
$filetype = strtolower ( $filetype[1] );
switch ( $filetype ) {
case "gif":
case "jpg":
case "jpeg":
case "png":
if ( !empty ( $ahref ))
echo "<a href='$ahref'>";
$output = "<img border='0' src='$show'";
if (!empty ( $width ))
$output .= " width='$width'";
if (!empty ( $height ))
$output .= " height='$height'";
if (!empty ( $alt ))
$output .= " alt='$alt'";
$output .= ">";
echo $output;
if ( !empty ( $ahref ))
echo "</a>";
break;
case "htm":
case "html":
case "txt":
include_once ("$image");break;
case "swf":
if ( empty ( $width ) )
$width="30%";
if ( empty ( $height ) )
$height="30%";
include_once ("swf_view.php");break;
}
// Write last file
$file = fopen ( "img_settings/last.inc", "w");
$succ = fwrite ( $file, "item=" . $item . "\n" );
@chmod ( "img_settings/last.inc", 0777 );
fclose( $file );
}
//exit;
?>
admin.inc.php
Код:
login=Потребителско име!!
pass=Парола!!
admin.php
Код:
<?php
error_reporting (0);
include_once ('redir.php');
include_once ('session.php');
session_start();
$auth = $_SESSION['auth'];
if( !$auth )
{
session_destroy();
Redirect('./');
}
define ('SUCCESS', true);
define ('ERROR', false);
function imgSettings ( $filename, $set_array = array() ) {
extract ( $set_array );
if ( !isset( $ahref ) )
$ahref = "";
if ( !isset( $width ) )
$width = "";
if ( !isset( $height ) )
$height = "";
if ( !isset( $alt ) )
$alt = "";
if ( !isset( $enabled ) )
$enabled = "0";
$filetype = explode ( '.', $filename );
$filetype = strtolower ( $filetype[1] );
$settings = "";
switch ( $filetype ) {
case "gif":
case "jpg":
case "jpeg":
case "png": $settings .= "enabled=$enabled\nahref=\"".htmlentities(stripslashes($ahref),ENT_QUOTES)."\"\nwidth=$width\nheight=$height\nalt=\"".htmlentities(stripslashes($alt),ENT_QUOTES)."\"\n"; break;
case "swf": $settings .= "enabled=$enabled\nwidth=$width\nheight=$height\n"; break;
}
if ( !$_SESSION['demo'] ) {
$file = fopen ( "img_settings/" . $filename . ".set", "w" );
$succ = fwrite ( $file, $settings );
chmod ( "img_settings/" . $filename . ".set", 0777 );
fclose( $file );
}
}
function Log0( $text, $type )
{
global $log;
$logentry['text'] = $text;
$logentry['type'] = $type;
$log[] = $logentry;
}
if( $_SERVER['REQUEST_METHOD'] == 'POST' && !$_SESSION['demo'] )
{
$form = $HTTP_POST_VARS['submit'];
if( $form == 'Качи' )
foreach( $HTTP_POST_FILES as $file )
{
$filename = $file['name'];
$location = $file['tmp_name'];
$target = 'img/' . $filename;
if( file_exists( $target ) )
Log0("Файла $filename вече съществува.", ERROR );
else
{
$rc = move_uploaded_file( $location, $target );
if( $rc ) {
Log0("Файла $filename беше качен успешно.", SUCCESS );
imgSettings ( $filename );
}
else
Log0("Не съществува директорията за ъплоад на файла или не е зададен csmod на 777.", ERROR );
}
}
elseif( $form == 'Изтрий' )
{
foreach( $HTTP_POST_VARS as $name => $value )
{
if( $name == "submit" )
continue;
if( is_array ( $value ) )
continue;
$target = 'img/' . $value;
if( !file_exists( $target ) )
{
Log0("Неможете да изтриете $value. Файлът не съществува..", ERROR);
continue;
}
$rc = @unlink( $target );
if( $rc )
Log0("Файла $value е изтрит успешно.", SUCCESS);
else
Log0("Неможе да изтриете $value. Поради неуточнена грешка.", ERROR);
if ( file_exists( "img_settings/" . $value . ".set" ) )
@unlink( "img_settings/" . $value . ".set" );
}
}
elseif( $form == 'Редактирай' ) {
if ( isset ( $HTTP_POST_VARS['edit'] ) ) {
foreach( $HTTP_POST_VARS['edit'] as $name => $value )
{
imgSettings ( $name, $value );
}
}
if ( isset ( $HTTP_POST_VARS['text'] ) ) {
foreach( $HTTP_POST_VARS['text'] as $name => $value )
{
$value['text'] = stripslashes ( $value['text'] );
$file = fopen ( "img/" . $name, "wb" );
fwrite ( $file, $value['text'] );
fclose ( $file );
}
}
Log0("Редактирането е Успешно.", SUCCESS);
}
// Промяна на режим
if ( isset ( $_POST['output'] ) ) {
$output_mode = $_POST['mode'];
$file = fopen ( "img_settings/mode.inc", "w" );
fwrite ( $file, "mode=$output_mode\n" );
fclose ( $file );
}
}
$handle = opendir("./img");
$img_list=array();
while ($file = readdir($handle)) {
if ($file != "." && $file != "..") {
array_push($img_list,"$file");
}
}
closedir ($handle);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Банер Ротация Контрол Панел</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=windows-1251">
<LINK rel="stylesheet" type="text/css" href="banera/style.css">
</HEAD>
<BODY bgcolor="#FFFFFF" text="#000000" link="#000000" vlink="#000000" alink="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" bgcolor="#30608F" cellpadding="5" cellspacing="5">
<tr>
<td><font class="chapter2">Банер Ротация Контрол Панел</font></td>
<td align="center"><a href="logout.php" class="logout">Излез от Контрол Панела</a></td>
</tr>
</table>
<table width="100%" height="30" border="0" cellpadding="5" cellspacing="5">
<tr>
<td>
<?php
if( count ( $log ) > 0 )
{
print "<ul>\n";
foreach( $log as $logentry )
{
$text = $logentry['text'];
switch( $logentry['type'] )
{
case SUCCESS:
print "<li><div align='center'><font color=green>$text</font></div></li>\n";
break;
case ERROR:
print "<li><div align='center'><font color=red>$text</font></div></li>\n";
break;
}
}
print "</ul><hr>\n";
}
if ( is_file ( "img_settings/mode.inc" ) )
extract ( parse_ini_file ( "img_settings/mode.inc" ) );
else $mode = 0;
switch ( $mode ) {
case "0": $sel0="selected";$sel1="";break;
case "1": $sel1="selected";$sel0="";break;
}
?>
<font class="chapter3">Kaчване на Банери!!</font>
<hr width="100%" size="1" noshade color="#84A7CE">
<form action="" method="post" enctype="multipart/form-data" name="form1">
<p>Качи Банер:
<input type="file" name="file">
<input name="submit" type="submit" id="submit" value="Качи">
</p>
</form>
Позволени формати за качване <font color="#FF0000">.gif, .jpg, .jpeg, .png, .swf</font>
<hr width="100%" size="1" noshade color="#84A7CE">
<font class="chapter3">Kaк да ви се показват Банерите!!</font>
<hr width="100%" size="1" noshade color="#84A7CE">
<form name="form3" method="post" action="">
<p>Изберете от формата:
<select name="mode">
<option value="0" <?php echo $sel0;?>>Произволно</option>
<option value="1" <?php echo $sel1;?>>В съответствие</option>
</select>
<input type="submit" name="output" value="Давай">
</p>
</form>
<hr width="100%" size="1" noshade color="#84A7CE">
<font class="chapter3">Настроика на вече качените банри!!</font>
<hr width="100%" size="1" noshade color="#84A7CE">
<p><font color="#CC0000"><strong>Изтрий</strong></font>
- За да изтриете изображението сложете отметка в квадратчето пред името на изображението и натиснете [Изтрий].
<br>
<font color="#006699"><strong>On/Off</strong></font>
- Функцията On/Off за да включите банера да се показва сложете отметка в квадратчето ако не искате банера да се покаже оставете кавадратчeто празно и натиснете [Редактирай].
Ако искате да редактирате височината ширината и описанието. След като ги редактирате натиснете пак [Редактирай].
<hr width="100%" size="1" noshade color="#84A7CE">
<form name="form2" method="post" action="">
<table border="0">
<tr><td><font color="#CC0000"><strong>Изтрий</strong></font></td><td></td><td><font color="#006699"><strong>On/Off</strong></font></td><td></td></tr>
<?php
$format = "<tr><td><input type=\"checkbox\" name=\"%s\" value=\"%s\"></td><td><a href=\"ad_rotator.php?item=%s\" target=\"_blank\"><b>%s</b></a></td>";
foreach( $img_list as $key=>$image ) {
$filename = basename ( $image );
extract ( parse_ini_file ( "img_settings/" . $filename . ".set" ) );
printf( $format, $image, $image, $key, $image );
$filetype = explode ( '.', $filename );
$filetype = strtolower ( $filetype[1] );
switch ( $filetype ) {
case "gif":
case "jpg":
case "jpeg":
case "png": if ( $enabled == 1 )
$checked = "checked";
else $checked = "";
print ("<td><input type='checkbox' name='edit[$filename][enabled]' value='1' $checked></td><td></td>");
print ("<td>Ширина:</td><td><input type='text' name='edit[$filename][width]' value='$width' size='4'></td>");
print ("<td>Височина:</td><td><input type='text' name='edit[$filename][height]' value='$height' size='4'></td>");
print ("<td>Линк:</td><td><input type='text' name='edit[$filename][ahref]' value='$ahref'></td>");
print ("<td>Описание:</td><td><input type='text' name='edit[$filename][alt]' value='$alt'></td>");
break;
case "htm":
case "html":
case "txt": if ( $enabled == 1 )
$checked = "checked";
else $checked = "";
print ("<td><input type='checkbox' name='edit[$filename][enabled]' value='1' $checked><td>enabled,</td></td>");
$file = fopen ( "img/" . $image, "r" );
$text = fread ( $file, filesize ( "img/" . $image ) );
fclose ( $file );
print ("<td>text=</td><td colspan='7'><textarea name='text[$filename][text]' cols='65' rows='3'>$text</textarea></td>");
print ("<input type='hidden' name='edit[$filename][hidden]' value=''>");
break;
case "swf": if ( $enabled == 1 )
$checked = "checked";
else $checked = "";
print ("<td><input type='checkbox' name='edit[$filename][enabled]' value='1' $checked></td><td>enabled,</td>");
print ("<td>width=</td><td><input type='text' name='edit[$filename][width]' value='$width' size='4'>,</td>");
print ("<td>height=</td><td><input type='text' name='edit[$filename][height]' value='$height' size='4'></td>");
break;
}
echo "</td></tr>";
}
if( count( $img_list ) == 0 )
print "<b>-- No files --</b>\n";
?>
<tr><td colspan="2"><br><br><input type="submit" name="submit" value="Изтрий"></td><td colspan="2">
<br><br><input type="submit" name="submit" value="Редактирай"></td></tr>
</table>
</form>
</td>
</tr>
</table>
<hr width="100%" size="1" noshade color="#84A7CE">
<div align="center">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td align="center"><a href="http://cs-xipnoza.info" class="copyright"><font color="#FF0000" size="2">© 2010 Автор Pupe64etoo_92. Всички права Запазени. </font></a></td>
</tr>
</table>
</div>
<hr width="100%" size="1" noshade color="#999999">
demo
Код:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Банер Ротация Демо как ще ви изглежда в сайта</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<style type="text/css">
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#000000" vlink="#000000" alink="#000000" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0">
<table width="780" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<br><br>
<?php
include_once("ad_rotator.php");
?>
</td>
</tr>
</table>
<br>
<table width="780" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="140" align="center">
<p> </p>
<p> </p>
Лява колона в сайт
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</td>
<td width="500" align="center">
<p> </p>
<p> </p>
Централна колона в сайта
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</td>
<td width="140" align="center">
<p> </p>
<p> </p>
<br>
Дясна колона в сайт
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</td>
</tr>
</table>
</body>
</html>
index.php
Код:
<?php
error_reporting(0);
include_once ('session.php');
include_once ('redir.php');
session_start();
$auth = $_SESSION['auth'];
if( $auth )
Redirect('admin.php');
// Admin and guest data
if ( is_file ( "admin.inc.php" ) ) {
$admin_data = parse_ini_file("admin.inc.php");
}
else $admin_data = array ('login'=>'', 'pass'=>'');
if ( is_file ( "demo.inc.php" ) ) {
$demo_data = parse_ini_file("demo.inc.php");
}
else $demo_data = array ('allow'=>'', 'login'=>'', 'pass'=>'');
//
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{
$login = trim( $_POST['login'] );
$password = trim( $_POST['password'] );
if( $login != '' && $password != '' )
{
if( ( $login == $admin_data['login'] && $password == $admin_data['pass'] ) )
{
$_SESSION['auth'] = true;
$_SESSION['demo'] = "";
$auth = true;
Redirect('admin.php');
}
else
if( $demo_data['allow'] && $login == $demo_data['login'] && $password == $demo_data['pass'] )
{
$_SESSION['auth'] = true;
$_SESSION['demo'] = $demo_data['allow'];
$auth = true;
Redirect('admin.php');
}
else
$errmsg = 'Не сте попълнили полетата коректно.';
}
else
$errmsg = 'Добре дошли в Админ Панела.';
}
session_destroy();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Админ Панел Банер Ротация</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=windows-1251">
<META name="keywords" content="<%tv keywords%>">
<LINK rel="stylesheet" type="text/css" href="style.css">
<BODY bgcolor="#BBD1E8" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0">
<p> </p>
<form name="exc_upload" method="post" action="" enctype="multipart/form-data">
<table width="400" border="0" align="center" cellpadding="5" cellspacing="0" bgcolor="#97BADD">
<tr>
<td colspan="2" align="left" bgcolor="#3D79B6"><font color="#000000" class="chapter"><div align="center">Банер Ротатор</div></font>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<?
if( isset( $errmsg ) )
print "<div align=\"center\"><font color=\"#FFFFFF\"><b>$errmsg</b></font></div>";
?>
</td>
</tr>
<tr>
<td width="50%" align="center"><div align="right">Потребител:</div></td>
<td width="50%" align="center"><div align="left">
<input type="text" name="login" value="demo"></div></td>
</tr>
<tr>
<td align="center"><div align="right">Парола:</div></td>
<td align="center"><div align="left">
<input type="password" name="password" value="demo">
</div></td>
</tr>
<tr>
<td align="center"> </td>
<td align="center"><div align="left">
<input type="submit" name="Submit" value="Влез"><br><br>
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
logout.php
Код:
<?php
include_once ('session.php');
include_once ('redir.php');
session_start();
$_SESSION['demo'] = "";
$_SESSION['auth'] = "";
Redirect('./');
?>
redir.php
Код:
<?php
function Redirect( $script )
{
global $db, $HTTP_SERVER_VARS, $REQUEST_URI;
$host = $HTTP_SERVER_VARS['HTTP_HOST'];
$dir = dirname( $HTTP_SERVER_VARS['PHP_SELF'] );
header("Location: http://".$host.$dir.'/'.$script);
exit;
}
?>
session.php
Код:
<?php
function open ($save_path, $session_name) {
global $sess_save_path, $sess_session_name;
$sess_save_path = $save_path;
$sess_session_name = $session_name;
return(true);
}
function close() {
return(true);
}
function read ($id) {
global $sess_save_path, $sess_session_name;
$sess_file = "$sess_save_path/sess_$id";
if ($fp = @fopen($sess_file, "r")) {
$sess_data = fread($fp, filesize($sess_file));
fclose($fp);
return($sess_data);
} else {
return("");
}
}
function write ($id, $sess_data) {
global $sess_save_path, $sess_session_name;
$sess_file = "$sess_save_path/sess_$id";
if ($fp = @fopen($sess_file, "w")) {
$rc = fwrite($fp, $sess_data);
fclose($fp);
return($rc);
} else {
return(false);
}
}
function destroy ($id) {
global $sess_save_path, $sess_session_name;
$sess_file = "$sess_save_path/sess_$id";
return(@unlink($sess_file));
}
function gc ($maxlifetime) {
return true;
}
session_set_save_handler ("open", "close", "read", "write", "destroy", "gc");
?>
swf_view.php
Код:
<?php
echo <<<SWF
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="$width" height="$height">
<param name="movie" value="$image">
<param name="quality" value="high">
<embed src="$image" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="$width" height="$height"></embed>
</object>
SWF;
?>
style.css
Код:
BODY, TD {
font-family : Verdana, Tahoma, sans-serif;
font-size: 12px;
color: #000000;
}
/*****************/
a.copyright {
font-family : Verdana, Tahoma, sans-serif;
font-size: 10px;
color: #999999;
text-decoration: none;
}
a.copyright:hover {
text-decoration: underline;
}
a.logout {
font-family : Verdana, Tahoma, sans-serif;
font-size: 11px;
color: #FFFFFF;
font-weight: bold;
text-decoration: none;
}
a.logout:hover {
text-decoration: underline;
}
/*****************/
.chapter {
color: #ffffff;
font-size: 18px;
font-family : Verdana, Tahoma, sans-serif;
font-weight: normal;
}
.chapter2 {
color: #ffffff;
font-size: 22px;
font-family : Verdana, Tahoma, sans-serif;
font-weight: bold;
}
.chapter3 {
color: #000000;
font-size: 17px;
font-family : Verdana, Tahoma, sans-serif;
font-weight: bold;
}
/*****************/
.bg1 {
background-color=#ffffff;
}
.bg2 {
background-color=#f1f1f1;
}
Това бяха файловете на системата сега остава и демо да ви дам.
Демото ви на админ панела
Ето ви и демо на аd_rotator.php изглед на банерите само рефлешвате и те се сменят.
http://cs-xipnozademos.net84.net/baner/ad_rotator.php
Демотo за изглед на банерите
Ето ви линк да свалите системата.
Свали системата
Име: demonstraciq
Парола: demonstraciq