Jump to content

Adam

Moderators
  • Posts

    5,717
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Adam

  1. $p->add_field('amount', $_POST['formtext1']); try that..
  2. Don't think anyone will just do it for you. If you do want someone to do it for you then I'd ask in the freelance section...
  3. Adam

    Hey

    Erm, very vague. What kind of code is it? If you mean return everything from within two tags, say a div element(?) you could use JavaScript with something like: var content = document.getElementById('yourElementsID').innerHTML; ... (or ".value" depending on the element, like an 'input' for example) ------------ To return the JS code I have no idea, don't know if you can? Need bit more information really... Adam
  4. Okay so the PHP script is called from the JavaScript using AJAX. You're then echo'in out all the variables (except $price) on the PHP side .. so firstly remember when you call a PHP script with AJAX, you only receive a string of text "searchReq.responseText" .. not the actual variables. So using $price isn't going to work... what you could do is format the and print out the string on the JS side. What I've done in the past is return the string in a var1|var2|var3 form .. then split the string into an array using the | as the delimitor. So for example: PHP echo $chartcode .'|'. $chartp .'|'. $chartdescription .'|'. $price ."\n"; JS var records = searchReq.responseText.split("\n"); for (x in records) { var str = searchReq.responseText.split('|'); var suggestTxt = str[0] + ' ' + str[1] + ' - ' + str[2]; var suggest = '<div onmouseover="javascript:suggestOver(this);" '; suggest += 'onmouseout="javascript:suggestOut(this);" '; suggest += 'onclick="javascript:setSearch(this.innerHTML, ' + str[3] + ');" '; suggest += 'class="suggest_link">' + suggestTxt + '</div>'; ss.innerHTML += suggest; } Then you'll just need to change the setSearch function to: function setSearch(value, price) { document.getElementById('chart_info').innerHTML = value + "Price: " + price; } Not tested this code so there by an error or two, but should work with a little tweaking! Adam
  5. How would view-source sort the problem? I don't actually think view-source is anything more than a browser command? (Though it's not actually supported in IE) .. I think sending view-source at the start of the file_get_contents function would just cause it to fail?
  6. Oh need to use "OR" not "||" Also I tested the query and it fails, I reckon it's because "character" has a meaning within mysql and it's causing an error in the SQL syntax using it as a table name. I renamed it to "players" and the messed with the query a little bit and came up with the following... This will return the 3 skill records for character #'1'.. SELECT * FROM Skill AS a, Players AS b WHERE (a.ID = b.Skill1 OR a.ID = b.Skill2 OR a.ID = b.Skill3) AND b.ID = '1' A typical return may look like: id name id player character type skill1 skill2 skill3 1 Sneak 1 John Doe Smooth Criminal Thief 1 2 3 2 Evade 1 John Doe Smooth Criminal Thief 1 2 3 3 Fight 1 John Doe Smooth Criminal Thief 1 2 3 This will return the skill info in skill slot 1 for character #'1'.. SELECT * FROM Skill AS a, Players AS b WHERE a.ID = b.Skill1 AND b.ID = '1' A typical return may look like: id name id player character type skill1 skill2 skill3 1 Sneak 1 John Doe Smooth Criminal Thief 1 2 3 -------------- The bottom line in each query sets the character in question in the query to '1'. You could very easily replace the 1 with a PHP variable such as the user's session id or a GET value sent in the URL like.. "skillInfo.php?id=##" .. Does that all make sense? Adam
  7. Ah sorry, misread what you said. I got the impression you were wanting the skill definitions for a certain character's skills.. like all 3 of them.. If you just wank Skill1's details, could use something like: SELECT * FROM Skill, Character WHERE Skill.ID = Character.Skill1 The previous query I showed you before is actually quite simple: SELECT * FROM Skill, Character AS b That just means select everything from Skill, and basically set "b" as a kind of variable for the Character table, so instead of having to go: WHERE Skill.ID = Character.Skill1 || Skill.ID = Character.Skill2 || Skill.ID = Character.Skill3 can just use: WHERE ID = b.Skill1 || ID = b.Skill2 || ID = b.Skill3 And obviouslly that's just finding skill records where the skill ID matches that in either skill slot 1, 2 or 3 of the character... Did I describe that well :S Adam
  8. That just moves all the log entries up a file.. like from file 1 to 2.. file 2 to 3 etc.. however frequently you set up the cron to run. There's nothing limiting the logs to 100 entries though.. I'm a little unsure myself about how you could do it..
  9. Using a database would be simpler for limiting the entries, if you have one available too you? Adam
  10. 23,1 |5,1 |5,1 I assume the ",1" after each is the rank achieved? Would make it easier if you perhaps used: Skill 1 | Skill 1 Rank | Skill 2 | Skill 2 Rank | etc. ..as the fields? Then you could go like... SELECT * FROM Skill, Character AS b WHERE ID = b.Skill1 || ID = b.Skill2 || ID = b.Skill3 (not tested) .. but that should return their 3 skills...
  11. $source = file_get_contents("http://mysite.com/"); will return the source...
  12. Huh yeah not noticed that... Yeah they're stored in YYYY-MM-DD format but for some reason the query still works? Odd! Adam
  13. Good explanation of the function used here: http://uk3.php.net/fgetcsv But.. basically while the variable $data still reads from the csv file and does not = false, do that code...
  14. Hah I went through this just the other day, was a bit of a nightmare.. I'll give you a big help though and show you the MySQL syntax for selecting between two dates: SELECT * FROM yourTable WHERE yourDateField BETWEEN 'YYYY-MM-DD' AND 'YYYY-MM-DD' That assumes in the database table each record has a single date. Then the range of dates will replace the two YYYY-MM-DD 's, i don't know if you have two fixed dates in mind or if you're going to have a form for the user to select.. but that should help you on your way..
  15. OR if that doesn't work: VALUES ('" .$row['realname']. "',
  16. Do they need to be in form of 1, 2, 3, 4 etc ?? If not just create yourself a naming formula like.. md5(TodaysDate_TimeToTheSecond_Random4DigitNum) Chances are like 1 in 10 thousand per second that someone will ever get the same number.. or something daft! If they do need to be in order, could loop through, eg: $x = 1; while ( !file_exists($x . '.jpg')) { $x++; } $filename = $x . '.jpg'; ..not tested though! If you had a lot of uploads however, and it gets to like 300.jpg, or even 3000.jpg, don't wanna have to loop through each time. so could use a database or flatfile or something to store the current count... Adam
  17. try using http://uk3.php.net/zip
  18. $row = mysqli_fetch_assoc($result); .. returns an array. you need to use: $row['realname'] in: VALUES ('$row['realname']', Adam
  19. Okay so double check; $username is what it's supposed to be that the username exists in the database and.. that there isn't two of the same username seen as you're using == 1 Adam
  20. ahh, do you have error reporting turned off?? here's the problem i reckon: mysql_numrows($sql) should be: mysql_num_rows($sql)
  21. Instead of: if (!get_magic_quotes_gpc()) { $username = mysql_real_escape_string(stripslashes($_POST['username'])); $password = mysql_real_escape_string(stripslashes(md5($_POST['password']))); } Just use: $username = mysql_real_escape_string(stripslashes($_POST['username'])); $password = mysql_real_escape_string(stripslashes(md5($_POST['password']))); See if that works? If not try outputting the $username and $password variables, if still nothing, try changing: if (mysql_numrows($sql) == 1) { $set = mysql_fetch_array($sql); if ($password == $set['password']) { $_SESSION['username'] = $set['username']; $_SESSION['id'] = $set['id']; $_SESSION['usrlvl'] = $set['usrlvl']; $_SESSION['logged_in'] = 1; } } to: if (mysql_numrows($sql) == 1) { $set = mysql_fetch_array($sql); if ($password == $set['password']) { $_SESSION['username'] = $set['username']; $_SESSION['id'] = $set['id']; $_SESSION['usrlvl'] = $set['usrlvl']; $_SESSION['logged_in'] = 1; } else { die('Invalid password!'); } } else { die('No user found!'); } Any luck?
  22. No no.. thats for if they enter the login form. that codes just basically testing if they're already loggin in and redirecting them if so. And you only really need to test one session value. People tend to use something that actually means something, like.. $_SESSION['loggedIn']; so when you see: if ($_SESSION['loggedIn']) { makes sense... adding more $_SESSION values to the if can i guess be added safety but if your system works right then you shouldn't need to really.. Adam
  23. Ah right gotchya, thought you was asking why it weren't working... could check for the time_start session you're setting, ie: <?php session_start(); if ($_SESSION['time_start']) { header("Location: memberspage.php"); } ?> put that at the top of loginpage.html (except it'll need to be .php now) and it should work fine... Adam
  24. Okay that's just static HTML, why would the session carry over to this page?
  25. Oh you've missed session_start() off of the top, should be: <?php session_start(); if (!isset($_SESSION['us....... Also have you connected to the database? Just realised there's no code...
×
×
  • 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.