-
Posts
3,404 -
Joined
-
Last visited
-
Days Won
55
Everything posted by Ch0cu3r
-
No, as long as you're handing the $_GET variable safely. Such as don't do include $_GET['page']; Make sure you check that what $_GET is requesting is a file that exists in the location you expect it be in. Only except filenames not file paths.
-
Finding Time range between two given times in Php
Ch0cu3r replied to mflevie44's topic in PHP Coding Help
explode the time on the : (colon) into $hour and $min variables. Compare $hour is between 7 and 20. Example code $time = '7:45'; list($hour, $min) = explode(':', $time); if($hour >= 7 && $hour <= 20) { // time is ok } else { // time is out of range }- 2 replies
-
- php
- unixtimestam
-
(and 2 more)
Tagged with:
-
New Form Authentication - PIN ONLY - NO Uername
Ch0cu3r replied to jsmith664732's topic in PHP Coding Help
Modify the HTML form, delete the password field, rename the username field to pin then you can retrieve the entered value using $_POST['pin'] -
Your question doesn't make sense. Your php app is most probably using mod_rewrite. For example the url domain.com/view/title-of-page-blah-blah is actually being mapped to the following url domain.com/page.php?q=view&title=title-of-page-blah-blah You'd access view and title using $_GET['q] and $_GET['title] variable. Not $GLOBALS.
-
So you want to get all the Q&A's from your database and paginate the results? have a look at this http://www.phpfreaks.com/tutorial/basic-pagination
-
Oh logout page. I miss read your topic as layout page. Umm hacking?
-
What does that mean?
-
The spaces in body is breaking the mailto: clause You need wrap the value of the href attribute in quotes. <a href="mailto:abc@gmail.com?body=hai every body&cc=aa@gmail.com&subject=Letter&body=This is the body content">Link</a></td>
-
I have a feeling this book is out of date. echo $tireqty." tires<br>"; echo $oilqty." bottles of oil<br>"; echo $sparkqy." spark plugs<br>"; The above is the old way of getting data from a form that has been submitted. This will only work if a setting called register_global is enabled. This setting has been removed as of php5.4. You should find a book that is using this version at least, a book published in 2012 should be more up to date. The correct code would be to use the $_POST super global instead echo $_POST['tireqty']." tires<br>"; echo $_POST['oilqty']." bottles of oil<br>"; echo $_POST['sparkqty']." spark plugs<br>";
-
how to get the array contents and serialize data
Ch0cu3r replied to new_member's topic in PHP Coding Help
so $this->test['testing'] contains a multidimensional array. You'll need to do a foreach within a foreach foreach($this->test['testing'] as $array) { foreach($array as $key => $value) { // do something } } If thats not what you want you'll need to explain more clearly what you're trying to do and post what code you have tried. -
If you're using PDO then you cannot use the mysql_* function library along side it. fetchColumn is an equivalent to mysql_result
-
how to step up and down through the result of an sql query
Ch0cu3r replied to ajoo's topic in MySQL Help
Pagination is a very common technique for displaying your results in pages rather than display them as one big long list of results. So page 1 can display results 1 - 10, page2 will display the results from 11 - 20 etc. how many results you want shown per page is down to you. Here is a basic tutorial on pagination http://www.phpfreaks.com/tutorial/basic-pagination -
Ignore.. shutting up now
-
How are you connecting to your vps via ssh? Isnt sftp or scp setup? Thats how you'll upload files to your vps. By fault on debian Apache serves files from /var/www folder. This can be changed via apaches configuration in /etc/apache/sites-available/default.
-
how to step up and down through the result of an sql query
Ch0cu3r replied to ajoo's topic in MySQL Help
You can use mysqli_data_seek -
In what format is the date currently formatted for $_POST['londerhoud'] and $_POST['vonderhoud']? I will also reiterate which function you'll need to use a I said earlier.
-
how to get the array contents and serialize data
Ch0cu3r replied to new_member's topic in PHP Coding Help
Its the same format foreach($this->test['testing'] as $key => $value) { // do whatever } -
iteration to check if xlm data exists in db
Ch0cu3r replied to codecreative's topic in PHP Coding Help
md5 can be used for a whole range of things, passwords being one of the main uses but is being phased out for better password encryption methods. md5 in the line you posted is being used to obfuscate the file name I guess, making it harder for hackers to guess the name of the dump file for instance. -
First google search for difference between mysql table innodb and MyISAM http://dba.stackexchange.com/questions/1/what-are-the-main-differences-between-innodb-and-myisam looks very informative and answers your question nicely.
-
PHP not working in IE 8/9/10
Ch0cu3r replied to albionite's topic in PHP Installation and Configuration
Maybe a stab in the dark but what is IE's security ( Internet Options > Security) setting set to? It may be too high to allow cookies or you may also want to check the privacy tab too. -
Need to display form field output in table format
Ch0cu3r replied to judah's topic in PHP Coding Help
I do give you credit for trying to modify a third-party script and learning php in the process. If you're still learning the language then you're bound to run into small little issues like this. Modifying third party scripts from someone else is not always easy as they are usually badly documented (lack of documentation/comments in the code) and poorly put together. All pros get something wrong from time to time. No ones perfect Yeah I noticed that too. It is because of the functions group_start(), group_end and, total_end() were defined twice. Once you declare a function you cannot declare it again. If you do you'll get a duplication function error. We got there in the end. -
So you want to loop through all the links on a page and apply css to a specific word or to the whole link? To give a nudge in the right direction have a look at this example script for highlighting words in text <style type="text/css"> .hightlight { color: red; background-color: yellow; } </style> <?php // wraps word with span tag with hightlight class applied function hightlight_word($word) { return '<span class="hightlight">' . $word[0] . '</span>'; } // some dummy text $text = ' I like cats and dogs. cats like to each fish. dogs like to chase cats. '; // word to search for $word = 'cats'; // search for word and apply highlight_word() $text = preg_replace_callback("~\b$word\b~i", 'hightlight_word', $text); // display text with highlighted word echo nl2br($text); ?>
-
Need to display form field output in table format
Ch0cu3r replied to judah's topic in PHP Coding Help
On line 634 add closing tag ?> I'm guess you're new to PHP, you need to be more careful when go in and out of "php mode" with the <?php and ?> tags. A <?php tag must have a matching ?> tag. if you do not then you'll get errors like this. because you're going in an out of php mode so often it makes it more difficult to identify this issue. You also need to take the time making sure your codes syntax is correct. You cannot just copy 'n paste code somewhere and just expect it to work. -
Need to display form field output in table format
Ch0cu3r replied to judah's topic in PHP Coding Help
That line is fine. I expect something else is causing this error. Attach the file.