PHP - Cookie Remember Me Works Fine In Localhost But Not In Test Server.
Hi all,
I wonder if any of you have this problem before.. I have a login page with "checked box remember me" - It is working fine in my localhost machine I can see the COOKIE in my browser's option setting (Firefox). But now the problem is: When I run the script in my test server; and do exactly the same thing..the COOKIE did not seem know. When I logged in as an admin and checked the box. And closed all the browser. Then, open the browser (Firefox)and go to the index page (landing page) then it redirect me to the login page instead. I looked the at COOKIE setting in my Firefox and I can it is stored there. Any ideas whats wrong? Similar TutorialsI was hoping someone could help me figure out why my Code: [Select] header('Location: .');works right on my localhost testing computer but not when I load it onto the actual server. Here are the two files in question. The first is a snippet from my index.php controller file. Code: [Select] if (isset($_POST['action']) and $_POST['action'] == 'Edit') { include '../../includes/db.inc.php'; { $id = mysqli_real_escape_string($link, $_POST['id']); $sql = "Select * from s_times where id = '$id'"; $result = mysqli_query($link, $sql); if (!$result) { $error = 'Error fetching service time details ' . mysqli_error($link); include '../../includes/error.php'; exit(); } $row = mysqli_fetch_array($result); $pagetitle = 'Edit Category'; $action = 'editform'; $id = $row['id']; $day = $row['day']; $time = $row['time']; $event = $row['event']; $avail = $row['avail']; $orderby = $row['orderby']; $button = 'Update'; } include 'stimes_modify.php'; exit(); } if (isset($_GET['editform'])) { include '../../includes/db.inc.php'; $id = mysqli_real_escape_string($link, $_POST['id']); $day = mysqli_real_escape_string($link, $_POST['day']); $time = mysqli_real_escape_string($link, $_POST['time']); $event = mysqli_real_escape_string($link, $_POST['event']); $avail = mysqli_real_escape_string($link, $_POST['available']); $orderby = mysqli_real_escape_string($link, $_POST['orderby']); $sql = "Update s_times set day = '$day', time = '$time', event = '$event', avail = '$avail', orderby = '$orderby' where id = '$id'"; if (!mysqli_query($link, $sql)) { $error = 'Error updating service times ' . mysqli_error($link); include '../../includes/error.php'; exit(); } header('Location: .'); exit(); } here is the stimes_modify.php file code Code: [Select] if (isset($_POST['action']) and $_POST['action'] == 'Edit') { include '../../includes/db.inc.php'; { $id = mysqli_real_escape_string($link, $_POST['id']); $sql = "Select * from s_times where id = '$id'"; $result = mysqli_query($link, $sql); if (!$result) { $error = 'Error fetching service time details ' . mysqli_error($link); include '../../includes/error.php'; exit(); } $row = mysqli_fetch_array($result); $pagetitle = 'Edit Category'; $action = 'editform'; $id = $row['id']; $day = $row['day']; $time = $row['time']; $event = $row['event']; $avail = $row['avail']; $orderby = $row['orderby']; $button = 'Update'; } include 'stimes_modify.php'; exit(); } if (isset($_GET['editform'])) { include '../../includes/db.inc.php'; $id = mysqli_real_escape_string($link, $_POST['id']); $day = mysqli_real_escape_string($link, $_POST['day']); $time = mysqli_real_escape_string($link, $_POST['time']); $event = mysqli_real_escape_string($link, $_POST['event']); $avail = mysqli_real_escape_string($link, $_POST['available']); $orderby = mysqli_real_escape_string($link, $_POST['orderby']); $sql = "Update s_times set day = '$day', time = '$time', event = '$event', avail = '$avail', orderby = '$orderby' where id = '$id'"; if (!mysqli_query($link, $sql)) { $error = 'Error updating service times ' . mysqli_error($link); include '../../includes/error.php'; exit(); } header('Location: .'); exit(); } The functionality of both pages seems to be working in relation to editing the database but the page will not redirect back to the main page when it gets back down to the header line. Like I said it works on localhost just not on actual server. I also tried putting in the full URL like this Code: [Select] header('Location: http://www.bbcpa.org/dbsite/admin/stimes/stimes/php');and still got a blank page. The URL in the address bar shows this http://www.bbcpa.org/dbsite/admin/stimes/?editform it should show this http://www.bbcpa.org/dbsite/admin/stimes/ so maybe something is wrong with this line in stimes_modify.php Code: [Select] <form action="?<?php htmlout($action); ?>" method="POST"> anyway any help would be greatly appreciated. Thanks I have tested my code and got it working but when it was uploaded to my web host of godaddy.com it suddenly stops working on one page; it literally comes up a blank page, the page source is completely empty as well. the code on the page is Code: [Select] <?PHP session_start(); include("../functions/common.php"); $sqldb = open_database(); //Open the database include("../functions/create_game.php"); #This is the actual game creation code header('Location:'.$_SESSION['web_site'].'/home.php'); //Go back to the home page ?> first thing I did was put error code reporting in Code: [Select] <?PHP error_reporting( E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR ); ini_set ('display_errors', '1'); session_start(); include("../functions/common.php"); $sqldb = open_database(); //Open the database include("../functions/create_game.php"); #This is the actual game creation code header('Location:'.$_SESSION['web_site'].'/home.php'); //Go back to the home page ?>The test server the code still worked fine but on the production server it gave me Quote Fatal error: Call to undefined function PHPerror_reporting() in /home/content/74/8039674/html/testcricketmanager.com/gameplay/challenge.php on line 1 Out of frustration I put Code: [Select] <BR>1 <?PHP #error_reporting( E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR ); #ini_set ('display_errors', '1'); echo "<br>2"; /* session_start(); include("../functions/common.php"); $sqldb = open_database(); //Open the database include("../functions/create_game.php"); #This is the actual game creation code header('Location:'.$_SESSION['web_site'].'/home.php'); //Go back to the home page*/ ?> <BR>3 and the output was Quote 1 3 James NOTE: All the code works fine on the test server (at home on a Linux box); production server (godaddy) the PHP code works on each page except this one I'm an experienced programmer with several languages (COBOL, REXX, Java, Javascript, etc.) under my belt over many years but I know very little about PHP. I dabbled in it a bit a year or two back and got it to do what I wanted to do but I'm not sure how to do what I currently need.
A bit of context: I have designed a website where the user can choose between various page styles; each style invokes different CSS to give them a different visual experience of the site. They can select the style they want via View/Style in Internet Exploder and View/Page Style in Firefox but that preference is only remembered as long as they're on that page. As soon as they move to another page on the site, they have to choose the alternate style again or live with the default style. I want them to be able to select that preference ONCE, the store it in a cookie specifically for them, then keep using that style every time they visit the site. (Naturally, I want them to be able to change the style and then remember the new style as well.) There will be many visitors and each will want that same capability. I currently don't require any login to the site. (I'm toying with password-protecting some of the site down the road but that's not a factor in this page style thing that I'm talking about here.
Now, my questions.
I've found a variety of short articles describing how to use setCookie() to create the cookie (and delete it later) and getCookie() or the newer echo $_COOKIE["name"] to determine the cookie value. However, I am NOT seeing anything that says where I put the code to set and/or read the code within my web pages. I would really appreciate an explanation of that! I expect to write short fragments of php code to do those jobs which I will then imbed within my web pages via SSI (Server Side Includes). Is that reasonable or is there a better way?
Also:
1. When the user clicks on the desired Style in the View/Style menu, how do I detect what choice they made?
2. Should the name of the cookie be something like "pageStyle" or should it be something that uniquely identifies the user so that the right cookie is retrieved when the come back? If the latter, what value should I use and how should I obtain it? I assume that something unique about the user obtained from their headers is far better than displaying a dialog and asking them for some unique identifier.
I'd rather stay away from Javascript in any of this functionality since I can't rely on it being turned on.
One quick aside while I'm here. Does anyone know how to change the page style if visitors use Google Chrome or Opera? I can't even FIND options for changing the page style in my copies of those two browsers and both are current versions. Do they not support differing page styles at all or do they just hide the technique to choose the style very effectively?
--
Henry
Hi Guys I don't why it happen. probably i missed out something. Here is my code. Code: [Select] <?php if($_REQUEST["xtvt"]=="addEdit") { $sql02="INSERT INTO attachment (remarks, attached_by, attached_date) VALUES('".$_REQUEST["remarks"]."', '".$_SESSION["SESSION_ID"]."', now())"; $res02=mysql_query($sql02); //--------- attach file ---------------------------- $name = $_FILES["file"]["name"]; if ($name != "") { $selectDB="SELECT max(id) AS id FROM attachment"; $qryDB= @$res1=mysql_query($selectDB); $fetchDB=mysql_fetch_array($qryDB); $maxid=$fetchDB[0]; $result=move_uploaded_file($_FILES["file"]["tmp_name"], "upload//" . $_FILES["file"]["name"]); if (!$result) { echo "Error uploading file"; } $update_faultLog = "UPDATE attachment SET attachment='$name' WHERE id='$maxid'"; $res1=mysql_query($update_faultLog); } } ?> <table width="625" border="0"> <tr> <td width="78">Select File <span class="style1">*</span></td> <td width="5">:</td> <td width="539"><input type="file" name="file" id="file"/></td> </tr> <tr> <td>Remarks <span class="style1">*</span></td> <td>:</td> <td><pre><textarea name="remarks" id="remarks" cols="45" rows="3"></textarea></pre></td> </tr> <tr> <td> </td> <td> </td> <td><input type="reset" id="bttnReset" name="bttnReset" value="Reset" onclick="Reset()"/> <input type="button" id="bttnAdd" name="bttnAdd" value="Add" onclick="addEdit()"/></td> </tr> </table> Its work at localhost but not when i put at server... please help me... Thank You Hello, I made a website, with 3 lang on it, and site works fine (localhost) but when I upload it, default lang is EN and whenever I change lang on the web, let's say from EN to FR, page goes on that lang in this case on FR and redirect me on home page and all text on site is on FR, that's ok, but after that, when I try to click on let's say about us, then on it's own change it back to default lang, and show me that page (about us) but on default lang... Here is sample of code how it's look... This is select.php and I include_once this file on every page... <?php session_start(); header('Cache-control: private'); // IE 6 FIX if(isSet($_GET['lang'])) { $lang = $_GET['lang']; // register the session and set the cookie $_SESSION['lang'] = $lang; setcookie("lang", $lang, time() + (3600 * 24 * 30)); } else if(isSet($_SESSION['lang'])) { $lang = $_SESSION['lang']; } else if(isSet($_COOKIE['lang'])) { $lang = $_COOKIE['lang']; } else { $lang = 'en'; } switch ($lang) { case 'en': $lang_file = 'lang.en.php'; break; case 'fr': $lang_file = 'lang.fr.php'; break; case 'de': $lang_file = 'lang.de.php'; break; default: $lang_file = 'lang.en.php'; } include_once 'lang/'.$lang_file; This is lang.en.php... $lang = array(); // menu $lang['txt1'] = 'Home'; $lang['txt2'] = 'About Us'; $lang['txt3'] = 'Services'; $lang['txt4'] = 'Contact'; It's the same for other two languages... and I simply put in index.php this... <ul> <li><a href="index.php"><em><b><?php echo $lang['txt1'];?></b></em></a></li> <li><a href="about.php"><em><b><?php echo $lang['txt2'];?></b></em></a></li> <li><a href="services.php"><em><b><?php echo $lang['txt3'];?></b></em></a></li> <li><a href="contact.php"><em><b><?php echo $lang['txt4'];?></b></em></a></li> </ul> Let's say again, this kind of code works fine on localhost, but on web not... Any idea why? Thank you. Cheers. Is there a reason why on my local machine with php, my login system works, but then when I upload my files and test it on my web host, the login system doesn't work properly. I'm using the same php version on my local machine and on my webhost, so I don't understand why it wouldn't work the same. When I try logging in on my webhost, everything processes as normal when a correct user/pass combo is found in the database, however, my session just doesn't seem to be saved, and therefore I won't be logged in. It'll end up refreshing to the home page (as I have it setup), but it won't show me as logged in. Is there something special I need to do in order for the session to be stored correctly? (I realize I haven't pasted any code, but I'm not sure exactly how much code would be needed for me to show in order to resolve the issue). Following a tutorial on udemy, i tried to learn the very basics of mvc structure. I built the same project on my local server and it worked without giving me any error. but when i tried it on live server. its not working as it should. not showing any error. I tried to figure out the problem and found that for every page loading, it stops at the same line in my main.php file. <?php require($view); ?> starting from the above line. it stops. i came here to share my problem but i am unable to upload my files here. if there is a way to upload and share my files, please guide. zip file size of the whole project is 31.6 kb Is there any php function I can test how fast my server is performing, like how fast its carrying out a certain action so I can see its resource usage. I created this to test the connection to my ms sql server with a web page. I can connect with isql with out fail.
when I open this I get
PHP SQL Test
END PHP SQL Test
I was expecting to get sql data between the above lines. What am I doing wrong.
<html> <head> <title>PHP SQL Test</title> </head> <body> <p> PHP SQL Test </p> <? $conn =odbc_connect("datasource","user","password"); if(!$conn) { exit("Connection Failed: " . $conn); } $sql="SELECT top 10 * from WIP_master"; $rs =odbc_exec($conn,$sql); print_r($rs); if(!$rs){ exit("Error in SQL"); } odbc_close($conn); ?> <p> End PHP SQL Test </p> </body> </html> I have created a script (single file) that works fine when testing it alone, but when included it doesn't and rest of page is blank. What could cause this? Is this because of some "mismatch" between the queries, variables used on the included file and the existing file? What I'm trying to accomplish is your average session login w/ a cookie-based "remember me" feature. I can log in fine, I can set cookies, I can access those cookies, and I can use that data to log in just as if the user had logged in manually. The problem is logging out. But the bigger problem is figuring out why. You see, it works perfect. It logs in and it log out, so long as I am outputting data to the page. I was outputting a session variable and the cookies I set to make sure they were all working right; and they were. But then as soon as I disable those echoes, all of a sudden it won't log out anymore. So then I turn them on to see what the data says and BAM, I'm logged out. I log back in fine, I log back out fine, so I turn em off again. I log in fine. I can't log out. I try multiple times. I close my browser and open a new one. Still logged in. I try a few more times, still logged in. I turn the output back on, load the page again and I'm logged out. So... WTF? (my code to follow) Code: [Select] <?php $objConnect = mysql_connect("localhost","","cgdfgdfg") or die(mysql_error()); $objDB = mysql_select_db("ffdfvbbd"); $pic2 = "SELECT * FROM images"; if (!isset($_GET['Page'])) $_GET['Page']='0'; $pic1 = mysql_query($pic2); $Num_Rows = mysql_num_rows($pic1); $Per_Page = 16; // Per Page $Page = $_GET["Page"]; if(!$_GET["Page"]) {$Page=1;} $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_Start = (($Per_Page*$Page)-$Per_Page); if($Num_Rows<=$Per_Page) {$Num_Pages =1;} else if(($Num_Rows % $Per_Page)==0) {$Num_Pages =($Num_Rows/$Per_Page) ;} else {$Num_Pages =($Num_Rows/$Per_Page)+1; $Num_Pages = (int)$Num_Pages;} $pic2 .="ORDER by thumbnailID DESC LIMIT $Page_Start , $Per_Page" ; $pic1 = mysql_query($pic2); $cell = 0; $link1 = "SELECT * FROM images"; echo ' <div id="tablediv"> <table border="0" cellpadding="17" cellspacing="0" class="table"> <tr>'; while($pic = mysql_fetch_array($pic1)) { if($cell % 4 == 0) { echo '</tr><tr>'; } if($cell == 2) { echo ' <td> filler </td>'; } elseif ($cell == 3) { echo ' <td> filler </td>'; } else { echo ' <td> <a href="/' . $pic["link"] . '.php"> <div class="image"> <img src="https://s3.amazonaws.com/images/' . $pic["pic"] . '.png" alt="' . $pic["alt"] . '" height="200" width="200" /> </div> </a> </td>'; } $cell++; } echo '</tr></table></div>'; ?>The code above works just fine. However, once I add a WHERE function,as shown below, I get a "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource" error. Code: [Select] <?php $objConnect = mysql_connect("localhost","","cgdfgdfg") or die(mysql_error()); $objDB = mysql_select_db("ffdfvbbd"); $pic2 = "SELECT * FROM images WHERE folder = 'blog' "; //WHERE FUNCTION IS HERE if (!isset($_GET['Page'])) $_GET['Page']='0'; $pic1 = mysql_query($pic2); $Num_Rows = mysql_num_rows($pic1); $Per_Page = 16; // Per Page $Page = $_GET["Page"]; if(!$_GET["Page"]) {$Page=1;} $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_Start = (($Per_Page*$Page)-$Per_Page); if($Num_Rows<=$Per_Page) {$Num_Pages =1;} else if(($Num_Rows % $Per_Page)==0) {$Num_Pages =($Num_Rows/$Per_Page) ;} else {$Num_Pages =($Num_Rows/$Per_Page)+1; $Num_Pages = (int)$Num_Pages;} $pic2 .="ORDER by thumbnailID DESC LIMIT $Page_Start , $Per_Page" ; $pic1 = mysql_query($pic2); My mysql table includes column thumbnailID folder link pic alt time The folder column is there so I can specify what I want in the page. Anyhow, why won't it work? FOR the CMS go to http://sandeepthapa.com.np/project/admin and login in username: user pasword: 123456 with both Chrome and IE. pleease and site is http://sandeepthapa.com.np/project/ it works fine with Chrome, but not with IE. please help me this is my first CMS . i am learning.. it i use joommla templetefor design. oz i am not a designer //..here is the code for process_login.php page <?php require_once("includes/session.php"); ?><?php require_once("includes/connection.php"); ?><?php require_once("includes/functions.php"); ?><?php if (logged_in()) { redirect_to("content.php"); } if (isset($_POST['submit'])) { if(!$_POST['username']) { echo ' Make sure u type in username'; } if( !$_POST['password']) { echo 'make sure you type password'; } $username = trim(mysql_prep($_POST['username'])); $password = trim(mysql_prep($_POST['password'])); $hashed_password = sha1($password); // Check database to see if username and the hashed password exist there. $query = "SELECT id, username "; $query .= "FROM users "; $query .= "WHERE username = '{$username}' "; //$query .= "AND hashed_password = '{$hashed_password}' "; $query .= "AND hashed_password = '{$hashed_password}' "; $query .= "LIMIT 1"; $result_set = mysql_query($query) or die(mysql_error()); if(!$result_set) {die("Database connection failed: " . mysql_error());} confirm_query($result_set); if (mysql_num_rows($result_set) == 1) { // username/password authenticated // and only 1 match $found_user = mysql_fetch_array($result_set); //echo $found_user['id']; $_SESSION['user_id'] = $found_user['id']; $_SESSION['username'] = $found_user['username']; //echo 'test query'; redirect_to("content.php"); } } else { echo 'error'.mysql_error(); } ?> </body> </html> I am having a very difficult time working out what to look at next. I have a page and it will not fopen a new file or an existing one to write. Even though I have a couple of other pages that copy into the same location without trouble. My PHP is 5.2.13 on W2k3 IIS. Here is the code that works; copy($myDir.$file, "\\\\Eeyore\\TempEDI\\".$file); Here is the code that fails; $fileN = "\\\\Eeyore\\TempEDI\\alley.txt"; $fh1 = fopen($fileN, 'wb'); I have tried with and without the new file already existing. I have checked NTFS permissions and the Share permissions. The webserver in use is remote to the files. I have turned on File level object access auditing on the Eeyore server (also win2k3) and the fopen call does not even hit the Eeyore server, I can see all other access to the file and folder but nothing from the page in question. Safe_mode and Opendirbase are both unset in php.ini. All I want to do is make a text file and add some lines of text, this problem is absolutely infuriating. Hello everyone, I'm having this problem which is really annoying, tried to solve it but couldn't, I write that code in PHPMyAdmin and it works great, but it doesn't work in the website it self ok long story short, there are three tables, hotels, cities, countries hotels include in addition to hotel info, 2 columns (city_id) and (country_id) Cities include id and name and also countries include id and name what I was trying to do, that when a person inputs a city or country name in the search form, it should get the hotels that exists in this city or country, but unfortunately it shows all the hotels in all cities and countries, although the pagination code for number of pages works just fine, it count the number of hotels in that city or country and show the number of pages correctly so here is the code for both for hotel search Code: [Select] class hotelManager { public function getHotel($where) { $where = isset($_POST['where']) ? $_POST['where'] : ""; $dbObj = new DB(); $sql = "select * from hotels where city_id = (select id from cities where name = '$where' ) or country_id = (select id from countries where name = '$where' )"; $result = MYSQL_QUERY($sql); $arr = array(); echo "<table>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td valign=\"top\" width=\"120px\">"; $rowid = $row['id']; $imageqry=mysql_query("SELECT * FROM `hotelphotos` where hotel_id='$rowid' LIMIT 1"); $image=mysql_fetch_array($imageqry); $imagename=$image['attachmentName']; echo "<img src=\"foxmaincms/webroot/files/small/$imagename\"/>"; echo "</td>"; echo "<td valign=\"top\">"; echo "<table> <tr> <td valign=\"top\"> <a href=\"hotels.php?id=".$row['id']."\" class=\"titleslink\">".$row['name']."</a> </td> </tr> <tr> <td class=\"text\" valign=\"top\"> ".$row['location']." </td> </tr> </table>"; echo "</td>"; echo "</tr>"; } echo "</table>"; for hotel pagination Code: [Select] <?php include("includes/hotelsManager.php"); $hotelObj = new hotelManager(); $where = isset($_POST['where']) ? $_POST['where'] : ""; if(isset($_POST['where'])) { $hotelObj -> getHotel($where); $per_page = 9; //Calculating no of pages $sql = "select * from hotels where city_id = (select id from cities where name = '$where' ) or country_id = (select id from countries where name = '$where' )"; $result = MYSQL_QUERY($sql) or die("<br />No Hotels found in this city, please check the city name and try again"); $count = mysql_num_rows($result); $pages = ceil($count/$per_page) ?> <div id="loading" ></div> <div id="maincontent" ></div> <ul id="pagination"> thank you in advance Good day dear community. I need to build a function which parses the domain from a url. I have used various ways to parse html sources. But this one is is a bit tricky! See the target i want to parse - it has some invaild Markup: http://www.schulministerium.nrw.de/BP/SchuleSuchen?action=644.0013008534253&SchulAdresseMapDO=194190 well what do you think - can i apply this code here <?php require_once('config.php'); // call config.php for db connection $filename = "url.txt"; // Include the txt file which have urls $each_line = file($filename); foreach($each_line as $line_num => $line) { $line = trim($line); $content = file_get_contents($line); //echo ($content)."<br>"; $pattern = '/<td>(.*?)<\/td>/si'; preg_match_all($pattern,$content,$matches); foreach ($matches[1] as $match) { $match = strip_tags($match); $match = trim($match); //var_dump($match); $sql = mysqli_query("insert into tablename(contents) values ('$match')"); //echo $match; } } ?> well i have to rework the parser-part of this script. I need to parse somway different - since i have other site here. Can anybody help me here to get a better regex - or a better way to parse this site ... Any and all help will be greatly apprecaited. regards db1 I have strange problem with SOAP. My file SchoolAPI look like that: <?php require_once('../require/constants.php'); require_once('../require/connection.inc.php'); class SchoolAPI{ private $dbh; public function __construct() { $this->dbh = new PDO(DRIVER.':host='.HOST.';dbname='.DB, USER, PASSWORD); } //function return all subcjects public function getSubjects(){ $sth = $this->dbh->prepare(' SELECT id, nazwa ROM subjects'); $sth->execute(); return $sth->fetchAll(PDO::FETCH_NUM); //return array(array("1", "subject1"),array("2", "subject2")); } //function return all classes public function getClasses(){ $sth = $this->dbh->prepare(' SELECT id, nazwa FROM classes'); $sth->execute(); return $sth->fetchAll(PDO::FETCH_NUM); //return array(array("1", "class1"),array("2", "class2")); } } ini_set("soap.wsdl_cache_enabled", "0"); $server = new SoapServer("SchoolAPI.wsdl"); $server->setClass("SchoolAPI"); $server->handle(); ?> wsdl file is named SchoolAPI.wsdl and look like that: <wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schema.example.com" targetNamespace="http://schema.example.com" > <wsdl:types> <xsd:schema targetNamespace="http://schema.example.com"> <xsd:complexType name="myarry2"> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="unbounded" name="row" nillable="true" type="xsd:string" /> </xsd:sequence> </xsd:complexType> </xsd:schema> <xsd:schema targetNamespace="http://schema.example.com"> <xsd:complexType name="myarray"> <xsd:sequence> <xsd:element minOccurs="0" maxOccurs="unbounded" name="table" nillable="true" type="tns:myarry2" /> </xsd:sequence> </xsd:complexType> </xsd:schema> </wsdl:types> <wsdl:message name="getSubjectsRequest"></wsdl:message> <wsdl:message name="getSubjectsResponse"> <part name="getSubjectsReturn" type="tns:myarray"/> </wsdl:message> <wsdl:message name="getClassesRequest"></wsdl:message> <wsdl:message name="getClassesResponse"> <part name="getClassesReturn" type="tns:myarray"/> </wsdl:message> <wsdl:portType name="SchoolAPIPortType"> <wsdl:operation name="getSubjects"> <wsdl:input message="tns:getSubjectsRequest"/> <wsdl:output message="tns:getSubjectsResponse"/> </wsdl:operation> <wsdl:operation name="getClasses"> <wsdl:input message="tns:getClassesRequest"/> <wsdl:output message="tns:getClassesResponse"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="SchoolAPIBinding" type="tns:SchoolAPIPortType"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="getSubjects"> <soap:operation soapAction="urn:SchoolAPI/getSubjects" style="document"/> <wsdl:input> <soap:body use="literal"/></wsdl:input> <wsdl:output><soap:body use="literal"/></wsdl:output> </wsdl:operation> <wsdl:operation name="getClasses"> <soap:operation soapAction="urn:SchoolAPI/getClasses" style="document"/> <wsdl:input> <soap:body use="literal"/></wsdl:input> <wsdl:output><soap:body use="literal"/></wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="SchoolAPI"> <wsdl:port name="SchoolAPIPort" binding="tns:SchoolAPIBinding"> <soap:address location="http://localhost:82/myschool/webservices/SchoolAPI.php" /> </wsdl:port> </wsdl:service> </wsdl:definitions> The problem is that correct data is returned olny by first function declarated in <wsdl:binding> section. In this example correct data will be return by getSubjects function, and function getClassses return null. However, if we change order and put getClasses operation first in binding section like this: <wsdl:binding name="SchoolAPIBinding" type="tns:SchoolAPIPortType"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="getClasses"> <soap:operation soapAction="urn:SchoolAPI/getClasses" style="document"/> <wsdl:input> <soap:body use="literal"/></wsdl:input> <wsdl:output><soap:body use="literal"/></wsdl:output> </wsdl:operation> <wsdl:operation name="getSubjects"> <soap:operation soapAction="urn:SchoolAPI/getSubjects" style="document"/> <wsdl:input> <soap:body use="literal"/></wsdl:input> <wsdl:output><soap:body use="literal"/></wsdl:output> </wsdl:operation> </wsdl:binding> then correct data will be return by getClasses function, and getSubjects will return null. Do you know what is going on? I do my best to solve this problem and I have no idea what is wrong... hi i have the script below which copies data from one table to another but will only insert new data update current data or delete old data from tempproducts to products then it will delete the tempproducts from the db however i keep getting this error: Warning: mssql_query() [function.mssql-query]: Query failed in E:\UpdateProducts.php on line 33 updateproducts.php Code: [Select] <?php include('../../otherscripts/functions.php'); $log = new Logging(); // create DB connection $host = "localhost"; $user = "user"; $pass = "pass"; $mydb = "db"; $db = mssql_connect($host,$user,$pass); //Select Database mssql_select_db($mydb); // delete all old data $sql0 = "SELECT * FROM tempproduct"; $sql1 = "INSERT INTO products SELECT * FROM tempproduct WHERE manf_part_no NOT IN (SELECT manf_part_no FROM products) AND supp_id NOT IN (SELECT supp_id FROM products)"; $sql2 = "DELETE FROM products WHERE manf_part_no NOT IN (SELECT manf_part_no FROM tempproduct) AND supp_id NOT IN (SELECT supp_id FROM tempproduct)"; $sql3 = "UPDATE p1 SET p1.avail_qty = t1.avail_qty, p1.cost_price = t1.cost_price, p1.rrp = t1.rrp, p1.date_added = t1.date_added, p1.description = t1.description FROM Products p1 INNER JOIN tempproduct t1 ON (p1.manf_part_no = t1.manf_part_no AND p1.supp_id = t1.supp_id)"; $sql4 = "TRUNCATE TABLE tempproduct"; //If tempproduct is empty done Execute Commands if it is full then execute commands $query = mssql_query($sql0) or die($log->lwrite('Failed to select for count from db')); $rowcount = mssql_num_rows($query); if($rowcount == 0){ $log->lwrite('Teh tempproduct am emptyish'); } else{ mssql_query($sql1) or die($log->lwrite('Failed to insert to db'.$sql1)); mssql_query($sql2) or die($log->lwrite('Failed to Delete from db')); mssql_query($sql3) or die($log->lwrite('Failed to Update db')); mssql_query($sql4) or die ($log->lwrite('Failed to TRUNCATE db')); } ?> if i run $sql1 command in the sql manager it runs fine and no errors occur? I have some code that works fine on my dev server but does not work on my production server. Dev server has PHP version 5.2.5 and production server has PHP version 5.1.6. This is the part of the code that isn't working on the prod. server: $xmlDoc=new DOMDocument(); $xmlDoc->loadXML($tmpDoc); $x=$xmlDoc->getElementsByTagName('link'); //get the q parameter from URL $q=$_GET["q"]; //lookup all links from the xml file if length of q>0 if (strlen($q)>0) { $hint=""; for($i=0; $i<($x->length); $i++) { $y=$x->item($i)->getElementsByTagName('title'); $z=$x->item($i)->getElementsByTagName('url'); if ($y->item(0)->nodeType==1) { //find a link matching the search text if (stristr($y->item(0)->childNodes->item(0)->nodeValue,$q)) { if ($hint=="") { $hint="<tr><td><a href='" . $z->item(0)->childNodes->item(0)->nodeValue . "' target='_blank'>" . $y->item(0)->childNodes->item(0)->nodeValue . "</td></tr>"; } else { $hint=$hint . "<tr><td><a href='" . $z->item(0)->childNodes->item(0)->nodeValue . "' target='_blank'>" . $y->item(0)->childNodes->item(0)->nodeValue . "</a></td></tr>"; } } } } } $tmpDoc is a variable that holds database information in xml form. It basically looks like this: $tmpDoc = $tmpDoc . "<link><title>" . $row['CustomerName'] . "****" . $row['Rep'] . "****" . $row['InstallDate'] . "****" . $row['PaidDate'] . "</title><url>accountPage.php?AccNum=" . $row['AccountNum'] . "</url></link>"; ...that is inside a while loop that loops through the rows returned by a query. Basically, as I said, the whole thing works fine on my dev server but on the production server it never makes it into the for loop so I guess the condition $i<($x->length) isn't being met. I'm at a bit of a loss here. Is there anything like the PHP version or Apache version that may cause the "->" operator to not work? The prod PHP version isn't that much older than my dev PHP version so I doubt that's the issue but it's about all I can think of. Thanks! |