Jump to content

peranha

Members
  • Posts

    878
  • Joined

  • Last visited

Everything posted by peranha

  1. <?php $c_avg =("SELECT AVG(a_concept) FROM '$tbl_name2' WHERE question_id='$id'"); $c_avg1=mysql_query($c_avg); echo ($c_avg1); $query_data1 = mysql_fetch_row($c_avg1); $avgrows = $query_data1[0]; echo "Average: $avgrows"; ?> Try that, but always open your php code with <?php not with <?
  2. I have had the best service with them so far, tried a couple of others, but they are the best to deal with as of yet for me.
  3. you need $module = $_GET['module'];
  4. It hashes what you put in, and compares that to a database.
  5. $query = "select * from users where `username` = '".$_POST['username']."' AND `password` = PASSWORD('".$pass."')"; $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error(); change your query to this and see what gets displayed.
  6. Yes, use his code, mine is not correct. I should have started the session at the beginning.
  7. <head> <title>Welcome To UltimateRavers.Net, Your Ultimate Online Raving Destiny!</title> <style type="text/css"> @import "stylesheet.css"; </style> <div align="center"> <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <table id="Table_01" width="851" height="736" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="11" background="images/Index_01.gif" width="850" height="6" alt=""></td> <td background="images/spacer.gif" width="1" height="6" alt=""></td> </tr> <tr> <td colspan="7" rowspan="2" background="images/Index_02.gif" width="672" height="28" alt=""></td> <td background="images/Untitled-1_03.gif" width="140" height="14" alt=""> <?php session_start(); echo "<p>Welcome, " . $_SESSION["valid_user"]; ?> </td> <td colspan="3" rowspan="2" background="images/Index_04.gif" width="38" height="28" alt=""></td> <td background="images/spacer.gif" width="1" height="14" alt=""></td> </tr> <tr> <td background="images/Index_05.gif" width="140" height="14" alt=""></td> <td background="images/spacer.gif" width="1" height="14" alt=""></td> </tr> <tr> <td colspan="2" rowspan="2" background="images/Index_06.gif" width="20" height="106" alt=""></td> <td colspan="7" background="images/Index_07.gif" width="807" height="99" alt=""></td> <td colspan="2" rowspan="2" background="images/Index_08.gif" width="23" height="106" alt=""></td> <td background="images/spacer.gif" width="1" height="99" alt=""></td> </tr> <tr> <td colspan="7" background="images/Index_09.gif" width="807" height="7" alt=""></td> <td> <img src="images/spacer.gif" width="1" height="7" alt=""></td> </tr> <tr> <td rowspan="7" background="images/Index_10.gif" width="16" height="595" alt=""></td> <td colspan="9" background="images/Untitled-1_11.gif" width="817" height="30" alt=""></td> <td rowspan="7" background="images/Index_12.gif" width="17" height="595" alt=""></td> <td background="images/spacer.gif" width="1" height="30" alt=""></td> </tr> <tr> <td colspan="9" background="images/Index_13.gif" width="817" height="14" alt=""></td> <td background="images/spacer.gif" width="1" height="14" alt=""></td> </tr> <tr> <td colspan="2" rowspan="5"> <img src="images/Index_14.gif" width="6" height="551" alt=""></td> <td colspan="2" background="images/Untitled-1_15.gif" width="141" height="186" alt=""> <a href="home.php"target="ur">Home</a> <br> <a href="tester.php" target="ur">Home</a> <br> <a href="home.html" target="ur">Home</a> <br> <a href="home.html" target="ur">Home</a> <br> <a href="home.html" target="ur">Home</a> <br> <a href="home.html" target="ur">Home</a> <br> <a href="home.html" target="ur">Home</a> <br> <a href="home.html" target="ur">Home</a> <br> <a href="home.html" target="ur">Home</a> <br> <a href="home.html" target="ur">Home</a> <br> <a href="home.html" target="ur">Home</a> <br> <a href="home.html" target="ur">Contact</a> <br> <a href="logout.php" target="ur">Logout</a> <br> </td> <td rowspan="5" background="images/Index_16.gif" width="28" height="551" alt=""></td> <td colspan="3" rowspan="4" background="images/Untitled-1_17.gif" width="636" height="515" alt=""> <iframe name="ur" width="636" height="515" src="home.php" frameborder="0" scrolling="yes" > </iframe> </td> <td rowspan="5" background="images/Index_18.gif" width="6" height="551" alt=""></td> <td background="images/spacer.gif" width="1" height="186" alt=""></td> </tr> <tr> <td colspan="2" background="images/Index_19.gif" width="141" height="58" alt=""></td> <td background="images/spacer.gif" width="1" height="58" alt=""></td> </tr> <tr> <td background="images/Untitled-1_18.gif" width="139" height="269" alt=""> Shoutbox Is Currently Being Created! </td> <td rowspan="3" background="images/Index_21.gif" width="2" height="307" alt=""></td> <td background="images/spacer.gif" width="1" height="269" alt=""></td> </tr> <tr> <td rowspan="2" background="images/Index_22.gif" width="139" height="38" alt=""></td> <td background="images/spacer.gif" width="1" height="2" alt=""></td> </tr> <tr> <td colspan="3" background="images/Index_23.gif" width="636" height="36" alt=""></td> <td background="images/spacer.gif" width="1" height="36" alt=""></td> </tr> <tr> <td background="images/spacer.gif" width="16" height="1" alt=""></td> <td background="images/spacer.gif" width="4" height="1" alt=""></td> <td background="images/spacer.gif" width="2" height="1" alt=""></td> <td background="images/spacer.gif" width="139" height="1" alt=""></td> <td background="images/spacer.gif" width="2" height="1" alt=""></td> <td background="images/spacer.gif" width="28" height="1" alt=""></td> <td background="images/spacer.gif" width="481" height="1" alt=""></td> <td background="images/spacer.gif" width="140" height="1" alt=""></td> <td background="images/spacer.gif" width="15" height="1" alt=""></td> <td background="images/spacer.gif" width="6" height="1" alt=""></td> <td background="images/spacer.gif" width="17" height="1" alt=""></td> <td></td> </tr> </table> </body> </html> just do the above.
  8. Is the file .htm, .php or what type?
  9. This should get it working <?php session_start(); // dBase file include "dbConfig.php"; if ($_GET["op"] == "login") { if (!$_POST["username"] || !$_POST["password"]) { die("You need to provide a username and password."); } // Create query $q = "SELECT * FROM `dbUsers` " ."WHERE `username`='".$_POST["username"]."' " ."AND `password`=PASSWORD('".$_POST["password"]."') " ."LIMIT 1"; // Run query $r = mysql_query($q); if ( $obj = @mysql_fetch_object($r) ) { // Login good, create session variables $_SESSION["valid_id"] = $obj->id; $_SESSION["valid_user"] = $_POST["username"]; $_SESSION["valid_time"] = time(); // Redirect to member page Header("Location: home.php"); } else { echo "<body bgcolor=\"#505050\" text=\"#000000\" link=\"#363636\" vlink=\"#363636\" alink=\"#d5ae83\">"; // Login not successful die("Sorry, You have enterd a wrong Username or Paswword please try again and be more carefull with your spelling!"); } } else { echo "<center>"; echo '<font size="2" face="verdana" color="#3d3d3d">'; echo "<form action=\"?op=login\" method=\"POST\">"; echo "Username: <input name=\"username\" size=\"15\"> "; echo "Password: <input type=\"password\" name=\"password\" size=\"15\"> "; echo "<input type=\"submit\" value=\"Login\">"; echo "</form>"; echo "</font>"; } ?> This will only output the body if there is an error. you cannot have header information output if there has already been an output which was being done with the body tag at the beginning.
  10. can we see login2.php code. Is something in there that is redirecting to login.htm?
  11. What are the files, and what are the name of the files, if the php portion is login.php, then login.htm is going to login.php which is correct. What is the issue? does it not go to login2.php
  12. Your form action is going to login.php <form action="login.php" method="POST"> is that supposed to be login2.php?
  13. I use Notepadd++, I have not used Microsoft Sharepoint before, so not sure if there is anything different. What SQL server were you using with Linux. If you were not connecting to a MS SQL server, then your queries will be different. MySQL $query = "SELECT * FROM table"; // get results of query above $result = mysql_fetch_array(mysql_query($query)); MS SQL $query = "SELECT * FROM table"; // get results of query above $result = mssql_fetch_array(mssql_query($query)); something along those lines.
  14. I dont believe there is anything different from a linux server. You just need to change queries if you are using MS SQL my mysql, or Postgre SQL. I am running both, windows as development, and Linux as my server, and I dont need to do anything different.
  15. Add a session line to create a session variable. <?php if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" $_SESSION['username'] = $myusername; //Added line session_register("myusername"); session_register("mypassword"); header("location:index1.php"); } ?> on all pages where you want the user name to display put this code. <?php echo $_SESSION['myusername']; ?>
  16. can we see the error, and possibly the code you are using.
  17. I would use 2 tables, and then use join statements to connect the 2. table 1 ID Rider table 2 ID Miles Rider_id Something along those lines is what I would do. if that is all you want to save. then you use sql SUM to count at the end of the month.
  18. Are you looking at a total for the month, or total for each day, and add at the end of the month? It can be done pretty easily either way.
  19. Do not double post, this is the same as your last post. Check that one for answers.
  20. <? session_start(); if(session_is_registered(myusername)){ header("location:index1.html"); } ?>
  21. $display has to be a number, not the words PAGE_DISPLAY
  22. Click on start, run type in 'services.msc' Look for something that says WAMP, Apache, or something like that, I dont use WAMP, I install apache, mysql, PHP separately, so I have Apache2.2 in my services that I set to automatic. right click it, and change startup to automatic.
  23. You should be able to set it to start at boot in your computer services.
  24. This is what I use to log visitors on a page visit. It will go on all pages, if you just wanted to log certain pages, you will just put it on certain pages. You will need to create a new table in your mysql database if that is what you are using, but this should get you started. <?php $visitURL = $_SERVER["PHP_SELF"]; $IPnumber = getenv("REMOTE_ADDR"); $Browser = $_SERVER["HTTP_USER_AGENT"]; $date = (date ("Y-m-d")); $time = (date ("H:i:s")); // open connection $connection = mysql_connect($server, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); // create query $query = "INSERT INTO page_vis (uservis, pagevis, ipadd, userbrows, date, time) VALUES ('$_SESSION[username]', '{$visitURL}', '{$IPnumber}', '{$Browser}', '{$date}', '{$time}')"; // execute query $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); // close connection mysql_close($connection); ?>
  25. You are saying that they second one works, and the first one doesnt? If that is the case, echo $name, and see if there is a value there.
×
×
  • 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.