Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/225241-need-help-on-project/
Share on other sites

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");
}
?>

 

 

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());

 

 

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???

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.