Jump to content

DeanWhitehouse

Members
  • Posts

    2,527
  • Joined

  • Last visited

Everything posted by DeanWhitehouse

  1. i solved it , i had the mysql_close(); before the include for the nav_bar, therefore closing the connection the second i made it
  2. as i said, i can login on the home page, just not any of my other pages. so the connection is fine.
  3. is the host allowing out going mail?? not all do, if there not free.
  4. i am getting these errors when i try and login Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'crazyemochild'@'82.197.131.40' (using password: NO) in /home/www/mysitename.co.uk/nav_bar.php on line 86 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/www/mysitename.co.uk/nav_bar.php on line 86 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'crazyemochild'@'82.197.131.40' (using password: NO) in /home/www/mysitename.co.uk/nav_bar.php on line 87 Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/www/mysitename.co.uk/nav_bar.php on line 87 but i only get these errors when i try to login on certain pages??? i can login on the home page, but only that page. this is my code <div class="login"> <?php $server = str_replace("?logout","",$_SERVER['PHP_SELF']); ?> <table class="log_in"><form action="<?php echo "$server"; ?>" method="post"> <th>Welcome</th> <tr><td align="center">Username:</td></tr><tr><td align="center"><input type="text" name="user_name" size="16" value="<?php echo $_COOKIE['uname']; ?>" /><br /></td></tr> <tr><td align="center">Password:</td></tr><tr><td align="center"> <input type="password" name="user_password" size="16" value="<?php echo $_COOKIE['userpw'] ?>" /><br /></td></tr> <tr><td align="center"><input type="hidden" name="login" value="true"><input type="submit" value="Submit"></td></tr> <tr><td align="centre"><input type="checkbox" name="remember" <?php echo $_COOKIE['check'] ?>> Remember Me </td></tr><tr><td align="center"><a href="register.php">[Register]</a></td></tr><tr><td align="center"><a href="forgot_password.php">[Forgot Password?]</a></td></tr></table> </form> </div> <?php if ($_SESSION['is_valid'] == false) { if (isset($_POST['login'])) { $user_name = mysql_real_escape_string($_POST["user_name"]); $user_password = mysql_real_escape_string($_POST["user_password"]); $cookiename = forumcookie; $verify_username = strlen($user_name); $verify_pass = strlen($user_password); if ($verify_pass > 0 && $verify_username > 0) { $userPswd = md5($user_password); $userpwsd = sha1($userPswd); $sql = "SELECT * FROM $user WHERE user_name='$user_name' AND user_password='$userpwsd' LIMIT 1;"; $result = mysql_query($sql) or die(mysql_error() . " in $sql"); if (mysql_num_rows($result) == 1) { $row = mysql_fetch_assoc($result); $s_userpass = serialize($userpass); $_SESSION['id_username'] = $row['user_name']; $_SESSION['id_user_password'] = $row['user_password']; $_SESSION['user_level'] = $row['userlevel']; $_SESSION['user_id'] = $row['user_id']; $_SESSION['is_valid'] = true; if (isset($_POST['remember'])) { $checked = "checked='checked'"; setcookie("uname", $_SESSION['id_username'], time() + 86400*100); setcookie("userpw", $user_password, time() + 86400*100); setcookie("check",$checked, time() + 86400*100); mysql_close(); } header("Location:http://".$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI]); } else { echo "Login failed. Username or Password are not correct."; } } else { ?> <p><font style="font-size:small;">You left required field(s) blank</font></p> <?php } } } } ?> </div> </div> and this is the home page <?php require_once 'includes/header.php'; require_once 'includes/db_connect.php'; ?><div class="bg"></div> <div class="clock"><?php echo gmdate('l, jS F Y');?> <span id="txt"></span></div> <?php $filename = "install/instll.php"; if (file_exists($filename)) { ?><p class="exists"><br>Please remove the install.php file<br> and the install folder</p><?php } else { ?><p class="welcome"><?php echo"$welcome"; ?></p> <?php } require_once 'nav_bar.php'; require_once 'includes/footer.php'; ?> and this is the member page(this is where i got the error) <?php require_once 'includes/header.php'; require_once 'includes/db_connect.php'; ?><div class="bg"></div> <div class="clock"><?php echo gmdate('l, jS F Y');?> <span id="txt"></span></div> <div class="member"> <?php if ($_SESSION['is_valid'] == true){ if (isset($_GET['id'])) { if ((int) $_GET['id'] > 0) { require_once 'nav_bar.php'; $userid = $_GET['id']; $sql = "SELECT * FROM $user WHERE `user_id`='{$userid}' LIMIT 0,1;"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); $userprofname = $row['user_name']; $profemail = $row['user_email']; echo "$userprofname"; $show_email = $row['show_email']; if (mysql_num_rows($result) < 1) { echo 'This ID does not exist in the database<br>'; echo "<a href=\"members.php\">Return to Members Page</a>"; exit(); } if ($show_email == 1) { $email = "$profemail"; $email = explode('@',$email); echo '<br>Email:' ?> <a target="_blank" rel="external" href='javascript:window.location="mai"+"lto:"+"<?php echo $email[0]; ?>"+"@"+"<?php echo $email[1]; ?>";self.close();'onmouseover='window.status="mai"+"lto:"+"<?php echo $email[0]; ?>"+"@"+"<?php echo $email[1]; ?>"; return true;' onmouseout='window.status="";return true;'> Email Me</a> <?php } elseif ($show_email == 0) { echo "<br>Email: Hidden"; } exit(); } else { echo "Unknown User ID! <br />"; echo "<a href=\"members.php\">Return to Members Page</a>"; exit(); } } //No ID passed to page, display user list: $query = "SELECT user_id, user_name FROM $user"; $result = mysql_query($query) or die("Error:" . mysql_error()); if (mysql_num_rows($result) > 0) { echo "User List:<br />"; while ($row = mysql_fetch_assoc($result)) { echo '<a href="?id=' . $row['user_id'] . '">' . $row['user_name'] . '</a><br />'; } } } else { echo "Please login to view this page."; } ?> </div> <?php mysql_close(); require_once 'nav_bar.php'; require_once 'includes/footer.php'; ?> the nav_bar is where the login form is any other questions , please ask me
  5. here is a PM tutorial http://www.egmods.com/Main/Tutorials/php/intermediate/pms/index.php
  6. i have this pagination code, that is ment to display 1 user per page, but it doesn't work, it shows all the usernames but has page 1-3 but they all show the same data. There is also a number 7 at the top of the area where the pagination is. this is my pagination code, if (!(isset($pagenum))) { $pagenum = 1; } $data = mysql_query("SELECT * FROM $user") or die(mysql_error()); $rows = mysql_num_rows($data); $page_rows = 1; $last = ceil($rows/$page_rows); if ($pagenum < 1) { $pagenum = 1; } elseif ($pagenum > $last) { $pagenum = $last; } $max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows; $data_p = mysql_query("SELECT * FROM $user $max") or die(mysql_error()); while($info = mysql_fetch_array( $data_p )) { Print $info['user_id']; echo "<br>"; } echo "<p>"; echo " --Page $pagenum of $last-- <p>"; if ($pagenum == 1) { } else { echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1'> <<-First</a> "; echo " "; $previous = $pagenum-1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$previous'> <-Previous</a> "; } echo " ---- "; if ($pagenum == $last) { } else { $next = $pagenum+1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$next'>Next -></a> "; echo " "; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last'>Last ->></a> "; } and this is where i tried implementing it <?php require_once 'includes/header.php'; require_once 'includes/db_connect.php'; ?><div class="bg"></div> <div class="clock"><?php echo gmdate('l, jS F Y');?> <span id="txt"></span></div> <div class="member"> <?php if ($_SESSION['is_valid'] == true){ if (isset($_GET['id'])) { if ((int) $_GET['id'] > 0) { require_once 'nav_bar.php'; $userid = $_GET['id']; $sql = "SELECT * FROM $user WHERE `user_id`='{$userid}' LIMIT 0,1;"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); $userprofname = $row['user_name']; $profemail = $row['user_email']; echo "$userprofname"; $show_email = $row['show_email']; if (mysql_num_rows($result) < 1) { echo 'This ID does not exist in the database<br>'; echo "<a href=\"members.php\">Return to Members Page</a>"; exit(); } if ($show_email == 1) { echo '<br>Email:<a href="mailto:'.$profemail.'"> Email Me</a>'; } elseif ($show_email == 0) { echo "<br>Email: Hidden"; } exit(); } else { echo "Unknown User ID! <br />"; echo "<a href=\"members.php\">Return to Members Page</a>"; exit(); } } //No ID passed to page, display user list: $query = "SELECT user_id, user_name FROM $user"; $result = mysql_query($query) or die("Error:" . mysql_error()); if (mysql_num_rows($result) > 0) { echo "User List:<br />"; while ($row = mysql_fetch_assoc($result)) { echo '<a href="?id=' . $row['user_id'] . '">' . $row['user_name'] . '</a><br />'; } } } else { echo "Please login to view this page."; } ?> </div> <?php mysql_close(); require_once 'nav_bar.php'; require_once 'includes/footer.php'; ?> this is the exact area //No ID passed to page, display user list: $query = "SELECT user_id, user_name FROM $user"; $result = mysql_query($query) or die("Error:" . mysql_error()); if (mysql_num_rows($result) > 0) { echo "User List:<br />"; while ($row = mysql_fetch_assoc($result)) { echo '<a href="?id=' . $row['user_id'] . '">' . $row['user_name'] . '</a><br />'; } } } if i'm not explaining properly just say
  7. i managed to find a way around it, thanks for the replys
  8. on, members.php, everything that should show does, but on members.php?id=19, only the requires above the code are shown
  9. when i click on a members ID the navigation bar dissapears, the URL goes from members.php to members.php?id=18 this is my code <?php require_once 'includes/header.php'; require_once 'includes/db_connect.php'; ?><div class="bg"></div> <div class="clock"><?php echo gmdate('l, jS F Y');?> <span id="txt"></span></div> <div class="member"> <?php if ($_SESSION['is_valid'] == true){ if (isset($_GET['id'])) { if ((int) $_GET['id'] > 0) { $userid = $_GET['id']; $sql = "SELECT * FROM $user WHERE `user_id`='{$userid}' LIMIT 0,1;"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); $userprofname = $row['user_name']; $profemail = $row['user_email']; echo "$userprofname<br>"; $show_email = $row['show_email']; if (mysql_num_rows($result) < 1) { echo 'This ID does not exist in the database'; exit(); } if ($show_email == 1) { echo 'Email:<a href="mailto:'.$profemail.'"> Email Me</a>'; } elseif ($show_email == 0) { echo "Email: Hidden"; } exit(); } else { echo "Unknown User ID! <br />"; echo "<a href=\"members.php\">Return to Members Page</a>"; exit(); } } //No ID passed to page, display user list: $query = "SELECT user_id, user_name FROM $user"; $result = mysql_query($query) or die("Error:" . mysql_error()); if (mysql_num_rows($result) > 0) { echo "User List:<br />"; while ($row = mysql_fetch_assoc($result)) { echo '<a href="?id=' . $row['user_id'] . '">' . $row['user_name'] . '</a><br />'; } } } else { echo "Please login to view this page."; } ?> </div> <?php mysql_close(); require_once 'nav_bar.php'; require_once 'includes/footer.php'; ?>
  10. i tried this way , and it didn't work <?php $email = "admin@randomgamedesign.uk.tt"; $email = explode($email, '@'); ?> <span style="float: right; text-align: right;"><a target="_blank" rel="external" href='javascript:window.location="mai"+"lto:"+"<?php echo $email[0]; ?>"+"@"+"<?php echo $email[1]; ?>";self.close();' ;return true;'>Email </a></span> so i think i will have to try this way, and have two input boxes one for "email" and another for "hotmail.com". Unless anyone knows a better way to reduce spam.
  11. ok, so it is now working with this code, <?php require_once 'includes/header.php'; require_once 'includes/db_connect.php'; ?><div class="bg"></div> <div class="clock"><?php echo gmdate('l, jS F Y');?> <span id="txt"></span></div> <div class="member"> <?php if ($_SESSION['is_valid'] == true){ if (isset($_GET['id'])) { if ((int) $_GET['id'] > 0) { $userid = $_GET['id']; $sql = "SELECT * FROM $user WHERE `user_id`='{$userid}' LIMIT 0,1;"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); $userprofname = $row['user_name']; $profemail = $row['user_email']; echo "$userprofname<br>"; $show_email = $row['show_email']; if (mysql_num_rows($result) < 1) { echo 'This ID does not exist in the database'; } if ($show_email == 1) { echo 'Email:<a href="mailto:'.$profemail.'"> Email Me</a>'; } elseif ($show_email == 0) { echo "Email: Hidden"; } exit(); } else { echo "Unknown User ID! <br />"; echo "<a href=\"members.php\">Return to Members Page</a>"; exit(); } } //No ID passed to page, display user list: $query = "SELECT user_id, user_name FROM $user"; $result = mysql_query($query) or die("Error:" . mysql_error()); if (mysql_num_rows($result) > 0) { echo "User List:<br />"; while ($row = mysql_fetch_assoc($result)) { echo '<a href="?id=' . $row['user_id'] . '">' . $row['user_name'] . '</a><br />'; } } } else { echo "Please login to view this page."; } ?> </div> <?php mysql_close(); require_once 'nav_bar.php'; require_once 'includes/footer.php'; ?> but it is still showing the Email: Hidden
  12. ok, i tried this , but it still does the same <?php require_once 'includes/header.php'; require_once 'includes/db_connect.php'; ?><div class="bg"></div> <div class="clock"><?php echo gmdate('l, jS F Y');?> <span id="txt"></span></div> <div class="member"> <?php if ($_SESSION['is_valid'] == true){ if (isset($_GET['id'])) { if ((int) $_GET['id'] > 0) { $userid = $_GET['id']; $sql = "SELECT * FROM $user WHERE `user_id`='{$userid}' LIMIT 0,1;"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); $userprofname = $row['user_name']; $profemail = $row['user_email']; echo "$userprofname<br>"; $show_email = $row['show_email']; if ($show_email == 1) { echo 'Email:<a href="mailto:'.$profemail.'"> Email Me</a>'; } elseif ($show_email == 0) { echo "Email: Hidden"; } exit(); } } //No ID passed to page, display user list: $query = "SELECT user_id, user_name FROM $user"; $result = mysql_query($query) or die("Error:" . mysql_error()); if (mysql_num_rows($result) < 1) { echo 'This ID does not exist in the database'; echo "<a href=\"members.php\">Return to Members</a>"; }if (mysql_num_rows($result) > 0) { echo "User List:<br />"; while ($row = mysql_fetch_assoc($result)) { echo '<a href="?id=' . $row['user_id'] . '">' . $row['user_name'] . '</a><br />'; } } } else { echo "Please login to view this page."; } ?> </div> <?php mysql_close(); require_once 'nav_bar.php'; require_once 'includes/footer.php'; ?>
  13. yer, i think i understand, i can replace this $email = "admin@randomgamedesign.uk.tt"; with $email = "something_from_mydatabase_using_a_query";
  14. i have this code for a members page, and when someone enters an invalid URL with an id that doesn't exist it should echo a message, but it doesn't work, it just says email: hidden. any ideas <?php if ($_SESSION['is_valid'] == true){ if (isset($_GET['id'])) { if ((int) $_GET['id'] > 0) { $userid = $_GET['id']; $sql = "SELECT * FROM $user WHERE `user_id`='{$userid}' LIMIT 0,1;"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); $userprofname = $row['user_name']; $profemail = $row['user_email']; echo "$userprofname<br>"; $show_email = $row['show_email']; if ($show_email == 1) { echo 'Email:<a href="mailto:'.$profemail.'"> Email Me</a>'; } elseif ($show_email == 0) { echo "Email: Hidden"; } exit(); } else { echo "Invalid user! <br />"; echo "<a href=\"members.php\">Return to Members</a>"; exit(); } } //No ID passed to page, display user list: $query = "SELECT user_id, user_name FROM $user"; $result = mysql_query($query) or die("Error:" . mysql_error()); if (mysql_num_rows($result) > 0) { echo "User List:<br />"; while ($row = mysql_fetch_assoc($result)) { echo '<a href="?id=' . $row['user_id'] . '">' . $row['user_name'] . '</a><br />'; } } } else { echo "Please login to view this page."; } ?>
  15. near the same thing but this is for a user profile, it is so they don't recieve spam mail, but i can't see how to change href='javascript:window.location="mai"+"lto:"+"admin"+"@"+"randomgamedesign.uk.tt";self.close(); so it is an email from my database.
  16. this is a code i found in a template system <span style="float: right; text-align: right;"><a target="_blank" rel="external" href='javascript:window.location="mai"+"lto:"+"admin"+"@"+"randomgamedesign.uk.tt";self.close();' onmouseover='window.status="mai"+"lto:"+"admin"+"@"+"randomgamedesign.uk.tt"; return true;' onmouseout='window.status="";return true;'>Email </a></span> how can i use this code or something similar so you can only email them, and not see there email when you mouseover?
  17. yer, that was a mistake, i have now got it at 30 but and still having the same error
  18. ok, i tried the wordwrap code, and it doesn't seem to apply wrap to the second line. $intro = "Welcome, this is a test of the sites features.Please go to the admin centre to cutomise the site.TEXTTEXTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXTTEXT"; $welcome = wordwrap($intro, 60, "<br />\n"); <p class="welcome"><?php echo"$welcome"; ?></p>
  19. you get this error Parse error: syntax error, unexpected $end in /home/content/e/v/e/everkleen/html/testforum/forum/usrsignup.php on line 57 on this page http://www.everkleen.biz/testforum/forum/usrsignup.php
  20. this is the site, you can see that it isn't working and what it is doing wrong. http://deanwhitehouse.awardspace.co.uk/home.php with ********* it does what you see on the page, and if i use words like "thisistext" it does work, why is this??
  21. this is what i get showen when i sign-up. i am not using a real email address, or am i using @ in the address, i am just using a word.
×
×
  • 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.