Jump to content

marcus

Members
  • Posts

    1,842
  • Joined

  • Last visited

Posts posted by marcus

  1. I know, this may be the wrong board, but this may be helpful for some who want an easy quick search of php.net's functions.

    This works for Mozilla Firefox only.

    file directory: c:\documents and settings\USER\Application Date\Mozilla\Firefox\Profiles\PROFILENAME\searchplugins\

    You can manually add the file by creating a new document called php.net.xml

    and the file contents should be as followed:

    [code]
    <SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
    <ShortName>php.net</ShortName>
    <Description>Search php.net function list</Description>
    <InputEncoding>utf-8</InputEncoding>
    <Image width="16" height="16">data:image/x-icon;base64,Qk02AwAAAAAAADYAAAAoAAAAEAAAABAAAAABABgAAAAAAAADAADEDgAAx
    A4AAAAAAAAAAAAAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAw
    ICAwICAwICAwICAwICAwICAwICAwICA19fX19fX19fXwICAwICAwICAwICAwICAwICAwICA19fX19fX19fXwICAwICAwICA19fXAAAA19fXwICAw
    ICAwICAwICAwICAwICAwICA19fXAAAA19fXwICAwICAwICA19fXAAAA19fX19fXwICAwICA19fXwICAwICA19fX19fXAAAA19fX19fXwICAwICA1
    9fXAAAAAAAAAAAA19fX19fXAAAA19fX19fXAAAA19fXAAAAAAAAAAAA19fX19fX19fXAAAA19fX19fXAAAA19fXAAAA19fX19fXAAAA19fXAAAA1
    9fX19fXAAAA19fX19fXAAAA19fX19fXAAAA19fXAAAA19fX19fXAAAA19fXAAAA19fX19fXAAAA19fX19fXAAAA19fX19fXAAAA19fXAAAA19fX1
    9fXAAAA19fXAAAA19fX19fXAAAA19fX19fXAAAAAAAAAAAA19fX19fXAAAAAAAAAAAA19fX19fXAAAAAAAAAAAA19fX19fXwICA19fX19fX19fXw
    ICA19fXAAAA19fX19fXwICAwICA19fX19fX19fXwICAwICAwICAwICAwICAwICAwICA19fXAAAA19fXwICAwICAwICAwICAwICAwICAwICAwICAw
    ICAwICAwICAwICAwICA19fX19fX19fXwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAw
    ICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwICAwI
    CAwICAwICAwICAwICAwICAwICAwICA</Image>
    <Url type="text/html" method="GET" template="http://www.php.net/manual-lookup.php">
      <Param name="pattern" value="{searchTerms}"/>
      <Param name="sourceid" value="Mozilla-search"/>
    </Url>
    <SearchForm>http://www.php.net/manual-lookup.php</SearchForm>
    </SearchPlugin>
    [/code]

    or you can take the quick way and just manually download it of the attached file.

    [attachment deleted by admin]
  2. You can do a session and have a value to it.

    [code]
    <?php
    session_start();

    if(isset($_SESSION['counted'])){
    $new = $_SESSION['counted'] + 1;
    $_SESSION['counted'] = $new;
    echo $_SESSION['counted'];
    }else {
    $_SESSION['counted'] = 1;
    }
    ?>
    [/code]

  3. And for showing a members list you can do:

    [code]
    <?php
    $sql = "SELECT * FROM `users`";
    $res = mysql_query($sql) or die(mysql_error());
    $num = mysql_numrows($res);

    if($num == 0){
    echo "no users";
    }else {
    while($row = mysql_fetch_assoc($res)){
    echo "<a href=profile.php?id=$row['id']>$row['username']</a>\n";
    }
    mysql_free_result($res);
    }
    ?>
    [/code]
  4. You can do this easily with some mysql queries.

    [code]
    <?php
    $id = $_GET['id'];

    if(isset($id)){
    $sql = "SELECT * FROM `users` WHERE id =$id";
    $res = mysql_query($sql) or die(mysql_error());
    $num = mysql_numrows($res);
    $row = mysql_fetch_assoc($res);

    if($num > 0){
    echo "Welcome to $row['username']'s profile!<br><br>\n";
    echo "Name: $row['name']<br>\n";
    echo "Email: $row['email']<br>\n";
    echo "Picture: <img src='".$row['image']."'><br>\n";
    //and whatever is in your database
    }else {
    echo "That user does not exist!\n";
    }

    }else {
    echo "You have no user id specified!";
    }
    ?>
    [/code]
  5. I am trying to make a contact thing, that just simply puts a row in a database, but how would I go upon checking if the message included swears?

    Say if I had an array of words that I didn't want the person to send and check if the message included any of those
  6. Yeah, you can use captcha for the security code. And to block http:// and www

    You can do:

    [code]
    <?php
    $message = $_POST['message'];
    $message = str_replace("http://","",$message);
    $message = str_replace("www","",$message);
    ?>
    [/code]
  7. Is it possible to check if the same value of the submitted field are the same values?

    [code]
    <?php
    $str = $_POST['num'];

    if(strlen($str) > 0 && strlen($str) < 5){
        //then check if the field is the same value (like 4444,3333,1111)
    }
    ?>
    [/code]
  8. You could do:

    [code]
    $sql = "SELECT * FROM `friends` WHERE id =$id LIMIT 12";
    $res = mysql_query($sql) or die(mysql_error());

    while($row = mysql_fetch_assoc($res)){
    echo "<a href=profile.php?id=$row[friendowner]>$row[friendname]</a>|\n";
    }
    mysql_free_result($res);
    [/code]

    Then you could easily just make a new page like friends.php and use a get to show all the friends

    [code]
    $sql = "SELECT * FROM `friends` WHERE id =$_GET['id']";
    $res = mysql_query($sql) or die(mysql_error());

    while($row = mysql_fetch_assoc($res)){
    echo "<a href=profile.php?id=$row[friendowner]>$row[friendname]</a>|\n";
    }
    mysql_free_result($res);
    [/code]
×
×
  • 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.