joycesolomon Posted December 22, 2009 Share Posted December 22, 2009 Hi All I am new to php and wanting some help. I need to create a script that emails active articles in my KB to my engineers with the link embedded in the email. My problem is , once the email reached, the engineer clicks on a link, the login box need to prompt, and he enters his id and password, and once that is authenticated, it has to redirect to the url of the article that he clicked. Here is a script that i have come so far... <?php $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $dbuser="<id>"; $dbpass="<password>"; $dbname="<database>"; $chandle = mysql_connect("localhost", $dbuser, $dbpass) or die("Connection Failure to Database"); mysql_select_db($dbname, $chandle[/color]) or die ($dbname . " Database not found. " . $dbuser); $mainsection="faqdata"; //The name of the table $mainsection1="faqnewarticles"; //The name of the table $query3=sprintf("TRUNCATE faqnewarticles"); $query=sprintf("INSERT INTO faqnewarticles SELECT faqdata.id, faqdata.active, faqdata.thema, faqdata.datum, faqcategoryrelations.category_id, NULL FROM faqdata, faqcategoryrelations WHERE faqcategoryrelations.record_id = faqdata.id AND faqdata.active = 'No' "); $query2=sprintf("UPDATE faqnewarticles SET newdate = (SELECT LEFT(cast(faqnewarticles.datum as datetime),10))"); $query1=sprintf("SELECT faqnewarticles.thema,faqnewarticles.newdate, faqnewarticles.id, faqnewarticles.category FROM faqnewarticles WHERE faqnewarticles.newdate >= date_sub(curdate(), interval 2 week)"); $result3 = mysql_db_query($dbname, $query3) or die("Failed Query of " . $query3); //do the query $result1 = mysql_db_query($dbname, $query) or die("Failed Query of " . $query); //do the query $result2 = mysql_db_query($dbname, $query2) or die("Failed Query of " . $query2); //do the query $result = mysql_db_query($dbname, $query1) or die("Failed Query of " . $query1); //do the query $i=0; while($row = mysql_fetch_array($result)) { $result_array[$i] = $row; $i++; } $to = "[email protected]"; $subject = "KB Portal has new articles"; for ($j=0;$j<count($result_array);$j++) { $id=$result_array[$j]['id']; $thema=$result_array[$j]['thema']; $category=$result_array[$j]['category']; //$body .= "\n".$result_array[$j]."\n"; $body .= "<br><a href= \"http://kb.hosted.mwedc.com/faq/index.php?action=artikel&cat=".$category."&id=".$id."&artlang=en\">".$thema."</a><br>"; } mail($to, $subject,$body, $headers) ; //mail($to, $subject,$body) ; mysql_close($chandle); ?> Link to comment https://forums.phpfreaks.com/topic/186039-link-in-email-to-redirect/ Share on other sites More sharing options...
Buddski Posted December 22, 2009 Share Posted December 22, 2009 We need more details on how your client system is setup? Why it displays the login screen, how they get to the login screen (ie. redirect) etc. Link to comment https://forums.phpfreaks.com/topic/186039-link-in-email-to-redirect/#findComment-982456 Share on other sites More sharing options...
joycesolomon Posted December 22, 2009 Author Share Posted December 22, 2009 Hi, I have installed the phpmyFAQ system, the KB portal. So we have customized that every time the user wants to check on some articles or add an article, he has to login into the portal first. So now, i need to create a script that send email to the users everyweek on a monday and show that new articles are added into the portal. Also give the title of each articles and its link , eg below: Configure Mac OS X (10.5) for VPN File Sharing from Linux to Windows Set logon hours for users into network File Sharing from Linux to Windows Backup Files from Linux across network to a lacie external hard disk So when a user needs to click the link, it will take to the webbrowser, and a login box need to appear, once he puts his id and password, it gets authenticated and then redirects to the link page of the articles. This is what i want to achieve and do not know how Please help Link to comment https://forums.phpfreaks.com/topic/186039-link-in-email-to-redirect/#findComment-982469 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.