Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New Coder
    Join Date
    Aug 2010
    Posts
    36
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Create message problem

    Hey,

    I have a problem with senting a message.

    Can you please read over my code and tell me whats wrong?

    Heres the html web ink
    http://www.triplenines.com/create_message.php
    and heres the code

    PHP Code:
    <?php
    session_start
    ();

    $toplinks "";
    if (isset(
    $_SESSION['id'])) {
        
    $userid $_SESSION['id'];
        
    $username $_SESSION['username'];
        
    $toplinks '<a href="member_profile.php?id=' $userid '">' $username '</a> &bull; 
        <a href="member_account.php"><input type="submit" name="Account" value="Account" /></a>
        <a href="logout.php"><input type="submit" name="Log out" value="Log out" /></a>'
    ;
    } else {
        
    $toplinks '<a href="join_form.php"><input type="submit" name="Register" value="Register" /><a href="login.php"><input type="submit" name="Login" value="Login" /></a>';

    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Triplenines 999 - Create message</title>
    <style type="text/css"> 
     
    body  {
        font: 100% Verdana, Arial, Helvetica, sans-serif;
        margin: 0; 
        padding: 0; 
        color: #000000;
        width: 500px;
        background-color: #666;
        font-family: Verdana, Geneva, sans-serif;
        background-image: url(pictures/logo%20buttons/29410-Clipart-Illustration-Of-Sparkling-White-Delicate-Grasses-Over-A-Light-Blue-Background.jpg);
    }


    .thrColHybHdr #container {
        width: 800px;
        background: #FFFFFF; 
        margin-right: 0%;
        margin-left: 250px;
    }  
    .thrColHybHdr #header {
        outline-style: none;
        background-color: #FFF;
        width: 780px;
        padding-top: 0;
        padding-right: 10px;
        padding-bottom: 0;
        padding-left: 10px;

    .thrColHybHdr #header h1 {
        margin: 0; 
        padding: 10px 0; 
        text-align: left;
    }


    .thrColHybHdr #sidebar1 {
        float: left;
        width: 11em; 
        background: #EBEBEB;
        background-color: #FFF;
        color: #000;
        padding-top: 0px;
        padding-right: 0;
        padding-bottom: 0px;
        padding-left: 0;
    }
    .thrColHybHdr #sidebar2 {
        float: right;
        width: 100%; 
        background: #EBEBEB; 
        background-color: #FFF;
        padding-top: 0px;
        padding-right: 0;
        padding-bottom: 0px;
        padding-left: 0;
    }
    .thrColHybHdr #sidebar3 {
        float: right;
        width: 170px; 
        background-color: #FFF;
        padding-right: 0;
        padding-left: 0;
        text-align: left;
    }
    .thrColHybHdr #sidebar4 {
        float: right;
        width: 170px; 
        background-color: #FFF;
        padding-right: 0;
        padding-left: 0;
        text-align: left;
    }

    .thrColHybHdr #sidebar1 h3, .thrColHybHdr #sidebar1 p, .thrColHybHdr #sidebar2 p, .thrColHybHdr #sidebar2 h3 {
        margin-left: 10px; 
        margin-right: 10px;
        color: #000;
    }


    .thrColHybHdr #mainContent {
        margin-top: 46px;
        margin-right: 0em;
        margin-left: 12em;
        padding-top: 4px;
        padding-right: 0em;
        padding-bottom: 0;
        padding-left: 0em;

    .thrColHybHdr #mainContent1 {
        margin-top: 60em;
        margin-right: 0em;
        padding-top: 0px;
        padding-right: 0em;
        padding-bottom: 0;
        padding-left: 0em;
        width: 100%;
        text-align: left;

    .thrColHybHdr #footer {
        padding: 0 10px; 
        background:#DDDDDD;
        background-color: #CCC;

    .thrColHybHdr #footer p {
        margin: 0; 
        padding: 10px 0; 
    }

    .fltrt { 
        float: right;
        margin-left: 8px;
    }
    .fltlft { 
        float: left;
        margin-right: 8px;
    }
    .clearfloat { 
        clear:both;
        height:0;
        font-size: 1px;
        line-height: 0px;
    }
    .thrColHybHdr #container #sidebar3 h5 {
        text-align: center;
    }
    .thrColHybHdr #container #sidebar3 table tr th {
        text-align: center;
    }
    .thrColHybHdr #container #mainContent1 {
        text-align: center;
        font-size: 90%;
        margin-top: 1em;
    }
    .thrColHybHdr #container #sidebar1 table tr th {
        color: #000;
    }
    #mainContent1 h5 a {
        font-family: Tahoma;
        font-size: 10px;
        color: #000;
    }

    #container #mainContent p a {
        font-family: Tahoma;
        font-size: 12px;
        color: #000;
        text-align: center;
    }
    #container #mainContent p a {
        font-family: Tahoma;
        font-size: 12px;
        font-weight: bold;
        color: #000;
    }
    </style>
    <script type="text/javascript">
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    }
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }

    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    }

    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }
    </script>
    </head>

    <body class="thrColHybHdr" onload="MM_preloadImages('pictures/dresses/B02b.jpg','pictures/dresses/A01b.jpg','pictures/dresses/B03b.jpg','pictures/logo buttons/w012color.JPG','pictures/logo buttons/header.jpg','pictures/logo buttons/home1.JPG','pictures/logo buttons/products1.JPG','pictures/logo buttons/customize1.JPG','pictures/logo buttons/testimonials1.JPG','pictures/logo buttons/friends1.JPG','pictures/dresses/E02.jpg','pictures/dresses/BK318.jpg','pictures/dresses/BK318b.jpg','pictures/dresses/BK330.jpg')">

    <div id="container">

      <div id="header">

    <script type="text/javascript">
    var k_push_vars = {
        "display_after": 30,
        "view_percentage": 40,
        "popup_font_color": "#000000",
        "popup_background": "#ffffff",
        "popup_separator": "#D4E2F0",
        "header": "Your feedback is important to us!",
        "question": "Would you be willing to give us a short (1 minute) feedback?",
        "footer": "Thank you for helping us improve our website",
        "remind": "Remind me later",
        "remind_font_color": "#3882C3",    
        "yes": "Yes",
        "no": "No",
        "text_direction": "ltr",
        "images_dir": "http://cf.kampyle.com/",
        "yes_background": "#76AC78",
        "no_background": "#8D9B86",
        "site_code": 6231394
    }
    </script>

    <link rel="stylesheet" type="text/css" media="screen" href="http://cf.kampyle.com/k_button.css" />

        <h1 ><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image8','','pictures/logo buttons/header.jpg',1)"><img src="pictures/logo buttons/header.jpg" name="Image8" width="780" height="285" border="0" id="Image8" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image8','','pictures/logo buttons/header.jpg',1)"></a></h1>
        <h1 ><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image9','','pictures/logo buttons/home1.JPG',1)"><img src="pictures/logo buttons/home.JPG" name="Image9" width="153" height="61" border="0" id="Image9" /></a><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image26','','pictures/logo buttons/w012color.JPG',1)"></a><a href="index.html"></a><a href="choose.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image10','','pictures/logo buttons/products1.JPG',1)"><img src="pictures/logo buttons/products.JPG" name="Image10" width="155" height="61" border="0" id="Image10" /></a><a href="customize.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image11','','pictures/logo buttons/customize1.JPG',1)"><img src="pictures/logo buttons/customize.JPG" name="Image11" width="156" height="61" border="0" id="Image11" /></a><a href="reviews.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image12','','pictures/logo buttons/testimonials1.JPG',1)"><img src="pictures/logo buttons/testimonials.JPG" name="Image12" width="157" height="61" border="0" id="Image12" /></a><a href="friends.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image13','','pictures/logo buttons/friends1.JPG',1)"><img src="pictures/logo buttons/friends.JPG" name="Image13" width="159" height="61" border="0" id="Image13" /></a></h1>
      </div><div id="sidebar1">
        <p><?php echo $toplinks?></p>
        <table width="100%" border="1">
          <tr>
            <th scope="col">What's New?</th>
          </tr>
        </table>
        <h5 align="center"><a href="BK302.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image26','','pictures/dresses/BK302.jpg',0)"><img src="pictures/dresses/BK302.jpg" name="Image26" width="150" height="240" border="0" id="Image26" /></a></h5>
        <table width="100%" border="1">
          <tr>
            <th scope="col">What's Hot?</th>
          </tr>
        </table>
        <h5 align="center"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image27','','pictures/dresses/E02.jpg',1)"><img src="pictures/dresses/E02.jpg" name="Image27" width="150" height="240" border="0" id="Image27" /></a></h5>
        <table width="100%" border="1">
          <tr>
            <th scope="col">This week special</th>
          </tr>
        </table>
        <p align="center"><a href="BK330.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image1','','pictures/dresses/BK330.jpg',1)"><img src="pictures/dresses/BK330.jpg" name="Image1" width="150" height="240" border="0" id="Image1" /></a></p>
      </div>
      <div id="mainContent">


    <div id='k_close_button' class='k_float kc_bottom_sl kc_right'></div><div><a href='http://www.kampyle.com/feedback_form/ff-feedback-form.php?site_code=6231394&amp;lang=en&amp;form_id=54960'  target='kampyleWindow' id='kampylink' class='k_float k_bottom_sl k_right' onclick="javascript:k_button.open_ff('site_code=6231394&amp;lang=en&amp;form_id=54960');return false;"><img src="http://cf.kampyle.com/buttons/en/orange/en-orange-corner-low-right.gif" alt="Feedback Form" border="0"/></a></div>
    <div id='k_slogan' class='k_float k_bottom k_right'></div>
    <script src="http://cf.kampyle.com/k_button.js" type="text/javascript"></script>
    <script src="http://cf.kampyle.com/k_push.js" type="text/javascript"></script>

        <div align="center"></div>
    <h5 align="left">
      <p><a href="create_message.php">Create a new message</a></p>
      <p>
      
      <?php
    if ($username){
        echo 
    "<div id='box'>
          <b class='corners'>
          <b class='corners1'><b></b></b>
          <b class='corners2'><b></b></b>
          <b class='corners3'></b>
          <b class='corners4'></b>
          <b class='corners5'></b></b>
          <div class='cornersfg'>
        </div>
            <div id='bottom' style='padding: 10px;'>"
    ;
        
    ////////////////////////////////////////////////////////////////////
            
    $form "<form action='create_message.php' method='POST'><table>
            <tr>
                <td><input type='text' name='sendtouser' class='text-box' size='50' id='msguserbox' onblur='msguserbox_blur();' onfocus='msguserbox_focus();' value='Username of the person revieving your message'></td>
            </tr>
            <tr>
                <td><input type='text' name='subject' class='text-box' size='50' id='msgsubjectbox' onblur='msgsubjectbox_blur();' onfocus='msgsubjectbox_focus();' value='Message Subject'></td>
            </tr>
            <tr>
                <td><textarea name='content' class='text-box' cols='45' rows='7' id='msgcontentbox' onblur='msgcontentbox_blur();' onfocus='msgcontentbox_focus();'>Message Content</textarea></td>
            </tr>
            <tr>
                <td><input type='submit' name='sendbutton' class='button' value='Send'></td>
            </tr>
            </table></form>"
    ;
            
            if (
    $_POST['sendbutton']){
                
    $sendtouser $_POST['sendtouser'];
                
    $subject $_POST['subject'];
                
    $content $_POST['content'];
                
                if (
    $sendtouser == "Username of the person revieving your message")
                    
    $sendtouser "";
                if (
    $subject == "Message Subject")
                    
    $subject "";
                if (
    $content == "Message Content")
                    
    $content "";
                
                if (
    $sendtouser && $subject && $content){
                    require (
    'connect_to_mysql.php');
                    
    $query mysql_query("SELECT * FROM users WHERE username='$sendtouser'");
                    
    $numrows mysql_num_rows($query);
                    if (
    $numrows == 1){
                        
    $row mysql_fetch_assoc($query);
                        
    $to_id $row['id'];
                        
    $to_user $row['username'];
                        
    $date date("M d, Y");
                        
                        
    $query mysql_query("SELECT * FROM messages WHERE content='$content' AND to_id='$to_id' AND from_id='$userid' AND date='$date'");
                        
    $numrows mysql_num_rows($query);
                        if (
    $numrows == 0){
                            
    mysql_query("INSERT INTO messages VALUES ('', '$to_user', '$to_id', '$username', '$userid', '$subject', '$content', '$date')");
                            echo 
    "You message has been sent. <a href='inbox.php'>Click here</a> to view your inbox.";
                        }
                        else
                            echo 
    "You can not resend the same message.$form";
                    }
                    else
                        echo 
    "The username you have entered is invalid.$form";
                }
                else
                    echo 
    "You did not fill in the entire messsage form.$form";
            }
            else
                echo 
    "$form";
        
    ////////////////////////////////////////////////////////////////////    
        
    echo "</div>
          </div>
          <b class='corners'>
          <b class='corners5'></b>
          <b class='corners4'></b>
          <b class='corners3'></b>
          <b class='corners2'><b></b></b>
          <b class='corners1'><b></b></b></b>
        </div>"
    ;
        echo 
    "</div>";
    }
    else
        echo 
    "<center><h2><font color='red'>You must be logged in to view this page.</font></h2></center>";
    require(
    'connect_to_mysql.php'); ?>
      </h3>
        
        
      <!-- begin htmlcommentbox.com -->
      </p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p><a href="contactus.php">Contact Us</a> <a href="privacy.php">Privacy</a> <a href="sizing.php">Sizing</a> <a href="shippingandreturns.php">Shipping and Returns</a> <a href="aboutus.php">About Us</a> <a target="_blank"href="catalogue.php">Catalogue</a></p>
      <p> 2010 Triplenines.com a division of 999</p>
      
      </div>
      <!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats -->
     <br class="clearfloat" />
     <!-- end #container -->
    </div>

    </body>
    </html>

  2. #2
    Supreme Master coder!
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    10,097
    Thanks
    10
    Thanked 1,159 Times in 1,150 Posts
    We can't see it without logging in.

  3. Users who have thanked mlseim for this post:

    DouboC (08-28-2010)

  4. #3
    New Coder
    Join Date
    Aug 2010
    Posts
    36
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Use the username test

    and password test

    or create your own thanks

  5. #4
    New Coder
    Join Date
    Aug 2010
    Posts
    36
    Thanks
    8
    Thanked 0 Times in 0 Posts
    the inbox and delete message also don't work yet, they are in another trend

    http://codingforums.com/showthread.p...602#post987602

  6. #5
    Supreme Master coder!
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    10,097
    Thanks
    10
    Thanked 1,159 Times in 1,150 Posts
    The login page won't open with IE8, so I had to use FF to get the login page.
    Looks like you have other problems.

    The send message fails on line 311 ... in red:

    require ('connect_to_mysql.php');
    $query = mysql_query("SELECT * FROM users WHERE username='$sendtouser'");
    $numrows = mysql_num_rows($query);

    I don't really see why it would fail with this message:
    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/triplen1/public_html/create_message.php on line 311

    I wonder if this script: connect_to_mysql.php doesn't have the table called "users" in it.

    That would create a different error message?? very strange.


    .

  7. Users who have thanked mlseim for this post:

    DouboC (08-28-2010)

  8. #6
    New Coder
    Join Date
    Aug 2010
    Posts
    36
    Thanks
    8
    Thanked 0 Times in 0 Posts
    here is my code for connect_to_mysql

    PHP Code:
    <?php 

    $db_host 
    "localhost";

    $db_username "********"

    $db_pass "*********";

    $db_name "triplen1_imga1";

    mysql_connect("$db_host","$db_username","$db_pass") or die(mysql_error());
    mysql_select_db("$db_name") or die("no database by that name");
    ?>
    the *** are my username and password i use for my cpanel

  9. #7
    Supreme Master coder!
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    10,097
    Thanks
    10
    Thanked 1,159 Times in 1,150 Posts
    Inside "triplen1_imga1" is a table called "users", and within that table is a column called "username"?

  10. Users who have thanked mlseim for this post:

    DouboC (08-28-2010)

  11. #8
    New Coder
    Join Date
    Aug 2010
    Posts
    36
    Thanks
    8
    Thanked 0 Times in 0 Posts
    There is a table called members not users is that what is wrong? by the way can i add you as a friend?

  12. #9
    Supreme Master coder!
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    10,097
    Thanks
    10
    Thanked 1,159 Times in 1,150 Posts
    See the red below ... the table called 'users' doesn't exist in your database 'triplen1_imga1' ...

    require ('connect_to_mysql.php');
    $query = mysql_query("SELECT * FROM users WHERE username='$sendtouser'");
    $numrows = mysql_num_rows($query);

  13. #10
    New Coder
    Join Date
    Aug 2010
    Posts
    36
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Oh thanks i'm a idiot


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •