Jump to content

aebstract

Members
  • Posts

    1,105
  • Joined

  • Last visited

Posts posted by aebstract

  1. when you echo variables, remember theres two ways to echo.. as far as I know

    echo '';
    and
    echo "";

    the difference in the quotation marks.
    Single quotes will enter a whatever is in them exactly how it is seen, leaving your variable as $id and whatnot. If you use double quotes, it puts it in as the actual id and not $id.


    Edit: to clarify sorry,

    Single Quotes: Treated Literally
    Double Quotes: Extrapolated - a variable's name is replaced with its value.
  2. [code]
    result = mysql_query("SELECT * FROM friendslist WHERE userid = '$id'")
    while($r=mysql_fetch_array($result))  {  
    $friendsid=$r["friendsid"];  


    $result2 = mysql_query("SELECT * FROM accounts WHERE id = '$friendsid' ORDER BY username DESC")
    while($r2=mysql_fetch_array($result2))  {  
    $username2=$r2["username"];  

    $content .= "

    $username2<br />

    ";
    }
    }
    [/code]

    It's suppose to find out who is in your friendslist (a table with three columns flid (auto increment), userid (your personal id), and friendsid (their id). Should find the rows that match up with your id, then find the usernames of their id through the accounts table. If theres an easier way to do this that im missing let me know, but why the unexpected '='?

    Parse error: syntax error, unexpected '=' in /home/.jaguar/onelastromance/carbenco.com/beta/pmbox.php on line 319

    319 is while($r=mysql_fetch_array($result)) {
  3. I'm trying to get it to delete every row that has a certain number in a certain column, so I need to run a while for that number in that column, but there could be any number of them so I'm not sure exactly how to do it. Any help in a direction to go with this would be great.



    edit: solved with:


    [code]
    } elseif ($action == deleteall){
    $result = mysql_query("SELECT * FROM pmbox WHERE recieverid = '$id'");    
    while($r=mysql_fetch_array($result))  {  
    mysql_query("DELETE FROM pmbox WHERE recieverid = '$id'");             
    }
    }
    [/code]
  4. Hello,
    You're just wanting a simple mail sent to you whenever someone signs up? Try this:


    Right after this part:
    $last = mysql_insert_id();
    $_SESSION[AgentID] = $last;



    Enter the following, but be sure to change around the information that you set variable to, set it to whatever you wish it to send to you. This variable will be the body of your email.

    $variable = "$_POST[FirstName] $_POST[LastName] has just registered";

    mail ($email, 'New User', $variable, 'From: _____@____.com');



    Also change $email to the variable or exact address you want this mail to be sent to. The from is straight forward, it can be a variable or exact wording also. Any questions, just ask. Hope this helps.
  5. Okay so the code section that is having the problem is here:

    [code]
    if($action == compose){
    $content .= '<div id="pmbox">';


    if (isset ($_POST['submit'])) {
    $problem = FALSE;  
    $_POST['reciever'] = strip_tags($_POST['reciever']);
    $_POST['subject'] = strip_tags($_POST['subject']);
    $_POST['message'] = strip_tags($_POST['message']);  

    if (empty ($_POST['reciever'])) {
    $problem = TRUE; $content .= 'Reciever is a required field<br />';
    }  

    if (empty ($_POST['subject'])) {
    $problem = TRUE;
    $content .= 'Subject is a required field<br />';
    }  

    if (empty ($_POST['message'])) {
    $problem = TRUE;
    $content .= 'Message is a required field<br />';
    }  

    $query = mysql_query("SELECT id FROM accounts WHERE username = '".$_POST['reciever']."'");
    $query = mysql_fetch_array($query);         
    if ($query){     
    $recieverid = $query['id'];                  

    } else {         

    $problem = TRUE;         
    $content .= 'Invalid Username<br />';

    }  
    if (!$problem) {  
    $reciever = $_POST['reciever'];
    $subject = $_POST['subject'];
    $message = $_POST['message'];
    $datesent = date('F j, Y - g:i a');  

    $insert = mysql_query("INSERT INTO pmbox (recieverid,sender,senderid,message,subject,datesent,read)".
    "VALUES ('$recieverid', '$username', '$id', '$message', '$subject', '$datesent', '0')");


    header ("Location: index.php?menu=pmbox&action=pmsent");  
    } else {
    $content .= '<br />';
    }
    }    
    $content .= '
      
    <form action="index.php?menu=pmbox&action=compose" method="post">  
    Reciever: <br />
    <input type="text" maxlength="14" class="textfield" name="reciever" size="20" value="' . $_POST['reciever'] . '" />
    <br />
    Subject: <br />
    <input type="text" class="textfield" name="subject" maxlength="15" size="20" value="' . $_POST['subject'] . '" />
    <br />
    Message: <br /><textarea class="textfield" name="message" rows="10" cols="40" value="' . $_POST['message'] . '"></textarea>
    <br /><br />  
    <input type="submit" name="submit" value="Send PM" class="textfield" />
    </form>  

    ';



    $content .= '</div>';
    [/code]


    Like I said, I know the url/variable stuff is working, cause it works on the other parts that are just like this. The problem is the information actually getting placed in to the database. If theres some kind of code I can put in to test for the error, please shoot it at me and explain and I will give it a shot, if you can see the problem.. that helps too! :P Thanks!
  6. im sorry if I seemed rude, I didn't mean to, but session_start [i]was[/i] right at the beginning and the code he kept telling me to put in didn't make sense of where or how to use it. Thanks for explaining it and whatnot, the error that it gave me was:

    SELECT * FROM pmbox WHERE recieverid = '1' && = '1'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= '1'' at line 1

    I figured out the problem since && ='1' the $pmid was showing nothing, needed to take the $ off. I am sorry and thank you a lot for the help.
  7. session_start() line 2 of the very first code i posted, please look before telling me you can not see it.

    you want the coding or the little error message that your code produces? cause I put your code in and it didnt work the way you wanted it to i guess, since I couldn't figure out how or w/e. If you want the code that is being run, I have already told you this several times:

    [code]} elseif ($action == read){
    $content .= '<div id="pmbox">



    <table><tr id="trone"><td id="tdone">From:</td><td id="tdtwo">Subject:</td><td id="tdthree">Date:</td></tr>

    ';


    $result = mysql_query("SELECT * FROM pmbox WHERE recieverid = '$id' && $pmid = '$mail'");    

    while($r=mysql_fetch_array($result)) {  
    $sender=$r["sender"];  
    $senderid=$r["senderid"];  
    $message=$r["message"];  
    $subject=$r["subject"];
    $datesent=$r["datesent"];
    $pmid=$r["pmid"];  

    $content .= "

    <tr id=trtwo><td>$message</td></tr>


    ";
    }




    $content .= '</table></div>';























    } elseif ($act........[/code]
  8. Error: Query was empty with query

    $id comes from my connect.php file,

    [code]
    <?php
    mysql_connect("mysql.carbenco.com","onelastromance","147258");
    mysql_select_db("onelastromance");

    $id = $_SESSION["id"];
    $result = mysql_query("SELECT * FROM accounts WHERE id='$id'");

    while($r=mysql_fetch_array($result))
    {

    $id=$r["id"];
    $password=$r["password"];
    $email=$r["email"];
    $emailshow=$r["emailshow"];
    $firstname=$r["firstname"];
    $lastname=$r["lastname"];
    $registerdate=$r["registerdate"];
    $username=$r["username"];
    $memlvl=$r["memlvl"];

    }
    ?>[/code]
    which is included in the index.php file,
  9. [code]
    $result = mysql_query("SELECT * FROM pmbox WHERE recieverid = '$id' && $pmid = '$mail'");    
    while($r=mysql_fetch_array($result)) {  
    $sender=$r["sender"];  
    $senderid=$r["senderid"];  
    $message=$r["message"];  
    $subject=$r["subject"];
    $datesent=$r["datesent"];
    $pmid=$r["pmid"];  
    $content .= "

    <tr id=trtwo><td>$message</td></tr>


    ";
    }
    [/code]

    $sender=$r["sender"]; is 127
  10. Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/.jaguar/onelastromance/carbenco.com/beta/pmbox.php on line 127... grrrr, these stupid errors are making me mad cause I don't know what the hell is wrong :(


    Anyway, heres the code:


    [code]
    <?php  
    session_start();
    header("Cache-control: private");  
    if(!isset($_SESSION["id"]))  
    {  
    header("Location: index.php?menu=mustlogin");  
    }

















    if($action == compose){
    $content .= '<div id="pmbox">';


    if (isset ($_POST['submit'])) {
    $problem = FALSE;  
    $_POST['reciever'] = strip_tags($_POST['reciever']);
    $_POST['subject'] = strip_tags($_POST['subject']);
    $_POST['message'] = strip_tags($_POST['message']);  

    if (empty ($_POST['reciever'])) {
    $problem = TRUE; $content .= 'Reciever is a required field<br />';
    }  

    if (empty ($_POST['subject'])) {
    $problem = TRUE;
    $content .= 'Subject is a required field<br />';
    }  

    if (empty ($_POST['message'])) {
    $problem = TRUE;
    $content .= 'Message is a required field<br />';
    }  

    $query = mysql_query("SELECT id FROM accounts WHERE username = '".$_POST['reciever']."'");
    $query = mysql_fetch_array($query);         
    if ($query){     
    $recieverid = $query['id'];                  

    } else {         

    $problem = TRUE;         
    $content .= 'Invalid Username<br />';

    }  
    if (!$problem) {  
    $reciever = $_POST['reciever'];
    $subject = $_POST['subject'];
    $message = $_POST['message'];
    $datesent = date('F j, Y - g:i a');  

    $insert = mysql_query("INSERT INTO pmbox (recieverid,sender,senderid,message,subject,datesent,read)".
    "VALUES ('$recieverid', '$username', '$id', '$message', '$subject', '$datesent', '0')");


    header ("Location: index.php?menu=pmbox&action=pmsent");  
    } else {
    $content .= '<br />';
    }
    }    
    $content .= '
      
    <form action="index.php?menu=pmbox&action=compose" method="post">  
    Reciever: <br />
    <input type="text" maxlength="14" class="textfield" name="reciever" size="20" value="' . $_POST['reciever'] . '" />
    <br />
    Subject: <br />
    <input type="text" class="textfield" name="subject" maxlength="15" size="20" value="' . $_POST['subject'] . '" />
    <br />
    Message: <br /><textarea class="textfield" name="message" rows="10" cols="40" value="' . $_POST['message'] . '"></textarea>
    <br /><br />  
    <input type="submit" name="submit" value="Send PM" class="textfield" />
    </form>  

    ';



    $content .= '</div>';























    } elseif ($action == read){
    $content .= '<div id="pmbox">



    <table><tr id="trone"><td id="tdone">From:</td><td id="tdtwo">Subject:</td><td id="tdthree">Date:</td></tr>

    ';

    $result = mysql_query("SELECT * FROM pmbox WHERE recieverid = '$id' && $pmid = '$mail'");    
    while($r=mysql_fetch_array($result)) {  
    $sender=$r["sender"];  
    $senderid=$r["senderid"];  
    $message=$r["message"];  
    $subject=$r["subject"];
    $datesent=$r["datesent"];
    $pmid=$r["pmid"];  
    $content .= "

    <tr id=trtwo><td>$message</td></tr>


    ";
    }




    $content .= '</table></div>';























    } elseif ($action == sentmail){

    $content .= '
    <div id="pmbox">
    sent mail
    </div>
    ';

























    } else {
    $content .= '<div id="pmbox">
    <table><tr id="trone"><td id="tdone">From:</td><td id="tdtwo">Subject:</td><td id="tdthree">Date:</td></tr>

    ';

    $result = mysql_query("SELECT * FROM pmbox WHERE recieverid = '$id'");    
    while($r=mysql_fetch_array($result))  {  
    $sender=$r["sender"];  
    $senderid=$r["senderid"];  
    $message=$r["message"];  
    $subject=$r["subject"];
    $datesent=$r["datesent"];
    $pmid=$r["pmid"];  
    $content .= "

    <tr id=trtwo><td id=tdone><a href=index.php?menu=profileview&user=$senderid>$sender</a></td><td id=tdtwo><a href=index.php?menu=pmbox&action=read&mail=$pmid>$subject</a></td><td id=tdthree>$datesent</td></tr>


    ";
    }

    $content .= "</table></div>";
    }



    ?>
    [/code]
  11. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Everything is working fine, except it won't put the information in.[/quote]

    ^^
  12. Hi, I am trying to get my pm send form to insert the data from the form in to the database so that whoever is recieving the pm can view it. Everything is working fine, except it won't put the information in. Can anyone help me with this? The problem is in the if (action == compose) { section of the script, and here the script is:


    [code]<?php  
    session_start();
    header("Cache-control: private");  
    if(!isset($_SESSION["id"]))  
    {  
    header("Location: index.php?menu=mustlogin");  
    }



    if($action == compose){
    $content .= '<div id="pmbox">';


    if (isset ($_POST['submit'])) {
    $problem = FALSE;  
    $_POST['reciever'] = strip_tags($_POST['reciever']);
    $_POST['subject'] = strip_tags($_POST['subject']);
    $_POST['message'] = strip_tags($_POST['message']);  

    if (empty ($_POST['reciever'])) {
    $problem = TRUE; $content .= 'Reciever is a required field<br />';
    }  

    if (empty ($_POST['subject'])) {
    $problem = TRUE;
    $content .= 'Subject is a required field<br />';
    }  

    if (empty ($_POST['message'])) {
    $problem = TRUE;
    $content .= 'Message is a required field<br />';
    }  

    $query = mysql_query("SELECT id FROM accounts WHERE username = '".$_POST['reciever']."'");
    $query = mysql_fetch_array($query);         
    if ($query){     
    $recieverid = $query['id'];                  

    } else {         

    $problem = TRUE;         
    $content .= 'Invalid Username<br />';

    }  
    if (!$problem) {  
    $reciever = $_POST['reciever'];
    $subject = $_POST['subject'];
    $message = $_POST['message'];
    $datesent = date('F j, Y - g:i a');  
    $result = MYSQL_QUERY("INSERT INTO pmbox (recieverid,sender,senderid,message,subject,datesent,read)". "VALUES ('$recieverid', '$username', '$id', '$message', '$subject', '$datesent', '0')");  
    include "connect.php";    
    header ("Location: index.php?menu=pmbox&action=pmsent");  
    } else {
    $content .= '<br />';
    }
    }    
    $content .= '
      
    <form action="index.php?menu=pmbox&action=compose" method="post">  
    Reciever: <br />
    <input type="text" maxlength="14" class="textfield" name="reciever" size="20" value="' . $_POST['reciever'] . '" />
    <br />
    Subject: <br />
    <input type="text" class="textfield" name="subject" maxlength="15" size="20" value="' . $_POST['subject'] . '" />
    <br />
    Message: <br /><textarea class="textfield" name="message" rows="10" cols="40" value="' . $_POST['message'] . '"></textarea>
    <br /><br />  
    <input type="submit" name="submit" value="Send PM" class="textfield" />
    </form>  

    ';



    $content .= '</div>';
    } elseif ($action == sentmail){

    $content .= '
    <div id="pmbox">
    sent mail
    </div>
    ';




    } else {
    $content .= '<div id="pmbox">
    <table><tr id="trone"><td id="tdone">From:</td><td id="tdtwo">Subject:</td><td id="tdthree">Date:</td></tr>

    ';

    $result = mysql_query("SELECT * FROM pmbox WHERE recieverid = '$id'");    
    while($r=mysql_fetch_array($result))  {  
    $sender=$r["sender"];  
    $senderid=$r["senderid"];  
    $message=$r["message"];  
    $subject=$r["subject"];
    $datesent=$r["datesent"];
    $pmid=$r["pmid"];  
    $content .= "

    <tr id=trtwo><td id=tdone><a href=index.php?menu=profileview&user=$senderid>$sender</a></td><td id=tdtwo><a href=index.php?menu=pmbox&action=read&read=$pmid>$subject</a></td><td id=tdthree>$datesent</td></tr>


    ";
    }

    $content .= "</table></div>";
    }



    ?>[/code]


    thanks
  13. [a href=\"http://www.carbenco.com/beta/\" target=\"_blank\"]http://www.carbenco.com/beta/[/a]
    I don't want to use tables, and here is the css for what you see:
    [code]
    #logintemp1 {
            position: absolute; top: 80px; right:7px;
            background-color: #CCCCCC;
            width: 195px;
                            border-width: 1px;
                            border-color: #666666;
                            border-style:solid;
                padding: 5px;
    }
    [/code]
  14. I don't know what you want on your second question, but for your first one try this out:

    [code]
    if (!isset($mo)){
    $mo = "date('M')";
    }
    [/code]

    this way if you set it by the url it will not set it to current day, but if it isn't set by url it will set it to the auto.
  15. I want a single div to be able to have a 1px border and a 2-3px border on the inside of the 1px. then have a bg color and padding of about 5px. A great example of what I want can be found at: www.gmail.com the login box how it has a thin border, then white then the bg color. I got all of it on my site except for the white part. Thanks in advance.
  16. I have a contact form that when fully filled out returns an "Error:" message at top of my forum, though has no errors in it. I have it set up so that if there is an error, it says "Error:" then it will list the various errors in the form. When the entire form is filled out correctly, it says error without any errors listed! Here is my script, and a link to the form:

    [a href=\"http://carbenco.com/index.php?menu=contact\" target=\"_blank\"]http://carbenco.com/index.php?menu=contact[/a]


    [code]
    <?php
    header("Cache-control: private");

    if(isset($sent)) {
    $content2 .= 'Your message has been sent.';
    }

    if(!isset($sent)) {



    if (isset ($_POST['submit'])) {
    $problem = FALSE;

    if ($problem = TRUE) {
    $content2 .= 'Errors:<br />';
    }

    $_POST['firstname'] = strip_tags($_POST['firstname']);
    $_POST['lastname'] = strip_tags($_POST['lastname']);

    if (empty ($_POST['firstname'])) {
    $problem = TRUE;
    $content2 .= 'Your first name is required<br />';
    }

    if (empty ($_POST['lastname'])) {
    $problem = TRUE;
    $content2 .= 'Your last name is required.<br />';
    }

    if (empty ($_POST['email1'])) {
    $problem = TRUE;
    $content2 .= 'Email Address is a required field.<br />';
    }elseif (!preg_match("/.*@.*..*/", $_POST['email1']) OR preg_match("/(<|>)/", $_POST['email1']))
    {
    $problem = TRUE;
    $content2 .= 'The email address you chose was incorrect.<br />';
    }

    if (empty ($_POST['subject'])) {
    $problem = TRUE;
    $content2 .= 'You are required to enter a subject.<br />';
    }

    if (empty ($_POST['body'])) {
    $problem = TRUE;
    $content2 .= 'You are required to submit a message.<br />';
    }


    if (!$problem) {

    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];
    $email = $_POST['email1'];
    $body = $_POST['body'];
    $subject = $_POST['subject'];


    $sendmail = "$firstname $lastname
    $email

    $body";

    $sendmail2 = "Hi $firstname $lastname,
    This is an automatic message sent to confirm that your following message has been sent in to carbenco:

    $body";

    mail ('aebstract@gmail.com', 'Contact: Carbenco', $sendmail, 'From: aebstract@gmail.com');
    mail ('$email', 'Contact: Carbenco', $sendmail2, 'From: $email');


    header ("Location: index.php?menu=contact&sent");


    } else {
    }
    }








    $content2 .= '<form action="index.php?menu=contact" method="post">


    Contact Form<br /><br />


    First Name: <br /><input type="text" class="textfield" name="firstname" maxlength="20" size="20" value="' . $_POST['firstname'] . '" /><br />
    Last Name: <br /><input type="text" class="textfield" name="lastname" maxlength="20" size="20" value="' . $_POST['lastname'] . '" /><br />
    Email Address: <br /><input type="text" maxlength="32" class="textfield" name="email1" size="20" value="' . $_POST['email1'] . '" /><br /><br />

    Subject: <br /><input type="text" class="textfield" name="subject" maxlength="20" size="20" value="' . $_POST['subject'] . '" /><br />
    Message: <br /><textarea name="body" rows="5" cols="40" class="textfieldmsg"></textarea><br /><br />

    <input type="submit" name="submit" value="Send" class="textfield" /></form>';

    }

    ?>

    [/code]


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