Jump to content

sirio

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Posts posted by sirio

  1. Well, i think i've solved the problem.

     

    I've added these lines at the beginning of the 2nd file:

     

    require("../config.php");
    require("../includes/sql_layer.php");
    $db = sql_connect($dbhost, $dbuname, $dbpass, $dbname);

     

    And I've deleted these other lines:

     

    mysql_connect("localhost", "root", "");
    mysql_select_db("lq");

     

    Perfect!!!!  ;D

  2. No, i mean through a link button ("click here to refresh"). I've already done that part, but the problem now is the connection.

     

    In the 2nd file, i have this:

     

    mysql_connect("localhost", "root", "");

    mysql_select_db("lq");

     

    But this is an unsecure method to connect.

    I've tried to pass the variable $db to the 2nd file using GET method, but my browser doesn't show me anything.

    I also tried to pass another variable ($prefix) to the second file and I didn't have any problem.

     

    How could i pass the $db variable???

     

    (sorry if you don't understand me but i'm spanish)

  3. Well, I've already do it, but i have a problem: I have two files:

     

    block-Forums.php:

     

    if( eregi( "block-Foros.php",$PHP_SELF ) )
    {
    Header("Location: index.php");
    die();
    }
    
    global $prefix, $user_prefix,  $db;
    
    // Ajax function
    $content  .= "
    <script language=\"javascript\" type=\"text/javascript\">
    function getPage(Last_New_Topics){
    var xmlhttp=false; //Clear our fetching variable
            try {
                    xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
            } catch (e) {
                    try {
                            xmlhttp = new
                            ActiveXObject('Microsoft.XMLHTTP');
                } catch (E) {
                    xmlhttp = false;
                            }
            }
            if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                    xmlhttp = new XMLHttpRequest();
            }
            var file = 'test/1/text.php?n=';
        xmlhttp.open('GET', file + Last_New_Topics, true);
        xmlhttp.onreadystatechange=function() {
            if (xmlhttp.readyState==4) {
                    var content = xmlhttp.responseText;
                    if( content ){
                          document.getElementById('content').innerHTML = content;
                    }
            }
            }
            xmlhttp.send(null)
    return;
    }
    </script>";
    
    [...]
    
    

     

    and text.php:

     

    <?php
    mysql_connect("localhost", "root", ""); 
    mysql_select_db("lq");
    $n = $_GET["n"];
    
    $result = mysql_query("SELECT t.topic_id, t.topic_first_post_id, t.forum_id, t.topic_last_post_id,
    	t.topic_title, t.topic_poster, t.topic_views, t.topic_replies, t.topic_moved_id, p.poster_id,
    	p.post_time, u.username, l.username, u.user_id, tx.post_text, p.post_username, f.post_username
    	FROM nuke_bbtopics AS t
    	LEFT JOIN nuke_bbposts AS p ON (p.post_id = t.topic_last_post_id)
    	LEFT JOIN nuke_bbposts AS f ON (f.post_id = t.topic_first_post_id)
    	LEFT JOIN nuke_bbposts_text AS tx ON (p.post_id = tx.post_id)
    	LEFT JOIN nuke_users AS u ON (u.user_id=p.poster_id)
    	LEFT JOIN nuke_users AS l ON (l.user_id=t.topic_poster)
    	WHERE t.topic_moved_id=0
    	ORDER BY t.topic_last_post_id DESC LIMIT 0, $n
    	");
    while( list( $topic_id, $postf_id, $forum_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_moved_id, $poster_id, $post_time, $post1, $post2, $user_id, $post_text, $guest_name, $guest_name2) = $row = mysql_fetch_row($result))
    {
    [...]
    
    

     

    In the second file, I have to make a connection, but i want to make it through the "$db" variable, to avoid these lines:

    mysql_connect("localhost", "root", ""); 
    mysql_select_db("lq");

     

    How could i do it?

  4. Hi all.

     

    In the main page i've got a block which shows the x last posts. The problem is that if you want to check for new posts, you have to refresh the whole page. But I wanted to refresh ONLY that part using AJAX, by using a "Refresh" button.

     

    How could i do it? is it very difficult?

  5. ok, i've made an iframe to do it, but i get an error message.

    In index.php, i wrote:
    <iframe src="foros.php" width="100%" height="200"></iframe>

    and when i run the index, i get this:

    [quote]Fatal error: Call to a member function on a non-object in /data/members/free/tripod/es/l/a/t/latinquasar/htdocs/foros.php on line 28[/quote]

    Line 28:
    [quote]$result = $db->sql_query( "SELECT t.topic_id, t.topic_first_post_id, t.forum_id, t.topic_last_post_id,
    t.topic_title, t.topic_poster, t.topic_views, t.topic_replies, t.topic_moved_id, p.poster_id,
    p.post_time, u.username, l.username, u.user_id, tx.post_text, p.post_username, f.post_username
    FROM ".$prefix."_bbtopics AS t
    LEFT JOIN ".$prefix."_bbposts AS p ON (p.post_id = t.topic_last_post_id)
    LEFT JOIN ".$prefix."_bbposts AS f ON (f.post_id = t.topic_first_post_id)
    LEFT JOIN ".$prefix."_bbposts_text AS tx ON (p.post_id = tx.post_id)
    LEFT JOIN ".$user_prefix."_users AS u ON (u.user_id=p.poster_id)
    LEFT JOIN ".$user_prefix."_users AS l ON (l.user_id=t.topic_poster)
    ORDER BY t.topic_last_post_id DESC LIMIT 0, $Last_New_Topics");[/quote]

    foros.php is just a block in phpnuke.
  6. I posted this in the wrong forum of this website, so i repeat:
    I'm running my website with php-nuke, n my forums are the well known phpbb forums.
    In the main page of my website, i have a script that shows the last topics in the forums... so i wanted to know if it is possible to refresh ONLY that part of the page (and not the parent page) clicking on a link or button. Maybe in php? javascript?...

    I've been searching, and i found nothing.

    Somebody suggested me to use ajax, but i want a better way to solve this.

    Thanks.
  7. Hi guys, i'm spanish, sorry if u don't understand me.
    I'm running my website with php-nuke, n my forums are the well known phpbb forums.
    In the main page of my website, i have a script that shows the last topics in the forums... so i wanted to know if it is possible to refresh ONLY that part of the page (and not the parent page) clicking on a link or button. Maybe in php? javascript?...

    I've been searching, and found nothing.

    Thank u.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.