Query Web ODBC

11/04/2011 20:22 dgaby#1
as I can put that all is for odbc connection? whom I spend a fixed

that has all the connections mssql

PHP Code:
<?php
    session_start
();
    
    include(
"../modules/include/Config.php");
    require_once(
"../modules/include/sqlConn.php");
    require_once(
"../modules/include/Security.php");
    
    if(!isset(
$_SESSION['loggedin'])) {
        
header("location:?notLoggedIn");
    } else {    
        
mssql_select_db($dbName1$dbConn) or die ("Couln't select database $dbName1");
        
        
        
$userID $_SESSION['name'];    
        
$ip $_SERVER['REMOTE_ADDR'];
        
$time time();
        
        
$voteid = ($_POST['votenum']);
        
        
define("VOTE_TIME""12");
        function 
clean_requests($time) {
            
$query mssql_query("select * from vote_log");
            
$i 0;
            while(
$row mssql_fetch_array($query)) {
                
$i++;
                
$lastvoted $row['vote_time'];
                if(
$time-$lastvoted VOTE_TIME*3600) {
                    if (!
mssql_query"delete from vote_log where vote_time='$lastvoted'")) {
                        return 
false;
                    }
                }
            }
            return 
true;
        }
        
        function 
vote_entries($userID) {
            
$entries mssql_query("select * from vote_log where account = '$userID' and vote_count > 1");
            if (!
$entries ) {
                die (
"Unable to get number of entries: ".mssql_error());
            }
            return 
mssql_num_rows($entries);
        }
        
        
        function 
votenow($votenum) {
            
$url "";
            if(
$votenum) {
                switch(
$votenum) {
                    case 
1:
                        
$url "http://";
                    break;
                    case 
2:
                        
$url "http://";
                    break;
                    default:
                        
header("location:./../?vote"); 
                    break;
                }
            }
            return 
$url;
        }
        
        if(
clean_requests($time)) {
            
$ip $_SERVER['REMOTE_ADDR'];
            
$voteCount 0;
            
$query mssql_query("select * from vote_log where account = '$userID'");
            while(
$row mssql_fetch_array($query)) {
                
$voteCount $row['vote_count'];
            }
            if (
$voteCount <= && vote_entries($userID) == 0) {
                
mssql_query("insert into vote_log (account, ip, vote_time, vote_count) VALUES ('$userID', '$ip', '$time', '1')");
                
mssql_query("exec CGI.CGI_WebPurchaseSilk 0,'$userID',0,4,0");
                
header("Location: ".votenow($voteid)."");
            } else if (
$voteCount == && vote_entries($userID) == 0) {
                
mssql_query("update vote_log set vote_count = '2' where ip = '$ip'");
                
mssql_query("exec CGI.CGI_WebPurchaseSilk 0,'$userID',0,5,0");
                
header("Location: ".votenow($voteid)."");
            } else {
                
header("location:./../?alreadyVoted");
            }
        }
    }
?>
help mee
11/07/2011 13:43 PlayCreedSRO#2
same problem