-
Posts
1,469 -
Joined
-
Last visited
-
Days Won
12
Everything posted by CroNiX
-
Sorry, this is part of your other thread where it looks like you are creating a hacking script. http://forums.phpfreaks.com/topic/290552-fetching-from-textarea-into-array-php/
-
Is there a correct way to create a folder then copy files to it?
CroNiX replied to SmexyPantsGnome's topic in PHP Coding Help
This is how we learn, so it's not "time wasted". -
Is there a correct way to create a folder then copy files to it?
CroNiX replied to SmexyPantsGnome's topic in PHP Coding Help
Once the user logs in store their user info in $_SESSION. On the page that displays the user profile, check that the name entered in the url is the same as the name they logged in with. If it's not, display an error. If it is, show the page. Are you only relying on a username and last IP address? No password? -
show an example of users.txt, and how you want the array to look like after it's converted
-
There are thousands of sites and tutorials that explain how to create html forms.
-
This is starting to look like a hacking/malicious script.
-
You do not have any FORM elements with these names that you are trying to access via POST: $_POST['OrderForm']; $_POST['name01']; $_POST['TOTAL']; You are doing stuff like this which makes no sense: <td TYPE=TEXT NAME="PROD_SCONE_2.00" onChange="CalculateTotal(this.form)" class="style13" >2,00</td> Is that supposed to be a form element? It's a TD.
-
Post what you've tried that didn't work along with any error messages you were getting.
-
You aren't actually using simple_html_dom. You grab the page using curl and put it in $html, but $html is not a simple_html_dom object. It's just a string. Either use the simple_html_dom function, file_get_html(url) instead of using your custom curl function, or, pass $html that you retrieve using getHTML() to the simple_html_dom function str_get_html($html). Then you can use the find method. $html = file_get_html('http://www.website.com'); foreach($html->find("img") as $element) ... or $html=getHTML("http://www.website.com",10); $html = str_get_html($html); foreach($html->find("img") as $element) ... http://simplehtmldom.sourceforge.net/manual.htm
-
How Do You Create Sortable Pagination Results?
CroNiX replied to Fluoresce's topic in Javascript Help
Yes. What if something changes, like you add a new feature. Would you like to update 1 page of code or 9? You'd be basically duplicating code 9 times with small variances which is not what programmers should do. This is like saying you shouldn't have pagination and manually create 1 file for each page. Do you really need to rewrite the url for this part? Why not keep that part a querystring? /browse/1?category=video-documentaries&order=popularity Also, since you have newest-oldest (descending), oldest-newest (ascending)...why wouldn't you do the same for popularity? -
I believe he's trying to style the "Choose File" button that shows on a file input.
-
alternatively, since $aMeat is an array, you can use implode() on it, like $N = count($aMeat); $message = "You ordered $N meat(s): " . implode(', ', $aMeat); Message would now be something like: You ordered 1 meat(s): pork or if there were more than one selected: You ordered 3 meat(s): pork, beef, chicken
-
Problem is you're echoing the values, which will just go out to the browser. You want to add it to a string. $aMeat = $_POST['tMeat']; $message = ''; if(empty($aMeat)) { $message = "You didn't select any meats."; } else { $N = count($aMeat); $message = "You ordered $N meat(s): "; for($i=0; $i < $N; $i++) { //add this meat to the end of the $message string (string concatenation) $message .= $aMeat[$i] . " - "; } }
-
PHP usually gets executed as the webserver "user". In my case it's "www-data". So that user would need WRITE group permissions on that directory.
-
Please use the editor and wrap the code in the code tags. You can do that in the editor by highlighting the code and clicking on the <> symbol/button.
-
Something like this might work for you. var availableTags = [ "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme" ]; <?php $arr = array('red', 'green', 'blue'); echo "var php_array = " . json_encode($arr) . ';'; ?> availableTags = availableTags.concat(php_array);
-
I'm not sure how you would do that then. One is in the browser (js) and the other is on the server (php). Somehow they need to be in the same place in order to merge them.
-
run the array through htmlentities with the ENT_QUOTES flag before json encode?
-
Yes, but that's a javascript array. Is it being generated by php or something before you stick it on the page?
-
I'm not understanding the difference either; they are both coming from php. Either a json object embedded in the php page, or retrieving the json object via ajax. I understand that if you are using user-supplied data from the public that it could be harmful to just "include" it, but that would be true whichever way you retrieved it, wouldn't it?
-
Where is the js array stored? Somehow you'd have to get that into php-land, or vice-versa. Then just json_decode(js_array) and array_merge() it with your php array, or the other way around (json_encode(php_array) and concatenate the 2 js arrays using jsarray.concat(other_array))
-
The 50% width of the search bar is taking 50% of the parent container, which will force some other child objects onto the next "line" unless the others can all fit within the remaining 50%. If you want to use %'s for the children, then they all need to total to 100% or just below that, which is hard to do when you mix %'s and px's.
-
If you use text-align: center on the parent div that should help. You already have display:inline-block on the child elements so that's correct. One problem is the image also takes up space (it's also a child of the container), and your search bar is using 50% width, so those will affect the outcome.
-
php Script used to search multiple websites at once.
CroNiX replied to dolke022's topic in PHP Coding Help
You wouldn't be "copying the website". You'd be storing a local copy of the HTML results page from the other site so you can parse it locally. What you are trying to do isn't a simple task. You wouldn't need "multiple scripts". You'd need a different parser for each type of site, which can just be different methods in the same class. For instance, if you wanted to search google remotely it is different than searching MSN. The query strings in the URL are different and the results are also in a different HTML format, so you'd need to know that in order to scrape the data/parse the DOM structure properly. So you'd need a way to identify each "type" of site, like you mentioned Magento, and parse it with the proper parser designed for each type. So you'd need to know ahead of time what each site uses and then use the proper parser for each site. Site A uses Magento Site B uses ClearCart Site C uses OpenCart Site D uses Magento In order to speed up the process, you'd want to be using asynchronous requests so that you don't have to wait for the result from Site A before getting the next one from Site B. So they can all be executed at the same time basically.- 16 replies
-
- search
- multiple websites
-
(and 3 more)
Tagged with: