Jump to content

Lulzim

Members
  • Content Count

    295
  • Joined

  • Last visited

Community Reputation

3 Neutral

About Lulzim

  • Rank
    Member
  • Birthday March 1

Contact Methods

  • Website URL
    http://
  • ICQ
    0

Profile Information

  • Location
    Kosovo
  • Interests
    Web Programming
  1. even though your user has no password you have to specify the user. mysqldump -u root database_name > e:/sql/alpha2.sql try running the command on command line first to see if you get the desired result and then put int on php script and if you are on windows, you might have to include the full path to mysqldump (something like "c:program filesmysqlbinmysqldump.exe -u root database_name > e:/sql/alpha2.sql")
  2. Lulzim

    Need Help Here..

    You just had to make a few small changes: <?php$dateFromDb = new DateTime($replace_this_with_your_date_from_db); #don't forget to fix this line$currentDate = new DateTime();$difference = $currentDate->diff($dateFromDb);if($difference->m>=1){ echo "1 month has passed please register.";}else { echo "Carry on"; }
  3. Lulzim

    Need Help Here..

    Something like this? $dateFromDb = new DateTime('2013-08-16 10:55:14');$currentDate = new DateTime();$difference = $currentDate->diff($dateFromDb);if($difference->m>=1){ echo "years: ".$difference->y."<br />"; echo "months: ".$difference->m."<br />"; echo "days: ".$difference->d."<br />"; echo "hours: ".$difference->h."<br />"; echo "minutes: ".$difference->i."<br />"; echo "seconds: ".$difference->s."<br />";}
  4. Lulzim

    Quick installation CMS

    Get the required information from a form, then generate php code and save it to a file. Something like this in your case: <?php$string = '<?php $db_host = "'. $_POST["db_host"]. '";$db_uname = "'. $_POST["db_uname"]. '";$db_pass = "'. $_POST["db_pass"]. '";$db_name = "'. $_POST["db_name"]. '";?>';$file = fopen("config.php", "w");fwrite($file, $string);fclose($file);?>
  5. The difference Include_once and include (same as require_once and require) is that *_once will check if the file was included/required before, it will not include it again. And the difference between include and require is that require will stop the execution of the script if it cannot find the file required and generate a fatal error. While include will only issue a warning and continue the execution of the script. So for essential code, as in this case DB connection, require_once is best.
  6. Yeah, try to look at error_log if you don't set display errors as thescientist suggested. Here are a few errors you have: Notice: Undefined variable: nameپست in ... Meaning if you are going to put a variable inside a string, concatenate it or enclose on {}Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in ... The email you typed "info@keivanstone.ir <>" is not a vaild email. Remove <> or format it properly. Also, change this line $_SESSION['captcha'] = $num . $num2; to $_SESSION['captcha'] = $num+$num2; because it is very confusing. Look at the code I posted above, I have fixed all these errors :S
  7. Just FYI, the way you are constructing the query is very dangerous. Read through this page so you can see what can happen and how to protect it http://php.net/manual/en/security.database.sql-injection.php
  8. I tested your script and here is what I found: -You need to use session_start() if you are going to use sessions. That is why $captcha != $_SESSION['captcha'] will always fail. -About the captcha, did you mean to add the two numbers and enter the result on the text box, or just concatenate them? Because as it is right now, if you add them, lets say you get 24 + 10 and you enter 34 it will not work. As it is right now, for that example you should write 2410. Here is the complete code that worked for me <?phpsession_start(); #was missingini_set("display_errors",1); #remove this on production, needed it to see any errors$php_self = $_SERVER['PHP_SELF'];//$error_name = " you don't enter name.please enter you name.";// on submit$mail_sent=0;$error_name = $error_email = $error_subject=$error_body = $error_captcha = '';if( isset($_POST['name']) && isset($_POST['email'])&&isset($_POST['subject']) && isset($_POST['body']) && isset($_POST['captcha']) ){ $name = $_POST['name']; $email = $_POST['email']; $subject = $_POST['subject']; $body = $_POST['body']; $captcha = $_POST['captcha']; $error = 0; // name if( $name == "" ){ $error=1; $error_name = "class='error'"; } // email if( $email == "" ){ $error=2; $error_email = "class='error'"; } // subject if( $subject == "" ){ $error=3; $error_subject = "class='error'"; } // body if( $body == "" ){ $error=4; $error_body = "class='error'"; } // captcha if( $captcha == "" || $captcha != $_SESSION['captcha']){ $error=5; $error_captcha = "class='error'"; } // no error, send email if( $error == 0){ // your email address $address = "info@keivanstone.ir"; // email subject $subject = "New body"; // email content $content = "نام:$nameپست الکترونیک:پیام شما:$email$body"; // html email $email_content = "<!doctype html><head><meta charset='utf-8'><title>".$subject."</title>"; $email_content .= "</head><body>"; $email_content .= $content; $email_content .= "</body></html>"; // headers for html email $headers = 'MIME-Version: 1.0' . "/r/n"; $headers .= 'Content-type: text/html; charset=utf-8' . "/r/n"; $headers .= "From: info@keivanstone.ir" . "/r/n"; // send email mail($address, $subject, $email_content, $headers); // reset variables $name = ""; $email = ""; $body = ""; $mail_sent = 1; }}else{ $name = $email = $subject= $body = $captcha = ''; }// captcha$num = rand(1, 40);$num2 = rand(5, 25); $verif = $num . "+" . $num2;$_SESSION['captcha'] = $num . $num2; if( $mail_sent == 1 ){ echo "<h1>از تماس شما سپاسگزاریم.تا48 ساعت آینده پاسخ خود را دریافت خواهید کرد.<br/>گروه سنگ آنتیک کیوان</h1>";} else { echo " <form action='".$php_self."' method='post'> <p><label for='name'>نام:</label> <span class='required'>*</span></p> <input type='text' ".$error_name." name='name' value='".$name."'> <p><lable for='email'>پست الکترونیک:</label> <span class='required'>*</span></p> <input type='text' ".$error_email." name='email' value='".$email."'> <p><label for='subject'>موضوع:</label> <span class='required'>*</span></p> <input type='text' ".$error_subject." name='subject' value='".$subject."'> <p><label for='body'>پیام شما:</label> <span class='required'>*</span></p> <textarea ".$error_body." id='body' name='body' style='width:460px;height:119px;'>".$body."</textarea> <p><label>جمع دوعدد:".$verif."?</label> <span class='required'>*</span></p> <input type='text' ".$error_captcha." id='captcha' name='captcha' value=''><br/> <input type='submit' value='ارسال'/> </form>";}?>
  9. take a look at these lines: else { echo "<!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" xml:lang="en" lang="eng"> If you start a string with double quotes " the string will end when the next double quote occurs.Now, on this line the string starts and ends on the quotes marked on red. The rest of the line is considered a comment because of //echo "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">And then the <html tag is not recognized as php and throws an error
  10. Lulzim

    Single Result

    It is not very clear what are you looking forif you want to get distinctive results from one column the sql query should look something like this SELECT DISTINCT column_name FROM table_NAME if you want to get first three records from a table no matter what they are SELECT column_name FROM table_name LIMIT 0,3 hope that helps
  11. Lulzim

    Join Avi.x Files

    on linux there is a cli program called lxsplit, as for windows the only one I know is hjsplit
  12. sorting column and order should not be enclosed on quotes$result = mysql_query("SELECT * FROM reviews ORDER BY '$sort_by' '$ascordesc' LIMIT 0, 20");Also, I must say that this script is not secure at all. Do not use $_REQUEST, use $_POST or $_GET and check your data before inserting them on sql queries.
  13. <?php $a['beans'] = 1; $names = array_keys($a); echo $names[0]; ?>
  14. Just click the office button on upper left corner -> save as -> other formats -> then select the image format (png for example). After that it will ask which slides you want to export (current or all). Once you have the images then just include on your web pagehttp://library.wustl.edu/units/arc/dbb.html
  15. Your select box should look something like this: echo "<select name='color'>"; while ($baris3 = mysql_fetch_array($hasil3)) { $reff=$baris3["color"]; if($_POST['color'] == $reff) echo "<option value='$color' selected='selected' >$color</option>"; else echo "<option value='$color'>$color</option>"; } echo "</select>"; I'm not sure I used the right variables in the right place but that's the logic basically.
×
×
  • Create New...