Центриране на картинка

  • Автор Автор Gonke
  • Начална дата Начална дата

Gonke

Registered
Значи взех системата за новини на staf.Редактирах я до някъде но дойде проблем.
hz7i5xr887pg2682rl0xixrsqk9wa7mdtd4rai73.jpg

Картинката където е колата на нея искам да иде на средата ама аз немога да я направя. :cry: Ако някой може давам +1.
Това е save.php
Код:
<?php
umask(0);
//variables
if ( isset($_POST['ime'])  AND isset($_POST['poqsnenie']) AND isset($_POST['kartinka']) AND isset($_POST['text']) ) {
 $user = $_POST['ime'];

 $http = $_POST['poqsnenie'];
 $town = $_POST['kartinka'];
 $msg = $_POST['text'];


 
 if (( $user != "" ) AND ( $msg != "" )) {
  include "db.php";
$ip = $_SERVER['REMOTE_ADDR'];
$http=str_replace("<",'<',$http); 
$http=str_replace(">",'>',$http);
$town=str_replace("<",'<',$town); 
$town=str_replace(">",'>',$town);
$user=str_replace("<",'<',$user); 
$user=str_replace(">",'>',$user);
$mail=str_replace("<",'<',$mail); 
$mail=str_replace(">",'>',$mail); 
$msg=str_replace("<",'<',$msg); 
$msg=str_replace(">",'&gt',$msg); 
$msg=preg_replace("/(\[b\])(.+?)(\[\/b\])/i", "<b>\\2</b>", $msg);
$msg=preg_replace("/(\[i\])(.+?)(\[\/i\])/i", "<i>\\2</i>", $msg);
$msg=preg_replace("/(\[u\])(.+?)(\[\/u\])/i", "<u>\\2</u>", $msg);
$msg=preg_replace("/(\[email=(.+?)\])(.+?)(\[\/email\])/i", '<a href="mailto:\\2" target="_blank">\\3</a>',$msg);
$msg=preg_replace("/(\[email\])(.+?)(\[\/email\])/i", '<a href="mailto:\\2">\\2</a>', $msg);
$msg=preg_replace("/(\[url\])(.+?)(\[\/url\])/i", '<a href="\\2" target="_blank">\\2</a>', $msg);
$msg=preg_replace("/(\[url=\])(.+?)(\[\/url\])/i", '<a href="\\2" target="_blank">\\2</a>', $msg);
$msg=preg_replace("/(\[url=(.+?)\])(.+?)(\[\/url\])/i", '<a href="\\2" target="_blank">\\3</a>', $msg);
$msg=str_replace(":biggrin:",'<img src="smilies/biggrin.gif" alt="img">',$msg);
$msg=str_replace(":cool:",'<img src="smilies/cool.gif" alt="img">',$msg);
$msg=str_replace(":cry:",'<img src="smilies/cry.gif" alt="img">',$msg);
$msg=str_replace(":dead:",'<img src="smilies/dead.gif" alt="img">',$msg);
$msg=str_replace(":eek:",'<img src="smilies/eek.gif" alt="img">',$msg);
$msg=str_replace(":embarrassed:",'<img src="smilies/embarrassed.gif" alt="img">',$msg);
$msg=str_replace(":laugh:",'<img src="smilies/laugh.gif" alt="img">',$msg);
$msg=str_replace(":love:",'<img src="smilies/love.gif" alt="img">',$msg);
$msg=str_replace(":mad:",'<img src="smilies/mad.gif" alt="img">',$msg);
$msg=str_replace(":no:",'<img src="smilies/no.gif" alt="img">',$msg);
$msg=str_replace(":none:",'<img src="smilies/none.gif" alt="img">',$msg);
$msg=str_replace(":rolleyes:",'<img src="smilies/rolleyes.gif" alt="img">',$msg);
$msg=str_replace(":sad:",'<img src="smilies/sad.gif" alt="img">',$msg);
$msg=str_replace(":smile:",'<img src="smilies/smile.gif">',$msg);
$msg=str_replace(":smilewinkgrin:",'<img src="smilies/smilewinkgrin.gif" alt="img">',$msg);
$msg=str_replace(":upset:",'<img src="smilies/upset.gif" alt="img">',$msg);
$msg=str_replace(":wink:",'<img src="smilies/wink.gif" alt="img">',$msg);
$msg=str_replace(":yes:",'<img src="smilies/yes.gif" alt="img">',$msg);




  $write1 = " 
<table class=\"border\" cellpadding=\"1\" cellspacing=\"1\" width=\"100%\">
 <tr>
  <td class=\"a\" align=\"left\">
    <table>
     <tr>
      <td width=\"71%\" class=\"b\">
       <b>"; 
  //ime = name
$write2 = "
       </b>
      </td>
     </tr>
    </table>
  </td>
 </tr>
 <tr>
  <td>
   <table>
    <tr>
	 <td>
	  <div align=\center\><img src=\"";
  //ime = http
$write4 = "\" </img></div><br>

	 </td>
	 <td class=\"b\">
	  
	  
	   
	 </td>
	</tr>
   </table><center>"; 
  //ime = comment 
 $write6 ="</center>
  </td>
 </tr>
 <tr>
  <td class=\"a\" height=\"6\" width=\"100%\">
  </td>
 </tr>
</table>";


$ip = $_SERVER['REMOTE_ADDR'];
  umask(0);

  $fp = fopen("posts/".$broi.".html", "w");

  fwrite($fp, "$write1");
  fwrite($fp, "$user");
  fwrite($fp, "$write2");
  fwrite($fp, "$town");

  fwrite($fp, "$write4");
  fwrite($fp, "$http");
  fwrite($fp, "$write5");
  fwrite($fp, "$msg");
  fwrite($fp, "$write6");
  fclose($fp);

  umask(0);
  $broi++;
  $fp2 = fopen("db.php", "w");
  $writedb = '<?php $broi='.$broi." ; ?>";
  fwrite($fp2, "$writedb");
  fclose($fp2);
  $message = "Áëàãîäàðèì Âè çà ìíåíèåòî!";
 } else {
 $message = "Íå ñòå âúâåëè èíôîðìàöèÿ!"; 
 }
} else {
$message = "Ãðåøåí ëèíê!";
}
?>


</font>
<html>
<head>
<title></title>
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=index.php">
</head>
<body>


</body>
</html>
 
2SHAE каза:
Изтрии center навсякъде където го пише
Код:
<?php
umask(0);
//variables
if ( isset($_POST['ime'])  AND isset($_POST['poqsnenie']) AND isset($_POST['kartinka']) AND isset($_POST['text']) ) {
 $user = $_POST['ime'];

 $http = $_POST['poqsnenie'];
 $town = $_POST['kartinka'];
 $msg = $_POST['text'];


 
 if (( $user != "" ) AND ( $msg != "" )) {
  include "db.php";
$ip = $_SERVER['REMOTE_ADDR'];
$http=str_replace("<",'<',$http); 
$http=str_replace(">",'>',$http);
$town=str_replace("<",'<',$town); 
$town=str_replace(">",'>',$town);
$user=str_replace("<",'<',$user); 
$user=str_replace(">",'>',$user);
$mail=str_replace("<",'<',$mail); 
$mail=str_replace(">",'>',$mail); 
$msg=str_replace("<",'<',$msg); 
$msg=str_replace(">",'&gt',$msg); 
$msg=preg_replace("/(\[b\])(.+?)(\[\/b\])/i", "<b>\\2</b>", $msg);
$msg=preg_replace("/(\[i\])(.+?)(\[\/i\])/i", "<i>\\2</i>", $msg);
$msg=preg_replace("/(\[u\])(.+?)(\[\/u\])/i", "<u>\\2</u>", $msg);
$msg=preg_replace("/(\[email=(.+?)\])(.+?)(\[\/email\])/i", '<a href="mailto:\\2" target="_blank">\\3</a>',$msg);
$msg=preg_replace("/(\[email\])(.+?)(\[\/email\])/i", '<a href="mailto:\\2">\\2</a>', $msg);
$msg=preg_replace("/(\[url\])(.+?)(\[\/url\])/i", '<a href="\\2" target="_blank">\\2</a>', $msg);
$msg=preg_replace("/(\[url=\])(.+?)(\[\/url\])/i", '<a href="\\2" target="_blank">\\2</a>', $msg);
$msg=preg_replace("/(\[url=(.+?)\])(.+?)(\[\/url\])/i", '<a href="\\2" target="_blank">\\3</a>', $msg);
$msg=str_replace(":biggrin:",'<img src="smilies/biggrin.gif" alt="img">',$msg);
$msg=str_replace(":cool:",'<img src="smilies/cool.gif" alt="img">',$msg);
$msg=str_replace(":cry:",'<img src="smilies/cry.gif" alt="img">',$msg);
$msg=str_replace(":dead:",'<img src="smilies/dead.gif" alt="img">',$msg);
$msg=str_replace(":eek:",'<img src="smilies/eek.gif" alt="img">',$msg);
$msg=str_replace(":embarrassed:",'<img src="smilies/embarrassed.gif" alt="img">',$msg);
$msg=str_replace(":laugh:",'<img src="smilies/laugh.gif" alt="img">',$msg);
$msg=str_replace(":love:",'<img src="smilies/love.gif" alt="img">',$msg);
$msg=str_replace(":mad:",'<img src="smilies/mad.gif" alt="img">',$msg);
$msg=str_replace(":no:",'<img src="smilies/no.gif" alt="img">',$msg);
$msg=str_replace(":none:",'<img src="smilies/none.gif" alt="img">',$msg);
$msg=str_replace(":rolleyes:",'<img src="smilies/rolleyes.gif" alt="img">',$msg);
$msg=str_replace(":sad:",'<img src="smilies/sad.gif" alt="img">',$msg);
$msg=str_replace(":smile:",'<img src="smilies/smile.gif">',$msg);
$msg=str_replace(":smilewinkgrin:",'<img src="smilies/smilewinkgrin.gif" alt="img">',$msg);
$msg=str_replace(":upset:",'<img src="smilies/upset.gif" alt="img">',$msg);
$msg=str_replace(":wink:",'<img src="smilies/wink.gif" alt="img">',$msg);
$msg=str_replace(":yes:",'<img src="smilies/yes.gif" alt="img">',$msg);




  $write1 = " 
<table class="border" cellpadding="1" cellspacing="1" width="100%">
 <tr>
  <td class="a" align="left">
    <table>
     <tr>
      <td width="71%" class="b">
       <b>"; 
  //ime = name
$write2 = "
       </b>
      </td>
     </tr>
    </table>
  </td>
 </tr>
 <tr>
  <td>
   <table>
    <tr>
	 <td>
	  <img src="";
  //ime = http
$write4 = "" </img><br>

	 </td>
	 <td class="b">
	  
	  
	   
	 </td>
	</tr>
   </table>"; 
  //ime = comment 
 $write6 ="
  </td>
 </tr>
 <tr>
  <td class="a" height="6" width="100%">
  </td>
 </tr>
</table>";


$ip = $_SERVER['REMOTE_ADDR'];
  umask(0);

  $fp = fopen("posts/".$broi.".html", "w");

  fwrite($fp, "$write1");
  fwrite($fp, "$user");
  fwrite($fp, "$write2");
  fwrite($fp, "$town");

  fwrite($fp, "$write4");
  fwrite($fp, "$http");
  fwrite($fp, "$write5");
  fwrite($fp, "$msg");
  fwrite($fp, "$write6");
  fclose($fp);

  umask(0);
  $broi++;
  $fp2 = fopen("db.php", "w");
  $writedb = '<?php $broi='.$broi." ; ?>";
  fwrite($fp2, "$writedb");
  fclose($fp2);
  $message = "Áëàãîäàðèì Âè çà ìíåíèåòî!";
 } else {
 $message = "Íå ñòå âúâåëè èíôîðìàöèÿ!"; 
 }
} else {
$message = "Ãðåøåí ëèíê!";
}
?>


</font>
<html>
<head>
<title></title>
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=index.php">
</head>
<body>


</body>
</html>
 
index.php
Код:
<?php
for ($i=$broi; $i>$broi-11;$i--){
 if (is_file("posts/".$i.".html")) {
 include "posts/".$i.".html";
 echo "<center></center><br />";
 
 }
}
?>
style.css
Код:
/* Css document by Svein Erik Storkaas - CssTemplatesWeb.com | 2008 */

* {
 padding: 0;
 margin: 0;
}
body {
 font-family: Arial, Helvetica, sans-serif;
 color: #666666;
 font-size: 12px;
 background-image:url(images/bg-tile.gif);
 background-repeat:repeat;
}
#wrapper {
 width: 782px;
 margin: 0 auto;
}
#border {
 border: 1px  #FE7B00;
 margin: 20px 0px 5px 0px;
 background-color: #fffffe;
 min-height: 776px;
 float: right;
 width: 780px;
 border-style: double;
}
* html #border {height:776px} /* IE Min-Height Hack */ 

#header {
 margin: 6px 5px 3px 5px; 
 background-image:url(images/header.jpg);
 background-repeat:no-repeat;
 height:140px;
}

#headertext
{
	width:180px;
	height:40px;
	font-family:"Trebuchet MS";
	font-size:33px;
	color:#71c15c;
	margin:50px 0px 0px 50px;
	float:left;
	clear:none;
}

#headertextsmall
{	
	width:250px;
	height:30px;
	font-family:"Trebuchet MS";
	font-size:20px;
	color:#fff;			
	padding-right:50px;
	padding-top:60px;
	float:right;
	
}

/* ------------------------ Start Navigation Bar -----------------*/
#topmenu
{
height:46px;
width: 770px;
padding-left:5px;
background-repeat:no-repeat;
}

/*MEUNU*/
.glossymenu{
	position: relative;
	padding: 0 0 0 34px;
	margin: 0 auto 0 auto;
	background: url(images/menug_bg.gif) repeat-x; /*tab background image path*/
	height: 46px;
	list-style: none;
}

.glossymenu li{
	float:left;
}

.glossymenu li a{
	float: left;
	display: block;
	color:#000;
	text-decoration: none;
	font-family: sans-serif;
	font-size: 13px;
	font-weight: bold;
	padding:0 0 0 16px; /*Padding to accomodate left tab image. Do not change*/
	height: 46px;
	line-height: 46px;
	text-align: center;
	cursor: pointer;	
}

.glossymenu li a b{
	float: left;
	display: block;
	padding: 0 24px 0 8px; /*Padding of menu items*/
}

.glossymenu li.current a, .glossymenu li a:hover{
	color: #fff;
	background: url(images/menug_hover_left.gif) no-repeat; /*left tab image path*/
	background-position: left;
}

.glossymenu li.current a b, .glossymenu li a:hover b{
	
	background: url(images/menug_hover_right.gif) no-repeat right top; /*right tab image path*/
}

/* ------------------------ End Navigation Bar -----------------*/


/* ------------------------ Start Images ----------------*/

 

img.block {
 display: block;
}
/* ------------------------ End Images -----------------*/


/* ------------------------ Start Main Columns -----------------*/
#leftcolumn { /* Parent Wrapper for inside boxes */
 margin: 6px 0px 0px 4px;
 display: inline; /* IE Hack */
 width: 240px;
 float: left;
 background-image:url(images/search-box.gif);
 background-repeat: no-repeat;
 min-height: 300px;
 padding: 0;

}
* html #leftcolumn {height:300px} /* IE Min-Height Hack */

.leftcolumn-inner { /* Parent Wrapper for inside boxes */
 display: inline; /* IE Hack */
 width: 220px;
 float: left;
 background-image:url(images/search-box.gif);
 background-repeat: no-repeat;
 min-height: 40px;
 padding: 10px;
 margin-bottom: 7px;
}
* html .leftcolumn-inner {height:40px} /* IE Min-Height Hack */

.in-the-news { /* Parent Wrapper for inside boxes */
 display: inline; /* IE Hack */
 width: 235px;
 float: left;
 min-height: 125px;
 margin-bottom: 7px;
}
* html .in-the-news {height:125px} /* IE Min-Height Hack */


#rightcolumn {
/* border: 1px solid red;*/
 margin: 6px 0px 0px 0px;
 display: inline; /* IE Hack */
 width: 513px;
 float: left;
 min-height: 300px;
}
* html #rightcolumn {height:300px} /* IE Min-Height Hack */ 

#highlightnews {
 background-image:url(images/highlightnews.jpg); 
 height:auto;
 background-repeat: no-repeat;
 text-align: left;
 padding: 17px 10px 10px 13px;
 display: inline; /* IE Hack */
 float: left;
 width: 510px; 
}


#highlightnews img
{
	float:left;
	padding-right:10px;	
}

* html .sponsor {height:80px} /* IE Min-Height Hack */

.maincontent {
 min-height: 80px;
 display: inline; /* IE Hack */
 float: left;
 margin-bottom: 7px;
 width: 530px;
}
* html .maincontent {height:80px} /* IE Min-Height Hack */

.content-mid {
 background-image:url(images/content-mid.gif);
 background-repeat: repeat;
 padding: 5px 14px 5px 14px;
}
.content-mid img
{
	float:left;
	margin:3px 10px 14px 0px;
}
.left-mid {
 background-image:url(images/left-mid.gif);
 background-repeat: repeat;
 padding: 5px 14px 10px 14px;
}
.randompicture
{
background-image:url(images/left-mid.gif);
background-repeat: repeat;
text-align:center;
padding:5px 0px 5px 0px;
overflow:hidden;	
}

.left-heading {
 background-image:url(images/left-heading.gif);
 background-repeat: no-repeat;
 padding: 9px 14px 5px 10px; 
}
.left-heading h3
{
	font-size: 16px;
 color: #fff;
 min-height: 11px;
 font-weight: bold;
}

* html .left-heading {height:11px} /* IE Min-Height Hack */
/* ------------------------ End Main Columns -----------------*/

/* ------------------------- Start Headings ---------------------*/
h1 {
 font-size: 16px;
 color: #72C236;
}
/* ------------------------- End Headings ---------------------*/

input {
 border: 1px solid #8ECE5F;
 width: 200px;
}



#footer {
 font-size: 10px;
 clear: both;
 font-family: Verdana, Arial, Helvetica, sans-serif;
 margin-bottom: 5px;
 text-align:center;
}


ul#daily-links li {
 list-style: none;
 margin-left: 2px;
}
ul#nav-links li {
 display: inline;
 margin-left: 0px;
 padding-left: 12px;
 
}

ul#daily-links li a:link{
 color: #333;
 text-decoration: none;
 font-weight: bold;
}
ul#daily-links li a:visited{
 color: #333;
 text-decoration: none;
 font-weight: bold;
}
ul#daily-links li a:hover{
 color: #999;
 text-decoration: none;
 font-weight: bold;
}




a:link {
 color: #006600;
 text-decoration: none;
}
a:visited {
 color: #006600;
 text-decoration: none;
}

.valid {
 margin: 10px 0px 0px 10px;
}
 
Променяш само това дето е в червено за пикселите и си готов :)

<?php
umask(0);
//variables
if ( isset($_POST['ime']) AND isset($_POST['poqsnenie']) AND isset($_POST['kartinka']) AND isset($_POST['text']) ) {
$user = $_POST['ime'];

$http = $_POST['poqsnenie'];
$town = $_POST['kartinka'];
$msg = $_POST['text'];



if (( $user != "" ) AND ( $msg != "" )) {
include "db.php";
$ip = $_SERVER['REMOTE_ADDR'];
$vreme=date("d F Y, H:i");
$vremeto=date("d F Y");
$http=str_replace("<",'<',$http);
$http=str_replace(">",'>',$http);
$town=str_replace("<",'<',$town);
$town=str_replace(">",'>',$town);
$user=str_replace("<",'<',$user);
$user=str_replace(">",'>',$user);
$mail=str_replace("<",'<',$mail);
$mail=str_replace(">",'>',$mail);
$msg=str_replace("<",'<',$msg);
$msg=str_replace(">",'&gt',$msg);
$msg=preg_replace("/(\[b\])(.+?)(\[\/b\])/i", "<b>\\2</b>", $msg);
$msg=preg_replace("/(\[i\])(.+?)(\[\/i\])/i", "<i>\\2</i>", $msg);
$msg=preg_replace("/(\[u\])(.+?)(\[\/u\])/i", "<u>\\2</u>", $msg);
$msg=preg_replace("/(\)(.+?)(\[\/email\])/i", '<a href="mailto:\\2" target="_blank">\\3</a>',$msg);
$msg=preg_replace("/(\[email\])(.+?)(\[\/email\])/i", '<a href="mailto:\\2">\\2</a>', $msg);
$msg=preg_replace("/(\[url\])(.+?)(\[\/url\])/i", '<a href="\\2" target="_blank">\\2</a>', $msg);
$msg=preg_replace("/(\[url=\])(.+?)(\[\/url\])/i", '<a href="\\2" target="_blank">\\2</a>', $msg);
$msg=preg_replace("/(\[url=(.+?)\])(.+?)(\[\/url\])/i", '<a href="\\2" target="_blank">\\3</a>', $msg);
$msg=str_replace(":biggrin:",'<img src="smilies/biggrin.gif" alt="img">',$msg);
$msg=str_replace(":cool:",'<img src="smilies/cool.gif" alt="img">',$msg);
$msg=str_replace(":cry:",'<img src="smilies/cry.gif" alt="img">',$msg);
$msg=str_replace(":dead:",'<img src="smilies/dead.gif" alt="img">',$msg);
$msg=str_replace(":eek:",'<img src="smilies/eek.gif" alt="img">',$msg);
$msg=str_replace(":embarrassed:",'<img src="smilies/embarrassed.gif" alt="img">',$msg);
$msg=str_replace(":laugh:",'<img src="smilies/laugh.gif" alt="img">',$msg);
$msg=str_replace(":love:",'<img src="smilies/love.gif" alt="img">',$msg);
$msg=str_replace(":mad:",'<img src="smilies/mad.gif" alt="img">',$msg);
$msg=str_replace(":no:",'<img src="smilies/no.gif" alt="img">',$msg);
$msg=str_replace(":none:",'<img src="smilies/none.gif" alt="img">',$msg);
$msg=str_replace(":rolleyes:",'<img src="smilies/rolleyes.gif" alt="img">',$msg);
$msg=str_replace(":sad:",'<img src="smilies/sad.gif" alt="img">',$msg);
$msg=str_replace(":smile:",'<img src="smilies/smile.gif">',$msg);
$msg=str_replace(":smilewinkgrin:",'<img src="smilies/smilewinkgrin.gif" alt="img">',$msg);
$msg=str_replace(":upset:",'<img src="smilies/upset.gif" alt="img">',$msg);
$msg=str_replace(":wink:",'<img src="smilies/wink.gif" alt="img">',$msg);
$msg=str_replace(":yes:",'<img src="smilies/yes.gif" alt="img">',$msg);




$write1 = "
<table class=\"border\" cellpadding=\"1\" cellspacing=\"1\" width=\"100%\">
<tr>
<td class=\"a\" align=\"left\">
<table>
<tr>
<td width=\"71%\" class=\"b\">
<b>";
//ime = name
$write2 = "
</b>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width=\"800px\">
<tr>
<td align=\"center\">
<img align=\"center\" src=\"";
//ime = http
$write4 = "\" alt=\"img\">
</td>
</tr>
<tr>

<td class=\"b\">
<b>";
//ime = town
$write5 = "</b>
<br />
<br />
<i>Публикувано на | $vremeto</i>
</td>
</tr>
</table>";
//ime = comment
$write6 ="
</td>
</tr>
<tr>
<td class=\"a\" height=\"6\" width=\"100%\">
</td>
</tr>
</table>";


$ip = $_SERVER['REMOTE_ADDR'];
umask(0);

$fp = fopen("posts/".$broi.".html", "w");

fwrite($fp, "$write1");
fwrite($fp, "$user");
fwrite($fp, "$write2");
fwrite($fp, "$town");

fwrite($fp, "$write4");
fwrite($fp, "$http");
fwrite($fp, "$write5");
fwrite($fp, "$msg");
fwrite($fp, "$write6");
fclose($fp);

umask(0);
$broi++;
$fp2 = fopen("db.php", "w");
$writedb = '<?php $broi='.$broi." ; ?>";
fwrite($fp2, "$writedb");
fclose($fp2);
$message = "Благодарим Ви за мнението!";
} else {
$message = "Не сте въвели информация!";
}
} else {
$message = "Грешен линк!";
}
?>


</font>
<html>
<head>
<title></title>
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=index.php">
</head>
<body>

</body>
</html>
 

Back
Горе