
Note that commands that use a parameter needs one space.
Also you might need to use a form to submit the actions.
At the moment it's only the PHP code part.
When I get time I'll post something complete.
This is just an example:
Code: Select all
<?php//CONFIGS$server = 'XXXXXXXX'; //Server$database = 'XXXXXXXX'; //Database name$user = 'XXXXXXXX'; //MySQL User$pass = "XXXXXXXX"; //MySQL User Password$reward = 14720; //Item ID$reward_name = 'Event - Apiga'; //Item's Name$quantity = 1; //Quantity of the item //END OF CONFIGS?> <head><title>Get your reward!</title><style type="text/css">.input_field, .button1 { background: #0c0c0c; border: 1px solid #1c1c1c; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 0.90em; padding: 3px; color: #FFFFFF;}</style></head><body bgcolor=#0b0b0b><center><form action=vote.php method=post><font color=orange><b>Character's Name:</b></font><br><input type=text name=char class=input_field><br><input class=button1 type=submit name=reward value='Send my Reward'></form><?phpif($quantity>1){$be='were';}else{$be='was';}if(isset($_POST['reward'])){mysql_connect("$server", "$user", "$pass");mysql_select_db("$database");$char = $_POST['char'];if($char == ""){echo "<font color=red>Invalid Character's Name!</font>";}else {$microtime = explode(" ", microtime());$microtime = $microtime[1];$voteTime = 12*60*60;$voteBounds = $microtime - $voteTime;$votedToday = mysql_query("SELECT site_voted FROM voting_system WHERE ip_address = '$char' && time_voted > $voteBounds");if(mysql_num_rows($votedToday) == 0) {$result = mysql_query("SELECT * FROM voting_system WHERE ip_address LIKE '$char'") or die(mysql_error());$row_sql = mysql_fetch_assoc($result);$total = mysql_num_rows($result); if($total>0){mysql_query("UPDATE voting_system SET time_voted='$microtime' WHERE ip_address='$char'");}else {mysql_query("INSERT INTO voting_system(ip_address, time_voted, site_voted) VALUES('$char', '$microtime', '1')"); } $query="SELECT * FROM characters WHERE char_name='$char' LIMIT 1"; $result = mysql_query($query); if($row = mysql_fetch_array($result)) { $id = $row['charId']; $acc = $row['account_name']; //$rec = $row['rec_have']; mysql_query("INSERT INTO items VALUES('$id', '', '$reward', '$quantity', '0', 'INVENTORY', '0', 'null', '0', '0', '-1', '-1')"); echo "<font color=green>Thanks for Voting!<br>$quantity $reward_name $be added to char $char </font><br><form method=post><input type=button class=button1 value='Close Window'onclick=\"window.close()\"></form>"; } else { echo "<font color=red>Character Doesn't Exist!<br></font>"; } }else { echo "<font color=red>You can only vote every 12 hours!</font><br><form method=post><input type=button class=button1 value='Close Window'onclick=\"window.close()\"></form>"; }}}?>
Could you share this complete voting system?disorder35 wrote:Can anyone help me please, I need a script that will give the item to the players after they vote on all 3 sites.
I need the Item to be added in inventory in game.
Please help me.
Thank you.
huh? your talking about mine?Naminator_X_ wrote:Oh how much i love unsafe PHP scripts
it's working fineNaminator_X_ wrote:I was talking about the telnet script BUT i haven't yet tested yours
Code: Select all
<?php include "l2jTelnet.php"; //host, port, pass, timeout $telnet = new telnet("127.0.0.1", "12345", "123456", 2); $telnet->init(); echo $telnet->write("help"); echo $telnet->write("help"); echo $telnet->write("status");