SharkBait
Members-
Posts
845 -
Joined
-
Last visited
Never
Everything posted by SharkBait
-
[SOLVED] HELP - php error when setting session cookie
SharkBait replied to aminnuto's topic in PHP Coding Help
I always use this little bit of code when playing with sessions: <?php session_start(); header("Cache-control: private"); // IE6 Fix for Sessions ob_start(); ?> Also when checking a Session I like to use the IsSet() function: <?php if(isset($_SESSION['box'])) { // Session is set } else { // Session is not set } ?> -
There is also the IP2Country database. usually in the form of a text file that you can parse through and figure out where someone is based on a algorithim of their IP. Just google for IP2Country and there should be examples of that too, else I can find the script I use.
-
I like the 3rd one as well. I know this might be really picky but can you clone the shadow off her arm? the one that's holding the mic? If you have other poses of her I'm sure it would work better too. Like her looking 'out toward the crowd' kinda thing.
-
if you have root access you can also run 'locate php.ini' if locate is set up. But yes depending on your server it could be in multple places. I've seen it in /etc/php.ini /etc/php5/php.ini /etc/httpd/php/php.ini and others
-
I've done a couple online shopping forms and the current one I am working with is with Moneris. They have you create the form and pass the creditcard information via a PHP class using cURL to their servers that gets processed etc. You would probably have to do the customer's contact information validation, but Moneris and other companies will probably do the validation of the card. There are also classes out there that check to see if the creditcard number is valid via a partiular log algorithim.
-
Hi, Looking for advice when it comes to connections with MySQL. Currently I go the easy way and use mysql_connect() but I noticed that one of my windows apps has an issue with closing connections and I kept getting error about there were no connections available. Now I can look through the code and fix that, but is it better to use persistant connections? I have more web based apps that use MySQL and is it more efficient to to use mysql_pconnect() and leave the connection open? Currently all my scripts call mysql_connect() at the top and mysql_close() at the bottom. I have 3 databases that multiple sites and 3 winapps use to read/write data too. I could change the my.cnf file to allow more connections but that's more of a bandaid fix isnt it? My web queries are all under 0.5 secs when executed. The server is a dual xeon setup running on a gigabit backbone (all web apps and win aps are run within our network). So yea, just looking on advice. Yes I'll be fixing that winApp that doesn't seem to properly close its MySQL Connections Thanks
-
The only way i can see someone using the same session if they are using the same computer with the same browser with the same window open. You'd just have to ask them for playername1 and playername2 I guesss and make sure that the session matches both of those names? I don't see the session being the same if they were on different computers or even the same computer but difference browser window...
-
I have my pages in a sorta 3 sections. 1 page is my header.html (keywords, meta data, etc) then my body or content pages (index.php or whatever other file) and then my footer.html that cleans up all the div tags and closes various connections etc. and then in my index.php I just require the header.html and the footer.html. Hope this is what you mean.
-
Ah then that's what I want sorry. I just wanted to know how I can figure out what the upcoming friday is.
-
Hi, Not sure how to go about this but I need to figure out how to get a countdown from a day and then make it reoccur. Well the countdown part is simple enough from a particular date from now. This is my little function: <?php function CountDown($date) { // Timestamp the inputed date $countdown_date = strtotime($date); //echo $date ."<br />"; // Get today's date $today = time(); $difference = $countdown_date - $today; if($difference <0) $difference = 0; $days_left = floor($difference/60/60/24); //echo "Countdown date ".date("F j, Y, g:i a",$countdown_date)."<br/>"; if($days_left == 0) { return "Already Started"; } else { return "Starts in {$days_left} days."; } } ?> But I want to make a countdown that will start from Friday of the current week at 330pm from the time now. What is the best way to go about this? I assume there is a way to find out what ever friday from now on is and then just check to see if it is the current week or not? I think I am making it sound more complicated than it is.
-
I was thinking pipes as well. Thanks!
-
Hey that's a pretty neat tool! Windows has their Live editor 9forget its real name) that does something similar, you can create entries for Blogger, WP etc. I'll have to try that tool out though on my dev box and see how it works with WP (though I normally don't use WP, since my blog (which is currently missing) is custom built).
-
What is the best delimiter to use to seperate fields that have been concatenated from user input? I've used ; (semi-colons) but the odd person has used it in their input and it buggers things up. I guess the other best thing to do would be str_replace() any ; that the user enters huh? (just thinking about that now). So any other suggestions?
-
You can do a mutiple file upload just do multiple file inputs and in the name field of the inputs ad [] to the end of it So in my form I have something like this: [code] <?php for($i=1;$i<=5;$i++) { echo "<tr> <td><input type=\"file\" name=\"upload{$i}\" size=\"30\" /></td> </tr>\n"; } ?> ?> And then after submitting I loop through each $_FILES[] and do my validation moving etc.[/code]
-
Woo I'm living in Canada! I use IP2Country for one of my sites too. Seems mostly accurate, well haven't had anyone complain yet about it anyway
-
Interesting caching issue - PHP to the rescue!
SharkBait replied to obsidian's topic in PHP Coding Help
Oh I think I might be able to use something like this. Some of my aJax pages don't update properly because IE reads from the cache all the time. I only have temporarily fixed it because I have manually set IE to always get a new version and never to read from the cache. I'll try the header thing, I know there was a way to do it but I guess I haven't really looked into it too much. Thanks! -
How much does your site make off google ads?
SharkBait replied to twilightnights's topic in Miscellaneous
Was it TechCrunch that made $60,000 in Google Ads Sense ads? Think that is what I read in a magazine. http://www.johnchow.com/making-money-from-a-blog-december-recap/ <-- made ~$600 in his adsense Whereas I only made $5.00 in 6 months but my impressions were not high at all and my site is down until I work out some personal home issues. -
I'm trying to convert my window apps into pretty little webapps using PHP and the only part that I will have trouble is the creation of PDFs. The documents I would create can span multiple pages but they also include tabular data. If I could create the output information in the form of HTML could I do the same thing with PHP? I know I could just 'Print to PDF' kinda deal but I am looking for an automated way to do this. The PDF will be created after they run the required steps and the file would be place in a particular location on the server so that it could be sync'd to another server. The documents would pull from a MySQL database (customer information etc) and then the output would be pretty much be line items placed in various points down the length of the document. There are othe conditions as well but once I figure out how to get the basic information layed out on the PDF I can look into those later. So what I am looking for is the ability to create PDFs on the fly from dynamically created PHP/MySQL output in a nice formatted way so that I can send it to Customs (yes Customs not Customers) ;) Since I would show a table type structure of information, with PHP would I just have to go line by line and output the text, draw the lines and keep going down the page? Keeping track of the page length incase I need to go over I would then start on a new page? Or is the PHP's library for PDF smart enough to carry on the output to the subsiquent pages if they are needed? :)
-
I don't think he has control over the ads on the very top. If it's a free hosted account that code is inserted automatically.
-
I wont critique it until there is a test account. If I like the game, then I'll sign up for it ;) But to have me register to look at it is silly.
-
The only time I have PHP 'hang' is because there is some crazy infinite loop running trying to output html. If the file becomes too big to output, i'm usually presented to download the file though.
-
When I do MySQL queries I always have them in the form: [code] <?php $query = mysql_query($strqry) or die("MySQL Error: <br />{$strqry}<br /> ". msyql_error()); ?> [/code] That way if I have a mysql error, the query will die, it will spit out my actually query so I can see what it looks like and then the [code=php:0]mysql_error()[/code] tells me what is wrong with it.
-
Change this: [code] if(isset($_POST['submitted'])){ [/code] to this: [code] if(isset($_POST['submit'])){ [/code] You're not checking to see if the submit button was set :)
-
Technically that doesn't pop up but does open a new browser window ;) Javascript could be used to create a 'popup' window :)
-
Your navigation blocks. I would try and melt the light gray into the dark gray so there isnt a definition between the two colours. I would change the blocks themselfs and make the look like blocks (border top/bottom etc) I would get rid of the hyphen on the links I would change the color of the link's hovers, the red makes it a bit hard to see.