Lumio
Members-
Posts
679 -
Joined
-
Last visited
Never
Everything posted by Lumio
-
What do you think about the template-engine blade? It uses eval for rendering.
-
What do you mean? Is it that bad?
-
Hi guys! I just heard about Laravel www.laravel.com and wanted to know, what you think about it. I usualy use CodeIgniter but thought that the way Laravel does routing is interesting So what do you think and for what apps do you think is it good for? Thanks
-
Hi, I'm an owner of a root-server. I have it in the office of my work. But now I'm thinking about another place where I have a better connection. In the office I only have 2 Megabit up and down. A bit too slow Now I'm looking for a good and also cheap solution. I found the following: http://netdirect.de/c/cms/front_content.php?idcat=3&idlang=1 But are there others?
-
Maybe this will work: <?php if (array_key_exists('item_retail', $_GET)) echo floatval($_GET['item_retail']) * .75
-
Google: php template engine Result: http://www.smarty.net/ You can also create your own template-engine by using str_replace, or if you want to do some advanced stuff: preg_replace and preg_replace_callback Think about caching (by saving your template and content in an extra file) And include is not a good way to do so.
-
Thank you I made it a little bit different now: /\({\$[\w\d\[\]^\n]+\})|(\<\<.+?\>\>)/
-
Okay. In the first case I face the following data: a little string with {$var} in it the second case: a little string with <<foo bar >> in it The first expression should just match in one line, the second in multiples.
-
Hello! I got two expressions: /(\{\$[\w\d\[\]]+\})/ ans /(\<\<.+?\>\>/s How can I merge these two expressions?
-
is that quicker? but what if I want to say everythink but not PLAIN?
-
No, they are the only one. Without any other text.
-
Hi! Thanks for your quick answere. Well I do have more keywords like that. For example K_IF or K_ELSE or K_ENDIF. Let's say, I only want to let a condition get true, if it is not PLAIN. Okay, for that reason I can use a normal if-statement. But lets say I don't want to have lets say PLAIN and also not K_ENDIF. So I thought ^PLAIN|^K_ENDIF would do it, but no. It doesn't I want to match the whole key.
-
Hello, I have a little problem with regular expressions. I got the following string: $str = "PLAIN"; So what I want to do now is to say, that if the string is PLAIN, that it is not true, but with a regular expression. I tried <?php $str = "PLAIN"; $r = "^PLAIN"; var_dump(preg_match("/($r)/", $str)); But it always gets 1 and not 0. Why?
-
Try the following expression: /\<div class\=[\"]{0,1}votes[\"]{0,1}\>(.*?)\<\/div\>/s If also the class is different, make something like [\w\d]+ instead of votes. Anyway, the /s in the last position allows you to look over the lineedges
-
[SOLVED] Cannot find problem in this script.
Lumio replied to tomcommathe's topic in PHP Coding Help
Instead of if (@mysql_num_rows($result) == 1) { make if ($result != false && mysql_num_rows($result) == 1) { This is going to check $result if the query was ok or not. If not the if-statement gets false. Also check if mysql_error() is empty or not. -
<?php $where = ''; if (array_key_exists('Genus', $_GET)) { //Checking Genus $genus = mysql_escape_string($_GET['Genus']); //To avoid SQL-Injection use mysql_escape_string for user-input $where = "`Genus` = '$genus'"; } if (array_key_exists('Division', $_GET)) { //Checking Division $division = intval($_GET['Division']) //Get an integer out - so don't allow Hello1 or something like that if ($where != '') $where .= ' AND '; $where .= "`Division` = $division"; } if ($where != '') $where = ' WHERE '.$where; $sql = "SELECT Product_ID, Genus, Common_name, Description FROM products$where ORDER BY Product_ID DESC "; //echo $sql; something like that: //SELECT Product_ID, Genus, Common_name, Description FROM products WHERE `Genus` = 'something' AND `Division` = 1 ORDER BY Product_ID DESC ?>
-
I also won't save images in the database. But remember the difference of an html-page and an image: html is plain text, images is not plain text. So you can't just output the image-source into the html page. Create a new file for the image and write the following: <?php //... here should be the connection for the database $query = "SELECT thumbnail FROM uploads where intProductID=$adid"; $result = mysql_query($query); //PHP-Function are mostly written in lower-case!!! $data = mysql_result($result,0,"thumbnail"); header('Content-type: image/png'); /* I don't know which type of image you are outputing but you need to change the header */ echo $data; ?>[code] And in you html-code (if the file is called image.php): [code]<img src="image.php" />
-
[SOLVED] My code stops executing, but there are no errors posted!
Lumio replied to macattack's topic in PHP Coding Help
Load your page and look at the source-code. You have a little mess with quotes. use double Quotes (") for html-attributes, as <h2 class="center"> and not single one (') If this is XHTML you must use double-quotes. Your problem right now is the following line: <form action="admin_login.php?login='yes' method='POST'> Can you see, that you closed the quote? I can't. -
Answer: yes it is possible for example with the mysql function LEFT: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_left or also with the php function substr: http://php.net/substr
-
That's not php and also doesn't help you to prevent steeling your pictures. It's better to use watermarks.
-
What do you mean? You want to have a form, where users can write something and the input is then given to you?
-
See the mySQL manual (if you use MySQL) http://php.net/mysql_connect
-
<?php $currentDay = intval(date('j')); //Current day $days = intval(date('t')); //How many days has the current month for ($iDay=1; $iDay <= $days; $iDay++) { if ($iDay == $currentDay) echo '<b style="color:red;">'.$iDay.'</b>'; else echo $iDay; } ?>
-
Do you mean something like Lightbox or Lytebox? Ask Google for that case.
-
I made a script for a friend, that mailed to 200 adresses and it didn't appear as spam.