Jump to content

sd9sd

Members
  • Posts

    52
  • Joined

  • Last visited

    Never

Everything posted by sd9sd

  1. that's true...it isn't secure...but nice to know that. btw, anybody knows that maximum length of a variable that can be passed in a $_POST or $GET?
  2. Problem solved!!! Using GET in the form and in the PHP worked. Thanks markjoe! Lemme guess...if there are two parameters that have to be passed, and you want only one of them to be shown on the addressbar, you can receive one of them as $_GET['user'] and the other as $_POST['password'] Am I right unkwntech?
  3. oh...got it...placing the post before the get was the problem..I'll get back after attempting a solution.
  4. Got it myself...the javascript has to be configured to send a query to php <script language="JavaScript" type="text/JavaScript"> <!-- function MM_jumpMenu(targ,selObj,restore){ //v3.0 var tagValue=selObj.options[selObj.selectedIndex].value; var stringCarryingQuery=tagValue.substring(0,tagValue.indexOf(" (")); var outputString=targ+".location='"+"a.php?tagSelection="+stringCarryingQuery+"'"; //document.write(outputString); eval(outputString); //if (restore) selObj.selectedIndex=0; } //--> </script> for <select name="tagSelection" onChange="MM_jumpMenu('self',this,0)">>
  5. Hi, I've got some html for a combobox: <td><form name="form1"><div align="center"> <select name="menu1" onChange="MM_jumpMenu('parent',this,0)"> <option>tag (23)</option> <option>tag (3)</option> <option>By Title</option> <option selected>Show All (92)</option> </select> </div> </form></td> I have a php file which echoes the html file to display it. I'm using this code for the php file to call itself: $path = empty($_SERVER['PATH_INFO'])?$_SERVER['PHP_SELF']:$_SERVER['PATH_INFO']; What I need is that when an option in the combobox is chosen, the option chosen should appear in the addressbar as a query string OR it should be available as a $_POST variable so that my php file should be able to capture it as either $_GET['id'] or $_POST['id'] Currently what's happening is: when an option is selected the php file calls itself, but the option chosen gets added to the address and it gets shown like www.site.com/optionChosen. I don't have a separate function to handle the MM_jumpMenu, but when I choose the option, how can I avoid it appearing in the addressbar and to capture it as a GET or POST?
  6. but it was not showing in the addressbar when it was a $_GET.
  7. erm..that's where the problem is. When I have a GET in the html, the query string shows up in the addressbar, but the toon does not get updated (which means that the toonValue isn't captured). So I changed the $_POST["toonValue"] to $_GET["toonValue"] and now the toonValue variable is captured, but the query string isn't shown in the addressbar.
  8. When I enter a value into the form and press enter, the php file calls itself and the form value is sent as a query string. The problem is that the query string doesn't get displayed in the addressbar. The strange thing is that when I used the same code earlier, it used to work. But ever since I've used a css file to change colour of the text, it stopped showing the query string. I don't think the css could have affected it, but I need the query string to be shown on the address bar like so: www.somesite.com/index.php?id=4 Any pointers? This is the piece of form HTML code <form name="form1" method="post" action="<TOONVALUEACTION>"> <span class="biglinks"># </span> <input name="toonValue" type="text" id="toonValue" size="6" value="<TOONVALUE>"> </form> And this is the last part of the php that replaces the TOONVALUEACTION string: if (file_exists("abc.html")) $template = implode("", file("abc.html")); //---for the php file to call itself $path = empty($_SERVER['PATH_INFO'])?$_SERVER['PHP_SELF']:$_SERVER['PATH_INFO']; $id=$_POST["toonValue"]; if ($id=="") $id=$_GET["id"]; $template = str_replace("<TOONVALUE>",$id,$template); $template = str_replace("<TOONVALUEACTION>",$path,$template); echo $template;//displays the page
  9. if your host provider doesn't allow remote access, one option is to move the remote domain onto the same server as the local domain. This way, you'll be able to access the database from both sites as localhost.
  10. Darn! isn't there ANY way to access the database then? I hoped that php would have a function like send_query("www.nothing.com/called.php?id=1"); But they haven't provided any such function either. Any ideas please? I need both websites to access the same database.
  11. I hoped the "yay" word would be captured by the GET or POST...but something tells me that it wouldn't work like that...
  12. Thanks Bendude14....I tried including it like this... This is the caller.php file on www.something.com <?php include("http://www.nothing.com/called.php"); $id=$_POST["id"]; echo "id value is =$id"; $id=$_GET["id"];//so that it'd receive the value either by get or post echo "id value is =$id"; ?> and this is the code in called.php <?php echo "yay"; ?> But it gives an error saying: Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/LOGINNAME/public_html/caller.php on line 2 Warning: include(http://www.nothing.com/called.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/LOGINNAME/public_html/caller.php on line 2 Warning: include() [function.include]: Failed opening 'http://www.nothing.com/called.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/LOGINNAME/public_html/caller.php on line 2 id value is =id value is = I'm still only starting to understand how to use php code, so please bear with me...how is this include supposed to be done?
  13. Thanks lamez and DarkWater....I had an email conversation with the domain host (nettigritty). They say that they've disabled remote SQL access for the past five years due to security reasons. It's necessary for me to access it remotely coz both sites access the same database. I've been thinking of alternate options and one option seems to be to have a php file in www.nothing.com, which access the database and sends the info to the php file which calls it. The calling php will be in www.something.com. @Bendude: the error was suppressed with the @, but the main point is that I've used the exact same code for connecting to the database using localhost (while I was working on www.nothing.com). So the names are correct...I'm sure of it. Thanks for mentioning that logging in to the website isn't necessary...that helped.
  14. Done a lot of googling but the solutions didn't work. Thought I'd post it in a way which would help others as well as me. I'm using fictitious passwords and domain names, so let these not be confused with any constants. I'm working on a website called www.something.com My SQL database is on a domain called www.nothing.com I've logged into www.nothing.com with the username 'sam' and password 'abc'. I created a database named 'icecream'. In this database I created a table named 'tags'. I've got a PHP file which I'm running from www.something.com as http://www.something.com/testing.php This is the code I'm using to connect to the icecream database. $host="ftp.nothing.com"; $user="sam"; $password="abc"; $conn = @ftp_connect("$host"); if (!$conn) {echo("&result=0&");echo 'Error: Could not connect to ftp server';ftp_close($conn);exit;} $result = @ftp_login($conn, $user, $password); if (!$result) {echo("&result=0&");echo "Error: Could not log on as $user";ftp_quit($conn);exit;} $DB_SERVER="www.nothing.com"; $DB_USER="sam_owner"; $DB_PASS="abc"; $DB_NAME="sam_tags"; define("TBL_USERS", "icecream"); $connection = @mysql_connect($DB_SERVER, $DB_USER, $DB_PASS); if (!$connection) {echo "SQL error. Tag names couldn't be obtained";} $sc = @mysql_select_db($DB_NAME, $connection); I'm able to login to the nothing.com website but can't connect to the database. Could anyone be kind enough to tell me where I've gone wrong?
  15. Apologies...topic got solved faster here http://www.phpfreaks.com/forums/index.php/topic,204794.html
  16. Thanks themistral and marif4u! It worked....my mistake with the array. Thanks again Thanks whiteboikyle...that's one solution that'll be useful for me too. P.S: a friendly hint from me - you can try using $i++ in the for loop, instead of the $i=$i+1;
  17. I have a table like this: --------------------------------------- order | rating | name --------------------------------------- 0 | 54 | tom 2 | 34 | dick 8 | 45 | harry --------------------------------------- I need to get the contents of the 'order' column into an array like so: echo $orderNumbers[0]; //prints 0 echo $orderNumbers[1]; //prints 2 echo $orderNumbers[2]; //prints 8 This is the php code I'm using unsuccessfully: $query = mysql_query("SELECT * FROM `data`"); while($row = mysql_fetch_array($query)){$result=$row['order'];} $result=explode(",",$result); echo "length of array=".count($result)."<br>"; for($i=0;$i<count($result);$i++) {echo "$result[$i] <br>";} Could anyone show me the right way to get the data please?
  18. I have a table like this: --------------------------------------- order | rating | name --------------------------------------- 0 | 543 | abc 2 | 34 | dfwe 8 | 45 | ssf --------------------------------------- I need to get the contents of the 'order' column into an array like so: echo $orderNumbers[0]; //traces 0 echo $orderNumbers[1]; //traces 2 echo $orderNumbers[2]; //traces 8 This is the php code I'm using unsuccessfully: $query = mysql_query("SELECT * FROM `data`"); while($row = mysql_fetch_array($query)){$result=$row['order'];} $result=explode(",",$result); echo "length of array=".count($result)."<br>"; for($i=0;$i<count($result);$i++) {echo "$result[$i] <br>";} Could anyone show me the right query to get the data please?
  19. Thanks masterace14! it works. I was under the impression that a post is used whenever you don't want the query string to show up in the address bar. Guess it isn't that way after all
  20. Thanks interpim...but it doesn't work. The receiver file doesn't print out the hello word. Yes.
  21. Hi, I'm trying to execute a PHP file from another PHP file. I've tried writing my own code (below) but it didn't work. Also tried using the exec command, but couldn't get it to work. Could I have some guidance of how to make it work/ Sender PHP (the 'done sending message' also has to work) <?php $hello="yo"; echo "sending message<br>"; echo "receiverPHP.php?hi=$hello"; echo "done sending message<br>"; ?> Receiver PHP <?php $mssg = $_POST['hi']; echo "The message is $mssg<br>"; ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.