We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
  • Pages:
  • 1
  • 3
  • 4
PHP Support Topic
Topic Started: Apr 5 2005, 05:42 PM (2,072 Views)
Jeremy
Member Avatar
Member
[ *  *  *  *  *  * ]
I'm feeling nice, today. ;) Until otherwise noted, I will be willing to provide answers to any of your PHP questions, in this topic. I'm sure I'll be assisted by plenty brilliant PHP Programmers, such as Seth, but just know that this topic is here if you want to ask something. :)

Everyone please keep in mind that you cannot use PHP on your InvisionFree Boards. So, don't post here asking for codes for your Forum. As a matter of fact, don't post here asking for codes, at all. ;)

Other than that, ask away. ^_^

:jeremy:
Offline Profile Quote Post Goto Top
 
solinent
Member
[ *  *  * ]
Ok, well i've heard of a php text grabber, and I could easily get my hands on one(for my site, you know) but my server doesn't have php, and I have to use asp. Asp will cost me, but that's OK. I'm just wondering how these text-grabbers work, and if I could grab a php script, with asp.

All this will do is get some info from the game site, runescape.com(with their permission), and help me run calculators for skills, and other things where a dynamic script would give me an edge on my site.

Thanks for your help Jeremy! And Seth if your there lol :yes: !
Offline Profile Quote Post Goto Top
 
Jeremy
Member Avatar
Member
[ *  *  *  *  *  * ]
If you're still here, could you edit the site link out of your post? I'm pretty sure that's against the rules...

Also, I don't know anything about ASP, so I don't know how it would work there. What exactly do you mean by text grabber? Like grabbing text off of other web pages, or grabbing data out of text files?
Offline Profile Quote Post Goto Top
 
solinent
Member
[ *  *  * ]
Well I edited the thing out :) Anyways, I mean like taking content (skills in paticular, it gets their experience in a skill if they type their name in, at least that's what it should do) and putting it on my page.

I could give you a link to a webpage that does this with Php if you like :)
Offline Profile Quote Post Goto Top
 
dbzlotrfan
Member
[ *  *  *  *  *  *  * ]
what does this mean?

Fatal error: Cannot instantiate non-existent class: skin_tutorials in /home/compjus6/public_html/tsfa/sources/functions.php on line 601


Does that mean the "class skin_tutorials ()" doens't exist? or what?
Offline Profile Quote Post Goto Top
 
Seth
Member Avatar
I has a pony
[ *  *  *  *  *  *  *  *  * ]
Yes.

It's like saying
Code:
 
SkinTutorial st = new SkinTutorial()
when you haven't defined the thing yet.
Offline Profile Quote Post Goto Top
 
solinent
Member
[ *  *  * ]
Ok, since I figured out that you can't retrieve a php script with asp, I am trying to download php onto my server.

But because the person who does things like installation and things like that onto the server im using is away, for now i'll have to download onto the comp that i'm using.

I've done everything to set up php on an apache server, exept the one, the last code bit you have to update to the httpd file(I'm using windows).

The thing I have to do, is place the following code into it:
Code:
 
SetEnv PHPRC C:/php


I know what it does, but can someone tell me where it goes? If you could that would be great! :w00t:
Offline Profile Quote Post Goto Top
 
Seth
Member Avatar
I has a pony
[ *  *  *  *  *  *  *  *  * ]
If you're on windows:

Control Panel > System > Advanced > Environment Variable > Add "C:\PHP" to the list.
Offline Profile Quote Post Goto Top
 
solinent
Member
[ *  *  * ]
ok ty, It was being problematic, so I just installed it as a module.

I've almost made the program now, (to get someones skills from a page)

Actually, I could use it, exept for one problem. Look at the code, and then i'll tell you the problem.
Code:
 
<html>
<body>
<?php
$value = $_GET['value'];
function show() { ?>
<form action="/contents.php" method="GET">
<input type="text" name="value" value="Enter your rs name here" /><input type="submit" value="submit" />
</form>
<? }
if ($value == "") {
show();
echo "<ul><li>Please Enter a RuneScape Name!!</li></ul>";
}
else {
// Get a file into an array
$username = $value;
$filename = "http://hiscore.runescape.com/aff/runescape/hiscorepersonal.cgi?username=".$username;
$lines = file($filename);
foreach ($lines as $line_num => $line) {
  echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";
}
$attack =  'Attack';   //value needed on line 13, I can't figure this value out...
}
if ($attack == $lines[13]) {
echo "Your attack is ".htmlspecialchars($lines[17]);
}
</body>
</html>


Ok, the lines might be a bit screwd up, but I think you should be able to figure it out.
Ok, what the program does, is set an array to $lines for each line in the file on hiscores.runescape.com/blahblahblah...(i forgot the entire filename, look at code to seee it)

so if i wrote echo $lines[9] it would echo line number 10 in the source code of hiscores.runescape.com/blahblahblah...(because of makeing it to complicated i'll still refer to line #10 as #9)

Now, I need to check if line #13 (or $lines[13]) is equal to $lines[13], because in some cases it won't. (If I was doing defence instead of attack, it would be the following code...

Code:
 
if ($lines[13] == $defence) {                      //if their attack isn't in the runescape highscores then defence will be where attack is.
echo "Your defence exp is ".$lines[17];      //the line the data I need would be on
}
else if ($lines[20] == $defence) {              //Where defence is normally
echo "Your defence exp is ".$lines[24]        //Where their exp is normally
}


and defence might not be on the line where it would normally be if attack was not on the highscores(e.g. their attack is too low). I hope you are still following me.
Now the problem is, I need a value for $defence and the function that I use to retrieve data is file() and I don't know what the EXACT value of lines[13] is.
(subsitutie 13 for anything.)

Can someone tell me how to find the EXACT value without actually displaying the html code, or could someone run the program and test it? It works if it tells you your attack. If you need to, use my username, solinent, on the part where I need a user name, and replace the action="/contents.php" with whatever you named your file.

All I need to know, is the EXACT value of lines[13] and I could figure out the rest by myself. Thank you very much!

All help is very much appreciated!
Offline Profile Quote Post Goto Top
 
solinent
Member
[ *  *  * ]
Well..I got it to work by myself(Wow php sure has alot of usefull functions!)

Here's the code for one of the calculators just incase you want to know :):
Code:
 
<html>
<head>
<style type="text/css">
table { border: 1px solid #EE0000 }
td { border: 1px solid #EE0000 }
th { border: 1px solid #EE0000 }
.black { color: black }
.select { background-color:#000000; color: #EE0000; border: 1px solid #EE0000 }
input { border: 1px solid #EE0000; background-color: black; color: red }
</style>
</head>
<body bgcolor="black" text="white">
<?php
$exp_needed = $_GET["exp_wanted"] - $_GET["exp"];
$normal = ceil($exp_needed/25);
$oak = ceil($exp_needed/37.5);
$willow = ceil($exp_needed/67.5);
$maple = ceil($exp_needed/100);
$yew = ceil($exp_needed/175);
$magic = ceil($exp_needed/250);
$rsname = str_replace("W","?", $value);
$woodcutting =  "<td><a href=\"hiscoreuser.cgi?username=".$rsname."&category=9\" class=c>Woodcutting</a></td>"; //69
$value = $_GET["value"];
$username = $value;
$filename = "http://hiscore.runescape.com/aff/runescape/hiscorepersonal.cgi?username=".$username;
$lines = file($filename);

if (strpos($woodcutting, "W") == strpos($lines[13], "W")) {
$woodcuttingexp = $lines[17];
}
else if (strpos($woodcutting, "W") == strpos($lines[20], "W")) {
$woodcuttingexp = $lines[24];
}
else if (strpos($woodcutting, "W") == strpos($lines[27], "W")) {
$woodcuttingexp = $lines[31];
}
else if (strpos($woodcutting, "W") == strpos($lines[34], "W")) {
$woodcuttingexp = $lines[38];
}
else if (strpos($woodcutting, "W") == strpos($lines[41], "W")) {
$woodcuttingexp = $lines[45];
}
else if (strpos($woodcutting, "W") == strpos($lines[48], "W")) {
$woodcuttingexp = $lines[52];
}
else if (strpos($woodcutting, "W") == strpos($lines[55], "W")) {
$woodcuttingexp = $lines[59];
}
else if (strpos($woodcutting, "W") == strpos($lines[62], "W")) {
$woodcuttingexp = $lines[66];
}
else if (strpos($woodcutting, "W") == strpos($lines[69], "W")) {
$woodcuttingexp = $lines[73];
}
else if ($username =="") {
$woodcuttingexp = "Enter your name or experience";
}
else{
$woodcuttingexp = "Not on Highscores";
}
$woodcuttingexp = str_replace(",","",$woodcuttingexp);
?>

<form action="/phpcalcwoodcutting.php" method="GET" name="simple_form">
<table border="1" align="center">
<tr class="black" style="background-image: url('http://www.runescapeapocalypse.com/pictures/navstrip2.bmp')"><th>Calculator</th><th>Level wanted</th></tr>
<tr><td>
<p><b>Enter your username: </b><input type="text" name="value" value="<?php
if ($username == "")
echo "";
else
echo $username; ?>" /></p><p>
<p><b>Enter your experience</b><input type="text" name="exp" value="<?
if ($woodcuttingexp == "") {
echo $_GET["exp"];
}
else {
echo $woodcuttingexp;
}
?>" /></p>
<table border="1">
<tr><th>Number</th><th>Name</th><th>Exp.</th><th>Level</th></tr>
<tr><td><? echo $normal ?></td><td>Normal Logs</td><td>25</td><td>1</td></tr>
<tr><td><? echo $oak ?></td><td>Oak logs</td><td>37.5</td><td>15</td></tr>
<tr><td><? echo $willow ?></td><td>Willow logs</td><td>67.5</td><td>30</td></tr>
<tr><td><? echo $maple ?></td><td>Maple logs</td><td>100</td><td>45</td></tr>
<tr><td><? echo $yew ?></td><td>Yew logs</td><td>175</td><td>60</td></tr>
<tr><td><? echo $magic ?></td><td>Magic logs</td><td>250</td><td>75</td></tr>
</table>
<br />
<input type="submit" value="Calculate and/or Retrieve Exp." />
<br />
</td>
<td>
<select size="25" name="exp_wanted" class="select">
<option value="0">Level 1</option>
<option value="83">Level 2</option>
<option value="174">Level 3</option>
<option value="276">Level 4</option>
<option value="388">Level 5</option>
<option value="512">Level 6</option>
<option value="650">Level 7</option>
<option value="801">Level 8</option>
<option value="969">Level 9</option>
<option value="1154">Level 10</option>
<option value="1358">Level 11</option>
<option value="1584">Level 12</option>
<option value="1833">Level 13</option>
<option value="2107">Level 14</option>
<option value="2411">Level 15</option>
<option value="2746">Level 16</option>
<option value="3115">Level 17</option>
<option value="3523">Level 18</option>
<option value="3973">Level 19</option>
<option value="4470">Level 20</option>
<option value="5081">Level 21</option>
<option value="5624">Level 22</option>
<option value="6291">Level 23</option>
<option value="7028">Level 24</option>
<option value="7842">Level 25</option>
<option value="8740">Level 26</option>
<option value="9730">Level 27</option>
<option value="10824">Level 28</option>
<option value="12031">Level 29</option>
<option value="13363">Level 30</option>
<option value="14833">Level 31</option>
<option value="16456">Level 32</option>
<option value="18247">Level 33</option>
<option value="20224">Level 34</option>
<option value="22406">Level 35</option>
<option value="24815">Level 36</option>
<option value="27473">Level 37</option>
<option value="30408">Level 38</option>
<option value="33648">Level 39</option>
<option value="37224">Level 40</option>
<option value="41171">Level 41</option>
<option value="45529">Level 42</option>
<option value="50339">Level 43</option>
<option value="55649">Level 44</option>
<option value="61512">Level 45</option>
<option value="67983">Level 46</option>
<option value="75127">Level 47</option>
<option value="83014">Level 48</option>
<option value="91721">Level 49</option>
<option value="101333">Level 50</option>
<option value="111945">Level 51</option>
<option value="123660">Level 52</option>
<option value="136594">Level 53</option>
<option value="150872">Level 54</option>
<option value="166636">Level 55</option>
<option value="184040">Level 56</option>
<option value="203254">Level 57</option>
<option value="224466">Level 58</option>
<option value="247886">Level 59</option>
<option value="273742">Level 60</option>
<option value="302288">Level 61</option>
<option value="333804">Level 62</option>
<option value="368599">Level 63</option>
<option value="407015">Level 64</option>
<option value="449428">Level 65</option>
<option value="496254">Level 66</option>
<option value="547953">Level 67</option>
<option value="605032">Level 68</option>
<option value="668051">Level 69</option>
<option value="737627">Level 70</option>
<option value="814445">Level 71</option>
<option value="899257">Level 72</option>
<option value="992895">Level 73</option>
<option value="1096278">Level 74</option>
<option value="1210421">Level 75</option>
<option value="1336443">Level 76</option>
<option value="1475581">Level 77</option>
<option value="1629200">Level 78</option>
<option value="1798808">Level 79</option>
<option value="1986068">Level 80</option>
<option value="2192818">Level 81</option>
<option value="2421087">Level 82</option>
<option value="2673114">Level 83</option>
<option value="2951373">Level 84</option>
<option value="3258594">Level 85</option>
<option value="3597792">Level 86</option>
<option value="3972294">Level 87</option>
<option value="4385776">Level 88</option>
<option value="4842295">Level 89</option>
<option value="5346332">Level 90</option>
<option value="5902831">Level 91</option>
<option value="6517253">Level 92</option>
<option value="7195629">Level 93</option>
<option value="7944614">Level 94</option>
<option value="8771558">Level 95</option>
<option value="9684577">Level 96</option>
<option value="10692629">Level 97</option>
<option value="11805606">Level 98</option>
<option value="13034431">Level 99</option>
</select>
</td>
</tr>
</table>
</body>
</html>


(Ps. I solved the problem by instead of finding the entire string, just finding a w, and replacing all the ws in their name(when checking) to questions marks(so that the count is still equal)
Test it out with the name "Solinent"!
Offline Profile Quote Post Goto Top
 
Jeremy
Member Avatar
Member
[ *  *  *  *  *  * ]
Glad you figured it out... Sorry I wasn't more help, I've been busy all weekend. :P I'm back now, if anyone else has any questions.
Offline Profile Quote Post Goto Top
 
Das
Member Avatar
Smells of rich mahogany
[ *  *  *  *  *  *  * ]
I have a really basic question. Do you have to know any language other that PHP to be able to use it? I have heard alot about Myslq and PHP and I wondered if you had to know both to do PHP? I want to learn PHP, but Idon't want to get half way through learning it just to find out you must know something else.
Offline Profile Quote Post Goto Top
 
Seth
Member Avatar
I has a pony
[ *  *  *  *  *  *  *  *  * ]
You should know HTML to do PHP. MySQL is not required but is very handy.
Offline Profile Quote Post Goto Top
 
Das
Member Avatar
Smells of rich mahogany
[ *  *  *  *  *  *  * ]
Seth
April 10, 2005 07:13 PM
You should know HTML to do PHP. MySQL is not required but is very handy.

I know HTML. How handy is MySlq? Is MySlq hard to learn? Can you use Javascript in php?
Offline Profile Quote Post Goto Top
 
Seth
Member Avatar
I has a pony
[ *  *  *  *  *  *  *  *  * ]
Good. Very. No. No.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · Technology Chat · Next Topic »
Add Reply
  • Pages:
  • 1
  • 3
  • 4