Forums

use old version

mja1356 07 Feb, 2009
Hi
I use CF since last year.after you released new version of CF(version 3) , I upgrade my CF but I can't work with new version easily.I used some php code in my form html but when i want to create table that field didn't appear.triumph, do boi, winny, thoi trang be gai, xe day tre em, do dung cao cap cho be, thoi trang cong so, vay lien cong so, ban buon quan ao, do lot[/url]
anyway my question is if i use ChronoForms V2.5 J1.5 RC3.1 is there any security problem?
can i use old version safe and secure🙄
GreyHead 07 Feb, 2009
Hi mja1356,

I don't think that there is any big security difference between the two except possibly fo the use of session tokens to prevent session high-jacking (I don't remember if that was in the old version).

**But** any Form HTML that worked in the old version should work exactly the same in the new version. Usually you can cut and paste between the two to upgrade with no problems.

Bob

Bob
mja1356 07 Feb, 2009
Hi Bob
I'm so confused about saving data to database.I create a form with some php and js code but it doesn't save any data to database.would you please take a look at this code and help me?
thanks

<body onload="return wl(this.form)">
<style>


#label_win,#label_lost,#loss,#game,#tip,#line,#odd {
background-color:#f8f8f8;
text-align:center;
border:0;
padding:0;
}
#win {
text-align:center;
}
.sub{
background-color: #999999;
border:0;
}
#slip{
background-color: #0C0C0C;
color:#FFFFFF;
}
#tb {
border-left: thin;
border-right:thin;
border-left-color:#000000;
border-right-color:#000000;
}
#game {
border-bottom:1px;
border-bottom-color:#000033;
margin-bottom:4px;
}
</style>
<?php
//connet to MySQL server
$db = mysql_connect("localhost", "test1", "123456");
mysql_select_db('test');
$dt=date('Y-m-d',time()-0.5*3600);
$cf=$_GET['cf_id'];
$gid=$_GET['g_id'];
$fid=$_GET['f_id'];
$user =& JFactory::getUser();
$userId = $user->get( 'id' );

$query = "select * from jos_chronoforms_1 where cf_id='$cf' order by Time_Hour, Time_Minute asc";
$cr="select * from jos_comprofiler where user_id='$userId'";
$resul = mysql_query($cr);
$raw = mysql_fetch_row($resul);

$result = mysql_query($query);
$row = mysql_fetch_row($result);
echo "<input type='text' name='ccredit' value='$raw[22]' id='ccredit' />";
echo "<input type='text' name='cfid' value='$row[0]'/>";
echo "<input type='text' name='betcode' value='10$row[0]'/>";


  ?>
  <table align="right"  dir="rtl" id="tb">
  <tr>
  
    <td colspan="2" align="right" id="slip"> سربرگ شرط</td>
  

 </tr>
  <?php
  echo "<tr>";
  
  
  echo "<td colspan='2' align='right'><input type='text' value='$row[7]    $row[9]' name='game' id='game' readonly></td>";
   echo "</tr>";
  

  echo "<tr>";
  if ($gid==1)
   echo "<td width='60'><input type='text' value='بازي کامل' name='tip' id='tip' readonly size='7'></td>";//kind of bet
	elseif ($gid==2)
	echo "<td><input type='text' value='نيمه اول' name='tip' id='tip' readonly size='7'></td>";
	else
	echo "<td><input type='text' value='Over/Under' name='tip' id='tip' readonly' size='7'></td>";
    
	echo "<td>";
   echo "<table dir='rtl'>";
  echo "<tr>";
switch ($gid)
{
case '1' :
{
if ($fid==1 and $row[11]==A)
echo "<td dir='ltr' id='line_td'><input type='text' value='$row[10]' name='line' id='line' readonly size='3'></td>";
elseif ($fid==1 and $row[11]==B)
{
$x1=$row[10]*(-1);
echo "<td dir='ltr'><input type='text' value='$x1' name='line' id='line' readonly size='3'></td>";
}
elseif ($fid==2 and $row[11]==A)
{
$x1=$row[10]*(-1);
echo "<td dir='ltr'><input type='text' value='$x1' name='line' id='line' readonly size='3'></td>";
}
else
echo "<td dir='ltr'><input type='text' value='$row[10]' name='line' id='line' readonly size='3'></td>";
}
break;

case '2' :
{
if ($fid==1 and $row[17]==A)
echo "<td dir='ltr'><input type='text' value='$row[16]' name='line' id='line' readonly size='3'></td>";
elseif ($fid==1 and $row[17]==B)
{
$x1=$row[16]*(-1);
echo "<td dir='ltr'><input type='text' value='$x1' name='line' id='line' readonly size='3'></td>";
}
elseif ($fid==2 and $row[17]==A)
{
$x1=$row[16]*(-1);
echo "<td dir='ltr'><input type='text' value='$x1' name='line' id='line' readonly size='3'></td>";
}
else
echo "<td dir='ltr'><input type='text' value='$row[16]' name='line' id='line' readonly size='3'></td>";
}
break;

case '3' :
{
if ($fid==1)
echo "<td><input type='text' value='O $row[22]' name='line' id='line' readonly size='3'></td>";
else
echo "<td><input type='text' value='U $row[22]' name='line' id='line' readonly size='3'></td>";
}
break;
}


switch ($gid)
{
case '1' :
{
if ($fid==1)
echo "<td dir='ltr'><input type='text' value='$row[12]' name='odd' id='odd' readonly size='2'></td>";
else
echo "<td dir='ltr'><input type='text' value='$row[13]' name='odd' id='odd' readonly size='2'></td>";
}
break;

case '2' :
{
if ($fid==1)
echo "<td dir='ltr'><input type='text' value='$row[18]' name='odd' id='odd' readonly size='2'></td>";
else
echo "<td dir='ltr'><input type='text' value='$row[19]' name='odd' id='odd' readonly size='2'></td>";
}
break;

case '3' :
{
if ($fid==1)
echo "<td dir='ltr'><input type='text' value='$row[23]' name='odd' id='odd' readonly size='2'></td>";
else
echo "<td dir='ltr'><input type='text' value='$row[24]' name='odd' id='odd' readonly size='2'></td>";

}
break;
}

echo "</tr>";
echo "</table>";
echo "</td>";
echo "</tr>";

echo "<tr>";
echo "<td align='center'><input type='text' id='label_win' name='label_win'  readonly='readonly' size='5'></td>";
echo "<td align='center'><input type='text' id='label_lost' name= 'label_lost' readonly='readonly' size='5'></td>";
echo "</tr>";
echo "<tr>";

echo "<td><label></label><input type='text'  name='win' id='win' onKeyUp=\"return change(this.form)\" size='8'></td>";

echo "<td><input type='text'  name='loss' id='loss' readonly size='8'></td>";

echo "</tr>";
	?>
<tr class="sub"><td>	
  <input type="submit" value="ارسال" name="B1" id="sub" class="sub"  size="8"></td>
  <td><input type="reset" value="انصراف" name="B2" size='20' class="sub"></td>
    </tr>
</table>
</body>


and javascript code:js code works i think there is somthing wrong in my php code


// 

function validate(myform)
{
var myTextBox = (document.getElementById('win'));
var x=(document.getElementById('win').value)-0;
var y=(document.getElementById('ccredit').value)-0;

if (x>y)
{
alert ('اعتبار شما کافی نیست');
myTextBox.focus();
   myTextBox.value = "";
		myTextBox.style.backgroundColor = "#003366";
		
		
		return false;
	}
	else if (x<=0)
	{
	alert ('لطفا مبلغ صحیح را وارد نمایید');
	myTextBox.focus();
   myTextBox.value = "";
		myTextBox.style.backgroundColor = "#fa7932";
		return false;
	}
	else
		return true;
	
}

function change(myform)
{
var myTextBox1 = (document.getElementById('loss'));
var myTextBox2 = (document.getElementById('win'));
var myTextBox3 = (document.getElementById('odd'));
var x=(myTextBox1.value)-0;
var y=(myTextBox2.value)-0;
var z=((myTextBox3.value)-0)*(-1);
if (z>0)
var lost=(y*z)/24;
else
var lost=((y*z)/24)*(-1);

   myTextBox1.value = Math.round(lost);
   

		return true;
	
}



function wl(myform)
{

var lwin = (document.getElementById('label_win'));
var llost = (document.getElementById('label_lost'));
var x=(document.getElementById('odd').value)-0;


if (x>0)
{

 lwin.value = "باخت";
llost.value = "برد";		
		
		
	}
	else 
	{
lwin.value = "برد";
llost.value = "باخت";	
}
	
}
mja1356 07 Feb, 2009
Hi
Maybe I put very much code here and no one doesn't come to see my post😢 😢 😢

I ask my question shortly
May i ask you to mention all reasons you know that prevent to save data in dbase?
GreyHead 07 Feb, 2009
Hi mja1356,

Sorry, I'm busy working on something else. I'll try to take a look in the next half-hour.

Bob
mja1356 07 Feb, 2009
My problem solved, I created a form to calculate some data and put it's address in submit URL
that was my problem.I removed that address and paste that code to after submit code.
GreyHead 07 Feb, 2009
Hi mja1356,

Excellent, well done.

There is no save to database in your form html. But here it is cleaned up and simplified:
<?php
?>
<!-- <body onload="return wl(this.form)">  -->
<style>
#label_win,#label_lost,#loss,#game,#tip,#line,#odd {
	background-color: #f8f8f8;
	text-align: center;
	border: 0;
	padding: 0;
}

#win {
	text-align: center;
}

.sub {
	background-color: #999999;
	border: 0;
}

#slip {
	background-color: #0C0C0C;
	color: #FFFFFF;
}

#tb {
	border-left: thin;
	border-right: thin;
	border-left-color: #000000;
	border-right-color: #000000;
}

#game {
	border-bottom: 1px;
	border-bottom-color: #000033;
	margin-bottom: 4px;
}
</style>
<?php
//connect to MySQL server

$db   =& JFactory::DBO();
$dt   = date('Y-m-d', time() - 0.5*3600);
$cf   = $_GET['cf_id'];
$gid  = $_GET['g_id'];
$fid  = $_GET['f_id'];
$user =& JFactory::getUser();
$userId = $user->get( 'id' );

$query   = "
	SELECT *
		FROM #__comprofiler
		WHERE user_id = '$userId';";
$db->query($query);
$raw = $db->loadRow();

$query = "
	SELECT *
		FROM #__chronoforms_1
		WHERE cf_id = '$cf'
		ORDER BY Time_Hour, Time_Minute ASC;";
$db->query($query);
$raw = $db->loadRow();
?>
<input type='text' name='ccredit' value='<?php echo $raw[22]; ?>' id='ccredit' />
<input type='text' name='cfid' value='<?php echo $row[0]; ?>'/>
<input type='text' name='betcode' value='10<?php echo $row[0]; ?>'/>

<table align="right" dir="rtl" id="tb">
	<tr>
		<td colspan="2" align="right" id="slip">????? ???</td>
	</tr>
	<tr>
		<td colspan='2' align='right'>
			<input type='text' value='<?php echo $row[7]." ".$row[9]; ?>'
				name='game' id='game' readonly>
		</td>
	</tr>
	<tr>
<?php
$width = "";
if ( $gid == 1 ) {
    $width = "width='60'";
	$value = '???? ???';
} elseif ( $gid == 2 ) {
	$value = '???? ???';
} else {
	$value = 'Over/Under';
}
?>
	<td <?php echo $width; ?> >
		<input type='text' value='<?php echo $value; ?>'
			name='tip' id='tip' readonly' size='7'>
	</td>

	<td>
		<table dir='rtl'>
			<tr>
<?php
$ltr = "dir='ltr'";
switch ( $gid ) {
    case '1' :
        if ( $fid == 1 and $row[11] == A ) {
            $value = $row[10];
        } elseif ( $fid == 1 and $row[11] == B) {
	        $value = $row[10]*(-1);
	    } elseif ( $fid == 2 and $row[11] == A) {
            $value = $row[10]*(-1);
         } else {
	        $value = $row[10];
        }
	    break;
    case '2' :
        if ( $fid == 1 and $row[17] == A) {
            $value = $row[16];
        } elseif ( $fid ==1  and $row[17] == B) {
            $value = $row[16]*(-1);
        } elseif ( $fid == 2 and $row[17] ==A ) {
            $value = $row[16]*(-1);
        } else {
            $value = $row[16];
        }
        break;
    case '3' :
        $ltr = "";
        if ( $fid == 1 ) {
            $value = 'O '.$row[22];
        } else {
            $value = 'U '.$row[22];
        }
        break;
	}
?>
		<td <?php echo $ltr; ?> >
    		<input type='text' value='<?php echo $value; ?>'
    			name='line' id='line' readonly size='3'>
        </td>";
<?php
switch ( $gid ) {
    case '1' :
        if ( $fid == 1 ) {
            $value = $row[12];
        } else {
            $value = $row[13];
        }
        break;
    case '2' :
        if ( $fid == 1 ) {
            $value = $row[18];
        } else {
            $value = $row[19];
        }
        break;
    case '3' :
        if ( $fid == 1 ) {
            $value = $row[23];
        } else {
            $value = $row[24];
        }
        break;
}
?>
		<td dir='ltr'>
			<input type='text' value='<?php echo $value; ?>'
				name='odd' id='odd' readonly size='2'>
		</td>";
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td align='center'>
			<input type='text' id='label_win' name='label_win'
				readonly='readonly' size='5'>
		</td>
		<td align='center'>
			<input type='text' id='label_lost' name='label_lost'
				readonly='readonly' size='5'>
		</td>
	</tr>
	<tr>
		<td>
			<input type='text'  name='win' id='win'
				onKeyUp='return change(this.form)' size='8'>
		</td>
		<td>
			<input type='text' name='loss' id='loss' readonly size='8'>
		</td>
	</tr>
	<tr class="sub">
		<td>
			<input type="submit" value="?????" name="B1" id="sub" class="sub" size="8">
		</td>
		<td>
			<input type="reset" value="??????" name="B2" size='20' class="sub">
		</td>
	</tr>
</table>

Bob
This topic is locked and no more replies can be posted.