Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Oct 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Please help me in solving this..Its urgent any help is appreciated

    Thanks in advance

    I have created authentication system in which after authentication i stored value in session that distinguish registered user and and unregistered member.

    My session look like this.

    $linuser=$_session['data'];

    i use session-start(); in all my pages.

    it work fine in all the pages.but in the page where i show the link to topics.
    when user click the link some time session lost in this page where description is shown but occur some times it comes.when i pressed back session comes on previous page but not in the page where i used to show the description. I checked all the code i am not destroying any session but i don't now the reason why some time session appear at the page and some time not appear at the same page .

    this is my code......................in which session appear some time........

    <?php session_start();
    $linuser=$_SESSION['linuser'];
    $luser=$_SESSION['luser'];
    $cuser= $_SESSION['cuser'];
    $iuser=$_SESSION['iuser'];

    //-----------------------------------------------------------------------------------------------------------------------------

    $protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https') === FALSE ? 'http' : 'https';
    $host = $_SERVER['HTTP_HOST'];
    $script = $_SERVER['SCRIPT_NAME'];
    $params = $_SERVER['QUERY_STRING'];
    $url1=$protocol."://".$host.$script."?".$params;
    $_SESSION['url1']=$url1;

    $loginid=$_SESSION['id'];
    $name1=$_SESSION['name']; //name of login user
    $loginid=$_SESSION['id']; //check user login id and topic login id
    include('includes/config.php');

    //----------------------------------------get data from url-----------------------------------------------------------------------


    $id=$_GET['pageid'];
    $idp=base64_decode($id); //login key of topic author remember author login id poste topic
    $id2=$_GET['topic'];
    $fid=base64_decode($id2); //primary key topic

    //---------------------------------------------------------------------------for subcomment--------------------------------------------
    if($_POST['input'])
    {
    if((isset($cuser))||(isset($luser))||(isset($linuser))||(isset($iuser)))
    {
    $cname=$_POST['cname']; //username of vommented user
    $val=$_POST['val'];
    $comment=$_POST['noise'];
    $loginsub=$_POST['loginsub'];
    $url=$_POST['url'];
    $sql13=mysql_query("insert into f_fcomment(name,comment,uid,login,time)values('$cname','$comment','$val','$loginsub',NOW())");
    if($sql13)
    {

    $sqlemail=mysql_query("select name,loginid,cid from f_forucom where id='$val'");
    $rowemail=mysql_fetch_array($sqlemail);
    $idll=$rowemail['loginid'];
    $nameww=$rowemail['name'];
    $cidww=$rowemail['cid']; //topicid
    $valuesend=base64_encode($idll);
    $sqlloginemail=mysql_query("select email,estatus from f_login where id='$idll'");
    $rowemaillog=mysql_fetch_array($sqlloginemail);
    $emailauthor=$rowemaillog['email'];
    $estatus=$rowemaillog['estatus'];
    if($estatus==1)
    {
    }else{
    $topicget=mysql_query("select title,description,name from f_topics where id='$cidww'");
    $rowcic=mysql_fetch_array($topicget);
    $namecic=$rowcic['name'];
    $titlemail=$rowcic['title'];
    $description1 =$rowcic['description'];
    $description2=substr($description1,0,18);
    $value="1";

    $TemplateMessage.="<div style='font-family:Arial; font-size:12px; color:#000000;'>";
    $TemplateMessage.="Dear $nameww".",";
    $TemplateMessage.="<br><br><br>You have received a new reply to your comment on '"." $titlemail"."' on 4gwirelessforum.com:";
    $TemplateMessage.="'"."<b>"."$description2"."</b>"."'"."posted by ".'"'."$namecic".'"';
    $TemplateMessage.="<br><br>To view the full reply, please click <a href=$url><u>here</u></a>.";
    $TemplateMessage.="<br><br><b>Best Wishes,</b>";
    $TemplateMessage.="<br><b>san.com</b>";
    $TemplateMessage.="</div>";
    $TemplateMessage.="<div style='font-size:10px; font:Geneva, Arial, Helvetica, sans-serif; color:#999999;'>";
    $TemplateMessage.="<br><br><br>".'"'."For your valuable feedback please click <a href=http://san.com/contactus.php><u><b>here</b></u></a>. ";
    $TemplateMessage.="<br><br>To stop receiving the notification emails, please click <a href=http://san.com/articles/subscribe.php?stop=$value&stopverification=$valuesend><u>here</u></a>.";
    $TemplateMessage.="<br>You are receiving this mail because you have accepted the terms of use while registering with 4G Wireless Forum. ";
    $TemplateMessage.="<br>Please add san@gmail.comto your contact list to prevent future 4G Wireless Forum Alerts from being directed to your Junk / Bulk Folder.".'"';
    $emailc="info@4gwirelessforum.com";

    $mail=mail($emailauthor,"Reply posted to your comment on '"."$titlemail"."'",$TemplateMessage,"From: $emailc\nContent-type: text/html; charset=iso-8859-1 \nMIME-Version: 1.0");
    if($mail)
    {
    }else
    {
    $mail=mail($emailauthor,"Reply posted to your comment on '"."$titlemail"."'",$TemplateMessage,"From: $emailc\nContent-type: text/html; charset=iso-8859-1 \nMIME-Version: 1.0");
    }
    }
    }
    }
    }

    //---------------------------------------------------------for unregisterd user-----------------------------------

    if($_POST['input1'])
    {
    $errrmsg="To use full facility.Please register first.";
    $showmsg=base64_encode($errrmsg);
    header("Location:create-account.php?$showmsg");
    }
    //------------------ details of f_topics----------------------------------------------------------------------------------------------------------

    $sql=mysql_fetch_array(mysql_query("select * from f_topics where id='$fid' order by id DESC"));
    $topiid=$sql['id'];
    $_SESSION['topicid']=$topiid;
    $idtopic=base64_encode($topiid);
    $description=$sql['description'];
    $description1=stripslashes($description);
    $name=$sql['name']; //name of the author//////////////////////////
    $title=$sql['title'];
    $date=$sql['date'];
    $time=$sql['time'];
    $tiddelete=$sql['tid'];

    $dataidof=base64_encode($tiddelete);



    $sql=mysql_query("SELECT id from f_login where email='$linuser' || email='$luser'|| email='$cuser'|| email='$iuser' ");
    $log=mysql_fetch_array($sql);
    $loginsub=$log['id'];
    include('includes/header.php');
    ?>

    <!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>
    <script type="text/javascript">
    function con() {
    var answer = confirm("Are you sure you want to delete?");
    if (answer==true)
    {
    window.location.href = "redirect.php?data=<?php echo $idtopic; ?>";
    }
    else
    {
    return false;
    }
    }
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    <link href="ag.css" type="text/css" rel="stylesheet" />
    <link href="css/forum.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <script type="text/javascript" src="js/animatedcollapse.js"></script>
    <script type="text/javascript">
    <?php
    //-------------------------------------------------to open slide in ----------------------------
    $sql1="select id from f_forucom where cid='$fid'";
    $query=mysql_query($sql1);
    while($row=mysql_fetch_array($query))
    {
    ?>
    animatedcollapse.addDiv('<?php echo $row['id']; ?>', 'fade=1,height=180px')
    animatedcollapse.ontoggle=function($, divobj, state){ //fires each time a DIV is expanded/contracted
    //$: Access to jQuery
    //divobj: DOM reference to DIV being expanded/ collapsed. Use "divobj.id" to get its ID
    //state: "block" or "none", depending on state
    }
    animatedcollapse.init()
    <?php } //-------------------------------------------------------------------------------------------?>
    </script>

    <style type="text/css" media="all">
    @import "css/info.css";
    @import "css/main.css";
    @import "css/widgEditor.css";
    </style>

    <script type="text/javascript" src="scripts/widgEditor.js"></script>


    <script type="text/javascript">
    <?php
    $sql1="select id from f_forucom where cid='$fid'";
    $query=mysql_query($sql1);
    while($row=mysql_fetch_array($query))
    {
    ?>
    bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });
    new nicEditor().panelInstance('<?php echo "a".$row['id']; ?>');
    <?php } //-------------------------------------------------------------------------------------------?>
    </script>
    </head>
    <body>
    <div style="text-align:center">
    <br />
    <div style="float:right;"><?php include("add-bookmarks.html"); ?></div>
    <table style="width:100%" cellspacing="0" cellpadding="0">

    <tr>
    <td valign="bottom">
    <table width="970" cellpadding="0" cellspacing="0">
    <tr class="petit">
    <td width="200" valign="bottom" style="border-bottom: groove #000099 1px;border-left: groove #000099 1px;border-top: groove #000099 1px;width:200;background-color:#D7D7D7"><b><img src="images/histicon.gif" />
    <?php if((isset($cuser))||(isset($luser))||(isset($linuser))||(isset($iuser))) { ?>
    <a href="forum.php" target="_parent">Forum index</a></b></td>
    <?php }else { ?>
    <a href="u_forum.php" target="_parent">Forum index</a></b></td>
    <?php } ?>

    </tr>
    </table>
    </td>
    <td align="right" style="width:1"><a href="" target="_parent"></a> </td>
    <td align="right"><a href="" ></a></td>
    </tr>
    </table><br />
    <div style="text-align:right" class="petit"></div>
    <?php $errmsg=$_SESSION['message']; ?>
    <div style="text-align:left" class="petit"><?php echo $errmsg; ?></div>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr style="background-color:#D7D7D7;border: 2px #FFFFFF solid;width:100%" align="center" class="titres">
    <td width="175" style="width:175"><b></b> </td>


    <td width="510" style="font-size:18px;"><p><b>Topic:&nbsp;<?php echo $title; ?></b></p>
    <?php if($msgerror)
    { ?>
    <div align="center" style="font-size:16px; font-family:Georgia, 'Times New Roman', Times, serif; color:#660033;"><?php echo $msgerror;?><a href="create-account.php" ><u>Click</u></a></div>
    <?php } ?></td>
    <td width="288" class="petit" style="text-align:right">&nbsp;</td>
    </tr>
    </table>





    <table width="100%" border="0" cellspacing="0" cellpadding="1" style="border-top: 2px #FFFFFF solid;border-left: 2px #FFFFFF solid;border-right: 2px #FFFFFF solid">
    <tr>
    <?php //----------------------------------to get author images-------------------------------------------------------------------------------
    $sql1=mysql_query("select tid from f_topics where id='$fid'");
    $row1=mysql_fetch_array($sql1);
    $tid=$row1['tid'];
    $diddeco=base64_encode($tid);
    $sqli=mysql_fetch_array(mysql_query("select mid,image from f_image where mid='$tid'"));
    $image=$sqli['image'];
    $mid1=$sqli['mid'];
    if(isset($image))
    {
    ?>
    <td style="border-right: 2px #FFFFFF solid;width:200px;background-color:#D7D7D7;vertical-align:top; font-size:12px; " class="master" rowspan="2" ><b>Created by : <?php echo $name; ?></b><br />&nbsp;&nbsp;<a href="click_profile.php?mid=<?php echo $diddeco; ?>" target="_blank"><img src="a_images/<?php echo $image; ?>" width="90" height="93" /></a></span></td>
    <?php }else{ ?>
    <td style="border-right: 2px #FFFFFF solid;width:200px;background-color:#D7D7D7;vertical-align:top; font-size:12px;" class="master" rowspan="2"><b>Created by : <?php echo $name; ?> </b><br />&nbsp;&nbsp;<a href="click_profile.php?mid=<?php echo $diddeco; ?>" target="_blank"><img src="a_images/noimage1.jpg" width="90" height="93" /></a></td>
    <?php } ?>
    <td style="background-color:#D7D7D7;" valign="top" class="master">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color:#D7D7D7">
    <tr>
    <td style="width:50%;text-align:left" class="petit"><img src="images/icones/icon22.gif"/>&nbsp; Posted on&nbsp;<?php echo $date."&nbsp;".$time; ?></td>
    <td width="20%" style="text-align:right">
    <table border="0" cellspacing="0" style="padding-left:3;padding-right:3">

    <tr style="background-color:#D7D7D7">
    <td class="menumessage"><a href="click_profile.php?mid=<?php echo $dataidof; ?>" target="_blank">
    <img src='images/edit_profile.gif' alt="Profile" /></a></td>


    </td>
    </tr>
    </table></td>
    </tr>
    </table>
    <div style="text-align:left">
    <p><?php echo $description1; ?></p></div>

    <?php
    if($tiddelete==$loginid)
    {
    ?>
    <div align="right"><br /><input type="button" value="Delete" onclick="con()" style="background-color:#C7C2BC;" /></div>
    <?php } ?>
    <span class="petit" style="background-color:#D7D7D7;border-top: 1px #000099 solid;text-align:left;height:1" >
    </span><br /><td height="7"></td>
    </tr>
    <tr>
    <td height="22" valign="bottom" class="petit" style="background-color:#D7D7D7;border-top: 1px #000099 solid;text-align:left;height:1"><br /></td>
    </tr>
    </table>

    <?php
    //------------------------fetch data to show user comment---------------------------------------------------------
    $sql="select id,name,message,date,time,image_id,loginid from f_forucom where cid='$fid' order by id DESC";
    $query=mysql_query($sql);
    while($row=mysql_fetch_array($query))
    {
    $idf=$row['id'];
    $name=$row['name'];
    $message=$row['message'];
    $date=$row['date'];
    $time=$row['time'];
    $image_id=$row['image_id'];
    $idchech=$row['loginid'];
    $conlogin=base64_encode($idchech);
    ?>
    <script type="text/javascript">
    function concl(control) {
    var answer = confirm("Are you sure you want to delete?");
    if (answer)
    {

    window.location.href = "redirect.php?sata="+control.id;
    }
    else
    {
    return false;
    }
    }
    </script>




    <table width="100%" border="0" cellspacing="0" cellpadding="1" style="border-top: 2px #FFFFFF solid;border-left: 2px #FFFFFF solid;border-right: 2px #FFFFFF solid">
    <tr>
    <td style="border-right: 2px #FFFFFF solid;width:200px;background-color:#D7D7D7;vertical-align:top" class="master" rowspan="2"><b><?php echo $name; ?></b> <span class="petit"><br />
    <?php //to get image of commented user//----------------------

    $sqli=mysql_query("select mid,image from f_image where mid='$image_id'");
    $fetch=mysql_fetch_array($sqli);
    $image=$fetch['image'];
    $mid2=$sqli['mid'];
    $mid5=base64_encode($mid2);
    if($image)
    {
    ?>
    <a href="click_profile.php?mid=<?php echo $conlogin; ?>" target="_blank"><img src="a_images/<?php echo $image; ?>" width="111" height="106" /></a></span></td>
    <?php }else{ ?>
    <a href="click_profile.php?mid=<?php echo $conlogin; ?>" target="_blank"><img src="a_images/noimage1.jpg" width="111" height="106" /></a></td>
    <?php } ?>

    <td style="background-color:#D7D7D7" valign="top" class="master"><table width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color:#D7D7D7">
    <tr>
    <td style="width:50%;text-align:left" class="petit"><img src="images/icones/icon1.gif" border="0"/>&nbsp; Posted&nbsp;<?php echo $date."&nbsp;".$time; ?></td>
    <td width="20%" style="text-align:right">&nbsp;</td>
    </tr>
    </table>
    <div style="text-align:left; border-bottom-style:groove; border-left-style:groove; border-right-style:groove; border-top-style:groove; ">
    <p><?php echo stripslashes($message); ?></p><br /></div>
    <?php
    if($idchech==$loginid)
    { $decode=base64_encode($idf); ?>
    <div align="right"><input type="button" id=<?php echo $decode; ?> value="Delete" onclick="concl(this)" style="background-color:#C7C2BC;" /></div>
    <?php } ?>
    <?php
    $sql=mysql_query("select id,name,login,comment,time from f_fcomment where uid='$idf' order by id ASC");
    if($sql)
    {
    while($ro=mysql_fetch_array($sql))
    {
    $fcomid=$ro['id'];
    $dat=$ro['comment'];
    $idlogin=$ro['login'];
    $namesub=$ro['name'];
    $time1=$ro['time'];
    $idconvert=base64_encode($idlogin);
    ?>
    <script type="text/javascript">
    function sub(control1) {
    var answer = confirm("Are you sure you want to delete?");
    if (answer)
    {
    window.location.href = "redirect.php?subid="+control1.id;
    }
    else
    {
    return false;
    }


    }
    </script>


    <table width="765" height="92" border="1" style="border-top: 2px #FFFFFF solid;border-left: 2px #FFFFFF solid;border-right: 2px #FFFFFF solid">
    <tr>
    <td height="18" colspan="2" class="petit">Posted by::<?php echo $namesub; ?>&nbsp;<?php echo $time1; ?></td>
    </tr>
    <tr>
    <?php $sqlimage=mysql_query("select mid,image from f_image where mid='$idlogin'");
    $image=mysql_fetch_array($sqlimage);
    $img=$image['image'];

    if($img)
    {
    ?>
    <td width="76" valign="top"><a href="click_profile.php?mid=<?php echo $idconvert; ?>"><img src="a_images/<?php echo $img; ?>" width="77" height="67" /></a></td>
    <?php }else{ ?>
    <td width="76" valign="top"><a href="click_profile.php?mid=<?php echo $idconvert; ?>"><img src="a_images/noimage1.jpg" width="77" height="67" /></a></td>
    <?php } ?>

    <td width="673" class="master"><?php echo $dat; ?>
    <?php
    $sqlsu=mysql_query("select login from f_fcomment where id='$fcomid'");
    $rowsu=mysql_fetch_array($sqlsu);
    $login=$rowsu['login'];
    if($login==$loginsub)
    { $subcommet=base64_encode($fcomid);
    ?>
    <p style="vertical-align:bottom;" align="right" ><input type="button" id="<?php echo $subcommet; ?>" value="Delete" onclick="sub(this)" style="background-color:#C7C2BC;" /></p></td>
    <?php } ?>
    </tr>

    </table>
    <?php } } ?>
    <div style="text-align:left">


    <div align="left"><a href="javascript:animatedcollapse.show(['<?php echo $idf; ?>'])">Reply to this comment</a> </div>
    <?php if((isset($cuser))||(isset($luser))||(isset($linuser))||(isset($iuser)))
    { ?>
    <div id="<?php echo $idf; ?>" style="width: 600px; height:200px; background:#CCCCCC;display:none">
    <form action="<?php echo $PHP_SELF; ?>" name="form" method="post">
    <textarea id="<?php echo "a".$idf; ?>" name="noise" class="widgEditor nothing" ></textarea>
    <input type="submit" value="Enter Your Comment" name="input" style="background-color: #A29D82;" />&nbsp;<a href="javascript:animatedcollapse.hide(['<?php echo $idf; ?>'])">Close</a>
    <input type="hidden" value="<?php echo $idf; ?>" name="val" />
    <input type="hidden" value="<?php echo $name1; ?>" name="cname" />
    <input type="hidden" value="<?php echo $loginsub; ?>" name="loginsub" />
    <input type="hidden" value="<?php echo $url1; ?>" name="url" />

    </form>

    </div>
    <?php }else{ ?>
    <div id="<?php echo $idf; ?>" style="width: 600px; height:200px; background:#CCCCCC;display:none">

    <textarea id="<?php echo "a".$idf; ?>" name="noise" class="widgEditor nothing" ><b>Only registered member can post comments.To register/login please click on Create Account below.</b></textarea>
    <a href="create-account.php"><font style="background-color:#A29D82;">Create Account</font></a>&nbsp;&nbsp;<a href="javascript:animatedcollapse.hide(['<?php echo $idf; ?>'])"><font style="background-color:#A29D82;">Close</font></a>


    </div>
    <?php } ?>
    </div></td>
    </tr>
    </table>
    <?php } ?>
    <table width="100%" border="0" cellspacing="0" cellpadding="1" style="border-top: 2px #FFFFFF solid;border-left: 2px #FFFFFF solid;border-right: 2px #FFFFFF solid">
    <br />
    </td>
    </tr>
    </table>
    <div style="text-align:left" class="petit"></div>
    <table style="width:100%" cellspacing="0" cellpadding="0">

    <tr>
    <td valign="bottom" align="center" bgcolor="#C5C0BC" style="font-size:18px; font-family:Georgia, 'Times New Roman', Times, serif;">
    <?php //crete a link to post main comment

    $value=base64_encode($fid); //primary key of topic
    //now we are getting the login primary key commenting user
    $sql="SELECT id from f_login where email='$linuser' || email='$luser'|| email='$cuser'|| email='$iuser' " ; //to get id from table
    $query1=mysql_query($sql);
    $row1=mysql_fetch_array($query1);
    $idlogin=$row1['id'];
    $Lvalue=base64_encode($idlogin); //login key of user
    //------------------------------now you get the id of user----------------------------------

    ?>
    Post your comment<a href="commentpage.php?Page=<?php echo $value; ?>&lvalue=<?php echo $Lvalue; ?>"><u>&nbsp;here</u></a></td>
    </tr>
    </table>
    <div style="text-align:right"></div>
    <div style="text-align:right">
    <div class="legend"></div>
    </div>
    </div>
    <?php include('includes/footer.php');?>

    </body>


    </html>








    Please help me. Any help is appreciated.
    Last edited by san2629; 11-27-2010 at 07:39 PM.

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,471
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    I'm not sure of how your script works ... way to hard to see without testing it myself.
    But, in order to set a SESSION (or cookie), you need at least one refresh of some kind.
    The SESSION info is put into a packet header.

    So, if you are using Javascripting to alter fields, and you expect a SESSION to be
    set without a refresh, that's your problem. You can create a separate script just
    for handling SESSION read and writes. That script can redirect back to your main
    script (the process of that will be invisible to the user). Doing that, takes care of
    the needed header.

    The alternative to handling both page edits, without refresh, and SESSIONS, is to use AJAX.

  • #3
    New to the CF scene
    Join Date
    Oct 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by san2629 View Post
    Thanks in advance

    I have created authentication system in which after authentication i stored value in session that distinguish registered user and and unregistered member.

    My session look like this.

    $linuser=$_session['data'];

    i use session-start(); in all my pages.

    it work fine in all the pages.but in the page where i show the link to topics.
    when user click the link some time session lost in this page where description is shown but occur some times it comes.when i pressed back session comes on previous page but not in the page where i used to show the description. I checked all the code i am not destroying any session but i don't now the reason why some time session appear at the page and some time not appear at the same page .

    this is my code......................in which session appear some time........

    <?php session_start();
    $linuser=$_SESSION['linuser'];
    $luser=$_SESSION['luser'];
    $cuser= $_SESSION['cuser'];
    $iuser=$_SESSION['iuser'];

    //-----------------------------------------------------------------------------------------------------------------------------

    $protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https') === FALSE ? 'http' : 'https';
    $host = $_SERVER['HTTP_HOST'];
    $script = $_SERVER['SCRIPT_NAME'];
    $params = $_SERVER['QUERY_STRING'];
    $url1=$protocol."://".$host.$script."?".$params;
    $_SESSION['url1']=$url1;

    $loginid=$_SESSION['id'];
    $name1=$_SESSION['name']; //name of login user
    $loginid=$_SESSION['id']; //check user login id and topic login id
    include('includes/config.php');

    //----------------------------------------get data from url-----------------------------------------------------------------------


    $id=$_GET['pageid'];
    $idp=base64_decode($id); //login key of topic author remember author login id poste topic
    $id2=$_GET['topic'];
    $fid=base64_decode($id2); //primary key topic

    //---------------------------------------------------------------------------for subcomment--------------------------------------------
    if($_POST['input'])
    {
    if((isset($cuser))||(isset($luser))||(isset($linuser))||(isset($iuser)))
    {
    $cname=$_POST['cname']; //username of vommented user
    $val=$_POST['val'];
    $comment=$_POST['noise'];
    $loginsub=$_POST['loginsub'];
    $url=$_POST['url'];
    $sql13=mysql_query("insert into f_fcomment(name,comment,uid,login,time)values('$cname','$comment','$val','$loginsub',NOW())");
    if($sql13)
    {

    $sqlemail=mysql_query("select name,loginid,cid from f_forucom where id='$val'");
    $rowemail=mysql_fetch_array($sqlemail);
    $idll=$rowemail['loginid'];
    $nameww=$rowemail['name'];
    $cidww=$rowemail['cid']; //topicid
    $valuesend=base64_encode($idll);
    $sqlloginemail=mysql_query("select email,estatus from f_login where id='$idll'");
    $rowemaillog=mysql_fetch_array($sqlloginemail);
    $emailauthor=$rowemaillog['email'];
    $estatus=$rowemaillog['estatus'];
    if($estatus==1)
    {
    }else{
    $topicget=mysql_query("select title,description,name from f_topics where id='$cidww'");
    $rowcic=mysql_fetch_array($topicget);
    $namecic=$rowcic['name'];
    $titlemail=$rowcic['title'];
    $description1 =$rowcic['description'];
    $description2=substr($description1,0,18);
    $value="1";


    $emailc="info@4gwirelessforum.com";

    $mail=mail($emailauthor,"Reply posted to your comment on '"."$titlemail"."'",$TemplateMessage,"From: $emailc\nContent-type: text/html; charset=iso-8859-1 \nMIME-Version: 1.0");
    if($mail)
    {
    }else
    {
    $mail=mail($emailauthor,"Reply posted to your comment on '"."$titlemail"."'",$TemplateMessage,"From: $emailc\nContent-type: text/html; charset=iso-8859-1 \nMIME-Version: 1.0");
    }
    }
    }
    }
    }

    //---------------------------------------------------------for unregisterd user-----------------------------------

    if($_POST['input1'])
    {
    $errrmsg="To use full facility.Please register first.";
    $showmsg=base64_encode($errrmsg);
    header("Location:create-account.php?$showmsg");
    }
    //------------------ details of f_topics----------------------------------------------------------------------------------------------------------

    $sql=mysql_fetch_array(mysql_query("select * from f_topics where id='$fid' order by id DESC"));
    $topiid=$sql['id'];
    $_SESSION['topicid']=$topiid;
    $idtopic=base64_encode($topiid);
    $description=$sql['description'];
    $description1=stripslashes($description);
    $name=$sql['name']; //name of the author//////////////////////////
    $title=$sql['title'];
    $date=$sql['date'];
    $time=$sql['time'];
    $tiddelete=$sql['tid'];

    $dataidof=base64_encode($tiddelete);



    $sql=mysql_query("SELECT id from f_login where email='$linuser' || email='$luser'|| email='$cuser'|| email='$iuser' ");
    $log=mysql_fetch_array($sql);
    $loginsub=$log['id'];
    include('includes/header.php');
    ?>

    <!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>
    <script type="text/javascript">
    function con() {
    var answer = confirm("Are you sure you want to delete?");
    if (answer==true)
    {
    window.location.href = "redirect.php?data=<?php echo $idtopic; ?>";
    }
    else
    {
    return false;
    }
    }
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    <link href="ag.css" type="text/css" rel="stylesheet" />
    <link href="css/forum.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <script type="text/javascript" src="js/animatedcollapse.js"></script>
    <script type="text/javascript">
    <?php
    //-------------------------------------------------to open slide in ----------------------------
    $sql1="select id from f_forucom where cid='$fid'";
    $query=mysql_query($sql1);
    while($row=mysql_fetch_array($query))
    {
    ?>
    animatedcollapse.addDiv('<?php echo $row['id']; ?>', 'fade=1,height=180px')
    animatedcollapse.ontoggle=function($, divobj, state){ //fires each time a DIV is expanded/contracted
    //$: Access to jQuery
    //divobj: DOM reference to DIV being expanded/ collapsed. Use "divobj.id" to get its ID
    //state: "block" or "none", depending on state
    }
    animatedcollapse.init()
    <?php } //-------------------------------------------------------------------------------------------?>
    </script>

    <style type="text/css" media="all">
    @import "css/info.css";
    @import "css/main.css";
    @import "css/widgEditor.css";
    </style>

    <script type="text/javascript" src="scripts/widgEditor.js"></script>


    <script type="text/javascript">
    <?php
    $sql1="select id from f_forucom where cid='$fid'";
    $query=mysql_query($sql1);
    while($row=mysql_fetch_array($query))
    {
    ?>
    bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });
    new nicEditor().panelInstance('<?php echo "a".$row['id']; ?>');
    <?php } //-------------------------------------------------------------------------------------------?>
    </script>
    </head>
    <body>
    <div style="text-align:center">
    <br />
    <div style="float:right;"><?php include("add-bookmarks.html"); ?></div>
    <table style="width:100%" cellspacing="0" cellpadding="0">

    <tr>
    <td valign="bottom">
    <table width="970" cellpadding="0" cellspacing="0">
    <tr class="petit">
    <td width="200" valign="bottom" style="border-bottom: groove #000099 1px;border-left: groove #000099 1px;border-top: groove #000099 1px;width:200;background-color:#D7D7D7"><b><img src="images/histicon.gif" />
    <?php if((isset($cuser))||(isset($luser))||(isset($linuser))||(isset($iuser))) { ?>
    <a href="forum.php" target="_parent">Forum index</a></b></td>
    <?php }else { ?>
    <a href="u_forum.php" target="_parent">Forum index</a></b></td>
    <?php } ?>

    </tr>
    </table>
    </td>
    <td align="right" style="width:1"><a href="" target="_parent"></a> </td>
    <td align="right"><a href="" ></a></td>
    </tr>
    </table><br />
    <div style="text-align:right" class="petit"></div>
    <?php $errmsg=$_SESSION['message']; ?>
    <div style="text-align:left" class="petit"><?php echo $errmsg; ?></div>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr style="background-color:#D7D7D7;border: 2px #FFFFFF solid;width:100%" align="center" class="titres">
    <td width="175" style="width:175"><b></b> </td>


    <td width="510" style="font-size:18px;"><p><b>Topic:&nbsp;<?php echo $title; ?></b></p>
    <?php if($msgerror)
    { ?>
    <div align="center" style="font-size:16px; font-family:Georgia, 'Times New Roman', Times, serif; color:#660033;"><?php echo $msgerror;?><a href="create-account.php" ><u>Click</u></a></div>
    <?php } ?></td>
    <td width="288" class="petit" style="text-align:right">&nbsp;</td>
    </tr>
    </table>





    <table width="100%" border="0" cellspacing="0" cellpadding="1" style="border-top: 2px #FFFFFF solid;border-left: 2px #FFFFFF solid;border-right: 2px #FFFFFF solid">
    <tr>
    <?php //----------------------------------to get author images-------------------------------------------------------------------------------
    $sql1=mysql_query("select tid from f_topics where id='$fid'");
    $row1=mysql_fetch_array($sql1);
    $tid=$row1['tid'];
    $diddeco=base64_encode($tid);
    $sqli=mysql_fetch_array(mysql_query("select mid,image from f_image where mid='$tid'"));
    $image=$sqli['image'];
    $mid1=$sqli['mid'];
    if(isset($image))
    {
    ?>
    <td style="border-right: 2px #FFFFFF solid;width:200px;background-color:#D7D7D7;vertical-align:top; font-size:12px; " class="master" rowspan="2" ><b>Created by : <?php echo $name; ?></b><br />&nbsp;&nbsp;<a href="click_profile.php?mid=<?php echo $diddeco; ?>" target="_blank"><img src="a_images/<?php echo $image; ?>" width="90" height="93" /></a></span></td>
    <?php }else{ ?>
    <td style="border-right: 2px #FFFFFF solid;width:200px;background-color:#D7D7D7;vertical-align:top; font-size:12px;" class="master" rowspan="2"><b>Created by : <?php echo $name; ?> </b><br />&nbsp;&nbsp;<a href="click_profile.php?mid=<?php echo $diddeco; ?>" target="_blank"><img src="a_images/noimage1.jpg" width="90" height="93" /></a></td>
    <?php } ?>
    <td style="background-color:#D7D7D7;" valign="top" class="master">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color:#D7D7D7">
    <tr>
    <td style="width:50%;text-align:left" class="petit"><img src="images/icones/icon22.gif"/>&nbsp; Posted on&nbsp;<?php echo $date."&nbsp;".$time; ?></td>
    <td width="20%" style="text-align:right">
    <table border="0" cellspacing="0" style="padding-left:3;padding-right:3">

    <tr style="background-color:#D7D7D7">
    <td class="menumessage"><a href="click_profile.php?mid=<?php echo $dataidof; ?>" target="_blank">
    <img src='images/edit_profile.gif' alt="Profile" /></a></td>


    </td>
    </tr>
    </table></td>
    </tr>
    </table>
    <div style="text-align:left">
    <p><?php echo $description1; ?></p></div>

    <?php
    if($tiddelete==$loginid)
    {
    ?>
    <div align="right"><br /><input type="button" value="Delete" onclick="con()" style="background-color:#C7C2BC;" /></div>
    <?php } ?>
    <span class="petit" style="background-color:#D7D7D7;border-top: 1px #000099 solid;text-align:left;height:1" >
    </span><br /><td height="7"></td>
    </tr>
    <tr>
    <td height="22" valign="bottom" class="petit" style="background-color:#D7D7D7;border-top: 1px #000099 solid;text-align:left;height:1"><br /></td>
    </tr>
    </table>

    <?php
    //------------------------fetch data to show user comment---------------------------------------------------------
    $sql="select id,name,message,date,time,image_id,loginid from f_forucom where cid='$fid' order by id DESC";
    $query=mysql_query($sql);
    while($row=mysql_fetch_array($query))
    {
    $idf=$row['id'];
    $name=$row['name'];
    $message=$row['message'];
    $date=$row['date'];
    $time=$row['time'];
    $image_id=$row['image_id'];
    $idchech=$row['loginid'];
    $conlogin=base64_encode($idchech);
    ?>
    <script type="text/javascript">
    function concl(control) {
    var answer = confirm("Are you sure you want to delete?");
    if (answer)
    {

    window.location.href = "redirect.php?sata="+control.id;
    }
    else
    {
    return false;
    }
    }
    </script>




    <table width="100%" border="0" cellspacing="0" cellpadding="1" style="border-top: 2px #FFFFFF solid;border-left: 2px #FFFFFF solid;border-right: 2px #FFFFFF solid">
    <tr>
    <td style="border-right: 2px #FFFFFF solid;width:200px;background-color:#D7D7D7;vertical-align:top" class="master" rowspan="2"><b><?php echo $name; ?></b> <span class="petit"><br />
    <?php //to get image of commented user//----------------------

    $sqli=mysql_query("select mid,image from f_image where mid='$image_id'");
    $fetch=mysql_fetch_array($sqli);
    $image=$fetch['image'];
    $mid2=$sqli['mid'];
    $mid5=base64_encode($mid2);
    if($image)
    {
    ?>
    <a href="click_profile.php?mid=<?php echo $conlogin; ?>" target="_blank"><img src="a_images/<?php echo $image; ?>" width="111" height="106" /></a></span></td>
    <?php }else{ ?>
    <a href="click_profile.php?mid=<?php echo $conlogin; ?>" target="_blank"><img src="a_images/noimage1.jpg" width="111" height="106" /></a></td>
    <?php } ?>

    <td style="background-color:#D7D7D7" valign="top" class="master"><table width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color:#D7D7D7">
    <tr>
    <td style="width:50%;text-align:left" class="petit"><img src="images/icones/icon1.gif" border="0"/>&nbsp; Posted&nbsp;<?php echo $date."&nbsp;".$time; ?></td>
    <td width="20%" style="text-align:right">&nbsp;</td>
    </tr>
    </table>
    <div style="text-align:left; border-bottom-style:groove; border-left-style:groove; border-right-style:groove; border-top-style:groove; ">
    <p><?php echo stripslashes($message); ?></p><br /></div>
    <?php
    if($idchech==$loginid)
    { $decode=base64_encode($idf); ?>
    <div align="right"><input type="button" id=<?php echo $decode; ?> value="Delete" onclick="concl(this)" style="background-color:#C7C2BC;" /></div>
    <?php } ?>
    <?php
    $sql=mysql_query("select id,name,login,comment,time from f_fcomment where uid='$idf' order by id ASC");
    if($sql)
    {
    while($ro=mysql_fetch_array($sql))
    {
    $fcomid=$ro['id'];
    $dat=$ro['comment'];
    $idlogin=$ro['login'];
    $namesub=$ro['name'];
    $time1=$ro['time'];
    $idconvert=base64_encode($idlogin);
    ?>
    <script type="text/javascript">
    function sub(control1) {
    var answer = confirm("Are you sure you want to delete?");
    if (answer)
    {
    window.location.href = "redirect.php?subid="+control1.id;
    }
    else
    {
    return false;
    }


    }
    </script>


    <table width="765" height="92" border="1" style="border-top: 2px #FFFFFF solid;border-left: 2px #FFFFFF solid;border-right: 2px #FFFFFF solid">
    <tr>
    <td height="18" colspan="2" class="petit">Posted by::<?php echo $namesub; ?>&nbsp;<?php echo $time1; ?></td>
    </tr>
    <tr>
    <?php $sqlimage=mysql_query("select mid,image from f_image where mid='$idlogin'");
    $image=mysql_fetch_array($sqlimage);
    $img=$image['image'];

    if($img)
    {
    ?>
    <td width="76" valign="top"><a href="click_profile.php?mid=<?php echo $idconvert; ?>"><img src="a_images/<?php echo $img; ?>" width="77" height="67" /></a></td>
    <?php }else{ ?>
    <td width="76" valign="top"><a href="click_profile.php?mid=<?php echo $idconvert; ?>"><img src="a_images/noimage1.jpg" width="77" height="67" /></a></td>
    <?php } ?>

    <td width="673" class="master"><?php echo $dat; ?>
    <?php
    $sqlsu=mysql_query("select login from f_fcomment where id='$fcomid'");
    $rowsu=mysql_fetch_array($sqlsu);
    $login=$rowsu['login'];
    if($login==$loginsub)
    { $subcommet=base64_encode($fcomid);
    ?>
    <p style="vertical-align:bottom;" align="right" ><input type="button" id="<?php echo $subcommet; ?>" value="Delete" onclick="sub(this)" style="background-color:#C7C2BC;" /></p></td>
    <?php } ?>
    </tr>

    </table>
    <?php } } ?>
    <div style="text-align:left">


    <div align="left"><a href="javascript:animatedcollapse.show(['<?php echo $idf; ?>'])">Reply to this comment</a> </div>
    <?php if((isset($cuser))||(isset($luser))||(isset($linuser))||(isset($iuser)))
    { ?>
    <div id="<?php echo $idf; ?>" style="width: 600px; height:200px; background:#CCCCCC;display:none">
    <form action="<?php echo $PHP_SELF; ?>" name="form" method="post">
    <textarea id="<?php echo "a".$idf; ?>" name="noise" class="widgEditor nothing" ></textarea>
    <input type="submit" value="Enter Your Comment" name="input" style="background-color: #A29D82;" />&nbsp;<a href="javascript:animatedcollapse.hide(['<?php echo $idf; ?>'])">Close</a>
    <input type="hidden" value="<?php echo $idf; ?>" name="val" />
    <input type="hidden" value="<?php echo $name1; ?>" name="cname" />
    <input type="hidden" value="<?php echo $loginsub; ?>" name="loginsub" />
    <input type="hidden" value="<?php echo $url1; ?>" name="url" />

    </form>

    </div>
    <?php }else{ ?>
    <div id="<?php echo $idf; ?>" style="width: 600px; height:200px; background:#CCCCCC;display:none">

    <textarea id="<?php echo "a".$idf; ?>" name="noise" class="widgEditor nothing" ><b>Only registered member can post comments.To register/login please click on Create Account below.</b></textarea>
    <a href="create-account.php"><font style="background-color:#A29D82;">Create Account</font></a>&nbsp;&nbsp;<a href="javascript:animatedcollapse.hide(['<?php echo $idf; ?>'])"><font style="background-color:#A29D82;">Close</font></a>


    </div>
    <?php } ?>
    </div></td>
    </tr>
    </table>
    <?php } ?>
    <table width="100%" border="0" cellspacing="0" cellpadding="1" style="border-top: 2px #FFFFFF solid;border-left: 2px #FFFFFF solid;border-right: 2px #FFFFFF solid">
    <br />
    </td>
    </tr>
    </table>
    <div style="text-align:left" class="petit"></div>
    <table style="width:100%" cellspacing="0" cellpadding="0">

    <tr>
    <td valign="bottom" align="center" bgcolor="#C5C0BC" style="font-size:18px; font-family:Georgia, 'Times New Roman', Times, serif;">
    <?php //crete a link to post main comment

    $value=base64_encode($fid); //primary key of topic
    //now we are getting the login primary key commenting user
    $sql="SELECT id from f_login where email='$linuser' || email='$luser'|| email='$cuser'|| email='$iuser' " ; //to get id from table
    $query1=mysql_query($sql);
    $row1=mysql_fetch_array($query1);
    $idlogin=$row1['id'];
    $Lvalue=base64_encode($idlogin); //login key of user
    //------------------------------now you get the id of user----------------------------------

    ?>
    Post your comment<a href="commentpage.php?Page=<?php echo $value; ?>&lvalue=<?php echo $Lvalue; ?>"><u>&nbsp;here</u></a></td>
    </tr>
    </table>
    <div style="text-align:right"></div>
    <div style="text-align:right">
    <div class="legend"></div>
    </div>
    </div>
    <?php include('includes/footer.php');?>

    </body>


    </html>








    Please help me. Any help is appreciated.

    i checked session id .it has value but session variable not working in the page.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •