Jump to content

Mouse

Members
  • Posts

    95
  • Joined

  • Last visited

    Never

Posts posted by Mouse

  1. to be honest, what ever works best... all the quotes are in a txt file and i'm just writing the on this day file but using Excel for ease of keeping it all together... so i am open...

    Quote:
    [code]
    <?php
    // Array Structure:  "Quote","Author"

    $allqts = array
        (
    "You can create the most wonderful place in the world. But it takes people to make the dream a reality. - Walt Disney",
    "You may not realize it when it happens, but a kick in the teeth may be the best thing in the world for you. - Walt Disney",
    "It's not hard to make decisions when you know what your values are. - Roy Disney",
    "There's no good idea that can't be improved on. - Michael Eisner",
    "Succeeding is not really a life experience that does that much good. Failing is much more enlightening. - Michael Eisner",
    "Well, when you're trying to create things that are new, you have to be prepared to be on the edge of risk. - Michael Eisner"
            );

    $totalqts = (count($allqts)/2);

    $nmbr = (rand(0,($totalqts-1)));
    $nmbr = $nmbr*2;

    $quote = $allqts[$nmbr];
            $nmbr = $nmbr+1;


    echo "<Font color=$textcolor>";
    echo "$quote<br>";
    echo "</font>";


    IF ($PHP_SELF == "/quotes.php") {
        show_source("quotes.php");
      }

    ?>
    [/code]

    (and thanks for the interest...)

    Mouse
  2. Ok, I am a total lose where to start with this… maybe I am being a little too cleaver for my own good, or perhaps I am just too dumb today to work this out for myself…

    What I have is two lists:
    One is a list of quotes, and their speakers,
    The other is a list of “on this day” and the relevant years.

    What I am aiming to do is…

    If
    there is a listing for today in this list then put “what happened” in box “a” and ‘On this day’ and the year in box “b”
    else
    put random quote in box “a” and site the speakers name in box “b”

    at the moment I am part way there on my homepage with the quote part (see http://mouse.nodstrum.com/index.php) but I just cant get my head around how to get the if’s and else’s to make this work….

    HELP

    (pretty please)

    Mouse
  3. but anyways, why wont my meter EVER show a perfect six? following my own rules that the meter was founded on, 6 or more characters, at least one special character and a mix of upper, lower case and didgits... so even #M1ckE4 wont get 6... its got to be a coding bug....

    only i don't see it... HELP...

    Mouse.
  4. [CODE]
    <?php
    function pwd_strength($pwd)
    {
      $result = 0;  # intialize to weakest
      $result += round(strlen($pwd) / 10);
      foreach(array("a-z", "A-Z", "0-9", "^a-zA-Z0-9") as $chars)
      {
        if(preg_match("/[$chars]/", $pwd))
        {
          $result += 1;
        }
      }
      return(min($result, 6));
    }
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang='en'>
    <head>
    <META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'>
    <title>Password Validation</title>
    <style type="text/css">
    body {
      font: medium arial, helvetica, sans-serif;
      margin: 0;
      padding: 1em 10%;
    }
    div {
      height: 20px;
      margin: 5px 0;
      padding: 0;
      border: solid 1px #333;
    }
    #str0, #str1 {
      width: 12%;
      background-color: #f00;
    }
    #str2 {
      width: 24%;
      background-color: #c30;
    }
    #str3 {
      width: 36%;
      background-color: #963;
    }
    #str4 {
      width: 48%;
      background-color: #693;
    }
    #str5 {
      width: 60%;
      background-color: #3c0;
    }
    #str6 {
      width: 72%;
      background-color: #0f0;
    }
    #rating {
      width: 72%;
      padding: 0;
      margin: 0;
      border: none;
      height: auto;
    }
    </style>

    </head>
    <body>
    <h1>Password Strength Rating</h1>
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    <p>Password: <input type="password" name="password" size="16" maxlength="16">
    <input type="submit" name="submit" value="Rate Password"></p>
    </form>
    <?php
    if(isset($_POST['submit']))
    {
      $strength = pwd_strength($_POST['password']);
      echo "<p>Password strength (1 = very weak, 6 = very strong): ".
          "<strong>$strength</strong></p>\n";
      echo "<div id='str$strength'></div>";
      echo "<div id='rating'><p style='float: left'>Weak</p>";
      echo "<p style='float: right'>Strong</p></div>\n";
    }
    ?>
    </body>
    </html>
    [/code]
    any ideas why i can never get a perfect 6?
  5. [quote author=Barand link=topic=105508.msg421796#msg421796 date=1156489658]
    Your image width is 300px, but you need to know what value the full width represents (ie what is your max value);

    Assuming it's 100,

    $max = 100;
    $graph_value = 10;
    $valWidth = ($graph_value/$max) * 300;

    imagefilledrectangle($im, 0, 0, $valWidth , $imageHeight, $colorRed);
    imagerectangle ($im, 0, 0, $imgWidth - 1, $imageHeight - 1, $colorBlue);
    [/quote]
    Many thanks i'll give this a spin tonight when i get 127.0.0.1 many thanks

    Mouse
  6. [quote author=AdRock link=topic=105508.msg421498#msg421498 date=1156441531]
    I don't know if this is any good but I got this fund raising thermoter for my site here

    [url=http://www.entropyfarm.org/software/thermo/]http://www.entropyfarm.org/software/thermo/[/url]

    I changed some of the sizes of the images and changed some of the variables to make it fit within my site and it does the job i want
    [/quote]
    most excelent... why didn't i find this... many thanks
  7. Donations thermometer Ladies and gentlemen… good day to you all.

    Well its my least favourite subject here… math(s). to be honest it’s the bit in PHP I suck at… and the other bit I know nothing of is graphics in PHP.

    What I am aiming to do is generate a horizontal donations thermometer on my site. I think the community site I am building will benefit so here’s what I am aiming to do…

    To produce an image X pixels high, by Y pixels wide that will represent the part of the target amount (lets call it Z), which has been met by donations (erm… lets call that D).

    So far I got to here (#### ) and lost the will to live (if life involves maths that is…)

    [code]
    <?
    // Add values to the graph
    $graphValues=10; // D for Donations random ammount for testing

    // Define .PNG image
    header("Content-type: image/png");
    $imgWidth=300; // Y pixels wide
    $imgHeight=10; // X pixels high

    // Create image and define colors
    $image=imagecreate($imgWidth, $imgHeight);
    $colorWhite=imagecolorallocate($image, 255, 255, 255); // Background Colour
    $colorBlue=imagecolorallocate($image, 104, 157, 228); // Border Colour
    $colorRed=imagecolorallocate($image, 255, 51, 0); // Thermomiter Fill Colour

    ########################################

    // Output graph and clear image from memory
    imagepng($image);
    imagedestroy($image);
    ?>
    [/code]

    If any kind Math / PHP fiend would care to help I would be grateful

    Many thanks

    Mouse
  8. Dear all…

    Ok so I’ve just about got the PHP thing under control and the JavaScript (so I can learn Ajax next) is coming along… so the next thing I need to sort out is a bit of backing up of MySQL.

    Short of manually backing up my database each evening (hard to do as I am away a lot and the wife does like to see me occasionally) with a dump file via my host’s poor PHPMyAdmin, - or trusting them to do it correctly…

    Question:
    Is there a script / program / magic bit of hocus-pocus that will automatically back up my database and perhaps mail it to me every 24 hours or so?

    Answer: … over to you!

    Many thanks

    Mouse
  9. [!--quoteo(post=384101:date=Jun 15 2006, 09:03 AM:name=joquius)--][div class=\'quotetop\']QUOTE(joquius @ Jun 15 2006, 09:03 AM) [snapback]384101[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    preg_replace ("/([\w]{50})/", "$1 more\>\>", $text);

    but I'm a bit rusty on reg expressions so check it first
    [/quote]

    i was thinking along the lines of

    [code]
    if(strlen($srchrow["desc"])>75){
              $srchrow["desc"]=substr($srchrow["desc"],0,75)."...";
            }
    [/code]

    but this counts letters not words... any ideas?

    Mouse
  10. Mental Block time…
    Quoting the first 50 words… more>>

    Ok so it has something to do with count() but I can’t get my head around it… I want to quote the first 50 words of an article in the link to that page but how can I pull the first 50 words and put them along with a “more>>” link at the end???

    Mouse
  11. hello all, time to reactivate this conversation... my host has offered me either Simple machines or PhpBB forums as the only two options... any one used either and got any pro's and or cons???

     

    many thanks for your feedback

     

    Mouse

  12. [!--quoteo(post=370309:date=May 1 2006, 05:31 PM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ May 1 2006, 05:31 PM) [snapback]370309[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    Take a look at these articles at the [a href=\"http://www.nyphp.org/index.php\" target=\"_blank\"]NYC PHP User's Group[/a] web site:[list]
    [*][a href=\"http://www.nyphp.org/phundamentals/spoofed_submission.php\" target=\"_blank\"]Spoofed Form Submissions[/a]
    [*][a href=\"http://www.nyphp.org/phundamentals/email_header_injection.php\" target=\"_blank\"]Email Header Injection Exploit[/a]
    [/list]
    Ken
    [/quote]
    makes for a scarey read... i think i'm going to have to reevaluate my mail functions.

    has anyone found a solution? would it be feasable to add a limit to how many mails were sent by each IP or email address?

    Mouse
  13. hi all...

    i have just found that a simple mail form i had on my testing site has been used to send spam... so two questions

    1... how do they use my form to spam other people?

    2... how do i stop the buggers?

    GRRRRRRRRrrrrrrrrr!!!!!!!!!!!!!!!!11

    Mouse
  14. [!--quoteo(post=369493:date=Apr 28 2006, 09:28 AM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ Apr 28 2006, 09:28 AM) [snapback]369493[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    First of all, the PHP Help forum is for specific PHP scripting problems, so I'll be moving this to a more relevent forum.

    Yes, I have done it - I have FreeBSD installed on an old machine: 800MHz CPU; 128Mb RAM; 10Gb HDD. But I mainly use this for learning the command line for FreeBSD as I have a couple of dedicated servers with the same OS on, if I want to do something on my live servers I test it out on my test one first so that I know what I am doing!

    For testing my PHP projects on, I just use my development machine which is running a WAMP set-up.
    [/quote]
    thanks for that Semi... just need to run tests on my mail security and membership systems that as the use a mail confirmation i'm having issues doing it on my development machine...

    Mouse
  15. Building a web server to test my own sites…

    Has anyone built heir own home test server? I’ve read that I could use my old PC as a base, ok so it won’t be fast or flashy but it could work… but has anyone done it before?

    I have an cable / wireless / Ethernet net connection and was wondering if anyone had already done it and if so how?

    Mouse
  16. Sessions and variables…

    Dear all,

    The idea of sessions is a new one to me… and I have what is a basic question.

    When a user registers for my site I ask for and record $first_name, $last_name and $email_address and a random password is assigned to each user. When they log in to the site their email ($email_address) is checked against their password and all is well, they enter…

    How do I call the $first_name, $last_name, and $email_address variables into a page so that I can use them to automatically populate user fields in contact forms etc?

    Many thanks

    Mouse.
  17. [!--quoteo(post=361159:date=Apr 3 2006, 10:19 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Apr 3 2006, 10:19 AM) [snapback]361159[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    make sure you have session_start as the first line in every php file you use session for.

    Also the guru status is about your post count not your actual skill/knowledge of PHP itself.
    [/quote]
    the session_start issue has been addressed, thank you. what i was aiming for is one flowing validation script that checks all the fields are filled and puts together the appropriate responce if not...
  18. Hi… I am in a pickle… I have followed a couple of tutorials on building a membership login and have come up with a hybrid that works ( [a href=\"http://www.sitepoint.com/article/users-php-sessions-mysql\" target=\"_blank\"]http://www.sitepoint.com/article/users-php-sessions-mysql[/a] )… then I got a little more adventurous and tried to tie in a another tutorial on adding a Captcha (http://www.sitepoint.com/article/toughen-forms-security-image ) basicly I want to do the same thing as PHP Freaks do for their login…
    The problem I have is the validation scripts… I don’t know how to make them into one working form validation.
    Session based Login script
    [code]
    <?php
      exit;
    }
    $_SESSION['uid'] = $uid;
    $_SESSION['pwd'] = $pwd;
    $sql = "SELECT * FROM user WHERE
            userid = '$uid' AND password = PASSWORD('$pwd')";
    $result = mysql_query($sql);
    if (!$result) {
      error('A database error occurred while checking your '.
            'login details.\\nIf this error persists, please '.
            'contact you@example.com.');
    }
    if (mysql_num_rows($result) == 0) {
      unset($_SESSION['uid']);
      unset($_SESSION['pwd']);
      ?>
    [/code]
    Captcha validation code
    [code]
    <?php
          // check for posted form
          if (isset($_POST['login'])) {
             // see if the code the user typed matched the generated code
             if (strtoupper($_POST['code']) == $_SESSION['code']) {
                echo 'Congratulations, you entered the correct code.';
             } else {
                echo 'You have entered the wrong code. Please <a href="index.php">try again</a>.';
             }
          } else {
       ?>
    [/code]
    if anyone wants to have a look at this and walk me through a finished form validation code I would be truly grateful…
    many thanks in advance…
    Mouse
  19. [!--quoteo(post=359189:date=Mar 28 2006, 10:13 AM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Mar 28 2006, 10:13 AM) [snapback]359189[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    CHMOD sets perssions which can restrain users from doing certains things on your files/folders. Therer are three groups which are Owner, Group and Public

    Each groups has three settings which are Read, Write and Execute. The defualt perssions for your files is usually 0644. You can set these permissions in your FTP client after you have uploaded your files to the server. Once uploaded depending on your FTP client right click on the file and select Properties or Perssions from the menu. A small box should popup and a perssions table should be shown with tickboxes for each read, execute and write settings in each group. If you tick all the read, write and execute tickboxes in all three groups that wil set your file permissions to CHMOD 0777.

    CHMOD is a much more advanced file permission handler than WIndows persions which is just one setting Read-Only!
    [/quote]

    So why didn't they just say that then???

    Many thanks

    Mouse
  20. CHMOD to 777 - ???

    I have read the PHP manual on this but it is not 100% clear to me. I see on some scripts “set File_name CHMOD to 777” erm, what? How do I do this and more to the point why????

    Many thanks

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