premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
To get the 'Insane!' to display instead of 'Fanatic' ???
-
I just got bored and saw rat's post and decided to reply with my 2cents, no offense to you in any way.
-
mmmm, you could just use array_rand no? <?php if($_SERVER['HTTP_REFERER'] != "") { $aff_array = array("http://www.RANDOMWEBSITE1.COM", "http://RANDOMWEBSITE2.COM", "http://RANDOMWEBSITE3.COM"); header("Location: ".array_rand($aff_array)); exit(); } ?> If you want to send a false referrer, you would need to use cURL, however that is not really redirecting the user
-
Picky...or a post whore? lol
-
I prefer to use heredoc so that way you can include variables with {$variablename} instead of having to use <?php echo $variablename; ?> But that is just my preference <?php if ( $_GET['content'] == "pirep" ) { echo <<<OUTPUT <form name="form3" action="pirep_process.php" method="post"> <table cellpadding="8" align="center" cellspacing="0" width="80%" style="font-size: 10pt"> <tr> <td align="left" valign="top"> </td> <td ><input name="username" type="hidden" id="username" value="RPA001"></td> </tr> <tr> <td align="left" valign="top">Booked Flights</td> <td > <select name="Manual" size="1" onchange="window.open(this.options[this.selectedIndex].value,'_top')"> <option>Booked Flights</option> <option value="book.php?id=" id=""></option> </td> </tr> <tr> <td align="left" valign="top">Date of Flight</td> <td><input name="date" type="text" id="date" value="2009-01-29"></td> </tr> <tr> <td align="left" valign="top">Departure Airport</td> <td><input name="icao_orig" type="text" id="icao_orig" value=""></td> </tr> <tr> <td align="left" valign="top">Destination Airport</td> <td><input name="icao_dest" type="text" id="icao_dest" value=""></td> </tr> <tr> <td align="left" valign="top">Type Aircraft</td> <td><select name="aircraft" type="text" id="aircraft"> <option value="ERJ-170">ERJ-170/175</option> </td> </tr> <tr> <td align="left" valign="top">Flight Number</td> <td><input name="routenum" type="text" id="routenum" value=""></td> </tr> <tr> <td align="left" valign="top">Flight Time</td> <td><input name="flthrs2" type="text" id="flthrs2" value=""></td> </tr> <tr> <td><input name="hub" type="hidden" id="hub" value="KPHL"></td> </tr> <tr> <td align="left" valign="top">Comments:</td> <td><input name="comments" type="text" id="comments" value=""></td> </tr> <tr> <td align="left" valign="top">Online:</td> <td><select name="online" type="text" id="online"> <option value="Yes">Yes</option> <option value="No">No</option> </td> </tr> <td align="left" valign="top"> </td> <td><input type="submit" name="Submit" value="File Pirep!"></td> </tr> </table> </form> OUTPUT; } ?>
-
<?php $feed = "http://www.mysite.com/feed.xml"; $doc = new DOMDocument(); $doc->load($feed); $entries = $doc->getElementsByTagName("entry"); $datesUsed = array(); foreach ($entries as $entry) { $status = $entry->getElementsByTagName("eventStatus"); $eventStatus = $status->item(0)->getAttributeNode("value")->value; if ($eventStatus == $confirmed) { $titles = $entry->getElementsByTagName("title"); $title = $titles->item(0)->nodeValue; $times = $entry->getElementsByTagName("when"); if (!is_object($times)) continue; // skip the rest of the loop if times is not an object $startTime = $times->item(0)->getAttributeNode("startTime")->value; $date = date(" F j, Y", strtotime($startTime)); $time = date("g:i A", strtotime($startTime)); if (!in_array($date, $datesUsed)) { $currentnum = count($datesUsed); if ($currentnum > 0) echo "<br />"; echo "<strong>$date</strong><br />"; $datesUsed[$currentnum+1] = $date; $arrayyes = 1; } echo $title . " - $time<br />"; } } ?> is_object test if $times is an object, if it is not skip the rest and continue the loop.
-
You can send it via GET, but you would have to append each link with that value. As far as that, no I do not think it is possible.
-
Yea, I know. But for the purpose of easy understanding it is better to leave the 24 off imo People do better with round numbers for some weird reason lol.
-
My upload isn't shared. I use all this on one PC, no router, It's directly connected to the modem. And even if apache doesn't limit it by default, is there still a way to find out how to limit it or weather it is limiting it with a configuration? So you are running this test via a local machine right? Your cable company sets limits on how much you can upload and download. If you are throttled at 60KBps upload, you will not be able to configure apache to be faster. Simple dynamics of the internet. Your download may be 700KB/sec, but the upload is not near that. Also remember that the more users who use that site the slower the connection is going to be. So if say 4 users are downloading from you, I doubt that they would get more than 15-20KB/sec download. In that speed test, 486kbps is kilobits per second, not KiloBytes, that is roughly 48.6KiloBytes per second, not that fast at all. Most production webservers use T3 or greater lines (it is probably better than T3 now, but I am not sure of the technical term, so T3 will work), which have the capability to handle that and push data out at 100mbps+ from their server to multiple users. You may be at 10mbps on download but are only at .4mbps on your upload. Learn the basics of the internet, a normal household connection can not actively run a site that has alot of users due to this. That is why there are servers out there and they cost a lot of money per month. Just to put this in perspective here is how stuff is layed out: ***NOTE the lowercase kb and the upper case KB same with mb and MB, there is a difference) 1kbps = 1 kilobit 1KBps = 1 KiloByte (1,000 kb) 1mbps = 1 megabit (100,000 kb or 100KB) 1MBps = 1 MegaByte (1,000 KB) etc. So looking at that speed report, you have a nice download (1MBps), which works if users are uploading to you. They should not have a problem with that. But them retrieving files from your server (46KBps) is very slow and that maxes their speed, and each user that connects to download from you take that and divide it in half. Hope that helps you understand, but as I said, this is internet basics. You should read up on it. EDIT: And a simple search of the terms "apache limit bandwidth" in google pulled up this result: http://www.whoopis.com/howtos/web-bandwidth-limit.html EDIT: I am not claiming that the text above is 100% correct, but it is more just to give you an idea of what is going on, as stated above for the correct lingo etc do the research.
-
More than likely you just imagined it. Session data is stored in a file on your server. 8mb's is plenty per user and should not kill your diskspace, but let's be real. There is a slim chance you will ever break 100KB per user, unless your site is setup weird. Maybe a cookie is 4kb, but that is stored on the user's machine. Session data is stored on your server.
-
[SOLVED] Help with counter/resetter snippet...
premiso replied to TheLoveableMonty's topic in PHP Coding Help
<?php ## Opens file containing current value $curloc = "curbil.dat"; $curbil = file_get_contents($curloc); list($curbil, $total) = explode(":", $curbil); $fp = fopen($curloc, "w"); if ($curbil == $totbil){ $curbil = "1:$totbil"; } else { $curbil = ($curbil+1) . ":$totbil"; } fwrite($fp, $curbil); flcose($fp); ?> Modified your code, why store it in 2 files vs just 1 file with a splitting parameter (ie the colon). You may have to modify the current file to do that before you invoke this script. Also removed alot of duplicated code and compacted the code. See if that works out for you. -
anyone see what is wrong with this simple image upload script
premiso replied to Reaper0167's topic in PHP Coding Help
Is location even defined? Given that code, I do not see where it is defined, that and you removed my $location part. Please add that back in re-report the error. The reason I had that in there is so you could see what file was trying to be opened and that will help you out 10 times more than not echoing it out. $fh = fopen($location, "r") or die("Unable to open file at location: $location"); Display that error here or even better look at it and figure out why the file is not at that location. -
You could put the error in session... Then you get to keep it!
-
Why not just foreach the files. If $_FILES is a multi-dimensional array this would be better. <?php foreach ($_FILES as $key => $val) { if (is_array($val)) { echo "File at $key is named " . $_FILES[$key]['name'] . "<br />"; } } ?> I am not keen on file uploads, but see what that gives you. If it works, then just modify items inside the if statement to do what you want. If not maybe look for a multiple file upload php tutorial and see how it is really done.
-
You can check, but the easiest way is after they post the data and it is done with what you want to do a header redirect to a "thankyou" page. This will wipe out the post data and prevent it from being duplicated on refresh. Even if you redirect to the same page, it does not really matter. The redirect is key.
-
anyone see what is wrong with this simple image upload script
premiso replied to Reaper0167's topic in PHP Coding Help
Explain to me how this is reading it before opening it: $location = addslashes(fread(fopen($location, "r"), $PSize)); Order of operations, items inside the parenthesis get executed first. My code may do the same thing, but it provides an error message incase that file is not there to open. That and it makes less confusion to people so that you know the file is being opened before being read. -
anyone see what is wrong with this simple image upload script
premiso replied to Reaper0167's topic in PHP Coding Help
He was opening it. If you look at the OP it is just in the same line as fread. -
anyone see what is wrong with this simple image upload script
premiso replied to Reaper0167's topic in PHP Coding Help
Why try and combine that into one line? <?php include "msdata.php"; $PSize = filesize($location); $fh = fopen($location, "r") or die("Unable to open file at location $location"); $location = addslashes(fread($fh, $PSize)); mysql_connect($host,$username,$password) or die("Unable to connect to MySQL."); mysql_select_db($db_name) or die("No database found."); mysql_query("INSERT INTO $tbl_name(pic)VALUES('$location')") or die("Operation unable to perform."); ?> See what that gives ya. -
strip_tags is the way to go. I believe you can even tell it which ones to or not to strip. Edit: 10 seconds slow =\
-
You are to fast mate... you will find the code if you follow the link I have phpMailer but want to use my own code...learn by trail and error Use phps extension for that page to display properly with syntax highlights, right now it is just garbled text.
-
Post some code and maybe we will be able to help. I would suggest googling phpMailer and using that script for complex emails like you want.
-
Shopping cart program for multiple-item pick?
premiso replied to richardhsu001's topic in PHP Coding Help
Very possible, here is an example: <input type="text" size="4" name="item[A]" /> <input type="text" size="4" name="item[b]" /> <input type="text" size="4" name="item[C]" /> Of course I am just showing the simple version, you need to incorperate that to have it dynamic. To access it you would do: <?php if (isset($_POST)) { $item = isset($_POST['item'])?$_POST['item']:array(); foreach ($item as $itemName => $qty) { if ($qty > 0) { // your coding here... } } } ?> -
Although you may be right, if javascript is turned off, anyone can submit anything to that page without having it validated.
-
You have an error in that sql. $ToolDataQuery = "SELECT i.wafer_max,date_format(inventory.in_production,'%m-%y') AS i.in_production ,i.footprint, l.loc_name FROM inventory i LEFT JOIN locations l USING (loc_ref) WHERE i.inventory_id = $ref"; //print $ToolDataQuery; $ToolDataQueryResult = mysql_query($ToolDataQuery) or die("MySQL Error for Query: $ToolDataQuery <br /> MySQL Returned: " . mysql_error(); $ToolDataQueryResultRow = mysql_fetch_array($ToolDataQueryResult); My bet is that in_production is not a datetime field in mysql.
-
Not sure which is your date column, but this would work if in_production is your column: $ToolDataQuery = "SELECT DATE_FORMAT(i.in_production, '%Y-'%c) as in_production, l.loc_name FROM inventory i LEFT JOIN locations l USING (loc_ref) WHERE i.inventory_id = $ref";