PHP - How To Adjust The System Time - On A Linux Machine
hello dear php-experts i run opensuse 13-2 and i am very very happy the time does not get displayed correct. it falls back to UTC all day. What can i do. i have had look at the documents here https://en.opensuse....uring_the_clock https://tr.opensuse....T_Date_and_Time how to set up correct to the local time - note i live in GERMANY near francfurt Similar TutorialsHi, I am trying to load a block of code for all operating systems except Linux. I have the following code. Does it look ok?- I am not too sure what to put in the IF statement.
Thanks! hello and good day dear Linux-experts, i want to install a new opensuse linux on a notebook. i want to upgrade is the following: this one: Akoya P 6512 15" OpenSuse 13.1: AMD Athlon X2 P320, 2,10 GHz, 4 GB 320 GB hdd-drive what is wanted: i want to do a total fresh installation i want to have not tooo much partitions! i only want to run opensuse 13.2 i want to have some kind of native linux partitions - such as ext 4 - # what do you suggest - should go with the new default BTRFS file system?!? well to begin with the beginning: i applied the following commands a. lsblk b. fdisk -l see the results,,,, ; linux-c5sz:/home/martin # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 465,8G 0 disk ├─sda1 8:1 0 4G 0 part [SWAP] ├─sda2 8:2 0 102M 0 part ├─sda4 8:4 0 1K 0 part ├─sda5 8:5 0 2G 0 part ├─sda6 8:6 0 4G 0 part ├─sda7 8:7 0 10G 0 part ├─sda8 8:8 0 20G 0 part / └─sda9 8:9 0 389,6G 0 part /home sr0 11:0 1 1024M 0 rom and the following fdisk -l linux-c5sz:/home/martin # fdisk -l Disk /dev/sda: 500.1 GB, 500107862016 bytes, 976773168 sectors Units = Sektoren of 1 * 512 = 512 byte Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0xb8fa3ecd Gerät boot. Anfang Ende Blöcke Id System /dev/sda1 63 8385929 4192933+ 82 Linux swap / Solaris /dev/sda2 8385930 8594774 104422+ 83 Linux /dev/sda4 * 8803620 976768064 483982222+ 5 Extended /dev/sda5 8803683 12996584 2096451 83 Linux /dev/sda6 12996648 21382514 4192933+ 83 Linux /dev/sda7 21382578 42347339 10482381 83 Linux /dev/sda8 117821440 159766527 20972544 83 Linux /dev/sda9 159768576 976766975 408499200 83 Linux linux-c5sz:/home/martin # subsequently the questions; which partition logic should i choose. what is wanted: i want to have not tooo much partitions! i only want to run opensuse 13.2 note: i want to erase all the existing partition logic /(that is currently existing) i do this with Gparted. which partitions should i take? which file system ? i am curious to get to know your ideas Code: [Select] <?php if(date('w') == 0) $str = 'today'; else $str = 'last sunday'; $timestamp = strtotime($str); //echo $timestamp; echo "<img src='brn_masthead.gif' width='500' /><br /><table border='1'><tr>"; echo "<tr><td align='center' width='140'><b>Sunday</b></td><td align='center' width='140'><b>Monday</b></td><td align='center' width='140'><b>Tuesday</b></td><td align='center' width='140'><b>Wednesday</b></td> <td align='center' width='140'><b>Thursday</b></td><td align='center' width='140'><b>Friday</b></td><td align='center' width='140'><b>Saturday</b></td></tr><tr>"; $j = 0; for($i = 0; $i < 14; $i++) { $thisdate = date('Y-m-d', $timestamp + ($i * (60 * 60 * 24))); ?> I've looked into mktime and checked the manual, but can't find anything that seems to work inside the loop. Thanks! well good moring dear folks - hope you are all right and everythings is fine across the atlantic today i have a question regarding server-paths - and the absolute and relative in a linux-[opensuse 11.4] lampp-system well i just installed something in to my Lampp on openSuse 11.4 while setting up this application - (it is a joomla 1.7.3 ) i wonder how i name the paths public $unicodeslugs = '0'; public $feed_limit = '10'; public $log_path = 'D:\\Xammp\\xampp\\htdocs\\pre1/logs'; public $tmp_path = 'D:\\Xammp\\xampp\\htdocs\\pre1/tmp'; public $lifetime = '15'; public $session_handler = 'database'; what cou you thinks how shoud i name the paths well you see above this was a windows box where the pahts originally were taken from love to hear from you PHP date and time function is not showing correct time on my local system I have the following php code date_default_timezone_set("Africa/Lagos"); $date = date('d-m-y h:i:s'); echo "Server Time ".$date ."<br>"; echo "The time is " . date("h:i:sa")."<br>"; $current_datetime = date("Y-m-d") . ' ' . date("H:i:s", STRTOTIME(date('h:i:sa'))); echo "Current time1: ".$current_datetime . "<br>";
Output
Server Time 21-05-21 09:55:39
Expected Output
Server Time 21-05-21 10:55:39
Any help would be appreciated. Edited May 21 by Ponel I am having a problem with PHP displaying the correct date and time. It updates as it should, but is fast by 4min and is always displaying a date in 2004. I ran a basic php script to make sure the application im using itself is not wrong. go to lunenburgledger.com/time.php Anybody had any ideas on where to check? The system time on the Windows Server 2003 is correct. The only thing I can think of is that it was converted to a virtual machine on vmware esxi, but the system time stayed right. Any ideas? Thanks! Hi, i am thinking of creating a text based game mmorpg using php/mysql etc... I know that a lot of these types of games use a tick based system, but i want it to be realtime, the only game i cna find that uses this is Torn, does anyone know how they make it realtime? I know that ticks can be controlled by cronjobs, but how about realtime? The problem is that the game might involve the player building a house, in a tick based system it could be easy to manage by saying the house will take 3 ticks to complete, but i want the house to be like in 10 minutes of 32 minutes, how can i do this. Someone said to check whenever the player next logs in to check if the house has finished and then say it has been built, but seeing as it is an mmorpg it could affect everyones gameplay, not just the person building it, so this will not work. Thanks and sorry if this is a bit confusing. Hello Guys, I would really appreciate some feedback on this one. Here's the basic simplified code for my bidding system site (querys for when a user sends a new valid bid): Its working fine but if 2 users send a bid at exactly the same precise moment (even same milliseconds), I have 2 problems (described below code, for better understanding) Please picture this code as if its happening 2 times at the same time (from 2 different users) Code: [Select] $time = microtime(true) * 10000; $result = mysql_query("UPDATE `AUCTIONS` SET Current_Price = Current_Price + '$increase_price', Bids = Bids + 1, Bidder = '$bidder', Bidder_Time = '$bidder_time' WHERE PId = '$id'"); //grab the current price to save on bidding history DB if($result) { $resultPrice = mysql_query("SELECT Current_Price FROM AUCTIONS WHERE PId = '$id'"); while($row=mysql_fetch_array($resultPrice)) { $current_price = $row['Current_Price']; } if($resultPrice) { $result = mysql_query("INSERT INTO `BIDDING_HISTORY_DB` (Id, Bidder, Bidder_Time, Raw_Time, Ip, Type, Bid_Amount) VALUES ('$id', '$last_bidder', '$last_bidder_time', '$time', '$client_ip', '$credit_type', '$current_price')"); } } If 2 users bid at exactly the same SAME moment, its possible that on BIDDING_HISTORY_DB... I get the Bid_Amount field with the same value (when it should be always 1 number higher than the previous) ( Bid_Amount is coming from $current_price) $current_price grabs the new updated value from the AUCTIONS DB on the first query (Current_Price = Current_Price + '$increase_price'). So its impossible to have 2 values that are the same (at least I am not expecting that), but I realized that if the query from 2 users are being processed at the same time and the UPDATE AUCTIONS query is processed 2 times and AFTER THAT then the SELECT Current_Price FROM AUCTIONS WHERE PId = '$id' is processed on both bids...that is when the Current_Price is grabbed with the same value for both USERS!! Any ideas on how I can find a solution to this ??? The other problem is that I am knowing which bid was made (by which user) before/after because of the $time variable. But sometimes when 2 bids are made at the SAME precise time with the same milliseconds (yes it happens) ... this is when problems arise (because 1 user could have as Current_Price 10.11 and the other one 10.12 and then on DB the user with 10.12 could be shown as if he made the bid first, any ideas/suggestions on how I can find a solution to this? Hi. How to implement twitter like real-time sharing system? So that is like, if my friend(following person) write a message, it also appear on my wall(page). 1. Is it hard? 2. What language used for it? PHP? 3. Is there any source about it? Thanks. Hi everyone... I would like to implement a questionnaire/survey system that has only two Answers (Yes /No). Basically, this questionnaire system will be widely used on Mobile Phones. It will be looking something like this below: http://awardwinningfjords.com/2009/06/16/iphone-style-checkboxes.html Lets say a user selects a response as No (Using the above slider button for a question). That response should be recorded in the database with User Details + Time Stamp. Also, I would like to generate a report for each question (Responses of Multiple Users) and a report at a User Level for the entire questionnaire/survey (s). Can some one guide me the fastest & easiest way to achieve this? I'm a new learner of PHP. Regards Sandeep Hi everyone, I'm trying to get the name of the machine in use. If I use this feature locally, it works.
function visitor_machine_name(){
return $machine_name;
But as soon as I try it on an online server I get the DNS name back, like this:
What can I do? hello dear PHP-Fans - greetings to you - and a happy new year!! i set up a WAMP-System on my openSuse 11.4 system. In order to learn as much as i can bout PHP i want to do some tests and write some scripts. Well the WAMP is allready up and running. Now i try to give the writing access to the folder mkdir /srv/www/ where the php-scripts should go in... i want to give write permission to all to all files in /srv/www As root I generally: mkdir /srv/www/ chown <webmaster usrername> /srv/www/ /srv/www/ should be readable and traversable by all, but only writeable by it's owner (the user designated as the webmaster.) can i do this like mentioned above,... Love to hear from you greetings db1 I am trying to make a gumball machine on my site which gives you a gumball every time you click the button. This is the code I am using to generate a gumball: Code: [Select] <?php $balltype = rand(1,50); if ($balltype = 1) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30978','1','1')"); $gummy = "You won a <b>Blue Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_blue.gif" width="80" height="80" border="0">'; } elseif ($balltype = 2) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30978','1','1')"); $gummy = "You won a <b>Blue Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_blue.gif" width="80" height="80" border="0">'; } elseif ($balltype = 3) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30978','1','1')"); $gummy = "You won a <b>Blue Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_blue.gif" width="80" height="80" border="0">'; } elseif ($balltype = 4) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30978','1','1')"); $gummy = "You won a <b>Blue Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_blue.gif" width="80" height="80" border="0">'; } elseif ($balltype = 5) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30983','1','1')"); $gummy = "You won a <b>Green Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_green.gif" width="80" height="80" border="0">'; } elseif ($balltype = 6) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30983','1','1')"); $gummy = "You won a <b>Green Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_green.gif" width="80" height="80" border="0">'; } elseif ($balltype = 7) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30983','1','1')"); $gummy = "You won a <b>Green Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_green.gif" width="80" height="80" border="0">'; } elseif ($balltype = 8) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30983','1','1')"); $gummy = "You won a <b>Green Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_green.gif" width="80" height="80" border="0">'; } elseif ($balltype = 9) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30985','1','1')"); $gummy = "You won an <b>Orange Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_orange.gif" width="80" height="80" border="0">'; } elseif ($balltype = 10) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30985','1','1')"); $gummy = "You won an <b>Orange Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_orange.gif" width="80" height="80" border="0">'; } elseif ($balltype = 11) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30985','1','1')"); $gummy = "You won an <b>Orange Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_orange.gif" width="80" height="80" border="0">'; } elseif ($balltype = 12) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30985','1','1')"); $gummy = "You won an <b>Orange Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_orange.gif" width="80" height="80" border="0">'; } elseif ($balltype = 13) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30986','1','1')"); $gummy = "You won a <b>Purple Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_purple.gif" width="80" height="80" border="0">'; } elseif ($balltype = 14) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30986','1','1')"); $gummy = "You won a <b>Purple Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_purple.gif" width="80" height="80" border="0">'; } elseif ($balltype = 15) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30986','1','1')"); $gummy = "You won a <b>Purple Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_purple.gif" width="80" height="80" border="0">'; } elseif ($balltype = 16) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30986','1','1')"); $gummy = "You won a <b>Purple Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_purple.gif" width="80" height="80" border="0">'; } elseif ($balltype = 17) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30990','1','1')"); $gummy = "You won a <b>Yellow Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_yellow.gif" width="80" height="80" border="0">'; } elseif ($balltype = 18) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30990','1','1')"); $gummy = "You won a <b>Yellow Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_yellow.gif" width="80" height="80" border="0">'; } elseif ($balltype = 19) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30990','1','1')"); $gummy = "You won a <b>Yellow Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_yellow.gif" width="80" height="80" border="0">'; } elseif ($balltype = 20) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30990','1','1')"); $gummy = "You won a <b>Yellow Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_yellow.gif" width="80" height="80" border="0">'; } elseif ($balltype = 21) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30981','1','1')"); $gummy = "You won a <b>Cola Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_cola.gif" width="80" height="80" border="0">'; } elseif ($balltype = 22) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30981','1','1')"); $gummy = "You won a <b>Cola Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_cola.gif" width="80" height="80" border="0">'; } elseif ($balltype = 23) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30981','1','1')"); $gummy = "You won a <b>Cola Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_cola.gif" width="80" height="80" border="0">'; } elseif ($balltype = 24) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30979','1','1')"); $gummy = "You won a <b>Chocolate Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_bronze.gif" width="80" height="80" border="0">'; } elseif ($balltype = 25) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30979','1','1')"); $gummy = "You won a <b>Chocolate Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_bronze.gif" width="80" height="80" border="0">'; } elseif ($balltype = 26) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30979','1','1')"); $gummy = "You won a <b>Chocolate Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_bronze.gif" width="80" height="80" border="0">'; } elseif ($balltype = 27) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30984','1','1')"); $gummy = "You won an <b>Ice Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_ice.gif" width="80" height="80" border="0">'; } elseif ($balltype = 28) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30984','1','1')"); $gummy = "You won an <b>Ice Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_ice.gif" width="80" height="80" border="0">'; } elseif ($balltype = 29) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30984','1','1')"); $gummy = "You won an <b>Ice Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_ice.gif" width="80" height="80" border="0">'; } elseif ($balltype = 30) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30987','1','1')"); $gummy = "You won a <b>Rock Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_rock.gif" width="80" height="80" border="0">'; } elseif ($balltype = 31) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30987','1','1')"); $gummy = "You won a <b>Rock Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_rock.gif" width="80" height="80" border="0">'; } elseif ($balltype = 32) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30987','1','1')"); $gummy = "You won a <b>Rock Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_rock.gif" width="80" height="80" border="0">'; } elseif ($balltype = 33) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30988','1','1')"); $gummy = "You won a <b>Strawberry Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_strawberry.gif" width="80" height="80" border="0">'; } elseif ($balltype = 34) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30988','1','1')"); $gummy = "You won a <b>Strawberry Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_strawberry.gif" width="80" height="80" border="0">'; } elseif ($balltype = 35) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30988','1','1')"); $gummy = "You won a <b>Strawberry Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_strawberry.gif" width="80" height="80" border="0">'; } elseif ($balltype = 36) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30980','1','1')"); $gummy = "You won a <b>Dark Chocolate Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_chocolate2.gif" width="80" height="80" border="0">'; } elseif ($balltype = 37) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30980','1','1')"); $gummy = "You won a <b>Dark Chocolate Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_chocolate2.gif" width="80" height="80" border="0">'; } elseif ($balltype = 38) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30977','1','1')"); $gummy = "You won a <b>Black Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_black.gif" width="80" height="80" border="0">'; } elseif ($balltype = 39) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30977','1','1')"); $gummy = "You won a <b>Black Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_black.gif" width="80" height="80" border="0">'; } elseif ($balltype = 40) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30982','1','1')"); $gummy = "You won a <b>Digital Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_digital.gif" width="80" height="80" border="0">'; } elseif ($balltype = 41) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30982','1','1')"); $gummy = "You won a <b>Digital Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_digital.gif" width="80" height="80" border="0">'; } elseif ($balltype = 42) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30989','1','1')"); $gummy = "You won a <b>Silver Gumball</b>."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gum_silver.gif" width="80" height="80" border="0">'; } elseif ($balltype = 43) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30991','1','1')"); $gummy = "You won a <b>Burnt Gumball</b>. Ur... Well done..."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gumball_burnt.gif" width="80" height="80" border="0">'; } elseif ($balltype = 44) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30991','1','1')"); $gummy = "You won a <b>Burnt Gumball</b>. Ur... Well done..."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gumball_burnt.gif" width="80" height="80" border="0">'; } elseif ($balltype = 45) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30991','1','1')"); $gummy = "You won a <b>Burnt Gumball</b>. Ur... Well done..."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gumball_burnt.gif" width="80" height="80" border="0">'; } elseif ($balltype = 46) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30991','1','1')"); $gummy = "You won a <b>Burnt Gumball</b>. Ur... Well done..."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gumball_burnt.gif" width="80" height="80" border="0">'; } elseif ($balltype = 47) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30991','1','1')"); $gummy = "You won a <b>Burnt Gumball</b>. Ur... Well done..."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gumball_burnt.gif" width="80" height="80" border="0">'; } elseif ($balltype = 48) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30991','1','1')"); $gummy = "You won a <b>Burnt Gumball</b>. Ur... Well done..."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gumball_burnt.gif" width="80" height="80" border="0">'; } elseif ($balltype = 49) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30991','1','1')"); $gummy = "You won a <b>Burnt Gumball</b>. Ur... Well done..."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gumball_burnt.gif" width="80" height="80" border="0">'; } elseif ($balltype = 50) { mysql_query("INSERT INTO usersitems2 (owner,item_id,parts_left,game) VALUES ('$userid','30991','1','1')"); $gummy = "You won a <b>Burnt Gumball</b>. Ur... Well done..."; $picture = '<img src="http://www.bubblemagic.co.cc/images/gumballs/gumball_burnt.gif" width="80" height="80" border="0">'; } else { $gummy = "Nooooooooo!!!!! The gumball machine is broken!!! It still took your money though..."; } ?> Every time I try it, it gives me a burnt gumball EDIT: All that CODE hurts.... use some CODE formatting for godsakes. Does any one know where I can find a PHP slots machine script? Is there a way to get my visitors PC or Device Name? I am not looking for server name or ip. I need to get my current visitors computer name. Example: MAIN, HOME, OFFICE, TOM32154}}{|\] like when first naming a PC with a new windows install. Could Someone Help Me Make A Gumball Machine My Site Is Toxicpets.co.cc And the page is gumballs.php but i need it to give gumballs Is it possible to read from a file that is located on the user's local machine and not on the server? I have a CSV file that is about 70MB that I have to parse through and insert the data into a database. I have no problem doing this if I hard code the path to the file. Is there a way to get the path of the file that the user wants to be parsed into the database? I don't think uploading the file would be a good idea because, like I said, it is 70MB and is nearly 2 million lines. Simply parsing the file takes long enough without throwing in upload time.. I am working on a task where the user of the webpage can amend to a text file, but when I try it on Windows, I get messages such as Warning: fopen(C: mpp\htdocs cm\denman2.txt) [function.fopen]: failed to open stream: Invalid argument in C:\xampp\htdocs\amendfile.php on line 8 Warning: fputs() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\amendfile.php on line 10 Warning: fclose() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\amendfile.php on line 11 And nothing is appended. I don't know what the problem is, considering the only aspect I really changed was the file path since I was using Ubuntu to try to accomplish this. Here is the coding of my Amend File Script: Code: [Select] <html> <head><title>Amend File</title></head> <?php if($_POST['append'] !=null) { $filename="C:\xampp\htdocs\rcm\denman2.txt"; $file=fopen($filename, "a"); $msg="Updated Information: " .$_POST['append']. "<br>"; fputs ($file, $msg); fclose($file); } ?> <body> <h1>Do you want to append to a document?</h1> Enter Updated Information: <form action="amendfile.php" method="post"> <input type="text" size="40" name="append"><br><br> <input type="submit" value="Add name to report"> </form> <form action="viewfile.php" method="post"> <input type="submit" value="View Web Blog"> </form> <a href="viewfile.php">View Web Blog</a></body></html> Any help is appreciated! Hello, I am wondering if there is any way with PHP to get a list of the processes running on the client that hits the PHP server script. If that is not possible, is there a way I have have my PHP script do an 'exec' call on something that will do it? Thanks Mike hello and good day dear php-freaks which is the passwd for the mysql db run opensuse - therein i have installed a myql serfver and an apache now i want to port over a cms-system from a server to the localhost. question: the passwd of the configuriatin of the cms has got the following db connecgtion host : localhost db-name db-passwd question: does the db passwd need to match the passwd of the local mysql server!? is this true love to hear from you |