premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
FOr multi-line if statements you need to use brackets and use ltrim to trim from the left: if(in_array($x, $valid)) { $trimmed = ltrim($x, "cat:"); include_once $trimmed . '.inc'; }else { include '1.inc'; }
-
Yes, it can.
-
links not clickable after fetching from db
premiso replied to $php_mysql$'s topic in PHP Coding Help
You could, but there should be examples of just finding urls in text. http://www.phpfreaks.com/forums/index.php?topic=336117.msg1583321#msg1583321 I would also check out that topic, it has code for what you want to do. -
links not clickable after fetching from db
premiso replied to $php_mysql$'s topic in PHP Coding Help
Turn them into hyperlinks using the <a href="http://somesite.com">http://somesite.com</a>. If you need a method to parse them, search the manual comments here preg_replace. -
Put csv file contents into text area and choose random line
premiso replied to giraffemedia's topic in PHP Coding Help
The only time the file is stored permanently is if you actively move the file in the php script. You can read from the file using the temporary file location. The location can be found with something like: $tmp_name = $_FILES["formfield"]["tmp_name"]; $fh = fopen($tmp_name, 'r'); if ($fh !== FALSE) { while (($data = fgetcsv($fh, 1000, ",")) !== FALSE) { $num = count($data); echo "<p> $num fields in line $row: <br /></p>\n"; $row++; for ($c=0; $c < $num; $c++) { echo $data[$c] . "<br />\n"; } } fclose($fh); } Something like that should do what you are looking for. -
You could always install a deal on Chromium (if you use chrome) called "Disconnect" I use it all the time, it monitors Twitter / FB / Google cookies and allows you to disable them for certain sites etc.
-
I would take a look at the following: http://www.ferdychristant.com/blog/archive/DOMM-7QJPM7 I used to have a more elegant resource but I cannot find the link anymore. If I find that I will post it. But your google terms, if you decide to do more research should be: MySQL Hierarchical
-
You should still validate the data, especially if you want to give useful errors to people. You just won't need to escape the data, as the prepared statement (bindParam) handles that for you.
-
Where is that coming from? Javascript? PHP on it's own cannot detect screen resolution, at least as far as I know.
-
The main thing is it makes the hash larger and increases the chances of collisions. Instead of doing double md5's I would do the inner md5 and the outside sha1. But a good unique salt would do better than doing an inner md5 hash. But yea, that is the main reason why it would be considered bad practice. What is a collision? Basically it increases the chances that user X's hash is the same as user's Y's which can be a security breach if someone by chance figures out an exploit or accidentally gets authenticated as that user. Edit: Along side of that, it would also increase the chance that a brute force attack would be successful, as with the collisions, it could mean that they could do less attacks and perhaps get "lucky".
-
Isn't this in the Forum Posting 101 manual classified under "Common Sense" ?
-
Google releasing a(nother) new programming language
premiso replied to joe92's topic in Miscellaneous
Is it just going to be a rename of GoLang? -
All you have to do is bendover... *premiso unzips
-
I require a $50 meal and sex first prior to a first date.
-
I guess this is where adblock has it's advantages.
-
Impossible to do without that functionality built in. If you have a php script that you can connect to write to it. But would need to be coded for an api-key if not it could be exploited easily. Or you can use SSH / FTP. But you have to have some type of functionality to allow the write method as http on it's own is generally read only.
-
cannot connect to server via PuTTy (SSH)
premiso replied to webguync's topic in Other Web Server Software
Perhaps you need a guide: http://webmaster.iu.edu/tool_guide_info/webserve_putty.shtml -
Why do I even bother replying if you are not going to read my post about associative indexed arrays and how to handle them? mail($row['email'], "Teste - Enviar Emails", "Teste - Enviar Emails", "From: Teste - Enviar Emails"); OR mail("{$row['email']}", "Teste - Enviar Emails", "Teste - Enviar Emails", "From: Teste - Enviar Emails"); For an explanation of WHY see my above post where I outlined how to fix your issue. And just incase you are too bold headed that you cannot scroll up, here is a link: http://www.phpfreaks.com/forums/index.php?topic=343361.msg1619881#msg1619881
-
Look at the syntax highlighting in your post, this should fix it. echo "{$_SESSION['SESS_EMAIL']}"; If you are using associative indexed arrays inside of doube quotes, you need to bracket them for it to parse correctly. While we are on this topic, you do not need to surround the variable in quotes if it is not apart of anything but itself. So I would just do this, unless there is more than just that one echo statement: echo $_SESSION['SESS_EMAIL'];
-
Since you are dealing with slashes, choose a different delimiter. preg_match_all('#<a href="/load/(.*)?pk=#i', $page, $pages); Should get you what you want.
-
Did you call session_start on all the pages you are using session on before you set / retrieve a variable? Have you tried echoing out the variable to make sure it was populated correctly? The question is vague with hardly any details. We need more information to help you.
-
You are going to need to be less vague. A model in what sense? MVC? In order to do that you would need some type of framework assistance. If you elaborate on what your goal is etc, we can provide you with a more thorough answer.
-
Something like this should work: <?php function timeDiff($firstTime,$lastTime) { // convert to unix timestamps $firstTime=strtotime($firstTime); $lastTime=strtotime($lastTime); // perform subtraction to get the difference (in seconds) between times $timeDiff=$lastTime-$firstTime; // return the difference return $timeDiff; } //Usage : echo timeDiff("2002-04-16 10:00:00","2002-03-16 18:56:32"); ?>
-
How do you echo/flush strings during script execution?
premiso replied to ballhogjoni's topic in PHP Coding Help
Output buffer is not ideal for that job, unfortunately. Since some browsers choose to ignore it and hold all output to the end. What I would look into is using an AJAX type script to report you the status of how it is going, sort of like a "processing" script. That way you just keep the feed open and update the data on the page with ajax.