Jump to content

richarro1234

Members
  • Posts

    146
  • Joined

  • Last visited

Everything posted by richarro1234

  1. Hello all, im having a bit of trouble with this peice of code: <script language="javascript" type="text/javascript"> <!-- //Browser Support Code function ajaxFunction(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.getElementById('status'); ajaxDisplay.innerHTML = ajaxRequest.responseText; } } var status = document.getElementById('mystatus').value; var queryString = "?status=" + status; ajaxRequest.open("GET", "status.php" + queryString, true); ajaxRequest.send(null); //alert(queryString); } //--> </script> <form> <?= $r['name'] ?> <input id="mystatus" value="<?= $r['mystatus'] ?>" name="mystatus" size="30" style="color:#990000; font-weight:bold"> <input class="button" onClick="ajaxFunction();" value="Enter" type="button"> </form> <div id='status'></div> </td> </tr> <tr> <td class="four">Select your mood:</td> </tr> <tr> <td class="four"> <script language="javascript" type="text/javascript"> <!-- //Browser Support Code function setmood(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.getElementById('mood'); ajaxDisplay.innerHTML = ajaxRequest.responseText; } } var status = document.getElementById('mymood').value; var queryString = "?mood=" + mood; ajaxRequest.open("GET", "mood.php" + queryString, true); ajaxRequest.send(null); alert(queryString); } //--> </script> <form> <select id="mymood" onChange="setmood();"> <option value="Accepted">Accepted</option> <option value="Accomplished">Accomplished</option> <option value="Aggravated">Aggravated</option> <option value="Alone">Alone</option> <option value="Amused">Amused</option> <option value="Angry">Angry</option> <option value="Annoyed">Annoyed</option> <option value="Anxious">Anxious</option> <option value="Apathetic">Apathetic</option> <option value="Ashamed">Ashamed</option> <option value="Awake">Awake</option> <option value="Bewildered">Bewildered</option> <option value="Bitchy">Bitchy</option> <option value="Bittersweet">Bittersweet</option> <option value="Blah">Blah</option> <option value="Blank">Blank</option> <option value="Blissful">Blissful</option> <option value="Bored">Bored</option> <option value="Bouncy">Bouncy</option> <option value="Calm">Calm</option> <option value="Cheerful">Cheerful</option> <option value="Chipper">Chipper</option> <option value="Cold">Cold</option> <option value="Complacent">Complacent</option> <option value="Confused">Confused</option> <option value="Content">Content</option> <option value="Cranky">Cranky</option> <option value="Crappy">Crappy</option> <option value="Crazy">Crazy</option> <option value="Crushed">Crushed</option> <option value="Curious">Curious</option> <option value="Cynical">Cynical</option> <option value="Dark">Dark</option> <option value="Depressed">Depressed</option> <option value="Determined">Determined</option> <option value="Devious">Devious</option> <option value="Dirty">Dirty</option> <option value="Disappointed">Disappointed</option> <option value="Discontent">Discontent</option> <option value="Ditzy">Ditzy</option> <option value="Dorky">Dorky</option> <option value="Drained">Drained</option> <option value="Drunk">Drunk</option> <option value="Ecstatic">Ecstatic</option> <option value="Energetic">Energetic</option> <option value="Enraged">Enraged</option> <option value="Enthralled">Enthralled</option> <option value="Envious">Envious</option> <option value="Exanimate">Exanimate</option> <option value="Excited">Excited</option> <option value="Exhausted">Exhausted</option> <option value="Flirty">Flirty</option> <option value="Frustrated">Frustrated</option> <option value="Full">Full</option> <option value="Geeky">Geeky</option> <option value="Giddy">Giddy</option> <option value="Giggly">Giggly</option> <option value="Gloomy">Gloomy</option> <option value="Good">Good</option> <option value="Grateful">Grateful</option> <option value="Groggy">Groggy</option> <option value="Grumpy">Grumpy</option> <option value="Guilty">Guilty</option> <option value="Happy">Happy</option> <option value="High">High</option> <option value="Hopeful">Hopeful</option> <option value="Hot">Hot</option> <option value="Hungry">Hungry</option> <option value="Hyper">Hyper</option> <option value="Impressed">Impressed</option> <option value="Indescribable">Indescribable</option> <option value="Indifferent">Indifferent</option> <option value="Infuriated">Infuriated</option> <option value="Irate">Irate</option> <option value="Irritated">Irritated</option> <option value="Jealous">Jealous</option> <option value="Jubilant">Jubilant</option> <option value="Lazy">Lazy</option> <option value="Lethargic">Lethargic</option> <option value="Listless">Listless</option> <option value="Lonely">Lonely</option> <option value="Loved">Loved</option> <option value="Mad">Mad</option> <option value="Melancholy">Melancholy</option> <option value="Mellow">Mellow</option> <option value="Mischievous">Mischievous</option> <option value="Moody">Moody</option> <option value="Morose">Morose</option> <option value="Naughty">Naughty</option> <option value="Nerdy">Nerdy</option> <option value="Not Specified">Not Specified</option> <option value="Numb">Numb</option> <option value="Okay">Okay</option> <option value="Optimistic">Optimistic</option> <option value="Peaceful">Peaceful</option> <option value="Pessimistic">Pessimistic</option> <option value="Pissed off">Pissed off</option> <option value="Pleased">Pleased</option> <option value="Predatory">Predatory</option> <option value="Quixotic">Quixotic</option> <option value="Recumbent">Recumbent</option> <option value="Refreshed">Refreshed</option> <option value="Rejected">Rejected</option> <option value="Rejuvenated">Rejuvenated</option> <option value="Relaxed">Relaxed</option> <option value="Relieved">Relieved</option> <option value="Restless">Restless</option> <option value="Rushed">Rushed</option> <option value="Sad">Sad</option> <option value="Satisfied">Satisfied</option> <option value="Shocked">Shocked</option> <option value="Sick">Sick</option> <option value="Silly">Silly</option> <option value="Sleepy">Sleepy</option> <option value="Smart">Smart</option> <option value="Stressed">Stressed</option> <option value="Surprised">Surprised</option> <option value="Sympathetic">Sympathetic</option> <option value="Thankful">Thankful</option> <option value="Tired">Tired</option> <option value="Touched">Touched</option> <option value="Uncomfortable">Uncomfortable</option> <option value="Weird">Weird</option> </select><input class="button" onClick="setmood();" value="Enter" type="button"> </form> <div id='mood'></div> The first bit works fine, i can type in a "status" click update and it will update the database and output a msg underneath it saying "status updated successfully". But the second bit (with the dropdown list) doesnt work atall. i have uncommented the bit to display what its sending to the database so that i can see whats happening, but all its showing is "[object HTMLDivElement]" rather then whats selected from the dropdown list. can someone please help me sort out this code so that both bits will work as there meant to thanks Rich
  2. Hello all, im having a bit of trouble with this peice of code: <script language="javascript" type="text/javascript"> <!-- //Browser Support Code function ajaxFunction(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.getElementById('status'); ajaxDisplay.innerHTML = ajaxRequest.responseText; } } var status = document.getElementById('mystatus').value; var queryString = "?status=" + status; ajaxRequest.open("GET", "status.php" + queryString, true); ajaxRequest.send(null); //alert(queryString); } //--> </script> <form> <?= $r['name'] ?> <input id="mystatus" value="<?= $r['mystatus'] ?>" name="mystatus" size="30" style="color:#990000; font-weight:bold"> <input class="button" onClick="ajaxFunction();" value="Enter" type="button"> </form> <div id='status'></div> </td> </tr> <tr> <td class="four">Select your mood:</td> </tr> <tr> <td class="four"> <script language="javascript" type="text/javascript"> <!-- //Browser Support Code function setmood(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.getElementById('mood'); ajaxDisplay.innerHTML = ajaxRequest.responseText; } } var status = document.getElementById('mymood').value; var queryString = "?mood=" + mood; ajaxRequest.open("GET", "mood.php" + queryString, true); ajaxRequest.send(null); alert(queryString); } //--> </script> <form> <select id="mymood" onChange="setmood();"> <option value="Accepted">Accepted</option> <option value="Accomplished">Accomplished</option> <option value="Aggravated">Aggravated</option> <option value="Alone">Alone</option> <option value="Amused">Amused</option> <option value="Angry">Angry</option> <option value="Annoyed">Annoyed</option> <option value="Anxious">Anxious</option> <option value="Apathetic">Apathetic</option> <option value="Ashamed">Ashamed</option> <option value="Awake">Awake</option> <option value="Bewildered">Bewildered</option> <option value="Bitchy">Bitchy</option> <option value="Bittersweet">Bittersweet</option> <option value="Blah">Blah</option> <option value="Blank">Blank</option> <option value="Blissful">Blissful</option> <option value="Bored">Bored</option> <option value="Bouncy">Bouncy</option> <option value="Calm">Calm</option> <option value="Cheerful">Cheerful</option> <option value="Chipper">Chipper</option> <option value="Cold">Cold</option> <option value="Complacent">Complacent</option> <option value="Confused">Confused</option> <option value="Content">Content</option> <option value="Cranky">Cranky</option> <option value="Crappy">Crappy</option> <option value="Crazy">Crazy</option> <option value="Crushed">Crushed</option> <option value="Curious">Curious</option> <option value="Cynical">Cynical</option> <option value="Dark">Dark</option> <option value="Depressed">Depressed</option> <option value="Determined">Determined</option> <option value="Devious">Devious</option> <option value="Dirty">Dirty</option> <option value="Disappointed">Disappointed</option> <option value="Discontent">Discontent</option> <option value="Ditzy">Ditzy</option> <option value="Dorky">Dorky</option> <option value="Drained">Drained</option> <option value="Drunk">Drunk</option> <option value="Ecstatic">Ecstatic</option> <option value="Energetic">Energetic</option> <option value="Enraged">Enraged</option> <option value="Enthralled">Enthralled</option> <option value="Envious">Envious</option> <option value="Exanimate">Exanimate</option> <option value="Excited">Excited</option> <option value="Exhausted">Exhausted</option> <option value="Flirty">Flirty</option> <option value="Frustrated">Frustrated</option> <option value="Full">Full</option> <option value="Geeky">Geeky</option> <option value="Giddy">Giddy</option> <option value="Giggly">Giggly</option> <option value="Gloomy">Gloomy</option> <option value="Good">Good</option> <option value="Grateful">Grateful</option> <option value="Groggy">Groggy</option> <option value="Grumpy">Grumpy</option> <option value="Guilty">Guilty</option> <option value="Happy">Happy</option> <option value="High">High</option> <option value="Hopeful">Hopeful</option> <option value="Hot">Hot</option> <option value="Hungry">Hungry</option> <option value="Hyper">Hyper</option> <option value="Impressed">Impressed</option> <option value="Indescribable">Indescribable</option> <option value="Indifferent">Indifferent</option> <option value="Infuriated">Infuriated</option> <option value="Irate">Irate</option> <option value="Irritated">Irritated</option> <option value="Jealous">Jealous</option> <option value="Jubilant">Jubilant</option> <option value="Lazy">Lazy</option> <option value="Lethargic">Lethargic</option> <option value="Listless">Listless</option> <option value="Lonely">Lonely</option> <option value="Loved">Loved</option> <option value="Mad">Mad</option> <option value="Melancholy">Melancholy</option> <option value="Mellow">Mellow</option> <option value="Mischievous">Mischievous</option> <option value="Moody">Moody</option> <option value="Morose">Morose</option> <option value="Naughty">Naughty</option> <option value="Nerdy">Nerdy</option> <option value="Not Specified">Not Specified</option> <option value="Numb">Numb</option> <option value="Okay">Okay</option> <option value="Optimistic">Optimistic</option> <option value="Peaceful">Peaceful</option> <option value="Pessimistic">Pessimistic</option> <option value="Pissed off">Pissed off</option> <option value="Pleased">Pleased</option> <option value="Predatory">Predatory</option> <option value="Quixotic">Quixotic</option> <option value="Recumbent">Recumbent</option> <option value="Refreshed">Refreshed</option> <option value="Rejected">Rejected</option> <option value="Rejuvenated">Rejuvenated</option> <option value="Relaxed">Relaxed</option> <option value="Relieved">Relieved</option> <option value="Restless">Restless</option> <option value="Rushed">Rushed</option> <option value="Sad">Sad</option> <option value="Satisfied">Satisfied</option> <option value="Shocked">Shocked</option> <option value="Sick">Sick</option> <option value="Silly">Silly</option> <option value="Sleepy">Sleepy</option> <option value="Smart">Smart</option> <option value="Stressed">Stressed</option> <option value="Surprised">Surprised</option> <option value="Sympathetic">Sympathetic</option> <option value="Thankful">Thankful</option> <option value="Tired">Tired</option> <option value="Touched">Touched</option> <option value="Uncomfortable">Uncomfortable</option> <option value="Weird">Weird</option> </select><input class="button" onClick="setmood();" value="Enter" type="button"> </form> <div id='mood'></div> The first bit works fine, i can type in a "status" click update and it will update the database and output a msg underneath it saying "status updated successfully". But the second bit (with the dropdown list) doesnt work atall. i have uncommented the bit to display what its sending to the database so that i can see whats happening, but all its showing is "[object HTMLDivElement]" rather then whats selected from the dropdown list. can someone please help me sort out this code so that both bits will work as there meant to thanks rich
  3. hey thanks for that laffin, it now doesnt show up, if theres nothing in the address bar. but if i put anything else in there, then it works, so, if i put signup.php?id=1 then the whole form shows up. rather then it bein signup.php?userid=1&useremail=<email>&hash=<hashkey> Rich
  4. darksuperhero: here is the code include("data.php"); //include("funktioner.php"); mysql_connect($server,$anvandare, $losen); mysql_select_db($databas); $query1 = mysql_query("SELECT * from richspri_social.invites where userid = '$id' && useremail = '$useremail' && hash = '$hash'") or exit( mysql_error() ); $inv = mysql_fetch_array($query1); laffin: ok thanks, well i have the db all sorted, im just trying to get that bit working so that i can hide the form if someone is trying to sign up normally or trying to guess information to let them signup. Thanks rich
  5. hey all, i cant seem to get the code working to hide it, im not sure if i have it wright or not, its worked before one other stuff, but it still shows the form. the idea is that it checks the URL for the useremail, id and hash if all 3 match then it shows the form, if not then it shows an error. This is the code i have for that bit: <? if ($inv['userid'] != $id && $inv['useremail'] != $useremail && $inv['hash'] != $hash){ ?> !!ERROR!! <?} else { ?> <? require("inc/signup.php");?> <?}?> Thanks Rich
  6. ok thanks, will give it ago, if i get stuck on anything i will post for help Thanks Rich
  7. sorry, sure. well its like what gmail had when they first started up. basically the current user list (my friends i have who are helping me code it and test for bugs) enter an email addres of a friend they want to sign-up to the website, then the user receives an email with a link in there to sign up using a generated code. which then gives them full access to the site. Thanks Rich
  8. Hey there, Im wondering how to start building an invite only system. i have a few ideas on how to start but not sure if any of them are right or whether they would work. can someone help me get started and tell me how i could implement it into my website before i open it up for alpha release. Thanks in advance Rich
  9. hey thanks for that just lookin at how to take it apart and use it for what im after Rich
  10. Thanks mjdamato, that works great, what about if all the prices are set in a DB? so the max and min prices are in the DB, along with some other properties to help change the price (each item will have unique properties which will also help influence the price changes.) Thanks Rich
  11. mark, the one you posted doesnt do anything, it just shows a white screen? not sure what its meant to show.
  12. thanks for that mark. i tried to copy and paste it into a page so that i can see what it looks like on a website, but it came up with loads of errors and took up about 1800 lines. Rich
  13. Well all the information will be stored in a db anyway, to make things easier to change if need be. Thanks for the help, i done what you said and changed it to 4,10 and multiplied by 1mill at the end and it works fine now thanks, onlything is it still drops below 4mill and still abit of a dramatic drop (sometimes from 10-6) but with a bit of editing im sure i can get that sorted. P.S what is "value" for? what does it do? thanks for the help, will post if i have any more questions Thanks Rich
  14. Thanks for the quick response a few questions about the code you provided. How can i make it so that its only whole numbers (to the nearest million)? $change_factor = ($max - $min) / 2; //How much it can go up/down by Is that the bit to stop it from dropping from 10m to 4m? (gradual increase/decrease in price) How would i change it to only change at certain times? (every 30 mins or so) rather then every page refresh? Basically this is like a stock market, buy low and sell high. Thanks Rich
  15. Hello there, What im after is to be able to set (in a database) 2 prices for an item (a min. and a max.) and have some php code randomly select a price between those to numbers, but not too far apart in the oppisite direction. So for example, say i have a bank, max price of 10,000,000 min price of say 4,000,000. i would start it off at 7mil (just because its in between the 2 numbers) what i would like is to have the price either go up or go down from that 7 million, but obviously not exceed the min/max price. so say it starts at 7mill, i would like it to eaither randomly go up to 8, or 9, or even 10, then it either (still at random) stay at 10mill or drop to something like 8mill. not drop too low, like to 4mill. but gradually increase and decrease each time, the time it changes will either be every 20 mins or every 30 mins, or maybe every hour. How can i go about doing such a task? Thanks for you help, if you have any questions or i didnt explain clearly enough then please ask and i will be happy to answer. Thanks Rich
  16. ok thanks, should have fixed this now, if you can still post can u let me no please. Thanks
  17. i think ajax would be the way forwards for this. i just done a quick search on google about updating the DB and found a few script examples i might have a look at and see if i can find some usefull tutorials to help me on the way. Thanks for the help guys Rich
  18. Hello, i would like to know if its possible to have a form that will allow someone to update a text field with an onlcik (of offclick) so for instance, if i was to update my mood, it would show my current mood (which is set in the database) then, when i click on it, it will change to a text field so i can type my new mood in there, then when i click outside the box, it will save my mood as what i just typed. or maybe just have a "post" button next to the text, but it doesnt load a new page so it just updates the database without the page bein reloaded. Thanks Rich
  19. no, it doesnt show an error anymore it just shows up but when i remove the print_r() it doesnt show anything (and its onviously meant to show the firends).
  20. it just shows up as "SELECT * FROM friends WHERE myid='1' AND friendsid='1' LIMIT 5 " print_r($query12=" SELECT * FROM friends WHERE myid='$urid' AND friendsid='$urid' LIMIT 5"); $result=mysql_query($query12) or die ('Error: '.mysql_error ()); $num=mysql_numrows($result);
  21. hey there, im trying to cut down on the size of my database by checking for a users id in 2 collums of a database. here is the code i have but for some reason it doesnt work? <?php $query12=" SELECT * FROM friends WHERE myid='$urid' and friendsid='$urid' LIMIT 5"; $result=mysql_query($query12) or die ('Error: '.mysql_error ()); $num=mysql_numrows($result) or die ('Error: '.mysql_error ()); $i=0; while ($i < $num) { $myid=mysql_result($result,$i,"myid"); $friendsid=mysql_result($result,$i,"friendsid"); $query10 = mysql_query("SELECT * from users WHERE id = $friendsid " ); while ($fr = mysql_fetch_array($query10)) { $friendspic = $fr['picture']; $friendsname = $fr['username']; } ?> that just comes back as "Error:" and doesnt show a message or anything. Can someone please tell me how i can get this to work. Thanks Rich
  22. yea but its for a certain function. Here is the code for that bit: ...some site code above here.... if ($_GET['action'] == 'delete') { $padid = ($_GET['padid']); $query = mysql_query("SELECT * from richspri_social.padposts WHERE id = '$padid'"); while ($pad = mysql_fetch_array($query)) { if (strtoupper($pad['posterid']) != strtoupper($urid)) { header ("Location: $page&error=5"); die(); } $there = "yes"; } if ($there == FALSE) { header ("Location: $page&error=6"); die(); } $query = mysql_query("DELETE FROM richspri_social.padposts WHERE id = '$padid'"); echo "Success!"; } ....rest of the site code.... Thanks
  23. yea thats what i want and it works great, thanks. but is there anyway of choosing where it echo's as all the code is at the top of my page and i would like it to echo near the bottom of my page? Thanks
  24. Hey there, im trying to make it so that i can echo a message after a succesful SQL query, without having to load a new page. So the query can be run and if it works it will echo a successful msg, but if it fails it will echo a msg (that isnt the mysql error:) Here is the code: $query = mysql_query("DELETE FROM <tablename> WHERE id = '$padid'"); header ("echo: testing?"); die(); thats the sort of thing i would like, how would i go about doin that please? Thanks Rich
×
×
  • 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.