buladex Posted January 21, 2011 Share Posted January 21, 2011 its a claime reward system i need !! we have 2 sql table 1 st user table : name = abc account_id=123 2 nd reward table(this will be whit value after insert comand): action= id= account_id= op= op2= time= i need that this page can be opened only if its redirected from a fix web adress user gets on this page and has a login kind of form where he puts his player name, if the name checks in user table insert action fallows and i need after insert to look like this: reward table: action=123456 id= account_id=123 op=0 op2=1 time=64800 i tried many ways but im a noob didnt figure it out and took a long time and no results please help me! i done similar php by my own but they were whit update not insert and the biggest problem here i can get the account id value from user table by insert in account id in reward table Quote Link to comment Share on other sites More sharing options...
Maq Posted January 21, 2011 Share Posted January 21, 2011 You haven't asked a question... Please post your code, how else are we supposed to help? Quote Link to comment Share on other sites More sharing options...
buladex Posted January 21, 2011 Author Share Posted January 21, 2011 brb whit script in few minutes!! Quote Link to comment Share on other sites More sharing options...
buladex Posted January 21, 2011 Author Share Posted January 21, 2011 here is main login form : test</center> </td> </tr> <tr> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="red"> <tr> <form name="form1" method="post" action="checklogin.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="gold"> <tr> <td colspan="3"><center/><strong>reward</strong></center></td> </tr> <tr> <td width="200">Player Name (in game)</td> <td width="6">:</td> <td width="294"><input name="myusername" type="text" id="myusername"></td> </tr> <tr> <td> </tr> <tr> <td> </tr> <tr> <td>Warehouse Password or 0 if u dont have</td> <td>:</td> <td><input name="mypassword" type="text" id="mypassword"></td> </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="Submit" value="Claime"></td> </tr> </table> </td> </form> </tr> </table> <br><center/><font size="5"><font color="FF0000"> Reward claime</center> here is chechlogin : <?php $host="localhost"; // Host name $username="test"; // Mysql username $password="test"; // Mysql password $db_name="test"; // Database name $tbl_name="user_table"; // Table name mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name WHERE name='$myusername' and lock_key='$mypassword'"; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count==1) { $sql="SELECT * FROM $tbl_name WHERE trp > 20000000 and name='$myusername'"; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count==1) { $sql="SELECT * FROM $tbl_name WHERE lvl > 70 and name='$myusername'"; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count==1) { mysql_query("this is the part i miss"); session_register("myusername"); session_register("mypassword"); header("location:Ranked.php"); mysql_close($myconn); } else { header("location:2vote.php"); } } else { header("location:smalllvl.php"); } } else { header("location:smalllvl.php"); } ?> Quote Link to comment Share on other sites More sharing options...
Maq Posted January 21, 2011 Share Posted January 21, 2011 Where's the part where you're trying to insert into the table? Quote Link to comment Share on other sites More sharing options...
buladex Posted January 21, 2011 Author Share Posted January 21, 2011 mysql_query("this is the part i miss"); thats the thing i cant figure it out it should look like : INSERT INTO `reward` VALUES ('123456', '', 'account_id value', '0', '1', '64800'); Quote Link to comment Share on other sites More sharing options...
Maq Posted January 21, 2011 Share Posted January 21, 2011 I'm not sure where you're getting these values from except for the account_id. Something like this: $row = mysql_fetch_assoc($result); $sql = "INSERT INTO `reward_table` (action. id, account_id, op, op2, time) VALUES ('123456', '', '{$row['account_id']}', '0', '1', '64800')"; mysql_query($sql) or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
buladex Posted January 21, 2011 Author Share Posted January 21, 2011 not good cuz thats the problem there are 2 different tables and i need value from 1 st to 2 nd table on account id, i just tot of something: better to define account id like $id="SELECT account_id FROM $tbl_name WHERE name='$myusername' and lock_key='$mypassword'"; but how i put it in insert??? Quote Link to comment Share on other sites More sharing options...
Maq Posted January 21, 2011 Share Posted January 21, 2011 Aren't you getting the account_id from the previous query? $sql="SELECT * FROM $tbl_name WHERE lvl > 70 and name='$myusername'"; Quote Link to comment Share on other sites More sharing options...
buladex Posted January 21, 2011 Author Share Posted January 21, 2011 yes i just realised i had an bad line of code, all work great ty, now how can i make main login be accesed form a specific web address? Quote Link to comment Share on other sites More sharing options...
Maq Posted January 21, 2011 Share Posted January 21, 2011 yes i just realised i had an bad line of code, all work great ty, now how can i make main login be accesed form a specific web address? Not sure exactly what you mean. Could you provide an example? Quote Link to comment Share on other sites More sharing options...
buladex Posted January 21, 2011 Author Share Posted January 21, 2011 yes the page can be accessed only from my partener site , ill try htaccess order deny,allow deny from all allow from "partener site here" this should work right?? Quote Link to comment Share on other sites More sharing options...
Maq Posted January 21, 2011 Share Posted January 21, 2011 yes the page can be accessed only from my partener site , ill try htaccess order deny,allow deny from all allow from "partener site here" this should work right?? Yes, that's one possibility. You should mark this topic solved and start a new thread. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.