PHP MysQL db Problem -

Discussion in 'PHP' started by Sneakyfeet, Feb 25, 2008.

  1. #1
    I have some Php pages with built in mailing list - i created a mysql db but I can never get it to work right. I know the problem lies in my code.
    If some one could help me get this to work - I would be willing to pay. (but I am on a budget :))
     
    Sneakyfeet, Feb 25, 2008 IP
  2. jeff_oneil

    jeff_oneil Peon

    Messages:
    29
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    show us some code and tell us the error you get...
     
    jeff_oneil, Feb 25, 2008 IP
    Sneakyfeet likes this.
  3. PHPGator

    PHPGator Banned

    Messages:
    4,437
    Likes Received:
    133
    Best Answers:
    0
    Trophy Points:
    260
    #3
    Sneakyfeet, feel free to send me a PM. I will need the code though and a link showing the error you are recieving.
     
    PHPGator, Feb 25, 2008 IP
    Sneakyfeet likes this.
  4. Sneakyfeet

    Sneakyfeet Well-Known Member

    Messages:
    683
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    130
    #4
    Thanks for the help - I just put everything toghether - I will pm you guys for your e-mail address so I can send the info over.
    Thanks
    Dan
     
    Sneakyfeet, Feb 25, 2008 IP
  5. Dwaighty

    Dwaighty Peon

    Messages:
    358
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You could try and post the code here and spare a few bucks. There are many people around willing to help just for the sake of building a good rep for themselves or just because they want to give something back to this community. Making a mailing list isn't difficult, maybe you're missing the obvious.
     
    Dwaighty, Feb 25, 2008 IP
    Sneakyfeet likes this.
  6. Sneakyfeet

    Sneakyfeet Well-Known Member

    Messages:
    683
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    130
    #6
    Dwaighty:
    Thanks for the advice. DP was having some problems pm an hour or so ago so here is what I've got:
    The website is http://www.PeeoverTheHill.com and here is the code:
    This is my config.inc.php:
    <?
    /*
    ----------------------------------------
    Simple Mailing List - Configuration file
    ----------------------------------------
    The variables below are used for
    configuring Simple Mailing List.
    ----------------------------------------
    */


    // ----------------------------------------------------
    // 1. Database configuration variables (All required)
    // ----------------------------------------------------

    // Your database server (usually localhost)
    $config['db_server'] = "localhost";

    // A user that has access to your database
    $config['db_user'] = "database username here";

    // The password for the user that has access to your database
    $config['db_password'] = "database password here";

    // The name of the database
    $config['db_name'] = "database name here";


    // -----------------------------------------------
    // 2. List configuration variables (All required)
    // -----------------------------------------------

    // The name of your list. This will appear in the confirmation email body and subject line.
    $config['list_name'] = "mailinglist name here";

    // The email address of the list owner. Messages will be sent from this address.
    $config['owner_email'] = "email here";

    // 0 or 1. Make this a 1 if you would like to receive an email every time someone confirms their subscription.
    $config['notify_on_confirm'] = 1;

    // 0 or 1. Make this a 1 if you would like to receive an email every time someone unsubscribes.
    $config['notify_on_unsub'] = 1;

    // 0 or 1. Make this a 1 if you would like the user to receive an email after they confirm their subscription.
    $config['notify_user_on_confirm'] = 1;

    // 0 or 1. Make this a 1 if you would like the user to receive an email after they unsubscribe.
    $config['notify_user_on_unsub'] = 1;

    // URL to the page that contains your subscribe/unsubscribe form.
    $config['unsub_url'] = "http://www.youcantseeme.co.uk/";

    // Default message format (0=text, 1=html).
    $config['default_format'] = 0;


    // --------------------------------
    // 3. Queue configuration variables
    // --------------------------------

    // Using a queue sends your message to each member individually. Not using the queue builds a list of addresses
    // and sends your message to the list in the Bcc (blind carbon copy) field.
    $config['use_queue'] = false;

    // The number of email messages to send (per pass) when using the queue feature.
    $config['queue_size'] = 15;


    // -------------------------------
    // 4. Bounce maintenance variables
    // -------------------------------

    // 0 or 1. Set to zero to disable bounce checking, 1 to enable.
    $config['check_bounces'] = 0;

    // Email address (account) of mailbox to check for bounces
    $config['bounce_mailbox'] = "";

    // Password for above mailbox (account)
    $config['bounce_password'] = "";


    // -------------------------
    // 5. Remote relay variables
    // -------------------------

    // 0 or 1. Set to zero to disable remote relay, 1 to enable.
    $config['allow_relay'] = 0;

    // An array of email addresses from which SML will relay messages. Leave empty to accept from any address.
    $config['allow_relay_from'] = array();

    // Email address (account) of mailbox to check for messages to relay
    $config['relay_mailbox'] = "";

    // Password for above mailbox (account)
    $config['relay_password'] = "";


    // -------------------------------
    // 6. SMTP configuration variables
    // -------------------------------

    // 0 or 1. Whether to use SMTP(1) or sendmail(0). The default is sendmail(0).
    $config['use_SMTP'] = 0;

    // The SMTP server. For secure connections use the format ssl://smtp.gmail.com
    $config['smtp_server'] = "";

    // The domain you're sending from. Localhost is usually fine
    $config['smtp_domain'] = "";

    // The email address associated with the SMTP account
    $config['smtp_from_address'] = "";

    // The SMTP username. Commonly the email address
    $config['smtp_username'] = "";

    // The SMTP password
    $config['smtp_password'] = "";

    // The port to connect to your SMTP server on. Usually 25, 465, or 587
    $config['smtp_port'] = "";

    /*
    ----------------------------------------
    That's it! Anything following this code
    should not be changed unless you are
    comfortable modifying PHP.
    ----------------------------------------
    */

    $connection = mysql_connect($config['db_server'], $config['db_user'], $config['db_password']) or die("Could not connect : " . mysql_error());
    mysql_select_db($config['db_name']) or die("Could not select database");

    require_once("lang.inc.php");
    define('SML_EOL', "\r\n");

    function insert_message($subject,$message,$curr_timestamp,$queue_timestamp,$sent_count,$texthtml)
    {
    if (((!empty($_GET) Or !empty($_POST)) And get_magic_quotes_gpc()) Or get_magic_quotes_runtime()) // Quotes in the message are automatically being escaped
    {
    $subject = strip_tags($subject);
    }
    else
    {
    $message = addslashes($message);
    $subject = strip_tags(addslashes($subject));
    }
    $query = "INSERT INTO mailinglist_messages (subject,message,created,queued,count,format) VALUES ('$subject','$message','$curr_timestamp','$queue_timestamp','$sent_count','$texthtml')";
    $result = mysql_query($query) or die("Query failed : " . mysql_error());
    return mysql_insert_id();
    }

    function get_confirmed_members()
    {
    $address_query = "SELECT address FROM mailinglist_subscribers WHERE confirmed = '1'";
    $address_result = mysql_query($address_query) or die("Query failed[gfm] : " . mysql_error());
    return $address_result;
    }

    function insert_recipients_into_queue($message_id,$address_row,$queue_timestamp)
    {
    $queue_insert_query = "INSERT INTO mailinglist_queue (message_id,address,send_after) VALUES ('$message_id','$address_row','$queue_timestamp')";
    $queue_insert_result = mysql_query($queue_insert_query) or die("Query failed[iriq] : " . mysql_error());
    return $queue_insert_result;
    }
    ?>

    ...................
    ...................
    ...................

    I substituted my dbname /my username/ pw and still get the error.
    just go to www.peeoverthehill.com and type in an e-maill address and you'll get:

    Parse error: syntax error, unexpected T_STRING, expecting ']' in /home/content/w/1/2/w12325475/html/PeeOverTheHill/mailinglist/admin/config.inc.php on line 34


    Thanks for any help,
    Dan
     
    Sneakyfeet, Feb 25, 2008 IP
  7. Dwaighty

    Dwaighty Peon

    Messages:
    358
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #7
    This config file looks ok, at line 34 it doesn't have any errors: $config['list_name'] = "mailinglist name here";

    I believe this is the original config file, not the one you already modified. Check on the modified one if you have something like:
    $config['list_name' = "mailinglist name here";

    You might have accidentally deleted the ']'.
     
    Dwaighty, Feb 26, 2008 IP
  8. Sneakyfeet

    Sneakyfeet Well-Known Member

    Messages:
    683
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    130
    #8
    Thanks for the help you guys - -
    You were right this was the original config - I'm going to pull the modified congig file and check it out -
    You know what they say- - - -
    The devil is in the details!
    thanks,
    Dan
     
    Sneakyfeet, Feb 26, 2008 IP