Jump to content

matfish

Members
  • Posts

    242
  • Joined

  • Last visited

Posts posted by matfish

  1. Hi, hard to explain and not sure if its simply possible..

    Say iv got a text feild in the database and im pulling it in so it looks like an article. If someone types in a URL like "This is an www.example.com" how can I make the URL clickable link in the article without them knowing the html tags etc..? I dont want them entering <a href= etc..

    Thanks



  2. Hi,

    Having a few probs php/mysql.

    Got a table with datetime (0000-00-00 00:00:00) and needing to do a mysql query on the months only (like archiving the months only) but how do I search for the months out of that type of date?

    Many thanks
  3. Hi,

    Im keen to know what vunerabilities their are on InvisionBoards as my main site is currently running this and I was unaware of the issues you were experiencing. I want to obvisouly protect my site so what was going on? If you prefer to email/pm me that fine as I understand you may not want to disclose these vunerabilities on a forum for everyone to hack at.

    There any vunerabilities/issues with SMF? Is it easy to apply mods etc?

    Thanks
  4. This is a bump and a half... but...

    Wondering if there was any answers to this? Sort of like PHPLIST, where it checks a mailbox and picks up the bounces. It then adds the bounces (contents of the emails) to the database and deletes the emails from the mailbox.

    I would like to be able to send an email to the server/mailbox or to a script somehow and then put the to, from, subject and body into the database...?

    Or is this just wishful thinking?
  5. Barands code:

    [code]<?php
    function age($dt)  {

    $y1 = date('Y', strtotime($dt));
    $y2 = date('Y');
    $md1 = date('md', strtotime($dt));
    $md2 = date('md');
    return ($md2 < $md1) ? ($y2 - $y1 - 1) : ($y2 - $y1);
    }

    $dob = '1949-01-22';

    echo age($dob);
    ?>[/code]

    works a treat!

    Many thanks!!!!
  6. Hi,

    Im trying to find out how to calculate the correct age from a given date of birth. I did use just the years (this year 2006 - date pf birth year) but this is inaccurate as surely it should also go by day and month?

    Anyone help?

    Thanks
  7. I know this isnt really going to make sense but the code is below:-

    functions.php
    function get1stquestion($nxtgroup)
    [code]{

    $folder_list = getAllIDArrayWhere("questionID", "questions", "question_group = $nxtgroup");
                if (is_array($folder_list)) {
                ?>

                <a name="top"> </a>
                    <p><strong>Is your machine:</strong></p>
                    <ul>
                        <?        
                        while ($link_element = each ($folder_list)) {
                        $folder = getRow("questions","questionID", $link_element[1]);
                            $folder2 = getRow("answers","answerID", $link_element[1]);
                        ?>
                        <li><a href="qanda.php?answer=<?=$folder2['answerID']?>&nxt_group=<?=$folder2['nxt_group']?>&query=<?=$folder2['query']?>"><?=$folder['question']?> </a>  <?=$folder2['query']?>

                        <?
                        }

                        echo '</ul>';
                    }


    }

    function addToQuery ($query){

        global $db_query;
        $db_query = $db_query.$query;
        echo $db_query;
    }


    function get1stanswer($id ,$nxtgroup)
    {
        

        if ($nxtgroup == 0)
        {
        $folder_list = getAllIDArrayWhere("questionID", "questions", "questionID = $id");
        }
        else
        {
            $folder_list = getAllIDArrayWhere("questionID", "questions", "question_group = $nxtgroup");    
            
            $query_detail = getQuery($id);
            
            addToQuery($query_detail);

        }
                
                if (is_array($folder_list)) {

                ?>

                <a name="top"> </a>
                    <p><strong>Is your machine:</strong></p>
                    <ul>

                        <?    

                        while ($link_element = each ($folder_list)) {
                        $folder = getRow("questions","questionID", $link_element[1]);
                            $folder2 = getRow("answers","answerID", $link_element[1]);
                        ?>
                        <li>
                        <?
                        if ($nxtgroup == 0)
                        {
                        ?>
                        Query: <?=$folder2['query']?> <?=$folder2['answer']?>  <br />
                        <?
                        }
                        else
                        {
                        ?>
                        <a href="qanda.php?answer=<?=$folder2['answerID']?>&nxt_group=<?=$folder2['nxt_group']?>&query=<?=$folder2['query']?>"><?=$folder['question']?> </a> <?=$folder2['query']?>
                        <?

                        }
            
                        }    
                        echo '</ul>';
                    }
    }


    function getQuery($id){
            return getBite("query", "answers", "questionID", $id);
    }
    [/code]

    mainpage.php which is initially called first:

    [code]<?

    global $db_query;

    if (isset($_GET['answer']))
    {

    get1stanswer($_GET['answer'], $_GET['nxt_group']);

    }
    else
    {

            get1stquestion("2");

    }


    ?>[/code]

    Even returning it doesnt work. I think its because its stuck in a loop? Even if I could add the values to the GET to pass on it would be good. Just need to try and build the query until it reaches nxt_group=0. Therefore it was in a fuctional loop thingy incase there are loads of questions and answers?




  8. Tis difficult to explain, but Ill give it a go:-

    Iv got a table "Questions" and a table "Answers". Iv done it in functions which will go through the questions and answers and hits the end when reaching 'nxt_group=0' which is the final answer. Within the Answers table there is a "query" column where I want to build a query. So when an answer is clicked it will add "AND answer=whatever" to the query.

    I cant seem to add the query's up, it just keeps echoing the one Im pressing:-


    [code]function addToQuery ($query){

        global $db_query;
        $db_query = $db_query.$query;
        echo $db_query;    
    }

    [/code]

    Is it because its in two functions thats looping around that its not adding the string (the query bit of the answers table) as its just displaying the one pressed?

    Thanks

  9. Hi,

    All im trying to do is list the last 4 months like:-

    June
    May
    April
    March

    Firstly my code done the first two correctly but then would continue the 2nd month down the rest of the page. My current attempt worked yesterday (still being in May) but then looking today (1st June) its messed up again, its missing May.

    Iv got:


    [code]// this prints the curent month
    echo "<p><a href='/resources/blog_archive_view.php?arch=".date("Ym")."'>".date("F")."</a></p>";


    // this should print the last 3 months
    for ($m = 3; $m > 0; $m--)
    {

    $last4month = mktime(0, 0, 0, date("m", $last)+$m, date("d", $last),  date("Y", $last));
                    
    echo date("F y",$last4month);
                    
    }[/code]

    Ideally would like to get rid of the first echo and just have it loop the last 4 months, including this (current) month.

    Any ideas/point me in the right direction to a script etc.. would be appreciated!

    Thanks for you time.


×
×
  • 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.