PHP - Get Invisible Statuts Of A Yahoo User
Hello
ive Googled around for ages for a PHP script that Shows the yahoo user statuts .. but the only thing i ve found is this link from yahoo thats saying the Online/Offline statuts http://opi.yahoo.com/online?u= ive heared that theres some way of sending a bot to the id and see if its on invisible .. dos anyone know a way to do it ? Similar TutorialsHi every one I've downloaded some classes but they weren't work . How do I send a private message? thanks If your working with Yahoo API, or Yahoo Scraping, is there a way to detect the 999 error. I have an App that deals heavily with Yahoo scraping. However, Yahoo after awhile has the 999 error. What I want to do is detect when it returns the error, serialize all the arrays up into a database, and allow the client to try it again later when Yahoo has removed it's blocking restriction (after about an hour). So, what I have thought about is doing a standard detection script. Just to see if the text 999 was found. SO the function that I use to get data from Yahoo, after awhile it returns: Quote Warning: file_get_contents(http://siteexplorer.search.yahoo.com/search?p=http://http://www.seomarketing.com&bwm=i&bwmf=u&bwms=p&fr2=seo-rd-se&b=1501) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 999 Unable to process request at this time -- error 999 in /var/www/vhosts/seomarketing.com/httpdocs/seotools/competitiveanalysis/functions.php on line 86 What I want to do is supress that error (Which I can do with Error Reporting, or the @ symbol. That is easy. What I also want to do is put up a conditional. if (file_get_contents($url) throws a warning) { // Do some database work. } I can't figure out the best way to approach this. Any advice? Hello, For months I'm looking for a weather script for my modest blog I finally have a php script that displays yahoo weather (5 days) in English (TUE, WEN, THU, ...) It would be nice if someone can tell me if there is a way, function or script, to translate these days in French Yahoo team says that it is not possible :http://developer.yahoo.com/forum/General-Discussion-at-YDN/Can-Yahoo-Weather-API-show-by/1275022713000-d78748d9-0247-313b-ad9e-3503b8ea3d07 Cordially, Kim. Hello, everyone. I'm still kind of new at this, so please bear with me. I've customized a website (hosted by Yahoo Small Business) which is now fully functional aside from the "Contact Us" page. I have a PHP file named "send_email.php" uploaded to my root directory which has the following code: <?php $contact_name = $_POST['name']; $contact_email = $_POST['email']; $contact_subject = $_POST['subject']; $contact_message = $_POST['message']; if( $contact_name == true ) { $sender = $contact_email; $receiver = "my@email.com"; $client_ip = $_SERVER['REMOTE_ADDR']; $email_body = "Name: $contact_name \nEmail: $sender \n\nSubject: $contact_subject \n\nMessage: \n\n$contact_message \n\nIP: $client_ip \n\nFlash Contact Form provided by http://www.flashmo.com"; $extra = "From: $sender\r\n" . "Reply-To: $sender \r\n" . "X-Mailer: PHP/" . phpversion(); if( mail( $receiver, "Flash Contact Form - $contact_subject", $email_body, $extra ) ) { echo "success=yes"; } else { echo "success=no"; } } ?> I went ahead and changed "my@email.com" to my actual email address. The problem I'm having, though, is that the form fails every time...except if I enter my own email address in the "Email" field which should be filled in by the customer. I can't figure this out. It's probably something simple that I'm doing wrong, or perhaps it has something to do with Yahoo Web Hosting. I'm also thinking I have to fill something in the "Client IP" section of the code...but I'm not sure what should go there. I'd really appreciate your time and responses. Thanks so much. Hey guys, newbie here love the site, lots of great info, hopefully one of u guys can help me out. i have adapted code from http://www.singhvishwajeet.com/2009/06/25/using-php-to-get-stock-quotes-from-yahoo-finance/ (which is free to use) i have been working on a way to enter a company code, e.g. BARC -barclays bank, on one page then on another im trying to serahc the yahoo csv for a number of specific numbers that are "live" and then output them on my site, which in turn i shall work with but i cant seem to out put the data, its the $stat bit im struggling with i will attach the files, hopefully someone can help me Hello all, I'm looking for some assistance with some code. I'm trying to put this to bed as it's driving me nuts. The Psuedo code for this would be to 1) Download the rates from the Yahoo API and declare my base rate to my foreign exchange. 2) Store an array of currencies to choose from to compare against the base currency. 3) I then GET the chosen currency and register it in a SESSION to be used on other pages. (I'm unsure if this is correct?) 4) I then calculate the Price of my product which is in GBP to the selected foreign currency. 5) Output the converted price anywhere on the page. My script takes GET values from the URL like so.. .com?c=EUR My code is like so.. 1) First I get the rates from the Yahoo API Code: [Select] session_start(); $from = 'GBP'; $to = '$c'; $url = 'http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s='. $from . $to .'=X'; $handle = @fopen($url, 'r'); if ($handle) { $result = fgets($handle, 4096); fclose($handle); } $allData = explode(',',$result); /* Get all the contents to an array */ $PoundValue = $allData[1]; 2) Then I store an array of the currencies. Code: [Select] $currency_array = array ('USD','EUR','RMB','JPY','AUD','CHF') 3) Then I get the chosen currency. Code: [Select] if(isset($_GET['c'])) { $c = $_GET['c']; if(array($currency_array)) { $_SESSION['currency_array'] = $c; } } 4) I then calculate the product price. Code: [Select] $Total = $Price * $currency_array; $outprice = number_format($Total, 2, '.', ','); 5) Then I output on the page Code: [Select] <?php echo .$outprice; ?> So is all my coding logically in the right order? Any help would be greatly appreciated. Thank you. I'm using a simple form to grab an email address and send the person who signs up and automatic response. It was working for a while and now it's not. Not sure what happened. My hosting company told me to look into my headers. Can anyone help? Here is my code. Thanks, Code: [Select] <?php /* Set e-mail recipient */ $subject = "Sign Up"; $headers = "From: admin@xxx.com" . "\r\n" . "CC: admin@xxx.com"; /* Check all form inputs using check_input function */ $sign_up_email_address = check_input($_POST['sign_up_email_address'], "Please enter your email address."); /* If e-mail is not valid show error message */ if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $sign_up_email_address)) { show_error("E-mail address not valid"); } /* Let's prepare the message for the e-mail */ $response_message = "Sample Message"; /* Send the message using mail() function */ mail($sign_up_email_address, $subject, $response_message, $headers); /* Functions we used */ function check_input($data, $problem='') { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); if ($problem && strlen($data) == 0) { show_error($problem); } return $data; } function show_error($myError) { ?> <?php echo $myError; ?> Thank you, It seems something has changed at Yahoo Finance. I use a Stock quote script (micro stock) to post stock quotes from specific tickers on my website. It worked fine for years until recently. Now i am unable to access any data directly from any Yahoo finance URL. Hereafter my script which comes from 1) Micro Stock : http://www.phptoys.com/product/micro-stock.html or 2) Getting Stock Quote : http://www.phptoys.com/tutorial/getting-stock-quote.html <?php function getStockSite($stockLink){ if ($fp = fopen($stockLink, 'r')) {$content = ''; while ($line = fread($fp, 1024)) {$content .= $line;}} return $content;} function processStockSite($wurl){ $wrss = getStockSite($wurl); $text = ''; if (strlen($wrss)>100){ // Get text $spos = strpos($wrss,'</span>:',$spos)+3; $spos = strpos($wrss,'<big>',$spos); $epos = strpos($wrss,'</div><h1>',$spos); if ($epos>$spos){ $text = substr($wrss,$spos,$epos-$spos);} else {$text = '-';}} // Get results $result['text'] = $text; return $result;} <html> <head> <title>Get Stock tutorial</title> </head> <body> <?php // Get stock data $data = processStockSite('http://finance.yahoo.com/q?s=GOOG'); echo $data['text']; ?> I am not php programmer and i hope someone can help me in this matter since that script was a marvel. Thank in advance. I have successfully used the Yahoo local search API and received results in XML format. I am trying to use PHPs Simple XML to parse the data into an array so I can loop through and print specific elements. I cannot get to specific elements and I have read several threads online. Below is some code and below that is the XML. I am trying to get to the elements like title, address, etc. Code: [Select] $url = 'http://local.yahooapis.com/LocalSearchService/V3/localSearch?appid=<my yahoo api key>&category=Casinos&query=blackjack&zip=95035&radius=20&results=10'; $xml = file_get_contents($url); $phpobject = simplexml_load_string($xml); foreach($phpobject->attributes() as $name=>$attr) { $res[$name]=$attr; } Code: [Select] <ResultSet xsi:schemaLocation="urn:yahoo:lcl http://local.yahooapis.com/LocalSearchService/V3/LocalSearchResponse.xsd" totalResultsAvailable="48" totalResultsReturned="10" firstResultPosition="1"> − <ResultSetMapUrl> http://maps.yahoo.com/broadband/?q1=Milpitas%2C+CA+95035&tt=poker&tp=1 </ResultSetMapUrl> − <Result id="34179399"> <Title>Bay Area Poker Chip</Title> <Address>1274 Piper Dr</Address> <City>Milpitas</City> <State>CA</State> <Phone>(408) 263-8611</Phone> <Latitude>37.412359</Latitude> <Longitude>-121.891794</Longitude> − <Rating> <AverageRating>5</AverageRating> <TotalRatings>1</TotalRatings> <TotalReviews>1</TotalReviews> <LastReviewDate>1198993183</LastReviewDate> − <LastReviewIntro> I bought 100% real clay chips from here and obsolutely love it. I had a poker game that night and needed chips and a table. They had everything in stock and saved me time to look around. Great products and great service and I highly recommend this place to anybody </LastReviewIntro> </Rating> <Distance>1.33</Distance> − <Url> http://local.yahoo.com/info-34179399-bay-area-poker-chip-milpitas </Url> − <ClickUrl> http://local.yahoo.com/info-34179399-bay-area-poker-chip-milpitas </ClickUrl> − <MapUrl> http://maps.yahoo.com/maps_result?q1=1274+Piper+Dr+Milpitas+CA&gid1=34179399 </MapUrl> <BusinessUrl>http://bayareapokerchip.com/</BusinessUrl> <BusinessClickUrl>http://bayareapokerchip.com/</BusinessClickUrl> − <Categories> <Category id="96928631">Graphic Design</Category> </Categories> </Result> − <Result id="44540748"> <Title>Bay Area Poker Chip</Title> <Address>519 Montague Expy</Address> <City>Milpitas</City> <State>CA</State> <Phone>(408) 263-8611</Phone> <Latitude>37.409925</Latitude> <Longitude>-121.89489</Longitude> − <Rating> <AverageRating>NaN</AverageRating> <TotalRatings>0</TotalRatings> <TotalReviews>0</TotalReviews> <LastReviewDate/> <LastReviewIntro/> </Rating> <Distance>1.48</Distance> − <Url> http://local.yahoo.com/info-44540748-bay-area-poker-chip-milpitas </Url> − <ClickUrl> http://local.yahoo.com/info-44540748-bay-area-poker-chip-milpitas </ClickUrl> − <MapUrl> http://maps.yahoo.com/maps_result?q1=519+Montague+Expy+Milpitas+CA&gid1=44540748 </MapUrl> <BusinessUrl>http://www.bayareapokerchip.com/</BusinessUrl> <BusinessClickUrl>http://www.bayareapokerchip.com/</BusinessClickUrl> − <Categories> <Category id="96925976">Sporting Goods</Category> <Category id="96935378">Games</Category> </Categories> </Result> − <Result id="67710717"> <Title>Poker Da Vinci</Title> <Address>51 E Campbell Ave</Address> <City>Campbell</City> <State>CA</State> <Phone>(408) 866-4446</Phone> <Latitude>37.287157</Latitude> <Longitude>-121.94942</Longitude> − <Rating> <AverageRating>NaN</AverageRating> <TotalRatings>0</TotalRatings> <TotalReviews>0</TotalReviews> <LastReviewDate/> <LastReviewIntro/> </Rating> <Distance>10.40</Distance> − <Url> http://local.yahoo.com/info-67710717-poker-da-vinci-campbell </Url> − <ClickUrl> http://local.yahoo.com/info-67710717-poker-da-vinci-campbell </ClickUrl> − <MapUrl> http://maps.yahoo.com/maps_result?q1=51+E+Campbell+Ave+Campbell+CA&gid1=67710717 </MapUrl> <Categories/> </Result> − <Result id="21599986"> <Title>Bay 101 Banquet Facilities</Title> <Address>1801 Bering Dr</Address> <City>San Jose</City> <State>CA</State> <Phone>(408) 451-8888</Phone> <Latitude>37.373044</Latitude> <Longitude>-121.912125</Longitude> − <Rating> <AverageRating>4</AverageRating> <TotalRatings>2</TotalRatings> <TotalReviews>2</TotalReviews> <LastReviewDate>1200040214</LastReviewDate> − <LastReviewIntro> If youre looking for high limit action Bay 101 is the place to go in San Jose. You can regularly find limit games up to $80-$160 in their spacious high ceiling room. </LastReviewIntro> </Rating> <Distance>4.13</Distance> − <Url> http://local.yahoo.com/info-21599986-bay-101-banquet-facilities-san-jose </Url> − <ClickUrl> http://local.yahoo.com/info-21599986-bay-101-banquet-facilities-san-jose </ClickUrl> − <MapUrl> http://maps.yahoo.com/maps_result?q1=1801+Bering+Dr+San+Jose+CA&gid1=21599986 </MapUrl> <BusinessUrl>http://bay101.com/</BusinessUrl> <BusinessClickUrl>http://bay101.com/</BusinessClickUrl> − <Categories> <Category id="96929273">Casinos</Category> </Categories> </Result> − <Result id="21401964"> <Title>Thwart Poker Incorporated</Title> <Address>525 Lincoln Ave</Address> <City>Palo Alto</City> <State>CA</State> <Phone>(650) 329-9627</Phone> <Latitude>37.444049</Latitude> <Longitude>-122.151513</Longitude> − <Rating> <AverageRating>NaN</AverageRating> <TotalRatings>0</TotalRatings> <TotalReviews>0</TotalReviews> <LastReviewDate/> <LastReviewIntro/> </Rating> <Distance>14.09</Distance> − <Url> http://local.yahoo.com/info-21401964-thwart-poker-incorporated-palo-alto </Url> − <ClickUrl> http://local.yahoo.com/info-21401964-thwart-poker-incorporated-palo-alto </ClickUrl> − <MapUrl> http://maps.yahoo.com/maps_result?q1=525+Lincoln+Ave+Palo+Alto+CA&gid1=21401964 </MapUrl> − <Categories> <Category id="96926908">Internet Access Providers</Category> <Category id="96932773">Computer Business Solutions</Category> </Categories> </Result> − <Result id="21574436"> <Title>Blinky's Can't Say Lounge</Title> <Address>1031 Monroe St</Address> <City>Santa Clara</City> <State>CA</State> <Phone>(408) 985-7201</Phone> <Latitude>37.348893</Latitude> <Longitude>-121.94816</Longitude> − <Rating> <AverageRating>5</AverageRating> <TotalRatings>3</TotalRatings> <TotalReviews>3</TotalReviews> <LastReviewDate>1228667811</LastReviewDate> − <LastReviewIntro> Good drinks good prices good people. Who could ask for more..... </LastReviewIntro> </Rating> <Distance>6.39</Distance> − <Url> http://local.yahoo.com/info-21574436-blinky-s-can-t-say-lounge-santa-clara </Url> − <ClickUrl> http://local.yahoo.com/info-21574436-blinky-s-can-t-say-lounge-santa-clara </ClickUrl> − <MapUrl> http://maps.yahoo.com/maps_result?q1=1031+Monroe+St+Santa+Clara+CA&gid1=21574436 </MapUrl> − <Categories> <Category id="96926057">All Bars, Pubs, & Clubs</Category> <Category id="96926063">Bars & Pubs</Category> </Categories> </Result> − <Result id="21619987"> <Title>Barbara of Pauline's Cake Decorating Supplies</Title> <Address>1093 Malone Rd</Address> <City>San Jose</City> <State>CA</State> <Phone>(408) 978-9740</Phone> <Latitude>37.293702</Latitude> <Longitude>-121.889876</Longitude> − <Rating> <AverageRating>4.5</AverageRating> <TotalRatings>8</TotalRatings> <TotalReviews>8</TotalReviews> <LastReviewDate>1268173462</LastReviewDate> − <LastReviewIntro> I love this store. No matter what it is i am looking for weather it is some thing i remember from my child hood or some thing i saw in a magazine and i need it i know i can find it there. Yes they are a little rough around the edges but that is only because they are trying to get it across to you what will work and what will not. This is an old school store with people who know their stuff and are only trying to help you get the best end result possible. I am 46 years old and i took my class from Barbara when i first came out of high school and believe me she will not try to up sale you or tell you some thing is going to work if it will not. Go in expecting to be overwhelmed by stock and know you are going to get the best prices in town. Take the time to get to know the employees and the store and you will always go back to Paulines. I travel all the way from Livermore to get stuff i know i can only find there. Thanks for all your many years of being in business </LastReviewIntro> </Rating> <Distance>9.52</Distance> − <Url> http://local.yahoo.com/info-21619987-barbara-of-pauline-s-cake-decorating-supplies-san-jose </Url> − <ClickUrl> http://local.yahoo.com/info-21619987-barbara-of-pauline-s-cake-decorating-supplies-san-jose </ClickUrl> − <MapUrl> http://maps.yahoo.com/maps_result?q1=1093+Malone+Rd+San+Jose+CA&gid1=21619987 </MapUrl> − <Categories> <Category id="96928859">Wedding Supplies & Services</Category> </Categories> </Result> − <Result id="21602089"> <Title>Carey David Incorporated</Title> <Address>1624 Remuda Ln</Address> <City>San Jose</City> <State>CA</State> <Phone>(408) 453-7843</Phone> <Latitude>37.372385</Latitude> <Longitude>-121.908305</Longitude> − <Rating> <AverageRating>NaN</AverageRating> <TotalRatings>0</TotalRatings> <TotalReviews>0</TotalReviews> <LastReviewDate/> <LastReviewIntro/> </Rating> <Distance>4.13</Distance> − <Url> http://local.yahoo.com/info-21602089-carey-david-incorporated-san-jose </Url> − <ClickUrl> http://local.yahoo.com/info-21602089-carey-david-incorporated-san-jose </ClickUrl> − <MapUrl> http://maps.yahoo.com/maps_result?q1=1624+Remuda+Ln+San+Jose+CA&gid1=21602089 </MapUrl> <BusinessUrl>http://dc-enterprises.com/</BusinessUrl> <BusinessClickUrl>http://dc-enterprises.com/</BusinessClickUrl> − <Categories> <Category id="96928508">Clothing Wholesalers</Category> <Category id="96928509">Clothing Manufacturers</Category> <Category id="96931030">Apparel Manufacturing</Category> </Categories> </Result> − <Result id="30246475"> <Title>Royal Casino Parties</Title> <Address>943 Berryessa Rd, #6</Address> <City>San Jose</City> <State>CA</State> <Phone>(408) 213-0904</Phone> <Latitude>37.363563</Latitude> <Longitude>-121.886341</Longitude> − <Rating> <AverageRating>NaN</AverageRating> <TotalRatings>0</TotalRatings> <TotalReviews>0</TotalReviews> <LastReviewDate/> <LastReviewIntro/> </Rating> <Distance>4.71</Distance> − <Url> http://local.yahoo.com/info-30246475-royal-casino-parties-san-jose </Url> − <ClickUrl> http://local.yahoo.com/info-30246475-royal-casino-parties-san-jose </ClickUrl> − <MapUrl> http://maps.yahoo.com/maps_result?q1=943+Berryessa+Rd%2C+%236+San+Jose+CA&gid1=30246475 </MapUrl> <BusinessUrl>http://www.royalcasinoparties.com/</BusinessUrl> <BusinessClickUrl>http://www.royalcasinoparties.com/</BusinessClickUrl> − <Categories> <Category id="96925812">Entertainment Production</Category> <Category id="96930362">Gambling</Category> </Categories> </Result> − <Result id="25247620"> <Title>Bay Casino Gaming, Casino Party Rentals</Title> <Address/> <City>San Jose</City> <State>CA</State> <Phone>(408) 747-1977</Phone> <Latitude>37.338475</Latitude> <Longitude>-121.885794</Longitude> − <Rating> <AverageRating>NaN</AverageRating> <TotalRatings>0</TotalRatings> <TotalReviews>0</TotalReviews> <LastReviewDate/> <LastReviewIntro/> </Rating> <Distance>6.44</Distance> − <Url> http://local.yahoo.com/info-25247620-bay-casino-gaming-casino-party-rentals-san-jose </Url> − <ClickUrl> http://local.yahoo.com/info-25247620-bay-casino-gaming-casino-party-rentals-san-jose </ClickUrl> − <MapUrl> http://maps.yahoo.com/maps_result?q1=+San+Jose+CA&gid1=25247620 </MapUrl> <BusinessUrl>http://www.baycasinogaming.com/</BusinessUrl> <BusinessClickUrl>http://www.baycasinogaming.com/</BusinessClickUrl> − <Categories> <Category id="96925812">Entertainment Production</Category> <Category id="96925814">Party Rentals</Category> </Categories> </Result> </ResultSet> i am new to curl .and i m trying to create create a script to log into yahoo and click the confermation link in emails. but i am stuck witht he login process only i made the code below . but still i cant make it work. the problem is yahoo is implementing a captcha challange for this kind of automated headers. do you have any idea ho to make it work again without alerting the captcha challange ? the header i caught through the livehttp header is as follows: Content-Length: 347 .tries=1&.src=ym&.md5=&.hash=&.js=&.last=&promo=&.intl=in&.bypass=&.partner=&.u=4ls6cr96lbs8e&.v=0&.challenge=W9w31pCrbdazCcY4mH41fVsyxwd8&.yplus=&.emailCode=&pkg=&stepid=&.ev=&hasMsgr=0&.chkP=Y&.done=http%3A%2F%2Fmail.yahoo.com&.pd=ym_ver%3D0%26c%3D%26ivt%3D%26sg%3D&pad=1&aad=1&login=myyahooid&passwd=mypassword&.persistent=y&.save=&passwd_raw= <?php $authUrl = "https: //login. yahoo . com/config/login?"; $userAgent = "Mozilla/5.0 (Windows NT 5.1; rv:2.0b11) Gecko/20100101 Firefox/4.0b11"; $referer = "http : // my . yahoo . com"; $login = "userid"; $password = "password"; $numPostData = 22; $cookieFileJar = "ycookie.txt"; $cookie = 0; $postData = ".tries=1&.src=ym&.md5=&.hash=&.js=&.last=&promo=&.intl=in&.bypass=&.partner=&.u=4ls6cr96lbs8e&.v=0&.challenge=W9w31pCrbdazCcY4mH41fVsyxwd8&.yplus=&.emailCode=&pkg=&stepid=&.ev=&hasMsgr=0&.chkP=Y&.done=http%3A%2F%2Fmail.yahoo.com&.pd=ym_ver%3D0%26c%3D%26ivt%3D%26sg%3D&pad=1&aad=1&login=$login&passwd=$password&.persistent=y&.save=&passwd_raw=" ; $ch = curl_init(); curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); // Set the referrer curl_setopt($ch, CURLOPT_REFERER, $referer); // Set the authentication url curl_setopt($ch, CURLOPT_URL, $authUrl); // Set number of post fields curl_setopt($ch, CURLOPT_POST, $numPostData); //Set post data in key=value pair such as login=yourusername curl_setopt($ch, CURLOPT_POSTFIELDS, $numPostData); //Set filename for storing cookie information curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFileJar); //Set ffilename for checking the stored cookie information curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieFileJar); //Set option for cookie curl_setopt($ch, CURLOPT_COOKIE, $cookie); //set this to output the result as string and not output directly ot browser curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); //set this value to 1 if you want to redirect to the url you provided as service url curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); //Set this option if you do not want to verify ssl curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); //set this option if you do not want to verify peer's certificate curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); //now execute the curl $res = curl_exec($ch); echo $res; //check if the username and password is valid if ((preg_match("/invalid/i", $res)) || (preg_match("/not yet taken/i", $res))) { echo "Invalid Login"; } else { //if CURLOPT_FOLLOWLOCATION is set to 1 then after logging in successfully user is directed to url that is specified as service url echo "Logged In"; } ?> then i have to work for clicking confermation links in mails. please suggest me some ways.i would be very grateful to you Hello, PHP Freaks, So I have my website built with RapidWeaver, and built a PHP form page, and it works fine with a test host. However, I uploaded to Yahoo Small Business and the submissions aren't getting through. I heard that Yahoo is quite problematic when it comes to PHP...I called their help line and they told me that I needed to include the following in my form: <form name="Form0" method="POST" action="http://us.xx.px.webhosting.yahoo.com/forms?login=YahooID&to=mail@domianname.com&confirm=index.html&error=" onSubmit="return checkForm0()"> However, I have 2 php files, application.php and mailer.php. application.php: Quote <?php // Start session. session_start(); // Set a key, checked in mailer, prevents against spammers trying to hijack the mailer. $security_token = $_SESSION['security_token'] = uniqid(rand()); if ( ! isset($_SESSION['formMessage'])) { $_SESSION['formMessage'] = 'Fill in the form below to submit an application.'; } if ( ! isset($_SESSION['formFooter'])) { $_SESSION['formFooter'] = 'A scholarship is also available, please contact us for more details.'; } if ( ! isset($_SESSION['form'])) { $_SESSION['form'] = array(); } function check($field, $type = '', $value = '') { $string = ""; if (isset($_SESSION['form'][$field])) { switch($type) { case 'checkbox': $string = 'checked="checked"'; break; case 'radio': if($_SESSION['form'][$field] === $value) { $string = 'checked="checked"'; } break; case 'select': if($_SESSION['form'][$field] === $value) { $string = 'selected="selected"'; } break; default: $string = $_SESSION['form'][$field]; } } return $string; } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="robots" content="all" /> <meta name="generator" content="RapidWeaver" /> <title>North Shore Culinary School | Application</title> <link rel="stylesheet" type="text/css" media="screen" href="../rw_common/themes/culinaryschool/styles.css" /> <!--[if IE 6]><link rel="stylesheet" type="text/css" media="screen" href="../rw_common/themes/culinaryschool/ie6.css" /><![endif]--> <!--[if IE 7]><link rel="stylesheet" type="text/css" media="screen" href="../rw_common/themes/culinaryschool/ie7.css" /><![endif]--> <link rel="stylesheet" type="text/css" media="screen" href="../rw_common/themes/culinaryschool/colourtag-page4.css" /> <link rel="stylesheet" type="text/css" media="print" href="../rw_common/themes/culinaryschool/print.css" /> <link rel="stylesheet" type="text/css" media="handheld" href="../rw_common/themes/culinaryschool/handheld.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../rw_common/themes/culinaryschool/css/width/900.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../rw_common/themes/culinaryschool/css/header/sunflower.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../rw_common/themes/culinaryschool/css/icons/blue.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../rw_common/themes/culinaryschool/css/sidebar/sidebar_right.css" /> <script type="text/javascript" src="../rw_common/themes/culinaryschool/javascript.js"></script> <!--[if IE 6]><script type="text/javascript" charset="utf-8"> var blankSrc = "../rw_common/themes/culinaryschool/png/blank.gif"; </script> <style type="text/css"> img { behavior: url("../rw_common/themes/culinaryschool/png/pngbehavior.htc"); } </style><![endif]--> </head> <body> <div id="top_bar"> <img src="../rw_common/themes/culinaryschool/images/body_top_bar.png" alt="" width="3000" height="8" /> </div> <div id="container"><!-- Start container --> <div id="top_swirl"> <img src="../rw_common/themes/culinaryschool/images/top_swirl.png" alt="" width="222" height="140" /> </div> <div id="pageHeader"><!-- Start page header --> <div id="logo_overlay"><img src="../rw_common/themes/culinaryschool/images/logo_grad_overlay.png" alt="" width="3000" height="175" /></div> <div id="logo"></div> <h1>North Shore Culinary School</h1> <h2>This is a complete program designed to train today's food service professionals for entry level jobs which may ladder to further opportunities.</h2> </div><!-- End page header --> <div id="contentContainer"><!-- Start main content wrapper --> <div id="navcontainer"><!-- Start Navigation --> <ul><li><a href="../index.html" rel="self">Home</a></li><li><a href="../about.html" rel="self">About</a></li><li><a href="../requirements.html" rel="self" class="currentAncestor">Curriculum</a><ul><li><a href="../curriculum/details.html" rel="self">Details</a></li><li><a href="../curriculum/calendar.html" rel="self">Calendar</a></li><li><a href="application.php" rel="self" id="current">Application</a></li></ul></li><li><a href="../contact.html" rel="self">Contact</a></li></ul> </div><!-- End navigation --> <div id="sidebarContainer"><!-- Start Sidebar wrapper --> <div id="sidebar"><!-- Start sidebar content --> <h1 class="sideHeader"></h1><!-- Sidebar header --> <!-- sidebar content you enter in the page inspector --> <!-- sidebar content such as the blog archive links --> </div><!-- End sidebar content --> </div><!-- End sidebar wrapper --> <div id="content"><!-- Start content --> <div class="message-text"><?php echo $_SESSION['formMessage']; unset($_SESSION['formMessage']); ?></div><br /> <form action="./application_files/mailer.php" method="post" enctype="multipart/form-data"> <div> <label>First Name:</label> *<br /> <input class="form-input-field" type="text" value="<?php echo check('element0'); ?>" name="form[element0]" size="40"/><br /><br /> <label>Last Name:</label> *<br /> <input class="form-input-field" type="text" value="<?php echo check('element1'); ?>" name="form[element1]" size="40"/><br /><br /> <label>Sex:</label> *<br /> <select name="form[element2]"> <option <?php echo check('element2', 'select','Male'); ?> value="Male">Male</option> <option <?php echo check('element2', 'select','Female'); ?> value="Female">Female</option> </select><br /><br /> <label>Birthdate (DD/MM/YYYY):</label> *<br /> <input class="form-input-field" type="text" value="<?php echo check('element3'); ?>" name="form[element3]" size="40"/><br /><br /> <label>Date of Application (DD/MM/YYYY):</label> *<br /> <input class="form-input-field" type="text" value="<?php echo check('element4'); ?>" name="form[element4]" size="40"/><br /><br /> <label>Address:</label> *<br /> <input class="form-input-field" type="text" value="<?php echo check('element5'); ?>" name="form[element5]" size="40"/><br /><br /> <label>Apartment Number:</label> <br /> <input class="form-input-field" type="text" value="<?php echo check('element6'); ?>" name="form[element6]" size="40"/><br /><br /> <label>Postal Code:</label> *<br /> <input class="form-input-field" type="text" value="<?php echo check('element7'); ?>" name="form[element7]" size="40"/><br /><br /> <label>Home Phone Number:</label> *<br /> <input class="form-input-field" type="text" value="<?php echo check('element8'); ?>" name="form[element8]" size="40"/><br /><br /> <label>Cell Phone Number:</label> <br /> <input class="form-input-field" type="text" value="<?php echo check('element9'); ?>" name="form[element9]" size="40"/><br /><br /> <label>Fax:</label> <br /> <input class="form-input-field" type="text" value="<?php echo check('element10'); ?>" name="form[element10]" size="40"/><br /><br /> <label>E-mail:</label> *<br /> <input class="form-input-field" type="text" value="<?php echo check('element11'); ?>" name="form[element11]" size="40"/><br /><br /> <label>Alternate e-mail:</label> *<br /> <input class="form-input-field" type="text" value="<?php echo check('element12'); ?>" name="form[element12]" size="40"/><br /><br /> <label>BCID #:</label> <br /> <input class="form-input-field" type="text" value="<?php echo check('element13'); ?>" name="form[element13]" size="40"/><br /><br /> <label>BC Driver's License #:</label> <br /> <input class="form-input-field" type="text" value="<?php echo check('element14'); ?>" name="form[element14]" size="40"/><br /><br /> <label>Are you of First Nation or Inuit descent?</label> *<br /> <select name="form[element15]"> <option <?php echo check('element15', 'select','Yes'); ?> value="Yes">Yes</option> <option <?php echo check('element15', 'select','No'); ?> value="No">No</option> </select><br /><br /> <label>Were you born in Canada?</label> *<br /> <select name="form[element16]"> <option <?php echo check('element16', 'select','Yes'); ?> value="Yes">Yes</option> <option <?php echo check('element16', 'select','No'); ?> value="No">No</option> </select><br /><br /> <label>If not, what is your country of birth?</label> <br /> <input class="form-input-field" type="text" value="<?php echo check('element17'); ?>" name="form[element17]" size="40"/><br /><br /> <label>When did you arrive in Canada? (DD/MM/YYYY)</label> <br /> <input class="form-input-field" type="text" value="<?php echo check('element18'); ?>" name="form[element18]" size="40"/><br /><br /> <label>Elementary School Attended:</label> *<br /> <input class="form-input-field" type="text" value="<?php echo check('element19'); ?>" name="form[element19]" size="40"/><br /><br /> <label>High School Attended:</label> *<br /> <input class="form-input-field" type="text" value="<?php echo check('element20'); ?>" name="form[element20]" size="40"/><br /><br /> <label>DId you receive any extra learning support in school? (e.g. ESL)</label> *<br /> <select name="form[element21]"> <option <?php echo check('element21', 'select','Yes'); ?> value="Yes">Yes</option> <option <?php echo check('element21', 'select','No'); ?> value="No">No</option> </select><br /><br /> <label>If yes, please specify...</label> <br /> <input class="form-input-field" type="text" value="<?php echo check('element22'); ?>" name="form[element22]" size="40"/><br /><br /> <label>Do you have a computer workstation at home?</label> *<br /> <select name="form[element23]"> <option <?php echo check('element23', 'select','Yes'); ?> value="Yes">Yes</option> <option <?php echo check('element23', 'select','No'); ?> value="No">No</option> </select><br /><br /> <label>How will you be travelling to and from school?</label> *<br /> <select name="form[element24]"> <option <?php echo check('element24', 'select','Car'); ?> value="Car">Car</option> <option <?php echo check('element24', 'select','Bus'); ?> value="Bus">Bus</option> <option <?php echo check('element24', 'select','Bike'); ?> value="Bike">Bike</option> <option <?php echo check('element24', 'select','Walking'); ?> value="Walking">Walking</option> <option <?php echo check('element24', 'select','Other'); ?> value="Other">Other</option> </select><br /><br /> <label>Are you receiving any financial assistance? Please specify...</label> *<br /> <input class="form-input-field" type="text" value="<?php echo check('element25'); ?>" name="form[element25]" size="40"/><br /><br /> <label>Have you received a blood test?</label> *<br /> <select name="form[element26]"> <option <?php echo check('element26', 'select','Yes'); ?> value="Yes">Yes</option> <option <?php echo check('element26', 'select','No'); ?> value="No">No</option> </select><br /><br /> <label>Have you received a TB test?</label> *<br /> <select name="form[element27]"> <option <?php echo check('element27', 'select','Yes'); ?> value="Yes">Yes</option> <option <?php echo check('element27', 'select','No'); ?> value="No">No</option> </select><br /><br /> <label>Do you have any disabilities? Please specify...</label> *<br /> <input class="form-input-field" type="text" value="<?php echo check('element28'); ?>" name="form[element28]" size="40"/><br /><br /> <label>What is your cultural background?</label> *<br /> <input class="form-input-field" type="text" value="<?php echo check('element29'); ?>" name="form[element29]" size="40"/><br /><br /> <div style="display: none;"> <label>Spam Protection: Please don't fill this in:</label> <textarea name="comment" rows="1" cols="1"></textarea> </div> <input type="hidden" name="form_token" value="<?php echo $security_token; ?>" /> <input class="form-input-button" type="reset" name="resetButton" value="Reset" /> <input class="form-input-button" type="submit" name="submitButton" value="Submit" /> </div> </form> <br /> <div class="form-footer"><?php echo $_SESSION['formFooter']; unset($_SESSION['formFooter']); ?></div><br /> <?php unset($_SESSION['form']); ?> <div class="clearer"></div> </div><!-- End content --> </div><!-- End main content wrapper --> </div><!-- End container --> <div id="footer"><!-- Start Footer --> <div id="footer_swirl"> <img src="../rw_common/themes/culinaryschool/images/footer_swirl.png" alt="" width="502" height="69" /> </div> <p>© 2010 Don Guthro</p> <div id="breadcrumbcontainer"><!-- Start the breadcrumb wrapper --> </div><!-- End breadcrumb --> </div><!-- End Footer --> </body> </html> mailer.php: Quote <?php //start the session session_start(); ////////////////////////////////////////////////////// // Begin variables to be written out by RapidWeaver // ////////////////////////////////////////////////////// //set the return URL $return_url = "../application.php"; //set the users email address $email = "nachapol.d@gmail.com"; //array of fields in form. (In the format "field_name" => "field_label") $form_fields = array( "element0" => 'First Name:', "element1" => 'Last Name:', "element2" => 'Sex:', "element3" => 'Birthdate (DD/MM/YYYY):', "element4" => 'Date of Application (DD/MM/YYYY):', "element5" => 'Address:', "element6" => 'Apartment Number:', "element7" => 'Postal Code:', "element8" => 'Home Phone Number:', "element9" => 'Cell Phone Number:', "element10" => 'Fax:', "element11" => 'E-mail:', "element12" => 'Alternate e-mail:', "element13" => 'BCID #:', "element14" => 'BC Driver\'s License #:', "element15" => 'Are you of First Nation or Inuit descent?', "element16" => 'Were you born in Canada?', "element17" => 'If not, what is your country of birth?', "element18" => 'When did you arrive in Canada? (DD/MM/YYYY)', "element19" => 'Elementary School Attended:', "element20" => 'High School Attended:', "element21" => 'DId you receive any extra learning support in school? (e.g. ESL)', "element22" => 'If yes, please specify...', "element23" => 'Do you have a computer workstation at home?', "element24" => 'How will you be travelling to and from school?', "element25" => 'Are you receiving any financial assistance? Please specify...', "element26" => 'Have you received a blood test?', "element27" => 'Have you received a TB test?', "element28" => 'Do you have any disabilities? Please specify...', "element29" => 'What is your cultural background?' ); $required_fields = array("element0", "element1", "element2", "element3", "element4", "element5", "element7", "element8", "element11", "element12", "element15", "element16", "element19", "element20", "element21", "element23", "element24", "element25", "element26", "element27", "element28", "element29"); $mail_from_name = "element0"; $mail_from_email = "element11"; $mail_subject = "element4"; //uses the email address defined above as the from email. $send_from_users_email = false; //sets the PHP setting 'sendmail_from' for use on a windows server. $windows_server = true; // Set up the error and success messages. $message_success = 'Thank you, your application has been sent.'; $message_unset_fields = "Fields marked with * are required."; //////////////////////////////////////////////////// // End variables to be written out by RapidWeaver // //////////////////////////////////////////////////// // Check key variable from form against session key. if ( ! isset($_POST['form_token']) || $_POST['form_token'] !== $_SESSION['security_token']) { // Set a fixed error message if the keys don't match. redirect($return_url, 'We cannot verify that you are trying to send an email from this form. Please try again.'); } // SPAM checking. If the "comment" form field has been filled out, // send back to form asking to remove content and exit the script. if ($_POST['comment']) { redirect($return_url, 'Please remove content from the last textarea before submitting the form again. This is to protect against SPAM abuse.'); } ///////////////////////// // PROCESS FORM FIELDS // ///////////////////////// $magic_quotes = (bool) get_magic_quotes_gpc(); foreach ($_POST['form'] as $key => $value) { if ($magic_quotes) { $value = stripslashes($value); } $_SESSION['form'][$key] = $value; } /////////////////////////// // CHECK REQUIRED FIELDS // /////////////////////////// //if any of the required fields are empty if (check_required_fields($required_fields) === false) { //return to form with error message. redirect($return_url, $message_unset_fields); } else { /////////////////////////////////// // ALL IS OK, SETUP GLOBAL VAR'S // /////////////////////////////////// //check email address if ( ! check_email($email)) unset($email); //set mime boundry. Needed to send the email. Mixed seperates text from attachments. $mixed_mime_boundary = 'rms-mix-x'.md5(mt_rand()).'x'; //alt seperates html from plain text. $alt_mime_boundary = 'rms-alt-x'.md5(mt_rand()).'x'; //set the from address if user supplied email is invalid use form owners. $submitted_email = ''; if (isset($_SESSION['form'][$mail_from_email])) { $submitted_email = $_SESSION['form'][$mail_from_email]; } if (check_email($submitted_email) && $send_from_users_email === false) { $from = $reply_to = $_SESSION['form'][$mail_from_name].'<'.$submitted_email.'>'; } else { $from = '<'.$email.'>'; $reply_to = check_email($submitted_email) ? '<'.$submitted_email.'>' : $from; } //set the email subject $subject = ''; if (isset($_SESSION['form'][$mail_subject])) { $subject = $_SESSION['form'][$mail_subject]; } //email headers $headers = "From: $from\r\n" . "Reply-to: $reply_to\r\n" . "MIME-Version: 1.0\r\nContent-Type: multipart/mixed; " . "boundary=$mixed_mime_boundary"; //////////////////////////// // CONSTRUCT HTML CONTENT // //////////////////////////// //Construct HTML email content, looping through each form element //Note: When you get to a file attachment you need to use $_FILES['form_element']['name'] //This will just output the name of the file. The files will actually be attached at the end of the message. //Set a variable for the message content $html_content = "<html>\r\n<head>\r\n<title>" . safe_escape_string($subject) . "</title>\r\n</head>\r\n<body>\r\n<p>\r\n"; //////////////////////////// // CONSTRUCT TEXT CONTENT // //////////////////////////// //construct a plain text version of the email. $text_content = ''; //build a message from the reply for both HTML and text in one loop. foreach ($form_fields as $field => $label) { $html_content .= '<b>' . safe_escape_string($label) . '</b> '; $text_content .= "$label "; if (isset($_FILES[$field])) { $string = (isset($_FILES[$field]['name'])) ? $_FILES[$field]['name'] : ''; } else { $string = (isset($_SESSION['form'][$field])) ? $_SESSION['form'][$field] : ''; } $html_content .= nl2br(safe_escape_string($string)) . "<br /><br />\r\n"; $text_content .= "$string\r\n\r\n"; } //close the HTML content. $html_content .= "</p>\r\n</body>\r\n</html>"; ///////////////////////////// // CONSTRUCT EMAIL MESSAGE // ///////////////////////////// //Now we combine both HTML and plain text version of the email into one. //Creating the message body which contains a Plain text version and an HTML version, //users email client will decide which version to display $message = "\r\n--$mixed_mime_boundary\r\n" . "Content-Type: multipart/alternative; boundary=$alt_mime_boundary\r\n\r\n" . "--$alt_mime_boundary\r\n" . "Content-Type: text/plain; charset=UTF-8; format=flowed\r\n" . "Content-Transfer-Encoding: Quoted-printable\r\n\r\n" . "$text_content\r\n\r\n" . "--$alt_mime_boundary\r\n" . "Content-Type: text/html; charset=UTF-8\r\n" . "Content-Transfer-Encoding: Quoted-printable\r\n\r\n" . "$html_content\r\n\r\n" . "--$alt_mime_boundary--\r\n\r\n" . "\r\n\r\n--$mixed_mime_boundary"; ////////////////////// // FILE ATTACHMENTS // ////////////////////// //loop through the $_FILES global array and add each attachment to the form. if (isset($_FILES)) { foreach ($_FILES as $attachment) { $filename = $attachment['name']; //if the file has been uploaded if ($attachment['error'] === UPLOAD_ERR_OK && is_uploaded_file($attachment['tmp_name'])) { $file = fopen($attachment['tmp_name'],'rb'); $data = fread($file,filesize($attachment['tmp_name'])); fclose($file); $data = chunk_split(base64_encode($data)); $message .= "\r\nContent-Type: application/octet-stream; name=\"$filename\"" . "\r\nContent-Disposition: attachment; filename=\"$filename\"" . "\r\nContent-Transfer-Encoding: base64\r\n\r\n$data\r\n\r\n--$mixed_mime_boundary"; } else if ($attachment['error'] !== UPLOAD_ERR_NO_FILE) { //try to provide a useful error message determined from the error code. switch ($attachment['error']) { case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: $error = "File $filename exceeds the " . ini_get('upload_max_filesize') . 'B limit for the server.'; break; case UPLOAD_ERR_PARTIAL: $error = "Only part of the file $filename could be uploaded, please try again."; break; default: $error = "There has been an error attaching the file $filename, please try again."; } redirect($return_url, $error); } } } //finish off message $message .= '--'; //for windows users. if ($windows_server === true) { ini_set('sendmail_from', $email); } //if the mail sending works if (@mail($email, $subject, $message, $headers)) { //set the success message $notice = $message_success; unset($_SESSION['form']); } else { $notice = "I'm sorry, there seems to have been an error trying to send your email. Please try again."; } //redirect to the form redirect($return_url, $notice); } ////////////////////// // GLOBAL FUNCTIONS // ////////////////////// // Redirects back to the form, an optional session message can be defined. function redirect($url, $message = NULL) { if ($message) { $_SESSION['formMessage'] = $message; } header('Location: ' . $url); exit; } // Function to escape data inputted from users. This is to protect against embedding // of malicious code being inserted into the HTML email. // Sample code: safe_escape_string($_POST['form_field']) function safe_escape_string($string) { return htmlspecialchars($string, ENT_QUOTES); } // Function to check the validity of email address. function check_email($email) { return (bool) preg_match('/^([a-z0-9_]|\-|\.)+@(([a-z0-9_]|\-)+\.)+[a-z]{2,4}$/i', $email); } // Function to check the required fields are filled in. function check_required_fields($required_fields) { foreach ($required_fields as $field) { if (( ! isset($_SESSION['form'][$field]) || empty($_SESSION['form'][$field])) && ( ! isset($_FILES[$field]) || empty($_FILES[$field]['name']))) { return false; } } return true; } Now I'm a little bombarded with this code, since I am an amateur web-builder and I don't have much experience modifying PHP. I was just wondering how I can integrate the code given to me into my existing PHP files. The website is www.northshoreculinaryschool.com and my form is under Curriculum > Application. I can provide the files if anyone wishes. Any help is greatly appreciated! If you can help me through this, you're a lifesaver! With this link http://search.yahooapis.com/WebSearchService/V1/relatedSuggestion?appid=YahooDemo&query=Madonna&results=2 , one can see suggested keywords for a query. The result is like "madonna 4 minutes madonna 4 minutes lyrics". How to put the resulting keywords in a $array, as can be used for further php coding. Hi, So, I have two sessions. One's for displaying an array. Is there some kind of function to make a session invisible? Because when I display an error for not filling in, the previous words of the array show up behind the error message. Like this: $error = 'Please enter a word.' Output: Please enter a word.word word word So is there a way to make my Session Invisible (not removing any words from array)? Hi I have a simply working SMTP form, however I need this to send to a yahoo.com email address, what can I add to achieve this? SmtpConfig.php ============== <?php //Server Address $SmtpServer="91.186.30.25"; $SmtpPort="25"; //default $SmtpUser="things@wilsoncarandvanrental.co.uk"; $SmtpPass="things123"; ?> SmtpClass.php ============= <?php class SMTPClient { // A function for Setting up SMTP function SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body) { $this->SmtpServer = $SmtpServer; $this->SmtpUser = base64_encode ($SmtpUser); $this->SmtpPass = base64_encode ($SmtpPass); $this->from = $from; $this->to = $to; $this->subject = $subject; $this->body = $body; //Setting Default port Value if ($SmtpPort == "") { $this->PortSMTP = 25; } else { $this->PortSMTP = $SmtpPort; } } //Sending the Mail function SendMail () { if ($SMTPIN = fsockopen ($this->SmtpServer, $this->PortSMTP)) { fputs ($SMTPIN, "EHLO ".$HTTP_HOST."\r\n"); $talk["hello"] = fgets ( $SMTPIN, 1024 ); fputs($SMTPIN, "auth login\r\n"); $talk["res"]=fgets($SMTPIN,1024); fputs($SMTPIN, $this->SmtpUser."\r\n"); $talk["user"]=fgets($SMTPIN,1024); fputs($SMTPIN, $this->SmtpPass."\r\n"); $talk["pass"]=fgets($SMTPIN,256); fputs ($SMTPIN, "MAIL FROM: <".$this->from.">\r\n"); $talk["From"] = fgets ( $SMTPIN, 1024 ); fputs ($SMTPIN, "RCPT TO: <".$this->to.">\r\n"); $talk["To"] = fgets ($SMTPIN, 1024); fputs($SMTPIN, "DATA\r\n"); $talk["data"]=fgets( $SMTPIN,1024 ); fputs($SMTPIN, "To: <".$this->to.">\r\nFrom: <".$this->from.">\r\nSubject:".$this->subject."\r\n\r\n\r\n".$this->body."\r\n.\r\n"); $talk["send"]=fgets($SMTPIN,256); //CLOSE CONNECTION AND EXIT ... fputs ($SMTPIN, "QUIT\r\n"); fclose($SMTPIN); // } return $talk; } } ?> mail.php ======== <?php //Include Class And Config include('SmtpConfig.php'); include('SmtpClass.php'); //Check the Request Method if($_SERVER["REQUEST_METHOD"] == "POST") { $to = $_POST['to']; $from = $_POST['from']; $subject = $_POST['sub']; $body = $_POST['message']; // Send the mail Using the class $SMTPMail = new SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body); $SMTPChat = $SMTPMail->SendMail(); } // After Exit, show the form ?> <form method="post" action=""> To:<input type="text" name="to" /> From :<input type='text' name="from" /> Subject :<input type='text' name="sub" /> Message :<textarea name="message"></textarea> <input type="submit" value=" Send " /> </form> Probably quite straight form, but of course I don#t know how :0) Much appreciated. Hi all . I have a button now when i click the button an mypages is valid can i make that button in the page invisible in postback with php?? I know you can in C# by saying button1.Visible = false; Thanks for input... Hi, How to create an invisible text in an image. Any idea? Thanks. I would appreciate your assistance, there are tons of login scripts and they work just fine. However I need my operators to login and then list their activities for the other operators who are logged in to see and if desired send their clients on the desired activity. I have the login working like a charm and the activities are listed just beautifully. How do I combine the two tables in the MySQL with PHP so the operator Logged in can only make changes to his listing but see the others. FIRST THE ONE script the member logges in here to the one table in MSQL: <?php session_start(); require_once('config.php'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($str) { $str = @trim($str); if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); } $login = clean($_POST['login']); $password = clean($_POST['password']); if($login == '') { $errmsg_arr[] = 'Login ID missing'; $errflag = true; } if($password == '') { $errmsg_arr[] = 'Password missing'; $errflag = true; } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; session_write_close(); header("location: login-form.php"); exit(); } $qry="SELECT * FROM members WHERE login='$login' AND passwd='".md5($_POST['password'])."'"; $result=mysql_query($qry); if($result) { if(mysql_num_rows($result) == 1) { session_regenerate_id(); $member = mysql_fetch_assoc($result); $_SESSION['SESS_MEMBER_ID'] = $member['member_id']; $_SESSION['SESS_FIRST_NAME'] = $member['firstname']; $_SESSION['SESS_LAST_NAME'] = $member['lastname']; session_write_close(); header("location: member-index.php"); exit(); }else { header("location: login-failed.php"); exit(); } }else { die("Query failed"); } ?> ................................................. ................................ Now I need the person who logged in to the table above to be able to make multiple entries to the table below <? $ID=$_POST['ID']; $title=$_POST['title']; $cost=$_POST['cost']; $activity=$_POST['activity']; $ayear=$_POST['aday']; $aday=$_POST['ayear']; $seats=$_POST['special']; $special=$_POST['seats']; mysql_connect("xxxxxx", "xxx350234427", "========") or die(mysql_error()); mysql_select_db("xxxx") or die(mysql_error()); mysql_query("INSERT INTO `activity` VALUES ('ID','$title', '$cost','$activity', '$aday', '$ayear', '$special', '$seats')"); Print "Your information has been successfully added to the database!" ?> Click <a href="member-profile.php">HERE</a> to return to the main menu <?php ?> hi, i have made a website where people resgister their details of them and products. they have to enter the following details in form Name of company name of the product company address email id password mobile number contact and brief details about their company
user can then login with email id and pwd. now after login ..user will get a page where he can upload the photos of products images and their price, so now my question is that when he finishes uploading (|by clicking on upload button) the product images and price text box ..then on final uploaded webspage it should show all other things which he registerd before (company name , mobile number etc) along with images and price...hence the main question that user does not need to enter mobile and address while uploading images and filling proce ..but on the final page it should show mobile and address along with price and images..as user is not going to enter mobile and address again and again as he will have multiple products to upload.
Hi, so far I have managed to set up a somewhat basic login website with a mysql database backend. Once they have logged on they go to a "main menu" page. What I need to define is that user A sees button A but only that button, etc. (Then of course that same rule would have to apply if they tried to directly go to the page, but I am guessing I can do that in the same way that I currently do to force a login). If anyone has any tutorials or sample code I would much appreciate it. Thanks, Actually, what i want to do is to use the email to fetch the $email,$password and $randomnumber from database after |