Skip to content

Instantly share code, notes, and snippets.

@3l3ktr0n
Created December 3, 2018 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3l3ktr0n/1df9c6f76cf1487d5608f0c779575e0d to your computer and use it in GitHub Desktop.
Save 3l3ktr0n/1df9c6f76cf1487d5608f0c779575e0d to your computer and use it in GitHub Desktop.
<?php
require_once("class2.php");
if (!defined('e107_INIT'))
{
exit;
}
require_once(HEADERF);
if (isset($_POST['insert_game'])){
$insert = array(
'gameid' => 123, //$gameid,
'userid' => USERID, //$userid,
'username' => USERNAME //$username
);
$sql->insert('usergames', $insert);
$text = e107::getMessage();
$text->addSuccess('INFORMATION ADDED TO DATABASE.');
echo $text->render();
}
if (isset($_POST['delete_game'])){ /////////////EI TÖÖTA NII NAGU VAJA
$gameid = 123;
$userid = USERID;
$sql->delete("usergames", "gameid='$gameid'", "userid='$userid'");
$text = e107::getMessage();
$text->addSuccess('GAME REMOVED FROM DATABASE.');
echo $text->render();
}
/*function checkgame()///////////////////////BLABLAH
{
$check = array(
'gameid' => 123,
'userid' => USERID,
'username' => USERNAME
);
$game = "SELECT gameid, userid, username FROM #userrecipes";
}*/
if(USER){/////////////////////////////////////////
$text .= "<form id='game' action='" . e_SELF . "' method='post'><input class='button' type='submit' name='insert_game' value='ADD' /></form>";
//if ($row['gameid']==123 && $row['userid']==USERID){
$text .= "<form id='game' action='" . e_SELF . "' method='post'><input class='button' type='submit' name='delete_game' value='DELETE' /></form>";
//}
}
else
{
$text .= "LOGIN TO USE THIS FUNCTION.";
}
$ns->tablerender("", $text);
require_once(FOOTERF);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment