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




Control Structures


I was just wondering. Im submitting a form, using this code:

if ((!empty($_POST['Name']) || !empty($_POST['E-Mail']) ||
!empty($_POST['Question'])) {

code...

}

What im testing for is

if name, email or question is set, do the following. But it is not working,
do I have the syntax right?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Structures In Php ?
How do you create data structures in php ?

i.e. how would I create the following two vb structures in php ?

Structure SYSTEMTIME
Dim wYear As Short
Dim wMonth As Short
Dim wDayOfWeek As Short
Dim wDay As Short
Dim wHour As Short
Dim wMinute As Short
Dim wSecond As Short
Dim wMilliseconds As Short
End Structure

Private Structure TIME_ZONE_INFORMATION
Dim Bias As Integer
Dim StandardBias As Integer
Dim DaylightBias As Integer
Dim StandardDate As SYSTEMTIME
Dim DaylightDate As SYSTEMTIME
End Structure

Also, if I read a binary value from the registry, how would I then convert it to a variable of type TIME_ZONE_INFORMATION

Data Structures
Is it possible to create data structures in PHP and if so, would someone
provide a bried example?

Example:

I would like to create a Data Structure JRec which has the following fields

lID (Long)
dtDate (Date)
sName (10 Character String)

Data Structures
what data structures can be used in PHP?

Conditional Structures
I am wondering about conditional structures and the depth of nesting allowed, if at all. For example I know I can do this: Code:

Dynamic Directory Structures
I need to translate the path

/category_name/sub_category_name/

to

/category.php?sub_category_id=2

without redirecting the user.

There seem to be many ways of doing it, but with my current web hosting
provider (E.N.E IT - www.eneit.com) there are some constraints. For example
I cannot modify the httpd.conf.
However, I've got the functionality provided by CPanel (e.g. AddHandler's)
and I can create .htaccess files.

I've read a little about the RedirectRule command in Apache, but it does not
seem to work due to that I'm on a shared hosting server.

I've also realised that I could do
/category.php/category_name/sub_category_name/, but haven't found a way to
remove the .php in that instance.

Reading C Data Structures
I have a file duplication progam I wrote years ago in C on a Unix system. I open up zip files and store CRC info in my own database. It's a great application for php/mysql and I would like to learn php/mysql in the process of moving it over.

Can someone tell me how you would read the header (data structure information with all the fields) on a zip file (in this case its the localheader right after the signature), so that all the fields of the structure land nicely in an array in php? I'm attempting to use freads/fseek to  each field and this just can't be right.

Doesn't matter what data structure I just need to know the most common method you use to open a file in read blocks of data and unpack them back into a data structure.

Select Count Query, 2 Tables With Identical Structures
I have 2 Tables that have the exact same structures, One is for Inventory, the other is for Relief Inventory (ie. when an item is sold it is moved to relief).

What i want to be able to do is to run a query that will count the number of items tested by one person and display that sorted and grouped by the date cleared. I can get this to work when working with just the Inventory table, but the problem is that as items are moved out to relief the counts will change.

$query = "SELECT COUNT( * ) AS `Count` , `Date Cleared` , `Tested By` FROM `Inventory` WHERE `Tested By` = ".'"'.$tester.'"'." GROUP BY `Date Cleared` ORDER BY `Date Cleared` DESC ";

My question is, how do i run a similar query that will search both tables and combine the results. I have tried adding the other database to the FROM statement, and have been tring to figure out if i can use a join statement but that hasn't yielded any favorable results.

Tab Control
Anyone have code for a PHP based tab control for site navigation?

Control Query
I am trying to work on this url query control (people messing around with the query on the address bar) that i can to my script. Baiscly i have 3 choice that are linked from the web page. So you have file.php?choice=1, file.php?choice=2 and file.php?choice=3.

I have managed to find a way were if choice="" so if some one messed around and removed the number then it would perform a default action such as "$choice =1".

How can i redirect the user if any other option (obviously an incorrect one is used). Example file.php?choice=12 which doesnt exist. Id like it to go to a default like the case above. I had an attempt at it but i didnt work. Does any one know a way around it?

How Can I Control My Printer
I have some problem with printer... How can I control my printer
wiht php. I can print my record to invoice preprint form with vb or c++ but with php+mysql I have no idea.

Ad Control Through Script
I would appreciate your advice on the following problem:

Situation-Running Website through Drupal CMS connecting to a Mysql database on another server. Noticed a slight time lag in page loading possibly due to database being on another server, running CMS and using shared hosting.

Objective-Want to serve two different ads and minimize any extra time lag in page loading or ad serving.

Option 1(if possible)-Creating a small php or javascript, something like this:
if ip="a.a.a.a" serve ad <a href>Matching</a>
if ip is not equal to "a.a.a.a." serve ad <a href>Not Matching</a>

Option 2-use some pre-built script like phpadsnew which would require using another database for ad serving. Phpadsnew has some good options for targeting but I am concerned if this may slow the pages and ads especially for users not having high speed internet access.

Please provide your opinion and if possible an example of option 1 or should I just go with option 2.

How To Get Rid Of Control M Character
I'm using PHP code to develop a www interface to let users edit text
files stored on a Solaris UX server. Users are using Windows based
WWW browser access this web site. Once they have selected the file
they want to edit, it's presented in a text window (form) so thay can
modify the file.

The submit button passes the contents of the field to a variable and
it is saved to disc.

From the WWW interface everything seems OK, but when I look to the
file, each line has a "^M" (control-M) at the end.

This makes the files bigger and it can cause problem in a near future
because these files have to be processed by shell scripts to populate
a mySQL DB.

Someone has seen that before and what was the solution.

Control Panel
I`m building a small control panel for one of my sites and what I wanted to do was count the total number of MB being used, is it even possible in PHP and if so what would be the best method?

Cache Control
How can i cache a page in Php3?

Control Panel
I am trying to create a control panel so that i can edit the content of a particular page via Internet Explorer without MySQL. I have cerated the login part of the panel and now have no clue to make the edit page script. My questions are: Can this be done and what script will do it? I'd like the script to be primarily HTML/PHP based. Any ideas anyone?

While() Control Structure
I'm trying to insert a unique UserID into my database.  To do this I'm using the substring to get the first letter of the first name, then substring to get the first 8 letters of the last name, and then I want to append the concatenated string with 1, or if that is taken, the next hightest available number.

But I'm having a heck of a time getting it to work.  I had it working at one point for a single name, but it wouldn't deal with duplicate names, I'm pretty mixed up as to why it doesn't work now. The code:

Control Panel
Im trying to create a control panel for my site. I want to create a script for creating pages. So something like...

I have a form with 2 fields. Where I want to create the new page and what information i want in the file. Then it creates the file with the information in it.

Any ideas how I would do this?

PHP And COMM Ports? X10 Control?
Can I use PHP to talk to comm ports and thus control external devices?

I have never seen anything along this line of discussion.

If anyone can point me towards any information I would be appreciative.

Question On Flow Control
I am having some trouble with the execution of IF statements and I wondered if any one could give me a hand in debugging it please.
I thought or I assumed that what ever goes inside the IF statement executes only if the IF condition is true.
In my case I have a parameter $index passed as value to a popup page, the popup page contains the IF Statements which is supposed to execute depending on the value received from the $index.
It is executing but with errors from the other IF statements.
What I don’t understand is why is it executing or entering the IF statements when the condition is not true. Here is the code:
(Just for information I’ve even tried replacing it with Switch Statement, it is executing well with no errors but I don’t have the image. Which is the best way to do, should I Use IF or SWITCH?

ImageTTFText/size Control
lets say I have bg white.jpg 1px x 1px

Lets say I have a text that says "Kingston or Infineon"

What I want to do is to fill the BG, apply the text then make it transparent, I want the image size to be same as text size W and H.

Or is there a better way to make the text quality better?

bitmap fonts, 8px or 5px sizes... PHP Code:

PHP Switch Control Structure
I’m testing this control structure to serve content based on a variable but the square brackets are a problem… any suggestions?

<? switch ([VAR_NAME]) {
case 'FOO':
echo 'wooo'
break;
default: echo 'whoo'
}
?>

Printf() With Control Character
I'm trying to write a rotational symbol in a CLI process, to report
activity to the user console, using printf( "%s", symbol ); but I see
the control character () is been printed out instead of backspacing.

Is there any work around ?

Control Structure (Basic)
I'm basically creating a chart system, where new entries into the chart are highlighted via a change in the background colour of their HTML table row.

The problem I have is that the following code generates a "Parse Error", please can someone tell me where I'm going wrong?

---------------------------------
$tablecolor = "000000"

if ($lastweek = "NE")
let $tablecolor = "0000ff";
---------------------------------

The error comes in the "if....." statement line.

Date Picker Control
Want some help in embedding Date picker control in my php script.
I have a box where users can enter date, but I want to modify it so that user can click on the calender displayed next to the box and the date selected will be displayed in the box. Any clues how this can be achieved in PHP.

Coding Standards Without Control?
A recent poll asked if programming standards are used by development
organisations... and if they are controlled.

None: 20%
Yes, but without control: 49%
Yes, with control: 31%

Participants: 369

A majority of the participating organisations have coding standards...
and a majority does not control them ;o) What is the situation at your
location?

Creating Log On/Session Control
i am trying to do a simple log on for a project i've been working on but i'm having trouble with a line of code. One one of r the last lines of the PHP i have an error.

The line is down the bottom of the first code (//$db_conn->close() If i comment it out and put in the correct details i am still not getting the correct respnce. Instead i'm getting the else statement down near the bottom of the second part of code,

else { // they have not tried to log in yet or have logged out
echo 'You are not logged in.<br />' } PHP Code:

Control On Upload Function
I allowed user to post a project for bidding and allowed user to upload file. If user didn't upload file, shouldn't display upload failure. Means, user can post a project without upload any file. How do I control the upload function here? PHP Code:

Process Control Problem
I need to process some computation but i do not want the user wait the end of the computation but instead i would send the user a "wait refreshing page".
When the computation is finished i would replace the refreshing page with the new page containing the results.

So i need 2 processes one that would make the waiting page and one that would do computation and make the results page. I read in the php manual that handling processes within a web server environment could raise problems. Is there a simple and a clear manner to solve this problem?

Can I Control The Width Of Tk_messageBox?
I have below tk_messagecode:
tk_messageBox -icon info -type ok -title "About Test Item "
-parent $w -message
"preddddddddddddddddddddddddddddddddddddddddddddddd dddddddddddddddddddddddddddddddddddddddddddddd_tes t"

When I run it it always was displayed in multiple lines. It seems the
width of the message box cannot be controled.
Can I control it to use my prefer width and don't get carriage return
automatically?

Which Version Control System?
we are thinking of using a version control system at work. I was
wondering what are some of the issues we should take into
consideration when deciding upon which one to use? and which one/s you
would recommend?

How To Control And Output To Fax Machine
How to use PHP or other CGI to output some data to the fax machine?

Web Hosting Control Panel?
How do web hosts make the control panel for web hosting? I want to do this for my company, make myself rather then use. But are there any examples of detailed ones.

I know some of if, like adding/editing the SQL DB's etc...but what about editing the email users and Web Properties of the hosting in Apache/IIS 5 etc. are there any freeware versions i can download and analyse?

How Control Struct Evaluate
$PHONETIC is an array of strings. How can !$PHONETIC['d'], in the case
below, evalutae to true. It is a string not a boolean. It would make more
sense if it evalutated to null.

<?php

$PHONETIC = array('a' => 'alpha', 'b' => 'bravo', 'c' => 'charlie');

if(!$PHONETIC['d']):
echo 'true'
else:
echo 'false'
endif

?>

Help With PHP Process Control Functions
I have written a script that basically sends an email (using sockets). I
want this script to be able to run multiple copies of itself so that it
doesn't have to wait for one mail sending to finish before starting on the
next. I understand that I need to use the PHP pcntl_ family of functions to
control the processes, but am not sure where to start. There aren't many
helpful articles on the internet about this topic! Any example code or help
would be greatly appreciated.

Headers Cache Control
I have finished redeveloping a site, reuploaded it and the client is complaining of not being able to see the new site yet. If they Ctrl + F5 they would see it, but are concerned that if some of their clients dont know its a new site, how shall they see it?

I have put the following at the top of the index
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache");
header("Pragma: no-cache");

Will that override the browser settings?

Version Control System
I am not sure this is in the right section so feel free to move it if you need to. I am looking for a web-based version control system script. Basically, I need to be able to have users check files out so that no one can download a certain file until the person who checked it out submits a new version of it or if the admin sets it as lost.

I cannot use SourceForge because my project is not open source. Also, I cannot use Subversion or similar system because I do not want to give anyone SSH/Telnet access. There are companies that offer this service, but cost way too much money for something simple like I need. Does anyone know where I can find such a script? I don't care if it is PHP, Python, CGI, etc as long as it works the way I need it to on my own server.

Passing Control Onto Another Form
I am working with a payment gateway, which sends its response with a specific php page.

Lets say response.php, with parameter ?val=data.  ie http://abc.com/response.php?val=data.

On this php page, I want to perform some processing, but ultimately dont want to display any html form with this page.  I need some way to perform my processing on this php page, then immediately redirect to another php to display the next form, with the results.  Can anyone advise on how this is achieved?

So for example, I want it to then  invoke display.php?mode=1&conf=1, which has the formal display with all the results.  All this with NO user input.

How Do I Control Text Box Pre-Filled Entries
Can someone tell me how to control whether or not a text box is automatically pre-filled. In other words, on some web sites, when you visit them, the username and password automatically fills itself. But on other web sites you have to fill in the username and password each time you visit them.

There is one web site, Yahoo! dot com, where the username and password text boxes are never pre-filled. I have to type in my username and password for Yahoo! dot com each time I restart my browser. It didn't used to be that way. Yahoo!'s web site used to automatically pre-fill the username and password text boxes.

The web site that I'm working on uses cookies. I suppose that I could put a cookie $Name variable in a text box - but there may be a better way of doing it, though.

Access Control Based On Different Server
I surely hope that someone can help me out with this rather (for me) challenging task I’m facing:

I have a site running on a LAN that includes several servers that have each of their own permission configuration. PHP (v4.2.2) is running on a simple WinNT with FoxServ, and it’s doing a great job – but now I need to control the user access, based on the configuration of another server (that can’t be setup to run PHP).

My idea is to put some lines of code into the index file, pointing to a file located on the access controlled server. See: “client can’t connect to the file = redirected to another site / client can connect to the file = the site continues as if nothing ever happened.

The problem here is, that the server running PHP do always have access to this server, so the returned information has to be based on the clients access permission.

Since I’m newbie in this, I happily believe that this can be done – I just don’t know how. I tried with 'include' and 'request', but i learned that this can only be done with http and ftp (+local of course).

How To Control Which Element Of An Array Is Printed
Anyone know how to control which element of an array is printed, say from 1-4 then 5-9 etc.

Source Control Program For Linux?
Does anyone know of a src control program (equivilent to Vsiual Source Safe)?

How To Auto Hide Control When Fullscreen?
I need some help for one critical problem. I need that when
someone visit my site then my home page will be fullscreen
automatically along with autohide. I have done fullscreen but not able
to do auto hide.

CVS Or PVCS Or Version Control For Php Project
I'm working on the php project. ( writing a big application with php code )
I want to manage my code ( version control ).
I don't know how to and don't know software i must use.

My environment Server
= Linux
= Apache
= MySQL

My environment Client ( For coding )
= Window XP
= Dreamweaver

Can A Control Statement Go Within A Mail() Function?
I would like to put an IF statement within the mail() function. I've
tried this and searched around but haven't found anything written
about this. Is it possible? I've been doing somethings like :

mail ("Email", "Subject", "Body".if() {...}."", "From");

Sorry if this is a dumb question. BUT, if it works I will try similar
things in SELECT statements.

Set_error_handler() And @ Error Control Operator
I mentioned this before, but I think my question got kind of lost. I'll make
it one short question now.

With set_error_handler('myErrorHandler') I bypass PHP's standard error
handler, including the error control operator @. Can I still make @ work
with my own error handler? Or, how would I avoid getting two warnings in:

if (!($fp = @fopen('not_a_file', 'r')))
trigger_error("Can't open file", E_USER_WARNING);

when using my own error handler?

Good Version Control System
Im looking for a good Version Control system. I have seen CVS but I am
having difficulty understanding how it works and getting it running.

I was wondering if there was a simpler GUI one for Windows.

How To Control Apache URL To Filename Translation Via PHP?
Here's a problem I'm trying to solve:

In the configuration page of our CMS there is place where the administrator
would specify the directory where uploaded audio files will be stored. The
page currently does not work as fully as I would like. After a change the
audio files are not web-accessible until httpd.conf is updated to map URLs
to the new folder (and an Apache restart).

In my httpd.conf there's a line that looks like the following:

RewriteRule ^/audio/(.*) C:/Audio/$1

So it seems if I can somehow make the "C:/Audio" part a variable that can be
modified by PHP, my problem would be solved.

E-mail Newsletters - How To Control Send?
I have a site that ends out e-mail newsletters - currently to around
900 subscribers.

Is there an easy way to control the actual *send* to the mail server
so all 900 don't hit it at once?

Do multiple sends (from the same sender) tend to trigger spam
controls on mail servers?

My first thought was adding timing loops between batches, but then the
whole page would reach the php.ini timeout before finishing, would it
not?

Presently, the newsletter functions are part of an admin back-end -
I'd rather add some decent routines than foist a stand-alone email
sender application on ther poor client.

Control Panel For Apache Web Server
I run a small web hosting company and a couple of clients have expressed the need for a control panel so they could edit their account. Basically a way to add emails or email forwarding. Some basic functions.

I have searched through Hotscripts.com and some others and haven't been able to find anything, yet I see many hosting companies that offer this. Does anyone know where to get this??? A basic web site control panel? Or can anyone here write it?


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