Jump to content

mandukar

Members
  • Posts

    58
  • Joined

  • Last visited

    Never

Posts posted by mandukar

  1. bumping up as i still need help,  I've fixed the sql errors but the form is still not sending to the groups..

     

    here is the updated code

     

    PHP

    <?
    function containsTLD($string) {
      preg_match(
        "/(AC($|\/)|\.AD($|\/)|\.AE($|\/)|\.AERO($|\/)|\.AF($|\/)|\.AG($|\/)|\.AI($|\/)|\.AL($|\/)|\.AM($|\/)|\.AN($|\/)|\.AO($|\/)|\.AQ($|\/)|\.AR($|\/)|\.ARPA($|\/)|\.AS($|\/)|\.ASIA($|\/)|\.AT($|\/)|\.AU($|\/)|\.AW($|\/)|\.AX($|\/)|\.AZ($|\/)|\.BA($|\/)|\.BB($|\/)|\.BD($|\/)|\.BE($|\/)|\.BF($|\/)|\.BG($|\/)|\.BH($|\/)|\.BI($|\/)|\.BIZ($|\/)|\.BJ($|\/)|\.BM($|\/)|\.BN($|\/)|\.BO($|\/)|\.BR($|\/)|\.BS($|\/)|\.BT($|\/)|\.BV($|\/)|\.BW($|\/)|\.BY($|\/)|\.BZ($|\/)|\.CA($|\/)|\.CAT($|\/)|\.CC($|\/)|\.CD($|\/)|\.CF($|\/)|\.CG($|\/)|\.CH($|\/)|\.CI($|\/)|\.CK($|\/)|\.CL($|\/)|\.CM($|\/)|\.CN($|\/)|\.CO($|\/)|\.COM($|\/)|\.COOP($|\/)|\.CR($|\/)|\.CU($|\/)|\.CV($|\/)|\.CX($|\/)|\.CY($|\/)|\.CZ($|\/)|\.DE($|\/)|\.DJ($|\/)|\.DK($|\/)|\.DM($|\/)|\.DO($|\/)|\.DZ($|\/)|\.EC($|\/)|\.EDU($|\/)|\.EE($|\/)|\.EG($|\/)|\.ER($|\/)|\.ES($|\/)|\.ET($|\/)|\.EU($|\/)|\.FI($|\/)|\.FJ($|\/)|\.FK($|\/)|\.FM($|\/)|\.FO($|\/)|\.FR($|\/)|\.GA($|\/)|\.GB($|\/)|\.GD($|\/)|\.GE($|\/)|\.GF($|\/)|\.GG($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|\.ZM($|\/)|\.ZW)/i",
        $string,
        $M);
      $has_tld = (count($M) > 0) ? true : false;
      return $has_tld;
    }
    
    function cleaner($url) {
      $U = explode(' ',$url);
    
      $W =array();
      foreach ($U as $k => $u) {
        if (stristr($u,".")) { //only preg_match if there is a dot    
          if (containsTLD($u) === true) {
          unset($U[$k]);
          return cleaner( implode(' ',$U));
        }      
        }
      }
    return str_replace(array('[img=',']','<br /><br />'), array('','','/n'), implode(' ',$U));
    }
    
    function fbtext($string){
    $start="[b]";
    $end="[/b]";
    cleaner($string);
    $string = " ".$string;
    $ini = strpos($string,$start);
    if ($ini == 0) return "";
    $ini += strlen($start);
    $len = strpos($string,$end,$ini) - $ini;
    return substr($string,$ini,$len);
    }
    
    
    
    
    if(!$_POST['page']){
    
    ########## Database Info ##########
    $db_server = 'localhost';
    $db_name = 'test';
    $db_user = 'test';
    $db_passwd = 'test';
    $link = mysql_connect($db_server, $db_name, $db_passwd);
    if (!$link) {
    	die('Could not connect: ' . mysql_error());
    }
    mysql_select_db($db_name,$link);
    
    
    $topic_id = $_GET['topic_id'];
    $date = $_GET['date'];
    $type = $_GET['type'];
    
        $sql = mysql_query("SELECT DATE_FORMAT(smf_calendar.startDate, '%W <br>%D %M %y') AS startDate, smf_calendar.ID_TOPIC, smf_topics.ID_FIRST_MSG, smf_messages.subject, CURDATE() FROM smf_calendar INNER JOIN smf_topics
    ON smf_calendar.ID_TOPIC=smf_topics.ID_TOPIC INNER JOIN smf_messages
    ON smf_topics.ID_FIRST_MSG=smf_messages.ID_MSG WHERE smf_calendar.startDate >= CURDATE() AND smf_calendar.startDate <= DATE_ADD(curdate(), INTERVAL 1 MONTH) ORDER BY smf_calendar.startDate ASC");
    // if form is submitted post to the group
    $group_grp = $_POST['group'];
    
    $to_grp      = 'test@groups.facebook.com';
    $subject_grp = '';
    $message_grp = $group_grp;
    $headers_grp = 'From: 	test@facebook.com' . "\r\n" .
        'Reply-To: 		test@facebook.com' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();
    
    mail($to_grp, $subject_grp, $message_grp, $headers_grp);	
    
    	// if form is submitted post to the page
    $page_pg = $_POST['page'];
    
    $to_pg      = 'test@facebook.com';
    $subject_pg = $page_pg;
    $message_pg = '';
    $headers_pg = 'From: test@facebook.com' . "\r\n" .
        'Reply-To: 	test@facebook.com' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();
    
    mail($to_pg, $subject_pg, $message_pg, $headers_pg);	
    
    // if form is submitted post to the Trans Fusion facebook profile
    $page_prf = $_POST['page'];
    
    // only works on subject so formatted the same as a page
    $to_prf  = 'test@hotmail.co.uk';
    $subject_prf = $page_prf;
    $message_prf = '';
    $headers_prf = 'From: 	test@facebook.com' . "\r\n" .
        'Reply-To: 	test@facebook.com' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();
    
    mail($to_prf, $subject_prf, $message_prf, $headers_prf);	
    
    }
    ?>

     

    Viewing part.

     

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    <? if(!$_POST['group']){ ?>
    <form action="fbannounce.php" method="post">
    <strong>Facebook Group Post:</strong>
    <br />
    <br />
    <textarea name="group" cols="60" rows="15">
    <?
    echo $type." - ". date("D jS M", strtotime($date))." - ".$row['subject'];
    echo "
    ";
    echo str_replace("<br />","\n",fbtext($row['body']));
    echo "
    ";
    	while($row = mysql_fetch_array($sql)
    
    	)
    ?>
    </textarea>
    <br />
    <textarea name="page" cols="60" rows="15">
    <?
    echo $type." - ". date("D jS M", strtotime($date))." - ".$row['subject'];
    echo "
    ";
    echo "http://test.org/smf/index.php?topic=".$topic_id.".0";
    ?>
    </textarea>
    
    <input type="submit" name="post" value="submit" />
    </form>
    <? } else { ?>
    
    <strong>Status Updates updated check below for output - profile page might come in 10 minutes late:</strong>
    <br />
    <br />
    <strong>Group:</strong><a href="http://www.facebook.com/groups/test/" target="_blank">http://www.facebook.com/groups/test/</a>
    <br />
    <br />
    <br />
    <? } ?>
    </body>
    </html>

  2. and it does excute in the textarea of the form, I got

     

    <textarea name="group" cols="60" rows="15">
    <?
    echo $type." - ". date("D jS M", strtotime($date))." - ".$row['subject'];
    echo "
    ";
    echo str_replace("<br />","\n",fbtext($row['body']));
    echo "
    ";
    	while($row = mysql_fetch_array($sql))
      			{
      			echo $row['startDate']."<a href='http://secktorsrealm.com/smf/index.php?topic=".$row['ID_TOPIC']."'>" . $row['subject'] . "</a>";
    			}
    ?>
    </textarea>

  3. <?
    function containsTLD($string) {
      preg_match(
        "/(AC($|\/)|\.AD($|\/)|\.AE($|\/)|\.AERO($|\/)|\.AF($|\/)|\.AG($|\/)|\.AI($|\/)|\.AL($|\/)|\.AM($|\/)|\.AN($|\/)|\.AO($|\/)|\.AQ($|\/)|\.AR($|\/)|\.ARPA($|\/)|\.AS($|\/)|\.ASIA($|\/)|\.AT($|\/)|\.AU($|\/)|\.AW($|\/)|\.AX($|\/)|\.AZ($|\/)|\.BA($|\/)|\.BB($|\/)|\.BD($|\/)|\.BE($|\/)|\.BF($|\/)|\.BG($|\/)|\.BH($|\/)|\.BI($|\/)|\.BIZ($|\/)|\.BJ($|\/)|\.BM($|\/)|\.BN($|\/)|\.BO($|\/)|\.BR($|\/)|\.BS($|\/)|\.BT($|\/)|\.BV($|\/)|\.BW($|\/)|\.BY($|\/)|\.BZ($|\/)|\.CA($|\/)|\.CAT($|\/)|\.CC($|\/)|\.CD($|\/)|\.CF($|\/)|\.CG($|\/)|\.CH($|\/)|\.CI($|\/)|\.CK($|\/)|\.CL($|\/)|\.CM($|\/)|\.CN($|\/)|\.CO($|\/)|\.COM($|\/)|\.COOP($|\/)|\.CR($|\/)|\.CU($|\/)|\.CV($|\/)|\.CX($|\/)|\.CY($|\/)|\.CZ($|\/)|\.DE($|\/)|\.DJ($|\/)|\.DK($|\/)|\.DM($|\/)|\.DO($|\/)|\.DZ($|\/)|\.EC($|\/)|\.EDU($|\/)|\.EE($|\/)|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|\/)|\.XN--G6W251D($|\/)|\.XN--HGBK6AJ7F53BBA($|\/)|\.XN--HLCJ6AYA9ESC7A($|\/)|\.XN--JXALPDLP($|\/)|\.XN--KGBECHTV($|\/)|\.XN--ZCKZAH($|\/)|\.YE($|\/)|\.YT($|\/)|\.YU($|\/)|\.ZA($|\/)|\.ZM($|\/)|\.ZW)/i",
        $string,
        $M);
      $has_tld = (count($M) > 0) ? true : false;
      return $has_tld;
    }
    
    function cleaner($url) {
      $U = explode(' ',$url);
    
      $W =array();
      foreach ($U as $k => $u) {
        if (stristr($u,".")) { //only preg_match if there is a dot    
          if (containsTLD($u) === true) {
          unset($U[$k]);
          return cleaner( implode(' ',$U));
        }      
        }
      }
    return str_replace(array('[img=',']','<br /><br />'), array('','','/n'), implode(' ',$U));
    }
    
    function fbtext($string){
    $start="[b]";
    $end="[/b]";
    cleaner($string);
    $string = " ".$string;
    $ini = strpos($string,$start);
    if ($ini == 0) return "";
    $ini += strlen($start);
    $len = strpos($string,$end,$ini) - $ini;
    return substr($string,$ini,$len);
    }
    
    
    
    
    if(!$_POST['page']){
    
    ########## Database Info ##########
    $db_server = 'localhost';
    $db_name = 'test_trans';
    $db_user = 'test_trans';
    $db_passwd = 'testr';
    $link = mysql_connect($db_server, $db_name, $db_passwd);
    if (!$link) {
    	die('Could not connect: ' . mysql_error());
    }
    mysql_select_db($db_name,$link);
    
    
    $topic_id = $_GET['topic_id'];
    $date = $_GET['date'];
    $type = $_GET['type'];
    
        $sql = mysql_query("SELECT DATE_FORMAT(smf_calendar.startDate, '%W <br>%D %M %y') AS startDate, smf_calendar.ID_TOPIC, smf_topics.ID_FIRST_MSG, smf_messages.subject, CURDATE() FROM smf_calendar INNER JOIN smf_topics
    ON smf_calendar.ID_TOPIC=smf_topics.ID_TOPIC INNER JOIN smf_messages
    ON smf_topics.ID_FIRST_MSG=smf_messages.ID_MSG WHERE smf_calendar.startDate >= CURDATE() AND smf_calendar.startDate <= DATE_ADD(curdate(), INTERVAL 1 MONTH) ORDER BY smf_calendar.startDate ASC");
    // if form is submitted post to the group
    $group_grp = $_POST['group'];
    
    $to_grp      = 'test@groups.facebook.com';
    $subject_grp = '';
    $message_grp = $group_grp;
    $headers_grp = 'From: 	test@hotmail.co.uk' . "\r\n" .
        'Reply-To: 	test@hotmail.co.uk' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();
    
    mail($to_grp, $subject_grp, $message_grp, $headers_grp);	
    
    }
    ?>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    <? if(!$_POST['page']){ ?>
    <form action="fbannounce.php" method="post">
    <strong>Facebook Group Post:</strong>
    <br />
    <br />
    <textarea name="group" cols="60" rows="15">
    <?
    echo $type." - ". date("D jS M", strtotime($date))." - ".$row['subject'];
    echo "
    ";
    echo str_replace("<br />","\n",fbtext($row['body']));
    echo "
    ";
    	while($row = mysql_fetch_array($sql))
      			{
      			echo "<tr height='40'><td width='100'>".$row['startDate']."</td><td><a href='http://test.com/smf/index.php?topic=".$row['ID_TOPIC']."'>" . $row['subject'] . "</a></td></tr>";
    			}
    ?>
    </textarea>
    <br />
    
    
    <input type="submit" name="post" value="submit" />
    </form>
    <? } else { ?>
    
    <strong>Status Updates updated check below for output - profile page might come in 10 minutes late:</strong>
    <br />
    <br />
    <strong>Group:</strong><a href="http://www.facebook.com/groups/test/" target="_blank">http://www.facebook.com/groups/test/</a>
    <br />
    <br />
    <br />
    <strong>Want to send a group marketing message? <a href="fbgroupmarketing.php">Click here</a></strong>
    <? } ?>
    </body>
    </html>
    <? 
    if(!$_POST['page']){
    mysql_close($link);
    }?>

  4. The back code...

     

    <?
    function containsTLD($string) {
      preg_match(
        "/(AC($|\/)|\.AD($|\/)|\.AE($|\/)|\.AERO($|\/)|\.AF($|\/)|\.AG($|\/)|\.AI($|\/)|\.AL($|\/)|\.AM($|\/)|\.AN($|\/)|\.AO($|\/)|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.SD($|\/)|\.SE($|\/)|\.SG($|\/)|\.SH($|\/)|\.SI($|\/)|\.SJ($|\/)|\.SK($|\/)|\.SL($|\/)|\.SM($|\/)|\.SN($|\/)|\.SO($|\/)|\.SR($|\/)|\.ST($|\/)|\.SU($|\/)|\.SV($|\/)|\.SY($|\/)|\.SZ($|\/)|\.TC($|\/)|\.TD($|\/)|\.TEL($|\/)|\.TF($|\/)|\.TG($|\/)|\.TH($|\/)|\.TJ($|\/)|\.TK($|\/)|\.TL($|\/)|\.TM($|\/)|\.TN($|\/)|\.TO($|\/)|\.TP($|\/)|\.TR($|\/)|\.TRAVEL($|\/)|\.TT($|\/)|\.TV($|\/)|\.TW($|\/)|\.TZ($|\/)|\.UA($|\/)|\.UG($|\/)|\.UK($|\/)|\.US($|\/)|\.UY($|\/)|\.UZ($|\/)|\.VA($|\/)|\.VC($|\/)|\.VE($|\/)|\.VG($|\/)|\.VI($|\/)|\.VN($|\/)|\.VU($|\/)|\.WF($|\/)|\.WS($|\/)|\.XN--0ZWM56D($|\/)|\.XN--11B5BS3A9AJ6G($|\/)|\.XN--80AKHBYKNJ4F($|\/)|\.XN--9T4B11YI5A($|\/)|\.XN--DEBA0AD($|\/)|\.XN--G6W251D($|\/)|\.XN--HGBK6AJ7F53BBA($|\/)|\.XN--HLCJ6AYA9ESC7A($|\/)|\.XN--JXALPDLP($|\/)|\.XN--KGBECHTV($|\/)|\.XN--ZCKZAH($|\/)|\.YE($|\/)|\.YT($|\/)|\.YU($|\/)|\.ZA($|\/)|\.ZM($|\/)|\.ZW)/i",
        $string,
        $M);
      $has_tld = (count($M) > 0) ? true : false;
      return $has_tld;
    }
    
    function cleaner($url) {
      $U = explode(' ',$url);
    
      $W =array();
      foreach ($U as $k => $u) {
        if (stristr($u,".")) { //only preg_match if there is a dot    
          if (containsTLD($u) === true) {
          unset($U[$k]);
          return cleaner( implode(' ',$U));
        }      
        }
      }
    return str_replace(array('[img=',']','<br /><br />'), array('','','/n'), implode(' ',$U));
    }
    
    function fbtext($string){
    $start="[b]";
    $end="[/b]";
    cleaner($string);
    $string = " ".$string;
    $ini = strpos($string,$start);
    if ($ini == 0) return "";
    $ini += strlen($start);
    $len = strpos($string,$end,$ini) - $ini;
    return substr($string,$ini,$len);
    }
    
    
    
    
    if(!$_POST['page']){
    
    ########## Database Info ##########
    $db_server = 'localhost';
    $db_name = 'dumb_trans';
    $db_user = 'dumb_trans';
    $db_passwd = 'dumb';
    $link = mysql_connect($db_server, $db_name, $db_passwd);
    if (!$link) {
    	die('Could not connect: ' . mysql_error());
    }
    mysql_select_db($db_name,$link);
    
    
    $topic_id = $_GET['topic_id'];
    $date = $_GET['date'];
    $type = $_GET['type'];
    
        $sql = "SELECT * 
    FROM  `smf_topics` LEFT JOIN `smf_messages` ON `smf_topics`.`id_first_msg` = `smf_messages`.`id_msg` WHERE `smf_topics`.`id_topic`=".$topic_id
    ;	
        
    $result = mysql_query($sql);
    $row = mysql_fetch_array($result);
    echo mysql_errno($link) . ": " . mysql_error($link) . "\n";
    
    }else{
    // if form is submitted post to the group
    $group_grp = $_POST['group'];
    
    $to_grp      = 'gruup@groups.facebook.com';
    $subject_grp = '';
    $message_grp = $group_grp;
    $headers_grp = 'From: 	email@hotmail.co.uk' . "\r\n" .
        'Reply-To: 	email@hotmail.co.uk' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();
    
    mail($to_grp, $subject_grp, $message_grp, $headers_grp);	
    
    
    
    
    
    
    }
    
    
    
    
    ?>
    

    Then the  form part

     

    <!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>Untitled Document</title>
    </head>
    
    <body>
    <? if(!$_POST['page']){ ?>
    <form action="fbannounce.php" method="post">
    <strong>Facebook Group Post:</strong>
    <br />
    <br />
    <textarea name="group" cols="60" rows="15">
    <?
    echo $type." - ". date("D jS M", strtotime($date))." - ".$row['subject'];
    echo "
    ";
    echo str_replace("<br />","\n",fbtext($row['body']));
    echo "
    ";
    echo "http://url.com/smf/index.php?topic=".$topic_id.".0";
    ?>
    </textarea>
    <br />
    <br />
    <strong>Facebook Page Post:</strong>
    <br />
    <br />
    <textarea name="page" cols="60" rows="15">
    <?
    echo $type." - ". date("D jS M", strtotime($date))." - ".$row['subject'];
    echo "
    ";
    echo "http://url.com/smf/index.php?topic=".$topic_id.".0";
    ?>
    </textarea>
    
    <input type="submit" name="post" value="submit" />
    </form>
    <? } else { ?>
    
    <strong>Status Updates updated check below for output - profile page might come in 10 minutes late:</strong>
    <br />
    <br />
    <strong>Group:</strong><a href="http://www.facebook.com/groups/group/" target="_blank">http://www.facebook.com/groups/gruop/</a>
    <br />
    <br />
    <br />
    <strong>Want to send a group marketing message? <a href="fbgroupmarketing.php">Click here</a></strong>
    <? } ?>
    </body>
    </html>
    <? 
    if(!$_POST['page']){
    mysql_close($link);
    }?>

  5. Ahh okay thanks, I did a echo mysql_errno($link) . ": " . mysql_error($link) . "\n"; and I got the following message...

     

    1064: 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 '' at line 2

     

    tad confused does that mean I'm using something that's not compatible?

  6. I'm in the process of writing up a integration tool where basically a staff member with permission clicks a link on the calender and it'll automatically post on various social networking sites such as facebook. I have hit a snag though, I get a mysql error and i'm unsure what is wrong..

     

    The error is.. Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xx/public_html/fbannounce.php on line 63

     

    I am using the 2.0 series of smf..

     

    I have included the php file as an attachment,

     

    please can someone help?

     

    18785_.php

  7. Hey I am trying to make a site where a user puts there post code into a form and then the database looks for there post code and then displays it, if theres more then one address with the post code it allows you to select the right one. however I can't find a uk post code database, I was wondering does anyone know where I can find one for that we can use for free?

     

    Please note that the database needs to have the address, and not a latitude and longitude version.

     

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