[PHP] Using PHP on an .html file

2003-08-24 Thread Pag
	I looked everywhere for the answer to this dilemma, and i know there is a 
way around it, maybe something about the headers, cant really remember how 
it was, but can someone please tell me how i can use PHP code on a file 
with an extension of .html?

	For example, on a file called info.html, i want to have some PHP code that 
actually gets executed.

	Thanks.

	Pag



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


[PHP] finding out localhost :-P

2003-08-24 Thread Pag
	Heres the problem. I have one of my client's site hosted on a crappy 
server, and i have it running with php+mysql ok, the thing is i need to 
connect to that site's mysql's database from a different site to get data. 
The problem is that on the origin site (the crappy server), to connect to 
the database, i use localhost. How can i find out the real server to 
connect to from the other site? I tried using the whole domain, like 
www.crappyserver.com, but doesnt work. :-P
	Thanks.

	Pag

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


[PHP] session variables

2003-03-19 Thread Pag
	HI,

	Am trying to give controlled access to who logs in to my site. Have a 
quick doubt:

	I register a session var named $tu (value is taken from the DB) when a 
user logs in, how can i reference to that var? I mean, if i want to check 
its value, if i do print($tu);, it doesnt seem to work.
	Thanks.

	Pag



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


[PHP] Hacker problem

2003-03-12 Thread Pag
	Been having some hacker problems on my site, and a simple one:

	I have a shoutbox, a simple form with name and text that adds lines to the 
database. I do checks for insults, too long words, tags, etc, but its still 
possible to circumvent those checks by adding the data on the url instead 
of using the form. something like:

 	www.domain.com/shoutb.php?name=hackertext=generalnonsenseandbadwords

	To prevent this, i tried tracing the http_referral so that only data from 
inside the site goes into the shoutbox. THe problem is that if you do that 
url above after visiting my site, the http_referral obviously thinks its 
coming from inside the site. :-P
	How can i solve this? Is there any way to prevent data adding from 
outside? Maybe some invisible check on the form or something?

	Thanks.

	Pag



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


[PHP] Follow-up to Hacker problem

2003-03-12 Thread Pag
	Your tips were nice, guys, thanks a lot. I tried a few things and i 
decided to go for making all the checks server side, cant go safer than that.
	Just have a doubt on one of the checks, at least so far.
	I have a check for long words, because the shoutbox is in a IFRAME, so if 
someone posted a long word, the infamous horizontal scroll bar would 
appear. How can i check for long words on a string and remove them before 
they get written on the DB?

	Thanks.

	Pag



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


[PHP] PHP Online Store

2003-03-10 Thread Pag
	Hi,

I have to write a PHP/MySQL online store with product catalogs, prices,
descriptions, and ordering (no payment) etc, but i have a big doubt when it
comes to updating.
How is it usually done? I mean, i never did a project like this, with a
big amount of products to update. Whats the easiest way of updating the
prices like say, every week? The suppliers send a list of the new prices to
the store, and the store has to update the prices online manually, one by one?
Also i thought of saving the excel file in csv format and uploading to the
site, where some sort of parser would collect the new info from it. The
problem with that approach would be if the supplier changes a cel on some
product name, then everything would be ruined.
How is it usually done?
	Big thanks, i am completely blind in this.

	Pag



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


[PHP] problem with and '

2003-02-10 Thread Pag

	Hi,

	When a user wants to add a comment on my site and uses either  or  ', and 
when it gets printed out,  comes out as / or /', either to the web page or 
on a form to alter.

	The only treatment i give it after its submited on the form is:

	$comentarioc = str_replace(\r\n, \n, $comentarioc);
	$comentarioc = str_replace(\r, \n, $comentarioc);

	Is there a way to solve this? So it can accept both  and ', and be able 
to alter/print it with no problem?
	Thanks.

	Pag



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



Re: [PHP] File upload problem

2003-02-10 Thread Pag



Which sounds like it has to be there to me? I just checked a working
file upload form without MAX_FILE_SIZE field, and it worked.. I guess i
misunderstood what was on the tutorials ? Or i wonder if this was a must
in the earlier versions of PHP? Anyone?


I have an upload feature on my administration side of my site and 
i dont use the MAX_FILE_SIZE as a hidden field on the form. I simply have a 
field for the file to upload and do all the checks, for size, change 
filename, etc, on the receiving end (different script) and it works fine.
If you want the code, i can send it to you or post it here. :-)

Pag 



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



[PHP] and ' giving problems

2003-02-10 Thread Pag

	Hi,

	When a user wants to add a comment on my site and uses either  or  ', and 
when it gets printed out,  comes out as / or /', either to the web page or 
on a form to alter.

	The only treatment i give it after its submitted on the form is:

	$comentarioc = str_replace(\r\n, \n, $comentarioc);
	$comentarioc = str_replace(\r, \n, $comentarioc);

	Is there a way to solve this? So it can accept both  and ', and be able 
to alter/print it with no problem?
	Thanks.

	Pag



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



[PHP] counter freezes whole site!

2003-02-05 Thread Pag

	Hi, I am having a serious problem on my site. It was working fine until a 
day ago, when it simply freezes. After i made a few checks i realized it 
loops on this code. I tried everything but i cant understand why and i am 
going crazy trying to figure it out!
	This code is supposed to write a 24h cookie at first visit, and then 
checks for it at every refresh, if the cookie doesnt exist, it increases a 
counter on the DB. Simple, right? Then why did it stop working out of the 
blue? It loops on the refresh, keeps thinking the cookie is not active, so 
it keeps adding +1 to the counter. What am i doing wrong? How can i fix it?
	oh, this code is right at the top of my main page.
	Thanks!


?
if ($pvisita == '1') {
break;
} else {

include ('databaseinfo.txt');
$ligacao=mysql_connect($h, $u, $p) or die(Erro ao aceder a MySQL);
@mysql_select_db($DBname) or die(Unable to select database  . $DBname);
$resultado = mysql_query (select * from counttable where id='0');

if ($resultado) {
$registo = mysql_fetch_array($resultado);
$id = $registo[ID];
$contador = $registo[contador];
$contador = $contador + 1;
$resultado2 = mysql_query (update counttable set contador='$contador' 
where id='0');
setcookie(pvisita, 1, time() + 86400);
header(Location: $PHP_SELF);

}else{
print (não há registos);
break;
}

}
?



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



[PHP] How to check for refresh in PHP

2003-01-30 Thread Pag
	
	Hi,

	I have a news site where i want to track how many visits or reads each 
individual news has. I have a main list with all the titles, then clicking 
on them shows the details of the specific news, only then the counter for 
that particular news is increased. The problem is, if the user does a 
refresh while at the details, the counter is increased again. How can i 
prevent this from happening?

	I thought it would be something like a unique counter problem, but its 
like having a counter problem for each news i have. :-P

	What would be nice, if it exists, is to check if the user is doing a 
refresh or coming from somewhere else. If its a refresh, the counter would 
simply not increase. That would be sufficient to keep the 
i-want-my-news-to-have-the-higher-number-of-visitors author, from having 
his way.

	Thanks.

	Pag



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



[PHP] Login and sessions?

2003-01-23 Thread Pag

	Hi,

	I am trying to add a login functionality to my new manager. A simple 
username/password functionality, so that the user logs in and everything he 
does inside the site will have his name. I mean, if he wants to create a 
new entry on the database, the field name wont have to be filled, etc.
	Anyway, i dont have a clue to where to start. Tried to search the net but 
i dont even know the keywords to search for. Could you guys please put me 
in the good path?
	Heres where i got so far:

	Have a table on a mysql database named USERS, with name, password 
address, etc on it.
	What do i use to authenticate the user on my site? Sessions? If so, the 
steps i need to solve the problem are, user logs in, the server keeps his 
personal variables in memory so everytime they are needed for some form 
or whatever, the server fills the fields automatically.

	How can i have several users logged on and then have like a box on the 
site displaying who and how many users are logged in?
	Sorry for the messed up explanation, but i really dont know what do do 
about it. Thanks.

	Pag



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



[PHP] dumb time question

2003-01-13 Thread Pag

	Ok, this is going to be laughable, but here goes. I am looking at code too 
much to get this one:

	Have 2 text fields on a database called hours and minutes.
	How can i get the current time (hour-minutes) in two digit format and 
apply it to the two variables? Everything i do only gets one digit when the 
minutes are between 00 and 10.
	I know its going to be stupid but anyway, could use your help, i cant see 
anything straight in this code anymore. :-P
	Sorry and thanks.

	Pag



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



[PHP] FORM text formatting problem

2002-12-30 Thread Pag

	Hi,

	When i retrieve the text i have on my database, which was taken from a 
form textbox, i have line breaks ate the end of each line in the textbox. 
Ah, hard to explain!
	My textbox is small, and everytime, while writing a text in it, the line 
ends and we continued writing on the next one, thats the formatting my text 
on the database gets. It doesnt recognize the line breaks we want (by 
pressing ENTER), but takes line breaks simply from reaching the end of the 
textbox. How can that be?

	Before i insert the text from the textbox into the database, i do this:

	$texto = str_replace(\r\n, \n, $texto);
	$texto = str_replace(\r, \n, $texto);

	And when i want to retrieve the text from the database to display it on 
the site, i do:

	$texto = str_replace(\n, br, $texto);


	Some help, please?

	Pag
	



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



RE: [PHP] FORM text formatting problem

2002-12-30 Thread Pag




Are you using a WRAP attribute on your TEXTAREA? You'll want to set it
to OFF or NONE, probably. I can't remember the exact values, it can
take, but I think it's PHYSICAL, VIRTUAL, and NONE/OFF.


Thank you. Problem solved.
Better put thank you on some sort of macro because it seems i 
will be using it a lot. :-)

Pag 



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



RE: [PHP] Form duplicate post problem

2002-12-29 Thread Pag



You can still use one page and use a middle-man technique. The part
that processes the form input would redirect back to itself after the
data is inserted into the database, thus getting rid of the post data.
So subsequent refreshes of the page will refresh without attempting to
repost the data.


This post is merely for reference and, hopefully, to help out some 
other person that runs into the same problem.

I solved my duplicate form post problem using that middle-man 
technique you guys mentioned, but i did it in a little more user friendly 
way than using a complete page and redirecting back to the original. (thus 
preventing some design problems on my specific site)

I used some javascript to open a small window, it has the code to 
insert the comment into the database, thanks for the user input and 
immediately closes and refreshes the original, showing that last inserted 
comment. Works very smoothly, and if the user connection is fast enough, he 
doesnt even notice the window.

If anyone needs the code, feel free to email me, ok? I am just not 
posting it because its a bit long, and might unnecessarily clutter the 
list. :-)

Thanks for all the help, guys, you got me in the right direction.

Pag 



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



RE: [PHP] Form duplicate post problem

2002-12-29 Thread Pag



Also for reference, but I would recommend to everyone that they not rely
on Javascript and simply do all of this in the main window. With Pop-Up
Blockers and different browser versions, Javascript should be avoided if
possible unless you really know what your audience will be using (or
don't care).


I subscribe to your opinion, i spoke too soon. It seems i cant 
pass the form vars to the new javascript window, and i dont have a clue why 
not!
Quite simply, if instead of opening a new window, i use the exact 
same code on the main window, all the vars are passed, if i use javascript 
to open a new window, no php vars are passed on.
So i apologize for my early cry of victory, it quickly turned into 
a cry of despair. bah. Any ideas on how to get it working? PHP doesnt pass 
vars to javascript new window?

(going for the main window approach for now, thanks john)

Pag 



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



Re: [PHP] Form duplicate post problem

2002-12-29 Thread Pag



Maybe I'm missing something here but I'm not sure why you consider it more
user friendly to pop-up a window (and have it disappear automatically). If I
was a user I would be thinking what the hell was that?. And if their
connection was fast enough that they don't even notice the window pop-up 
disappear, and just see the main page refresh how different is that to the
'one page and use a middle-man technique'?


Ok, i admit my donkeyness. :-P It takes the same time to popup, 
close and refresh, than it does to redirect and refresh.
One thing that popup would prevent would be the browser history, i 
mean, if that popup method worked, if the user clicked on the back 
browser button, it would take him to where he came from. If i use that 
redirect method, the back button takes him to the redirect. Still trying to 
figure that one out. Would be nice to make the browser history forget 
that redirect. :-P
But you are right, Jason, time wise i was wrong in going for the 
popup, not to mention those other very relevant facts john mentioned too.

Pag 



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



RE: [PHP] Form duplicate post problem

2002-12-29 Thread Pag



Yeah, you should be using a header() redirect, not a javascript or META
REFRESH redirect...


Well, i tried, but i get an error saying that all the headers were 
already sent to the browser. :-P
I used:

header('Location: http://www.blahblah.com etc');


I placed this header right after all the database writes.

Pag 



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



RE: [PHP] Form duplicate post problem

2002-12-29 Thread Pag

	Got it to work. I removed everything except the PHP script. Works like a 
charm, no problem on the browser back button.
	Great help from you guys. Thanks a lot!

	Pag



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



[PHP] Form duplicate post problem

2002-12-28 Thread Pag

	Hi,

	I am having some problems with duplicate form input.
	I have a form that adds comments to an article, works fine, but if the 
user clicks on refresh, having added a comment previously, the same 
comment is added again. I tried clearing the variables after the database 
write, but the refresh somehow resends the previous values.
	Roughly, heres how my script works: (not using actual code syntax here)

	--
	if {$flag=1 AND $name!='' AND $commentbody!=''){

	inserts the comment into the database
	$flag = 0
	$name = ''
	$comment = ''
	}
	--
	routine to display the article and the existing comments here
	--
	form here
	if user clicks send, puts $flag=1 and calls same page
	--


	How can i prevent these double entries? Some command to definitely clear 
the variables?
	Thanks.

	Pag



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



Re: [PHP] Form duplicate post problem

2002-12-28 Thread Pag




to a new page that displays the success notices etc and if they
do a back or a refresh nothing will happen as the POST data
is on the previous now removed from history page.


I understand, but the reason i am trying to stick with just one 
page is that i want it to be practical. I mean, the moment the user clicks 
submit the page reloads and shows his comment immediately, and give him 
the functionality of pressing refresh to see if anyone else commented in 
the meantime.
Also, by using a different page, even with a redirect back to the 
original, might take a little while, since the original is a bit heavy on 
the download side. ;-)

Pag 



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



Re: [PHP] Form duplicate post problem

2002-12-28 Thread Pag



The redirect using the header method is instant and if the middle
page just does the inserts and you redirect right away using PHP
it is not noticable at all.



I gave up on reinventing the wheel and i am trying to use that 
middle-page method you guys mentioned. To make things a little more 
transparent to the user, i thought of using a popup window instead, you 
know, a tiny window pops up, with the code to insert the comment on the 
database, and closes right after it does so.

but err..how can i close it right after the database insert?

Pag 



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



[PHP] include problem

2002-12-26 Thread Pag

	Hi,

	i am trying to make my work a little easier when editing the appearance of 
a news site i am building. As it is, everytime i want to change the looks 
of how each news appears, i have to edit inside the print('  '); which is 
annoying, because of the backslash with  problem thing(when i need to have 
a  inside a print, i need to put a \, you know), for example:

	i have:

	print(br[$data] br $titulo br($user)br $intro br $texto 
brbr (comentarios=$contador)brbrhr size=1 width=90%br);

	Cant i do something like having the code inside the print on an external 
file? so when i want to change something, i only edit that file, instead of 
dealing with the print itself, like this:

	[some command(s) that put the content of the external file looks.inc in 
variable $a]
	print ($a);

	I dont even know what to look for in the net. This problem is so i, later 
on, can code some sort of backend in the ways of greymatter, that people 
can change the looks of the news entries by themselves.

	Thanks.

	Pag



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



[PHP] news site, recent entries retrieval

2002-11-13 Thread Pag

	Hi,

	I am writing a back end to be used by general news and journal sites and i 
am running into some problems.
	I already did all the background work, created the tables, programmed a 
php news manager to add, edit, remove entries/comments, etc. The problem is 
displaying all the info on the site. Whats the mysql command to display 
only n entries? I mean, assume i want to display only the 10 most recent 
entries on the main page, how do i do that? :-P
	One of the fields in my tables is type (values 0, 1, 2 etc), which 
divides the news into categories, how can i display like the 10 most recent 
entries of type = 2, for example?
	I am lost, could really use some help. Thanks!

	Pag



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



Re: [PHP] Re: Passing a PHP variable to javascript

2002-08-19 Thread Pag


Hi, i am coding a news manager backend for a client and i ran into a 
little problem.

I have two tables, one with the news and one with the comments on each news.

How can i count how many comments there are for each news entry? Simply 
put, is there some sort of Mysql command query that can count how many 
records exist with a given field content?
Example:

Count on a database how many peters there are in there?

Is there a specific SQL select or something, or i have to make a loop just 
to count them?

Thanks.

/Pag



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




[PHP] database value count retrieval

2002-08-19 Thread Pag


SELECT COUNT(x) FROM table;

Make 'x' equal to any column name in the table and add WHERE to the
clause as needed.

 err...all very well, but how do i retrieve the value afterwards? 
Heres my code:

 $sqlcom=select count(codigo) from comments where codigo=$id;
 $resultadocom = mysql_db_query (database,$sqlcom);
 $registocom = mysql_fetch_array($resultadocom);
 $contador = $registocom[codigo];
 print(comentarios= $contador);

 Nothing comes out, although i dont have a clue on how to retrieve 
the result after the fetch_array. :-P


 /Pag



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




[PHP] security login

2002-08-12 Thread Pag


Well, first off sory for a very basic question, but i really dont know 
where else to look for the answer. Heres my dilemma:

I need to code a backend for this site i am building, the backend will 
manage the news for the front page. The database stuff is pretty straight 
forward (so far!), but i need to validate who does the managing, i mean, 
some sort of login for only a few people. I am thinking of using 
username/pass from a table and all that but the thing is, how do i do the 
validating itself? Sure i know how to check for valid user/pass, but then 
what happens for the rest of the pages inside the backend, how do i keep 
the user validated and make sure only he can browse inside that secure 
mini site?
Dont know if i am explaining things right, hmm, ok, any of you guys are 
familiar with gryematter? It validates the user at the start and then we 
can do whatever we want inside. I want to prevent users from skipping the 
login and just typing the other page url and go on from there.
I use sessions, cookies? what? can you provide me with some urls for my 
research, or at least what to look for?
Thanks a lot, really appreciate all the help.

Pag



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




Re: [PHP] getaddrinfo failed

2002-06-23 Thread Pag


So what's on /usr/home/pagon/www/index.php on line 497 at a few lines
before it?

 on line 497 theres the line:

  $linha=file('downs.txt');

 then the rest of the script as below.
 Before this line theres simple, very simple, html. I dont 
understand the error.


 Pag






 
   ?
  $linha=file('downs.txt');
  $t=count($linha);
  $l = $t - 1;
  $fim = $l - 3;
 
  if ($l  3)
  {
  $fim=$l - 3;
  }
  else {
  $fim = 0;
  }
  for ($i = $l; $i = $fim ; $i--) {
   $array=explode(|,$linha[$i]);
   print(div align=\left\);
   print(span class=\data\$array[0]/span);
   print(br$array[1]br);
   print(/divimg src=\spacer.gif\ height=\3\);
   }
  ?
 
 
   But from time to time, and with absolutely no visible reason, i
  get this error:
 
   Warning: php_network_getaddresses: getaddrinfo failed: No address
  associated with hostname in /usr/home/pagon/www/index.php on line 497
 
  Warning: file(downs.txt) - Bad file descriptor in
  /usr/home/pagon/www/index.php on line 497
 



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




[PHP] Whos online at the moment in PHP

2002-06-23 Thread Pag


Is it possible to code in PHP a small indicator on a site saying how many 
people are viewing that page at the moment?
Sorry if its a silly question, but i am a newbie at PHP. If it is, could 
you point me in the good direction? i mean, some function or something.
Thanks.

Pag



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




[PHP] getaddrinfo failed

2002-06-22 Thread Pag


Sorry, i sent this to the list a few days ago, but i dont think it got 
there. heres my problem:

 Hi, i have this script that simply reads lines from a txt files 
and displays them on my site, itlists the first 4 entries of a txt file 
with the files that exist on a download page:

 ?
$linha=file('downs.txt');
$t=count($linha);
$l = $t - 1;
$fim = $l - 3;

if ($l  3)
{
$fim=$l - 3;
}
else {
$fim = 0;
}
for ($i = $l; $i = $fim ; $i--) {
 $array=explode(|,$linha[$i]);
 print(div align=\left\);
 print(span class=\data\$array[0]/span);
 print(br$array[1]br);
 print(/divimg src=\spacer.gif\ height=\3\);
 }
?


 But from time to time, and with absolutely no visible reason, i 
get this error:

 Warning: php_network_getaddresses: getaddrinfo failed: No address 
associated with hostname in /usr/home/pagon/www/index.php on line 497

Warning: file(downs.txt) - Bad file descriptor in 
/usr/home/pagon/www/index.php on line 497


 I tried everything, but i cant figure out why i get this error, 
the paths are ok (otherwise it wouldnt work in the first place) what could 
possibly cause it? The script is so small and simple, is there something 
wrong in it? But if it is, why does the error only appears randomly?
 I get this error on a different script on my site, also of the 
same type, reading a few lines from a txt file and displaying them.
 Thanks.

 Pag



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



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




[PHP] Weird error!!

2002-06-21 Thread Pag


 Hi, i have this script that simply reads lines from a txt files 
and displays them on my site, itlists the first 4 entries of a txt file 
with the files that exist on a download page:

 ?
$linha=file('downs.txt');
$t=count($linha);
$l = $t - 1;
$fim = $l - 3;

if ($l  3)
{
$fim=$l - 3;
}
else {
$fim = 0;
}
for ($i = $l; $i = $fim ; $i--) {
 $array=explode(|,$linha[$i]);
 print(div align=\left\);
 print(span class=\data\$array[0]/span);
 print(br$array[1]br);
 print(/divimg src=\spacer.gif\ height=\3\);
 }
?


 But from time to time, and with absolutely no visible reason, i 
get this error:

 Warning: php_network_getaddresses: getaddrinfo failed: No address 
associated with hostname in /usr/home/pagon/www/index.php on line 497

Warning: file(downs.txt) - Bad file descriptor in 
/usr/home/pagon/www/index.php on line 497


 I tried everything, but i cant figure out why i get this error, 
the paths are ok (otherwise it wouldnt work in the first place) what could 
possibly cause it? The script is so small and simple, is there something 
wrong in it? But if it is, why does the error only appears randomly?
 I get this error on a different script on my site, also of the 
same type, reading a few lines from a txt file and displaying them.
 Thanks.

 Pag



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




Re: [PHP] php_network_getaddresses

2002-05-04 Thread Pag



nancies is local, so I'm not suprised that the pings came back ok.  We did
put up a firewall about a week ago that blocks pings from the outside
though.  Since everything is local though, I'm not sure why we would have
this problem.

 I have this problem too, i mean, the same warning and bad location 
error. But its not always, i get it from time to time on my website 
(www.pagongski.com) and i cant figure out what it is.
 I have a random banner, a random quote and some fopen's for a 
shoutbox and news heading fetcher. Even changed all the vars hoping it 
would fix it. One thing i noticed is that the error is less frequent on IE6 
at home than it is at work. At home i acess the net by adsl and at the 
office we use isdn but by router/lan. Something to do with that? Dont know 
the reason for such errors.

 Pag


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




Re: [PHP] PHP compared to JSP

2002-05-04 Thread Pag



But my question still remains the same ... does PHP alone (without ZEND)
compile code into some .compiled_PHP file so that the user loading same page
for 2nd time gets better response than the 1st time?

 No, it doesnt. Every time a user accesses a page that has PHP, the 
page will be built on the spot. (server side) Its extremely fast so no 
delays whatsoever.
 More figurately, you have a webpage with the PHP code somewhere in 
it, if  a user requests to view it, the server generates the code, builds 
the page, delivers it to the user and still keeps the original PHP code for 
the next user, going over it again, dynamically.
 Sorry if i cant explain this very well.

 Pag


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




Re: [PHP] PHP compared to JSP

2002-05-04 Thread Pag



Does PHP compile : NO
Does the user loading same page for 2nd time gets better response : YES it 
can if caching is provided

 On a side not..isnt caching a bit like going against why PHP was 
built in the first place? I mean, information may get a bit out of date if 
we get a page on the cache instead of getting it fresh from the server.

 Pag


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




[PHP] PHP editing environment

2002-05-03 Thread Pag


Hi, i am new to the list and i am quite impressed with whats going on over 
here. Anyway, just have a small question.
Have been coding php for a while now but i still havent found a stable 
(easy and not time consuming) way of working in PHP, i mean, i use 
homesite5 to code and when i want to test the php i upload the scripts and 
test them on the site. This process is a bit time consuming, so i installed 
php on my winXP, but even like that i can only test small things using php 
master editor.
Anyone know how i can make my work more efficient? Like install MySQL and 
PHP and get everything working normally when i preview the code in internet 
explorer, that would be perfect, is it possible? How do you guys and girls 
work with php, what editors and/or tools you use?
Thanks.

Pag


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