Jump to content


  • Posts

  • Joined

  • Last visited


Everything posted by MidOhioIT

  1. try this instead: change your connection string to: $db=mysql_connect("localhost", "root", "pass...")or die("cannot connect"); You sure you have root access or is that what you named your username? that is a bad idea if you named your username that... then change your query to: $sql=mysql_query("INSERT INTO web_members(name,lastname,email) VALUES('$name','$lastname','$email' ",$db); * put a space before "VALUES" if you still get an error, its either your connection itself or the query not having values, or not agreeing with your table web_members. if your still having issues try doing this after your insert: echo "insert statement: INSERT INTO web_members(name,lastname,email) VALUES('$name','$lastname','$email' <br>"; at least you can see your insert and then run it directly on the db to see if you get a syntax issue. you could also always do or die commands afterwards and that would tell you if your sql syntax is wrong.
  2. try this instead: if ( ($_SESSION["usr"]) ) that should be good enough to test if it is set or not...
  3. well I have tried the following so far with no luck: $date = date("m-d-Y"); shell_exec(" tar zxvf file_backup_$date.tar.gz mydir/ "); shell_exec(" tar zxvf file_backup_$date.tar.gz"); shell_exec(" tar -zxvf file_backup_$date.tar.gz"); shell_exec('tar -zxvf file_backup_$date.tar.gz'); shell_exec('tar -zxvf file_backup_$date.tar.gz *'); am I doing something wrong? the php file with this code in it is in the same directory as the tar.gz file. I expect it to dump all the files into that directory...
  4. I have created a tar file with my site backup and I assume it is the full backup. Not sure becasue I can't "un"-tar the file. I have tried several ways to "unzip" or untar the file but can not come up with anything. here is how I had created the tar file: $date = date("m-d-Y"); // repeat this command for multiple backups, changing the path - e.g. you can have a backup for email, another for files, etc. shell_exec("tar cvfz file_backup_$date.tar.gz mydir/ "); now how do extract it?
  5. does anyone know what the following errors are and how to correct them? I recently upgraded my php versions and I am positive it is related, just not sure how to make the errors go away [02-Jan-2011 11:02:49] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20060613/sqlite.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20060613/sqlite.so: undefined symbol: third_arg_force_ref in Unknown on line 0 [02-Jan-2011 11:02:49] PHP Warning: PHP Startup: pdo_mysql: Unable to initialize module Module compiled with module API=20060613 PHP compiled with module API=20090626 These options need to match in Unknown on line 0
  6. does anyone know why I am getting the error: Deprecated: Function ereg() is deprecated on line 75 ? here is line 75 (line 3, the seond if statement): if($form_cc_type == 'visa') { if(!ereg('^4[0-9]{12}([0-9]{3})?$', $form_cc_number)) { $form_error = "Invalid number"; } } I am assuming I would get a simular error on all the ereg lines... if($form_cc_type == 'visa') { if(!ereg('^4[0-9]{12}([0-9]{3})?$', $form_cc_number)) { $form_error = "Invalid number"; } } elseif($form_cc_type == 'mastercard') { if(!ereg('^5[1-5][0-9]{14}$', $form_cc_number)) { $form_error = "Invalid number"; } } elseif($form_cc_type == 'americanexpress') { if(!ereg('^3[47][0-9]{13}$', $form_cc_number)) { $form_error = "Invalid number"; } } elseif($form_cc_type == 'diners') { if(!ereg('^3(0[0-5]|[68][0-9])[0-9]{11}$', $form_cc_number)) { $form_error = "Invalid number"; } } elseif($form_cc_type == 'discover') { if(!ereg('^6011[0-9]{12}$', $form_cc_number)) { $form_error = "Invalid number"; } }
  7. Is there a way I can scan one of my websites for directories and files if it is not on the same server? I can scan just fine on the same server but not if it is on another server/website. since it is not the same server I tried to give the full path: http://www.site.com but it would not work. can this even be done?
  8. Does anyone have sugguestions on a newsletter? I want to have a what you see is what you get (WYSIWYG) editing functions along with being able to upload different template layouts to choose from and send out newsletters. I have a need to give a client a newsletter system that the newsletter needs to be in HTML form and they want to be able to have different layouts. They are in no way close to understanding HTML but can change images and text ect.. I want something to install PHP and MySql on my server. I have tried looking for things but only find some info..
  9. Does anyone know if using an osc for giftcards is a good idea or not? What I need is an online shopping cart for the usual selling items online. However the tricky part is my client wants to sell gift cards as well. The part I am not sure about is if lets say you buy 5 gift cards that have different amounts and you want them to go to all different addresses with maybe personal notes as well. maybe there is a fix or a module for that but osc website was no help in a response.
  10. Alex, Thanks but that was not it. It also looks like it only has the issue running as cron
  11. I am confused why I am getting the following error and was wondering if I could get a 2nd pair of eyes.. error: [29-Jul-2010 20:58:01] PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent in /home/curren11/public_html/mysite***.com/file_monitor.php on line 2 [29-Jul-2010 20:58:01] PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /home/curren11/public_html/mysite***.com/file_monitor.php:2) in /home/curren11/public_html/mysite***.com/file_monitor.php on line 2 Here is the code: <?php session_start(); $root_path = realpath(getcwd()); $error_monitor_file = $root_path.'/file_modify.txt'; $hour = date("H"); $today = date("m-d-Y"); $myFile2 = "file_monitor.php.log"; $fh3 = fopen($myFile2, 'a'); $log_msg = "Last ran on: ".$today." at: ".$hour." \n"; fwrite($fh3, $log_msg); function scan_dir($path) { $out = array(); $files = opendir($path); while ($f = readdir($files)) { $extension = substr($f,-3); if ($f=='.' or $f=='..' or $extension=='jpg' or $extension=='JPG' or $extension=='png' or $extension=='gif' or $f=='file_monitor.php' or $f=='file_modify.txt' or $f=='file_monitor.php.log' or $f =='error_log' ) { continue; } if (is_dir($path.'/'.$f)) { $out = array_merge($out, scan_dir($path.'/'.$f)); } //if (((!is_dir($path.'/'.$f)) && ($f!='.' or $f!='..' or $extension!='jpg' or $extension!='JPG' or $extension!='png' or $extension!='gif')) else // { $out[] = $path. '/'. $f; //} } $_SESSION['all_files'] = $out; return $out; } $a = scan_dir(getcwd()); $count_array = count($_SESSION['all_files']); $loop_count=0; while($loop_count < $count_array) { // file in directory when was it last changed ? $filechange1 = date("m-d-Y-H", filemtime($_SESSION['all_files'][$loop_count])); // was it chnaged today and have I sent out an alert yet? if($filechange1 == $today."-".$hour) { $fh2 = fopen($error_monitor_file, 'a'); fwrite($fh2, "\n alert, file: ".$_SESSION['all_files'][$loop_count]." was changed today within the last hour ! \n"); fclose($fh2); } $loop_count ++; // log file? was it changed this past hour? if (file_exists($error_monitor_file)) { $filechange_log = date("m-d-Y-H", filemtime($error_monitor_file)); if ( ($loop_count == $count_array ) && ($filechange_log == $today."-".$hour ) ) { email(); } } } // function for email... function email() { require_once ('class.phpmailer.php'); $mail = new PHPMailer(); $mail->IsSMTP(); // send via SMTP $mail->Host = "localhost"; // SMTP servers $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "**c66@***ar.com"; // SMTP username $mail->Password = "*****"; // SMTP password $mail->From = "***@***.com"; $mail->FromName = "Colonial Cottage File Changed"; $mail->AddAddress("email@*****.com"); $mail->WordWrap = 50; // set word wrap //$mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment //$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); $mail->IsHTML(true); // send as HTML $mail->Subject ="Unauthorized file changed today!"; $mail->Body = "" ; $mail->AltBody = "This is the text-only body"; if(!$mail->Send()) { exit(); } } if ((file_exists($error_monitor_file)) && $hour == "00") { unlink($error_monitor_file); } fclose($fh3); exit(); ?>
  12. thanks sasa, that was almost what I wanted. I had to make a few changes but it put me on the right path. Is there a reason why it is still pulling the .jpg files though? I have looked at the code for a while now and still cant figure out why it is still looking and storing .jpg files. I want to exclude all image files as they change often.. Thanks in advance. its not the misspelling on extension, i fixed that already.
  13. ok here it is. Like I said in my previous post, I am trying to scan my dir for files and other directories to see if something was modified in the same day. My server has been hacked a couple of times now and would like to know when my files change asap to fix the website with a clean backup. What I am trying to do is scan the root dir first, then store all files in one array, store all dir in another array. Go back into the dir array and change dir to whatever the 1st element directory is. Then scan the new directory for more files and directories until all directories in the directory array have been scanned. In a since, I want this program to be smart enough to crawl through my entire website looking for changed files in every single directory reguardless on how deep the directories get. Here is my code, it works well in the root directory but when it scans other directories, it looses its count, im assuming because of a session thing. Maybe there is a better way to do what I am doing anyways.. I am open to sugguestions. <?php // start up your PHP session! session_start(); // get full patch $root_path = realpath(getcwd()); $hour = date("H"); $today = date("m-d-Y"); $error_monitor_file = $root_path.'/file_modify.txt'; $count = 0; $dir_loop_count = 0; $current_dir = getcwd(); echo "current directory is from start: ".$current_dir; echo "<br>"; $handle1 = opendir($current_dir); while (false !== ($file = readdir($handle1))) { // if result is a file and not a dir.. and not an image or image dir if($file != "." && $file != ".." && !is_dir($file) && $file['extension'] != "jpg" && $file['extension'] != "JPG" ) { $all_files[] = realpath(getcwd()).'/'.$file; } // if result is a dir and not a file and not image dir.. if(is_dir($file) && $file != "." && $file != ".." && $file != "image" && $file != "images" && $file != "logos" && $file != "slideshow_images") { //$all_dirs[] = realpath(getcwd()).'/'.$file; $_SESSION['all_dirs'] = array(realpath(getcwd()).'/'.$file); } } $count_files = count($all_files); $count_dir = count($all_dirs); while($dir_loop_count < $count_dir ) { // see if new directories were added... $count_dir = count($all_dirs); // $new_dir = $all_dirs[$dir_loop_count]; $new_dir = $_SESSION['all_dirs'][$dir_loop_count]; chdir($new_dir); scan_new_dir(); chdir($root_path); // go back to root dir; $dir_loop_count ++; } function scan_new_dir() { $current_dir = getcwd(); $handle2 = opendir($current_dir); while (false !== ($file = readdir($handle2))) { // if result is a file and not a dir.. and not an image or image dir if($file != "." && $file != ".." && !is_dir($file) && $file['extension'] != "jpg" && $file['extension'] != "JPG" ) { $all_files[] = realpath(getcwd()).'/'.$file; } // if result is a dir and not a file and not image dir.. if(is_dir($file) && $file != "." && $file != ".." && $file != "image" && $file != "images" && $file != "logos" && $file != "slideshow_images") { // $all_dirs[] = realpath(getcwd()).'/'.$file; $_SESSION[all_dirs][] = realpath(getcwd()).'/'.$file; } $count_dir2 = count($_SESSION['all_dirs']); $count_files2 = count($all_files); echo "all files: ". $count_files2." amd all dir: ". $count_dir2; echo "<br>".$all_dirs; } } if (file_exists($error_monitor_file)) { echo "<br>send email..."; } if( ($hour == "00") && (file_exists($error_monitor_file) )) { unlink($error_monitor_file); } exit; ?>
  14. Is there a way to store data in array that is in a function and keep it? it seems that everytime it leaves the function the data is gone. I almost need a session array, can this be done? What I am trying to do is scan my own website and store the full path to all directories in an array so I can go back to that directory later. here is what I tried and failed $file is simple coming from an opendir command: $_SESSION['all_dirs'][] = array(realpath(getcwd()).'/'.$file);
  15. thanks teamatomic , What you said was the fix, much appriciated
  16. when using the following code: $xml3 = simplexml_load_file('image_and_link_featured.xml'); $images3 = array(); foreach($xml3->pic as $link) { $links3[] = $link->link; } $Featurelink1 = $links3[0]; I get the errors: image_and_link_featured.xml:5: parser error : EntityRef: expecting ';' in /index_with_links.php on line 29 Warning: simplexml_load_file() [function.simplexml-load-file]: <link>show_coupon.php?catparam=5&business in /index_with_links.php on line 29 Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /index_with_links.php on line 29 Warning: Invalid argument supplied for foreach() in /index_with_links.php on line 31 Here are lines 29 - 31: $xml3 = simplexml_load_file('image_and_link_featured.xml'); $images3 = array(); foreach($xml3->pic as $link) Here is the xml file content that can not change: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <images> <pic> <image>featuredsponsor1.jpg</image> <link>show_coupon.php?catparam=5&business=MATTRESS+ONE+FURNITURE+COMPANY</link> </pic> </images> Does anone have any ideas? It is obvious to me is is not liking the link because of what is in it but I am ok with it just reading it as a text string
  17. dmaar, We are all on different levels. We all need help, even the expierenced programers need another eye sometimes. I even have a few posts with some questiosn. Keep trying you will get it, it will just take time. so did you figure out what I meant by clicking on the sql link?
  18. As sugguest by mike... I don't think your table creation is right for what you want. Do that table creation in phpAdmin and give me the error
  19. Don't forget to mark as solved. So the issue was the table itself and not inserting records in it?
  20. fyi, doing a describe on the table is as simple as clicking on the "sql" link and then doing the following command: desc TABLE_NAME;
  21. try this: $q=$db->query("INSERT INTO products (product_name, product_category, price) VALUES('$name', '$category', '$price')"); Notice the single quote around the varables in the values.. let me know if that fixes it
  22. try setting your cookie as the first thing to do
  23. Have you tried a simple echo like "hello world" or "inside while loop" How do you know for 100% certain that you are fetching rows from your query?
  24. I think you can also try this: && $_GET['xlspg'] !='contact_us') && ($_GET['xlspg']!='cart') && ($_GET['xlspg']!='msg');
  • 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.