Jump to content

sorensens

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Posts posted by sorensens

  1. [!--quoteo(post=389147:date=Jun 29 2006, 01:31 AM:name=heckenschutze)--][div class=\'quotetop\']QUOTE(heckenschutze @ Jun 29 2006, 01:31 AM) [snapback]389147[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    rather than changing all of your links, an easier way would be to change the link class.

    eg..

    [code]//** Goes inbetween the "head" tags of your document.

    echo "<style type=\"text/css\">";
    if($member_status == 2)
    {
        echo "a:link {}";    //** Starting example, Admin link styles goes here
    }else{
        echo "a:link {}";    //** Starting example, User link styles goes here
    }
    echo "</style>";[/code]

    OR you could include a different stylesheet. eg, an "extra" one.

    hth, Zac.
    [/quote]

    :/ I need to use the link from before though - there's only one link as it's from my usersonline. The style isn't giving me the problem it's applying the style to the link that's not working since I can't just put something like [code]class=" '.$style.' "[/code]
  2. [!--quoteo(post=389097:date=Jun 28 2006, 10:22 PM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Jun 28 2006, 10:22 PM) [snapback]389097[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    <a href="viewprofile.php?id='.$id.'" class='.$style.'>'".$name."'</a>
    [/quote]

    Sorry, what I meant to say was that the link when you view source looks like -

    <a href="viewprofile.php?id='.$id.'" class=adminStyle>'.$name.'</a>

    So the class isn't working :(
  3. [!--quoteo(post=389036:date=Jun 28 2006, 04:26 PM:name=SharkBait)--][div class=\'quotetop\']QUOTE(SharkBait @ Jun 28 2006, 04:26 PM) [snapback]389036[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    I think you have the idea pretty much.

    [code]
    <?php
    // Check to see the status of the user
    if($member_status == '2') {
       // User is Admin
       $style = "adminStyle";
    } else {
       // User is Not Admin
       $style = "regularStyle";
    }

    ?>

    <a class="<?php echo $style;?> href="#""> First Link</a>
    [/code]

    So now if your an Admin it will look like
    [code]
    <a class="adminStyle" href="#">First Link</a>
    [/code]
    and if your Not an Admin
    [code]
    <a class="regularStyle" href="#">First Link</a>
    [/code]
    [/quote]


    ^.^ Thank you for helping. My only problem left now is that my link is being echo'd already from inside the php and I can't figure out how to get it to echo within double quotes.

    ex. this is the specific line I'm changing [code]<a href="viewprofile.php?id='.$id.'" class='.$style.'>'.$name.'</a>  [/code]
  4. ^.^;; 2nd question of the day. For some reason my $to_id isn't storing in either p_messages or p_messages_sent but everything else is just fine. So, here are the two pages.

    The Form: [code]
    <?php
    include 'cookie.php';
    include 'adminbar.php';
    include 'db.php';
    ?>
    <form action="sendpm.php" method="post">
      <table border="0" cellspacing="0" cellpadding="2">
        <tr>
          <td>Recipient:</td>
          <td> <select name="to_id" id="to_id">
          <?php
    $query = "SELECT name, id
              FROM membership
              WHERE status='Y' and name like '$a%'
              ORDER BY name ";
    $result = mysql_query($query) or die(mysql_error());

    if (mysql_num_rows($result) !=0)
    {
        while($row = mysql_fetch_array($result))
        {
            extract($row);
            echo "<option value=\"$id\">$name</option>";
        } #while
    } ?>
            </select></td>
        </tr>
        <tr>
          <td>Subject: </td>
          <td><input type="subject" name="subject"></td>
        </tr>
        <tr>
          <td>Message:</td>
          <td><textarea name="message" rows="15" cols="65"></textarea></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><input name="submit" type="submit" value="Send PM"></td>
        </tr>
      </table>
      <p>&nbsp;  </p>
    </form>
    [/code]

    The Script: [code]<?php
    // sendpm.php

    // Send PM to users
    //=================================
    // put database connection stuff here
    include 'db.php';

    // set variable for global_register off
    $subject = mysql_escape_string(trim(strip_tags($_POST['subject'])));
    $message = nl2br(mysql_escape_string(trim(strip_tags($_POST['message']))));
    $to_id = strtolower(mysql_escape_string(trim(strip_tags($_POST['to_id']))));

    $member = $_COOKIE['member']; // change to the cookie name u gave for the login

    if (empty($subject) || empty($message) || empty($to_id))
    {
        die('Error. All fields must be filled in.');
    }    

    // Now check if recipient is a valid member
    $qCheck = "select id from membership where lower(name) = '$to_id' limit 1";
    $rsCheck = mysql_query($qCheck)  or die(mysql_error());

    if (mysql_num_rows($rsCheck) !=0)
    {
        die ('Error, recipient is not a member in the system. ');
    }
    $row = mysql_fetch_row($rsCheck);
    $id = $row[0];        // set the id value returned by the query to $id

    // Obtain the sender id from the system
    $qID = "select id from membership where name='$member'  limit 1";
    $rsID = mysql_query($qID)  or die(mysql_error());
    $drow = mysql_fetch_array($rsID);
    $sender_id = $drow[0];

    // Now insert the PM into the database
    $qNew = "insert into p_messages (id, sender_id, subject, message, to_id, sentdate)
                    VALUES ('','$sender_id','$id','$subject','$message', now())";
    $rsNew = mysql_query($qNew) or die(mysql_error());

    if ($rsNew)
    {
        $qNew2 = "insert into p_messages_sent (id, sender_id, subject, message, to_id, sentdate)
                    VALUES ('','$sender_id','$id','$subject','$message', now())";
        $rsNew2 = mysql_query($qNew2) or die(mysql_error());
        echo '<p>Thank you, PM has been sent to recipient.</p>';
    }
    else
    {
        echo '<p>Error, Cannot send PM to recipient.</p>';
    }
    ?> [/code]
  5. Hi ^.^ For some reason my brain's just not computing to do this. Basically what I'm looking for is making it so that "admins" have one color in links while "members" have a different color. This is the code I'm working woth right now:

    [code]$query = "select member_status from membership where name = '$member'";
    $result = mysql_query($query) or die(mysql_error());

    $member_status = mysql_result($result, 0);
    if ($member_status=='2') {
    // Etc... [/code]

    Right now I import a CSS/PHP page to change how everything looks and I was hoping to add two classes there to use for how the admin and member links look.
×
×
  • 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.