Jump to content

Trekky1700

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Everything posted by Trekky1700

  1. Hi all, I'm having some trouble with a website I'm making. I want to add a button that users (logged in or not) can click to increase the score of a piece of content. How would I make it so that each person can only push the button once? Would I have to use cookies?
  2. Me and my friend are stumped as to how to do this. We want to make a subscription feature on our site, so that you can push subscribe on a user's profile and will be notified whenever he posts. Does anyone know a good way to go about this? Don't have to give me code, just if you can think of a concept.
  3. Thanks everyone for the help, ended up going through every scrap of code I had written prior, and it turened out to be a tiny spelling difference in another file associated to the login process. Sorry for wasting anyones time!
  4. Current Error Settings: ; display_errors ; Default Value: On ; Development Value: On ; Production Value: Off ; display_startup_errors ; Default Value: On ; Development Value: On ; Production Value: Off ; error_reporting ; Default Value: E_ALL & ~E_NOTICE ; Development Value: E_ALL | E_STRICT ; Production Value: E_ALL & ~E_DEPRECATED ; html_errors ; Default Value: On ; Development Value: On ; Production value: Off ; log_errors ; Default Value: On ; Development Value: On ; Production Value: On
  5. Ok, apperently none of the scripts on the page are running. I just tried filling out 1 out of the 2 boxes on my login, and it still displays blank. Here's my current code. <?php session_start(); session_regenerate_id (); include ("dbconnect.php"); $user=$_POST['username']; $pass=$_POST['password']; $title=$_POST['accounttype']; if(isset($user) && isset($pass)) { if (isset($_SESSION["logged_in_".$title]) && $_SESSION["logged_in_".$title] == $user) { echo $user.", you are already logged in.<BR><BR>"; exit; } $connection = new db(); $connection->connect(); $query = "SELECT username,password FROM ".$title." WHERE username='".$user."' AND password=sha1('".$pass."') "; $result = mysql_query($query) or die("An error occured while querying database, query: $query<br>" . mysql_error()); if(mysql_num_rows($result)>0) { $_SESSION["logged_in_".$title]=$user; header("Location:index.php"); } else { header("Location:register.php"); } $connection->close(); } else if ($user || $pass) { echo "Please fill in both fields."; } ?>
  6. No error was issued, it just keeps going to a blank screen (the login.php file). It does the same if I enter the wrong password too. Is there any other code I should include, such as the login box code or the database info?
  7. I tried it, it still didn't work. Does anyone know of any pre-built systems/tutorials that are good?
  8. Hi everyone, I'm having a problem with part of a login code. When I try to login, rather than redirecting to the index page like it's told, it just stays on the blank "login.php" file. Could some nice person tell me what I'm doing wrong? <?php session_start(); session_regenerate_id (); include ("dbconnect.php"); $user=$_POST['user']; $pass=$_POST['pass']; $title=$_POST['title']; if(isset($user) && isset($pass)) { if (isset($_SESSION["logged_in_".$title]) && $_SESSION["logged_in_".$title] == $user) { echo $user.", you are already logged in.<BR><BR>"; exit; } $connection = new db(); $connection->connect(); $result = mysql_query("SELECT username,password FROM mobagi_".$title." WHERE username='".$user."' AND password=sha1('".$pass."') "); if(!$result) { echo "An error occured while querying database"; exit; } if(mysql_num_rows($result)>0) { $_SESSION["logged_in_".$title]=$user; session_register("logged_in_".$title); header("Location:index.php"); } else { header("Location:index.php"); } $connection->close(); } else if ($user || $pass) { echo "Please fill in both fields."; } ?> Thanks
  9. I have no idea, I can give you a link to the tutorial I used parts of. http://www.designplace.org/scripts.php?page=1&c_id=25
  10. Hello, this is my first post. I have been using PHP for a few months now, and am working on my second PHP website. It's more of a test than anything, with databases. But I've run into a problem :'(. I've made a site where users can add "posts" to the database (think the site fmylife.com). I want results from the database to display in pages within the page, just like on the site. I used a tutorial for a php search that displays results from the database in pages, but can't get it to work. It implements well, but the pages won't change. Here's the code: <?php mysql_connect("l-------","-------"); mysql_select_db("--------"); $limit = '10'; $query = "select * from ------- order by date DESC"; $numresults = mysql_query ($query) or die ("Couldn't execute query: Reason; ".mysql_error()); $row_num_links_main =mysql_num_rows ($numresults); $row_count += $row_num_links; if(!isset($s)) $s=0; $query .= " LIMIT $s,$limit" ; $numresults = mysql_query ($query) or die ("Couldn't execute query: Reason; ".mysql_error()); while($row = mysql_fetch_array($numresults)) { echo "<tr><td class=td_main><table class=posts><tr><td width=93% class=tdsubmission>{$row['submission']}</td></tr> <tr class=tr_info><td>Submitted by {$row['nickname']} at {$row['date']}.</td> <td>Flags: {$row['flagged']}</td></tr></table>"; $count++ ; } $currPage = (($s/$limit) + 1); //break before paging echo "<br />"; // next we need to do the links to other results if ($s>=1) { // bypass PREV link if s is 0 $prevs=($s-$limit); print " <a href=\"$PHP_SELF?s=$prevs&q=$var\"><< Prev 10</a>&nbsp "; } // calculate number of pages needing links $pages=intval($row_num_links_main/$limit); // $pages now contains int of pages needed unless there is a remainder from division if ($row_num_links_main%$limit) { // has remainder so add one page $pages++; } // check to see if last page if (!((($s+$limit)/$limit)==$pages) && $pages!=1) { // not last page so give NEXT link $news=$s+$limit; echo " <a href=\"$PHP_SELF?s=$news&q=$var\">Next 10 >></a>"; } $a = $s + ($limit) ; if ($a > $row_num_links_main) { $a = $row_num_links_main ; } $b = $s + 1 ; echo "<p>Showing results $b to $a of $row_num_links_main</p>"; ?> Thank you in advance for any help/insight you can provide .
×
×
  • 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.