Jump to content

mmarif4u

Members
  • Posts

    1,244
  • Joined

  • Last visited

Everything posted by mmarif4u

  1. I have updated your code, but not tested. Backup your old file 1st. Try to adjust where you need to, also i would suggest to work on the if else statements. <?php session_start(); //Database Information $dbhost = "localhost"; $dbname = "masterdb"; $dbuser = ""; $dbpass = ""; //Connect to database mysql_connect ($dbhost, $dbuser, $dbpass)or die("Error: " .mysql_error()); mysql_select_db($dbname) or die(mysql_error()); $email=mysql_real_escape_string($_POST['email']); if(!$email){ include 'recover.php'; //echo ""; exit(); } $query_email = mysql_query("SELECT email FROM db WHERE email='$email'") or die(mysql_error()); $num_email = mysql_num_rows($query_email); if($num_email != 1){ include 'recover.php'; echo ""; exit(); } else { $sql = mysql_query("SELECT * FROM db WHERE email='$email'") or die(mysql_error()); $result = mysql_query($sql); // if found e-mail address, row must be 1 row // keep value $count = mysql_num_rows($result); if($count==1){ $rows = mysql_fetch_array($result); // keep password $pass = $rows['pass']; $name = $rows['name']; } if($_SESSION['captchaCheck'] != $_POST['providedCaptcha'] && !empty($_SESSION['captchaCheck'])){ // TODO include 'recover.php'; echo ""; unset($_SESSION['captchaCheck']); exit(); } else { include 'blank.php'; echo ""; echo '<META HTTP-EQUIV="Refresh" Content="5; URL=index.php">'; } $yoursite=''; $webmaster='Administrators'; $youremail=''; $subject="&#933;&#960;&#949;&#957;&#952;&#973;&#956;&#953;&#963;&#951; &#922;&#969;&#948;&#953;&#954;&#959;&#973; &#928;&#949;&#955;&#940;&#964;&#951;"; $message="&#913;&#947;&#945;&#960;&#951;&#964;&#942;/&#941; $name, E-Mail: $email &#922;&#969;&#948;&#953;&#954;&#972;&#962; &#928;&#949;&#955;&#940;&#964;&#951;: $pass &#917;&#965;&#967;&#945;&#961;&#953;&#963;&#964;&#974;, $webmaster"; mail($email, $subject, $message, "From: $yoursite<$youremail>\nX-Mailer:PHP/" .phpversion()); } ?>
  2. Try the link fortnox007 posted above, its a rich source of date functions. If still can't figure it out, post the code u tried.
  3. Can you post the whole code at once.
  4. Do you mean, every 1st date of the month? OR please explain more clearly.
  5. Why this: $sql= mysql_query("SELECT pass FROM db WHERE email='$email'"); $result=mysql_query($sql); Why two times mysql_query? why exit() after $pass? Try this //here is my db connection// $result = mysql_query("SELECT email FROM db WHERE email='$email'"); if(!$result){ } else if($email!= mysql_result($result, 0)){ include 'recover.php'; echo "bla bla"; exit(); } $sql= "SELECT pass FROM db WHERE email='$email'"; $result=mysql_query($sql); // if found e-mail address, row must be 1 row // keep value $count=mysql_num_rows($result); if($count==1){ $rows=mysql_fetch_array($result); // keep password $pass=$rows['pass']; } //here I have the Send Email code including: $email $pass Also we don't know how your email code looks like.
  6. Why infinite loop? may be you will look into cronjobs(cron).[if i get you correctly] http://en.wikipedia.org/wiki/Cron
  7. You need to work out your paths in the scripts.
  8. You can do this in query as well in PHP. Many more... In PHP: Assume, datetime format is 2010-12-27 12:23:12. $date = explode(' ', $datetime); echo $date[0];
  9. If i get you correctly. http://php.net/manual/en/function.nl2br.php
  10. <a href='detail.php?id=$id'>$productname</a> And retrieve the data for id on detail.php page. detail.php if($_GET['id'] != '') { $id = $_GET['id']; } $query = "select product,date,name,price from table where id='$id'"; //Do other mysql stuff and show the records This is just an example to get you started.
  11. #2# is random?, like #3#, #4# so on... You can remove it before inserting it to table, but we might need to look into your code for that(if you cant figure it out). Yup, you can remove it later also when retrieving from mysql, but confirm is it random?, or just #2# all the time.
  12. Your code: <?php session_start(); if(!session_is_registered(myusername)){ header("location:index.php"); } else { if(!myusername == 'admin'){ header("location:index.php"); } else { echo "Välkommen ". $_SESSION['user']; } } ?> session_is_registered is deprecated. Now new version for your script: <?php session_start(); if(!$_SESSION['myusername']){ header("location:index.php"); } else { if($_SESSION['myusername'] != 'admin'){ header("location:index.php"); } else { echo "Välkommen ". $_SESSION['myusername']; } } ?>
  13. That mean, the permission are not right for the folder you are trying to write into. Change it to 766, 777. Depends on the situation. http://www.elated.com/articles/understanding-permissions/
  14. This line should cover that: /?$ which means that trailing slash is optional, in case some one miss it. ? represents optional. So in this case both URL pattern will work like: http://domain.com/the-article http://domain.com/the-article/ It is because some time we miss the trailing slash, so to avoid that problem, just adding ? will make it optional.
  15. Yup, you can put this in the .htaccess file which will be in root directory. RewriteEngine on Options +FollowSymLinks #If base(root) directory is different , change the line below to RewriteBase /directory RewriteBase / RewriteRule ^([^/\.]+)/?$ description.php?id=$1 [L] In your php script: Description: <?php echo $_REQUEST['id']; ?> But make sure that mod_rewrite is enabled. Good luck!
  16. Yup, a hard core way to do that is to put this in your every page you have header issue: <?php ob_start(); ?> your html stuff .. ... <?php php code ob_end_flush(); ?> Hope this helps.
  17. I really don't think so you should know what they selected. But in case you wana check, there are many ways, you can close the browser tab or close the browser and then re open it to see if cookie exists. Another is to set a pre defined variable in each statement to know that which one is used like: $key = 'cookie'; $key = 'session'; Now one more thing. I think you are not using the exact logic of remember me thing. Let me rephrase it. Your input will be like this: <input type='checkbox' name='rememberme' value='save_me' style='background-color: #99FF66' />Remember me Now in your php script: $save_me = $_POST['rememberme']; if($save_me == 'save_me') { // check the value in input box, if it matches save in cookie or fall back to session //cookie stuff } else { //session stuff } Hope its clear.
  18. Hi fxuser, As there will be remember me check box. If user check the check box, store the info in cookies if did not check the box, just store info in session. Some thing like: if( $checkbox == 'save') { //do cookie stuff } else { //session } Hope, it helps if i get you correctly.
  19. Now thats more clear. What you can do is prepare another if statement and check the query, if runs sucessfully skip the insertion part and if not inset the error and other stuff into a table, some thing like: if(!$query) { $sql = mysql_query("insert into table(....) values (...)"); } else { } Hope this make sense.
  20. I am a bit confused here. Can you explain, how you want it to show to users. Show us the example how you want to output and hope i will try to help.
  21. Whats the purpose of putting a query in die statement?. There are pre defined error messages for mysql to output, why not use them?, like mysql_error, mysql_errno etc etc. OR even you can write your own error message to output. http://php.net/manual/en/function.mysql-error.php
  22. To make your life easier. http://www.raymondselda.com/php-pagination-script/
  23. <?php //starts session -- no white spaces -- session_start(); //check if logged-in if not echo login form if(!isset($_SESSION['username'])){ echo "<form action='login.php' method='post' name='login'> Username:<input name='username' type='text' value=''> Password:<input name='password' type='password' value=''><input name='Submit' type='submit' value='SUBMIT!' style='width:100; text-align:center; border-color:#F00; background-color:#FFF'><input name='Register' type='button' value='Register' style='width:100; text-align:center; border-color:#F00; background-color:#FFF'> </form>"; } // if user logged in, then echo welcome, username else { echo "<center>Welcome, <strong>".$_SESSION['username']."</strong></center>"; } ?>
×
×
  • 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.