Counter - Increased By One Everytime The Loop Runs
i want to make a counter that i can echo. its going to be used in a while loop so i want it to be increased by one everytime the loop runs so each time it runs it would look like this:
counter=1
counter=2
counter=3
etc.
View Complete Forum Thread with Replies
Related Forum Messages:
Get Exception Everytime I Try To Do This.
I'm trying to run a command that is ran in the background and is released from php. This was working code but when I upgraded to 4.3.8 it stopped working with an exception. Below is the code I'm working with. $exec = "D:/inetpub/bgrun.exe c:/progra~1/real/helixp~1/producer.exe -i D:/inetpub/liquid/content/".$HTTP_POST_VARS['mixid'].".mp3 -o D:/inetpub/liquid/content/".$HTTP_POST_VARS['mixid'].".rm -ad "28k""; $WshShell = new COM("WScript.Shell"); $oExec = $WshShell->Run($exec, 0, false); I've went through the code and it's definitly coming from these lines. nothing has change except for the version of php
View Replies !
Being Redirected Everytime
When the user uploads an image the script checks to see if its a jpeg. If it isn't it will redirect to another page but its redirecting regardless of the image being a jpeg or not. $chktype = $_FILES['file']['type']; if ($chktype!='jpeg' or $chktype!='JPEG') { header("Location: regform2.php"); exit; }
View Replies !
MySQL Send Me An Email Everytime Something Changes With The Db
I was wondering on your input for this because I was asked if it is possible to have the web site send an email to the admin everytime a row has been changed (either a delete, an update, anything). Basically this site has no script online that can change the database it is all made to view the database not to change it. But incase someone managed to change something by hacking or whatever, they want the site to send an email to the admin. I think it's possible but I have no direction what so ever, so can someone please point me in the right direction.
View Replies !
Session ID Changed Everytime Go To New Page Or Reload.
I'm new member of this group. I had added new virtual host at my intranet server. The new virtual host configuration on httpd.conf is similar with the old one. At the new virtual host, the session id seems changed every interaction to server (new page or reload). The old one is fine, the session id keeps at the same string. Both are at the same server. I use Apache 2.2.3 (Win32) with PHP 5.2.0. Tested using code below: session_start(); echo session_id(); PHP Configuration : session.save_handler = files ;session.save_path = "/tmp" session.use_cookies = 1 ;session.use_only_cookies = 1 session.name = PHPSESSID session.auto_start = 0 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.serialize_handler = php session.gc_probability = 1 session.gc_divisor = 1000 session.gc_maxlifetime = 1440 session.bug_compat_42 = 0 session.bug_compat_warn = 1 session.referer_check = session.entropy_length = 0 session.entropy_file = ;session.entropy_length = 16 ;session.entropy_file = /dev/urandom session.cache_limiter = nocache session.cache_expire = 180 session.use_trans_sid = 0 session.hash_function = 0 session.hash_bits_per_character = 5
View Replies !
Sessions - Popup Authentication Window Comes Up Everytime.
I start a session and then request user authentication from the web browser. I am storing the username in the cookie and using it across multiple pages. Currently, when I logout it kills the session but when I want to log back in, I don't get the popup window because it just uses what I had typed before. I would like to make it so the popup authentication window comes up everytime. Here is my logout code: PHP Code:
View Replies !
Logs Visitor's Info And Saves It Everytime It Is Being Refresh
Here's the code which logs visitor's info and saves it everytime it is being refresh. is there a way where the ip address will be saved just once? <?php //matthew the exploits's guest logger $cookie = $_GET['mte']; $ip = getenv ('REMOTE_ADDR'); $date=date("j F, Y, g:i a");; $referer=getenv ('HTTP_REFERER'); $fp = fopen('iplog.html', 'a'); fwrite($fp, 'Cookie: '.$cookie.'<br> IP: ' .$ip. '<br> Date and Time: ' .$date. '<br> Referer: '.$referer.'<br><br><br>'); fclose($fp); ?>
View Replies !
User Runs PHP
I have an app that uses PDFLib to read some images off the file system (Red Hat linux) and puts them into a PDF. I have permissions set on the directory to be readable by the owner and the group, 'images'. I made apache a member of the group 'images' but get a permission denied error when trying to read an image from the images directory. Is there some other user that owns the PHP app. Env. PHP 5.03 Red Hat ES4 Apache 2.02
View Replies !
PHP Only Runs From Command Line
I know very little about PHP, but I was just curious to know why exactly would some PHP code run fine from the command line but not from the browser? I'm just curious. I was working with someone else's PHP code that supposedly created MySQL tables in a database and for some reason it just wouldn't create the tables at all (no specific error message). Someone suggested I run from the command line and when I did, it worked...
View Replies !
Bad Query Runs With No Error!
there must be some weird setting on the mysql database i am using for this latest project. the following query runs without throwing an error: SELECT start_time, last_access_time, user_ip session_data FROM demo_sessions WHERE id='b31fd40c7e9135f2b52e4f17c23fc3c54da137b8' notice there is no comma between user_ip and session_data what's the story here? seems like a real security risk to me because my server won't log bad requests.
View Replies !
Why Script Runs Differently With CRON?
I am running a PHP Script that downloads my RSS News (and the accompanying Thumbnail images)from the Web. When I execute it from CMD line, no problem. The News and Images are downloaded, great! When I begin to update via CRON, no images are downloaded/written to disk.--I don't have this problem when it's RUN from a shared hosting account, it's only on my home Linux Box.
View Replies !
Bug 23891 MySQL Runs Out Of Connections
http://bugs.php.net/bug.php?id=23891 According to this report, what the person was asking isn't a bug, it's a feature (rimshot). I'm running into this problem almost exactly, and really don't understand what the answer is. The support person snidely suggests reading the manual, which is always great advice, but in this case really doesn't help out. Could someone explain what "If you use mysql_select_db() or slightly different connection string you can have more open connections then you have process." means? If I don't use mysql_select_db, then what do I use?
View Replies !
EXEC() Runs Process In Background
Exec, shell_exec, system, popen functions all run the process in the background. how can i get it to run the process normally. my code looks like this: <? exec("batch_file.bat"); ?> am i doing anything wrong?
View Replies !
Close Window After Script Runs
When a user clicks on a link in their email, I have a browser window that opens in the background and runs a script confirming their desire to be added to our email directory. I basically want this window to open, run and then close without the user having to deal with it. Is there a way in PHP to close the window after the script finishes running in it? Or should I revert to JavaScript? I want the script to be mobile so I've sort of ruled out processing it server side. TIA.
View Replies !
How Often Does Garbage Collector Runs In Sessions?
Does anybody knows how often the session garbage collector checks for expired session to delete them? is it possible to modify this timeframe? is it possible to call this function manually? I am storing my sessions in a mysql database and i am using a session expiration of 5 seconds (just for testing), but after the session is expired the session record in the db table still exists. and it looks the sessions aren't expiring either because if you still have the session cookie you can keep up with the session. Code:
View Replies !
Email Form Which Runs From An Iframe
I have set up an email form which runs from an iframe. The only problem is that when the script redirects the user to the success or error pages, these pages open within the iframe. Is there a way to specify the target window as 'parent'? Someone said that this could not be done via the php script and would have to be done with javascript in the html form itself.
View Replies !
Optimizing Query That Runs Slowly On Linux
I was wondering if anyone has any insight into why the query I have posted below runs exceedingly slow on my Linux server. I am using Php with a MySQL database. On both my development computers the query runs briskly. They are however both Windows boxes, one running Windows XP and the other running Windows 2000 Professional. Here is the culprit.....
View Replies !
Header Function Runs Before Update To Database Is Made
I have been having some problems with a part of my login script. This is the two lines of script I am having problems with: mysql_query("UPDATE " . $userName. " SET login = '$loginIN' WHERE pass = '$password' AND course = '$courseID'"); header( 'url=http://www.somewebsite.com/logged_IN.htm' ); The problem is that when this php script is executed the second line executes before the first and an update to the database is not made. I also tried the script without the second line and the first works then.
View Replies !
Query Runs In Mysql But Returns Error 1064
The same query runs in mysql and in Zend interface but not runs when using inside php script. I am receiving the error: "1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'str_qry_Insert' at line 1" INSERT INTO fnd_script_type (type_name) VALUES ('test1') I already have tried it with as: INSERT INTO `fnd_script_type` (`type_name`) VALUES (`test1`) INSERT INTO fnd_script_type (`type_name`) VALUES (`test1`) INSERT INTO fnd_script_type (type_name) VALUES (`test1`) what am i doing wrong ?
View Replies !
Query Runs Multiple Times Under Heavy Server Load.
I have been having an issue with some MYSQL queries running multiple times when the server is under a heavy load. Example, if I do an 'update Table1 set item1 = 0 where 1 = 1' This runs fine under normal conditions, but will repeat itself multiple times when the server is under load. Is this just an optimization or server resource issue. If so, I would assume the query would just timeout and not run at all instead of running a few times.
View Replies !
Working With Dates - Runs And Queries The Database To Produce A List Of Information
I have a script that runs and queries the database to produce a list of information, based on a date range. This is to fllow up on a script that is automatically run each Sunday night. What I want to try and acheive is, for example, if someone manually runs this report on a Tuesday the script will assume that it is run on the Sunday night, to make sure the results are exactly the same as the emails that have gone out. PHP Code:
View Replies !
Session Data Stored But New Session Everytime!
I am running out of time with a problem I have running PHP 5.04 and Apache 2.0 and really need help :(. I have a page that stores a variable in session but each time I reload that page the session seems to be re-created and is an empty array. I have checked the session file and the variable is being stored against the session id, but I dont know why PHP is not picking up the session after I reload.. I have tried the usual suspects of register_long_arrays etc but no luck.. slowly winding down to a quick death before our old server is taken out of commission and all our sites will be served from here, but at this rate its not gonna happen.
View Replies !
"Please Wait" Page While Php Runs Mysql Queries
Does anyone have any idea what I should google to create a "splash page" that tells the user to wait while a few mysql quieries are run through the php page? It takes anywhere from 5 to 20 seconds, and I don't need a progress meter, just a splash page so they do not go anywhere and the user doesn't think there is a problem with their browser or network connection.
View Replies !
Creating Table Rows For Ever Other Loop In A WHILE Loop
I'm trying to create a table using a MySQL fetch array while loop that would look like this: CONTENT1 CONTENT2 CONTENT3 CONTENT4 CONTENT5 CONTENT6 I need a <TR></TR> for every other piece of content. But I don't know how to do this with a loop that uses a MySQL fetch array while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { PHP CODE THAT IS LOOPED;}; I'm trying to remember from my old college Java class that we did something with loops for whenever the counter variable was even the loop would do something special... I don't know if this is possible with a while+mysql_fetch_array loop though.
View Replies !
While Loop In A Foreach Loop.... Semi-results!
I am echoing a mysql database result which is stored in the database as such "Superman, Batman, Wonder Woman, etc". I am using the explode to split the into an array using the comma as the delimiter. Then I am trying to get it so if I click on Superman I am taken to the Superman profile page... Batman I go to the Batman profile page. Code:
View Replies !
Database Stores Default Number Everytime, But I Havent Set A Default Number??
Im having some problems with my database. Everytime i store a number which is longer than 10 numbers the script or database puts this number into the database: 2147483647. Its does this everytime no mather how i write the numbers and nomather how long the number is, it just needs to be over 10. I have set any default value in the database and to be sure i havent i tried deleting the table, but same thing happends again???
View Replies !
Creating A For Loop Inside Another For Loop.
I'm trying to write a script that will display questions that are in one flat file and answers from another flat file. In addition, there are copies of these files with their own data in multiple folders. I created a for loop to work with an array of the different file paths to the different folders. Then I created a for loop inside of that one to display the questions and answers files that is in each folder. All I get when I run the script is the first folder and it's questions and then it stops there. PHP Code:
View Replies !
Loop Running Inside A Loop
Having a problem with the following; PHP Code: $last_id = mysql_insert_id(); Â Â Â Â $type_count = count($types); Â Â Â Â for ($i=0; $i < $type_count; $i++) { Â Â Â Â Â Â Â Â $match = ""; if ($types[$i] == $featured[$i]) { Â Â Â Â $match = "y"; Â Â Â Â } Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $q_add_types = "INSERT into company_ins (Id, company_id, ins_id, type_featured) VALUES ('', '$last_id', '$types [$i]', '$match')"; Â Â Â Â Â Â Â Â mysql_query($q_add_types) or die(mysql_error()); } The INSERT query does not run when I insert the inner parenthesis. Does anybody know why?
View Replies !
Hit Counter Help
I just created a counter in PHP, and was wondering how I would be able to make other websites (which are located on different servers) of mine be able use the same statisitcs/counter. If you don't get my drift, I am almost trying to accomplish a remotely hosting counter service. Counter Info There are two files: counter.php, counterlog.txt If a visitor comes, it opens up the counterlog.txt and it increments. I put an include statement where I want the counter to show. Can you guys help me by answering these questions: 1. What language would I use? 2. Would I call it with JavaScript's script src? If you want, you could also be so kind to write me the script (or at least some of it)
View Replies !
Counter
:) I am following a tutorial for php (hudzilla.org) absolutely loving it however I am having trouble with the counter example <?php // your content here... $filename = 'counter.txt' // our counter file $fp = fopen( $filename,"r"); // open it for READING ("r") $counter = fread($fp, filesize($filename) ); // read in value fclose( $fp ); // close it whilst we work ++$counter; // increase the counter by one print "$counter hits to this page"; // print out the new value $fp = fopen( $filename,"w"); // open it for WRITING ("w") fwrite( $fp, $counter); // write in the new value fclose( $fp ); // close it ?> however it dont werk : by dont work I mean... it wont add to a number held in counter.txt it _will_ read that number fine, just not change it I am currently using # php -v PHP 4.3.10 (cli) (built: Apr 4 2005 04:47:06) Copyright (c) 1997-2004 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
View Replies !
Counter.
I would like to have a counter on my website. I did try a simple code found on the net called "dark Counter" but when the code was placed in my siteheader.php it counted a visitor everytime they clicked a link when in reality it was only one visitor.
View Replies !
PHP Hit Counter
I want to make a simple-as-hell hit counter in PHP that just increments a value in a text file every time the page is loaded, so it would open the file, do a counter++ or something then close the file, then that file can be included in the front page with formatting around it etc.. No referers or any of that stuff is needed.
View Replies !
PHP Counter
Like at the top of each board it says there is so many guests online. Well how do you work out how many people are on one page at a time.
View Replies !
Hit Counter With Url?
I'm trying to make a hit counter that I can then use to show the most popular urls on a site. I've got the simple code from the phpfreaks tutorials section, could anyone give me pointers as to whether it's possible to extend so it somehow tallys based on url? I'm guessing it'd need some way to extract the current url, send to sql table, check if it already exists, if so, add one to that row, if not add a new row.. session_start(); include 'includes/dbconnect.inc.php'; if (!session_is_registered("counted")){ mysql_query("UPDATE simplecount SET count=(count + 1) WHERE count_id=1"); session_register("counted"); }
View Replies !
Hit Counter
i am a noob at php and was wondering if anybody could write a hit counter script for me. im not sure if it should be php or javascript, so could someone please write a script for me; it only must count the number of page veiws, nothing special like IP addys or how many in 1 hour.
View Replies !
Making Counter With Php
I am trying to make a counter that counts how many times a certain page has been viewed. First way of doing it that I can think of is creating a file that record the counter. The only thing is that the file will have to have 766 (or 666) permission. Now, my question is: is that safe? I am pretty new to php, but I am worry about giving permission other than 744 or 755. The other idea that I came up with is to store it in mysql. Is it a little too much to store only an integer (unsigned) in a database? I feel like trying to care a glass of water with a big 5-gallon container... Any other suggestion on how to do it will be great too.
View Replies !
IP Logging Counter
Hi. I wrote a script that logs IP's into MySQL and then prints them onto the page. The main purpose of this was a hit counter based on IP addresses. Everytime a user presses refresh or goes to another page, the hit counter adds one and records the IP address again. Here is my code:
View Replies !
Page Counter
It may seem incredibly dumb, but I'm trying to serve a counter for a website that doesn't have PHP. There's probably a very easy way to do it, but so far I've had the following: In the HTML only site an img tag pointing to counter.php as the source. Then the php returns a 1px by 1px image and performs the count and stors teh result in a db. Unfortunately for some reason the count is never updated until the page is refreshed. In other words when you visit the page the image part works fine, but the count isn't. So click the refresh button in the browser and the count goes up by one.
View Replies !
Counter Problem
I got a script that does a multi-query and echos the data. However i wanted to customize how the data is extracted and displayed. So i added in some code to create a table extract the data start the counter after the 10th record the the table is column is closed and next record is displayed on the next column. The multi-query works fine i tested it but the customization fails. I keep getting either errors or not being able to get it to swich to the next column after the 10th record. Heres the code:
View Replies !
Download Counter Help
I have written a php scipt to take a download path given a keyword from an MySQL database, incriment the counter by one, and then set the header to be the download URL. Everything is working well except that the counter is incrimenting by 2 each time. This problem wont happen if the header("Location....") is comented out, and it will behave like a good counter, but, ofcorse, not start the download. I have tried setting the location to be a call to another script, which istelf contains the: if ($download_path) { header("Location: $download_path"); exit; } but the problem still persists if it starts the download... Anyone have a clue what the problem could be?
View Replies !
PHP Counter For Free
I want to create a counter for free to my users, so that anybody could generate a small piece of code and add it to his website and by this way they run their own counters for free.Is there a simple way or a ready made php script that could do this. If anybody could tell me how to do it or the steps will be really...
View Replies !
Downloading Counter
I just wanted to ask if it is possible to have a download counter wherein the counter adds 1 whenever theres is a successful download, not when the user click on the download button?
View Replies !
|