Jump to content

Warraven

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

About Warraven

  • Birthday 06/29/1994

Profile Information

  • Gender
    Male
  • Location
    Australia - Tasmania

Warraven's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Okay, I did that and put the starting session to the top yet it does the same error, here is my code now; <?php session_start(); ?> <style type="text/css"> <!-- body { background-color: #1F1E26; background-image: url(images/Site.jpg); background-repeat: no-repeat; } body,td,th { color: #0F0; font-family: Arial, Helvetica, sans-serif; font-size: 12px; } --> </style> <script type="text/javascript"> <!-- function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <body onLoad="MM_preloadImages('images/Home Over.jpg','images/Login Over.jpg')"><table width="490" height="821" border="0"> <tr> <td width="118" height="60"> </td> <td width="30"> </td> <td width="328"> </td> </tr> <tr> <td height="240"><table width="127" border="0"> <tr> <td width="121" height="52"><a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Home','','images/Home Over.jpg',1)"><img src="images/Home Normal.jpg" alt="Home" name="Home" width="140" height="37" border="0" id="Home" /></a></td> </tr> <tr> <td height="41"><a href="main_login.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Login','','images/Login Over.jpg',1)"><img src="images/Login Normal.jpg" alt="Login" name="Login" width="140" height="37" border="0" id="Login" /></a></td> </tr> <tr> <td height="40"> </td> </tr> <tr> <td height="42"> </td> </tr> </table></td> <td> </td> <td><?php include($_SERVER['DOCUMENT_ROOT'] . '/connection.php'); $ID = $_SESSION["ID"]; $selected = mysql_query("SELECT * FROM members WHERE id='$ID'") or die(mysql_error()); if (mysql_num_rows($selected) > 0) { while ($user = mysql_fetch_array($selected)) { echo "Welcome ".$user["username"]."<br />"; echo "Evo State: ".$user["class_armor"]."<br />"; echo "E-Level: ".$user["level"]."<br />"; echo "E-XP: ".$user["exp"]."<br />"; echo "Health: ".$user["health"]."<br />"; echo "Strength: ".$user["strength"]."<br />"; echo "Agility: ".$user["agility"]."<br />"; echo "Intellect: ".$user["intellect"]."<br />"; } }else { echo "<p>Sorry there are no results for this person</p>"; } ?></td> </tr> <tr> <td height="513"> </td> <td> </td> <td> </td> </tr> </table>
  2. Thanks I will test it now. (I am just starting php and mysql.)
  3. No, that wouldn't be it but thanks. That is because it all worked untill I pasted in the Mysql+PHP bit into the page like images would show ect. Then when I pasted that into the code it didn't work. And I have the images in a folder above the page called "Images".
  4. Hi there, I recently posted on help with a PHP game and I have just run into another error. When I was making my site in Dreamweaver I put the code in, the background ect. And when I tested it the background was just a plain color with the buttons just as the alternate text and no images, I think it has something to do with the code; <style type="text/css"> <!-- body { background-color: #1F1E26; background-image: url(images/Site.jpg); background-repeat: no-repeat; } body,td,th { color: #0F0; font-family: Arial, Helvetica, sans-serif; font-size: 12px; } --> </style> <script type="text/javascript"> <!-- function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <body onLoad="MM_preloadImages('images/Home Over.jpg','images/Login Over.jpg')"><table width="490" height="821" border="0"> <tr> <td width="118" height="60"> </td> <td width="30"> </td> <td width="328"> </td> </tr> <tr> <td height="240"><table width="127" border="0"> <tr> <td width="121" height="52"><a href="index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Home','','images/Home Over.jpg',1)"><img src="images/Home Normal.jpg" alt="Home" name="Home" width="140" height="37" border="0" id="Home" /></a></td> </tr> <tr> <td height="41"><a href="main_login.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Login','','images/Login Over.jpg',1)"><img src="images/Login Normal.jpg" alt="Login" name="Login" width="140" height="37" border="0" id="Login" /></a></td> </tr> <tr> <td height="40"> </td> </tr> <tr> <td height="42"> </td> </tr> </table></td> <td> </td> <td><?php session_start(); include($_SERVER['DOCUMENT_ROOT'] . '/connection.php'); $ID = $_SESSION["ID"]; $selected = mysql_query("SELECT * FROM members WHERE id='$ID'") or die(mysql_error()); if (mysql_num_rows($selected) > 0) { while ($user = mysql_fetch_array($selected)) { echo "Welcome ".$user["username"]."<br />"; echo "Evo State: ".$user["class_armor"]."<br />"; echo "E-Level: ".$user["level"]."<br />"; echo "E-XP: ".$user["exp"]."<br />"; echo "Health: ".$user["health"]."<br />"; echo "Strength: ".$user["strength"]."<br />"; echo "Agility: ".$user["agility"]."<br />"; echo "Intellect: ".$user["intellect"]."<br />"; } }else { echo "<p>Sorry there are no results for this person</p>"; } ?></td> </tr> <tr> <td height="513"> </td> <td> </td> <td> </td> </tr> </table> Please and Thankyou!
  5. *Drum roll* Yay! It worked, the stats and stuff shows! Username: Admin Email: red-hot-lava@hotmail.com Level: 1 Health: 30 Strength: 3 Agility: 3 Intellect: 3 Main Hand: Fist Off Hand: Fist Class: Traveler Thanks so much man, you've been very helpful. Is there anyway I can pay you back like a +rep or something?
  6. No prob, lol. It came up with this; Sorry there are no results for this person
  7. Yep, it came up with this; SQL IS:SELECT id FROM members WHERE username='Admin' and password='costin123' USER ID IS:1
  8. Okay it came up with this. (members_area.php) [\code] The Current Session ID is: Sorry there are no results for this person
  9. Sorry for the delay but I got this error in connection.php Parse error: syntax error, unexpected T_STRING in C:\wamp\www\connection.php on line 16
  10. Yep, I have made connect. And It worked, I think, I got this message; Sorry there are no results for this person
  11. Alright thanks, but yeah I have everything in my db. Sorry about the size.
  12. Yep, it worked. Except one thing, it doesn't show the stats next to the text. ???
  13. Yep, that fixed checklogin.php. Now in members_area.php I have; Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\members_area.php on line 15
  14. Well I added that session_start into it, and it returned the same error I started with, and now when I run from the start I get this error in my checklogin.php file. Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\checklogin.php on line 23 <?php $host="localhost"; // Host name $username=""; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // username and password sent from form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // 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); // To Fix the error in members_area.php create $_SESSION["username"] = stripslashes($myusername); create $_SESSION["password"] = stripslashes($mypassword); $sql="SELECT * FROM $tbl_name 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 row if($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"; } ?>
×
×
  • 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.