-
Posts
4,704 -
Joined
-
Last visited
-
Days Won
179
Everything posted by kicken
-
The front page allows you to select multiple files, and even lists them out, but it only successfully uploads the first file, the rest seem to be ignored. Tested in Firefox and Chrome.
-
Help Joining These Queries (A Cron Job That Is Destroying My Site)
kicken replied to acidpunk's topic in PHP Coding Help
It's not really clear what exactly you're doing with the code provided (as in, what results you really need, but I gather you are looking to get the sum of all the fields for each user, for each slot. It's possible to write a single select query that would return a result set such as: +-----------+-------------+------------------+ | userId | slot | sumOfEverything | +-----------+-------------+------------------+ | 1 | Weapon | 12 | | 1 | Body | 11 | | 2 | Head | 9 | | 5 | Belt | 20 | .... +-----------+-------------+------------------+ Then you can use a few loops in your PHP code to process the data in whatever way necessary. Things you may need to read up on as far as how to write such a query would be JOIN's, and GROUP BY If you can't figure it out still post the CREATE TABLE structures of your tables and describe what exactly you're trying to accomplish in this cron script. -
Check into the DateTime and DateTimeZone objects. That will let you adjust the server's time into a user's timezone.
-
Via the Mono Project
-
You could handle receiving the uploaded audio data and distribution of it to the other users using PHP. In order to actually capture the audio from the user and then upload it you will need something else though. Flash or Java should be able to handle that part. So the overall process would be something like 1-Record the audio using a Flash/Java program 2-Have flash/java POST the captured audio to a PHP script 3-Have your PHP script accept the audio data and save it somewhere, either a file or database 4-Your other users would have to be constantly polling the server to find out if audio has been uploaded. When it has, download it for them to listen to. This can be handled via AJAX and a PHP script.
-
There is no such variable as $int. You want a different variable name. Think about it.
-
I think it'd be nice if to remove an element you could just drag it out of the bar. The little red x is not very noticeable, I didn't see it at first. Also since you drag them in to add them, it would make sense (to me) that you drag them out to remove them.
-
Myisam Table: Composite Key As Substitute For Foreign Key?
kicken replied to nodirtyrockstar's topic in MySQL Help
So long as you insert all the right ID's into the right columns, then you won't have an issue with your tables joining up. You'll still be able to get your totals and what not for the cart. You can still implement the concept of a foreign key using MyISAM, the database engine just won't enforce it (ie, rejecting an insert if the foreign key value is bad). If those enforcement capabilities are important to you then you should use a database engine that actually supports it. If that's not an option then you'll have to manage it yourself in your code. There are two ways you can do that: 1) Always check your constraints with PHP before you do any inserts, and make sure you cleanup all the tables on a delete or 2) Write stored procedures which manage all the details and call the procedures from your PHP -
It sounds to me you want variable variables, which is also a 'You're doing it wrong!' situation. If I'm understanding right you have for example: $cid01 = 'some content'; $cid02 = 'some other content'; And then then $_SESSION['cid'] contains a value like 'cid01'; which you want to use to find that variable, eg: $cid = $_SESSION['cid']; //(ex 'cid01') echo $cid; //(you want to echo 'some content'; The syntax for that would be: $cid = $_SESSION['cid']; //(ex 'cid01') echo $$cid; //double-dollar sign However as mentioned, this is the wrong way to do it. Rather than numbered cid varibles, use an array to store you're content, then just index into that array: $cidcontent = array( 'some content', 'some other content' ); $cid = $_SESSION['cid']; //stores the number 1 for example echo $cidcontent[$cid]; //outputs 'some other content';
-
The one labeled 'Configuration' is the one that is currently being used by PHP (it is named php.ini, turn off the hide extensions setting). The INI-DEVELOPMENT (php.ini-development) and INI-PRODUCTION (php.ini-production) are template files showing recommended settings for those environments. Neither is actually being used by PHP. They are there as a starting point, you would take on of those, copy it to the php.ini file, and then tweak the settings to your tastes.
-
memory_get_peak_usage would show you the maximum amount of memory your script consumed at any particular point (prior to the call of the function). It's numbers may change or they may not, depends on whether the process of rendering the view causes PHP to use more memory or not. The process of actually rendering your view would likely use more memory than you'd save by removing that one variable. It all depends on how things are setup. My main point was that you can't gather the memory usage data in two different places and expect the numbers to be the same.
-
When you call your footer function and assign the result to a variable I assume you are doing this in your controller somewhere, or at least somewhere other than the template file. What that means is your measuring the memory usage at different points so you can't really compare the numbers to each other. Calling the functions in different areas like that is like measuring how bright it is outside at noon vs 5pm. Obviously the numbers will be different because the time frame is different and different amount of stuff has happened.
-
I kinda looked into this since I was curious. The default settings for that theme have both the default foreground and bold blue set to the same gray color, which may have been part of the initial "everything is gray?" confusion. The default directory colors for ls have directories set to bold blue so in a default putty theme you'd see them as a darker blue while the files are white (unless otherwise colored), but with the new theme they are both gray. The solution is to either change the color codes in the putty settings for bold blue to be a different color, or change your LS_COLORS variable (via the dircolors command/file) to something else. Any other application would have a similar solution, either change putty or find a way to change which colors the app uses. so tl;dr version: The color scheme applied fine, but 'bold blue' is coded to be the same as the default foreground color.
-
The links appear to have gotten mangled, probably during the forum conversion? Not sure. I believe these are probably the posts in question: mssql vs. sqlsrv: What’s the Difference? (Part 1) MSSQL vs. SQLSRV: What’s the Difference? (Part 2)
-
Best/cheap Software To Run A Small/med 1St Timer Server?
kicken replied to JohnnyDoomo's topic in Other Web Server Software
The layers basically break down like so: - Operating system, obviously. There are various flavors of Linux you could use, each with it's own strengths and weaknesses. Pick which ever flavor you are most familiar with and know the most about. You'll probably be needing to hit the command line to change configs, install packages, do updates, etc with some frequency, especially during the initial setup. - Webserver Software: Apache, Nginx, lighthttpd, etc. There are several options for this. Apache is by far the most common, nginx is getting to be fairly popular these days as well. - Scripting languages: PHP, Ruby, Perl, etc. You'll need to decide which scripting languages you want to offer and get those setup to work with your chosen webserver. - Database Engine: MySQL, PostgreSQL, Mongo, etc. You'll have to decide which database engines you want to offer and set those up. DB Engines tend to need a good chunk of ram to work well so you'll probably only want to choose one, maybe two if you have pretty good hardware with lots of ram. If you have multiple machines, you could setup one as strictly the DB server and the other as the webserver. - [optional] DNS Server. If you're going to be hosting sites you may want to host DNS as well. - [optional] Email (SMTP/POP/IMAP) Servers. You'll probably be wanting to host email for your sites as well. There are various email solutions out there. Postfix and qmail are popular smtp servers. dovecot is a popular POP/IMAP server. So that's the basic setup you need to get. The most common setup is LAMP which basically Linux (Ubuntu/CentOS are popular), Apache, Mysql and PHP. Some Linux distros have packages or an option during setup to install a "LAMP" system and it will get everything setup initially for you. As far as cPanel/WHM go, they are just management packages which make the process of install, configuring, and managing all the above mentioned software and your clients easier. They are not really necessary but are definitely good idea, especially if you want to be selling webhosting to customers. Many customers will probably be used to using cPanel or WHM if they have ever hosted anywhere else before so there is a benefit to using them from that perspective. There are some open source control panel's out there but I am not familiar with any of them so I can't make any recommendations beyond try some and see what you like. Which control panel you pick may limit your options above regarding software. For example if the panel does not support nginx you won't be able to host using that webserver. I don't do any professional hosting with clients, just my own sites and a couple friends so I don't bother with any control panel software and just manage all my configuration manually. It's more work but will definitely get you familiar with how everything ties into each other to make a functioning server. If you want to learn how everything works I'd suggest at least once trying to setup a complete server from scratch without any of the management control panels. Then go ahead and set it up with a panel before you start offering your services for sale. -
return means that PHP will exit that function, so your first video to return a 200 status is going to cause the script to jump out of that function and back to wherever you called that function from. Near as I can tell from the code given, you probably just want to remove that line so the loop can continue.
-
You can't bind identifiers (column names, table names, etc). You can only bind values. If you need to use dynamic column/table names you have to use string concatenation to build the query.
-
You're missing the () after reqUid in your bindParam call.
-
Are you using Apache or are you using Nginx as your server? The solution will depend on which one you're using. Your post references both so it is unclear.
-
The problem is you're not cancelling the form submission so the page reloads. What happens is your JS function runs and populates the error div's with the messages. A split second later the form submits and the browser starts reloading the page. When the page reloads everything is reset so the messages disappear. You need to return false in the onsubmit handler to cancel the form submit. You already added the 'return ' key word there so it will return whatever value your doValidate function returns. You never setup a return value for that function though. You need to use a variable to track if there are errors and return true or false depending on that. function doValidate() { var hasErrors=false; if(document.registerform.textbox1.value= " ") { document.getElementById("hiddenDiv").innerHTML = "enter your email id its required"; hasErrors=true; } if(document.registerform.textbox2.value= " ") { document.getElementById("hiddenDiv2").innerHTML = "enter your password id its required"; hasErrors=true; } return !hasErrors; }
-
What SQL Engine are you using? The exact syntax will depend on the engine and possibly version. You might be able to just use a single UPDATE query and not need to select anything first.
-
Add your var_dump($mac) just after your shell_exec function and see what output you are getting. Did you setup an entry in sudo so that you can run the command without having to enter a password? Have you checked that $ip is a valid LAN address and not a WAN address or 127.0.0.1?
-
Exceptions are generally for what you might consider an "unusual circumstance" (ie, exception to the general rule/expectations) or for validation issues that are likely caused by bad programming (ie, not normal form validation typically). Some samples of when to use an exception: - If you run a DB query, and the connection to the DB server has been severed, you might throw an exception. The general expectation is that a connection is established - If you try to pass NULL to a function that expects an Object, you might throw an exception. The programmer should be testing for this case. Some samples of when NOT to use an exception (IMO): - When validating posted form data. - When testing for a specific condition (ie a file_exists or isSomething like function). When you start to use exceptions you can get a better feel for when they are and aren't appropriate. Also using a language that handles most all of it's errors via exceptions and seeing what it does can help as well. C# or Java would be good for this. Regarding not using them for form validation, the reason I say that is because generally speaking you'd want to provide the end user with some details as to what exactly is wrong. If you validate each field by throwing exceptions this means you will likely either only have one message to show, or you need several try/catch blocks which results in some messy code. Simple true/false returning functions make this nicer, plus they also generally fall under then 'checking a specific condition' area. This of course is all opinion. There is not any definitive "Here's when you do, Here's when you don't" guide to exceptions. You'll have to get a feel for them yourself and decide when you think an exception is appropriate vs just a true/false return value.
-
Merging Multiple Images Into 1 Using Php
kicken replied to davefootball123's topic in PHP Coding Help
GD Library ImageCopy or ImageCopyMerge, depending on your needs. That should get you started. -
If you just want the age by year then all you gotta do is subtract the birth year from the current year, eg: list($dd, $mm, $yy) = explode('.', $birthday); $age = date('Y') - ($yy + $yy>=50?1900:2000); The $yy + $yy>=50?1900:2000 converts the two-digit year to a four-digit year by adding either 1900 or 2000 depending on a particular year break point. I chose 50 which means something like 19.7.45 would be 2045 while something like 19.7.65 would be 1965. You could adjust the break point to whatever you want. If you want the more exact age down to the day, then you'd run through a process like so: $age = $ynow - $year; Are the years equal? yes => Is the current month less than the birth month? yes => $age = $age - 1; no => Is the current month equal to the birth month? yes => Is the day less than the birth day? yes => $age = $age - 1; There are lots of implementations of an age function on the internet if you want to just google for one. No, it uses IP.Board now.