Exemplo n.º 1
0
   for($i=0;$i<20;$i++)
    echo '<td>' . $rek[$i] . '</td>';
    
    
//   }
 //  echo "</BR>";     
  echo "</tr>";   
 }
  
 echo "</table>";
} 
echo '<input type="button" value="Print Output" onclick="printpage()">';
}
*/
while (!feof($fh_read)) {
    save_title($fh_write_title, read_ebayid($data = read_data($fh_read), 0));
    save_sku($fh_write_sku, read_ebayid($data, 1));
    //save_notes($fh_write_notes,  read_ebayid($data, 2));
}
//save_title($fh_write_title,read_ebayid(read_data($fh_read)));
echo "***END END END***";
?>
    
</td>
</table>




</BODY>
</HTML>
Exemplo n.º 2
0
<?php

/*
 * ------------- PHP Code -------------
 */
include 'data.inc.php';
/**
 * Retrieve previous content from the form
 */
$loaded_information = read_data();
/**
 * Generate a field input based on a name
 *
 * @param $name
 * @param bool|true $with_checkbox
 * @return string
 */
function field_input($name, $with_checkbox = true)
{
    global $loaded_information, $privacy;
    $field_value = isset($loaded_information[$name]) ? $loaded_information[$name] : ['value' => null, 'privacy' => 'public'];
    $html = '<input type="text" name="info[' . $name . '][value]" value="' . htmlentities($field_value['value']) . '" placeholder="' . $name . '" />';
    if ($with_checkbox === true) {
        $checkboxs = '';
        foreach ($privacy as $privacy_level => $label) {
            $status = $field_value['privacy'] == $privacy_level ? 'checked="checked"' : '';
            $checkboxs .= '<span><input type="radio" name="info[' . $name . '][privacy]" class="toggle-on" value="' . $privacy_level . '" ' . $status . '"/>' . $label . '</span>';
        }
        $html .= $checkboxs;
    }
    return $html;
Exemplo n.º 3
0
<?php

require_once 'common.php';
read_data();
?>
<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html> <!--<![endif]-->
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=Edge">
        <meta charset="utf-8">
        <title><?php 
echo $config['title'];
?>
</title>
        <link rel="stylesheet" href="bootstrap.css">
        <link rel="stylesheet" href="style.css">
        <link rel="stylesheet" href="print.css">
    </head>
    <body>
        <a class="btn btn-default nav-button" id="nav-graph" href="graph.php<?php 
echo $dataset_qs;
?>
">
            View graph
        </a>
        <div id="docs-list">
<?php 
foreach ($data as $obj) {
Exemplo n.º 4
0
        }
        tep_set_information_visible($information_id, $visible);
        $data = browse_information();
        $data_inc = browse_includes();
        if ($visible == '1') {
            $vivod = DEACTIVATION_ID_INFORMATION;
        } else {
            $vivod = ACTIVATION_ID_INFORMATION;
        }
        $title = "ID: {$information_id} {$confirm} {$vivod}";
        include 'information_list.php';
        $page_updated = true;
        break;
    case 'Delete':
        if ($information_id) {
            $delete = read_data($information_id);
            $data = browse_information();
            $data_inc = browse_includes();
            $title = DELETE_CONFITMATION_ID_INFORMATION . ' ' . $information_id;
            echo '<tr class="pageHeading"><td align="center"><br><br>' . $title . '</td></tr>';
            echo '<tr><td></td></tr><tr><td align="center"><br><br>';
            echo tep_draw_form('', FILENAME_INFORMATION_MANAGER, 'a_information=DelSure&information_id=' . $val[information_id], 'POST');
            echo tep_draw_hidden_field('information_id', "{$information_id}");
            echo tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_INFORMATION_MANAGER, '', 'NONSSL') . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>';
            echo '</form>

				</td>
			</tr>';
            $page_updated = true;
        } else {
            $error = '80';
Exemplo n.º 5
0
    //$data_key=isset($_POST['data_key'])?mysql_real_escape_string($_POST['data_key']):"";
    //$api_key=isset($_POST['api_key'])?mysql_real_escape_string($_POST['api_key']):"";
    $data_key = $_POST['data_key'];
    if (1234 == 1234) {
        switch ($data_key) {
            case 1:
                $data_result = insert_data();
                break;
            case 2:
                $data_result = update_data();
                break;
            case 3:
                $data_result = delete_data();
                break;
            case 4:
                $data_result = read_data();
                break;
            case 5:
                $data_result = read_all_data();
                break;
            default:
                $data_result = read_all_data();
                break;
        }
    } else {
        $data_result = array("status" => 0, "message" => "Aunthentication failed");
    }
} else {
    $data_result = array("status" => 1, "message" => "Request method not accepted");
}
//CRUD FUNCTIONS
Exemplo n.º 6
0
<?php

require_once './vendor/autoload.php';
use Abraham\TwitterOAuth\TwitterOAuth;
require_once './config/twitter_config.php';
require_once './config/config.php';
require_once './class/lab.php';
require_once './helper/log_helper.php';
$pre_data = read_data();
$data = get_newdata();
$labs = create_labs($data, $pre_data);
if (!empty($labs)) {
    $post_texts = get_post_tweets($labs);
    post_tweets($post_texts, $userdata);
    save_data($data);
}
function get_post_tweets($labs)
{
    $post_texts = array();
    foreach ($labs as $lab) {
        $post_texts[] = $lab->get_tweet_text();
    }
    return $post_texts;
}
function get_newdata()
{
    return json_decode(file_get_contents(API_URL));
}
function create_labs($data, $pre_data)
{
    // HACK: to zip loop
Exemplo n.º 7
0
function check_sud()
{
    global $char, $user_id;
    if (!isset($_SESSION['sud']) or !isset($_SESSION['use'])) {
        read_data();
    }
    $nums = range(1, 9);
    $ch = 0;
    for ($i = 0; $i < 9; $i++) {
        for ($j = 0; $j < 9; $j++) {
            $nu = 0;
            //массив вертикали и горизонтали
            $ver = $_SESSION['sud'][$i];
            $hor = array($_SESSION['sud'][0][$j], $_SESSION['sud'][1][$j], $_SESSION['sud'][2][$j], $_SESSION['sud'][3][$j], $_SESSION['sud'][4][$j], $_SESSION['sud'][5][$j], $_SESSION['sud'][6][$j], $_SESSION['sud'][7][$j], $_SESSION['sud'][8][$j]);
            //сформируем массив значений данного квадрата
            $kvad = array();
            $fk = floor($i / 3) * 3;
            $tk = $fk + 2;
            $fm = floor($j / 3) * 3;
            $tm = $fm + 2;
            for ($k = $fk; $k <= $tk; $k++) {
                for ($m = $fm; $m <= $tm; $m++) {
                    $kvad[$nu] = $_SESSION['sud'][$k][$m];
                    $nu++;
                }
            }
            $v_check = array_count_values($ver);
            $h_check = array_count_values($hor);
            $k_check = array_count_values($kvad);
            foreach ($v_check as $v) {
                if ($v > 1) {
                    $ch = -1;
                }
                break;
            }
            if ($ch == -1) {
                break;
            }
            foreach ($h_check as $v) {
                if ($v > 1) {
                    $ch = -1;
                }
                break;
            }
            if ($ch == -1) {
                break;
            }
            foreach ($k_check as $v) {
                if ($v > 1) {
                    $ch = -1;
                }
                break;
            }
            if ($ch == -1) {
                break;
            }
            //if(in_array(2,$v_check) OR in_array($k,$h_check) OR in_array($k,$k_check))  {$ch=-1; break;}
        }
        if ($ch == -1) {
            break;
        }
    }
    echo '<center>';
    echo '<br>';
    QuoteTable('open');
    if ($ch == 0) {
        //QuoteTable('open');
        echo '<div align=center><font color=green size=4>Сделано! Задание выплонено!</font>
			<br><a href="?mode=601&exit_puzzle">Продолжить</a></div>';
        //QuoteTable('close');
        myquery("UPDATE quest_engine_users SET done=1 WHERE user_id='{$user_id}' AND quest_type=601 AND par1_value=" . $char['map_name'] . " AND par2_value=" . $char['map_xpos'] . " AND  par3_value=" . $char['map_ypos'] . "");
        echo '<meta  http-equiv="refresh" content="2;url=?mode=601&exit_puzzle" tagert="game">';
        /*echo '</p>';
        		OpenTable('close');
        		exit();			*/
    } else {
        list($ers) = mysql_fetch_array(myquery("SELECT par4_value FROM quest_engine_users WHERE user_id='{$user_id}' AND quest_type=601 AND par1_value=" . $char['map_name'] . " AND par2_value=" . $char['map_xpos'] . " AND  par3_value=" . $char['map_ypos'] . ""));
        myquery("UPDATE quest_engine_users SET par4_value=par4_value+1  WHERE user_id='{$user_id}' AND quest_type=601 AND par1_value=" . $char['map_name'] . " AND par2_value=" . $char['map_xpos'] . " AND  par3_value=" . $char['map_ypos'] . "");
        //QuoteTable('open');
        if ($ers == 0) {
            echo '<div align=center><font color=orange size=4>Неверная комбинация! Первая ошибка!</font>
				<br><a href="?mode=601">Продолжить</a></div>';
            echo '<meta  http-equiv="refresh" content="2;url=?mode=601" tagert="game">';
            //QuoteTable('close');
            /*echo '</p>';
            		OpenTable('close');
            		exit();		*/
        } else {
            echo '<div align=center><font color=red size=4>Неверная комбинация! Вторая ошибка! Задание провалено!</font>
				<br><a href="?mode=601&exit_puzzle">Продолжить</a></div>';
            myquery("UPDATE quest_engine_users SET done=2 WHERE user_id='{$user_id}' AND quest_type=601 AND par1_value=" . $char['map_name'] . " AND par2_value=" . $char['map_xpos'] . " AND  par3_value=" . $char['map_ypos'] . "");
            echo '<meta  http-equiv="refresh" content="2;url=?mode=601&exit_puzzle" tagert="game">';
            //QuoteTable('close');
            /*echo '</p>';
            		OpenTable('close');
            		exit();		*/
        }
    }
    QuoteTable('close');
    echo '</p>';
    OpenTable('close');
    echo '</center>';
    exit;
}
Exemplo n.º 8
0
function extract_data_level($cubename_p, $level_pivoting, $slice_p)
{
    global $xmlfile;
    $xml = simplexml_load_file($xmlfile);
    list($dim1, $hier1, $lev1, $prop1) = explode(".", $level_pivoting);
    //print "LP $dim1,$hier1,$lev1,$prop1<br>";
    foreach ($xml->Cube as $cube) {
        //print "OK<br>";
        $cubename = (string) $cube['name'];
        //print "CU $cubename<br>";
        if ($cubename == $cubename_p) {
            //print "CU FOUND $cubename_p<br>";
            foreach ($cube->DimensionUsage as $dimension) {
                $dimensionname = (string) $dimension['name'];
                if ($dimensionname == $dim1) {
                    //print "D FOUND1 $dim1<br>";
                    foreach ($xml->Dimension as $dimensioncube) {
                        $dimensionname2 = (string) $dimensioncube['name'];
                        if ($dimensionname2 == $dim1) {
                            //print "D FOUND2 $dim1<br>";
                            foreach ($dimensioncube->Hierarchy as $hier) {
                                $hiername = $hier['name'];
                                $pk_hiertable = $hier['primaryKeyTable'];
                                if ($hiername == $hier1) {
                                    //print "H FOUND $hier1<br>";
                                    foreach ($hier->Level as $level) {
                                        $levelname = $level['name'];
                                        $level_col = $level['column'];
                                        $level_table = $level['table'];
                                        if ($level_table == "") {
                                            $level_table = $pk_hiertable;
                                        }
                                        if ($levelname == $lev1) {
                                            //print "L FOUND $lev1 COL $level_col TAB $level_table<br>";
                                            ///***************where
                                            $n = strlen($slice_p);
                                            $slice_p = substr($slice_p, 0, $n - 2);
                                            $cond = explode("--", $slice_p);
                                            $nc = count($cond);
                                            $where = "";
                                            for ($i = 0; $i < $nc; $i++) {
                                                list($dim_c, $hier_c, $lev_c, $prop_c, $cond1) = explode(".", $cond[$i]);
                                                if ($dim_c == $dim1 && $hier_c == $hier1 && $lev_c == $lev1) {
                                                    $cond1 = trasforma($cond1);
                                                    $where = "{$level_table}.{$level_col} {$cond1}";
                                                }
                                            }
                                            //**********************
                                            $dataset = read_data($level_table, $level_col, $where);
                                            return $dataset;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Exemplo n.º 9
0
function read_entries($User, $Level)
{
    global $msg, $db_name, $tbl_name, $fld_timestamp, $messageOrder, $messageBGColors, $boxEntries, $boxWidth, $wordLength, $timeOffset, $reservedNames, $dateFormat;
    if ($db_name) {
        $sql = "SELECT * FROM {$tbl_name} ORDER BY {$fld_timestamp} {$messageOrder} LIMIT {$boxEntries}";
        $result = mysql_query($sql);
        while ($row = mysql_fetch_row($result)) {
            $data[] = $row;
        }
    } else {
        $data = read_data();
        if (strtoupper($messageOrder) != 'ASC') {
            rsort($data);
        }
    }
    for ($i = 0; $i < count($data); $i++) {
        $id = $data[$i][0];
        $tstamp = timeStamp($data[$i][1]);
        $name = $data[$i][2] ? format($data[$i][2], $wordLength, $boxWidth - 22, true) : '???';
        $realName = $name;
        $email = strstr($data[$i][3], '@') ? $data[$i][3] : '';
        $text = format($data[$i][4], $wordLength, $boxWidth - 22, false);
        $bgcolor = $bgcolor != $messageBGColors[0] ? $messageBGColors[0] : $messageBGColors[1];
        $nameExplode = explode("-", $name);
        if (strcmp($nameExplode[0], '[Developer]') == 0) {
            $name = "<span style='font-weight:bold;color:red;font-size:15px;'>" . $name . "</span>";
            $text = "<br><span style='color:red;'>" . $text . "";
        } else {
            if (strcmp($nameExplode[0], '[3*]') == 0) {
                $name = "<span style='font-weight:bold;color:blue;font-size:15px;'>" . $name . "</span>";
                $text = "<br><span style='color:blue;'>" . $text . "";
            } else {
                if (strcmp($nameExplode[0], '[2*]') == 0) {
                    $name = "<span style='font-weight:bold;color:green;font-size:15px;'>" . $name . "</span>";
                    $text = "<br><span style='color:green;'>" . $text . "";
                } else {
                    if (strcmp($nameExplode[0], '[1*]') == 0) {
                        $name = "<span style='font-weight:bold;color:black;font-size:15px;'>" . $name . "</span>";
                        $text = "<br><span style='color:black;'>" . $text . "";
                    }
                }
            }
        }
        if ($dateFormat != 'Y-m-d' || (int) $timeOffset != 0) {
            $a = explode(' ', $tstamp);
            $d = explode('-', $a[0]);
            $t = explode(':', $a[1]);
            $ts = mktime($t[0], $t[1], $t[2], $d[1], $d[2], $d[0]);
            if ((int) $timeOffset != 0) {
                $ts += (int) $timeOffset * 3600;
            }
            if (!$dateFormat) {
                $dateFormat = 'Y-m-d';
            }
            $tstamp = date($dateFormat . ' H:i:s', $ts);
        }
        if (is_admin()) {
            $splitRName = explode("-", $realName);
            ?>
			
				<? if((strcmp(trim($splitRName['1']), trim($User)) == 0) || ($Level >= 3)) {?>
				<div class="cssShoutRaised" style="float:right;margin-right:3px;height:27px;width:22px;margin-top:3px;background-image: url('smilies/trash.gif');background-repeat: no-repeat;background-position: center;" title="<?php 
            echo $msg['delete'];
            ?>
"
				onMouseDown="this.className='cssShoutPressed'"
				onMouseUp="this.className='cssShoutRaised'"
				onMouseOut="this.className='cssShoutRaised'"
				onClick="confirmDelete(<?php 
            echo $id;
            ?>
)">
				</div>
				<a target="ShoutBox" href="edit.php?id=<? echo $id; ?>&userName=<? echo trim($splitRName['1']); ?>"><div class="cssShoutRaised" style="float:right;margin-right:3px;height:27px;width:25px;margin-top:3px;background-image: url('smilies/edit.gif');background-repeat: no-repeat;background-position: center;" title="<?php 
            echo $msg['edit'];
            ?>
"
				onMouseDown="this.className='cssShoutPressed'"
				onMouseUp="this.className='cssShoutRaised'"
				onMouseOut="this.className='cssShoutRaised'">
				</div></a>
				<? } ?>
				
<?php 
        }
        $class = in_array(strtolower($name), $reservedNames) ? 'cssShoutTextAdmin' : 'cssShoutText';
        ?>
			<div class="cssShoutTime" style="background-color:<?php 
        echo $bgcolor;
        ?>
">
			<?php 
        echo $tstamp;
        ?>
			</div>
			<div class="<?php 
        echo $class;
        ?>
" style="background-color:<?php 
        echo $bgcolor;
        ?>
">
			<?php 
        if ($email) {
            echo '<a href="mailto:' . $email . '">';
        }
        ?>
			<b><?php 
        echo $name;
        ?>
:</b><?php 
        if ($email) {
            echo '</a>';
        }
        ?>
 
				<?php 
        // The Regular Expression filter
        $reg_exUrl = "/(http|https|ftp|ftps)\\:\\/\\/[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(\\/\\S*)?/";
        // Check if there is a url in the text
        if (preg_match($reg_exUrl, $text, $url)) {
            // make the urls hyper links
            $text = preg_replace($reg_exUrl, '<a target="_blank" style="text-decoration: underline;color:purple;font-weight:bold;" href="' . $url[0] . '">(Website Link)</a>', $text);
        }
        $re = "/--(.*?)--/im";
        $subst = "<span style='color:darkblue;font-size:25px;'>\$1";
        $text = preg_replace($re, $subst, $text);
        $re = "/__(.*?)__/im";
        $subst = "<span style='font-style:italic;'>\$1</span>";
        $text = preg_replace($re, $subst, $text);
        $re = "/(?i:(view|check|info|link)):(.*?)(:|[ ](.*?):)/im";
        $subst = "\n\t\t\t\t<div class='alert alert-success' role='alert'>\n\t\t\t\t  <span style='font-weight:bold;'>\$2</span><br><span style='font-style:italic;'>\$3</span>\n\t\t\t\t  <a target='_parent' href='../search.php?edit=0&searchResult=\$2'><br><button class='btn btn-info' class='alert-link'>View Product</button></a>\n\t\t\t\t</div>";
        $text = preg_replace($re, $subst, $text);
        $re = "/(?i:(edit|broken|fix)):(.*?)(:|[ ](.*?):)/im";
        $subst = "\n\t\t\t\t<div class='alert alert-warning' role='alert'>\n\t\t\t\t  <span style='font-weight:bold;'>\$2</span><br><span style='font-style:italic;'>\$3</span>\n\t\t\t\t  <a target='_parent' href='../search.php?edit=1&searchResult=\$2'><br><button class='btn btn-info' class='alert-link'>Edit Product</button></a>\n\t\t\t\t</div>";
        $text = preg_replace($re, $subst, $text);
        $re = "/\\*\\*(.*?)\\*\\*/im";
        $subst = "<span style='font-weight:bold;'>\$1</span>";
        $text = preg_replace($re, $subst, $text);
        $re = "/\\@([a-zA-Z]+(\\S)?)/";
        $subst = "<span style='font-weight:bold;color:orange;font-size:18px;'>@\$1</span>";
        $text = preg_replace($re, $subst, $text);
        ?>
			<?php 
        echo "<div style='font-size:15px;padding:10px;padding-top:3px;'" . $text . "</div>";
        ?>
			
			</div>
<?php 
    }
}
Exemplo n.º 10
0
$cmd = "condor_q -xml -global";
if (isset($_REQUEST['user']) && !empty($_REQUEST['user'])) {
    $cmd = $cmd . " " . $_REQUEST['user'];
}
$raw = `{$cmd}`;
$pieces = explode("-- Schedd: ", $raw);
for ($ii = 1; $ii < count($pieces); $ii++) {
    // strip the schedd name and ip line
    $pos = strpos($pieces[$ii], ':');
    $g_schedds[$ii - 1] = trim(substr($pieces[$ii], 0, $pos));
    $pos = strpos($pieces[$ii], '<?xml');
    $output = substr($pieces[$ii], $pos);
    $g_xml = simplexml_load_string($output);
    //echo $schedd,' has ',count( $g_xml->c ),' jobs.<br />';
    if ($g_xml !== false) {
        read_data($g_schedds[$ii - 1]);
    } else {
        echo '<h2>Error getting xml data from schedd: ', $schedd, '</h2>';
        echo '<h3>', $cmd, '</h3>';
        echo '<pre>', htmlentities($output), '</pre>';
    }
}
data_accounting();
print_accounting();
echo '<hr />';
sort_data();
format_data();
print_data();
?>

		<hr>
Exemplo n.º 11
0
                                    if ($level_table == "") {
                                        $level_table = $pk_hiertable;
                                    }
                                    if ($levelname == $lev1) {
                                        //print "L FOUND $lev1 COL $level_col TAB $level_table<br>";
                                        //$dataset=read_data($level_table,$level_col,$where);
                                        foreach ($level->Property as $prop) {
                                            $propname = (string) $prop['name'];
                                            if ($propname != $prop1) {
                                                $prop_col = (string) $prop['column'];
                                                $target_list .= "{$level_table}.{$prop_col},";
                                            }
                                        }
                                        $lungh = strlen($target_list);
                                        $target_list = substr($target_list, 0, $lungh - 1);
                                        $dataset = read_data($level_table, $level_col, $target_list, $dato);
                                        //$n_celle_col=count($dataset);
                                        //for($j=0;$j<$n_celle_col;$j++)
                                        //{
                                        //  print "$dataset[$j]<br>";
                                        //}
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Exemplo n.º 12
0
    } else {
        $url = $endpoint_uis[$i];
    }
    $ep = array();
    $ep['ui'] = $url;
    $ep['api'] = $endpoint;
    $res['endpoint'] = $ep;
    $query1 = 'select ?p ?o {' . ' <' . $prefix . "/" . $uri . $separator . $resource . '> ?p ?o.' . '} order by ?p';
    $json1 = read_query($endpoint, $query1);
    $data = $json1["results"]["bindings"];
    $refer = read_data($data, 'p', 'o');
    $res['refer'] = $refer;
    $query2 = 'select ?s ?p {' . ' ?s ?p <' . $prefix . "/" . $uri . $separator . $resource . '>.' . '} order by ?p';
    $json2 = read_query($endpoint, $query2);
    $data = $json2["results"]["bindings"];
    $referred = read_data($data, 's', 'p');
    $res['referred'] = $referred;
    $result['results'][] = $res;
}
header('Content-type: application/json');
header("Access-Control-Allow-Origin: *");
echo json_encode($result);
exit;
function read_data($data, $c1, $c2)
{
    $ret = array();
    for ($i = 0; $i < count($data); $i++) {
        $item = array();
        if ($data[$i][$c1] != null) {
            $item[$c1] = $data[$i][$c1];
        }
Exemplo n.º 13
0
        } else {
            return false;
        }
    } else {
        return false;
    }
}
if (count($_GET) == 1) {
    require_once 'include/configpage.php';
    require_once 'include/emaillib.php';
    setCss();
    headerSet();
    $code = $_GET['code'] or die('<p class="message">Error');
    check_code($code) or die('<p class="message">Ooops');
    if (verify_data($code) == "pending") {
        $username = read_data($code);
        //print $username;
        if ($username != "Error") {
            if (gen_pass_mail($code, $username)) {
                print '<p class="message">Your password has been changed and sent, please check your email';
            }
        } else {
            die('<p class="message">Error, can\'t get your email, please contact the Administrator');
        }
    } else {
        die('<p class="message">Error, invalid code, please contact the Administrator');
    }
} else {
    die('<p class="message">Error, invalid parameters, please contact the Administrator');
}
mysql_close();
Exemplo n.º 14
0
function read_entries()
{
    global $msg, $db_name, $tbl_name, $fld_timestamp, $messageOrder, $messageBGColors, $boxEntries, $boxWidth, $wordLength, $timeOffset, $reservedNames, $dateFormat;
    if ($db_name) {
        $sql = "SELECT * FROM {$tbl_name} ORDER BY {$fld_timestamp} {$messageOrder} LIMIT {$boxEntries}";
        $result = mysql_query($sql);
        while ($row = mysql_fetch_row($result)) {
            $data[] = $row;
        }
    } else {
        $data = read_data();
        if (strtoupper($messageOrder) != 'ASC') {
            rsort($data);
        }
    }
    for ($i = 0; $i < count($data); $i++) {
        $id = $data[$i][0];
        $tstamp = timeStamp($data[$i][1]);
        $name = $data[$i][2] ? format($data[$i][2], $wordLength, $boxWidth - 22, true) : '???';
        $email = strstr($data[$i][3], '@') ? $data[$i][3] : '';
        $text = format($data[$i][4], $wordLength, $boxWidth - 22, false);
        $bgcolor = $bgcolor != $messageBGColors[0] ? $messageBGColors[0] : $messageBGColors[1];
        if ($dateFormat != 'Y-m-d' || (int) $timeOffset != 0) {
            $a = explode(' ', $tstamp);
            $d = explode('-', $a[0]);
            $t = explode(':', $a[1]);
            $ts = mktime($t[0], $t[1], $t[2], $d[1], $d[2], $d[0]);
            if ((int) $timeOffset != 0) {
                $ts += (int) $timeOffset * 3600;
            }
            if (!$dateFormat) {
                $dateFormat = 'Y-m-d';
            }
            $tstamp = date($dateFormat . ' H:i:s', $ts);
        }
        if (is_admin()) {
            ?>
				<div class="cssShoutRaised" style="float:right" title="<?php 
            echo $msg['delete'];
            ?>
"
				onMouseDown="this.className='cssShoutPressed'"
				onMouseUp="this.className='cssShoutRaised'"
				onMouseOut="this.className='cssShoutRaised'"
				onClick="confirmDelete(<?php 
            echo $id;
            ?>
)">
				<img src="delete.gif" width="10" height="10">
				</div>
<?php 
        }
        $class = in_array(strtolower($name), $reservedNames) ? 'cssShoutTextAdmin' : 'cssShoutText';
        ?>
			<div class="cssShoutTime" style="background-color:<?php 
        echo $bgcolor;
        ?>
">
			<?php 
        echo $tstamp;
        ?>
			</div>
			<div class="<?php 
        echo $class;
        ?>
" style="background-color:<?php 
        echo $bgcolor;
        ?>
">
			<?php 
        if ($email) {
            echo '<a href="mailto:' . $email . '">';
        }
        ?>
			<b><?php 
        echo $name;
        ?>
:</b><?php 
        if ($email) {
            echo '</a>';
        }
        ?>
 <?php 
        echo $text;
        ?>
			</div>
<?php 
    }
}