Пример #1
0
function mail_users($subject, $body)
{
    $query = msql_query("SELECT `email`, `first_name` FROM `users` WHERE `allow_email` = 1");
    while ($row = mysql_fetch_assoc($query) !== false) {
        email($row['email'], $subject, "Hello" . $row['first_name'] . ",\n\n" . $body);
    }
}
Пример #2
0
 function simpleQuery($query)
 {
     $this->last_query = $query;
     $query = $this->modifyQuery($query);
     $result = @msql_query($query, $this->connection);
     if (!$result) {
         return $this->raiseError();
     }
     // Determine which queries that should return data, and which
     // should return an error code only.
     return DB::isManip($query) ? DB_OK : $result;
 }
Пример #3
0
 function Query($query)
 {
     $this->Debug("Query: {$query}");
     $first = $this->first_selected_row;
     $limit = $this->selected_row_limit;
     $this->first_selected_row = $this->selected_row_limit = 0;
     if (!$this->SelectDatabase()) {
         return 0;
     }
     if ($result = msql_query($query, $this->connection)) {
         if (substr(strtolower(ltrim($query)), 0, strlen("select")) == "select") {
             if ($limit > 0) {
                 $this->limits[$result] = array($first, $limit);
             }
             $this->highest_fetched_row[$result] = -1;
         }
         $this->affected_rows = msql_affected_rows($result);
     } else {
         return $this->SetError("Query", msql_error());
     }
     return $result;
 }
Пример #4
0
 /**
  * Returns information about a table or a result set
  *
  * @param object|string  $result  DB_result object from a query or a
  *                                 string containing the name of a table.
  *                                 While this also accepts a query result
  *                                 resource identifier, this behavior is
  *                                 deprecated.
  * @param int            $mode    a valid tableInfo mode
  *
  * @return array  an associative array with the information requested.
  *                 A DB_Error object on failure.
  *
  * @see DB_common::setOption()
  */
 function tableInfo($result, $mode = null)
 {
     if (is_string($result)) {
         /*
          * Probably received a table name.
          * Create a result resource identifier.
          */
         $id = @msql_query("SELECT * FROM {$result}", $this->connection);
         $got_string = true;
     } elseif (isset($result->result)) {
         /*
          * Probably received a result object.
          * Extract the result resource identifier.
          */
         $id = $result->result;
         $got_string = false;
     } else {
         /*
          * Probably received a result resource identifier.
          * Copy it.
          * Deprecated.  Here for compatibility only.
          */
         $id = $result;
         $got_string = false;
     }
     if (!is_resource($id)) {
         return $this->raiseError(DB_ERROR_NEED_MORE_DATA);
     }
     if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
         $case_func = 'strtolower';
     } else {
         $case_func = 'strval';
     }
     $count = @msql_num_fields($id);
     $res = array();
     if ($mode) {
         $res['num_fields'] = $count;
     }
     for ($i = 0; $i < $count; $i++) {
         $tmp = @msql_fetch_field($id);
         $flags = '';
         if ($tmp->not_null) {
             $flags .= 'not_null ';
         }
         if ($tmp->unique) {
             $flags .= 'unique_key ';
         }
         $flags = trim($flags);
         $res[$i] = array('table' => $case_func($tmp->table), 'name' => $case_func($tmp->name), 'type' => $tmp->type, 'len' => msql_field_len($id, $i), 'flags' => $flags);
         if ($mode & DB_TABLEINFO_ORDER) {
             $res['order'][$res[$i]['name']] = $i;
         }
         if ($mode & DB_TABLEINFO_ORDERTABLE) {
             $res['ordertable'][$res[$i]['table']][$res[$i]['name']] = $i;
         }
     }
     // free the result only if we were called on a table
     if ($got_string) {
         @msql_free_result($id);
     }
     return $res;
 }
Пример #5
0
function sql_query($query, $id)
{
    global $dbtype;
    global $sql_debug;
    $sql_debug = 0;
    if ($sql_debug) {
        echo "SQL query: " . str_replace(",", ", ", $query) . "<BR>";
    }
    switch ($dbtype) {
        case "MySQL":
            $res = @mysql_query($query, $id);
            return $res;
            break;
        case "mSQL":
            $res = @msql_query($query, $id);
            return $res;
            break;
        case "postgres":
        case "postgres_local":
            $res = pg_exec($id, $query);
            $result_set = new ResultSet();
            $result_set->set_result($res);
            $result_set->set_total_rows(sql_num_rows($result_set));
            $result_set->set_fetched_rows(0);
            return $result_set;
            break;
        case "ODBC":
        case "ODBC_Adabas":
            $res = @odbc_exec($id, $query);
            return $res;
            break;
        case "Interbase":
            $res = @ibase_query($id, $query);
            return $res;
            break;
        case "Sybase":
            $res = @sybase_query($query, $id);
            return $res;
            break;
        default:
            break;
    }
}
Пример #6
0
 function query_msql($query)
 {
     if (!$this->msql_link) {
         return false;
     }
     $this->query_result = msql_query($query, $this->msql_link);
     if ($this->query_result) {
         return $this->query_result;
     } else {
         print nl2br("Error query. \n");
         return false;
     }
 }
Пример #7
0
function GetAllWikiPageNames($dbi_)
{
    $res = msql_query("select pagename from wiki", $dbi['dbc']);
    $rows = msql_num_rows($res);
    for ($i = 0; $i < $rows; $i++) {
        $pages[$i] = msql_result($res, $i, 'pagename');
    }
    return $pages;
}
Пример #8
0
            <input type="submit" name="submit" value="上传" />
        </form>

        <?php 
$email = $_SESSION['p_email'];
$ret = mysql_query("SELECT * FROM Images WHERE email = '{$email}'");
if ($row = mysql_fetch_array($ret)) {
    ?>
        
        <div style='width:170px;'>
            <img src="image.php?" width="500" height="500" border="0">
        </div>
        <?php 
} else {
    $_SESSION['p_email'] = 'default';
    $ret = msql_query("SELECT * FROM Images WHERE email='default'");
    while ($row = mysql_fetch_array($ret)) {
        ?>
        
            <div style='width:170px;'>
                <img src="image.php?" width="500" height="500" border="0">
            </div>     
        <?php 
    }
}
?>
    
    </div>
   
    <div id="username"></div>
   
Пример #9
0
Password:<input type=password name='pass'><br/>
<input type=submit value='Go!' name='submit'>
</form>
<?php 
if (isset($_POST['submit'])) {
    //mysql_real_escape_string() escapes special characters in a string for use in an SQL statement
    $user = mysql_real_escape_string($_POST['user']);
    $pass = mysql_real_escape_string($_POST['pass']);
    $con = mysql_connect('localhost', 'root', '') or die(mysql_error());
    mysql_select_db('user') or die("cannot select DB");
    $query = mysql_query("SELECT * FROM login WHERE user='******'");
    $numrows = mysql_num_rows($query);
    if ($numrows == 0) {
        //md5() calculates the MD5 hash of a string
        $encrypt_password = md5($pass);
        $sql - "INSERT INTO login(user,pass) VALUES ('{$user}','{$encrypt_password}')";
        $result = msql_query($sql);
        if ($result != 1) {
            echo "Failure!";
        } else {
            echo "Account succefully created";
        }
    } else {
        echo "That username already exists! please try again with another name.";
    }
}
?>
<p><a herf="register.php"><Register</a> | <a href="../../../Users/VANZ/AppData/Roaming/Macromedia/Dreamweaver 8/Configuration/Temp/FlashElements/ImageViewer/login.php">Login</a></p>
</body>
</html>