MemHT Portal is a Free PHP CMS and Blog
It permit the creation and the management online of websites with few and easy steps.
It's completelly customizable, expandable and suitable for all needs.
Moderators: Moderators
Page 1/2 1 2 >
Forum RSS feedReply
Tell a friend in Articles
AuthorText
Smyrna
Junior Member
Avatar

Posts: 26
Contributes: 0

Gender: _NEUTRAL_
Online: No
Date: 24/04/2007 22:33
Tell a friend in Articles
#post912
hello,

how can I add "Tell a friend" looks like in the news to the articles ?
Delete Edit Quote
 
mem
MemHT's Dad
Admin & Developer

Avatar

Posts: 5118
Contributes: 2461

Gender: _MALE_
Online: No
Date: 24/04/2007 23:04
Re: Tell a friend in Articles
#post914
Put this in articles/index.php

code
function sendMail($id,$email_mittente,$email_destinatario,$ok=false) {
        global $page,$siteConfig;

        $id = intval($id);
       
        $row_news = mysql_fetch_assoc(mysql_query("SELECT *,DATE_FORMAT(data, '".$siteConfig['timestamp']."') as data FROM memht_articles WHERE id='$id'"));
        $nome = outCode($row_news['nome']);
        $autore = outCode($row_news['autore']);
        $data = $row_news['data'];
        $enabled = intval($row_news['enabled']);
       
        if ($enabled=="1") {
                if (!$ok) {
                        openTable();
                        echo "<table width='90%' align='center'>";           
                                echo "<form name='sendMail' method='post' action='index.php?page=news&op=sendEmail&id=$id&ok=true'>";
                                        echo "<tr><td colspan='2' align='center'><b>"._SENDBYEMAIL_."</b></td></tr>\n";
                                        echo "<tr><td align='right'>"._YOUREMAIL_."</td><td><input type='text' name='email_mittente'></td></tr>\n";
                                        echo "<tr><td align='right'>"._EMAILDEST_."</td><td><input type='text' name='email_destinatario'></td></tr>\n";
                                        echo "<tr><td colspan='2' align='center'><input type='submit' name='submit' value='"._SEND_."'></td></tr>\n";
                                echo "</form>";
                        echo "</table>";
                        closeTable();
                } else {
                        if (validEmail($email_mittente) AND validEmail($email_destinatario)) {
                                $subject = $siteConfig['site_name']." - $email_mittente "._SENDINGYOUANEWS_;
                                $msg = _HI_.", $email_mittente "._SENDINGYOUANEWS_." "._ON_." ".$siteConfig['site_name'].":nn";
                                $msg .= $siteConfig['site_url']."/index.php?page=articles&op=readArticle&id=$idnn";
                                $mailheaders = "From: ".$siteConfig['site_name']." <".$siteConfig['webmaster_mail'].">rn" .
                                "Reply-To: $email_mittentern" .
                                 "X-Mailer: PHP/" . phpversion();
                       
                                @mail($email_destinatario, $subject, $msg, $mailheaders);
                               
                                echo "<meta http-equiv='refresh' content='0;URL=index.php?page=news&op=readNews&id=$id'>";
                        } else {
                                openTable();
                                        echo "<div align='center' id='errorText'><b>"._FIELDINVALID_."</b></div>";
                                closeTable();
                        }
                }
        } else {
                openTable();
                        echo "<div align='center'><img src='images/x.gif'><br><b>"._NEWSDONOTEXISTS_."</b></div>";
                closeTable();
        }
}
Delete Edit Quote
 
mem
MemHT's Dad
Admin & Developer

Avatar

Posts: 5118
Contributes: 2461

Gender: _MALE_
Online: No
Date: 24/04/2007 23:06
Re: Tell a friend in Articles
#post915
Of course you should link that function by putting in the switch on the bottom of the page
code
case "sendEmail":
                        sendMail($id,$email_mittente,$email_destinatario,$ok);
                break;


and the link should be ...&op=sendEmail&id=$id
Delete Edit Quote
 
Smyrna
Junior Member
Avatar

Posts: 26
Contributes: 0

Gender: _NEUTRAL_
Online: No
Date: 24/04/2007 23:38
Re: Tell a friend in Articles
#post918
quote
mem:
Of course you should link that function by putting in the switch on the bottom of the page
code
case "sendEmail":
                        sendMail($id,$email_mittente,$email_destinatario,$ok);
                break;


and the link should be ...&op=sendEmail&id=$id


there is an error !!

I become this message : NEWS DO NOT EXISTS ! Smile
Delete Edit Quote
 
paulo89
Moderator
Developer

Avatar

Posts: 1282
Contributes: 519

Gender: _MALE_
Online: No

Version: 3.8.1
Country: Portugal
Languages: Portuguese, Portuguese and little english ^^
Date: 25/04/2007 10:55
Re: Tell a friend in Articles
#post920
ok try this page
Attachment: index.php
Edited: 25/04/2007 10:56
Delete Edit Quote
 
paulo89
Moderator
Developer

Avatar

Posts: 1282
Contributes: 519

Gender: _MALE_
Online: No

Version: 3.8.1
Country: Portugal
Languages: Portuguese, Portuguese and little english ^^
Date: 25/04/2007 11:00
Re: Tell a friend in Articles
#post921
lol mem attachments no work very good Smile

Page here:
http://www.myben****.com/articles.txt

oh
http://www.m y b e n f i c a.com/articles.txt

lolSmile
Edited: 25/04/2007 11:09
Delete Edit Quote
 
Smyrna
Junior Member
Avatar

Posts: 26
Contributes: 0

Gender: _NEUTRAL_
Online: No
Date: 25/04/2007 11:05
Re: Tell a friend in Articles
#post922
quote
paulo89:
lol mem attachments no work very good Smile

Page here:
http://www.myben****.com/articles.txt


Smile
your link works also not good Smile

Smile
Delete Edit Quote
 
mem
MemHT's Dad
Admin & Developer

Avatar

Posts: 5118
Contributes: 2461

Gender: _MALE_
Online: No
Date: 25/04/2007 11:10
Re: Tell a friend in Articles
#post923
Lol, the attachment's script has to be finished yet because at the moment it link directly files and if you link a php file it try to open it and it's a real hazard for the security, so for for now upload only txt files or zip files
Delete Edit Quote
 
paulo89
Moderator
Developer

Avatar

Posts: 1282
Contributes: 519

Gender: _MALE_
Online: No

Version: 3.8.1
Country: Portugal
Languages: Portuguese, Portuguese and little english ^^
Date: 25/04/2007 11:12
Re: Tell a friend in Articles
#post925
Ah ok i send txt
Attachment: articles.txt
Delete Edit Quote
 
mem
MemHT's Dad
Admin & Developer

Avatar

Posts: 5118
Contributes: 2461

Gender: _MALE_
Online: No
Date: 25/04/2007 11:13
Re: Tell a friend in Articles
#post926
quote
paulo89:
lol mem attachments no work very good Smile

Page here:
http://www.myben****.com/articles.txt

oh
http://www.m y b e n f i c a.com/articles.txt

lolSmile


the censored word is "bad word" in italian Smile
even if i like it a lot Smile
Edited: 25/04/2007 11:21
Delete Edit Quote
 
Reply
Page 1/2 1 2 >
Tags Cloud
Advertising
News Archive
Language
Help MemHT Portal
Navigator
Users Block
Hi Guest
IP: 38.103.63.59

Username
Password
New files
MemHT Wiki
Friends
MemHT Portal is a free software released under the GNU/GPL License by Miltenovik Manojlo