Jump to content

webmaster1

Members
  • Posts

    607
  • Joined

  • Last visited

    Never

Posts posted by webmaster1

  1. I'm looking for a spell-checker mod for smf forum everywhere but all I can find are articles telling me I either have it or do not by default depending on my host.

     

    • How do I check if I have it in the first place without having to contact my host? I'm using mySQL, myPHPAdmin and cPANEL.
    • If I do have it what do I need to do?
    • If I don't have it what do I need to do?

     

    Any help would be greatly apreciated!

  2. Hi All,

     

    I'm calling on two dropdowns and writing their values back to a database:

    <?php
    //DROP DOWNS
    $callresult1 = $_POST['optone'];
    $callresult2 = $_POST['opttwo'];
    ?>

     

    For some reason the variables come back as blank. I'm using the following client side script:

     

    HEAD:

    <script type="text/javascript">
    
    function setOptions(chosen) {
    var selbox = document.myform.opttwo;
    
    selbox.options.length = 0;
    if (chosen == " ") {
      selbox.options[selbox.options.length] = new Option('Secondary Result',' '); 
    }
    
    if (chosen == "1") {
      selbox.options[selbox.options.length] = new
    Option('No Answer','oneone');
      selbox.options[selbox.options.length] = new
    Option('Engaged Tone','onetwo');
    }
    
    if (chosen == "2") {
      selbox.options[selbox.options.length] = new
    Option('No Decision Maker Available','twoone');
      selbox.options[selbox.options.length] = new
    Option('Follow Up: Sending Email','twotwo');
      selbox.options[selbox.options.length] = new
    Option('Follow Up: Decision Later','twothree');
    }
    
    
    if (chosen == "3") {
      selbox.options[selbox.options.length] = new
    Option('Obsolete Number','threeone');
      selbox.options[selbox.options.length] = new
    Option('Not Correct Contact','threetwo');
      selbox.options[selbox.options.length] = new
    Option('Outdated Prefix','threethree');
    }
    
    
    if (chosen == "4") {
      PRIVATE
    }
    
    if (chosen == "5") {
      selbox.options[selbox.options.length] = new
    Option('Overheads Too Expensive','fiveone');
      selbox.options[selbox.options.length] = new
    Option('Already Taken Course','fivetwo');
      selbox.options[selbox.options.length] = new
    Option('Not Applicable to Vocation','fivethree');
      selbox.options[selbox.options.length] = new
    Option('Weak Belief in Market Viability','fivefour');
      selbox.options[selbox.options.length] = new
    Option('Not Computer Literate','fivefive');
    selbox.options[selbox.options.length] = new
    Option('Out of Business','fivesix');
    }
    
    if (chosen == "6") {
      selbox.options[selbox.options.length] = new
    Option('Reviewing Record','sixone');
      selbox.options[selbox.options.length] = new
    Option('Editing Record','sixtwo');
    }
    
    }
    
    </script>
    
    <script language="javascript">
    
    
    function enableField()
    {
    
             if (document.myform.optone.value=="2")
             {
                document.myform.date.disabled=false;
                document.myform.month.disabled=false;
                document.myform.year.disabled=false;
                document.myform.hour.disabled=false;
                document.myform.minute.disabled=false;
    
    
             }
             else 
             {
                document.myform.date.disabled=true;
                document.myform.month.disabled=true;
                document.myform.year.disabled=true;
                document.myform.hour.disabled=true;
                document.myform.minute.disabled=true;
             }
             
    }
    
    </script>

     

    BODY:

    <p align="center">
    
    <select style="width: 150px;" name="optone" id="optone" size="1" onchange="setOptions(document.myform.optone.options[document.myform.optone.selectedIndex].value); enableField();">
    <option value=" " selected="selected"> Primary Result </option>
    <option value="1">Non-Connect</option>
    <option value="2">Schedule Call-Back</option>
    <option value="3">Wrong Number</option>
    <option value="4">Course Sale</option>
    <option value="5">Refusal</option>
    <option value="6">No Call Placed</option>
    </select>
    
    <select style="width: 250px;" name="opttwo" id="opttwo" size="1">
    <option value=" " selected="selected" > Secondary Result </option>
    </select>
    
    
    <input style="width: 35px;" name="date" id="date" type="text" disabled="true" >/
    <input style="width: 35px;" name="month" id="month" type="text" disabled="true" >/
    <input style="width: 45px;" name="year" id="year" type="text" disabled="true" >
    
    <input style="width: 35px;" name="hour" id="hour" type="text" disabled="true" >:
    <input style="width: 35px;" name="minute" id="minute" type="text" disabled="true" >
    
    
    
    
    </p>
    

  3. Hi All,

     

    I want to output from a database (that I've inputted to) without backslashes appearing. I was told in a recent thread to change the encoding of the page or to use html_entities. Outputting using stripslashes does the exact same thing.

     

    Lets say I'm outputting to a series of texboxes that I'm also using to re-input (insert) the data should the end-user need to make ammendments:

     

    <input type="text" name="landline" id="landline" value="<?php echo $landline; ?>"/>

     

    If I apply striplashes to the above value for outputting and then pick the variable back up with mysql_real_escape_string for inputting will I experience any sort of conflicts in terms of the special characters?

  4. Hi All,

     

    I need to pull one variable and it's count into a php page from its database. I can't get the count to work:

     

    <?php
    //CONNECT TO ADD TO EXPORT THE CATEGORY FIELD
    include("dbinfo.php");
    mysql_connect(localhost,$username,$password);
    @mysql_select_db($database) or die( "Unable to select database");
    
    //BUILD QUERY
    $query="SELECT DISTINCT category, count( category ) FROM `masterdata` GROUP BY category";
    
    $result=mysql_query($query);
    $num=mysql_numrows($result);
    mysql_close();
    
    //DISPLAY THE CATEGORY FIELD
    $i=0;
    while ($i < $num) {
    $category=mysql_result($result,$i,"category");
    $categorycount=mysql_result($result,$i,"count(category)");
    
    echo "<a href='recordlist.php?category=$category'>$category</a></br>";
    echo "<a href='recordlist.php?category=$categorycount'>$categorycount</a></br>";
    
    $i++;
    }
    ?>

     

    Can anyone spot where I've gone wrong?

  5. So you're saying the below code (its functional) would not time out until the browser is closed?

     

    <?php
    session_start();
        $valid_username = "user";
        $valid_password = "pass";
    
        $username = isset($_POST['username'])?$_POST['username']:"";
        $password = isset($_POST['password'])?$_POST['password']:"";
    
        if ($username == $valid_username && $password == $valid_password) {
              $_SESSION['logged'] = true;   
             header("Location: admin.php");
        }else {
                 $_SESSION['logged'] = false;
                 header("Location: loginfl.php");
        }?>

  6. Hi All,

     

    I'm building a basic CRM for work where I want users to:

     

    • be directed to a specific page based on their log in details.
    • remain logged in (no timing out of session).
       

     

    Should I be using sessions for this or do I use something simpler such as the username and password in a php page?

     

    Any reccomended tutorials would be apreciated too (yes, I do know how to google, just wondering if there is any specific tutorial some of you would reccomend  :P).

  7. Hi All,

     

    I'm using a basic script for a few RSS feeds but I keep on getting the following error:

     

    Parse error: syntax error, unexpected T_SL in ...

     

    The code is below. Can someone please help? This is really bugging me.

     

    <?php
    //
    // ScarySoftware RSS parser  
    // Copyright (c) 2006 Scary Software
    // ( Generates HTML from a RSS feeds )
    //    
    // Licensed Under the Gnu Public License
    //
    
    // Here are the feeds - you can add to them or change them 
    $RSSFEEDS = array( 
        0 => "http://www.site-reference.com/xml.php?c=all", 
        1 => "http://rss.cnn.com/rss/cnn_topstories.rss", 
        2 => "http://rss.slashdot.org/Slashdot/slashdot", 
    ); 
    
    
    // 
    //  Makes a pretty HTML page bit from the title,  
    //  description and link 
    //
    function FormatRow($title, $description, $link) {
    return <<<HTML 
    
    <!-- RSS FEED ENTRY -->
    <p class="feed_title">$title</p>
    <p class="feed_description">$description</p>
    <a class="feed_link" href="$link" rel="nofollow" target="_blank">Read more...</a>
    <p> </p>
    <hr size=1>
    <!-- END OF RSS FEED ENTRY --> 
    
    HTML;
    }
    
    // we'll buffer the output
    ob_start();
    
    // Now we make sure that we have a feed selected to work with
    if (!isset($feedid)) $feedid = 0;
    $rss_url = $RSSFEEDS[$feedid];
    
    // Server friendly page cache
    $ttl = 60*60;// 60 secs/min for 60 minutes = 1 hour(360 secs)  
    $cachefilename = md5($rss_url);
    if (file_exists($cachefilename) && (time() - $ttl < filemtime($cachefilename))) {
        // We recently did the work, so we'll save bandwidth by not doing it again
        include($cachefilename); 
        exit();
    }
    
    // Now we read the feed
    $rss_feed = file_get_contents($rss_url); 
    
    // Now we replace a few things that may cause problems later
    $rss_feed = str_replace("<![CDATA[", "", $rss_feed); 
    $rss_feed = str_replace("]]>", "", $rss_feed); 
    $rss_feed = str_replace("\n", "", $rss_feed); 
    
    // If there is an image node remove it, we aren't going to use 
    // it anyway and it often contains a <title> and <link> 
    // that we don't want to match on later. 
    $rss_feed = preg_replace('#<image>(.*?)</image>#', '', $rss_feed, 1 ); 
    
    // Now we get the nodes that we're interested in
    preg_match_all('#<title>(.*?)</title>#', $rss_feed, $title, PREG_SET_ORDER); 
    preg_match_all('#<link>(.*?)</link>#', $rss_feed, $link, PREG_SET_ORDER);
    preg_match_all('#<description>(.*?)</description>#', $rss_feed, $description, PREG_SET_ORDER); 
    
    // 
    // Now that the RSS/XML is parsed.. Lets Make HTML ! 
    // 
    
    // If there is not at least one title, then the feed was empty 
    // it happens sometimes, so lets be prepared and do something  
    // reasonable
    if(count($title) <= 1) 
    {
        echo "No news at present, please check back later.<br><br>";
    } 
    else 
    { 
        // OK Here we go, this is the fun part 
    
        // Well do up the top 3 entries from the feed
        for ($counter = 1; $counter <= 3; $counter++ ) 
        { 
            // We do a reality check to make sure there is something we can show
            if(!empty($title[$counter][1])) 
            { 
                // Then we'll make a good faith effort to make the title 
                // valid HTML 
                $title[$counter][1] = str_replace("&", "&", $title[$counter][1]);
                $title[$counter][1] = str_replace("'", "'", $title[$counter][1]);     
    
                // The description often has encoded HTML entities in it, and 
                // we probably don't want these, so we'll decode them
                $description[$counter][1] =  html_entity_decode( $description[$counter][1]);     
    
                // Now we make a pretty page bit from the data we retrieved from 
                // the RSS feed.  Remember the function FormatRow from the  
                // beginning of the program ?  Here we put it to use.
                $row = FormatRow($title[$counter][1],$description[$counter][1],$link[$counter][1]);
    
                // And now we'll output the new page bit! 
                echo $row;
            }
        }
    }
                    
    // Finally we'll save a copy of the pretty HTML we just created 
    // so that we can skip most of the work next time
    $fp = fopen($cachefilename, 'w'); 
    fwrite($fp, ob_get_contents()); 
    fclose($fp); 
    
    // All Finished! 
    ob_end_flush(); // Send the output to the browser
    
    ?> 

  8. I really don't know what you mean by

     

    expect the x,y coordinates

     

    or

     

    use a hidden field with a specific name/value that your code will use to detect that the form has been submitted.

     

    The theory makes sense but I don't know where to start in terms of implementation. Am I editing the name of the image or how I call it in the isset condition?

  9. Righto. So far I've found out its an IE 6+ issue.

     

    Apparently server side gets the following info from input type="image':

     

    control_name => value

    control_name_x => x co-ord

    control_name_y => y co-ord

     

    i've been told to test for existence of x or y by doing the following:

     

    <?php
    if (isset($_POST["control_name_x"]))
    {
    // form submitted 
    }
    ?>

     

    i'm not very certain of what it is I'm supposed to be doing here.

    http://www.aaronreynolds.co.uk/using-an-image-submit-button-in-php/

  10. Hi All,

     

    I'm using an image as submit that has a mouseover effect but it doesn't trigger my php code when clicked;

     

    <input name="submit" id="submit" type="image" alt="Send Message" 
    src="images/general_sendmessage1.jpg" 
    srcover="images/general_sendmessage2.jpg" 
    srcdown="images/general_sendmessage1.jpg" 
    border="0">

     

    It works fine when I use this:

     

    <input name="submit" id="submit" type="submit"/>

     

    Any ideas why its not working? i'm more interested in understanding whats going wrong rather than its fix.

                                                         

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