Jump to content

srinivas6203

Members
  • Posts

    53
  • Joined

  • Last visited

Everything posted by srinivas6203

  1. Hi this is also not working. I want to display error message as "your session expired" with login table, when user click back button after he logged out. thanq
  2. hi thanks for your reply. I tried your script but its not working. It show my previous page when click browser back button.
  3. hi Sorry for my english. I am doing one website. After user logged out. and click browser back button, it is displaying user previous pages. That means session was not destroy correctly. when click backbutton i want to display as "Your session expired. login again". How can i do this. Here is my code. <? session_start(); session_destroy(); header("location:index.php"); ?> $_SESSION['login_user'] is the session variable. Thanks in advance.
  4. Hi all I don't know this is silly question or not, but this is required for me. I am doing a social network website. In that persons send messages to each other. if persons write message as "askdhlasjdlkajsdlkjad asdasdk;askd asdkausdausdasd www.phpfreaks.com asdhkashdk". In this message www.phpfreaks.com is there. I want to display that www.phpfreaks.com as url. Can anyone tell me how can i do that. Thanks in advance.
  5. Hi I am doing a website using php. My problem is: there is textfield. If user enter into the textfield as 2 and onkeyup , 2 rows will be displayed and each one with delete button. This is working fine. But after i delete last record the field names (ex: first name, last name etc.,) are still appearing. I want to delete fieldnames after delete last record. Here is my code: <!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=iso-8859-1" /> <title>Untitled Document</title> <script type="text/javascript" language="javascript" src="clienthint.js"></script> <script> function deleteRow® { var i=0; var i=r.parentNode.parentNode.rowIndex; document.getElementById('invite_conf').deleteRow(i); } </script> </head> <body> <form> <input type="text" value="<? echo $numbers; ?>" onkeyup="showHint(this.value);"><br /> <span id="txtHint"></span> </form> </body> </html> clienthint.js // JavaScript Document var xmlHttp function showHint(str) { if (str.length==0) { document.getElementById("txtHint").innerHTML=""; return; } xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } var url="username.php"; url=url+"?q="+str; xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState==4) { document.getElementById("txtHint").innerHTML=xmlHttp.responseText; } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } username.php <?php $q = $_GET["q"]; if($q<2 || $q==0) { ?> <table border="1" id="invite_conf"> <tr><td align="center">First name</td><td align="center">Last name</td><td align="center">Email</td><td align="center">Telephone</td><td align="center"><input type="button" value="Delete" onclick="deleteRow(this)" style=" border:0px; font-weight:bold; width:50px; height:20px; background:#acbdee;"></td></tr> <? while($i<$q) { ?> <tr><td><input type="text" name="fname[]" size=12/></td> <td><input type="text" name="lname[]" size=12/></td> <td><input type="text" name="email[]" size=22 onblur="vemail(this)"/></td> <td><input type="text" name="phone[]" size=15 /></td> <td><input type="button" value="Delete" onclick="deleteRow(this)"></td> </tr> <? $i++; } } ?> </table> Please help me out.
  6. I want to export database values into spred sheets . But there is aproblem. By using .xls extension: In Linux , after save that file on desktop, if we double click on that file to open it shoot an error as following. (Cannot open 2008-06-20-10-44-17.xls The filename "2008-06-20-10-44-17.xls" indicates that this file is of type "Excel spreadsheet". The contents of the file indicate that the file is of type "plain text document". If you open this file, the file might present a security risk to your system. Do not open the file unless you created the file yourself, or received the file from a trusted source. To open the file, rename the file to the correct extension for "plain text document", then open the file normally. Alternatively, use the Open With menu to choose a specific application for the file. ) If file open, without save onto the desktop its working fine. On Windows its working fine. By using .csv extension: By using .csv extension, all are fine i.e, open and downloading. But the output was not taking table formate. If we write the following code for table design, <table border="1"> the above as it is code was displayed in output. But we want to display output of the above code into our desired output. I think the problem was coming with the extension. If it is .xls , not downloading into Linux. If it is .csv tables are not created. The following is the sample code: <?php session_start(); include "../../includes/user_functions.php"; if($_SESSION['adminlogin_user']) { <?php session_start(); include "../../includes/user_functions.php"; if($_SESSION['adminlogin_user']) { $csv_dt=date("Y-m-d-H-i-s"); $file_name = $csv_dt; if(strpos($HTTP_SERVER_VARS['HTTP_USER_AGENT'],'MSIE')) { header("Content-type: application/xls"); header('Content-Disposition: attachment; filename='.date('Y-m-d-H-i-s').'.xls'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); } else { header("Content-type: application/xls"); header('Content-Disposition: attachment; filename="'.$file_name.'.xls"'); } echo '<table border="1" width="100%" cellpadding="5" cellspacing="1"><tr bgcolor="black"><th align="left"><font color="white">Id</font></th><th align="left"><font color="white">From</font></th><th align="left"><font color="white">To</font></th></tr>'; $result = mysql_query("SELECT * FROM astcdr order by id DESC"); while($rs = mysql_fetch_array($result)) { echo '<tr><td align="left">'.$rs['id'].'</td><td align="left">'.$rs['accountcode'].'</td><td align="left">'.$rs['callednum'].'</td></tr>'; } echo '</table>'; } else { header('location:../../index.php'); } ?>
  7. My question is: I have the Pagination working beautifully, my only complaint is that in the future when there are a lot of submissions, it will display as [First] [Prev] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 [Next] [Last] Which is ok, but I would much rather it show up like Google results, by which I mean only lists a few pages in front of the current page. Like so [First] [Prev] 1 2 3 4 5 6 7 8 9 [Next] [Last] and if you are on page 4 [First] [Prev] 4 5 6 7 8 9 10 11 12 [Next] [Last] Unfortunatly for me, I have an idea how I could get this to work, but have not been able to get it right. How would this be done? Here is the code I have right now: if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"$self?page=$page\"><img src='Images/Prev.jpg' border='0' /></a> "; $first = " <a href=\"$self?page=1\"><img src='Images/First.jpg' border='0' /></a> "; } else { $prev = ' '; // we're on page one, don't print previous link $first = ' '; // nor the first page link } if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"$self?page=$page\"><img src='Images/Next.jpg' border='0' /></a> "; $last = " <a href=\"$self?page=$maxPage\"><img src='Images/Last.jpg' border='0' /></a> "; } else { $next = ' '; // we're on the last page, don't print next link $last = ' '; // nor the last page link } // print the navigation link echo "<table width='500' border='0' cellspacing='0' cellpadding='0'><tr><td width='100' height='50'>" . $first . "</td><td width='75' height='50'>" . $prev . "</td><td width='150' height='50'>" . $nav . "</td><td width='75' height='50'>" . $next . "</td><td width='100' height='50'>" . $last . "</td></tr></table><br>"; } }
  8. Hi i am new to php i have thousands of records in database table. I want to display 6o records per page. But the following code shows all the links. For example i have 6000 records. It is showing 100 page links. The page is fully occupied with those links. So i want to display those page links as 1 2 3 4 5 ........ n-5,n-4,n-3,n-2,n-1,n. I think phpfreaks using this type of method. Can any one gove code or modify my code. Here is my code: <html> <head> <title>Implementing Paging with next and prev</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php include 'library/config.php'; include 'library/opendb.php'; // how many rows to show per page $rowsPerPage = 2; // by default we show first page $pageNum = 1; // if $_GET['page'] defined, use it as page number if(isset($_GET['page'])) { $pageNum = $_GET['page']; } // counting the offset $offset = ($pageNum - 1) * $rowsPerPage; $query = "SELECT * FROM student LIMIT $offset, $rowsPerPage"; $result = mysql_query($query) or mysql_error('Error, query failed'); // print the random numbers while($row = mysql_fetch_array($result)) { echo $row['name'] . '<br>'; } echo '<br>'; // how many rows we have in database $query = "SELECT COUNT(*) AS numrows FROM student"; $result = mysql_query($query) or mysql_error('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; // how many pages we have when using paging? $maxPage = ceil($numrows/$rowsPerPage); // print the link to access each page $self = $_SERVER['PHP_SELF']; $nav = ''; for($page = 1; $page <= $maxPage; $page++) { if ($page == $pageNum) { $nav .= " $page "; // no need to create a link to current page } else { $nav .= " <a href=\"$self?page=$page\">$page</a> "; } } // creating previous and next link // plus the link to go straight to // the first and last page if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"$self?page=$page\">[Prev]</a> "; $first = " <a href=\"$self?page=1\">[First Page]</a> "; } else { $prev = ' '; // we're on page one, don't print previous link $first = ' '; // nor the first page link } if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"$self?page=$page\">[Next]</a> "; $last = " <a href=\"$self?page=$maxPage\">[Last Page]</a> "; } else { $next = ' '; // we're on the last page, don't print next link $last = ' '; // nor the last page link } // print the navigation link echo $first . $prev . $nav . $next . $last; // and close the database connection include 'library/closedb.php'; ?> </body> </html> Thanq very much
  9. Goto www.fpdf.org In that lot of pdf examples.
  10. Hi I am using php and mysql I am doing a website with authentication. If user, close the browser without logout, the session not destroyed. After sometime ,when the browser opened, the same user profile will be desplayed without asking login. Its happend on all browesers. Is there any way? thanq in advance.
  11. Hi i am using php and mysql. I want display total records cmpared on accountcode. The accountcode was getting from some table. The records are getting from another table with compare of accountcode. But there are so many accountcodes like 9000,9001,9002 etc. But the records are displayed only with use of single value (ex:9000 or 9001 etc) My code is as follows $sql_gcode=mysql_query("select * from table1 where uid='".$row_uid."' and tech='gtalk'"); while($row_gcode=mysql_fetch_array($sql_gcode)) { $user_gcode=$row_gcode['accountcode']; } $sql_gtalk=mysql_query("select * from table2 where accountcode='".$user_gcode."'"); while($row_gtalk=mysql_fetch_array($sql_gtalk)) { echo '<tr bgcolor="#cddeff"><td>'.$row_gtalk['id'].'</td><td>'.$row_gtalk['accountcode'].'</td><td>'.$row_gtalk['date_created'].'</td> </tr>'; } the accountcode's are 9000,9001,9002 etc are stored in $user_gcode. But the records are displayed only for single accountcode like (where accountcode='9000'). Cn anyone help me out. thanx in advance.
  12. Hi all I want display all the records from database by entering data into multiple text fields. I am using 5 input fields like username,source,destination,fromdate,todate. First i want to search username and source. For that i entered username as "peter" and source as "1234". For that the code as follows if(($_POST['username'])) && ($_POST['source'])) { $sql_query=mysql_query("select * from example where username='".$_POST['username']."' and source='".$_POST['source']."'"); while($row_query=mysql_query($sql_query)) { //print records } Now i want to search username,source,destination. For that i entered username as "peter" and source as "1234". For that the code as follows if(($_POST['username'])) && ($_POST['source']) && ($_POST['destination'])) { $sql_query=mysql_query("select * from example where username='".$_POST['username']."' and source='".$_POST['source']."' and destination='".$_POST['destination']."'"); while($row_query=mysql_query($sql_query)) { //print records } Next source,username,from date next todate,username,fromdate and some other fields the code was going so long. each time i am compare and write query for this. This was taken so much time. How can i search by using multiple input fields by easiest way. I am using php and mysql thanks in advance
  13. Hi i am doing sample website using php and mysql i want to send mail from localhost But mail didn't go from localhost After uploading to website that was going. I am using phpmailer until now Can u give anu suggestions or scripts. Thanq
  14. Hi all I am doing one website using php and mysql. I want to send e-greetings from one person to another person in that. So please send me scripts or url's. thanq
  15. Thanx for ur assistance. If u dont mind Can u send script in detail
  16. Hi all I want some add table rows script I want to add rows to the table based on the limit. Meamns there is a input field. If i enter in that field as 3 and click add rows, then 3 rows only will be add. If 2 , 2 rows will be add. Can u send me that script anyone. Thanx
  17. Yes u r correct. I want to shutdown and restart my pc only. Because this admin side. I can only use this features.
  18. Hi I am doing one website using php. I want to shutdown, restart pc when click "shtdown" and "restart" links. Is there any scripts for those in php or other languages. Kindly send me scripts or url's. Thanq
  19. There is any function to obtain the coordinates of a polygon
  20. Thank you very much to all guys. The problem was solved by using of ob_start() and ob_end_flush() thankyou
  21. Warning: Cannot add header information - headers already sent by (output started at c:\apache\htdocs\mysites\includes\header.php:9) in c:\apache\htdocs\netzgatecom1\user_check.php on line 60 I got this type of error frequently my script: <?php include "includes/config.php"; include "includes/header.php"; include "includes/contact_left.php"; ?> <style type="text/css"> .yregfloathelp { border: 1px solid black; /*padding: 5px 5 5 5px; */ background-color:#ffffff; text-align:center; color: black; width: 18em; font-size: 11px; font-family: arial, sans-serif; } </style> <div id="rightSide"><hr /> <div class="title2">.: User login</div> <div class="text2"><p> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr><td colspan="6" align="center"> <? extract($_POST); $lang_error = "<center>The following errors were found:</center><br>"; $lang_nouser = " <font color='#a10036'>You did not enter your username</font>"; $lang_usernotexist = " <font color='#a10036'>Username does not exist in our dtabase.</font>"; $error_colour = "red"; if (empty ($_POST['username_for'])) { $error = "1"; $info_error .= $lang_nouser . "<br>"; } $checkuser = "SELECT username FROM i_users WHERE username='$_POST[username_for]'"; $resultcheck = mysql_query($checkuser, $db_conn) or die ('query failed'); //if (mysql_num_rows($resultcheck) >0) $row=mysql_fetch_array($resultcheck); if($row['username']!=$_POST['username_for']) { $error = "1"; $info_error .= $lang_usernotexist. "<br>"; } else { $user=$_POST['username_for']; $_SESSION['user']=$user; } if ($error == "1") { $info_notice = "<span style=\"color: " . $error_colour . "; font-weight: bold;\">" . $lang_error . "</span><br>"; if (empty ($submit)) { $info_error = ""; $info_notice = $lang_notice; } } else { header('location:forgot2.php'); } ?> <form action="" method="post" name="c"> <table align="center" border="0" width="50%" cellpadding="0" cellspacing="0" style="border:1px solid #000000;"> <tr bgcolor="#525252"><td colspan="4" align="center"><b><font style="font-size:11px; color:white;">Confirm your Username</font></b></td></tr> <tr><td colspan="4"> </td></tr> <tr><td colspan="4" align="center"><?php echo $info_error ?></td></tr> <tr><td colspan="4"> </td></tr> <tr><td align="center">User Name </td> <td align="center"><sup><font color="red"><b>*</b></font></sup><input type="text" name="username_for" style="border: 1px solid black;width: 150px;background:white;font: 11px verdana, sans-serif;color:#443;padding:3px;margin-bottom:4px;outline:none;"> <!-- popup --> <font class="text" style="cursor:pointer;" onMouseOver="showRollTip('<b><div style=padding-bottom:0px><b></div>Enter correct user name. This is case sensitive.',event,'white', 275, null);" onMouseOut="hideRollTip()"><img src="images/help.gif" border="0" align="baseline" /> </font> <!-- popup end --> </td></tr> <tr align="center" valign="bottom"><td colspan="4"> </td></tr> <tr><td colspan="2" align="center"> <input type="submit" name="submit" value="submit" style="width:80px; font-size:11px; font-family:Arial, Helvetica; color:black; background:white; font-weight:bold; border:1px solid black;" /> </td></tr> <tr><td colspan="4"> </td></tr> </table> </form> </td></tr></table> </p> </div> </div> <? include "includes/footer.php"; ?> can any one help me
  22. Thanx for ur reply but its not working. Its persists the problem
  23. In authentication, when i click logout link the the form was logout. Again i click back button of browser the same user account was displayed and thats ready to change anything. I listed below my script <?php session_start(); session_unregister("login_user"); session_destroy(); header("Location:login.php"); ?> can anyone help me
×
×
  • 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.