Jump to content

c-o-d-e

Members
  • Posts

    127
  • Joined

  • Last visited

    Never

About c-o-d-e

  • Birthday 06/10/1993

Profile Information

  • Gender
    Male
  • Location
    Kingston Upon Hull

c-o-d-e's Achievements

Member

Member (2/5)

0

Reputation

  1. The title is pretty simple. If I have a background image, with a border which is curved on the corners. (curvy corners) How do I get it so the excess background image isn't shown, or is curved.
  2. Genesis730 What you tried before still sent the emails without correct username and password. However, wildteen88 that is an excellent example. Though it still does the same as Genesis730! It's confusing me. if($username > 0 && $email > 0) { $query = mysql_query("SELECT * FROM Users WHERE Username = '$username' AND Email = '$email' LIMIT 1") or trigger_error("Query failed: ".mysql_error()); // if no rows was returned, the display an error. Username/email does not exist if(mysql_num_rows($query) == 0) { $error['uspa'] = 'The Username/Email address provided does not exist'; } else { // A match was found, reset the password for the given username here } } And I do have "if(!isset($error)){" before the password reset part too.
  3. if($username > 0 && $email > 0){ $query = mysql_query("SELECT * FROM Users WHERE Username = '$username'") or trigger_error("Query failed: ".mysql_error()); if(mysql_num_rows($query) > 0) { $row = mysql_fetch_array($query); if($username == $row['Username']) {} else { $error['username'] = '<span style="color:red;">The entered Username is not registered!</span>'; } elseif($email == $row['Email']) {} else { $error['email'] = '<span style="color:red;">The entered Email is not the registered email!</span>'; } } } There is an unexpected elseif. If I remove the elseif and just use if. It then happens if I enter the WRONG email address associated with the Username. It resets my password and sends an email to that address, and even with the wrong Username AND Email. It still sends!
  4. You are using two Else statements within an If statement, it causes an unexpected else. I understand you said it may not be correct syntax. I can't figure out the correct syntax though! Can you help? Also, with the query too.. can you help with that? Thanks.
  5. I have this code, you may of seen it in the other thread of mine. I made a tiny bit of changes. If both username and email have been entered, it checks if there is a row with the entered username. If there is, it checks if the email is registered with the username. If there is no row with the entered username, it should create the error. Instead, it carries on with the process. if($username > 0 && $email > 0){ $query = mysql_query("SELECT * FROM Users WHERE Username = '$username'") or trigger_error("Query failed: ".mysql_error()); if(mysql_num_rows($query) > 0) { $row = mysql_fetch_array($query); if($email == $row['Email']){}else{ $error['email'] = '<span style="color:red;">The entered Email is not the registered email!</span>'; } } else { $error['username'] = '<span style="color:red;">The entered Username is not registered!</span>'; } } However, with the following code at the bottom its suppose to update the database. Although using an invalid username, it shouldn't be able to do the query. It should fail. Though.. it continues with the success note. Even though it has an if statement so that if the query failed, it would not work. Yet it works, but nothing changes in the database as there isn't a row with that user! I don't see why!! Here is the querys etc. $query = mysql_query("UPDATE Users SET Password = '$pass' WHERE Username = '$username'") or trigger_error('Query failed: '. mysql_error()); $send = mail($email , "Password Reset Request" , "You have applied for a new password at Developers Community\n\nYour Username and New Password are below, Please change your Password when you login!\n\nUser: ".$username."\nPass: ".$pwd."\n\nIf you did not request a New Password, please change your Password and if this continues to happen then please contact us.\n\nPlease do not reply, this is an automated mailer.\n\nThanks", "FROM: no-reply@developers-community.com"); if(($query)&&($send)){ $success['complete'] = '<span style="color:red;">Your New Password has been sent to your Email Address. The Email could be in your Junk. If you do not recieve the email, please contact us.</span>'; }
  6. Oh! Update: I had an error call above the form for Password, it should be Email. Thats why nothing happened. When I type in my exact email address that I registered the account with. It comes up as "The entered Email is not the registered email!" Even though its correct! AND where i has {}{ for the email, Should be {}else{
  7. $query = mysql_query("SELECT * FROM Users WHERE Username = '$username'") or trigger_error("Query failed: ".mysql_error()); if(mysql_num_rows($query) > 0) { $row = mysql_fetch_array($query); if($email == $row['Email']){}{ $error['email'] = 'The entered Email is not the registered email!'; } } else { if($username > 0){ $error['username'] = 'The entered Username is not registered!'; } } If there is a row, it checks if the email matches the email of the registered username thats entered, if it matches then no error, so it carries on. If it does not match, report the error, else if there isn't a row by the entered username, and the username has more than 1 character to report the error that its not registered. I changed it so that I am only using mysql_real_escape_string() and I have now put in the single quotes where needed. I just set the error reporting to E_ALL, although in my php.ini it is always set as on. Although with the error reporting set to E_ALL, it doesn't give me any other error that I should not recieve.
  8. ($username > 0) Should be If username is bigger than 0. Would it be < ? I seem not to remember the < and >
  9. I have a password reset form, and it doesn't do anything when I click submit. It refreshes my page. Nothing happens. I don't recieve an email, I've tried to echo the password as soon as it gets created. Nothing echo'd. Seems that NOTHING happens at all. Can anyone help me out? Here is the code. <?php session_start(); include ("inc/config.php"); if(isset($_POST['reset'])) { $username = addslashes(mysql_real_escape_string($_POST['username'])); $email = addslashes(trim(mysql_real_escape_string($_POST['email']))); if(empty($username)){ $error['username'] = '<span style="color:red;">Your Username is required!<br /></span>'; } if(empty($email)){ $error['email'] = '<span style="color:red;">Your registered Email Address is required!<br /></span>'; } $query = mysql_query("SELECT * FROM Users WHERE Username = $username") or trigger_error("Query failed: ".mysql_error()); if(mysql_num_rows($query) > 0) { $row = mysql_fetch_array($query); if($email == $row['Email']){}{ $error['email'] = 'The entered Email is not the registered email!'; } } else { if($username > 0){ $error['username'] = 'The entered Username is not registered!'; } } if(!isset($error)){ $length = 9; $characters = 'abcdefghjkmnpqrstwxyz23456789'; $max = strlen($characters) - 1; $pwd = ''; mt_srand((double)microtime() * 1000000); while (strlen($pwd) < $length + 1) $pwd .= $characters{mt_rand(0, $max)}; $pass = md5($pwd.strtolower($username)); $query = mysql_query("UPDATE Users SET Password = '$pass' WHERE Username = '$username'") or trigger_error('Query failed: '. mysql_error()); $send = mail($email , "Password Reset Request" , "You have applied for a new password at Developers Community\n\nYour Username and New Password are below, Please change your Password when you login!\n\nUser: ".$username."\nPass: ".$pwd."\n\nIf you did not request a New Password, please change your Password and if this continues to happen then please contact us.\n\nPlease do not reply, this is an automated mailer.\n\nThanks", "FROM: no-reply@developers-community.com"); if(($query)&&($send)){ $success['complete'] = 'Your New Password has been sent to your Email Address. The Email could be in your Junk. If you do not recieve the email, please contact us.'; } } } ?> <?php echo ''.$error['username'].''.$error['password'].''.$success['complete'].''; ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" style="width:300px; margin:0 auto;"> <label>Username<br /> <input name="username" type="text" class="textBox" id="username" size="40" /></label> <label><br /> Registered Email Address<br /> <input name="email" type="text" class="textBox" id="email" size="40" /></label> <br /><br /> <input name="reset" type="submit" class="textBox" id="reset" value="Submit" /> </form>
  10. I have a login form, and when I put in the correct details, and click submit, nothing happens... the page refreshes, but I get no error, and neither do I get logged in. Instead of refreshing the page, so still on the page where nothing happened, I try login again. It then works. Although normally, when a user gets logged in, it uses $back = $_SERVER['HTTP_REFERER']; header("Location: $back"); When having this is, I get an error.. Warning: Cannot modify header information - headers already sent by (output started at /home/jeanie/public_html/login.php:12) in /home/jeanie/public_html/login.php on line 120 Maybe both the issues are related and when one is fixed the other will be too. It's probably a simple issue, but I haven't figured it out yet. Here is the full code. <?php session_start(); include ("inc/config.php"); include("inc/functions.php"); checkcookie(); ?> <!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=utf-8" /> <meta http-equiv="Content-Language" content="en-UK" > <meta name="description" content="Developer's Community is a community dedicated to learning and teaching specific areas around computer development. We have a wide range of tutorials that cover all topics and we also have support forums for those who are needing a bit of support. The forums also consists of freelancing, and general discussions." > <title>Developer's Community - Login</title> <link href="styles/main.css" rel="stylesheet" type="text/css" /> <link href="styles/support.css" rel="stylesheet" type="text/css" /> <link rel="shortcut icon" href="images/favicon.ico"> <link rel="icon" href="images/favicon.ico"> <script type="text/javaScript" src="inc/cona.src.js"></script> <?php background(); ?> <script type="text/javaScript" src="inc/cona.src.js"></script> </head> <body> <!-- Begin Page --> <div id="container"> <!-- Header --> <div id="header"> <?php members_template(); ?> </div> <!-- Navigator --> <div class="navigator" id="dropdown"> <ul id="topnav"> <li><a href="/">Home</a></li> <li><a href="about.php">About</a></li> <li><a href="tutorials.php" rel="tutorials">Tutorials</a></li> <li class="active"><a href="support.php" rel="support">Support</a></li> <li><a href="forums">Forums</a></li> <li><a href="feeds">Feeds</a></li> </ul> </div> <?php navigator(); ?> <script type="text/javascript"> cssdropdown.startchrome("dropdown") </script> <div id="subnavigation"></div> <!-- Main Content --> <div id="pageContent"> <div id="advertskyscraper"> <script type="text/javascript"><!-- google_ad_client = "pub-7463512441958618"; /* 160x600, created 03/01/10 */ google_ad_slot = "6049830800"; google_ad_width = 160; google_ad_height = 600; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script></div> <div id="fill"><center> <h1>Login</h1> <p>This login is not the same as the Forums. It's a seperate account temporarily, you may have to <a href="register.php">register</a>. <?php if(isset($_POST['login'])) { $username = trim(addslashes(mysql_real_escape_string($_POST['username']))); $password = md5(trim(mysql_real_escape_string($_POST['password']))); // Are the fields empty? if(empty($username)){ $error['username'] = '*'; } if(empty($password)){ $error['password'] = '*'; } // We then check if the user is banned $q = mysql_query("SELECT ExpireDate FROM Banned WHERE Username = '$username'") or trigger_error('Query failed: '.mysql_error()); if(mysql_num_rows($q) !=0){ $row = mysql_fetch_array($q); if($row['ExpireDate'] > time()){ $error['banned'] = 'You are banned until '.date("d/m/Y H:i:s", $row['ExpireDate']).'!'; } else { $query = mysql_query("DELETE FROM Banned WHERE username = '$username'") or trigger_error('Query failed: '. mysql_error()); } } // Now we check if the username or password entered is incorrect and if correct check if they are activated $query = mysql_query("SELECT * FROM Users WHERE Username = '$username' AND Password = '$password' LIMIT 1") or trigger_error('Query failed: '. mysql_error()); $row = mysql_fetch_array($query); if(mysql_num_rows($query) == 0){ $error['incorrect'] = 'Your username or password is incorrect. Please try again.'; } elseif($row['Activated'] == 0){ $error['activated'] = 'Your account is not activated.'; } // If no errors were found, continue with the login if(!isset($error)){ $row = mysql_fetch_array($query); $query = mysql_query("UPDATE Users SET Used = YEAR(CURDATE()) WHERE username = '$username'") or trigger_error('Query failed: '. mysql_error()); $_SESSION['s_logged_n'] = 'true'; $_SESSION['s_username'] = $username; $_SESSION['s_name'] = $row['Name']; if(isset($_POST['keep']) == checked){ $actkey = $row['Actkey']; $activated = $row['Activated'] > 0; $time = time() + 60*60*24*1000; setcookie(DC_5739487932, $username, $time); setcookie(DC_9640683492, $actkey, $time); setcookie(DC_2094892587, $activated, $time); } $back = $_SERVER['HTTP_REFERER']; header("Location: $back"); } else { $error['failed'] = 'There was an error processing your login, please try again'; } } ?> </p> <?php echo ''.$error['activated'].''.$error['banned'].''.$error['incorrect'].''.$error['failed'].''; ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" style="width:200px; margin:0 auto;"> <label>Username<?php echo $error['username']; ?> <input name="username" type="text" class="textBox" id="username" /></label> <label>Password<?php echo $error['password']; ?> <input name="password" type="password" class="textBox" id="password" /></label> <br /><label><input name="keep" type="checkbox" id="keep" />Keep Me Logged In<br /></label><br /> <input name="login" type="submit" class="textBox" id="login" value="Submit" /> </form> <p>Didn't get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p> <p>Need an account? <a href="register.php">Click here</a> to register, it's completely free! </p> <br /> </center></div> </div> <!-- Footer --> <div id="footer"> <?php footer(); ?></div> <!-- end Page --></div> <?php include_once("inc/analytics.php") ?> </body> </html> This uses function.php with some functions. The top bit of that file is.. session_start(); include("config.php"); Can you help?
  11. I have a set as homepage link, and it looks like this. <a href="javascript:history.go(0);" style="float:right" onclick="this.style.behavior='url(#default#homepage)'; this.setHomePage('http://www.developers-community.com');">Set as Homepage</a> This only works on Internet Explorer, how can I make this more advanced to work with all if not most browsers? Thanks.
  12. I changed it to window.open(URL,id,"toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=500,left = 390,top = 150"); Although on firefox, it is still resizable. How can this be prevented. Thanks
  13. I don't really understand Evals, though that sets the options for the popup, along with the page to be displayed.
  14. The following code doesn't create a popup, displaying the page wicaptcha.php It does nothing, whats the problem? <script type="text/javascript"> function popUp(URL) { day = new Date(); id = day.getTime(); eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=500,left = 390,top = 150');"); } </script> <a href="#" onclick="popUp('/wicaptcha.php');">Whats this?</a>
  15. Sorry for bumping, this is a serious issue. I have no idea on the problem. Can someone please, please 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.