Jump to content

jcbones

Staff Alumni
  • Posts

    2,653
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by jcbones

  1. try: if ((stripos($title, 'needle') !== false )
  2. You are telling it to refresh in your href: change it to: <a href=\"javascript:void(0);\" class=\"" . $a[$i] . "\" onClick=\"locationValue('" . $a[$i] . "', '" . $_GET['search_type'] . "')\">
  3. Check out the DateTime class <?php $date = '2004/10/21'; //get the start date from a form $_POST['date'] $oFour = new DateTime($date); $today = new DateTime(); $date_of_oFour = $oFour->format('m-d-Y'); //accepts any string that date accepts. $interval = $oFour->diff($today); $thirty_days_from_oFour = $oFour->sub(new DateInterval('P30D')); $days_since_oFour = $interval->format('%a days'); $days_subtracted_from_oFour = $oFour->format('m-d-Y'); echo 'Start date: ' . $date_of_oFour . '<br />Days since the start date: ' . $days_since_oFour . '<br />30 days before the start date: ' . $days_subtracted_from_oFour; ?> Tested.
  4. Change: /*$duedate = new DateTime($issuedate); $duedate->add(new DateInterval('P15D')); echo $duedate->format('Y-m-d H:i:s') . "\n";*/ //$issuedate=date("Y-m-d",$issuedate); echo 'issuedate date is ' . $issuedate; list($year,$month,$date) = explode('-',$issuedate,3); $duedate = mktime(0,0,0,date($month),date(day)+15,date($year)); echo 'duedate date is ' . date("Y-m-d",$duedate); $duedate=date("Y-m-d",$duedate); //print $duedate; To: $duedate = date('Y-m-d',strtotime('+ 15 days',strtotime($issuedate)));
  5. readdir returns files listed in the same order as the filesystem stores them. The only option is to store the names in an array, sort the array, then display the results. But, this will sort them alphabetically. So alternatively we could use the time the file was made to sort by. while(false !== ($file = readdir($dh))) { if($file != '.' && $file != '..') { if(!is_dir($file)) { $filesArray[filemtime($file)] = $file; } } } if(isset($filesArray)) { ksort($filesArray); } else { die('files don\'t exist'); } foreach($filesArray as $filename) { $file_parts = explode(".", $filename); $file_base = $file_parts[0]; $file_ext = $file_parts[1]; $modulehtml .= "<tr>\n<td class=alt1>\n <a href=\"/index.php?page=dl_info&cat=$cat&file=$file_base&ext=$file_ext\">$file_base</a>\n </td>\n<td class=alt2>\n$file_ext\n</td>\n</tr>\n"; } This is only an example.
  6. You need to make the script call a script on your server that accesses your database and returns a code. Based on this code the script would run, or return an error to the user. No one here is going to write this code for you for free, and then you charge for it. That would just be dumb on our part.
  7. Alright, I'll try to nail this one in one post. Your file <html><head><link rel="stylesheet" type="text/css" href="style.css" /></head><body><?php include_once('content.php') ?></body><SCRIPT language="JavaScript" SRC="javascript.js"></SCRIPT><script type="text/javascript">function nametitle(){parent.iframe1.document.getElementById("div1").innerHTML = "{{VARIABLE1}}<br>{{VARIABLE2}}";parent.iframe1.document.getElementById("quotes").innerHTML = "{{VARIABLE3}}";}</script></html> Process.php <?php//define stuff$username = $_POST['username'];$filename = "generate.html"; //replace with your filename.$destination = $username . '.html'; //this creates a file with the name of the user.//form variables:$one = $_POST['one'];$two = $_POST['two'];$three = $_POST['three'];//open the file, and read it$handle = file_get_contents($filename);//search for the variables, and replace them$search = array('{{VARIABLE1}}','{{VARIABLE2}}','{{VARIABLE3}}');$replace = array($one,$two,$three);$new = str_replace($search, $replace, $handle);file_put_contents($destination,$new);?>
  8. Since you have the error outputting to your screen, just fix what is wrong. Otherwise post here the error you are getting, and we could help.
  9. There is no fool proof way of doing this. As a good scripter could rip out that part of the code. Although a good scripter would be able to just write the code themselves. You could base64 in chunks, then as a group. <- I've seen it done this way more than once. Bottom line is that everything written in PHP is able to be reverse engineered.
  10. Post the file with your email, and database connection details deleted. Make sure you enclose the code inside of [ php ] tags [ /php ]. <-no spaces of course.
  11. This is all you need: mail("me@mymail.net", $subject, $message, $from);
  12. I would do just as you say with the text area and script it something like. $name = $_POST['textarea'];$seperated_names = explode("\n",$name);$i = 0;foreach($seperated_names as $person) {$break_names = explode(' ',$person);$people_array[++$i]['firstname'] = $break_names[0];$people_array[$i]['lastname'] = $break_names[1];}foreach($people_array as $people) {echo '<br /><br />Firstname: ' . $people['firstname'] . '<br />Lastname: ' . $people['lastname'];}
  13. Change this line: if ( preg_match_all('/^[0-9]{2}$|^[0-9]{3}$/', $vaegt, $hoejde)) To if ( preg_match('/^[0-9]{2}$|^[0-9]{3}$/', $vaegt) && preg_match('/^[0-9]{2}$|^[0-9]{3}$/', $hoejde)) The syntax for preg_match(_all) is preg_match ( string $pattern , string $subject [, array &$matches [, int $flags [, int $offset ]]] ); It doesn't support multiple $subjects to compare against.
  14. You are making "$hoejde" into an array in the preg_match_all() function. That is where the error comes from. You cannot add,subtract,divide,multiply with an array.
  15. $insert_query="insert into issue values($account,$bookid,'$issuedate',DATE_ADD($issuedate,INTERVAL 15 DAY))"; DATE_ADD is a mysql function, NOT a PHP function. Therefore it must be handled by the DATABASE not the script.
  16. At the top of your script insert this line: error_reporting(E_ALL);ini_set('display_errors', 1); See if errors report to the screen.
  17. You can still do that, but if the column names in the two tables collide(same name) you may get an ambiguous message. You would then need to use alias's. I would try it without them first.
  18. $date = new DateTime(); $date->sub(new DateInterval('P1M')); echo $date->format('m-d-Y');
  19. You are mistaken. In the query you are using an alias for "leads" called "r". In the SELECT clause we are asking for "r.refundNotes" which is asking for the refundNotes from the table "leads".
  20. $key = '5000|6000';echo (array_key_exists($key,$WeightArray)) ? $WeightArray[$key] : 'Key does NOT exist.';
  21. Try this: same but re-ordered. $query = "SELECT client.*, web_info.* FROM client , web_info WHERE client.e_mail = web_info.e_mail AND $clientid = client_id";
  22. Replace your opening form element with this: <form name ="Search" method ="POST" action = ""> You were sending it to "test3" but that is an invalid file as there is no file extension on it. Setting the action to an empty string, returns the form to itself. PS. Your query will only return a surname if it is typed exactly as it appears in the database. If you want it to return surnames that start with the characters typed, use: $SQL = "SELECT * FROM ***** WHERE surname LIKE '" . mysql_real_escape_string($_POST['surname']) . "%'";
  23. I hope I understood that. $temp1 = mysql_query("SELECT p.recID,r.refundNotes FROM purchased_leads p JOIN leads r ON p.leadID=r.leadID WHERE p.leadID='{$_REQUEST[leadid]}'") or die('Error: ' . mysql_error());
  24. Unfortunately, nope. Try this out echo strtotime("24/12/2010") . ' - ' . strtotime("12/24/2010"); The first is DD/MM/YYYY, the second is MM/DD/YYYY. For me, it would only display the second date in timestamp. I was told the first, strtotime is thinking 24 is a month, but it isn't a month so it fails. You are correct it doesn't work with dd/mm/yyyy, of course I stated that it did, but the link I sent you to stated that it DOES NOT. IT DOES however accept the following construct. dd\tmm\tYYYY or dd-mm-YYYY or dd.mm.YYYY = day month year seperated by tabs, dots, or dashes.
  25. Anytime you have an un-expected anything, always look at the line above that. You probably missed a semi-colon.
×
×
  • 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.