Jump to content

PC Nerd

Members
  • Posts

    1,122
  • Joined

  • Last visited

    Never

Everything posted by PC Nerd

  1. i am creating a login script, where if the username and password do not match a database query, then it relocates users to the login page again.  because i have already passed values, how can i relocate the user, (eg, not header()) all help appreciated
  2. so the only way to continue passing data is to use cookies or sessions
  3. w = initial form x = rough validation and additional login (anti spam etc (type what you see in the picture)) y = create cookies, login data etc z = final site w -> x x -> y y - >z
  4. ok, so how should i send the $_POST data to the next page, when the user submits the form on the page
  5. i dont quite get what you saying.  if your saying that i need tio enclose the variable being used as '$VARIABLE'  then it makes no difference to the conversion, i just tried it could you clarify, what your saying
  6. i am writting a login script, that checks by comparing $_POST['User_Name']  to $_DATABASE_REQUEST['User_Name'] and the same with the password. basically it goes if(password and usernames match) {complete login sequence} else{echo there was an error and prompt to login again} here is the login script, and the include file SCRIPT: [code]<html> <head> <link rel="stylesheet" type="text/css" href="B_A-CSS.css"> <title>Login</title> </head> <body> <table> <thead> <td  class = left> <img src="Graphics/Draft Logo.jpg" alt="Logo"> </td> <td class = centre> <b><font color = "#006600"><center><h1>TITLE</h1></center></font></b> </td> <td class = right> <img src="Graphics/Draft Logo.jpg" alt="Logo"> </td> </thead> <tbody> <tr> <td class = left> </td> <td class = centre> <?PHP include("inc files/Database link.inc");                 $User_Name = $_POST['User_Name']; $User_SQL = "SELECT User_Name, Password FROM Table_1 WHERE User_Name = '" . $_POST['User_Name'] ."' "; $result = @mysql_query($User_SQL, $DB_Server);                 if(!$result){                         echo "Unable to perform query: $User_SQL<br>";                         echo mysql_error();                 } $confirm = mysql_fetch_array($result); if($confirm['User_Name'] == $_POST['User_Name'] and $confirm['Password'] == $_POST['Password']){ echo "<p>Please type what you see in the image.This is to stop scripts from playing the game for you.  Please read the Rules for more information.  The Image is Case sensitive.</p>"; $pic = rand(1,6); echo "<img src = 'Graphics/Login $pic.jpeg' alt = 'Login'>";                                 $User_Name = $_POST['USer_Name'];                                 $Password = $_POST['Password'];                                 $Pic_Value = $_POST['Pic_Value']; echo "<form action = 'B_A-Home.php' method = 'POST'>"; echo "<input type = 'hidden' name = 'User_Name' value = $User_Name>"; echo "<input type = 'hidden' name = 'Password' value = $Password>"; echo "<input type = 'hidden' name = 'Pic_Name' value = '$pic'>"; echo "<input type = 'text' name = 'Pic_Value' value = $Pic_Value>"; echo "</form>"; echo "<input type = 'submit' value = 'Login'>"; } else{ echo "<p>There has been an error with the login, please try to login again.  <a href = 'B_A-Home.html'>Try again here</a></p><br>"; } ?> </td> <td class = right> </td> </tr> </tbody> </table> </body> </html> [/code] INCLUDE FILE: [code]<?php $host="localhost"; $account="ACCOUNT"; $password="PASSWORD"; $dbname="DBNAME"; $Error_Log[1] = ""; $Error_Log[2] = ""; $DB_Server = mysql_connect($host, $account, $password); if(!$DB_Server){echo "<p>There was an error in connecting to the database server.  Please try again later.</p>"; $Error_Log[1] = "DB_Server";} else{} $DB = mysql_select_db($dbname); if(!$DB){echo "<p>There was an error connecting to the Database.  Please try Again later.</p>"; $Error_Log[2] = "DB_Connect";} else{} if(empty($Error_Log[1])){} elseif(empty($Error_Log[2])){} else{echo "<p>WE apologises for any and all inconveniences caused by this fualt in the system.  We are working on fixing the connection problem.  Why not explore the public site for FAQ's and other help sections to become more aquainted with the game.</p>";} ?>[/code] i cant see any errors.  i made sure that the database entries matched the form entries.  but there is still this error.  ass i said there are no error messages, eg warning undefined variable et.c, but the scrript isnt doing what i told it to do all help apprectiated P.S im working on the new user script now, so ill keep you posted if that could have any changes in this script thanks
  7. [code]include("inc files/Database link.inc.php");[/code]
  8. why does the file need to have php tags  isnt it inside other php tags once it is included??? ill post the code next
  9. im trying to include a file, but when it does so, it echos the entire contents of the inc file.  ive renamed the file .inc  .php  .inc.php  but nothing works.  can anyone help thanks PC Nerd
  10. thanks, that works  but now the page is echoing the entire contents of the inc file, but i think ive come accros this problem before, so ill have a llok at it. thanks again Pc Nerd
  11. ok, the sorounding code to the sql definition is [code]include("URL/inc files/Database link.inc");                 $User_Name = $_REQUEST['User_Name']; $User_SQL = "SELECT User_Name, Password FROM Table_1 WHERE User_Name = '$User_Name' "; $result = @mysql_query($User_SQL, $DB_Server);                 if(!$result){                         echo "Unable to perform query: $User_SQL<br>";                         echo mysql_error();                  } $confirm = mysql_fetch_array($result); if($confirm['User_Name'] == $_POST['User_Name'] and $confirm['Password'] == $_POST['Password']){ [/code] And the login form is [code]<h3>Player Login</h3> <form action="B_A-Login.php" action="POST"> <p>Player Name: <input type=test name=User_Name></p> <p>Password: <INPUT type=password name=Password</p> <p><input type=submit value=send></p> </form> [/code] if there is anything i have missed, let me know (the inc file is not posted because i am 99% sure the error is not ther although i am new and might be wrong  if you want it let me know) Thanks PC NErd
  12. yes, i am defining User_Name as you showed, and ive changed the $_POST[] to$_REQUEST[] but there is no difference ill post the supporting code next
  13. im using the following SQL to scource from a database(mysql) [code]$User_SQL = "SELECT User_Name, `Password` FROM Table_1 WHERE User_Name = '$User_Name' ";[/code] the User_Name is defined from a $_POST array, and i noticed that the page is sending the data like an GET statement, but i told the html to send it as POST.  then i define $User_Name from the Post array.  why is the data being sent like this, and how can i stop it.  im pretty sure that this is the problem but i dont know how to frix it can anyone help me P.S.   i think this is the reason my problem continued after my last question. 
  14. actually i find it easier to debug loops that only have one statement when they are all of one line.  i agree when there are more lines or statements then they shouldbe spread over many lines indented etc.  and no i dont take any offence at the comment and do you have any suggections on how to fix the problem
  15. ok, the site is completely database driven, so every page connects to the same db  i simpply include to file, so  ill post the entire inc file here it goes $host="localhost"; $account="USERNAME"; $password="PASSWORD"; $dbname="DBNAME"; $Error_Log[1] = "" $Error_Log[2] = "" $DB_Server = mysql_connect($host, $account, $password); if(!$DB_Server){echo "<p>There was an error in connecting to the database server.  Please try again later.</p>";   $Error_Log[1] = "DB_Server";} else{continue;} $DB = mysql_select_db($dbname); if(!$DB){echo "<p>There was an error connecting to the Database.  Please try Again later.</p>";   $Error_Log[2] = "DB_Connect";} else{continue;} if(empty($Error_Log[1])){continue;} elseif(empty($Error_Log[2])){continue;} else{echo <p>We apologise for any and all inconveniences caused by this fualt in the system.  We are working on fixing the connection problem.  Why not explore the public site for FAQ's.</p>";}
  16. ive changed the line and have been given the following: ERROR Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in URL on line 44 Unable to perform query: SELECT User_Name, Password FROM Table_1 WHERE User_Name = ''
  17. ok, im still getting errors on the following lines.  The following is the codeand the error message: [b]ERRORS[/b] Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/battle1a/public_html/game/B_A-Login.php on line 44 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/battle1a/public_html/game/B_A-Login.php on line 46 [b]CODE[/b] $result = mysql_query($User_SQL, $DB_Server); $confirm = mysql_fetch_array($result); i am new to database connection and i appreciate all you help
  18. im using php 4.4.2 and mysql 4.1.19 iis there any way to connect the two versions .  if not does anyone know of other free servers that give 500MB and Mysql / PHP that will work to gether.  im currently with http://addyour.net
  19. hey guys im working on a login script and i have run into this error.  i hav no idea what it means or where to start debugging.  can anyone help me  ??? ERROR: Fatal error: Call to undefined function: mysqli_query() in [u]URL[/u] on line 44 LINE 44 IS:  $result = mysqli_query($User_SQL, $DB_Server); i am really stumped i have defined the variables used here: $User_SQL = "SELECT User_Name, Password FROM Table_1 WHERE User_Name = '" . $_POST['User_Name'] . "'"; $DB_Server = mysql_connect ($host, $account, $password); and the variable in those definitions are definately defined. all help will be much appreciated PC Nerd
  20. ok, i think i just found the problem, it was earlier with a database thats carried through,  lets me check it
  21. ok ERROR: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in [u][b]URL HERE [/b] [/u] on line 55 echo "<p>Please type what you see in the image.This is to stop scripts from playing the game for you.  Please read the Rule for more information.  The Image is Case sensitive.</p>"; $pic = rand(1, 6); echo "<img src = 'Graphics/Login $pic' alt = 'Login'>"; this is the sourounding code, at closer count, the rand() is line 55??????? All help appreciated
  22. php is telling me there is an error with a line where there is nothing, its just for spacing and the lines either side are an echo statement that ive checked and this .  Ive never used rand() before to i cant figure it out
×
×
  • 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.