PDA

View Full Version : explode


pyro.699
01-11-2006, 12:30 AM
-.- my last thread wasent answered -.- (i posted it on ohte sites, ahd about 40 replies in an hour -.-)

anyway... i have susfully created a cd-key validator...
at the moment it checks in a file to see if the key is there

$file = file_get_contents("keys.1");
$savedcodes = explode(',', $file);
$key = "$A-$B-$C-$D-$E-$F";
if(array_search($key, $savedcodes) !== false)

the file looks liek this

key1,key2,key3

i want it to look like this

key1
key2
key3


now, my only problem, is that it has to all be on one line, and i need them all to be on seperate lines.... because of tagging, for when a key is used...

i have tryed \n adding an enter in brackets, and non of this works, please help me :)

sabret00the
01-11-2006, 01:28 PM
change $savedcodes = explode(',', $file);
to $savedcodes = explode("\n", $file);

for future reference: \n only works between double quotes :)

pyro.699
01-11-2006, 06:43 PM
it dosent seem to work, it only works if i use the code on the first line, and aslong as theres nothing under it

sabret00the
01-14-2006, 10:06 PM
try $savedcodes = explode(' . "\n" . ', $file);