premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
[SOLVED] creating a php script to log everyone off by CRON JOB
premiso replied to wmguk's topic in PHP Coding Help
http://www.devarticles.com/c/a/PHP/PHP-CLI-and-Cron/1/ I would suggest against lynx. 05 * * * * /usr/bin/php -f /var/www/vhosts/domain.co.uk/httpdocs/admin/scripts/cron.php That should run the script, it is better to do it this way, at least in my opinion. (That runs the script every minutes.) -
[SOLVED] creating a php script to log everyone off by CRON JOB
premiso replied to wmguk's topic in PHP Coding Help
It is because it is just reading out the script to the standard output. You need to process the script using PHP CLI (Command Line Interface). Look it up, I am sure if you google CRON PHP CLI you will get some examples. -
[SOLVED] creating a php script to log everyone off by CRON JOB
premiso replied to wmguk's topic in PHP Coding Help
I would move it outside of the webfolder, use PHP CLI to run it and make sure it has executable permissions (I believe that is needed by owner, doubt it is needed by public). -
<?php for($i = date('Y'); $i >= 1901; $i--){ echo '<option value="'.$i.'">'.$i.'</option>'; } ?> Try that.
-
I think you would need to use an API for this... http://apapi.sourceforge.net/ https://www.paypal.com/IntegrationCenter/ic_sdk-resource.html Either should be fine, which is better no clue. I never used it.
-
Well show us the query and maybe we can help you. You have multiple items in your DB with the same game name thus you get the duplicate name listings.
-
Well you will need to look up mail MIME types, I do not send emails as HTML, so maybe someone can help you with that part. As far as getting that into a variable for you to utilize try this: <?php ob_start(); ?> <table width="100%" border="0" align="right" cellpadding="5" cellspacing="0" class="row1"> <tr> <td class="headingText"><table width="100%" border="1" cellpadding="5" cellspacing="0" bordercolor="#000000" class="tablebody"> <tr> <td colspan="2"><? $querySearch = mysql_query("SELECT * FROM basket WHERE order_ref = '$invoice' ORDER BY `id` ASC"); while($myrowSearch = mysql_fetch_assoc($querySearch)) { ?></td> </tr> <tr> <td class="tablebody"><div align="left"><? echo $myrowSearch['name'] ?></div> <div align="left"></div> <div align="left"></div></td> </tr> <tr> <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="5" class="tablebody"> <tr> <td colspan="4"><? $category_id = $myrowSearch['product_id']; $queryLinks = mysql_query("SELECT * FROM images WHERE pk = $category_id ORDER BY `pk` ASC"); while($myrowLinks = mysql_fetch_assoc($queryLinks)) { ?></td> </tr> <tr> <td width="250" class="tablebody"><div align="left"><? $msg1 = $myrowLinks['description'] ?></div></td> <td width="250" class="tablebody"><div align="left"><a href="http://<? echo $myrowLinks['website'] ?>" target="_blank"><? echo $myrowLinks['website'] ?></a></div></td> </tr> <tr> <td colspan="4"><? } ?></td> </tr> </table></td> </tr> <tr> <td colspan="2"><hr size="1" /></td> </tr> <tr> <td colspan="2"><? } ?></td> </tr> </table></td> </tr> </table> <?php $emailContents = ob_get_contents(); ob_end_clean(); ?> That will put your table created into $emailContents, now you just need to figure out the right mail headers etc to send it as an HTML email. Mail() should have examples of that.
-
I have probably asked this before as I know this is the first time you posted this question. Have you looked into phpMailer or PEAR::Mail (I would go for phpMailer over Pear, but that is an option). Mail() I know it is not much help, but that is about all I can think of as I have never needed to send more than 1 attachment at a time via php Mail.
-
Show your current code, chances are no one is just going to blindly write this up for you. It is possible, if it is done right.
-
It should be turned off as it is being depreciated. Since he is not doing any db insert, this is how it should be. Just so you know as an fyi.
-
I haven't read through all the posts. This is not really a PHP question either. But I do know that in IE the only item you can have "rollover" effect is the anchor tag. To extend this you need a .htc hack file which can be found via google to extend the rollover functionality to IE. Now as far the JS part, I just assume it changes styles, which would still make this true. Whatever:hover There is a site with that hack and explanation of it.
-
[SOLVED] str_replace only inside of certain HTML.
premiso replied to atticus's topic in PHP Coding Help
One side note to the above. If you want it to just replace the first one, preg_replace's 4th parameter is a limit, change that to 1 and it will only do the first occurrence. As it is now, it will do all h1's inside the document. -
SELECT sum(hours) FROM table_name WHERE member = '5555'; That will give you the hours, you can calculate days using basic math techniques.
-
Your function does not return the array, thus it is only valid in the function scope. Try this: <?php function ReservationResultsInArray() { include ("array.php"); $countreservations = 0; foreach($array as $val) { $countreservations++; $startdate = strtotime($val['start']); $enddate = strtotime($val['end']); $hours = (($enddate - $startdate) / 60) / 60; $result[] = array( "id" => $val['id'], "hours" => $hours, "start" => $val['start'] ); } return $result; } // einde functie $result = ReservationResultsInArray(); I bet that will make it work.
-
[SOLVED] str_replace only inside of certain HTML.
premiso replied to atticus's topic in PHP Coding Help
Is this the only <h1> tag on the site? If so, this should work: <?php $string = "Replace this title <h1 class=foo>Title</h1>"; $replaced = preg_replace("~<h1(.+?)?>(.+?)</h1>~s", '<h1$1>test title</h1>', $string); echo "Original: " . htmlentities($string) . "<br />"; echo "Replaced: " . htmlentities($replaced) . "<br />"; ?> This will not keep the "class" if you wanted to keep that. If you do care if that is kept let me know and I will do some revisions. EDIT: Changed it so it would keep any attribute inside the <h1> tag. This should work for what you need, given that there is only 1 <h1> tag on the site EDIT:EDIT: Changed it to work with or without attributes in the tag. -
That tends to help.
-
No clue, I am sure you can use the read function, but I have never used it before. Most Captchas do not use imagemagick, they use the straight php functions. Find one that does a text twist that you like and look at that code to see how they did it. If all else fails GD Library look at those functions available to you and see if any tickle your fancy.
-
Is this code on the same page that you populate the $results array? And after it is populated?
-
You want to look up imagemagick http://www.imagemagick.org/Usage/distorts/#perspective That should have what you want. If not look at some captcha scripts to see how they do it. Should be plenty of those scripts laying around for you to look at.
-
$hours = 2; echo "Hours: " . $hours . " <br />Array Hours: " . $result[0]['hours'] . "<br />Returns:<br />"; if ($result[0]['hours']== $hours) { echo "Yep the hours were equal."; }else { echo "Nope the hours were not equal."; } See what that returns.
-
Depending on how the form is processed either $forminputname = $_GET['forminputname']; // OR $form2inputname = $_POST['form2inputname'];
-
Like I said, I have never done this. Chances are it is not port 80. You have to find out what port windows file server uses. I have no clue which port that is. PHP Networking may also have some more insight. Port 80 is used by web servers so I bet it does not work cause that file server is probably not running Apache to dish out the files. EDIT: And to be honest, I do not even know if this is possible. You "may" want to setup an FTP server to access those files, but that opens a whole nother can of worms. And the above would only work if the Windows Box is on your local network if it would even work. If they are not on an internal network with each other, FTP would be the only way to go about this. Unless you can figure out how to get this to work on an internal network, then VPN would be an option as well.
-
$result[0]['hours']== $hours The index is just the number adding the ' to it treated it like a string, which it is not. Try that.
-
[SOLVED] Maximum Commands Per Page. Is 52 Too Many?
premiso replied to Fluoresce's topic in PHP Coding Help
None taken. I know it is bad, but my brain is not working right for SQLs today, so yea. Thanks for posting a correct way to do that. lol and that is why I said: