Jump to content
Old threads will finally start getting archived ×

GreenUser

Members
  • Posts

    50
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

GreenUser's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks everyone! Yes, it would make sense to center it and brighten up the colours a tad. Good point on the heart ratio and the font. I do not have a test log in set up. I'm thinking (in addition to the provided comments) to turn it into a forum, providing comments too. Right now, the user can't edit or delete a post they made. As far as additional features go,... polls and a message system for the users might be a good idea. I'll post back when I have an update! Thanks!
  2. Good Afternoon! Q: What's the difference between an introvert programmer and an extrovert programmer? A: The extrovert looks at your shoes when they are talking! Thought that might be a good joke while those interested take a look at my site! http://rateyourdate.cc/ Thanks!
  3. Hi Freaks, I thought about taking a club to some of the boys at MS for constantly pissing me off but I thought I'd give this a chance first. Anyway, this page runs fine on my computer locally and on my server with Firefox. It also runs fine with IE7 locally on my computer, however the log in attempt fails when trying to do so with IE7 on my server. It is redirected by the first header, and takes me to the index.php page, but the session variables return false, displaying the index.php page as normal. I have made a check adding an else after the if(isset($_SESSION['USERNAME']) == TRUE) { } bit, and it returns false. Again, this problem only occurs in IE7. Simple script too. Here is my login.php <?php session_start(); require('db.php'); if($_POST['submit']) { $sql = "SELECT * FROM logins WHERE username = '".$_POST['username']."' AND password = '".$_POST['password']."';"; $result = mysql_query($sql) or die(mysql_error()); $numrows = mysql_num_rows($result); if($numrows == 1) { $row = mysql_fetch_assoc($result); session_register("USERNAME"); session_register("USERID"); $_SESSION['USERNAME'] = $row['username']; $_SESSION['USERID'] = $row['id']; header("Location: " . $con_dir . "/index.php"); exit(); } else { header("Location: " . $con_dir . "/login.php?error=1"); exit(); } } else { require('header.php'); if($_GET['error']) { echo "Incorrect login, please try again!"; } } ?> <form action="<?php echo $SCRIPT_NAME; ?>" method="post"> <table> <tr> <td><strong>Username</strong></td> <td><input type="text" name="username" style="background:#eeeeee"></td> </tr> <tr> <td><strong>Password</strong></td> <td><input type="password" name="password" style="background:#eeeeee"></td> </tr> <tr> <td></td> <td><input type="submit" name="submit" value="Login!"></td> </tr> </table> </form> <?php require('footer.php'); ?> Here is my index.php <?php session_start(); require('db.php'); require('header.php'); echo "<table><tr><td valign='top'>"; echo "<img src='name.jpg' style='border: none;'></td> <td valign='top' align='right'><h3><a href='form.php'>Contact</a></h3>"; echo "</td></tr><tr><td colspan='3'><hr></td></tr><tr>"; $catsql = "SELECT * FROM categories;"; $catresult = mysql_query($catsql); while($catrow = mysql_fetch_assoc($catresult)) { $sql = "SELECT * FROM gallery WHERE cat_id = " . $catrow['id'] . " ORDER BY RAND() LIMIT 1;"; $result = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_assoc($result); if ($i == 2) { print '</tr><tr>'; $i = 0; } $i++; echo "<td> "; echo "<strong><a href='gallery.php?id=" . $catrow['id'] . "'>" . $catrow['cat'] . "</strong><br>"; echo "<img src='./art/".$row['image']."' width='250' height='250'></a>"; if(isset($_SESSION['USERNAME']) == TRUE) { echo "<br>[<a href='deletecategory.php?id=".$catrow['id']."'><strong>Delete Gallery</strong></a>] "; } echo "</td>"; } if(isset($_SESSION['USERNAME']) == TRUE) { echo "<tr><td colspan='3'><hr></td></tr>"; echo "<tr><td><strong>Welcome XXX!</strong></td></tr>"; echo "<tr><td><strong>[<a href='category.php'>Add a category</a>]</strong></td>"; echo "<td><strong>[<a href='newitem.php'>Add an item</a>]</strong></td></tr>"; echo "<tr><td><strong>[<a href='contact.php'>Messages</a>]</strong></td>"; echo "<td><strong>[<a href='logout.php'>Logout</a>]</strong></td></tr>"; } echo "</table>"; require('footer.php'); ?> Thanks for reading.
  4. Oops, I thought I had it, sorry.
  5. You could do the same ... <meta name="<?php echo $config_keyword; ?>" content="<?php echo $config_description; ?>"> I would just use something like this, make a header file, then use it in in all of your files. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head> <meta name="Milk" content="Moo, Moo, Moo!"> <title>Milk Jugs</title> <link href="ss.css" rel="stylesheet" type="text/css" /> <body> <div id="main"> Using variables is nice too, but if you have it all in one file, like config.php or header.php it is easier to modify. <?php require('header.php'); ... content goes here ... ?>
  6. What's up? I have something like this in my config files. Then have that file required before the html code. <?php $sitename = "My Web Site"; ?> Then for the title ... <title><?php echo $sitename; ?></title> I keep the html header stuff in another file called header, which I require on every page. Hope it helps.
  7. There are plenty of tutorials if you google "php search engine" or "script". Of course, I've tried a couple and they can be quite lengthy.
  8. if(mysql_num_rows($result)==1){ while($row=mysql_fetch_assoc($result)){ $row['userlevel'] != $user; echo " YOU DO NOT HAVE ACCESS"; exit; } Well, I think this might help. Without the ! and if the values are correct it will always stop at this part of the if statement.
  9. Wow, after all that googling it was right here at home base. This looks good too, thank you sir fear
  10. Hi all, Will all hosting services that host php also support smtp and pop3? I assume that since mysql is the database of choice for most php users, they will support mysql. Any suggestions on hosting services for these three? I'd like to pay a professional service for this and not one of those free sites. Thanks!
  11. With you answer came clarity and understanding, thank you shimmyshine
  12. When the poster has no votes, it will show the appropriate message. If they have one vote, the result will not show. If they have multiple votes, they will all show but the first vote will not. In it's place will be resource id #13, any guesses? Cheers <?php require("db.php"); require("header.php"); $sql = "SELECT * FROM stories WHERE user_id = " . $_SESSION['SESS_USERID'] . ";"; $result = mysql_query($sql) OR die(mysql_error()); $row = mysql_fetch_assoc($result); echo "$result"; if($row == 0) { echo "<h1>No Votes</h1>"; echo "You have not posted any votes."; } else { while($row = mysql_fetch_assoc($result)) { echo "<strong><a href='viewstory.php?id=".$row['id']."'> <p>You voted ".$row['nagel']."</p></p></a></strong>"; $avgsql = "SELECT COUNT(id) AS number, AVG(rating) AS avg FROM ratings WHERE story_id = ".$row['id'].";"; $avgresult = mysql_query($avgsql) OR die(mysql_error()); $avgrow = mysql_fetch_assoc($avgresult); echo "<p>"; echo "<strong>Users Rating</strong>: "; if($avgrow['number'] == 0) { echo "No Ratings!"; } else { $a = (round($avgrow['avg'] * 2) / 2) . "<br>"; $a *= 10; if($a%5 == 0 && $a%10 != null) { $range = ($a / 10) - 0.5; } else { $range = $a / 10; } for($i=1;$i<=$range;$i++) { echo "<img src='" . $config_basedir . "/img/hfull.png'>"; } if($a%5 == 0 && $a%10 != null) { echo "<img src='" . $config_basedir . "/img/hhalf.png'>"; } $a = $a / 10; $remain = 10 - $a; for($r=1;$r<=$remain;$r++) { echo "<img src='" . $config_basedir . "/img/hnone.png'>"; } } } } require('footer.php'); ?>
  13. Hi and welcome, let's see if this helps If it is this line you are referring to, else //(!$username == $row['customer_name']); I would change it to else (!$username == $row['customer_name']);
  14. Bump Here is what the code looks like now. When the page is displayed, every image from anyone who has posted a story, will display with each story. The only image I want to display next to each story is from the one who posted it. Most of the code is at the bottom, marked off where the join statement starts. I have another join which I have commented out right above to try it differently. Two tables, stories and users are pulled. I only need the 'image' column from the users table. This is a mess. lol <?php require("db.php"); session_register("SESS_PARENT"); session_register("SESS_CHILD"); if(isset($_GET['parentcat']) && isset($_GET['childcat'])) { if(is_numeric($_GET['parentcat'])) { $_SESSION['SESS_PARENT'] = $_GET['parentcat']; } if(is_numeric($_GET['childcat'])) { $currentcat = $_GET['childcat']; $_SESSION['SESS_CHILD'] = $_GET['childcat']; } } else if(isset($_GET['parentcat'])) { if(is_numeric($_GET['parentcat'])) { $currentcat = $_GET['parentcat']; $_SESSION['SESS_PARENT'] = $_GET['parentcat']; $_SESSION['SESS_CHILD'] = 0; } } else { $currentcat = 0; } require("header.php"); $hotsql = "SELECT * FROM stories ORDER BY RAND() LIMIT 1;"; $hotresult = mysql_query($hotsql); $hotrow = mysql_fetch_assoc($hotresult); $avgsql = "SELECT COUNT(id) AS number, AVG(rating) AS avg FROM ratings WHERE story_id = " . $hotrow['id'] . ";"; $avgresult = mysql_query($avgsql); $avgrow = mysql_fetch_assoc($avgresult); echo "<strong><a href='viewstory.php?id=".$hotrow['id']."'> <p>".$hotrow['username']." xxx ".$hotrow['nagel']."</p></p></a></strong>"; echo "<p>"; echo "<strong>Users Rating</strong>: "; if($avgrow['number'] == 0) { echo "No Ratings!"; } else { $a = (round($avgrow['avg'] * 2) / 2) . "<br>"; $a *= 10; if($a%5 == 0 && $a%10 != null) { /// line 38 $range = ($a / 10) - 0.5; } else { $range = $a / 10; } for($i=1;$i<=$range;$i++) { echo "<img src='" . $config_basedir . "/img/hfull.png'>"; } if($a%5 == 0 && $a%10 != null) { echo "<img src='" . $config_basedir . "/img/hhalf.png'>"; } $a = $a / 10; $remain = 10 - $a; for($r=1;$r<=$remain;$r++) { echo "<img src='" . $config_basedir . "/img/hnone.png'>"; } } echo "<p>" . $hotrow['body'] . "</p>"; echo "<strong><a href='viewstory.php?id=".$hotrow['id']."'>Rate this date</a></strong>"; echo "</div>"; /// echo "<div id=main2>"; if($currentcat == 0) { $sql = "SELECT * FROM stories ORDER BY dateposted DESC LIMIT 10;"; } else { $parentsql = "SELECT parent FROM categories WHERE id = " . $currentcat . ";"; $parentres = mysql_query($parentsql); $parentrow = mysql_fetch_assoc($parentres); if($parentrow['parent'] == 1) { $sql = sprintf("SELECT stories.* FROM stories INNER JOIN cat_relate ON stories.cat_id = cat_relate.child_id WHERE cat_relate.parent_id = %d UNION SELECT stories.* FROM stories WHERE stories.cat_id = %d;" , $currentcat, $currentcat); } else { $sql = "SELECT * FROM stories WHERE cat_id = ".$currentcat.";"; } } $result = mysql_query($sql); $numrows = mysql_num_rows($result); if($numrows == 0) { echo "<h1>No Stories</h1>"; echo "<p>There are currently no stories in this category. </p>"; } else { while($row = mysql_fetch_assoc($result)) { if($_SESSION['SESS_USERLEVEL'] == 9) { echo "<a href='deletestory.php?id=" . $row['id'] . "'>[X]</a> "; } $avgsql = "SELECT SUM(fri + fun + soh + con + sma + sex + hyg + mes + aut + est) AS score FROM stories WHERE id = " . $row['id'] . ";"; $avgresult = mysql_query($avgsql); $avgrow = mysql_fetch_assoc($avgresult); ////////////////////////////////////////////////////////////////////////////// /// $imgsql = "SELECT username FROM stories LEFT JOIN users ON (stories.username = users.image)"; $imgsql = "SELECT stories.username, users.image "." FROM stories, users "." WHERE (stories.username = users.username)"; $imgres = mysql_query($imgsql) or die(mysql_error());; $imgrows = mysql_num_rows($imgres); if($imgrows == 0) { echo "No Image<br>"; } while($imgrows = mysql_fetch_assoc($imgres)) { if(empty($imgrows['image'])) { echo "<img src='./userimg/dummy.jpg' width=100 height=100 alt='" . $imgrows['name'] . "'>"; } else { echo "<img src='./userimg/" . $imgrows['image'] . "' width=100 height=100 alt='" . $imgrows['name'] . "'>"; } } echo"<a href='viewstory.php?id=".$row['id']."'> Somewhere in ".$row['location']."<strong> ".$row['username']."</strong> xxx <strong>".$row['nagel']."</a></strong> <font color=red><b>".$avgrow['score']." % </b></font><p>"; } } require("footer.php"); ?>
  15. See if this will change anything. if(!isset($_SESSION['CustID'])) { echo "<a href='login.php'>Login</a>"; } else { echo "<a href='logout.php'>Logout</a>"; }
×
×
  • 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.