Web Analytics Made Easy -
StatCounter Problem with code - CodingForum

Announcement

Collapse
No announcement yet.

Problem with code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with code

    Hi! I am making a personal messaging system for my virtual pet site, but I am having problems. I think that the preuserID varialble isn't showing up for some reason, but I am not sure. I've been working on this script all day! Help much needed. Thanks!

    PHP Code:
    <?
    session_start
    ();
    $session=session_id( );

    include (
    "/secure/config.php");

    $username=$_POST['to'];
    $subject=$_POST['subject'];
    $message=$_POST['message'];
    $preuserID=$_POST['preuserID'];

    $username_check "SELECT * FROM chibifriends WHERE preuserName = '$username'";
    $check_result mysql_query($username_check,$connection);
    $username_data mysql_fetch_array($check_result);
    $check_rows mysql_num_rows($check_result);

    if (
    $check_rows 1) {
    echo 
    "Sorry, there is no user by the name of $username";
    }
    else {
    function 
    cleanup($subject) {
        
    $words "form,noscript,meta,iframe,script,layer,style,filter,body,background,cursor,scrollbar,include,****,***,neopets,dick,***,homo,*****,lesbian,dike,pussy,****,sex,blowjob,suck,cwhome,cum,ecritters,aftermathzone,hump,******,gook,spic,*****";
        
    $wordarray explode(","$words);
        foreach (
    $wordarray as $word) {
            
    $subject eregi_replace($word" "$subject);
        }
        return 
    $subject;
    }


    function 
    cleanup1($message) {
        
    $words "form,noscript,meta,iframe,script,layer,style,filter,body,background,cursor,scrollbar,include,****,***,neopets,dick,***,homo,*****,lesbian,dike,pussy,****,sex,blowjob,suck,cwhome,cum,ecritters,aftermathzone,hump,******,gook,spic,*****";
        
    $wordarray explode(","$words);
        foreach (
    $wordarray as $word) {
            
    $message eregi_replace($word" "$message);
        }
        return 
    $message;
    }

    $subject =cleanup($subject);
    $message =cleanup1($message);
    $toID $username_data[preuserID];

    echo 
    "$message $subject $preuserID $toID";
    $send 'INSERT into starbits values (NULL, "$toID", "'.$preuserID.'", "'.$subject.'", "'.$message.'", "'.$unread.'",);';
    $result_send mysql_query($send)or die("Error 1a");
    echo 
    "Your message has been sent!";
    }
    ?>

  • #2
    PHP Code:
    // Replace
    $send 'INSERT into starbits values (NULL, "$toID", "'.$preuserID.'", "'.$subject.'", "'.$message.'", "'.$unread.'",);';
    // with this
    $send 'INSERT into starbits values (NULL, "'.$toID.'", "'.$preuserID.'", "'.$subject.'", "'.$message.'", "'.$unread.'",);'
    dumpfi
    "Failure is not an option. It comes bundled with the software."
    ....../)/)..(\__/).(\(\................../)_/)......
    .....(-.-).(='.'=).(-.-)................(o.O)...../<)
    ....(.).(.)("}_("}(.)(.)...............(.)_(.))¯/.
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
    Little did the bunnies suspect that one of them was a psychotic mass murderer with a 6 ft. axe.

    Comment


    • #3
      Thanks for responding. It still dosn't work. I accidently made unread into an variable, which it is not. And the table name starbits, was supposed to be starmail, but I am still having problems. Here is the new code.

      PHP Code:
      <?
      session_start
      ();
      $session=session_id( );

      include (
      "secure/config2.php");

      $username=$_POST['to'];
      $subject=$_POST['subject'];
      $message=$_POST['message'];

      $username_check "SELECT * FROM chibifriends WHERE preuserName = '$username'";
      $check_result mysql_query($username_check,$connection);
      $username_data mysql_fetch_array($check_result);
      $check_rows mysql_num_rows($check_result);

      if (
      $check_rows 1) {
      echo 
      "Sorry, there is no user by the name of $username";
      }
      else {
      function 
      cleanup($subject) {
          
      $words "form,noscript,meta,iframe,script,layer,style,filter,body,background,cursor,scrollbar,include,****,***,neopets,dick,***,homo,*****,lesbian,dike,pussy,****,sex,blowjob,suck,cwhome,cum,ecritters,aftermathzone,hump,******,gook,spic,*****";
          
      $wordarray explode(","$words);
          foreach (
      $wordarray as $word) {
              
      $subject eregi_replace($word" "$subject);
          }
          return 
      $subject;
      }


      function 
      cleanup1($message) {
          
      $words "form,noscript,meta,iframe,script,layer,style,filter,body,background,cursor,scrollbar,include,****,***,neopets,dick,***,homo,*****,lesbian,dike,pussy,****,sex,blowjob,suck,cwhome,cum,ecritters,aftermathzone,hump,******,gook,spic,*****";
          
      $wordarray explode(","$words);
          foreach (
      $wordarray as $word) {
              
      $message eregi_replace($word" "$message);
          }
          return 
      $message;
      }

      $subject =cleanup($subject);
      $message =cleanup1($message);

      $toID $username_data[preuserID];

      $send 'INSERT into starmail values (NULL, "'.$toID.'", "'.$preuserID.'", "'.$subject.'", "'.$message.'", "'.unread.'");'
      $result_send mysql_query($send) or die("Error");
      echo 
      "Your message has been sent!";
      }
      ?>
      Thanks!
      Last edited by chizu; Aug 2, 2005, 10:47 PM.

      Comment


      • #4
        Hi chizu,

        can i know what is preuserID in $toID = $username_data[preuserID]??

        is it $preuserID=$_POST['preuserID'];

        then u need the put the statement:
        $toID = $username_data[preuserID]
        as $toID = $username_data[$preuserID];
        or
        $toID = mysql_fetch_array($preuserID);

        and u did not declare $preuserID=$_POST['preuserID']; in ur second post(remember to put that in...)

        Comment


        • #5
          preuserID has already been set in my config file. The toID variable is right. Thanks though. This script is really confusing me now. It should be so simple! I still can't figure it out!

          Comment

          Working...
          X