sKunKbad
Members-
Posts
1,832 -
Joined
-
Last visited
-
Days Won
3
Everything posted by sKunKbad
-
you have no default case, but you might need to add "break;" at the end.
-
which line number is 160? You have no default case.
-
Play with the code below on your server, making two pages, a form page and a script to process the form. Name the script that processes the form "formprocesser.php". Simple Form on Page #1: <form action='formprocesser.php' method='get'> <input type='text' name='somewords' size='24'/> <input type='submit' value='submit'/> </form> Form Processing Script on formprocesser.php: <?php $gotWords = $_GET['somewords']; echo "The words from the form (page #1) that went through the URL are \"$gotWords\""; ?>
-
if you use a session, you could have a session variable that takes on the value of the page it was on, and the next time it goes to a page it would have the variable set: The refering page would set this: $_SESSION['lastPage'] = 'http://www.whatever.com'; Then your script would simply check that session variable, and you could use it something like this: if ($_SESSION['lastPage'] == 'http://www.whatever.com'){ //do something }
-
I have a program that works in all browsers except opera. It's truly bizarre isn't it. HTTP_REFERER will give info about where a person came from. So if they came from your page (http://www.site.com, then that is fine, but if for some reason they follow a link from an outside source, like a search engine, this code would break your site. You should think about that. Unfortunately $HTTP_REFERER is not foolproof. Some browsers do not send this information, or can be made to send false information. You should keep this in mind when working with $HTTP_REFERER.
-
[SOLVED] Alright, str_replace is being a b****!
sKunKbad replied to Mathy's topic in PHP Coding Help
so... who has the most posts ever? Barand with 10K+ is the most I've seen! -
[SOLVED] Alright, str_replace is being a b****!
sKunKbad replied to Mathy's topic in PHP Coding Help
$data = str_replace(" ","-",$dat['title']); echo $data; -
[SOLVED] Alright, str_replace is being a b****!
sKunKbad replied to Mathy's topic in PHP Coding Help
I'd think a dood with 7K+ posts is probably right. -
you could get rid of a third of the download time by getting rid of the flash, and yes downloading javascript from an outside source could definately slow you down. Images account for 142kb of the page, which is too much. You need to either optimize the images, or reduce the number of images on the page (or if the style sheet for this page calls for images that aren't used, make a seperate style sheet for the home page so that the other images don't get downloaded). Try dividing the page content , and putting some of it on other pages. Remember, if somebody who has dial-up internet access comes to your site, they will almost assuredly hit the back button within 10 seconds if the page hasn't loaded, and yours would be more like 5 minutes. Don't think they aren't still out there. Many of the wealthier folks in CA where I live own houses out in the "country", and don't have DSL, cable, or fiber network service. Your site is about vacations, and these are the people who are taking them.
-
I viewed the total amount of javascript that is being run on that page, and it alone is HUGE. You need to trim it down. I'm on a fiber connection (5down/2up), so if it's slow for me, and it is, it just means you have too much stuff loading. Documents (4 files) 115 kb http://www.greathawaiivacations.com/ 88 kb http://www.greathawaiivacations.com/common/js/calendar/demos/DateRange/ipopeng.htm 23 kb http://free.timeanddate.com/clock/ihdhs77/n103/fn17/fs11/fc8d8d71/ftb/ts1 3 kb http://www.greathawaiivacations.com/mp3player.php 524 bytes Images (64 files) 142 kb http://www.greathawaiivacations.com/images/logo.jpg 24 kb http://www.greathawaiivacations.com/images/why_choose.gif 19 kb http://www.greathawaiivacations.com/images/backpic.jpg 7 kb http://www.greathawaiivacations.com/images/instant-quote-bar.gif 6 kb http://www.greathawaiivacations.com/images/temp_pic.jpg 6 kb http://www.greathawaiivacations.com/hawaii/thumb/14918_6__molokai_thumb.jpg 4 kb http://www.greathawaiivacations.com/images/gulabo.gif 4 kb http://www.greathawaiivacations.com/images/avcd_search_glass.gif 4 kb http://www.greathawaiivacations.com/images/show_result.gif 4 kb http://www.greathawaiivacations.com/hawaii/thumb/14917_3__hawaii_thumb.jpg 3 kb http://www.greathawaiivacations.com/images/ghv_searchbar_07.gif 3 kb http://www.greathawaiivacations.com/hawaii/thumb/14932_2__14921_2__oahu_thumb.jpg 3 kb http://www.greathawaiivacations.com/hawaii/thumb/14920_4__kauai_thumb.jpg 3 kb http://www.greathawaiivacations.com/hawaii/thumb/14919_5__lanai_thumb.jpg 3 kb http://www.greathawaiivacations.com/images/Molokai-Vacations.gif 2 kb http://www.greathawaiivacations.com/images/Big-Island-Vacations.gif 2 kb http://www.greathawaiivacations.com/images/Kauai-Vacations.gif 2 kb http://www.greathawaiivacations.com/images/Lanai-Vacations.gif 2 kb http://www.greathawaiivacations.com/images/Oahu-Vacations.gif 2 kb http://www.greathawaiivacations.com/images/freenewsletter.jpg 2 kb http://www.greathawaiivacations.com/images/Maui-Vacations.gif 2 kb http://www.greathawaiivacations.com/images/Cruises.gif 2 kb http://www.greathawaiivacations.com/images/Home.gif 2 kb http://www.greathawaiivacations.com/images/Air-Packages.gif 2 kb http://www.greathawaiivacations.com/hawaii/thumb/14403_1__maui.jpg 2 kb http://www.greathawaiivacations.com/images/explore.jpg 2 kb http://www.greathawaiivacations.com/images/ghv_searchbar_02.gif 2 kb http://www.greathawaiivacations.com/images/ghv_searchbar_08.gif 2 kb http://www.greathawaiivacations.com/images/ghv_searchbar_12.gif 2 kb http://www.greathawaiivacations.com/images/ghv_searchbar_09.gif 1 kb http://www.greathawaiivacations.com/images/ad_barold.gif 1 kb http://www.greathawaiivacations.com/images/ghv_searchbar_06.gif 1 kb http://www.greathawaiivacations.com/images/mycls.jpg 1 kb http://www.greathawaiivacations.com/images/tempsign.jpg 736 bytes http://www.greathawaiivacations.com/images/button.gif 715 bytes http://www.greathawaiivacations.com/images/squares.gif 695 bytes http://www.greathawaiivacations.com/images/ghv_searchbar_03.gif 635 bytes http://www.greathawaiivacations.com/images/ghv_searchbar_13.gif 599 bytes http://www.greathawaiivacations.com/images/ghv_searchbar_01.gif 598 bytes http://www.greathawaiivacations.com/images/ghv_searchbar_11.gif 572 bytes http://www.greathawaiivacations.com/images/diag.jpg 566 bytes http://www.greathawaiivacations.com/images/time_border.gif 497 bytes http://www.greathawaiivacations.com/images/grey001.jpg 389 bytes http://www.greathawaiivacations.com/images/boxbgtop-1.jpg 357 bytes http://www.greathawaiivacations.com/images/boxbgtop.jpg 349 bytes http://www.greathawaiivacations.com/images/bar_bg1.jpg 311 bytes http://www.greathawaiivacations.com/images/wb_img.jpg 305 bytes http://www.greathawaiivacations.com/images/wt_img.jpg 305 bytes http://www.greathawaiivacations.com/images/grey002.jpg 304 bytes http://www.greathawaiivacations.com/images/thum_box_06.gif 273 bytes http://www.greathawaiivacations.com/images/thum_box_02.gif 267 bytes http://www.greathawaiivacations.com/images/thum_box_08.gif 267 bytes http://www.greathawaiivacations.com/images/thum_box_04.gif 265 bytes http://www.greathawaiivacations.com/images/thum_box_09.gif 205 bytes http://www.greathawaiivacations.com/images/thum_box_03.gif 204 bytes http://www.greathawaiivacations.com/images/thum_box_01.gif 198 bytes http://www.greathawaiivacations.com/images/thum_box_07.gif 198 bytes http://www.greathawaiivacations.com/images/ghv_searchbar_14.gif 181 bytes http://www.greathawaiivacations.com/common/js/calendar/demos/DateRange/arrowl.gif 128 bytes http://www.greathawaiivacations.com/common/js/calendar/demos/DateRange/arrowr.gif 128 bytes http://www.greathawaiivacations.com/images/lowernav_01.gif 110 bytes http://www.greathawaiivacations.com/images/lowernav_03.gif 109 bytes http://www.greathawaiivacations.com/common/js/calendar/demos/DateRange/calDropArrow1.gif 73 bytes http://www.greathawaiivacations.com/images/spacer.gif 45 bytes Objects (3 files) 240 kb http://www.greathawaiivacations.com/media/header.swf 231 kb http://www.greathawaiivacations.com/media/testimonials.swf 10 kb music/playerSingle.swf Scripts (10 files) 86 kb (100 kb uncompressed) http://www.greathawaiivacations.com/common/js/mm_menu.js 29 kb http://www.greathawaiivacations.com/common/js/calendar/demos/DateRange/plugins.js?0 16 kb http://www.greathawaiivacations.com/common/js/calendar/demos/DateRange/contrast.js?0 9 kb http://www.greathawaiivacations.com/music/swfobject.js 7 kb http://www.greathawaiivacations.com/js/validation.js 6 kb http://www.google-analytics.com/urchin.js 6 kb (20 kb uncompressed) http://www.greathawaiivacations.com/common/js/ajax_letter.js 4 kb http://www.greathawaiivacations.com/common/js/calendar/demos/DateRange/agenda.js?1182827466421 4 kb http://www.greathawaiivacations.com/common/js/pop_up.js 2 kb http://www.greathawaiivacations.com/common/js/homeflash.js 2 kb Style Sheets (2 files) 19 kb http://www.greathawaiivacations.com/style/hawaii.css 16 kb http://www.greathawaiivacations.com/common/js/calendar/demos/DateRange/contrast.css?0 3 kb Total 602 kb (616 kb uncompressed) You should really try to limit the total size to 100kb or less.
-
[SOLVED] Alright, str_replace is being a b****!
sKunKbad replied to Mathy's topic in PHP Coding Help
Try putting double quotes around your variables in the str_replace? -
This will work: <?php session_name("uid"); session_set_cookie_params(50*365*24*60*60); session_start(); ?> Nobody will have their current computer in 50 years, so making a cookie that lasts that long is pointless.
-
Are you sure your server is set up right? If you are using shared hosting, then you might call your host and ask about sending mail from php. In one instance, I had to use this code to make sending mail possible: ini_set("SMTP","mail.mysite.com"); // this being my server's SMTP outgoing server // yours could be smtp.yourdomain.com ini_set("smtp_port","25"); // you might have a different port number for SMTP
-
The "I want your emails" form already directly updates the database, I just wanted the "Send us an email" form to do it too. When using the "Send us an email" form, you are given a choice to subscribe to our emails, and now it automatically updates the database. I could never figure out the streaming. With the information provided in the curl example above, can you show me how you would have done it?
-
I used curl. It was super easy. I found a PDF online that was very imformative: http://www.phpit.net/article/using-curl-php/2/?pdf=yes Here was the code I came up with: <?php if ($aCleanedValues['opt-in'] == 'Y'){ $name = $aAllRawValues['realname']; $email = $aAllRawValues['email']; $url = "http://myemaildatabase.php?ID=abcdefg"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); // set url to post to curl_setopt($ch, CURLOPT_FAILONERROR, 1); //needed for some reason curl_setopt($ch, CURLOPT_TIMEOUT, 30); // times out after 31s curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //so you dont see the process, it just happens before the redirect curl_setopt($ch, CURLOPT_POST, 1); // set POST method curl_setopt($ch, CURLOPT_POSTFIELDS, array('Name'=>"$name", 'Email'=>"$email", 'DeliveryFormat'=>'HTML', 'Password'=>'RandomNumber', 'NewsletterListID'=>'123', 'JoinType'=>'Online', 'SID'=>'{CDFEB2A7-0B0C-4541-A50B-CC975DDB114A}')); // add POST fields curl_exec($ch); // run the whole process curl_close($ch); } ?>
-
my server says that fopen is disabled, so I'm looking for another way to do this
-
$name = 'John Doe'; $email = 'johndoe@nobody.net'; //this is the array of name=>value that need to POST array('Name'=>"$name", 'Email'=>"$email", 'DeliveryFormat'=>'HTML', 'Password'=>'RandomNumber', 'SID'=>'{CDFEB2A7-0B0C-4541-A50B-CC975DDB114A}') I've been trying, but I'm in a bit of a rush, any help would be greatly appreciated
-
ok ok, what it is is i have an email form on my website that has a radio button a user can check if they want to be added to our email list. For a long time I have been viewing the emails, and manually adding the people to my email database. I also have a host supplied form script that can add the users to the email database, and I'm trying to automate it.
-
what if the posted data name has changed, or if the value of the posted data changed at some point in the script?
-
Within my script I have: $whatever = $_POST['whatever']; $whatever2 = $_POST['whatever2']; These were from a form that the user filled out. Alot of stuff happens to $whatever and $whatever2 within my script, but at the end of the script I need $whatever and $whatever2 to get passed as $_POST data to http://www.someotherscript.com/script.php. This data can not be $_GET data in the URL. It must be passed as $_POST data. I know how to use standard HTML forms, but I don't know how to do this. Please help.
-
I have an email form, and users can select to be added to our email list with a radio button, which is mailed to me in the body of an email. On a seperate page of my website there is a form where users can sign up for this email, and that form sends the data to en email administration program that is seperate from the email processing script. Is it possible to have a form that posts to both the email processings script certain data, and posts other data to the email processings script?
-
I was just being dumb... This is all it took to make it work: <?php header("Last-Modified: " . gmdate("D, d M Y H:i:s", getlastmod()) ." GMT"); ?>
-
This is getting better, but I just want to know if there is an easier way: $hours = date ("H", getlastmod())+4; $daynumber = date ("j", getlastmod()); if ($hours == 24){ $hours = 00; $daynumber = $daynumber + 1; } if ($hours >= 25){ $hours = $hours -24; $daynumber = $daynumber + 1; } header("Last-Modified: " . date ("D, ", getlastmod()) . $daynumber . date(" M Y ", getlastmod()) . "$hours" . date (":i:s", getlastmod()) . " GMT"); Hasn't anyone ever done anything like this before?
-
OK, this works: <?php header("Last-Modified: " . date ("D, j M Y ", getlastmod()) . (date ("H", getlastmod())+4) . date (":i:s", getlastmod()) . " GMT");?> but the problem is that if the lastmod was during certain hours, the output for the hour might show something like 24 or 26. Since there is no 24 or 26th hour in a day, I need to come up with something that keeps the date right, but I am stuck and need help. Please help!