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




How To Check If Multiple Of 2?


I am creating a tournament script and need to have total matches as a multiple of 2 (2, 4, 8, 16, 32... ). How can i check the number to see if it's ok.

example
$matchesNum = 38;//obviously this is not a multiple

How would I check that number to make sure it was 32 or 64...




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Check For Multiple @'s
We are trying to prevent spammers from mass mailing their list while
using our contact us script. We have a few security measures in place
but would also like to add a "check for more than 1 @'s in the to:, cc:
and bcc: fields. Can anyone point us to some code or turotials for
doing this?

Check If Variable Is Multiple Of TWO
Is there another fast way (withOUT to call a PHP function), to do this? It is to know if a variable (into a loop) is a multiple of two. PHP Code:

Check For Multiple Occurances In An Array.
I am checking an array for existence of a value, but I want to see how many times it exists in the array.

Is there a quick function to do this or must I use a loop and step through? I looked through the manual and did not see any array functions that would do this, but I may have misunderstood one of them. Which has happened before.

I was using this before I realized I had multiple occurences in the array. PHP Code:

Handling Multiple Check Boxes
I have a PHP generated page which displays X many records. Each record has
a checkbox preceding it. The user checks several checkboxes, and hits a
delete button. All the corresponding records will be deleted.

But I'm running into difficulty...

Right now the NAME property of each check box is the primary key of the
corresponding record. Hence if I know which checkboxes are checked, I
simply use DELETE using the NAME value.

Generally speaking, how do I get the server side to see which check boxes
were checked?

The check box names may not be sequential, if any records have been deleted
previously, and the first check box might be a number greater than 0.

Is there an easy mechanism to do this? Some kind of built in cnotrol array
allowing me to loop over every check box that was on the form submitted?

I could store the last and first checkbox number in a hidden input, then
loop starting/ending at those values, but that may loop over a lot of
controls that do not exist.

Multiple Variables Eregi Check.....
This is an easy one I think but I just can't do it for some reson - I want to check more than one variable on the same line, not just address, but can't work out the syntax to do this...

ie. So this code........

$crack=eregi("(to:)|(from:)|(cc:)|(bcc:)",$address);

does this........

$crack=eregi("(to:)|(from:)|(cc:)|(bcc:)",$address and another variable);

I want it so that if any of the variables meet the criteria set in the eregi function then $crack will be true (or 1).

Function To Check For Multiple Instances Of A String In An Array?
I need to check if there are more than one of the same string in an array. Does anyone know of a function?

Selecting Multiple Values From Multiple Tables Using Checkboxes
I've been struggling with this for a bit but cannot seem to find a simpler, cleaner way of doing this.

a. I have a Table A - Customers , Table B - Contacts .
b. I have a form where a user types the first few alphabets of a customer name and then gets a list of contacts, cities.
c. The user is supposed to select multiple options from this list and then send that data to another form for processing.

I'm able to only pass data from Table A, not from B . Could someone please have a look at the 2 snippets of code and advise? And is there a way both these php scripts could be combined in a single one ? Code:

Grabbing Data From Multiple Tables For Multiple Requests
Here's what I'm trying to get at.

A table that displays all the Process Server's name, the number of summons's he has out within 7 days, 7-14 days and 15+ days...pretty simple, it's just a report so management can stay on top of how many papers are out.

I've got the server_information table with the server name and ID. and a case_information table with the serverID.

I've got a while loop that displays all the server's name, the problem is when I try to get the # of cases....here's what i've got so far. Code:

Multiple-combo - Multiple Mail Recipients
I am new to scripting but trying to create a page that lets users create an e-mail (mailto after having chosen from two drop-down menus (arrays).

I have managed to do so in HTML by using a Java script borrowed from Randall Wald (http://www.rwald.com).

However, I don't want the e-mail addresses to appear in the page to avoid spam. Is there a way to do so by using PHP?

P.S.: The first array contains (University A, University B) and the second array (Faculty, Staff, Students), i.e. 6 different e-mail addresses

To Search Multiple Words In Multiple Fields
I have a $phrase made of some words.Every query has a number variable of words. I would sort of my_table all records that have at least 1 word of the $phrase into field_a AND/OR field_b of my_table.

Multiple Users, Multiple Tables, One Form
I have a small group of users that will submit their 'goals' via one form (placed in a postnuke block). I have created one table (mysql) for each user to collect collect their goals. I need some direction in writing the php that will submit the form data to the correct table based upon the users Postnuke login.

Multiple Multiple Select Boxes
I'm looking to have multiple multiple-select-boxes on a page. But I
can only get the contents from the last selected value within a box,
via PHP. I've tried numerous methods. What am I doing wrong?

You can see ALL the values present in the url:
http://myserver/test.php?notify_use..._updcats=Update
e.g.......

Check Box?
i am trying to create few check box in one page without a submit button, and there are 5 have which is some with this. User only able to click submit in the last page after he make a selection after these 5 page.

How can it keep the selected check box so that i can process in last page. I had heard there are one way to create a onclick function inside check box but how?

How To Check An URL ..?
I am a beginner in PHP. Does anybody know how to check if an URL is
alive or dead in PHP (not exist or server down...or whatever ) ?

CHECK URL
How it can be checked that a URL exists or not in PHP.There is one
way is to use fopen function then passing the URL as a parameter.
Like this,

<?
$URL = "http://www.abc.com";
$fp = @fopen ($URL, "r");
if (!$fp)
{
die ("Cannot open website $URL!");
}
?>

But I think that there should have some other smart technique.

Can I Check SSL Somehow With PHP?
Ever since I got a server for our site, it just opens new issues.  Here is the problem: My SSL Cert somehow got corrupted.  The server is managed, so they fixed it right away once I noticed it, but nobody was able to checkout until it was fixed, and I cannot check the site every hour.

Here is what I want to do (but the server people say it is not possible): Is there a way, by chron or otherwise, to run a PHP  that requests a secure page, and if it does not respond, it emails a warning? It seems that this should be able to be done without too much trouble.  Any ideas?

How Can I Check The Url?
Is there a way to check if a user entered www. before the url?

How To Check Id
I was wondering how to get the id that has the biggest number and then add 1 to it so I can have an id field

id    name
1     test
2     test1

Eregi For URL Check
Can someone hook it up with an eregi expression to check URLs for validity?

Check For Folder
how would i check if there's at least one folder in the current folder? the current folder is $dir/$f/

this is what i have, but i know its wrong

$fillle = "$dir/$f/";
if (file_exists($fillle)) {$Q="true";} else{$Q="false";}

How To Check If I've Been CHMODED 220 ?
My host and I have come to a dissagreament on filedownload sizes, and everyday when I wake up, I see that I'm back to 220 for that /files/ directory.

I'd like to point out that it's nothing illegal, it's just gamepatches, and yes... these can get quite big.

Now, untill I settle that, I need to redirect my visitors IF that site is innaccessible to another box... how can i detect if the user gets a 403 page so that I can redirect him?

Had a look at "socket_read()" etc... but can't make heads or tail in it yet, will keep looking in there, but if someone can give me a push in the right direction, I'd apreciate it.

Check A String
Hey everyone, how would I check a string for having only numbers and having 4 integers exactly?

How To Check If 2 Vars Is Not Set?
How to check if 2 vars is not set?
I started with this
if (!isset($x,$y)){

and tried many like below but gave up.

if (!isset($x)) || (!isset($y){
if ((!isset($x)) || ((!isset($y)){

Check Data Not Already In D/b
Hwo can you do it, on an insert query so that it will check whether there is a record with the same info, say club name for example, and then if u try input same thing again it will reject it.

How To Check If Theres Something In STDIN
How do i check if there is something new in STDIN?

I ran into this problem when i was doing some simple command line script
that takes input from STDIN. And i noticed that feof() always returns
TRUE with STDIN. Also it seems that if i fread(STDIN) and there is
nothing in STDIN, it waits forever for input. So i was wondering if
there is some way to check how much stuff there is in STDIN and then
read it, because i dont want to wait for the input forever.

How To Check SessionID Available Or Not?
I am working on a site in which I need to check whether user is online
or not. If user successfully logged out then I can change status from
online to offline but if user do not logged out and close the browser
or session timeout then in both of the case I do not handle how to
change user's status from online to offline.

Check Box Question
I have a small question regarding check box and mail() forms.

I have a mail() form on my website and I want to add to it a check box
that if checked the user get a copy of the data he sent and if not
check the mail is sent to me only please help me doing this because I
have tried how to figure it out but I couldnt and the problem is that
am not a really good php developer am just a beginer.

Spell Check
I have a form with 6 different fields for the user to fill in. One of the field is the text field and they are suppose to fill in about 6 lines of information. This page/information is dynamically get displayed on my webpage. How do I make sure that before it gets displayed on the web some kind of spell check is done automatically.

I did try at php.net. There is a function call Aspell() but I don't know how to get that to work for my problem.

Domain Name Check
I want to check domainnames on my website. Type in a name and you'll see if it exists or not. I've once had a CGI Script dat does this... but I wonder if its also possible in PHP.. and how?

Webmail Check
How would I go about writing a script that checks users GMAIL and HOTMAIL emails and displays it for them? if you go to www.netvibes.com it allows you to check your gmail or hotmail and yahoo accounts right from their website.

Check Image Is Not There
is there an easy way to do a check on a directory to check that a file uploaded using php uplaod fucntion isn't already there, and if so where can i read up on this.

Spell Check
How can I do spell check words? I have a file with a bunch of words in it, I want to eliminate incorrectly spelled words.

String Check
I want to check if a string contains only alphabetical and/or numerical characters. I think the solution is eregi, but i am not an expert on regular expressions..

How To Check Value Of Variable??
I have this input box that is optional called "Reason" If a user submits this form with data in the "Reason" form then I want to take those contents and add to them, ie:

if (isset($reason)) {
$reason_message = "Reason for rejection: $reason";}
else {
$reason_message = "";}


Then I have $reason_message sent alow with other stuff in an email. The problem is that if a user leaves "Reason" empty, when they get their email, this string called "Reason for rejection:" is sent. Bottom line: is there a way for me to tell that "Reason" has no value and there for not send "Reason for rejection:"

Check Boxes
I have a very little problem with check boxes. How can I write a simple PHP code to tell me when a check box has been checked, and then use the name of the checkbox in a function.

Update Check!
i update a table like this and i want to check if the update was ok or not! Code:

Port Check In PHP
how can i check is port number xxx opened on localhost ?

Check For Cookies
This is more of a pain than I thought it would be. I need a simple code
segment to determine whether a browser accepts cookies or not. When I pass
variables between pages when cookies are turned off, the global variables
are empty between pages, fine, that tells me cookies store the global
variables - right? I store the values in $_session and when cookies are
turned on values are passed between web pages - I can see these values in
fields that are displayed in the next web page.

I need to be able to check on the 'first' entry webpage after a user enters
that page directly whether or not their browser accepts cookies at that
point. Everything I have tried complex to simiple won't work. How do I do
this?

Check My Math!
Not sure about you, but when I run this, it tells me 59001.31 doesn't
equal 59001.31. Change each side of the equation by a hundreth or two
and it checks. Change it a bit more, and it won't.

_What_ is going on here?!

<?php
$subtotal=59001.31;
$principal=58605.33;
$interest=395.98;
$check=$principal+$interest;
echo("<pre>");
echo("Check: " . $check . "
");
echo("Subtotal: " . $subtotal . "
");
if($check!=$subtotal) {
echo("Check (" . $check . ") does not equal subtotal (" .
$subtotal . ")"); // Check doesn't equal subtotal
}
else {
echo("Check (" . $check . ") equals subtotal (" . $subtotal .
")"); // Check does equal subtotal
}
echo("</pre>");
?>

Check If The Page Is Not 404
How can I check if some url or address works ? If I had in my database about 1000 links, how can I check if they work ?

Check Fonts
Is there a way to check wich fonts are installed on sombodies browser? if not in php maby in java or something. I need the code for that for a highly customizable graffity wall.

Cookie Check
I would like to check and see if my visitor’s browser accepts cookies, and do it on the first page they landed on. To best of my knowledge ‘setcookie’ function does not give a confirmation back if the cookie was already set. Is this possible and if so how?

Some notes:

How Do I Check Against The PHP Version?
I'm writing an installation script for my PHP content management
system. I've written the code to be compatible with PHP 4.06 or later.
I need to get the PHP version and throw an error message if the
version is less than 4.0.6. I realize that phpinfo outputs the info,
but what function would get me the version string?

Using PHP To Check POP Email?
PHP document that would log-in to the users POP mail server, and check for mail, allow them to "compose" and send an email through that server, along with any attachements, etc.
I've seen this done with Cold Fusion, and am looking for information on this using PHP.

Check Click
I have a page and a sponsor. Every time a user click on a banner from our
sponsor their webpage is opened. I'd like to reward these users, but how to
check who clicked on a banner. I can't do anything on sponsor's webpage?

Check Wildcard URL
I'm looking for a function that will help me determine whether or not a URL entered by a user matches specific requirements. This is done using $_POST.

Basically the format of the URL must be either: www.example.com, *.example.com, www.example.*, or *.example.* - or some kind of combination such as www.url.com*. I don't want to allow a star in the 'url'. So in theory, to check this, all i would have to do is make sure the string contains: [www and/or *].[text].[text and/or *]

Postcode Check
I have no idea where to start with the code, but would like in a way that i could input true and false values, eg if it contained "sw19" or "SW19" value = true. If postcode is something not listed, value = false also True and False results will take the person to a relevent page, or relevent pop up a box.

Check If Email Has Been Sent
How can I check whether the script sent the email ?


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