Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. Yes in MySQL (use phpmyadmin to make it easier)
  2. redarrow, it seams you need to understand MD5 a little better, hashing isn't the start and end of adding security infact I only use it to limit the damage of the worst case scenario, you may find it a waste of time, well that's your opinion, my opinion is program for the worst, hope for the best. Login/site access security doesn't mean, just MD5 a password, its a shame because you had it right once!
  3. Welcome, RegEx gets easier with time, I'm teaching a guy at work, his slower getting to grips with it, but the first time i showed him.. it said "F*** that!" but when i updates his 20someting lines of broken code with 3 lines of working code.. he started pay attention.
  4. change preg_match_all('%<div class="[^"]*">([^<]*)</div>%sm', $HTML, $somethings); to preg_match_all('%<div class="[^"]*">(.*?)</div>%sim', $HTML, $somethings); should do it, (untested)
  5. that's easy to fix, just drop the greediness $link = "site.com/bfdgnh/oc8687/funny_n.ames.jpg"; if (preg_match('%([^/]*?).?[^/.]{0,3}$%', $link, $regs)) { $titles= $regs[1]; } echo $titles;
  6. Like this <?php $HTML = '<div class="something">Hi there!</div> <div class="something">Hello!</div> <div class="something">hi i am</div> <div class="something">rofl</div> <div class="something">dsfssdf</div>'; preg_match_all('%<div class="[^"]*">([^<]*)</div>%sm', $HTML, $somethings); $somethings = $somethings[1]; var_dump($somethings); ?>
  7. You could but that's would probably be slower than the RegEx.
  8. okay here's the error Now functions.php is outputting a space, now as soon as an output is made, you can't send a header, and session_start(), need to make a header call, thus it fails see HEADER ERRORS - READ HERE BEFORE POSTING THEM
  9. Do you have any white space at the end of functions.php ? for example a space/return after the ?> ie "?> "
  10. what's on line 40 to 50 of functions.php and what's the first 10 lines of index.php
  11. Okay your going to need to create a database and a table, with all those fields, then save the excel as CSV, use PHPMyAdmin, to import the the CSV, to check everything, (PHPMyAdmin will show you the SQL statement it used) once your happy, copy that query and upload the CSV to the server and write a simple script to run the same query with the uploaded file, once that works, create a file uploader (simple form) and combine the 2 scripts, to allow upload and import, here is a quick PhpMyAdmin Tutorial, to get you started
  12. Nothing wrong, the print_r ($images); works fine
  13. PHPmyAdmin, allows you to create databases and tables on your server, is this going to be an on going or a one off ? if its going to be a one time thing then, you could do the whole thing in PHPmyAdmin, do you have an sample of your excel file, i can see, (I'll see if i can give you a step by step)
  14. depends on how your salting ie, if you used this md5(md5($pass).$salt) then you could update the existing hashes with md5($existingpass.$salt) EDIT: another option is a midway option where you have 2 fields 1 being the current password and 1 being the new password, if the new password is empty use the old one, but you update the new password on the next valid login, or simply post a message saying you have a new password routing and people need to use the recover password option to reset their password
  15. Okay by local you mean on the computer the database it running... right! So you have an excel file with 3 columns name, address, phone number Now on your have a website with a MySQL database, Create a table ie "MyExcelStuff" with 3* fields ie "fields name, address, phone" Now you open the excel file on the client PC and save as CSV, you upload that CSV to the website and then run this query LOAD DATA LOCAL INFILE '/importfile.csv' INTO TABLE MyExcelStuff FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (`name`, `address`, `phone`); the table MyExcelStuff will now have all the date from the CSV (excel file without formatting) *Should be 4 field as you want an auto number as well, but were get to that later
  16. We learn from our mistakes.. As you can see I have made a lots, if you output is wrong.. first step is check your input
  17. you could do this directlt in the a SQL query (probably the easiest route) LOAD DATA LOCAL INFILE '/importfile.csv' INTO TABLE test_table FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (field1, filed2, field3); a simple php file would be <?php $fcontents = file ('excel.csv'); // file to array foreach($fcontents as $line){ //array loop $line = trim($line); $arr = explode(",", $line); //break line into array (in case to use a tab delimiter change "," to "/t") $sql = "insert into TABLENAME values ('".implode("','", $arr) ."')"; mysql_query($sql); //echo $sql ."<br>\n"; //debug if(mysql_error()) { echo mysql_error() ."<br>\n"; } } ?>
  18. Read this $query2 = "SELECT * FROM active_consults WHERE signoff_status = 's' "; $results2 = mysql_query ($query) or die (mysql_error()); dose it really look right ? look 2 times hit: use the variables you set
  19. Well i do everything locally then when I'm happy I put it on my live server, but I don't see what that has to do with an excel import! i think saving the excel as a CSV then importing the CSV into a database would be an easier option, no matter where the database resides
  20. Their are a few ways to do it, one is netdrive, netdrive free for home use Another is FTP Drive (i think, google it), Even windows lets you do it, Map Network Drive -> Choose a custom network location -> Enter in the FTP address for the site (ftp://username:password@domain.com/path)
  21. basename is the best option if it's always .jpg, but I assumed the extension would be anything.
  22. I highly recommend you correct the field type,
  23. Infact it should be date(FROM_UNIXTIME(`date`)) if that works then your field type is wrong, change from INT to timestamp Saying, is very confusing, what's the field type timestamp or int ? did you try my last example ?
  24. Table CREATE TABLE `test` ( `test1` varchar(2) NOT NULL, `joindate` timestamp NOT NULL default CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `test` (`test1`, `joindate`) VALUES ('ol', '2009-09-18 03:59:52'), ('ne', '2009-09-20 04:21:18'); Query SELECT * FROM test WHERE date( `joindate` ) = date( now( ) ) ORDER BY `joindate` DESC LIMIT 20 Result Query Seams fine can you manually test the query your end
  25. Well /n is unix /r/n is windows and /r is mac, but when his dealing with HTML so the use of /n is fine! as a note if you wanted to be you should use PHP_EOL instead of hard coding /n
×
×
  • 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.