Results 1 to 4 of 4

Thread: PHP

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date: Sep:2016
    Location:
    Posts: 18

    PHP

    , -. . - . , , - . !
    Code:
    <?php
    session_start();
    $lines = file('sys-for-news/news.txt');
    $lines = array_reverse($lines);
    $last_news = $lines[0];
    list ($id, $data, $txtName, $txtZagl, $txtInfo, $ip) = preg_split ("/\|@\|/", $last_news);
    echo ': <a href="sys-for-news/index3.php">'.$txtZagl.'</a>'."\n";
    ?>
    :
    Code:
    <?php
    include "func.php";
     
    $lines = file('news.txt');
    $lines = array_reverse($lines);
    $item_per_page = 9;
     
    if(isset($_GET['page'])) $page = $_GET['page'];
    else $page = 1;
    $reji_ot_elem = ($item_per_page*$page)-$item_per_page;
    $sm = array_slice($lines, $reji_ot_elem, $item_per_page);
     
     
    foreach ($sm as $novini){
    	list ($id, $data, $txtName, $txtZagl, $txtInfo, $ip) = preg_split ("/\|@\|/", $novini);
    	$txtName = wordlength($txtName, 20);
    	$txtZagl = wordlength($txtZagl, 40);
    	$pic_file = wordlength($pic_file, 40);
    	$txtInfo = wordlength($txtInfo, 5000);
    	
    	echo '<div class="novina"><h3>'.$txtZagl.'</h3>'."\n";
    	echo '<div class="user"> : <b>'.$txtName.'</b>  <b>'.$data.'</b></div>'."\n";
    	
     
    	//         
    $gallery = file('gallery.txt');
    foreach($gallery as $l){
      //       id-   
      $match = '/'.$id.'/';
      
      if (preg_match($match,$l)){
         list($id, $pic_name, $file_name ) = preg_split("/\|@\|/", $l);
    	 
        echo '<a href="upload/'.$file_name.'"><img src="upload/'.$file_name.'" widht="350" height="250"></a>'; 
    }
     				
    }
     
    	echo '<p>'.$txtInfo.'</p>'.'<hr>'."\n".
    	'</div><!--  class="novina" -->';
     
    }
     
     
     
     
    // ---------  ----------
    echo "<br /><br />";
    for($x=1; $x<=ceil(count($lines)/$item_per_page);$x++){
    	if ($x==$page) {
    		echo "$x ";
    		continue;
    	}
    	echo ("<a href=\"index3.php?page=$x\">$x</a> ");
    }
     
    ?>

  2. #2
    Mire-x
    Join Date: Apr:2005
    Location: Sofia
    Posts: 763
    Code:
    <?php
    
    session_start();
    
    $limit = 2;
    
    $lines = file('sys-for-news/news.txt');
    $index = count($lines);
    if ($limit > $index) $limit = $index;
    while ($limit--) {
       list ($id, $data, $txtName, $txtZagl, $txtInfo, $ip) = preg_split("/\|@\|/", $lines[--$index]);
       echo ': <a href="sys-for-news/index3.php">'.$txtZagl.'</a>'."\n";
    }
    
    ?>
    $limit . - -.
    , , "sys-for-news/index3.php".
    "" .
    (10b) || !(10b)

  3. #3
    Registered User
    Join Date: Sep:2016
    Location:
    Posts: 18
    index3.php. , .
    Last edited by svetlio2009; 14th October 2016 at 22:48.

  4. #4
    Mire-x
    Join Date: Apr:2005
    Location: Sofia
    Posts: 763
    Quote Originally Posted by svetlio2009 View Post
    ... .
    ? ?
    Last edited by Tarvin; 18th October 2016 at 12:06.
    (10b) || !(10b)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |