Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by kingb00zer

  1. Its actually 2 seperate forms.
  2. Hey I have this table in the code below which has a gap between the first 2 text inputs which should not be there. what I want is 1 text input next to "current target:" and 5 text inputs in a column just below the current target one. I have been up all night though and it is probably something stupid (I am tired lol) but I really cant see anything wrong with the source code. <table class="defend" align="left"> <tr><td align="center"> <form> <b>Current target:</b> <input tpye="text" size="20" /> </td> </tr> </form> <tr><td align="center"> <b> Target List </b> </td> </tr> <tr><td align="center"> <form> <input type="text" size="20" /> </td> </tr> <tr><td align="center"> <input type="text" size="20" /> </td> </tr> <tr><td align="center"> <input type="text" size="20" /> </td> </tr> <tr><td align="center"> <input type="text" size="20" /> </td> </tr> <tr><td align="center"> <input type="text" size="20" /> </td> </tr> </form> </table> Any idea what I could be doing wrong here?
  3. Thanks that saves me from doing what i dreaded having to do and making both a widescreen and regular screen version
  4. oh i see, that works fine, now time to figure out exactly what percentage I am using on the 2 smaller tables... Thanks
  5. so you think using % for width with css would be the best way to ensure all users have the page fitting on the screen without that annoying side scroll that occurs sometimes?
  6. hey i recently started working with a pc which has a widescreen monitor and I'm not entirely sure if this has effected the output of my html documents (i also started my work from scratch). If not then lets say I wanted to set 3 tables side by side at the top of my page and I wanted it to span the whole way on both widescreen and normal screen monitors how far does the width have to = in order to fill the screen without going over the sides? I thought it was a total of 1000 but so far the 3 tables total a width of 1350 with room remaining.
  7. ahh thats what I thought originaly to I came to a bit of a problem earlier today and decided to add more curly braces kind of like if else with php (which im also pretty unsure with also)Thanks Ill fix it up n see how I go.EDIT: ahh that did the trick, thanks
  8. for some reason I cant seem to remove underlines from my links I have the class like this <a class="menu" href="yadayada.html"> </a> and here is how I have my external style sheet set for the <a> tag a.menu { letter-spacing: 1.5px; } { color: black; } { text-decoration: none; }a:link.menu { color: black; } { letter-spacing: 1.5px; } { text-decoration: none; }a:visted.menu { color: black; } { letter-spacing: 1.5px; } { text-decoration: none; }a:hover.menu { color: black; } { letter-spacing: 1.5px; } { text-decoration: none; }a:active.menu { color: black; } { letter-spacing: 1.5px; } { text-decoration: none; } what have I done wrong here?
  9. Hi I was just wondering if it were possible to use javascript to put multiple messages into a marquee and timed so it alternates through each message how I want it to. for example..Between right on the hour and 5 past the hour display: Welcome to my site if you need any help please read the help files...then between 5 past and 10 past display: Think you can beat the best of the best? Try beating some of the records, click here...then between 10 past and 15 past display: Are you moving up or slipping away? Compare your stats to your stats from this time last round, click here... then revert back to the first display in the marquee.If this is possible could anyone point me in the right direction please? I havnt attempted to create the code for this yet because I'm unsure where to start.
  10. when I start a session should I start it at the end of the last php file I was running to log in? or at the beggining of the script on the page you get taken to after you log in?EDIT: I noticed on the login successful file I have it already has sessionstart() do I have to start a session again with the page it takes me to? login_succes.php<?session_start();if(!session_is_registered(myusername)){header("location:index.php");}else{header ("location:phptestmenu.php");}?>
  11. by form do you mean the form on the login page? because I'm trying to get data from the user logged in displayed on the page you go to once logged in "phptestmenu.php" which hasnt got any forms.
  12. thanks its getting further thru without error but now i am getting this:Notice: Undefined index: username in /home/schulzy/public_html/phptestmenu.php on line 15Could not successfully run query (SELECT id as username, money, weed, thugs, pistols, turns FROM gamestats WHERE username= '') from DB: Unknown column 'id' in 'field list'EDIT: I took out the id as bit in the sql= part and now I have the undefined index problem.
  13. I gave that example a go and so far I've got nothing working. what could i have got wrong? It gives me this error: Parse error: syntax error, unexpected T_VARIABLE in /home/schulzy/public_html/phptestmenu.php on line 13I'm thinkin the $_POST[username] part is what I think is wrong but I cant seem to figure it out. phptestmenu.php<html><body><h1 align="center"> Thug Fights </h1><table align="center" border="3" width="700"><tr bgcolor="green"><td align="center">YOU HAVE:</td></tr><?phperror_reporting(E_ALL); ini_set('display_errors', 1);include('connection.php')$sql= "SELECT id as username, money, weed, thugs, pistols, turns FROM gamestats WHERE username= '$_POST[username]'"; $result= mysql_query($sql);if (!$result) { echo "Could not successfully run query ($sql) from DB: " . mysql_error(); exit;}if (mysql_num_rows($result) == 0) { echo "No rows found, nothing to print so am exiting"; exit;}while ($row = mysql_fetch_assoc($result)) {echo "<tr><td align=\"center\">Money:</td><td>{$row['money']}</td></tr>";echo "<tr><td align=\"center\">Weed:</td><td>{$row['weed']}</td></tr>";echo "<tr><td align=\"center\">Thugs:</td><td>{$row['thugs']}</td></tr>";echo "<tr><td align=\"center\">Pistols:</td><td>{$row['pistols']}</td></tr>";echo "<tr><td align=\"center\">Turns:</td><td>{$row['turns']}</td></tr>";}mysql_free_result($result);</table><table align="left" bgcolor="green"><tr><td align="center"><b>MENU</b></td></tr><tr><td><a href="buyweed.php" align="center">Buy Weed</a></td></tr><tr><td><a href="trainskills.php" align="center">Train Skills</a></td></tr><tr><td><a href="recruit.php" align="center">Recruit Thugs</a></td></tr><tr><td><a href="attackroom.php" align="center">Attack Room</a></td></tr><tr><td><a href="gunstore.php" align="center">Gun Store</a></td></tr><tr><td><a href="ranks.php" align="center">Ranks</a></td><</tr><tr><td><a href="logout.php" align="center">Logout</a></td></tr></table><br><br><br></body></html>?>
  14. Thanks, after about 30 minutes of going hru te errors I managed to log myself into my game for the first time , too bad dont have any working actions yet hehe
  15. I have a simple log in script which doesnt seem to log me in, it keeps saying wrong username or password for some reason and it isn't giving me what line any error is on, I know my username and pass is right coz i kept simple username ###### pass is face but for some reason it wont let me log in. index.html<html><body><h1> Thug Fights </h1><form name="form2" method="post" action="checklogin.php"><p>Username: <input type="text" name="username" id="username" size="15" maxlength="20" value=""/></p><p>Password: <input type="password" name="password" id="password" size="15" maxlength="20" value=""/></p><p> <input type="submit" name="login" value="Log in"></p><a href="register.php">New to thugfights Register Here</a></body></html> checklogin.php<?phpob_start();include('connection.php'); // Define $myusername and $mypassword$myusername=$_POST['username'];$mypassword=$_POST['password'];// To protect MySQL injection (more detail about MySQL injection)$myusername = stripslashes($myusername);$mypassword = stripslashes($mypassword);$myusername = mysql_real_escape_string($myusername);$mypassword = mysql_real_escape_string($mypassword);$sql="SELECT * FROM users WHERE username='$myusername' and password='$mypassword'";$result=mysql_query($sql);// Mysql_num_row is counting table row$count=mysql_num_rows($result);// If result matched $myusername and $mypassword, table row must be 1 rowif($count==1){// Register $myusername, $mypassword and redirect to file "login_success.php"session_register("myusername");session_register("mypassword");header("location:login_success.php");}else {echo "Wrong Username or Password";}ob_end_flush();?> login_success.php<?session_start();if(!session_is_registered(myusername)){header("location:index.php");}else{header ("location: phptestmenu.php")}?> If anyone can help me figure out why I cant log into my site that would be great beause I am unsure what it could be.
  16. Hi im working on a small browser game and so far I have the registration working fine, now im just making the basic layout for it and came to a part where I need more help. I have a table on my site which will show certain gamestats like "money, weed, thugs, guns and turns" and I have the html side of it complete but kind of unsure how to display these stats for when I log in. <table align="center" border="3" width="700"><tr bgcolor="green"><td align="center">YOU HAVE:</td></tr><tr><td align="center">Money:</td></tr><tr><td align="center">Weed:</td></tr><tr><td align="center">Thugs:</td></tr><tr><td align="center">Pistols:</td></tr><tr><td align="center">Turns:</td></tr></table> All of the above is from the same table in my databse and I want to display the stats from the database next to the text in the code above like "Money: $100,000" etc... How would I do this?
  17. I thought * meant "all", as in SELECT all FROM.... I'll try ^ instead and get abck to you on that
  18. Now that I have got that part figured out I went back to my original code. It didnt appear to have any errors on the registernext.php (pasted below) until i re wrote the connection.php (also below) now it connects but comes up with this error.Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 0 in /home/schulzy/public_html/registernext.php on line 8 registernext.php<?phpinclude('connection.php');//test to see if username is alpha numeric$test=$_POST[username];if (preg_match("/*[a-z0-9]+$/i", $test)) {//check for duplicate names$query= "SELECT * FROM users WHERE username='$_POST[username]'";$result= mysql_query($query);$num= mysql_num_rows($result);if ($num == 0) {//check for duplicate emails$query2= "SELECT * FROM users WHERE email='$_POST[email]'";$result2= mysql_query($query2);$num2= mysql_num_rows($result2);if ($num2 == 0) {//check if password and email confirmation is the sameif (($_POST['pass'] == $_POST['pass2'] && $_POST['email'] == $_POST['email2'])) {// generate random verification code$confirm_code=md5(uniqid(rand()));// get rid of all html from hackers$name= strip_tags($_POST['username']);$email= strip_tags($_POST['email']);$pass= strip_tags($_POST['password']);// insert into database$sql= "INSERT INTO temp SET code='$confirm_code', username='$name', email='$email', password='$pass',";$result= mysql_query($sql);if ($result) {$message= "Your confirmation link \r\n";$message.= "click on this to activate your account \r\n";$message.= "http://thugwars.x10hosting.com/confirmation.php?passkey=$confirm_code";$sentmail= mail("$email", 'registration_conformation',"$message");}else {echo "cannot send confirmation to your email";}// if email succesfully sentif ($sentmail) {header("location: thankyou.html");}}}}}?> connection.php<?php$con = mysql_connect("localhost","schulzy_ash","pompey08");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("schulzy_thugf", $con) or exit(mysql_error()); ?>
  19. Thanks for that, it made it a bit more clear how it wasnt working then I ecided I would create a new user, but ebfore i got to do that i found an option which added users to databases and reaqllised that i needed to give myself the permissin to insert and the rest lol" MySQL® Database WizardUser schulzy_ash was added to the database schulzy_thugf. "the message above was followed by an ohhhhhhhh I see and a grin
  20. Ok well the database name is right and that is the only so maybe it is the whole "free php/sql web host" thiing... Just a thought that maybe they make ti appear free but dont allow access to databases until you pay for the upgrades, which then makes it not free....Maybe there is a diferent avenue i can take which is also free or at worst dirt cheap. a friend of mine mentioned something about apache server and run it all off my pc but then again my pc is a piece of ######.
  21. Ok I found a diferent host, this one is looking better but still not entering data into the database, I'm still trying to sue the example script fomr the sql insert part of the php tutorial this is what I ahve got <?php$con = mysql_connect("localhost","schulzy_ash","pompey08");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("schulzy_thugf", $con);$sql = "INSERT INTO persons (firstname, lastname, age) VALUES ('$_POST[firstname]','$_POST[lastname]','$_POST[age]')";if (!mysql_query($sql,$con)) { die('Error! You did it wrong!!: ' . mysql_error()); }echo "1 record added";mysql_close($con)?> I'm having no issues connecting to the server but for some reason now I get the error on this line "die('Error! You did it wrong!!: ' . mysql_error()); " which looks more liek this on my screen Error! You did it wrong!!: No database selectedCan anyone explain why i cant select a database? is ther something wrong with this line mysql_select_db("schulzy_thugf", $con); ?And it cant be any miss spelling of the database name as that is exactly it is called schulzy_thugf.
  22. I have been having a little trouble working out exactly when and when not to add them. Since I copied this off a youtube tutorial some of the things were a bit of a blur when HD wasnt available and I think he may have also left a few things out by mistake on the files he was working on (and maybe showing what happens with files prepared earlier) maybe I'll go back to square one and start fresh or then again I did find one that didnt show any errors what so ever when I tried it out the only issue was that it didnt instert the data into the database. Testing as I go sounds like a really good idea, didn't reallise it were possible. So basicly what your saying is I do a coulpe lines of code then to test it I would (and im guessing) make an if statement that if the above is working then echo a good result for my test and if it isnt working then echo that it isnt working? I'm going to ahve to check the w3 tuts to find out what var_dumping does though.LATE EDIT: Hey I thought I'd go and have anotehr look at the php section of the tutorials on w3 and went to the mysql insert part since that is where I'm having trouble with this form I was playing with last night and I copied everything and just hanged my database name n pass for connecting with mysql and I'm not even connecting below is what I have copied straight from the tutorial on w3. I tried changing a few things and tried diferent variations of things like changing username form a5864476_ash to just a5864476 as it says my username is on the site however in phpmyadmin my name has the additional _ash added to it, I figure that is what connects to the database (but i checked it anyway) I even tried changing the localhost to what my webhost says the servername is that didnt work and I even tried dropping the _thugf out of my database name and I'm pretty sure I ahve done every single combonation of each of the things above I said I altered and nothing has worked, what could I possibly be doing wrong?The form first<html><body><h1> Test data entry to database </h1><form action="insert.php" method="post">Firstname: <input type="text" name="firstname" />Lastname: <input type="text" name="lastname" />Age: <input type="text" name="age" /><input type="submit" /></form></body></html> And the Insert.php <?php$con = mysql_connect("localhost","a5864476_ash","pompey08");if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("a5864476_thugf", $con);$sql="INSERT INTO persons (FirstName, LastName, Age)VALUES('$_POST[firstname]','$_POST[lastname]','$_POST[age]')";if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); }echo "1 record added";mysql_close($con)?> This is the error I getWarning: mysql_connect() [function.mysql-connect]: Access denied for user 'a5864476_ash'@'localhost' (using password: YES) in /home/a5864476/public_html/insert.php on line 2Could not connect: Access denied for user 'a5864476_ash'@'localhost' (using password: YES)
  23. I went through this tutorial on youtube and it was pretty helpful with giving me a better understanding of php. But I copied the stuff he was teaching and mine didnt work, anyway would you be able to point out some of these misplaced quotes? I'm not sure where they are.I also have a question about the error I got, it says line 8 of register next which is this if (!eregi("([^A-Za-z0-9])"),$test) { Is there something wrong with the way this is written? (its to test if the name is alphanumeric)oh yeah and I fixed the semi colons.
  24. Hi guys I been learning how to start making a browser based game with PHP and so far I have encouter an error (first of possibly many) and I also might ahve some else statements in strange places (sicne I was learning fomr youtube tutorials and the guy got lazy coz he had source code on his website that no longer contains the freakin source code for me to study) so I'm going to put the few files I have made into quotes and hope you guys can figure out why when i try to register i get the following error "Parse error: syntax error, unexpected ',' in /home/a5864476/public_html/registernext.php on line 8"
  25. How would I go about resizing the buttons with css? Spacing is something else I would liek to do between the buttons also.
  • Create New...