
QuickOldCar
Staff Alumni-
Posts
2,972 -
Joined
-
Last visited
-
Days Won
28
Everything posted by QuickOldCar
-
Store each attempted login just as a date, additionally a 0/1 (fail/success) Get that users count of timestamps up to 10 minutes ago...if is a fail last attempt and is a count of 5 or more then it keeps preventing them (store the timestamp and fail)...otherwise allows them (store the timestamp and success).
-
how to sort <a> tags inside an array based on their text?
QuickOldCar replied to sabeti05's topic in PHP Coding Help
You should make a habit to separate coding logic from html. Only add html for display, not stored in arrays. -
Good eye mac_gyver, not even sure how I missed that exit and so obvious.
-
What does the html source file show? Btw is no need to keep coming in and out of php the way you are. Also where is $error defined? if (isset($_POST['submit']) && isset($error) == '') { // if there is no error, then process further Is your error reporting actually working?
-
You have 2 closing form tags </form> <a class="haveaccount" href="login.php">I already have an account...</a> </form>
-
Welcome to the forum. Be sure to visit the php manual as it has all the current uses and plenty of information to read over.
-
Who is legally responsible for XSS vulnerabilities?
QuickOldCar replied to NotionCommotion's topic in PHP Coding Help
I'm in no way a lawyer and even a lawyers advice in a forum wouldn't have much merit, if went to court all would be determined there. It's usually anyone and everyone a party can blame and the lucky ones are those who can afford to get out of it or pass the blame and someone else accepts it. It's not even so much money but a reputation can be at stake. In my eyes if you clearly define in a TOS and also take actions against such wrongful person you should be exempt from blame. "...and any illegal or malicious activity" is a broad scope -
Dangers of user provided script in PHP file
QuickOldCar replied to NotionCommotion's topic in PHP Coding Help
I wouldn't let anyone upload code to the server. Are you doing a multiple subdomain/websites? If so have a default css file and let them edit that if anything and image uploads if required. Ever consider making your own theme/templating system? Create a variety of layouts and styles the user can select and further edit just css and images. Could make it they name their customized versions and those are saved. Can go crazy and make your own html builder. -
For the record, you can use the session_id() for that random number.
-
Changed it around a little more. page one <?php session_start(); if(isset($_POST['submit']) && trim($_POST['name']) != ""){ if(!isset($_SESSION['number'])){ $_SESSION['number'] = session_id(); } if(!isset($_SESSION['name'])){ $_SESSION['name'] = trim($_POST['name']); } //database insert stuff header("location: nextpage.php"); exit; }else{ echo "Enter your name"; } ?> <form method="post" action=""> <input name="name" type="text" value="" > <input name="submit" type="submit" value="NEXT" > </form> page two <?php session_start(); echo "session: ".$_SESSION['number']."<br />"; echo "name: ".$_SESSION['name']; ?>
-
Try this for page one <?php //page one session_start(); if(isset($_POST['submit'])){ $_SESSION['number'] = mt_rand(1000, 9999); //database insert stuff header("location: nextpage.php?session=".$_SESSION['number']."&name=".trim($_POST['name'])); exit; } ?> <form method="post" action=""> <input name="name" type="text" value="" > <input name="submit" type="submit" value="NEXT" > </form>
-
Mistakes are part of the learning process. Everything does not always go as planned, might need to compromise or make adjustments. What's written in those books are a persons opinions. Whatever makes you more proficient and comfortable doing this while getting a completed project done per clients specifications is the right way. Many website developers I know use a cms versus starting over each time. Some use frameworks while others develop their own cms. Is also clients that want a certain premade cms in which you have to modify for their needs. There is so many aspects of website development and different methods to go about it is mind boggling these days. It seems that each client has a priority what is more important to them and their website, is something will have to find out or convince them your ways are the best to go about it. Some think they know but actually do not. I concentrate on the backend functional aspect of the website first and any css, jquery, javascript, ajax, etc would be later unless is required. Create a basic layout and style to manipulate and test your data. A basic plan of what you need is fine. create your websites so they can be modified in many ways without editing lots of code separate the coding logic from the display create databases for what you need, content data,users login system with permissions (I personally use a 0-9 scale) administration area navigation and link to scripts performing specific tasks inserting,fetching and updating content to the database website frontend and display data users account/profile area any additional requirements you may need design and style it add in any flashy features you want I've seen piles of sites that look fantastic and have no functionality, in the same respect have seen fantastic working ones that looked horrible. You have developers,designers and then you have website developers which need to be able to do both fairly well. Is there any particular trouble areas you have trying to get something working together? I find the biggest issues are the hosting or outdated coding versions the client is using. For the record I've been programming and developing for 36 years and have done all sorts of freelancing. I can not say I have seen it all, but I've seen a lot.
-
DOMXPath error while looping with While for site scrape
QuickOldCar replied to max_maggot's topic in PHP Coding Help
I agree with Ch0cu3r. Instead of trying to scrape that site all one csv file you should save results to a database and do a systematic scrape. In your case you already have a database with data, I would clone that database and add extra columns. Make the scraper refresh each time and start at the lowest id scraping the additional data and insert into the cloned database. Have an additional column to check for if was scraped or not in case was a glitch so don't have to start scraping from the beginning again. -
Welcome to the club Fastol.
-
If I wanted my girlfriend to learn this I would walk her through the manual the same way I learned php, except she would have you to help and explain as well. http://php.net/manual/en/index.php Her asking any questions she is not fully understanding at the time is a good thing, promote that while teaching her. You don't always find out an answer if never ask the question. Spend more time going through and playing with functions and knowing what works better certain situations or know there is many options, be creative using a few together. http://php.net/manual/en/language.functions.php Can browse through some of the extensions and get even more ideas. http://php.net/manual/en/extensions.alphabetical.php Create along with her a "what did I learn so far" and store into a database. Making something useful gives a goal and sense of accomplishment. Math related are always fun right? Making forms and retrieving POST,GET,SERVER,REQUEST Uploading files or images Folder and file based functions Creating sessions and cookies, accessing them. Playing with many date functions and modifying them for display. Creating simple functions. Show how can echo within the function or return results. Adding multiple parameters. Explaining arrays and key values, different array types. foreach and for loops, accessing arrays. using various string manipulation functions how to concatenate and escape php/html database usage I posted a fairly long "do and don't" list for another member. http://forums.phpfreaks.com/topic/293447-echo-hello-world/?do=findComment&comment=1501111
-
I'd say so, lots of work to show a random image on a page with 2 buttons. To copy and host them is like image theft. loading a huge image isn't fun for many, I would hotlink from imgurl If I was to do such a project: simple image scraper using curl and php, most likely using dom and domxpath set a cron job to run the script scrape hyperlinks/alternately image tags and (match imgurl pattern if just want those, extract just the codes and normalize links the same for all imgurl) store full href links to expand upon this a day to other sites set a unique index on the url to prevent duplicates If the site scraping has adequate data just use their titles and or descriptions, otherwise go to the image source pages and obtain that data. In this case imgurl has all the opengraph meta data. I would hotlink from imgurl, cache smaller thumbnails and do a gallery in pagination or some lazy loader jquery or js/ajax If cached image exists load that...otherwise scale the image down or merely use css for a max width or height as a thumbnail. The frontend would be a mobile css design and more on the page than just a gallery.
-
That is a vague question. Is many variables to them that could make them slower. By default they are fast. A big helper would be to cache the results or pages somehow. Optimize queries and create an index for the database. Only fetch data you are using Don't load lots of images or large ones, cache smaller thumbnail versions of them when can. Use gzip or any other compression for js and css Can test your pages out here and try to find out what is making it slow. http://tools.pingdom.com/fpt/
-
Try laravel instead Have a look at octobercms built with laravel and made for developers
-
Recommended SQL datatype for BCRYPT hash
QuickOldCar replied to NotionCommotion's topic in PHP Coding Help
That's why having it a string would be better, don't need to deal with these issues. -
Recommended SQL datatype for BCRYPT hash
QuickOldCar replied to NotionCommotion's topic in PHP Coding Help
It's said that char is 50% faster than varchar, I've never done any performance tests on it. Although if stored larger with varchar and the data is less, it will only use as large as the data is, so some space savings and room to breath, possible less problems (like if had a space and didn't trim, change in code,etc...). -
Recommended SQL datatype for BCRYPT hash
QuickOldCar replied to NotionCommotion's topic in PHP Coding Help
Stick with char(60) then, no sense doing as binary if is not binary data, would need to do string to binary conversions -
Recommended SQL datatype for BCRYPT hash
QuickOldCar replied to NotionCommotion's topic in PHP Coding Help
I use varchar(255) because mine vary in length If the values are always the same length go with char, if they will vary use varchar varchar will trim the spaces if is less characters than assigned, char will not and pad with spaces -
A tool for testing your htaccess rules online http://htaccess.madewithlove.be/