dweeber
-
Posts
16 -
Joined
-
Last visited
Never
Posts posted by dweeber
-
-
I need to find out the length of a file
http://php.net/manual/en/function.filesize.php or
http://php.net/manual/en/function.stat.php
or just find out if there is a file called "abc" in the folder, if the file is not there, it errors "Cant open file" "No such file", how do i get around thisDoes file exist:
http://php.net/manual/en/function.file-exists.php
Search through a directory:
http://php.net/manual/en/function.readdir.php
Also, i have a varible, A$A$ = "BOB"
i need it to equal "'A$'.V"
i tried to use A$ = A$ + ".v", it doesn't work, but it doesn't error ???
# $A = "BOB"; # $A .= ".v"; # echo $A; BOB.v
-
The SID is the Session ID. You are most likely using session variables.
-
You are not really showing where in your code you are calling the sendmail function.
You did include at the top of your sendmail script:
sendmail('tester','tester','test','test');
But that isn't going to do anything. Is that really in your code, or did you just change all the inputs to tester?
You are also not testing for a result as to if it was accepted or not. So if the mail function is failing, your code would not know it.
-
Not enough info to answer that.
Depends on how your web host allows you to configure cron entries. Could be anything from a simple Cpanel like interface to regular raw Unix cron formatted setup.
Chances are, your Web host has a FAQ on how to do it for their servers or a knowledge-base with that info.
-
If your web host allows you to use Cron yes. You can schedule either a call to the PHP CLI to execute your code, or use something like Curl or Wget to execute the PHP code you want.
-
You can't make that assumption.
Without looking at the script and seeing what it does, nobody can.
-
Find a friend with a Unix/Linux server with cron that can do it for you.
File: cron.php
<?php if(isset($_GET['c']) && $_GET['c'] == "292081") { // Insert page you want to call or do the function here } ?>
http://www.somepage.somewhere/cron.php?c=292081
The code or in this case c is just to keep from some random hit from triggering it.
-
I have the same issue for some weather related sites where I use a hit a minute to collect data that has been saved on the site but needs to be added to a running log. For me it was an easy solution as I have cron. For others however, it wasn't because the use a cheap inexpensive ($10 year) web host which don't allow cron at all. Other sites only have 1/2 hour or hour increments.
The solutions I came up with were.
1) I can schedule a job on my site which has cron to call their site (a page called cron.php). It uses a code in the call so that other hits to that page don't do anything.
2) Setup a schedule on a winbox which does basically the same thing. You can do this with some simple vb scripts and the scheduler of your workstation, but you have to keep it running.
3) Run a utility on your win box which does the same thing. Never found a free one I liked, did see some paid ones. all of them would need to keep running. Running as a service would be better.
-
I used pseudo-cron a number of time on webhosts that don't provide cron abilities.
It is fairly easy to setup and use and is driven by hits to your site.
So if you have a general settings file or menu or whatnot that all your pages use when you get hits, you place a snippet in that code and hits to your site drive the cron scheduling.
If there are no hits, it will play catchup for tasks that should have happened.
Usually regular tasks like backup up the site's database are run using cron jobs. With cron jobs, you can exactly plan when a certain command is to be executed. But most homepage owners can't create cron jobs on their web server – providers demand some extra money for that.The only thing that's certain to happen quite regularly on a web page are page requests. This is where pseudo-cron comes into play: With every page request it checks if any cron jobs should have been run since the previous request. If there are, they are run and logged.
It works good for a lot of general scheduling... but if you have to have something updated on a real regular schedule, you could setup a page that you call from your workstation via it's scheduler instead. Their are some examples out on the net.
-
It is always a good idea to place an exit after the header command to prevent further action in the script. Header outputs the header, but does not stop the processing of the rest of the script.
<?php ... // Prevent non-logged in users from issuing commands. if (! $loggedInUser) { header( "Location: /login.php"); exit; } // User is logged in, make changes requested (like delete account)
If you don't, the code will continue on behind the scenes which might be a big surprise if you don't know it.
-
Only the superuser may change the owner of a file. Your webserver is not the superuser (hopefully)
Perhaps you can just chmod the file so you have permission to use it. Since the file is owned by the webserver, it can change the permissions of the file like:
chmod("/somedir/somefile", 666);
or whatever. As it is your server, there are many other options from the system level as well.
Ref:
-
The problem is you are breaking the data into three separate unrelated arrays of data with nothing to tie them together.
You would be much better processing the data sequentially and storing the found data into arrays in the order they are found. You might be able to take advantage of the comments they provide which have unique id's... <!--Fixture ID: 3470645-->
-
I tend to use single quotes for html output... This allows me to use the double quotes for html elements without having to think about it much and place variables outside of the single quotes to get them to work properly like:
<?php ... echo '<a href="/u/' . $user_info['username'] . '"> <img src="' . getUserAvatar($user_info['username']) . '" class="avatar f_left small" title="' . $user_info['display_name'] . '" alt="' . $user_info['display_name'] . '" /></a>'; ?>
-
...I have written a small system that takes an XML file that defines the input elements and then puts out a series of pages each with those elements on it (final output to save the data was to another XML file).
Keith,
Actually, had not really thought of XML for some reason. The forms are pretty basic as they also have to be Accessible (ADA), but there will be sections and pages and required selection fields. ....
Need to think about this a bit more. Thanks for the reply.
-
Been looking to see if anyone has published something like this.
I have a number of projects coming up which entail creating input form pages using PHP. Some of these are quite large as to the number of entries, pages etc.. and the worst part is that I know in advance that they most likely will want to change/add to the form after I am done.
So rather than coding them physically in the code, I want to define the form elements in an array that I can store in a database/flat file and when the page loads, read from the array to construct the form output.
I don't have any issues with dealing with the database or even using arrays, but I have not been able to come up with an array setup that works.
Has anyone done this and would care to share the structure they used.
Everything that I find on the net is basically sites that want to host the form, but this will be in a non-Internet accessible site so that is not an option.
Some help with Drop down box
in PHP Coding Help
Posted
First, <select> doesn't use selected. You normally identify what is selected by making that the first entry.
You are better off collecting all of the values into an array so you can then use that to find what you need.
Untested...