[PHP] Problem with "switch ($to)"..

2003-12-26 Thread Labunski
Hello, thanks in advice and Merry Christmas!
I'm a newbie in PHP, so I can't imagine how to add the "Part 1" to the "Part
2"..

/// Part 1 
 switch ($to)
 {
 case "roman":
 $to = $address;
 break;

 case "none":
 // here should go the "Part 2", but I don't know how!
 break;
 }

/// Part 2 ///
(empty($from) || empty($message)) {
header( "Location: ../eng/contact.htm" );
  }


Sorry for my bad english,
Lab.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Printing out html

2003-12-27 Thread Labunski
Hello, I have just entered PHP "world" and I have many questions. I have
already made PHP script that send's htm form values via e-mail.
Now I want to build PHP based web page..

>> 1.question>>
For example I have index.php file, but I want HTML (index.html) file to be
"printed out". How php code should look like?

>> 2.question >>
I know that code for IP address ($ip) is:
  $ip = getenv ("REMOTE_ADDR");

For example I have Index.php file, and I want an IP adders to be viewed in
the TD:

 IP address 

How should I write it?


Sorry for my dumb questions and bad english,
Regards,
Lab.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Simple question

2003-12-28 Thread Labunski
Hello, I have only one simple question..
I'm using this method to get the values from the text box:

  if(isset($_POST["Submit"]) && $_POST["Submit"]=="Submit")
 {
   $add = $_POST['textbox'] ;
 }

But I don't know how to write the source for this:

If the value from the textbox ($add) is "Hello" then.. do something.
I think it could be nicely done with IF, but I dont know how to write this..

Can someone help me, please?

Regards,
Lab.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Adding Text to .txt file

2004-01-19 Thread Labunski
Hello,
I've lost the name of the function I found in php.net some time ago.
This function was able to write the text line at the end of the text file.

Can you tell me the name of this function?

Lab.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Adding Text to .txt file

2004-01-19 Thread Labunski
And this function was differs from fopen("myFile.txt", "a");

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Problems with array_reverse!

2004-08-10 Thread Labunski
Hello,
First of all, I should apologize for my bad English,
and I hope somebody will understand what I was trying to say..

So, the problem is, that I can't SORT or REVERSE the array.
By the way, sorry for this awful and very long php script.
And I know  that many of you guys can  make it look short, but please, if
you can repair the main problem,
try to leave this "long" script close to it's natural look. At least so that
I can understand the connection between my part of the script, and yours.
Thank you very mych!



This way, this will print:
2004.08.11
2004.08.31
2004.11.07

But I want to reverse this array, so that it would print:
2004.11.07
2004.08.31
2004.08.11

BTW, I thought that $topic is an array, but when I was tryng to reverse
$topic,
the browser said: "Warning: array_reverse(): The argument should be an
array".

Thank you once more,
Lab.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] How to understand this Warning?

2004-08-17 Thread Labunski
Hello,
How to understand this warning?
I thought maybe the directory name is incorrect, but it's fine.
The Browser said..
"Warning: readdir(): 2 is not a valid Directory resource in
C:\xxx\x\news.php no line 78".


http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: How to understand this Warning?

2004-08-17 Thread Labunski
Hi,
> note the "2" in that message. You are prob. resetting the readdir()
parameter in the script somewhere
No, as far as I can see, I'm not resetting the readdir().. but..

> You loop twice throu the same dir?
Yes I do.

Here is whole script:

 ", $value);
$intro_text .= "$value";
   }
$intro_picture = $topic."/start.jpg";
$date = $topic;
 echo "
 
 
  
 
  
  
   
  ".$intro_text."
   
  ".$date."
 
 
 
  \n";

 unset($intro_text);
}
}
closedir($handle);
 }
 }
 ?>


Lab.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] How to Get URL?

2005-03-13 Thread Labunski
How to get url of the page the php script is on?

In other words, I want to know whether I'm in page "news.php" or in 
"posts.php", or in some other page. Is there any simple way to get tis info?


Thanks,
Lab. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Is the syntax correct?

2005-04-12 Thread Labunski
Is the syntax correct? (in connection with $order) :


switch ($page) {
case "news":
$order = "DESC"
break;
case "articles":
$order = "ASC"
break;
}
mysql_query(" SELECT * FROM data ORDER BY id $order ");


Sorry for my bad english,
Lab. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Simple Problem

2005-04-12 Thread Labunski
I'm not sure, but I just know that if you need to select the information
from two tables (and not just from one),
you should use JOIN syntax ( http://dev.mysql.com/doc/mysql/en/join.html )

Hope this helps,
Lab.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Simple Problem

2005-04-12 Thread Labunski
I'm not sure, but I just know that if you need to select the information
from two tables (and not just from one),
you should use JOIN syntax ( http://dev.mysql.com/doc/mysql/en/join.html )

Hope this helps,
Lab.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Defined constant in mysql_query - Question.

2005-04-12 Thread Labunski
Hi,
Can I use Constant in mysql query like this:


define("LANG", "eng");
mysql_query("SELECT * FROM data WHERE col = 'articles' ORDER BY 
subjectLANG");


Thanks a LOT,
Lab. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Creating a Directory

2005-04-12 Thread Labunski
I think you could use php function mkdir() to do this.

mkdir("/path/to/my/upload_dir", 0777);

But unfortunately there is big "BUT" aka Safe_mode.
To use this mkdir() function, you have to disable the Safe_mode on the 
server :(

"Note: When safe mode is enabled,
PHP checks whether the directory in which you are about to
operate has the same UID (owner) as the script that is being executed."

You can read more about mkdir() here: 
http://lv2.php.net/manual/en/function.mkdir.php
and about chmod values here: http://lv2.php.net/manual/en/function.chmod.php

Hope this helps,
Lab. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: trying to send mail via localhost

2005-04-16 Thread Labunski
Hi,
Unless I'm mistaken, it's cause of bad SMTP address in your php.ini file,
and so (if you haven't installed SMTP server on your PC),
you have to set the SMTP line in your php.ini file to your internet 
provider's smtp address.

For example, I'm on Windows and my internet provider's smtp address is 
mx.e-teliamtc.lv,

so php.ini file looks like:

[mail function]
; For Win32 only.
SMTP = mx.e-telia.lv

; For Unix only.  You may supply arguments as well (default: 
"sendmail -t -i").
;sendmail_path =

Sorry for my bad english,
Lab 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Is it possible to get the whole address (including http:// ) ?

2005-04-21 Thread Labunski
Hello,

I know for example how to get http vars or basename, but this time I need to 
get the whole address, including http:// .

Is it possible?


Thanks in advance,
Lab. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Strange problem with picture Upload

2005-04-23 Thread Labunski
Hi guys,
I have to say, I've written so many scripts that had file upload functions 
included,
but this time something strange is happening.

The script passes the IMAGE_TYPE check, and picture's name stores in the 
database (so I guess the picture should have been stored in the dir.), but 
when I look at the ftp - there's no picture in the upload directory.

Chmod of the directory is 777;

Here it is:

$realdir = $_SERVER['DOCUMENT_ROOT'].'/img/';
$uploadfile = $realdir. basename($_FILES['postbilde']['name']);

if (move_uploaded_file($_FILES['postbilde']['tmp_name'], 
$uploadfile)) {
   $put_name_en = $_POST['subject_en'];

if (!empty($put_name_en)) {
$image = basename($_FILES['postbilde']['name']);
$check_image = 
$_SERVER['DOCUMENT_ROOT'].'/img/'.$image;

if( (exif_imagetype("$check_image") == 
IMAGETYPE_JPEG)||(exif_imagetype("$check_image") == IMAGETYPE_GIF) ){
$put_img = $image;
}else{
$img_root = $_SERVER['DOCUMENT_ROOT'].'/img/';
$kick = $img_root.$image;
unlink($kick);
$put_img = '';
}

mysql_query("INSERT INTO data (subject_en, img) 
VALUES ('$put_name_en', '$put_img')") OR die(mysql_error());

echo '';
}
} else {
   echo "The upload was unsuccessful !";
}


Sorry for my bad english,
Thank you in advance,
Lab.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] How? First big letter

2004-06-25 Thread Labunski
Hello, how to make the firs letter of the word Big?

for example I have:
$colour = "car is red";

but I need:
$colour = "Car is big".

Thank you very much,
I would look for the answer myself using google,
but I have no time for it.
I hope there is an easy solution for this.

Lab.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How? First big letter

2004-06-25 Thread Labunski
Thank you very much! That helps!

As I sad before, I would look for it myself , but I wasn't sleepinng all the
night,
this way I think it would be a liittle bit difficult to find it.
Thank you once more,
Lab.


 wrote in message news:[EMAIL PROTECTED]
> Use ucfirst()
>
> Labunski wrote:
>
> >Hello, how to make the firs letter of the word Big?
> >
> >for example I have:
> >$colour = "car is red";
> >
> >but I need:
> >$colour = "Car is big".
> >
> >Thank you very much,
> >I would look for the answer myself using google,
> >but I have no time for it.
> >I hope there is an easy solution for this.
> >
> >Lab.
> >
> >
> >
>
> -- 
> Miguel J. Jiménez
> ISOTROL, S.A. (Área de Internet)
> Avda. Innovación nº1, 3ª - 41020 Sevilla (ESPAÑA)
> mjjimenez AT isotrol DOT com   ---   http://www.isotrol.com
> ICQ# 12670750
> TLFNO. 955036800 ext. 111

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] .htaccess - change index.php to index.abc

2006-06-03 Thread Labunski
Hello,

What should I change in .htaccess, so that visitors will see index.abc 
instead of index.php.
I just wanna hide file's extension.

Thanks 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] HELP! printing Arrays

2004-03-03 Thread Labunski
Hello,

// This will print first and sixth line from the text file:
$file = file("people.txt");
 print "$file[0]";
 print "$file[6]";

// But how to print all the lines from [0] to [6] ?
// Hope you understood my problem.


Thank you very much,
sorry for my bad english,
Lab.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] HELP! printing Arrays

2004-03-03 Thread Labunski
Thanks! It was very useful!

Lab.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] HELP! printing Arrays

2004-03-03 Thread Labunski
Your script is working perfectly, thanks for teaching me!

Lab.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] How to convert Function into the variable?

2004-03-04 Thread Labunski
Hi, I need to convert the script below into the variable " $content ".
How to do this?
I need this because I want to have an output of this function anywhere where
the $content is.


if ($action=="people"){
function output() {
$file = file("people.txt");
foreach($file as $value ){
print "$value";}
}
output(); //maybe I don't need to have this line here, I'm not sure.
}else{
error ();
}

If you don't understand what I said, you can email me: [EMAIL PROTECTED]

Thank you very much,
sorry for my bad english,
Roman

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] How to write this correctly?

2004-03-06 Thread Labunski
// or example I have some link:

About people

// so this function will output the content of people.txt file:

if ($action=="people"){
function output() {
$file = file("data/people.txt");
foreach($file as $value ) {
$output .= "$value";
}
return $output;
}
$content = output();
}else{
error ();
}

// How can I improve this function so, that it will work automaticly with
other links (below) too.

Factories
Beautiful pictures
Zoo
Contact us

P.S.
I have tried to improve If tag and the name of .txt file this way:
if ($action=="$action"){
function output() {
$file = file("data/".$action.".txt");

.. but the syntax is incorrect.
What to do?

Thanks,
Roman

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] str_replace problem

2004-03-17 Thread Labunski
Probleema sekojosha:
Shiim koda rindinjaam buutu jaanolasa IP adrese no temp.txt faila,
tad ieksh log.txt faila jaasameklee identiska IP adrese (taada pati kaa
temp.txt failaa)
un jaaizdzçð taa no log.txt faila.
Itkaa jau vienkaarshi, BET tas skripts nedarbojas :(

The problem is that str_replace isn't working preperly:
The whole idea of the script (below) is that it reads the IP address from
the temp.txt file,
then looks for identical IP address in log.txt file and deletes this IP
address from the log.txt file.
P.S.
temp.txt file has only one IP address, but log.txt file has many different
IP addresses.


$connect_temp_ip = fopen('temp.txt','r');
$temp_ip = fread($connect_temp_ip,filesize('temp.txt'));
fclose($connect_temp_ip);

$connect_log = fopen('log.txt','a+');
$empty = fread($connect_log,filesize('log.txt'));
$empty = str_replace($temp_ip,"",$empty);
fwrite($connect_log, $empty);
fclose($connect_log);


Thank you very much,
Lab.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Small Problem - could you help me, please?

2004-03-17 Thread Labunski
I have a small problem with the script - could you hepl me, please?

I made small "kicking system" for those who tried to guess the Login
information.
The script below is just a part of the code, but it's not working properly.
I tried to solve this problem in many ways, but I couldn't.
This script should check if the visitor's IP is listed in log.txt file and
if it is, the warning appears.
But the problem is that the script checks only first line in the log.txt
file, not all the lines.
P.S.
log.txt file has many IP addresses listed in one column.


$ip = getenv ("REMOTE_ADDR");

function kick() {
$file_ip = file("log.txt");
foreach($file_ip as $value_ip ) {
$kick .= "$value_ip";
}
return $kick;
}
if ($ip == kick()){
echo "Sorry, the access is denied.";

exit;
}


Sorry for my bad english,
Thanks,
Lab.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Small Problem - could you help me, please?

2004-03-17 Thread Labunski
Thank you very much, it's working fine.

Lab.

"Jason Giangrande" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Labunski wrote:
> | $ip = getenv ("REMOTE_ADDR");
> |
> | function kick() {
> | $file_ip = file("log.txt");
> | foreach($file_ip as $value_ip ) {
> | $kick .= "$value_ip";
> | }
> | return $kick;
> | }
> | if ($ip == kick()){
> | echo "Sorry, the access is denied.";
> |
> | exit;
> | }
>
> In the function you seem to be appending all the ip addresses in the
> file to $kick.  When you return kick it will hold all of the ips and not
> just and will therefore not be equal to $ip.
>
> You might want to try something like this:
>
> $ip = getenv ("REMOTE_ADDR");
>
> function kick($ip) {
> ~$file_ip = file("log.txt") or die("Can't open file");
> ~foreach ($file_ip as $value_ip) {
> $value_ip = preg_replace("/\n/", "", $value_ip);
> ~if ($ip == $value_ip) {
> return true;
> }
> ~}
> ~return false;
> }
>
> if (kick($ip)) {
> echo "Sorry, the access is denied.";
> }
>
> It seems each ip address in the $file_ip has a new line on the end too,
> so you need to remove that before the current ip address in $ip will
> match anything that is in the file.
>
> Hope this helps.
>
> - --
> Jason Giangrande <[EMAIL PROTECTED]>
> http://www.giangrande.org
> http://www.dogsiview.com
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.2.4 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
>
> iD8DBQFAWN6GjfevYzbk95IRAvx3AJ9jVbiSI0gyf50AkeJD63Z8LHT0ggCfQEqE
> RGunvEgTHkKJylmnywLxseM=
> =LJd1
> -END PGP SIGNATURE-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] How to LogOut ?

2004-03-18 Thread Labunski
I made Login page using http auth method ($PHP_AUTH_USER), and it's workong
fine.
But how to LogOut user?


Thanks for all the answers.
Lab.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] ? Sub Directories

2004-03-24 Thread Labunski
This script reads the content of the directory and turns it into the array.
The problem is, that this script reads the names of the subdirectories in
this directory too!

if ($directory = opendir('data/start')) {
   while (false !== ($faila_nos = readdir($directory))) {
   if ($faila_nos != "." && $faila_nos != "..") {
   return $faila_nos;
   }
   }
   closedir($direktorija);
}

// For example the array outputs:

other files
notes
my directory
flowers.txt
cars.txt
animals.txt

// and not just:

flowers.txt
cars.txt
animals.txt


How to solve this problem?

Thanks,
Lab.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] \n is not working!

2004-04-04 Thread Labunski
\n isn't working properly.

Why do this line $new_topic = $post_0.'|'.$post_1.'|'.'$post_2\n'; writes to
the document
one|two|three\n
but not
one|two|three (and break)



whole code:

if ($a=="new"){
$post_0 = $_POST["one"];
$post_1 = $_POST["two"];
$post_2 = $_POST["three"];
 if ($post_1 !=""){
 if ($post_2 !=""){
$m_fails=fopen('../data/menu.txt','a');
$new_topic = $post_0.'|'.$post_1.'|'.'$post_2\n';
fwrite($m_fails,$new_topic);
fclose($m_fails);
}}
}

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] How to Request?

2004-04-05 Thread Labunski
I'll try to explain..

For example I have a link: "index.php?fd=car"
then the Request part looks like this:

if(isset($_REQUEST['fd'])){
  $dir = ($_REQUEST['fd']);
}

But for example I have a link "index.php?fd=car&c=green"..
How to Request more then one variable if I want to get something like this:

if(isset($_REQUEST['fd','c'])){ // incorrect form. How to write this
correctly?
  $vehicle = ($_REQUEST['fd']);
  $color = ($_REQUEST['c']);
}

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Why $a +1 is not 02 ??

2004-11-23 Thread Labunski
Hello,
I have small problem..

$a = 01;
echo $a+1;
//this will display 2, instead of 02.

How to get 02?

thanks.
Lab.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Align pic

2004-12-29 Thread Labunski
Sorry for posting this here,
but this is only newsgroup I'm using, and I can't solve simple HTML problem.
yeah, it's funny, but still.. ;)

I need to center image on the blank screen without using javascript.
- so I wrote:









this should work, but it's not.
now the image is centered horizontally, but I need it vertically, too.
what to do?

Thank you,
Lab.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Problem with WHILE using MYSQL database

2005-01-08 Thread Labunski
Hi,
this script output's data from the database..

$data = mysql_query("SELECT * FROM firt_table WHERE cat='sweaters' ORDER BY
`id` ASC ") or die("can't find DB!");
while($line = mysql_fetch_array($data)){
echo' ';
}

for example, there are 3 records in the "first_table", so script will output
only 3 records:




It's ok. But I need to output 10 records always, even if there are less than
10 records in the database.

Can someone help me, please?
Lab

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] ? PHP in XML document

2005-08-14 Thread Labunski
Hello,

Is it possible to write some PHP code lines in the XML document?

e.g. I want to add  to the xml 
document, but
I don't know the right syntax to do this.

Btw, I need this, cause I'm trying to make CMS system for Flash page.

Thanks a lot!
Roman 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Unique user?

2005-08-19 Thread Labunski
Simply ad some info to the Cookies (including date and time). 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Function Overloading

2005-12-17 Thread Labunski
"PHP does not support function overloading."
So, is there any other way of getting a number of parameters(variables) 
passed to a function?

aka.
function fruits($apple, $banana, $kiwi, $grape){

#should (somehow) output 4

}

OK. if it was an array, than I could use count($array), but now I'm stuck!

Thanks in advance! 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Function Overloading

2005-12-18 Thread Labunski
Thank you very much. This is exactly what I wanted to do. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] ? Split string into smaller chunks

2005-12-19 Thread Labunski
I need to split a long string into smaler chunks (an array), as a separator 
using every third \n (and not just every \n).
I could use 'explode', but then it would produce too many chunks.

Thank you in advance!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] [Problem] - reading file

2006-02-06 Thread Labunski
Hello,

The problem is, that script outputs Last line from the file (and not first 
line, as expected)!
4 hours spent seeking for mistake. Hopeless.

The script should read all the filenames in the directory,
then open each file to read first line from file and output this line.

if(!isset($_GET['id'])){//if !ISSET ID
$path = "files/info/".LANG;

 if ($handle = opendir($path)) {//first if

while (false !== ($file = readdir($handle))) { //while
   if ($file != "." && $file != "..") { //if not .  ..

if(!is_file($file)){

 //echo $file."";
 $new_path = "files/info/".LANG."/".$file;
 //echo $new_path;
 $text = file($new_path);

 foreach($text as $lines ) {
 $lines = preg_replace("/\n/", "", $lines);
 $lines = trim($lines);

 $lines = explode("\n",$lines);
 $out = "$lines[0]";

 }
 echo $out."";
 unset ($out);

}//!is_file

 }//if not .  ..
}//while
closedir($handle);
 }//first if
}//if !ISSET ID


If text files look like:

1.txt{
First line of 1.txt.
Second line of 1.txt.
}

2.txt{
First line of 2.txt.
Second line of 2.txt.
}


Then Output (using this script) will be:

Second line of 1.txt

Second line of 2.txt

- - - - - - - - - - -
But it should be:

First line of 1.txt

First line of 2.txt


I'm really hopeless..
Thanks everyone in advance!
Roman.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Window close.

2006-02-06 Thread Labunski
It can'tbe done with PHP, cause it must be client side script, aka 
Javascript:

"javascript: window.close();" 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php