Jump to content

Eejut

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Everything posted by Eejut

  1. Hiya Ken, it's not generating any yellows, pinks, greys, blues etc here.. all I seem to get is variations of green, orange, red and brown lol I'll try what you've put there bocasz, I was wondering if there was an efficient way of doing it like that.. this looks like what I needed Thanks dudes :-)
  2. I must be doing something wrong here.. So I've figured the decimal (not rgb "decimal") equivalent of ffffff (white) is 16777215 Basic test here.. in theory.. every time the page refreshes it should generate a random colour (UK spelling) from 0 (black) to ffffff (white).. but it doesn't seem to be covering the entire spectrum.. it only seems to be generating shades of green, brown, orange, red <?php $colour = rand(0,16777215); $colour = dechex($colour); echo "<body bgcolor='#$colour'>"; ?> Maths isn't my strongest subject.. just wondering where I'm going wrong here
  3. Thanks for cleaning up the code and that works fine now I made the same changes for another loop checking a different file and for a while was still getting the same error but this time it was because there were 2 new lines at the end of that file!.. I'm going to learn mysql once this project is finished Ta
  4. Sure.. here are the relevant bits.. $chatname=$_GET["chatname"]; //get viewer's id number $idnumber; $getid = fopen('nunyabiz.txt','r'); if (!$getid) {echo 'ERROR1: Unable to open file.<br>'; exit;} while (!feof($getid)) { $line = fgets($getid, 1024); //use 2048 if very long lines if ($line != "" || $line != "\n") { list ($name, $pass, $fileidnumber) = explode ('|', $line); if ($chatname == $name) { $idnumber=$fileidnumber; } } $getid++; } fclose($getid);
  5. Yes that's the only way around it from what I've read.. and ideally an email address which is an ISP email addy.. as opposed to hotmail, yahoo mail etc.. that's how some of 'em are doing it out there. From what I've found out so far there's no way of stopping anyone from using proxy IPs and deleting cookies etc.
  6. Thanks for the help.. I've tried explode but it still keeps nagging about this "undefined offset" palarva The text file basically looks like this.. Rod|hello|1 Jane|noodles|2 Freddie|walrus|3 The first field is username, 2nd field is password, 3rd field is id number I'm using this line now instead (thanks for letting me know about "split" depreciation btw).. list ($name, $pass, $id) = explode ('|', $line); The silly thing is still complaining about undefined offsets (1 and 2 in this case)
  7. Hi, I've got a flat file/text file which I'm currently using as a member database for my site (not advisable I know.. but still learning here). In a section of code I need to separate the fields to make various checks later in the code I use this line to do that.. list ($name, $pass, $fileidnumber) = split ('\|', $line); Yet.. I keep getting "undefined offset" messages.. even when all 3 fields are filled in for all records.. eg.. Fred|bonkers|3\n Is it the new line causing the problem? Also, the server is a bit peculiar in behaviour, it won't let me upload empty text files to start with (0kb).. the only way around it is for me to add a blank line or something to make it at least 1kb so the server notices it.. so in other words.. if Fred's record was the only one in the database, there'd be a space (I guess) underneath his record (all future records are added to the top of the file, but the space will always come last when checking) If anyone out there can help or give ideas as to why this is happening I'd be grateful.. thanks
  8. Yes you're right.. I was printing an extra " " at the beginning of the text file every time a user posted a comment.. sorted out now.. thanks
  9. I've just tested something else here to check if there really is a gap being added before $user_id .. and there must be .. even after trim is used!! I added this bit of experimental, temporary code.. which follows the use of trim.. trim ($user_id); echo "the user id is$user_id"; The output should be "the user id isEejut" (assuming my name is the user id).. but it outputs.. "the user id is Eejut" I then tried this instead.. trim ($user_id); echo "$user_id$user_id"; .. and the output is "Eejut Eejut" (yes, with a space.. and id is repeated on the same line.. therefore it can't be a new line.. can it?!) So.. for some bizarre reason trim is either being ignored or isn't trimming.. why could this be?? lol
  10. Just checked and it's ok.. isn't it? All I can guess is.. could it be a server issue?! .. the session_id variable isn't effected, I'd have thought even if there's a gap in the data it'd get removed Unless there's an invisible character (such as a new line or something) to the left of the first variable that trim isn't removing?? I know I should use mysql or something.. I'm planning on learning that soon instead of relying on flat files.. lol Thanks for help to date and any more that can be given
  11. Here's the code that uses //get list of active members $activemembers = file('activemembers.txt'); if (!$activemembers) {echo 'ERROR: Unable to open file.<br>'; exit;} foreach ($activemembers as $key => $line) { rtrim($line, "\n"); if ($line != " ") { list($user_id, $iponfile, $timestamponfile, $coloronfile, $passwordonfile, $session_id) = explode("|", $line); trim($user_id); echo "<tr><td><a onclick=\"window.open('http://www.***.com/page/options.php?user_id=$user_id&session_id=$session_id','options','width=590,height=200,toolbar=no,scrollbars=yes,resizable=yes,statusbar=no,directories=no,menubar=no,location=no');return false;\" href=\"\">$user_id</a></td></tr>"; } } As can be seen, I've added trim before outputting the hyperlink, hoping it would solve the space problem.. but the problem still persists If I replace user_id=$user_id .. with something like .. user_id=hello .. the space vanishes Am I using trim correctly?.. I'll admit to not having checked properly yet
  12. Hi, here's my problem.. I have a php generated page with a hyperlink which opens in a new window echo "<tr><td><a onclick=\"window.open('http://www.***.com/page/options.php?user_id=$user_id&session_id=$session_id','options','width=590,height=200,toolbar=no,scrollbars=yes,resizable=yes,statusbar=no,directories=no,menubar=no,location=no');return false;\" href=\"\">$user_id</a></td></tr>"; The problem occurrs at options.php?user_id=$user_id The resulting hyperlink on the generated page adds a space to the user id after the "=" So when options.php loads.. it results in the user's id having an extra %20 at the beginning of their name Example.. The first page links to this.. http://www.***.com/page/options.php?user_id= Eejut&session_id=12345 When options.php loads it prints.. "This is %20Eejut's Options Page" I've tried using trim($user_id) before printing the hyperlink to the main page (that calls options.php) and the space still occurrs in the hyperlink Anyone know what's going wrong?? thanks in advance
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.