Jump to content

NewcastleFan

Members
  • Posts

    64
  • Joined

  • Last visited

Everything posted by NewcastleFan

  1. Haha don't need to win for newcastle atm! they are doing that themselves! haha.I'm to planning on giving up completely may just change project due to this one basically needed to be re-written to modern php! Thanks for all of the help guys.
  2. Possibly! I'm beginning to think I've bitten off more than I can chew with this project now. PHP Seems a lot more complex than I first thought . Would I be better off not working with old code to teach my self things? lol
  3. Haha yeh, I always change the configurations. It's often things like unexpected " in Tstring and errors like that I get when moving from local to live.
  4. I do have XAMMP on my local host, but when ever I have been working on little test scripts in the past, they have worked on my local host, but not when I've added them to a live environment, Have I got XAMMP setup wrong?
  5. Yeh sorry did not mean sessions in general meant the session_register. Just had a google and saw it was stopped in PHP 4.2. What's the current day replication of it?
  6. Yeh I'm playing about with it on a free host at the moment, seems like the sessions don't work anymore either. Would it be best running this on an older server? Also I don't think I can edit the php.ini file on the free host. http://deathmatch.hostei.com is the site, can sign up but it just logs you out atm ha.
  7. Thanks guys realised I needed POST not post on characters and it has worked. I'm just playing about with this code really Pikachu, once I get a bit better at this stuff I'll try and bring it up to date
  8. <?php session_start(); session_register("pid"); include("common.inc"); include("date.inc"); include("header.inc"); dbConnect(); $res = mysql_query("select id from $dbName.pdm_players where name=\"$name\"") or die(mysql_error()); $password1 = $_POST['password1']; $password2 = $_POST['password2']; $name = $_POST['name']; $character = $_post['character']; if ($name == "" || $password1 == "") Character is declared there now. However will character and name work like that? As in the character_form.inc they must have backslashes else it produces and error: <td align=center><input type=\"radio\" name=\"character\" value=\"$row[0]\""; <tr><td align=\"center\">Name<br><input size=20 maxlength=20 type=text name=\"name\" value = \"$name\"></td>"; Will I need to declare them as character\ and name\?
  9. Hi Gotharious, Thanks for that! I thought it was declared but guess that was on another copy. I've added that in and now I get the error "you are an idiot" - lol. Which comes from this line: if ($character < 1 || $character > 9) { die("you are an idiot"); }
  10. Hi Andy, Thanks for your quick reply? Are you suggesting I use extract to de-bug the script? I'm not 100% sure on the meaning of your post :S sorry.
  11. Hey guys, I've been playing around with this open source php game, I'm having problems with the registration system. For some reason the script is echoing back that there is no password in the password fields. When in fact there is: Add_player.php: <?php session_start(); session_register("pid"); include("common.inc"); include("date.inc"); include("header.inc"); dbConnect(); $res = mysql_query("select id from $dbName.pdm_players where name=\"$name\"") or die(mysql_error()); if ($name == "" || $password1 == "") { echo "<center><div class=\"sheader\">Oh dear me!</div> You have to actually enter a name and password!"; $name = ""; include("character_form.inc"); echo "</center>"; include("footer.inc"); return 0; } if ($name == $password1) { echo "<center><div class=\"sheader\">Oh dear me!</div> You can't make the password the same as the name. People will guess your password!"; include("character_form.inc"); echo "</center>"; include("footer.inc"); return 0; } if (strlen($password1) < 6) { echo "<center><div class=\"sheader\">Oh dear me!</div> Passwords must be at least 6 characters, otherwise they are easy to guess!"; include("character_form.inc"); echo "</center>"; include("footer.inc"); return 0; } if (mysql_fetch_row($res)) { echo "<center><div class=\"sheader\">Oh dear me!</div> Player $name already exists, try a different name."; $name = ""; include("character_form.inc"); echo "</center>"; include("footer.inc"); return 0; } if ($password1 != $password2) { echo "<center><div class=\"sheader\">Oh dear me!</div>"; echo "The two passwords didn't match - type carefully now!."; include("character_form.inc"); echo "</center>"; include("footer.inc"); return 0; } echo "<div class=\"sheader\">Registration for $name successful</div>"; $cp = crypt($password1); $dateArray = getdate(time()); $likeNowScoob = $dateArray["year"] . "-" . $dateArray["mon"] . "-" . $dateArray["mday"]; if ($character < 1 || $character > 9) { die("you are an idiot"); } pdm_characters(); $res = mysql_query("select type from $dbName.pdm_characters where cid = $character") or die(mysql_error()); $t = mysql_fetch_row($res); pdm_stuff(); $specRes = mysql_query("select sid from $dbName.pdm_stuff where sid >= 28 and sid <= 33 and type like \"%$t[0]%\"") or die(mysql_error()); $res = mysql_query("BEGIN") or die(mysql_error()); $res = mysql_query("insert into $dbName.pdm_players (name, used, dob, cpass, char_id, roundswon, evo, aWeapon, dWeapon) VALUES (\"$name\", 1, \"$likeNowScoob\", \"$cp\", $character, 0,0,0,0)") or die(mysql_error()); $res = mysql_query("select id from $dbName.pdm_players where name=\"$name\" for update") or die(mysql_error()); $row = mysql_fetch_row($res); $pid = $row[0]; $res = mysql_query("insert into $dbName.pdm_league (id, highest, days_no_1, yesterday, longPoints) VALUES ($pid, 16777215, 0, 16777215, 0)") or die(mysql_error()); $res = mysql_query("insert into $dbName.pdm_stats (id, level, attack, defence, health, speed, exp, ko, healthpercent, fights) VALUES ($pid, 1, 100, 100, 100, 100, 0, 0, 10, 0)") or die(mysql_error()); $res = mysql_query("insert into $dbName.pdm_clanmembers2 (id, clanTag, applyTag, utype) VALUES ($pid, NULL, NULL, '')") or die(mysql_error()); $res = mysql_query("insert into $dbName.pdm_money (id, bank, wallet, bankdate) VALUES ($pid, 0,0, '0000-00-00')") or die(mysql_error()); while ($row = mysql_fetch_row($specRes)) { $res = mysql_query("insert into $dbName.pdm_specials (id, sid, qty, switch) values ($pid, $row[0], 0, 1)") or die(mysql_error()); } $res = mysql_query("COMMIT") or die(mysql_error()); session_register("playerName"); $playerName = stripper($name); echo "<P><diV>Welcome $playerName, click the Fight link down the left to fight your first opponent.</div>"; include("main_screen.inc"); include("footer.inc"); ?> Character_form.inc: <center> <form method="post" action="add_player.php"> <P> <table cellpadding="0" cellspacing="0"><tr><td align="center"> <?php dbConnect(); pdm_characters();#check HEAP table exists $res = mysql_query("select cid, name, type from $dbName.pdm_characters order by type") or die(mysql_error()); $marker = "X"; $firstOne = 1; $cTypes["A"] = "Alien"; $cTypes["M"] = "Magic"; $cTypes["S"] = "Spirit"; while ($row = mysql_fetch_row($res)) { if ($marker != $row[2]) #new type (alien/magic etc) { if ($marker != "X") { echo "</table>\n"; } $cn = $cTypes[$row[2]]; echo "\n<table cellpadding=\"0\" cellspacing=\"0\" border=1> <tr><td colspan=\"3\" align=\"center\"><div class=\"sheader\"> $cn characters</div></td></tr><tr bgcolor=\"#efefef\">"; $marker = $row[2]; } echo "\n<td><table><tr><td align=center>$row[1]</td></tr><tr><td align=center> <img alt=\"Pick me!\" src=\"images/$row[0]0.gif\"></td></tr><tr> <td align=center><input type=\"radio\" name=\"character\" value=\"$row[0]\""; if ($firstOne and $character == "") { $firstOne = 0; echo " CHECKED "; } if ($character == $row[0]) { echo " CHECKED "; } echo "></td></tr></table></td>"; } echo "</tr></table> <table width=\"551\" cellpadding=0 cellspacing=0><tr><td colspan=\"3\"><div class=\"sheader\">character details</div></td></tr> <tr><td align=\"center\">Name<br><input size=20 maxlength=20 type=text name=\"name\" value = \"$name\"></td>"; ?> <td align="center">Password<br><input type="password" name="password1" size=20 maxlength=20></td> <td align="center">Password again<br><input type="password" name="password2" size=20 maxlength=20></td></tr> <tr><td colspan="3" align="center"><input type="submit" value="Register my character"></td></tr></table> </td></tr></table> <hr> </form> </centER> Anyone able to offer up any advice or where its going wrong, If I remove the validation stuff, it still doesn't insert the user into the database. Cheers
  12. Hi thanks for your reply. It may be possible to add an Iframe around the actual flash movie itself, do you happen to have a link to any examples or could show me an example of what you mean with the iframe? Thanks
  13. Hey Guys. I'm working on a tumblr theme at current and they have what is called a audio post, which ad's a flash movie that plays a sound. I'm having trouble as I've got a fixed header that the posts go under as the user scrolls the page, which works fine with youtube videos. However the audio post is going ontop of my banner/logo. #banner { width:637px; height:150px; margin-left:10px; background-color:#141414; background-repeat: no-repeat; position:fixed; z-index:1000; } .logo { margin-top:40px; z-index:1000; position:fixed; } .audio_player { z-index:-1000; position:static; } <span id="audio_player_11436410709"> <div class="audio_player"> <embed type="application/x-shockwave-flash" src="http://assets.tumblr.com/swf/audio_player_black.swf?audio_file=http://www.tumblr.com/audio_file/11436410709/tumblr_lt297nLjGa1r4fuce&color=FFFFFF" height="27" width="207" quality="best"></div></span> The embed is dynamically generated by tumblr so there is no way I can change it from embed. Has anyone else had this problem or know a solution? As Z-index seems to be getting ignored :S
  14. Hey guys, hope you are all well. I've got this project I'm working on and it requires a calculator to work out a cost via peoples inputs in a form... However I'm trying to figure out how to go about doing it... the basis is: (A * B) + Base Rate = Cost Per Month Value A can be input by the user, Value B is a cost, a cost that changes with the value of A. E.g If A = 10 then B = £1.00 Or If A = 20 then B = £0.90 I'm thinking I'm not going to be able to do this without having a database to store all of these numbers. To top it off, it has to have 4 different options in the first choice, which then determains witch list of values too read from. I'm completly confused at the moment, wondering if anyones got any suggestions of how to take this or have done anything like this in the past! Thanks
×
×
  • 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.