Problem on php script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mikola
Forum Newbie
Posts: 4
Joined: Thu Feb 19, 2009 3:25 am

Problem on php script

Post by mikola »

The index page loads forever.

the script is loading forever on index page.

http://bet.evolos.gr/index.php?a=

this is the url

Could someone give an idea whats happening.
User avatar
papa
Forum Regular
Posts: 958
Joined: Wed Aug 27, 2008 3:36 am
Location: Sweden/Sthlm

Re: Problem on php script

Post by papa »

Woud help if we could view the code for index.php

Put it in [ code ] tags.
mikola
Forum Newbie
Posts: 4
Joined: Thu Feb 19, 2009 3:25 am

Re: Problem on php script

Post by mikola »

Code: Select all

<?
error_reporting(E_ALL ^ E_NOTICE);
 
 
 
$needpin = false;
require("functions.php");
$sido = generateSID();
require("classTicket.php");
 
 
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");
mysql_query('SET NAMES utf8'); 
 
if(!isset($_COOKIE['bet']))
{
  setcookie("bet",$sido,time()+(60*30));
  $a = $_GET['a'];           //action 
  $rid = intval($_GET['rid']); //ref
  setcookie("rid", $rid, time()+(60*30));
  goto('index.php?a='.$a); 
}
 
$gmtdate = gmdate("Y-m-d H:i:s");
include('timezone.php');
$tzofset = GetTime(27);//gmt london
$data = date("Y-m-d H:i:s", mktime(gmdate("H"), gmdate("i") + $tzofset*60, gmdate("s"), gmdate("m"), gmdate("d"), gmdate("Y")));
 
session_start();
$ticket = new ticket;
//include('languages.php');
$sid=addslashes($_COOKIE['bet']);
loadTicket();
 
if(isset($_COOKIE['klaida1']))
{
  $klaida1=stripslashes($_COOKIE['klaida1']);
}
 
setcookie("klaida1","",time()-60);
setcookie("bet",$_COOKIE['bet'],time()+1800);
setcookie("rid",$_COOKIE['rid'],time()+1800);
if (!empty($sid)) {
  if(mysql_num_rows(mysql_query("SELECT * FROM `sessions` where `sid`='$sid'"))>0) { 
    $status = 'inside'; 
    $user   = getUser();
    $uid    = $user['id'];
    mysql_query("UPDATE `bet_users` set `lastdate`='$gmtdate' where `id`='$uid'");
 
    $rez1 = mysql_query("SELECT `timezone` FROM `bet_users` where `id`='$uid'");    
    $r1 = mysql_fetch_array($rez1);
 
    $tzofset = GetTime($r1['timezone']);
     
    $data = date("Y-m-d H:i:s", mktime(gmdate("H"), gmdate("i") + $tzofset*60, gmdate("s"), gmdate("m"), gmdate("d"), gmdate("Y")));
  }   
}
 
###########Ismokam affiliate#######
$thism = date("Y-m-");
$day   = date("d");
$config = mysql_fetch_array(mysql_query("SELECT * FROM `config`"));
$maxbet = $config['maxbet'];
if($day==1&&mysql_num_rows(mysql_query("SELECT * FROM `affiliate_payments` where `date` like '$thism'"))==0)
include("affiliate_count.php");
###########Fixinam###########
//include("fix.php");
$ip=$_SERVER['REMOTE_ADDR'];
#########Gaunam userio info################
if(isset($_POST['verification']))
{
   verificate($_POST['date'], $_POST['pin']);
}
$times = addslashes(trim($_COOKIE['times']));
$timer = getTimer($times);
$_COOKIE['times'] = 0;
//gaunam tekstus
$r=mysql_fetch_array(mysql_query("SELECT * FROM `config` where `id`='1'"));
$refp=$r['ref'];
$index=stripslashes(nl2br($r['index']));
$kontaktai=stripslashes(nl2br($r['kontaktai']));
$rules=stripslashes(nl2br($r['rules']));
$faq=stripslashes(nl2br($r['faq']));
$ad=stripslashes(nl2br($r['ad']));
 
###########Atliekam statymus jei yra################
 
//$maxbet = $user['betlimit'];
if (isset($_POST['betante']) && $ticket -> num > 0) {
 $ticket -> stake = floatval(str_replace(",",".",$_POST['amount']));
 if($user['money'] >= $ticket -> stake && $ticket -> stake >= 1) { 
    if($ticket -> stake > $maxbet) {
      $klaida1="Maximum bet stake is $maxbet $!";       
    } else {
      $ticket -> user = $user['id'];
      $klaida1 = $ticket -> bet();
      $r= mysql_fetch_array(mysql_query("SELECT * FROM `emails` WHERE `type`='ticketplaced'"));
      $msg=$r['message'];
      $msg=str_replace("KOFASVALUE", $kofas, $msg);
      $msg=str_replace("STAKEVALUE", $stake, $msg);
      $msg=str_replace("WINVALUE", $win, $msg);
      if($klaida1=="Your bet was placed!") {
        $headers="From:DoNoReply@sportbettingscript.com";
        $headers .= 'MIME-Version: 1.0\n';
        $headers .= 'Content-type: text/html; charset=UTF-8';
      $money = round($user['money'] - floatval(str_replace(",",".",$_POST['amount'])),2);
      mysql_query("UPDATE `bet_users` set `money`='$money' where `id`='".$user['id']."'");
      $user['money'] = $money;
      mail("$em","SEGbet.com - Ticket placed",$msg,$headers);
      saveTicket();
    }
   }
  }
 else
  {
    $klaida1 = "You don't have enough money or your ticket is empty!";
  }
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="description" content="Sportbettingscript.com - Your Sport Betting Platform!">
  <meta name="keywords" content="sportbetting script, sportbook script, platform, sportbook platform, sportbetting platform,e-gold, liberty reserve, pecunix, betting, odds." >
  <meta name="author" content="Sportbettingscript.com" >
  <meta name="reply-to" content="" >
  <meta name="copyright" content="Sportbettingscript.com" >
  <meta name="revisit-after" content="5 days" >
  <meta name="identifier-url" content="http://www.Sportbettingscript.com" >
 
 
<script type="text/javascript">
var currenttime = '<? echo date("F d, Y H:i:s", strtotime($data)); ?>'
var currentDate = new Date(currenttime);
var timeZone = ""
var h,m,s,monthName,d,y;
var month=new Array(12);
month[0]="<?=$January;?>";
month[1]="<?=$February;?>";
month[2]="<?=$March;?>";
month[3]="<?=$April;?>";
month[4]="<?=$May;?>";
month[5]="<?=$June;?>";
month[6]="<?=$July;?>";
month[7]="<?=$August;?>";
month[8]="<?=$September;?>";
month[9]="<?=$October;?>";
month[10]="<?=$November;?>";
month[11]="<?=$December;?>";
function startTime() {
    timeStr = formatTime(currentDate); 
    document.getElementById('time').innerHTML= timeStr;
    currentDate.setSeconds(currentDate.getSeconds() + 1);
    t=setTimeout('startTime()',1000);
}
function formatTime(dateTime)
{
    h = checkTime(currentDate.getHours());
    m = checkTime(currentDate.getMinutes());
    s = checkTime(currentDate.getSeconds());
    monthName = month[currentDate.getMonth()];
    d = checkTime(currentDate.getDate());
    y = checkTime(currentDate.getYear());
    timeStr = h+':'+m+':'+s+', '+d+'. '+monthName;
    return timeStr + ' ' + timeZone;
}
function checkTime(i){
if (i < 10) 
  {i="0" + i;}
  return i;
}
function oddc() {
document.showodd.submit();
}
</script>
 
<title><?=$title;?></title>
<link href="style.css" type="text/css" rel="stylesheet" >
<script src="betting.js" type="text/javascript"></script>
</head>
 
<body onload="startTime()">
 
<?
include("header.php");
?>
 
<div class="index-content">
<?
include("left.php");
?>
 
<div id="rightcolumn">
 
 <div id="content"> <font size="1" face="Verdana">
 
<table ALIGN="CENTER" border="0" >
<tr>
<TD WIDTH="300PX">&nbsp;</TD>
<td>
<form class="loginformstyle" action="" method="post" name="showodd">
       <?=$odds_system;?>
       <select class="xlogininput" name="hh" onchange="oddc()">
         <option value=""><?=$Select_system;?></option>    
         <option value="EU"><?=$EU;?></option>
         <option value="US"><?=$US;?></option>
         <option value="UK"><?=$UK;?></option>
       </select>
</form>
</td>
<td>
<div id='time' style="text-align:right;" ></div>
</td>
</tr>
</table>
 
THIS IS THE FIRST PART OF THE CODE
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Problem on php script

Post by Benjamin »

Do your tables have indexes on the fields you are using in the where clauses? How many records does each table have?
mikola
Forum Newbie
Posts: 4
Joined: Thu Feb 19, 2009 3:25 am

Re: Problem on php script

Post by mikola »

astions wrote:Do your tables have indexes on the fields you are using in the where clauses? How many records does each table have?

YES THEY HAVE.

THE BIGGEST TABLE HAS 1671 RECORDS
mikola
Forum Newbie
Posts: 4
Joined: Thu Feb 19, 2009 3:25 am

Re: Problem on php script

Post by mikola »

Code: Select all

<? 
global $em;
$a = addslashes($_GET['a']);
if($needpin) { 
  $ti = date("Y-m-d G:i:s",time()+(60*15));
  $f = rand(0,999);
  $s = rand(0,999);
 
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From:DoNotReply@sportbettingscript.com';
 
  $pin=$f.'-'.$s;
  $r=mysql_fetch_array(mysql_query("SELECT * FROM `bet_users` where `id`='$uida'"));
  $usr = $r['usr'];
  $msg=mysql_result(mysql_query("SELECT * FROM `emails` WHERE type='PIN'"),0,"message");
  $msg=str_replace("USERNAMEVALUE", $usr, $msg);
  $msg=str_replace("PINVALUE", $pin, $msg);
  $msg=str_replace("IPVALUE", $ip, $msg);
  $msg=str_replace("EXPIRESVALUE", $ti, $msg);
  mail($em,"sportbettingscript.com PIN", $msg, $headers); 
  mysql_query("UPDATE `bet_users` set pin='$pin',pintimeout='$ti' where `id`='$uida'");
  require("pages/needpin.php"); 
} else {
  require("content.php");
} 
?>
<!-- End Content -->
 
</div>
 
</div>
</div>
 
<?
include("footer.php");
?>
 
<iframe id="link" width="0" height="0" style='display:none;' border="0"></iframe>
<?
cachegames();
?>
</body>
</html>
THIS IS THE LAST PART OF THE CODE OF INDEX
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Problem on php script

Post by Benjamin »

Have a look at this link which will show you how to time your source code. Using this you should be able to nail it down. Please post back and let us know what the issue was because it will help others.

http://us2.php.net/manual/en/function.m ... .php#83642
Post Reply