Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[PHP HELP] Read file is messed

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
AlbanainRetard
Master Cheater
Reputation: 0

Joined: 02 Nov 2008
Posts: 494
Location: Canada eh?

PostPosted: Sat Mar 14, 2009 8:52 pm    Post subject: [PHP HELP] Read file is messed Reply with quote

Here is my code:
Code:

<?php
$fp = fopen('songs.txt','r');
if (!$fp) {echo 'ERROR: Unable to open file.</table></body></html>'; exit;}
 
while (!feof($fp)) {
$line = fgets($fp, 1024); //use 2048 if very long lines
list ($name, $link) = split ('\|', $line);
if( strpos($name,$_GET["search"]) != FALSE )
{
echo '<p>' . $name . '||' . $link . '</p>';
}
$fp++;
}
 


fclose($fp);
 
?>


update:
If my file is:
testname||pooman
poopoo||testxd

it only searches the top one, and I also can try to search test, only name...

And it should display all the correct responses but it only works on the first line, and suggestions?

_________________
Back to top
View user's profile Send private message Send e-mail
compactwater
I post too much
Reputation: 8

Joined: 02 Aug 2006
Posts: 3923

PostPosted: Sat Mar 14, 2009 9:24 pm    Post subject: Reply with quote

FALSE is 0, it will ignore an exact match. "estname" and not "testname". $fp++ is adding to a handle... need I say why that's dumb?
Artists with similar names will appear. "Test my music" and "Test my songs", and it is case sensitive. I recommend using an SQL database, or XML if that is not possible.

Code:
<?php
$fp = fopen('songs.txt','r');
if (!$fp) {echo 'ERROR: Unable to open file.</table></body></html>'; exit;}
 
while (!feof($fp)) {
$line = fgets($fp, 1024); //use 2048 if very long lines
list ($name, $link) = split ('\|', $line);
if( strpos($name,$_GET["search"]) > -1 )
{
echo '<p>' . $name . '||' . $link . '</p>';
}
}
 


fclose($fp);
 
?>
Back to top
View user's profile Send private message
AlbanainRetard
Master Cheater
Reputation: 0

Joined: 02 Nov 2008
Posts: 494
Location: Canada eh?

PostPosted: Sat Mar 14, 2009 9:32 pm    Post subject: Reply with quote

compactwater wrote:
FALSE is 0, it will ignore an exact match. "estname" and not "testname". $fp++ is adding to a handle... need I say why that's dumb?
Artists with similar names will appear. "Test my music" and "Test my songs", and it is case sensitive. I recommend using an SQL database, or XML if that is not possible.

Code:
<?php
$fp = fopen('songs.txt','r');
if (!$fp) {echo 'ERROR: Unable to open file.</table></body></html>'; exit;}
 
while (!feof($fp)) {
$line = fgets($fp, 1024); //use 2048 if very long lines
list ($name, $link) = split ('\|', $line);
if( strpos($name,$_GET["search"]) > -1 )
{
echo '<p>' . $name . '||' . $link . '</p>';
}
}
 


fclose($fp);
 
?>


Thanks, I am not the best of PHP developers. My host doesn't allow MySQL, until I rebuy some more hosting. I will rep you in 34XXXX seconds. I may try xml.

_________________
Back to top
View user's profile Send private message Send e-mail
Localhost
I post too much
Reputation: 0

Joined: 28 Apr 2007
Posts: 3402

PostPosted: Sun Mar 15, 2009 8:40 am    Post subject: Reply with quote

Uhh, i would find a new host! I know atleast 5 free hosts that allow MySQL databases.

txt databases are VERY insecure... Though they are usually much faster.

_________________
Back to top
View user's profile Send private message MSN Messenger
AlbanainRetard
Master Cheater
Reputation: 0

Joined: 02 Nov 2008
Posts: 494
Location: Canada eh?

PostPosted: Sun Mar 15, 2009 11:40 am    Post subject: Reply with quote

localhost wrote:
Uhh, i would find a new host! I know atleast 5 free hosts that allow MySQL databases.

txt databases are VERY insecure... Though they are usually much faster.


Most that I find have adds , like 007sites, Evo and 7gb have my sql, but their permissions are messed, always giving me a 403.

Oh and time to rep.

_________________
Back to top
View user's profile Send private message Send e-mail
Localhost
I post too much
Reputation: 0

Joined: 28 Apr 2007
Posts: 3402

PostPosted: Sun Mar 15, 2009 11:54 am    Post subject: Reply with quote

AlbanainRetard wrote:
localhost wrote:
Uhh, i would find a new host! I know atleast 5 free hosts that allow MySQL databases.

txt databases are VERY insecure... Though they are usually much faster.


Most that I find have adds , like 007sites, Evo and 7gb have my sql, but their permissions are messed, always giving me a 403.

Oh and time to rep.


x10hosting i think it is called. Not much space... But it rocks Very Happy

_________________
Back to top
View user's profile Send private message MSN Messenger
SXGuy
I post too much
Reputation: 0

Joined: 19 Sep 2006
Posts: 3551

PostPosted: Sun Mar 15, 2009 4:50 pm    Post subject: Reply with quote

http://agilityhoster.com i loved it so much, i actually upgraded to a paid subscription Razz

so many freebies included in the free hosting account you cant go wrong.

Some php functions are disabled as a free host, but then what do u expect.
Back to top
View user's profile Send private message
AlbanainRetard
Master Cheater
Reputation: 0

Joined: 02 Nov 2008
Posts: 494
Location: Canada eh?

PostPosted: Sun Mar 15, 2009 7:59 pm    Post subject: Reply with quote

Anyone got a host that call have files 5mb+?
_________________
Back to top
View user's profile Send private message Send e-mail
SXGuy
I post too much
Reputation: 0

Joined: 19 Sep 2006
Posts: 3551

PostPosted: Mon Mar 16, 2009 3:19 am    Post subject: Reply with quote

agilityhoster.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites