Jump to content

Mattyspatty

Members
  • Posts

    76
  • Joined

  • Last visited

Everything posted by Mattyspatty

  1. im struggling on something im trying to do with a cookie and a PHP generated image. the user visits a page, they have cookie data and i want the image to be able to read the cookie data. so far the image can show the IP through the REMOTE_ADDR thingybob :P. check it out here. [url=http://mattyspatty.com/image.php]mattyspatty.com/image.php[/url] [url=http://mattyspatty.com/counter.php?id=mattyspatty&a=image]http://mattyspatty.com/counter.php?id=mattyspatty&a=image[/url] these identical, because im using mod_rewrite. perhaps this is a problem? on my image creation page(counter.php), the cookie "ME" is checked for existance, if it DOES NOT exist then ME is set to "not logged in".  on the image.php page, i have set "ME" to "mattyspatty" but it is not passing through.  i hope this is detailed enough for some feedback! im very tired and this problem is really irritating me!
  2. hi, i hope i can get a speedy response to this its driving me nuts! im trying to create a website, currently my pages are includes on an index page; [b][color=green]mydomain.com/[/color][color=red]index.php?page=[/color][color=green]home[/color][/b] (for example) My problem is that i want to remove the red bits, i.e. [b][color=green]mydomain.com/home[/color][/b]  thus creating a nice simple and easy to navigate adressing system. ive managed to do this with mod_rewrite but i also want to completely BLOCK the abilty for users to view anything by typing the full address, as in the first example (this includes my images and other files) i have tried to block pages that have an extension to their address i.e. test.php but i always get a loop or nothing happens! perhaps i have been doing something wrong. All constructive responses are much appreciated! thanks in advance, Matty
  3. you could use substr to find the first letter and then keep printing the results until the letter changes then print B (or whatever letter it is) and continue. [code=php:0] $letter = ""; $result = @mysql_query("SELECT * FROM artist ORDER BY name ASC"); while ($row = mysql_fetch_assoc($result)) {     if($letter != substr($row['name'],0,1) {         echo substr($row['name'],0,1);     }     echo "<a href=index.php?artist=".$row[artist_id].">".$row[name]."</a><br/>"; } ?> [/code] theres some pretty basci code i just whipped up you'll want to change it as you need :)
  4. http://uk2.php.net/show_source hope this helps, its a really useful function :D
  5. ok i have found out what was causing the error [code]document.getElementById('include_area').innerHTML = response;[/code] will not run, it gets upto that line and errors when i click my problem link. [code]document.getElementById('include_area').innerHTML = "test";[/code] the above code worked fine!!, i can only assume it is the page i am including causing a problem, i took a wild last hope attempt at trying anything just to see if it works an i almost had a heart attack! i have a FORM on the page i was including, i deleted that and all was fine and dandy!!! ill be able to sleep tonight ;) its just one of those things i guess... thanks for your input guys much appreciated :) Matty
  6. its hard to understand exactly what you mean, i [b]think[/b] i understand...  are you trying to order the suppliers by number of discrepancies in a <table> and in an adjacent table row have various bits of data?
  7. by "not logged in but online" do you mean they are on the website, but not logged in? i can only suggest a cookie that updates a database or something just as you do with logged in members.
  8. i think i understand, you want a preview like: welcome to my page, some of the text has been removed to make it shorter! shows as welcome to my page, some... you can use this => [url=http://uk2.php.net/substr]http://uk2.php.net/substr[/url]
  9. [quote author=ober link=topic=113898.msg463651#msg463651 date=1162826953] eh... I've run into that error before.  It's an absolute whore to troubleshoot.  IE sucks [s]for this kinda stuff.[/s][/quote] ye its really annoying.. and, im not amazing at javascript but ill have a good go at alerting everything to find the problem, the new object instance idea sounds hopeful too. thanks for your input, ill let you know if i have any more problems. Matty
  10. no sorry, i am using my local computer to create this page and i dont want to give access to random people! i cant understand this problem, its only 1 link thats not working it makes no sense to me whatsoever :(  thanks, matty
  11. hmm that didnt seem to work :( i had a look at the FF JSconsole and i got an error about document.getElementById(). i refreshed the js file and now FF shows no error. i did notice this however: line 26: document.getElementById('include_area').innerHTML = response; line 27: break; maybe its "document.getElementById('include_area')" erroring?  i have used <div id="include_area"></div> but i dont see whats wrong with that!
  12. ah, i misunderstood your question, i know what you are trying to do now. take a look at this, it should tell you what you need [url=http://www.w3schools.com/sql/sql_join.asp]http://www.w3schools.com/sql/sql_join.asp[/url]
  13. hehe, forgot about that... shoot me now! it just says "unknown runtime error" line 27, char 4, index2.php. the links and ajax inclusion are on index2.php
  14. well i use this method alot to read everything in a table [code] $query = mysql_query("SELECT `username` FROM `User_Table`"); while($row = mysql_fetch_array) {     echo $row['username'] . "<br/>"; } [/code] which would print out the username in each row, within the loop you [b]could [/b] do another query (but remember to use different names to $row, and $query. Such as $row2) but i guess you could just inner join
  15. Hey i hope i can get some help on this one its really bugging me, i have a page that has links on and when you click the links a different page is included in the body of the page, all my links are fine except 1! it only stops working in IE, in FF its fine. All other links i have tried work perfectly fine in both IE and FF buts its just this 1 link that messes up IE! [code] <td height="1" align="center"><a onClick="include('home')" href="#">Home</a></td> <td height="1" align="center"><a onClick="include('military')" href="#">Military</a></td> <td height="1" align="center"><a onClick="include('construction')" href="#">Construction</a></td> <td height="1" align="center"><a onClick="include('inbox')" href="#">Messages</a></td> <!--Its this link that errors--> <td height="1" align="center"><a onClick="logout()" href="#">Logout</a></td>[/code] i dont have a clue whats up with it, i guess its just IE is being a (*&$^ about it [code] function createRequestObject(){ var request_o; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ request_o = new ActiveXObject("Microsoft.XMLHTTP"); }else{ request_o = new XMLHttpRequest(); } return request_o; } var page = createRequestObject(); var stat = createRequestObject(); function include(myPage){ statsbar_update(); //alert(myPage); myForm = code_body; page.open('get', 'includes.php?page=' + myPage); page.onreadystatechange = handleInclude; page.send(null); } function handleInclude(){ switch(page.readyState) { case 4: var response = page.responseText; document.getElementById('include_area').innerHTML = response; break; default: document.getElementById('include_area').innerHTML = "Querying, Please Wait..."; page.onreadystatechange = handleInclude; } } function statsbar_update() { stat.open('get', 'statsbar.php'); stat.onreadystatechange = handleStatsbar; stat.send(null); } function handleStatsbar() { switch(stat.readyState) { case 4: var response = stat.responseText; document.getElementById('statsbar_area').innerHTML = response; break; default: document.getElementById('statsbar_area').innerHTML = "Querying, Please Wait..."; stat.onreadystatechange = handleStatsbar; } } [/code] (optimisation comments appreciated;)) thanks in advance, Matty
  16. [!--quoteo(post=371725:date=May 5 2006, 11:18 PM:name=Cruisecar)--][div class=\'quotetop\']QUOTE(Cruisecar @ May 5 2006, 11:18 PM) [snapback]371725[/snapback][/div][div class=\'quotemain\'][!--quotec--] Your a genious, I knew all of the stuff you said - I just didn't piece it together. Thankyou! [/quote] happy to help :D if you can find the solved button, using it is much appreciated here!
  17. hi, i noticed caeser hasnt replied, so ill try n help [code] function chance($input) {   $rand= rand(0, 100) //get a number, 0 - 100   if($rand > $input) { /*if the number is more than random then its outside the percentage. e.g. $rang = 80  and $input = 60 then the rand is part of the 40%.*/     return 1; //outside the chance%   } else {     return 0; //inside the chance%   } } [/code] im not 100% sure how you return values in PHP, ive kinda forgotten :P. but that should work good :)
  18. [!--quoteo(post=367206:date=Apr 21 2006, 02:58 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Apr 21 2006, 02:58 PM) [snapback]367206[/snapback][/div][div class=\'quotemain\'][!--quotec--] Do something like this: [code]$_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'][/code] $_SERVER['QUERY_STRING'] gets everthing after the ? in the url. [/quote] thanks this helped, but i found this on PHP.net rather than using <?=$_SERVER['PHP_SELF']?> or <? echo $_SERVER['PHP_SELF']?> this: <? $_SERVER['PHP_SELF']?> (no 'printing') will not show an action but WILL keep the variables! wheres the bloody solved button got to??
  19. i have a form that will target the current page, including any GET vars. heres one example -> [a href=\"http://localhost/game/main.php?page=login\" target=\"_blank\"]http://localhost/game/main.php?page=login[/a] but when using PHP_SELF i only get this -> /game/main.php im sure i managed to do this at one point, but my minds gone blank and ive upgraded and formatted my PC since then so i have lost any trace of it! i had a quick search, didnt find any answers. thanks in advance!
  20. thanks for the reply. how i had my query is right, maybe i should have explained the table. it has card_id 1 to 52 and card value 2 to 11. the id is its position in the deck, and value its what card it is. eg card value 4 is a 4,value 11 is an ace, and the J,Q and K are value 10. the suit is of no use. its just not collecting enough rows. i tested the value of $c and it properly increments but then i count $draw and it only returns 2 :S, which i am assuming means its only fetching 2 rows.
  21. are you having the comparison on a 'next page' so to speak? if so you should use the POST function to collect all the data. if you want to revisit the comparison page whenever you feel like it then i think you should use the database method.
  22. $_SERVER['PHP_SELF'] // returns /my_page.php
  23. $res = mysql_query("SELECT card_id FROM bj ORDER BY RAND()"); $draw = mysql_fetch_array($res); $c = 0; $dcard = ",".$draw[$c]; $c++; $dcard .= ",".$draw[$c]; $c++; $pcard = ",".$draw[$c]; $c++; $pcard .= ",".$draw[$c]; $c++; echo count($draw); basically im creating a blackjack game, the dealer and player each are drawn 2 cards. but the count only returns 2?!?! its really bugging me, ive tried using LIMIT in the query, to no avail... does anyone have any other suggestions? i need to keep the query so i can keep referring to it, without getting duplicate cards, later in my script note: if my syntax looks 'tacky' i dont care ;)
  24. double check your using the correct password, i am assuming ur doing it on your local machine so that souldnt be much of a problem, also can u login to the database with those user/pass if u can then make sure the inc file is correctly included
×
×
  • 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.