Jump to content

Hello help needed for permissions


rastaman46

Recommended Posts

Hello needed for permissions

 

well dont know even how to ask .

 

im building simple betting and im want to add message if user has submitted bet

 

but problem im got is once user submit all other bets comes with message how to make it work separate for every single row

 

Here is my code

 

$statom = $TSUE['TSUE_Database']->query("SELECT count(*), b.betid, a.betid, a.memberid, a.chosen_team FROM rasta_betters a, rasta_betting b  WHERE memberid = ".$TSUE['TSUE_Member']->info["memberid"]." AND b.betid = a.betid ");       
	 $arr = mysqli_fetch_array($statom);
                 if ($arr[0] > 0) 
	 {
	 $forma = '<div class="success">You have placed bet here</div>';
	 }
	 else{			 
	 $team1 = $row['team1'];
	 $team2 = $row['team2'];
	 $pisk = '<input type="checkbox" name="komanda" value="'.$team1.'" />';
	 $pisk2 = '<input type="checkbox" name="komanda" value="'.$team2.'" />';
	 $komanda = '';
	 $komanda = $team1.$pisk;
	 $komanda2 = '';
	 $komanda2 = $team2.$pisk2;
	 $forma =  'This bet end on:'. date('Y-m-d H:i:s',$row['finish']).'';
         eval("\$betting_form = \"".$TSUE['TSUE_Template']->LoadTemplate('betting_form')."\";");
	 $forma .= $betting_form;
	 }	 

 

$TSUE['TSUE_Member']->info["memberid"] that is actual user id gets id auto

Link to comment
Share on other sites

definitely not enough information here.

you're saying you want a message to be added along with a users bet when created.

well what is your database structure like? how do bets work?

why can't you add an additional field into your sql table called message and store the content there?

we need more code and more information, thanks.

Link to comment
Share on other sites

Thanks for reply im want to do when user have submitted bet its stops displaying submit form

 

way im got now is once im submit bet all other bets comes with message but im want display message just for submitted one  bcoz its record user id in sql

 

i can post full code if need to

Link to comment
Share on other sites

from what you're saying, you're still getting the success message even after submitting the form.

this is a generic way to process form data and not show the form if it was submitted

<?php
if( isset( $_POST['process'] ) )
{
    // here you'll have all form submitted data
    print_r($_POST);
    echo '<br/>form submitted, data needs to be checked still';
}
else
{
?>
<form action="" method="post">
<input type="text" name="somedata" />
<input type="submit" name="process" />
</form>
<?php
}

 

if that doesn't help you with your situation, then yeah, go ahead and post the full code.

if the code i posted doesn't do what you want, then make sure you clarify on exactly what you need to happen.

Link to comment
Share on other sites

70050061.jpg

 

The green shows up for all not submitted  but imn have just placed bet just for one of them but rest still comes with message (Im not bet them yet)

 

Maybe im ruining sql wrong??

 

here full code

 

<?php
/*
This page coded by rastaman46 special for www.tsue-themes.net
*/

//Required for Active Members / Last 24 Active Members Plugins
define('SCRIPTNAME', 'betting.php');

//Load templates for this page to avoid extra usage of SQL queries.
$LoadTemplatelist = array('betting');

//Init
require('./library/init/init.php');

//Set Page Title
$Page_Title = get_phrase('betting');

//Create & Add Breadcrumb
AddBreadcrumb(array
(
get_phrase('navigation_home') => $TSUE['TSUE_Settings']->settings['global_settings']['website_url'].'/?p=home&pid=1',
get_phrase('betting') => $TSUE['TSUE_Settings']->settings['global_settings']['website_url'].'/?p=betting&pid='.PAGEID
));
$ratio = number_format($TSUE['TSUE_Member']->info["uploaded"] / $TSUE['TSUE_Member']->info["downloaded"], 2);

// here all begins
$memberid = '';
$statymai ='';
$forma = '';
$statom = $TSUE['TSUE_Database']->query("SELECT count(*), b.betid, a.betid, a.memberid, a.chosen_team FROM rasta_betters a, rasta_betting b  WHERE memberid = ".$TSUE['TSUE_Member']->info["memberid"]." AND b.betid = a.betid ");       
	 $arr = mysqli_fetch_array($statom);	  
$bets = $TSUE['TSUE_Database']->query("SELECT betid, bet_name, user_id, team1, team2, start, finish, image1, image2 FROM rasta_betting ");       
	 while ($row = $TSUE['TSUE_Database']->fetch_assoc($bets)) {
	 $betting_rezults = '';
	 $betting_form = '';
	 $betid = $row['betid'];
	 $finish = $row['finish'];
	 $laikas = TIMENOW;
	 $komanda = $row['team1'];
	 $komanda2 = $row['team2'];
	 $bet_name = $row['bet_name'];
	 $userid = $row['user_id'];			 
         $image1 = $row['image1'];
         $image2 = $row['image2'];
	 $forma = '';	

         if($ratio < 1)
	 {
	 $forma = '<div class="error" id="show_error">Your ratio is to low to place Bet</div>';
	 }
	 elseif ($laikas > $finish)
	 {
	 $forma = '<div class="error" id="show_error">This bet Hase been ended</div>';
	 }

     elseif ($laikas > $finish)
	 {
	 $team1 = $row['team1'];
	 $team2 = $row['team2'];
	 $komanda = '';
	 $komanda = $team1;
	 $komanda2 = '';
	 $komanda2 = $team2;
	 } 
         elseif ($arr[0] > 0) 
	 {
	 $forma = '<div class="success">You have placed bet here</div>';
	 }
	 else{			 
	 $team1 = $row['team1'];
	 $team2 = $row['team2'];
	 $pisk = '<input type="checkbox" name="komanda" value="'.$team1.'" />';
	 $pisk2 = '<input type="checkbox" name="komanda" value="'.$team2.'" />';
	 $komanda = '';
	 $komanda = $team1.$pisk;
	 $komanda2 = '';
	 $komanda2 = $team2.$pisk2;
	 $forma =  'This bet end on:'. date('Y-m-d H:i:s',$row['finish']).'';
         eval("\$betting_form = \"".$TSUE['TSUE_Template']->LoadTemplate('betting_form')."\";");
	 $forma .= $betting_form;
	 }	 
         eval("\$betting_rezults = \"".$TSUE['TSUE_Template']->LoadTemplate('betting_rezults')."\";");
    $statymai .= $betting_rezults;

}


if (isset($_POST['placebet']))
{
$statymo_dydis = '';
$statymo_dydis = 1073741824;
$suma = $_POST['suma'];
$statoma = $suma * $statymo_dydis;
$vartotojas = $TSUE['TSUE_Member']->info["memberid"];
$komanda = $_POST['komanda'];
$betid =$_POST['betid'];
$kada = TIMENOW;
$irasom = $TSUE['TSUE_Database']->query("INSERT INTO `rasta_betters`(betterid, betid, memberid, chosen_team, bett, added) VALUES ('','$betid','$vartotojas','$komanda','$statoma','$kada')");

      $test ='';
  $test = '<div class="information" id="show_information">Bet hase been placed.</div>';
  $naujinam =	$TSUE['TSUE_Database']->query("update tsue_member_profile set uploaded=uploaded-'$statoma' where memberid=".$TSUE['TSUE_Member']->info["memberid"]."");
}

//Get Page Template
eval("\$betting = \"".$TSUE['TSUE_Template']->LoadTemplate('betting')."\";");
//Print HTML Output
PrintOutput($betting, $Page_Title);
?>

Link to comment
Share on other sites

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.