Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Cron Questions


Just a few questions about cron files:

Can I include other files? Eg

<?php
require(config.php);
....

That's pretty much it! I'm running a cron job from DirectAdmin and I keep getting an error email with:

/home/aliashos/domains/aliashosting.co.uk/private_html/inc/cron/subscriptioncheck.cron.php: line 1:?php: No such file or directory
/home/aliashos/domains/aliashosting.co.uk/private_html/inc/cron/subscriptioncheck.cron.php: line 2: //: is a directory
/home/aliashos/domains/aliashosting.co.uk/private_html/inc/cron/subscriptioncheck.cron.php: line 3: //: is a directory
/home/aliashos/domains/aliashosting.co.uk/private_html/inc/cron/subscriptioncheck.cron.php: line 4: //: is a directory
/home/aliashos/domains/aliashosting.co.uk/private_html/inc/cron/subscriptioncheck.cron.php: line 38: //: is a directory
/home/aliashos/domains/aliashosting.co.uk/private_html/inc/cron/subscriptioncheck.cron.php: line 39: syntax error near unexpected token `('
/home/aliashos/domains/aliashosting.co.uk/private_html/inc/cron/subscriptioncheck.cron.php: line 39: `$udq = mysql_query("SELECT * FROM $CustomersTable",$Link) or die(mysql_error());'

And if I run the file in my web browser, it works fine! Confused :S




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Several CMS Questions
I am fairly new with PHP but I have used several news posting scripts in the past and none have been simple enough for me. I'm working on creating a site with the following layout, and I need help on a few issues along the way (those questions will be in bold so please check them out, even if you don't want to read everything else!).

The basic site layout will use a few "template pages." I.E. main.php and print.php and textonly.php. What they are is fairly self explanatory. The further pages will be accessed in the following manner: http://mysite.net/main.php?content=FAQ Would import a file called faq.php/html/txt (which is the best form for my content?).

I also want a news page. Should it be imported in the same way as the other pages (I.E. main.php?content=news)?
On every page, I want a "headlines" section with the last 5 recent "headlines" (from the news) and a link to them. On the news page, I want the last 5 news items listed. For my news system I could use MySql or just Flat files (I.E. a file called news.txt which has a uniqueID|author|title|date the uniqueID is the name of a .txt file with the content of that news item). All news items (not just the most recent 5) are found on an archives page, listed by headlines/date/author. Which is better (MySql or Flat files, considering how simple this news system will be Flat may be simpler) and how can I set it up in the way I asked?

Also, I created a simple system of PHP to go to different pages depending on the ?content= variable. I want it to go to a specific page if ?content= anything not listed in my variables. Here is what I have, it works except it won't go to google.com if anything "else" is written. How can I fix the code below to work?": PHP Code:

Else If - Questions
I have put togther a script which uploads images and renames them with the article ID, so that image names are always related to the article that is added.

But....when calling the individual article to view in a html page I want it so that if there is an image it shows it other wise don't show anything or show a blank pixel image. This is what I have tried and it does show if an image is there, but if the is now image present it shows an image box with missing link. Code:

A Few Questions
Say I wanted to send an HTTP request to a web server on port 80 - would
fsockopen or socket_create be better to use?

Also, I'm unsure of whether or not stream_set_blocking would be a
useful function to use for HTTP queries... any ideas?

Finally, the output of this seems a bit surprising:

<?
ob_start('test');

function test()
{
return getcwd();
}
?>

It displays / while the following displays something like
/path/to/file/

<?
echo getcwd();
?>

Pdf Questions
I have a pdf govt issue tax form for non-profits and am trying to
write a script that will handle browser based entry of data fields as
well as save some info to database

It is a tax form and has to be parsed to the pdf file that the govt
provides for printing...

Am completely stymied on how to pull all the field data, and to post
it to the pdf the pdf in question is



Questions About PHP-GTK 1.0
PHP-GTK is the ticket one can take to create cross-platform
PHP scripts that load a standalone GUI application with widgets, and
then everything else you know about PHP can work in the background via
signals (widget events), including database access, etc.

Some background for you:
http://www.sitepoint.com/article/697

Personally, I can't get it working. Others have, strangely enough.

1. I have RH9. Does anyone have an RH9 RPM out there for PHP-GTK 1?

2. Would it be good for me to install Glade to draw the GUIs and
connect the signal handlers faster? I don't have experience with
Glade.

3. I tried downloading the 1.0 source and then doing:

../buildconf
../configure
make
make install

but it bombs on ./configure with...

../configure: line 2606: syntax error near unexpected token `debug,'
../configure: line 2606: `PHP_GTK_ARG_ENABLE(debug, whether to include
debugging
symbols,'

4. I tried the steps recommended in the sitepoint.com web link I
posted (above) and it showed the same error, so I commented out the
code block starting with if on line 2606 to its following fi. Then, I
ran the commands as recommended from the web link, it runs good for
awhile and then spits back to me this error:

/home/me/installs/php-gtk/build/dynlib.mk:22:
/home/me/installs/php-gtk//libs.mk: No such file or directory
make: *** No rule to make target `/home/me/installs/php-gtk//libs.mk'.
Stop.

What's the catch?

PEAR Questions
Can someone explain to me exactly what PEAR is?

I've been looking around for different html modules/classes and it keeps coming up, but I can't find anything that actually explains what it's all about.

Also, is there a complete list of "PEAR" modules anywhere, organised in one place?

Login Questions
I have 2 books 1.) MySQL/PHP Database Applications and 2.) PHP4 Bible. My problem is that in both books the only way they show how to use a login form is to use the HTTP_AUTH. Which I don't want to use, I want my script to do the login and log out Like VB does. Where or how would I go about doing this? I can enter data into MySQL, but I know i am missing some steps, such as Md5ing the Password and sessions and such. Any info would be great.

IMAP Questions
I've spent hours, days .... weeks(!) reading the manual, but still can't find answers to my questions regarding the use of some IMAP functions and their miscellaneous properties.

From now, I'm gonna list all those questions on this thread and see if some of you can provide even partial but useful comments.

Question number ONE : imap_setflag_full

In imap_setflag_full($mbox, "2,5", "Seen Flagged"); we have the string sequence "2,5" but I fail to understand if it is safe or not to choose any sequence I want regardless of the message structure.

For example, if I apply a "Flagged" flag on all incoming messages exclusively at "2,5", is it possible that I could overwrite some precious information in that particular place? What are the implications of such a method?

Questions About Config.php
We all know its effective to create one central config file say "config.php"
that contains the required configuration variables.

I had seen the configuration is done by three ways:

1> By simply using variables ex $dbHost = ""; etc
2> By using associative arrays ex $setting['dbHost'] = ""; etc
3> By defining constants ex define("DB_HOST",""); etc

My Question?
Which one to use and why in config.php for creating the configuration file?

A Questions About Mysql_fetch_array()
whenever i use this, i'm leaving out one item from the array. in other
words, one row from the table i'm querying won't show up. i'm new at
php, and this is probably a simple thing, but please help of you can.
here's an example that leaves out the most recent submission:

$query = "SELECT topic, message, author, DATE_FORMAT(posted, '%M %e,
%Y') AS d FROM messageboard ORDER BY posted DESC";

$result = @mysql_query ($query);
$row = mysql_fetch_array($result, MYSQL_ASSOC);
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC) ) {
echo"<p> {$row['topic']}<br>
{$row['message']}
<br>Posted by {$row['author']} on {$row['d']}
<br>";
}

Pcntl_fork Questions
php.net's docs on pcntl_fork aren't exactly clear on how to spawn
multiple child processes...

i tried something like this, but it didn't seem to work:

<?
$pid1 = pcntl_fork();
$pid2 = pcntl_fork();
$pid3 = pcntl_fork();
if ($pid1)
print "test;
if ($pid2)
print "test2";
if ($pid3)
print "test3";
?>

any ideas why it didn't work?

PHP GTK Option Questions
Before I invest more time in researching and testing I am curious if anyone knows for certain if a PHP_GTK application running on a Windows machine can communicate and interface with a remote database SECURELY?

My plan involves creating a support system which would be a standalone application on a Windows Workstation. This application would query data from a remote database SECURLY and then support personal would be able to modify, edit, etc. data from the PHP_GTK application which would in turn update data in the remote database, again securely.

Can a PHP_GTK application support this, security being the biggest concern?

Questions About Sessions
First, just wanted to say that I found what I thought was a very helpful
tutorial on sessions in case anyone out there has questions on them:

I've been using sessions for quite some time but only after reading this
do I really understand what is going on on both the client and server side.

Unfortunately, I still have some unanswered questions after reading it,
as it is pretty basic and gives a quick intro to sessions. For testing
purposes, I turned off all cookies in IE and attempted to sign into my
site on my local host, which uses sessions for signing in. In addition,
session.use_trans_sid = 0 in my ini file. I can't figure out how, but
somehow my scripts all still work and I am able to login fine, even
though cookies are disabled, as well as trans sid. How is my session id
being passed, as my understanding is these are the 2 possible methods?
There is no sessid propagated through the URL either, so it is not
through a get variable.

Also, I looked in my sessiondata folder and found a bunch of session
data. When I physically log out and kill a session, it removes it from
the folder. However, when I just close the browser window, it does not
remove the data from the folder. Reopening the browser right away
results in a new session and requires the user to login again, but the
old data from the previous session is still there. I checked my ini,
and found the default:

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 1440

But this isn't working as far as I can tell because I have session files
from days ago, and according to this it should be deleted after 24 minutes.

PHP Interview Questions
I have reasonable PHP experience, but not yet a guru. I am going to an
interview this week for a PHP role, they develop a portal system used by
governments departments to create a common entry point for state
government services.

I have been advised they will be questioning my skill level on PHP, and
although my strengths are in Java (which they may use me for also) I was
just wondering what kinds of questions you all may have come across in
the interview, just so I get a feel for what to expect.

Questions About GD And Images
I have a system where admins can upload photos and images....the original photo as well as the thumbnail...At first sight, I had 2 fields, one for the image and one for the thumbnail...however, I was thinking about having only one field while the image should be proccessed by the "submit" script afterwards in order to create the thumbnail aytomatically in the selected folder (/pictures/thumbs/) while storing the original image in the /pictures/ folder...

In the first system I created (2 fields), both images were uploaded in a selected folder while their extensions(names) were stored in the Database...however...if I use GD library to create the new system the whole thing changes...Images are not uploaded but stored directly in the database as strings and called afterwards as images...for instance, the original photo is stored in the database while the automatically created thumbnail proccessed by GD, (opened as text...croped...etc etc.) and also stored in DB as text...Am I right?

PHP Interview Questions
We have collected Questions and answers for interviews after a long
effort and you study these questions and its answers freely our
website. If you have any query regarding to interview you contacts with
us we have reply your problem as soon as possible. I am very Thank full
to you.

Questions About Curl
I was looking at the various cURL options and have a few questions.

CURLOPT_HTTPPROXYTUNNEL's being set to true is supposed to tunnel
through a given HTTP proxy. Afaik, tunneling is only possible when the
CONNECT method is used. Is that correct?

Also, if it is... one can normally tunnel through as many HTTP proxies
supporting CONNECT as they see fit. Does cURL only let you tunnel
through one?

CURLOPT_PORT's value is described as "an alternative port number to
connect to", however, CURLOPT_URL already allows a URL to be added.
Does this mean that if it can't connect on that port, it'll try to
connect on this port?

Session Questions
I have a question regarding the usage of sessions and cookies. I'm still a
fairly new developer, but have built quite a few login-driven applications
using MySQL for the backend and PHP for the front end.

When I have a login, I generally do the standard algorithm - Check the DB
for a matching UN/PW, set a session variable as true (or jsut set the
username as a session var) and then check on if the session['username'] var
is set. If it's set, they're logged in, if it's not they're not and I
redirect back to login.

My question has come up recently as I've seen many PHP developers using
setcookie() and running their code off of this. I'm using the following
method if there has been a matching un/pw combination found in the DB:

if($totalRows != 0){
$_SESSION['username'] = $row['usernameFromDB'];
}

Then, in my include file to check, I'll say something like:

if(!isset($_SESSION['username'])){
header("Location: login.php");
}

Two Header Questions
Is it possible to generate an export file and still showing different
HTML page?

I have a page and when the user clicks on a link I generate export file
(with header and data after header) and the page remains the same. It
would be nice if I could show another page, like message "data generated!".

And I have another question. I have the following code for sending
export file:

header("Content-Disposition: attachment; filename=export.txt");
header("Content-Type: application/octetstream");
header("Pragma: no-cache");
header("Expires: 0");
echo $Data;

but when the Save as dialog appears I get filename "export.txt.php".
What must I do to get the right filename "export.txt"?

Speed Questions
i was trying to append a % before any occurance of either abc,
abd, or abe, in a string. which would be faster?:

$string = str_replace("abc","%abc",$string);
$string = str_replace("abd","%abd",$string);
$string = str_replace("abe","%abe",$string);

or

$string - preg_replace("/(abc|abd|abe)/","%$1",$string);

php.net says that preg_replace is slower than one str_replace, but for
multiple ones, it seems like it would gain a slight speed advantage.

also, exactly how would the following to code segments compare, speed
wise?

for ($num=0;$num<$length;$num++) {
$array1[] = $num;
$array2[] = $num;
}

for ($num=0;$num<$length;$num++)
$array1[] = $num;
for ($num=0;$num<$length;$num++)
$array2[] = $num;

it seems like the first one should require 3*$length operations,
whereas the first one would require 4*$length operations, although i'm
not 100% sure on that.

Session Questions
I currently manage all my sessions through MySQL tables, but obviously this
means database overhead for every single page. I would like to move to PHP
sessions but I'm not sure they do the job.

I'm sure you can all imagine how you would implement database-based
sessions, i.e. generate and store a unique identifer with the user data, and
pass this ID from page to page. On loading the page, get the user data
associated with that ID.

I would like to do this in PHP. However, I'm having problems with the
following:

1. Uniqueness. If someone with the account 'Dave' logs in on a phone in
Brazil, it should invalidate the session anyone else using that same
account, on any device, anywhere. There should only be one session per
account at any time.

2. Overwriting. On no account must anyone overwrite Dave's session and
become that user. This seems to be a problem in my test attempts for no good
reason (and the other user is on a different machine!)

3. Destruction. I, the manager, want to be able to destroy individual
sessions ("boot") at will, if possible.

Can this be achieved, or should I stick to doing it the MySQL way (or maybe
there's a better way)?

PHP5 Questions
I noticed there's an error in PHP when it receives form data. It seems
to precede various characters with "". I was wondering if that's about
to get fixed in PHP5, or already is fixed in PHP4? (Or is this somehow
not an error?)

Also, I was wondering when/ if PHP will include more object-oriented
functions, like $myString.replace($find, $replaceWith). (I sometimes
wonder if I need to use the first or second or third parameter or what
and it takes some more seconds to check PHP.net.)

Next, are there any plans to remove the "$" in front of variables?

Also: will XPath be supported internally/ by standard libraries (I use
a special library not part of PHP and it could be a little faster)?

Will there be real private members/ functions in PHP5 when using
classes/ objects? (And any plans to drop "$this->", not that it's
really bad?)

Cookie Questions
I'm acquainted with PHP about five days (more precisely,
with the web programming in general). However i have some
other experiences in programming.

The first thing i need to do is a reliable authentication
with sessions and cookies. I've create a scratch web-site
for testing this (http://igor.ath.cx:55554/) and have two
questions related to cookies. I use the latest PHP 4 & 5
with IIS5 (CGI mode) under Windows 2000. Php.ini settings
are setup defaults (when using php-x.x.x-installer.exe).

1. When i do setcookie ($vname, $vvalue, time() + 600, "/");
it's saved well, but the cookie does not expire after ten
minutes as it supposed to be (testing with IE6). What's wrong?

2. When i do setcookie (..); and after that (below in the
end of the same script) send a header("Location: $goto");
the cookie is not saved. I've create a workaround. But...
Is it normal behaviour? I can't find clear information on
this in the PHP Manual.

Snmprealwalk Questions
I am using snmprealwalk() to scan for interface types and descriptions on
some Cisco routers. What I am doing is two calls to walk the routers; one
walk for ifDescr.x and the other for locIfDescr.x so that I get the
interface index and our user defined descriptions.

That returns back two arrays which I then combine into one array with a
couple for and while loops, and that gives me a multidimentional array
containing the interface index, interface type, and the description. Things
have been going well, however, I have noticed that some of the newer routers
are not behaving as expected on some of the walks that I am doing.

When I do the two walks as described above, I get something like this:

Array (
[OLD-CISCO-INTERFACES-MIB::locIfDescr.1] ="Local LAN"
[OLD-CISCO-INTERFACES-MIB::locIfDescr.2] =""
[OLD-CISCO-INTERFACES-MIB::locIfDescr.3] =""
[OLD-CISCO-INTERFACES-MIB::locIfDescr.6] ="Internal Modem WIC"
[OLD-CISCO-INTERFACES-MIB::locIfDescr.7] =""
<snip>
)

Notice how it is missing interface descriptions for interface index 4 and 5.
So I manually ran snmpget and I get the snmp error "No Such Instance
currently exists at this OID". The problem is that snmprealwalk() doesn't
fill the array when I get the "No such instance" message - which really
screws up my program.

Is there a way to make snmprealwalk() fill in values in arrays, even if
there is no valid snmp data?

Date Questions.
I'm trying to select all of the dates from my datebase, but over a different time scale.

> past
> this month
> next month
> coming soon

I need to be able to do somthing along these lines, but i'm not to sure what. SELECT * FROM listings WHERE list_date='next month' Can anyone point me in the right direction.

Questions On Sessions
I'm fairly new to PHP, and have just started creating a very basic PHP login system for my site, and have gotten stuck on the login page.

I want it to check to see if you're already logged in, and if you are, display a message saying you're already logged in. If you aren't logged in already, it will display the login form.

Here's the code:

<?php
session_start();

if($_SESSION['user_level'] == 4){
echo "You are already logged in as ". $_SESSION['username'] ."!";
}
if($_SESSION['user_level'] == 3){
echo "You are already logged in as ". $_SESSION['username'] ."!";
}
if($_SESSION['user_level'] == 2){
echo "You are already logged in as ". $_SESSION['username'] ."!";
}
if($_SESSION['user_level'] == 1){
echo "You are already logged in as ". $_SESSION['username'] ."!";
}
if($_SESSION['user_level'] == 0){
echo "You are already logged in as ". $_SESSION['username'] ."!";
}
else {
include 'loginform.php';
}

?>

This works if you're logged in, but if you aren't then it still shows the "already logged on" message anyway.

My second question is instead of using those 5 seperate terms, could I just use one to check whether or not you're logged in?

More Questions On File Functions
Just a few questions, that I can't seem to find the answers in the manual.

1. What is better to use? fwrite() or fputs()? it says in the manual that they are the same then why 2 of them? (this is for fsocket() and/or fopen())

2. I'm writing to a socket not a file so I'm wondering if there is a max amount of data that can be sent in a single line i.e:

Nl2br And Session Questions
1)I am working on a function which can be reused in several tasks. Anyway I find the php engine automatically adds some extra <br />tags into the textarea when the user inserts the newlines and I think it would be some kind of eyesore when the user see that.Is there a way to eliminate those redundant codes:

Php.ini Listed In Phpinfo Questions
I was trying to follow some instructions on installing Smarty and suddenly
found php.ini is not where phpinfo lists it to be.
1. Is /usr/local/lib the default location for the php.ini
2. In old versions of PHP, did php.ini install by default and not have to be
copied?
The thing is I've installed PHP on my own home servers for years and never...

Flatfile Vs DB Questions For BBS Script

I am 50% through of coding a new BBS using PHP.

I started the script with flat-file system since I believe it would offer better opportunity for people to host their BBS on server without having to pay extra for database backend.

I have heard a lot of comments about using a database instead.

I believe that:
Databases were designed primarily for applications that use a great number of 'small' but 'relational' data cells. Many parts of a BBS would fall within that category but posts themselves do not.

Database on the other hand has it own limitations. To start with, it is another application that is running on the system which will share memory and resources. It has limits on the number of connections. Many users have already come across that when trying to connect to busy databases.

I have seen the 'rush' to shove everything into a database. I have seen fairly static websites stored on databases. It would be a lot faster and more efficient to output an 'txt' or 'html' doc via simple 'include()' rather than getting the same chunk of data from a database. The larger the chunk of data gets, the less useful a database may prove to be.

I trust [and it has to be proven later] that a well designed script could accomplish what is required without the extra overheads.

It would also be advantageous for the users as the number of free or cheap hosts with PHP and database are very limited.

BTW, some servers prefer the use of DB since besides charging extra for it, they can limit the connections and thus bandwidth.

Another handicap with databases is the backing up the board. I am designing the board so that it could be updated or backed up via ftp. Backing up from database would have limitations set by the server, php.ini and database. You will find many administrators have reservation as they can not back up databases of more that 2 MB. While that would be huge database if the data stored on individual cells were small, in case of BBS; that does not amount to anything ...

Converting From Javascript To Php - Two Questions
I have two questions re converting from Javascript to php.

1. Testing for NS4 browsers is easy with Javascript using "if (document.layers) {...whatever...}". Is it possible to use the same test in php?

2. Is it possible to include Javascript within a php include?

For example:

<?php require("../foobar.inc");?>

where foobar.inc is:

xhtml and text...
<script type="text/javascript">
if (document.layers)
{document.write("HI THERE");}
</script>
more xhtml and text...

Can this be made to work?

|FAQ| Zip Code Related Questions
Q: How to find the distance between two zip codes/cities?
Q: How to find list of cities/zip codes that are with in the particular
radius from given city/zip code?

A: In spherical trigonometry, we have haversine formula, which provides
relationship between the radius of the sphere and any two points on the
sphere (longitude and latitude of the points). So, if we take the earth
as a sphere and have longitude and latitude of any two cities, we can
find the distance approximately.

Developed countries like U.S. have census data that contains the zip
code, longitude and latitude of a particular city (along with
population data); this in turn helped a lot to find the distance
between any two cities or any two zip codes using the database. Not to
mention, even many commercial zip code databases are available for that
purpose.

Once we have the Zip code database, it's merely a calculation over the
data.

Questions On Size Of Session
Is there some sort of limit on how much one could store in a
session as far as amount of data?

Is it advisable to store a LOT of data in the session when a user logs
in to save queries to the dbase while the user is browsing the site?

Does this depend somehow on how many sessions are going on at once?

Include/header Questions
I am having problems with an include statement. I'm setting a session
variable flag and then including a file, and in that include file I have
a check at the top to make sure that the session variable is set,
otherwise I stop executing and redirect.

My problem is that this works if I use a relative path to the include
file, but not if I use the full path. If I use the full path, it does
not read the session flag as being set, and thus kills the include page.

So basically...

// page 1
$_SESSION['flag'] = "true";
include("../folder2/page2.php"); // this works
include("http://localhost/folder2/page2.php"); // this does not work

// page 2
if(isset($_SESSION['flag']) && $_SESSION['flag'] == "true")
{
// relative include gets you here
}
else
{
// absolute include gets you here
}

allow_url_fopen is ON in php.ini if that makes any difference, it's the
only thing I could find that seemed like it might affect this?

Also, I read in the manual for header() that:

HTTP/1.1 requires an absolute URI as argument to Location: including the
scheme, hostname and absolute path, but some clients accept relative URIs.

a) All of my header calls involve relative paths and they work, but
should I change them to absolute? Does using relative pose a security risk?

b) Does this also apply to include? Does using relative paths with
include pose a security risk? (I never variables in include or header
statements, even when using relative paths I specify which file to
include/redirect to...)

Mail Attachment Questions...
I know i have to read a lot. :) But sometimes
i need a little help from my friends, because i
am the only one in my environment that experiments
with php who could help me.. :(

Few questions though:

I cannot imagine that sending html is too much
for automated mail, or shouldn't i take this
too literally?

Would it be better to send a mail with an image in it
with an absolute url instead of attachment? Then renaming
files is not-done anymore, but it keeps the mail small...

Eclipse PHP IDE - 3 Nagging Questions
I've just installed Eclipse and PDT and I'm getting familiar without
major problems but I'm stuck with 3 issues:

1. do you know any plugin that would let me convert " to " in
selected text? (or enclose selection with braces, I mean basic
convertions that you use often in php when working with html tags)

2. how do I install Zend debugger? (I downloaded the plugin 'enabling
debbuging' from zend but probrably the server plugin too...?) Is it
worth instaling or maybe a better choice is Xdebug?

3. how do I safely remove plugins that I don't need? AFAI there are
eg. tools for developing Java apps. I would like to slim my Eclipse as
much possible to speed it up.

Form With Dynamic Questions
I've a mysql table where i stored a list of questions. My php script
executes a query which yields a different number of questions every time; i
used the loop function to create an input field for each question in the
form; and dynamically referencing each input name with the question number
i.e. question 1 is called q1, question 2 named q2, and so on.
The data is submitted using POST. I then try to retrieve all the answers by
doing a loop and using something like echo '$_POST['q'.$n.'']' except the
syntax doesnt seem to work.

Mail Attachment Questions...
I've found a script at these great Google fora. a script
to send emails with attachments.
The script is below this message, name etc. aren't mine, but from
the original post.

My questions are:
- Is this script extra heavy for a server, or should it be
no problem?
- How big do you advise for max size of attachments?
- Why is the attachment set in an array, when i remove the
array and only leave it's content-text i get a big time error.
- Why is this in there? --> $message .= str_replace ("=", "=3D",
$html_message)."
";
- In the source of the mail, there are a few THOUSAND lines of
the following text. Right after "Content-ID: <image.jpg>"
"Do1QlNSe3k6QmpmR0hJTERWWlVhh4EQABAgQDAggIBwoKBwgCA wABAgMA"
what is it for? Does it delay my server?

I'm sorry if this seems kind of lazy from me, but i'm a newb so i
don't
know how to figure it out else.

code from script below found at:
http://groups.google.nl/groups?hl=n...hello.at&rnum=3
__________________________________________________ ____________
<?php
function sendmail ($from_name, $from_email, $to_name, $to_email,
$subject, $text_message="", $html_message="", $attachment="")
{
$from = "$from_name <$from_email>";
$to = "$to_name <$to_email>";
$main_boundary = "----=_NextPart_".md5(rand());
$text_boundary = "----=_NextPart_".md5(rand());
$html_boundary = "----=_NextPart_".md5(rand());
$headers = "From: $from
";
$headers .= "Reply-To: $from
";
$headers .= "X-Mailer: The Bat! (v2.04.7) Personal
"; // say
we are
the bat mail client ;-)
$headers .= "MIME-Version: 1.0
";
$headers .= "Content-Type:
multipart/mixed;
boundary="$main_boundary"
";
$message = "
--$main_boundary
";
$message .= "Content-Type:
multipart/alternative;
boundary="$text_boundary"
";
$message .= "
--$text_boundary
";
$message .= "Content-Type: text/plain;
charset="ISO-8859-1"
";
$message .= "Content-Transfer-Encoding: 7bit

";
$message .= ($text_message!="")?"$text_message":"Text portion
of
HTML Email";
$message .= "
--$text_boundary

Questions About Uploading File
I have two questions about uploading files using php & html:
1. How can i add a `file type' in the pop window when i click
`browse' button of the `<input type=file>'.
2. How can i get the local path of the uploading file. btw, i know
there's a $_FILE['userfile']['name'], but it only give me the name not
the path.

More Magic Quotes Questions
it's more of the famous 'what do I do about magic_quotes' questions.
Anyways, here we go:

I've been a PHP developer for about a year now, and have grown to detest
magic_quotes for numerous reasons. So, in my applications now I simply use
..htaccess to turn magic_quotes_gpc off and I escape as needed from there.

My problem however has become what to do for FULLY portable applications.
I'm currently writing an XML-based PHP application that will be using a
MySQL backend, and going by my logic that I normally use (turning magic
quotes off via htaccess) I might run into some problems. Basically, this
application needs to be able to move to ANY hosting provider with very
little configuration.

So I thought "Hmm, ok, well I'll just run a 'get_magic_quotes_gpc()' check
and escape where magic quotes are off. This shouldn't cause a problem with
my own code because I've turned magic_quotes off anyways.

Problem is the 'get_magic_quotes_gpc()' function doesn't seem able to pickup
the htaccess directive that turns them off, so it is always reported on.
This basically traps me into not being able to check if they're on or off,
or simply counting on them for my own application and leaving them on (I
have no access to the .ini to turn them off at all).

Worse yet, on the other side - if I go with my .htaccess and just always
turn them off like I have been doing, this will come back to bite me if we
have to put this application on an IIS server where turning them off is not
an option. From what I understand, there's no way to turn them off at
runtime.

Generate Random Questions
I would like to generate ONE question for a user whenever he visits my page. The questions r stored in the database. And the user will hv to enter his email which is stored in the database. If the email is entered the second time, a different question will be given.

so my question is, how do i make sure that the same question will not b repeated if the same email is entered? any suggestions?

Session And Syntax Questions With @
I have a page that the session_start() statement does not work unless I put a @ in front of it. I have seen in some tutorials where people do this not just in sessions but also in mysql calls. I have never had to use this in my code before and have just seen it around in a few other code. Does anyone the purpose of the @ symbol, or why it makes a difference?

Help With Cron
I need some help with starting to use cron to auto update one folder from another folder remotely. I have no idea where to go and can't find a good tutorial or book on it, anybody have suggestions.

Eventually, I want to use one of my websites to update the pagtes on another, the hosting company won't set it up on the server for me so I need to develop a script i can run in php.

Cron Job Help!
I've been reading around with this but can't seem to find an easy example! I have NO idea how this works at all.

All I want to do automatically dumb the database to an email every morning at 4am, I know this IS possible but other than knowing I have to use cron, or cronjob.

Any help, or simple script showing me how this works would be much appreciated, I'm on PHP3 atm, but am moving to a new PHP4 server shortly.

Php Cron
Is there a way whereby when the cron I've set start to execute a particular command, while when the command gets back a positive response, it will stop the cron from running anymore?

For example:

cron start => execute command => 1 = true; 0 = false;

if 1, stop the cron completely from running anymore

if 0, continue to run as schedule in the cron file.

Another question is:

How many cron file can one server have?

Cron Job
how could i set up a cron job to execute a php file everyday. I got php as a module of apache.

Cron
Is there a way to run a cron job for a php file? I know if I want to run a cron job for a cgi script I just write the full path to the script in webmin.....but when I do the same with php it doesn't seem to work.

CRON
I am just starting messing with CRON. I can set up a cron job to run a php
script each hour, but I have several web sites on one server that may need a
script running.

I was contemplating running one "manager" script each hour that would check
a mysql table and where necessary run one of a range of possible scripts,
probably one at a time to spread any load.

1. Is this the best way of doing this?

If yes, what fields do you recommend? (id, ref, scriptURL, timestamp,
active(1/0))

Is it worth creating a log file to keep an eye on what and when scripts have
run?

Cron
How can I stop Cron from sending me emails? I tried to make the program run without output but it's still sending an email. I heard there was the other method, to make the output go to a file. How can I do this?


Copyright © 2005-08 www.BigResource.com, All rights reserved