473,394 Members | 1,811 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

explode & mktime function

Expand|Select|Wrap|Line Numbers
  1. $blid=$_GET['blid'];
  2.  $query=mysql_query("select * from pms_block,pms_rental where pms_block.block_id=pms_rental.block_id and pms_rental.block_id=$blid");
  3.   $r=mysql_fetch_object($query);
  4.   $parts1 = explode("-",$r->agree_date);
  5.   $thatis1 = mktime(12,0,0,$parts1[1],$parts1[2],$parts1[0]);
  6.   $nicedate1 = date("j - F - Y",$thatis1);
  7.  
i don't know how explode & mktime function works...
can you tell me that..
Apr 4 '08 #1
2 1791
Markus
6,050 Expert 4TB
Very basic php functions - i suggest you get familiarised with them.

Eplode()

Mktime()

Regards.
Apr 4 '08 #2
coolsti
310 100+
I just feel I do need to add this. Look at these two lines of code:
[php]$blid=$_GET['blid'];
$query=mysql_query("select * from pms_block,pms_rental where pms_block.block_id=pms_rental.block_id and pms_rental.block_id=$blid");[/php]

Now imagine what would happen if a malicious user modified the URL that would normally be created when submitting your form:

http://www.yoursite.com/yourphpfunct...?blid=1;delete from pms_block;delete from pms_rental

Obviously the hacker in this case would need to know the names of your database tables for this example to work, but I am sure one can come up with many other more generalized sql statements that could be just as dangerous. In the above case, this URL combined with your script will cause the two tables pmd_block and pms_rental to be emptied completely.

The moral of the story: never use $_GET or $_POST variables directly in SQL or other executable statements without validation and appropriate filtering of anything malicious.

Steve, Denmark

Please enclose your posted code in [code] tags (See How to Ask a Question). - moderator
Apr 4 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Sandman | last post by:
Hi. On my Linux RedHat 8 system, I can't obtain dates earlier than 1970 with PHP. That is, when feeding a function that turns dfates into unixtime, such as mktime() and strtotime() print...
9
by: WebM¤nkey | last post by:
Hi folks Just found that the mktime function returns a negative value when the date is 26 march 2006 with 0 hours, 0 seconds and 0 minutes. Is this a documented problem ? Any suggestions ?
16
by: John Hanley | last post by:
I created a function that breaks down a date into broken down time, I subtract a certain number of seconds from that, then use mktime() to recompute the calendar time. It works basically except...
12
by: frizzle | last post by:
Hi there, i have a site with fake folders & files. htaccess rewrites everything to index.php?vars now in index.php i decide what file to include with a switch/case statement. to define where...
5
by: FFMG | last post by:
Hi, I need the php equivalent of explode in one of my app. I read a very big file and "explode" each line to fill a structure. The reading of the file, 19Mb, (I will also need to streamline...
0
by: k04jg02 | last post by:
Python has a nifty operator that will take a container and pass its elements as function parameters. In Python you can make a list like so: x = Then you can say: f(*x)
5
by: alcool | last post by:
hi, I have 2 date/time values i.e. the system date/time and (h:m dd:mm:yyyy). I would like know to find a routine that calculate this difference. Maybe using the struct time_t and difftime. ...
2
by: John Hanley | last post by:
I am getting some inconsistencies with mktime(). I allocate memory for my struct tm early in my program, and assign only *some* of the member variables. t->tm_sec=s; t->tm_min=m;...
5
by: sathyashrayan | last post by:
Dear group, The function to be used as follows: $links = "http://www.campaignindia.in/feature/analysis"; $tag1 = '<div class=feature-wrapper>'; $tag2 = '<h1><a href'; $tag3 = "</a>"; $op =...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.