Keresés

Aktív témák

  • Ghostika

    csendes tag

    válasz L3zl13 #35 üzenetére

    Azt raktam be de akkor ezt írja ki.
    De próbáltam már alőzővel is és akkor is ezt írta ki.
    itt az egész forráskód:


    <?php require_once('Connections/my_Conn.php'); ?>
    <?php
    $currentPage = $HTTP_SERVER_VARS[''PHP_SELF'';];
    ?>
    <?php
    session_start();
    function GetSQLValueString($theValue, $theType, $theDefinedValue = '''', $theNotDefinedValue = '''')
    {
    $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

    switch ($theType) {
    case ''text'':
    $theValue = ($theValue != '''') ? ''''' . $theValue . ''''' : ''NULL'';
    break;
    case ''long'':
    case ''int'':
    $theValue = ($theValue != '''') ? intval($theValue) : ''NULL'';
    break;
    case ''double'':
    $theValue = ($theValue != '''') ? ''''' . doubleval($theValue) . ''''' : ''NULL'';
    break;
    case ''date'':
    $theValue = ($theValue != '''') ? ''''' . $theValue . ''''' : ''NULL'';
    break;
    case ''defined'':
    $theValue = ($theValue != '''') ? $theDefinedValue : $theNotDefinedValue;
    break;
    }
    return $theValue;
    }

    $editFormAction = $HTTP_SERVER_VARS['PHP_SELF';];
    if (isset($HTTP_SERVER_VARS['QUERY_STRING';])) {
    $editFormAction .= ''?'' . $HTTP_SERVER_VARS['QUERY_STRING';];
    }

    if ((isset($HTTP_POST_VARS[''MM_insert'';])) && ($HTTP_POST_VARS[''MM_insert'';] == ''form1'')) {
    $insertSQL = sprintf(''INSERT INTO tema (cim) VALUES (%s)'',
    GetSQLValueString($HTTP_POST_VARS['cim';], ''text''));

    mysql_select_db($database_my_Conn, $my_Conn);
    $Result1 = mysql_query($insertSQL, $my_Conn) or die(mysql_error());

    $insertGoTo = ''new_theme.php'';
    if (isset($HTTP_SERVER_VARS['QUERY_STRING';])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? ''&'' : ''?'';
    $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING';];
    }
    header(sprintf(''Location: %s'', $insertGoTo));
    }

    $maxRows_tema = 3;
    $pageNum_tema = 0;
    if (isset($HTTP_GET_VARS['pageNum_tema';])) {
    $pageNum_tema = $HTTP_GET_VARS['pageNum_tema';];
    }
    $startRow_tema = $pageNum_tema * $maxRows_tema;

    mysql_select_db($database_my_Conn, $my_Conn);
    $query_tema = ''SELECT * FROM tema'';
    $query_limit_tema = sprintf(''%s LIMIT %d, %d'', $query_tema, $startRow_tema, $maxRows_tema);
    $tema = mysql_query($query_limit_tema, $my_Conn) or die(mysql_error());
    $row_tema = mysql_fetch_assoc($tema);

    if (isset($HTTP_GET_VARS['totalRows_tema';])) {
    $totalRows_tema = $HTTP_GET_VARS['totalRows_tema';];
    } else {
    $all_tema = mysql_query($query_tema);
    $totalRows_tema = mysql_num_rows($all_tema);
    }
    $totalPages_tema = ceil($totalRows_tema/$maxRows_tema)-1;

    mysql_select_db($database_my_Conn, $my_Conn);
    $query_counter =''select tema_id, cim, count(hozzaszolas_id) as hozzaszolas from tema left outer join hozzaszolas on tema.tema_id=hozzaszolas.tema_id group by tema_id,cim'';

    $counter = mysql_query($query_counter, $my_Conn) or die(mysql_error());
    $row_counter = mysql_fetch_assoc($counter);
    $totalRows_counter = mysql_num_rows($counter);

    $queryString_tema = '''';
    if (!empty($HTTP_SERVER_VARS['QUERY_STRING';])) {
    $params = explode(''&'', $HTTP_SERVER_VARS['QUERY_STRING';]);
    $newParams = array();
    foreach ($params as $param) {
    if (stristr($param, ''pageNum_tema'') == false &&
    stristr($param, ''totalRows_tema'') == false) {
    array_push($newParams, $param);
    }
    }
    if (count($newParams) != 0) {
    $queryString_tema = ''&'' . implode(''&'', $newParams);
    }
    }
    $queryString_tema = sprintf(''&totalRows_tema=%d%s'', $totalRows_tema, $queryString_tema);
    ?>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv=''Content-Type'' content=''text/html; charset=iso-8859-1''>
    </head>

    <body>
    <form name=''form1'' method=''POST'' action=''<?php echo $editFormAction; ?>''>
    <table width=''400'' border=''0'' cellspacing=''5'' cellpadding=''0''>
    <tr>
    <td>Új Téma Neve:</td>
    <td><input name=''cim'' type=''text'' id=''cim''></td>
    </tr>
    <tr>
    <td> </td>
    <td><input type=''submit'' name=''Submit'' value=''Új téma''></td>
    </tr>
    </table>
    <a href=''hozza.php?tema_id=<?php echo $row_tema['tema_id';]; ?>''><?php echo $row_tema['cim';]; ?></a>
    <input type=''hidden'' name=''tag_id'' value=''<?php echo $_SESSION[''tag_id'';]; ?>''>
    <input type=''hidden'' name=''MM_insert'' value=''form1''>
    </form>
    <p>Témák:</p>
    <p> 
    <?php do { ?>
    </p>
    <table width=''400'' border=''0'' cellspacing=''0'' cellpadding=''0''>
    <tr>
    <td width=''250''> </td>
    <td width=''150''> <?php echo $row_tema['hozzaszolas';]; ?> </td>
    </tr>
    </table>
    <p><img src=''shim.gif'' width=''1'' height=''10''>
    <?php } while ($row_tema = mysql_fetch_assoc($tema)); ?>
    <table border=''0'' width=''31%'' align=''center''>
    <tr>
    <td width=''31%'' align=''center''> <?php if ($pageNum_tema > 0) { // Show if not first page ?>
    <a href=''<?php printf(''%s?pageNum_tema=%d%s'', $currentPage, max(0, $pageNum_tema - 1), $queryString_tema); ?>''>Previous</a>
    <?php } // Show if not first page ?> </td>
    <td width=''23%'' align=''center''> <?php if ($pageNum_tema < $totalPages_tema) { // Show if not last page ?>
    <a href=''<?php printf(''%s?pageNum_tema=%d%s'', $currentPage, min($totalPages_tema, $pageNum_tema + 1), $queryString_tema); ?>''>Next</a>
    <?php } // Show if not last page ?> </td>
    </tr>
    </table>
    </p>
    <p>

    </p>
    </body>
    </html>
    <?php
    mysql_free_result($tema);

    mysql_free_result($counter);
    ?>

Aktív témák