
poofacer
Members-
Posts
12 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
poofacer's Achievements

Newbie (1/5)
0
Reputation
-
Can somebody see why Opera and IE cannot handle the cookies properly while Firefox can?
-
I sent all the arguments but Opera still handles the cookies in a funky manner.
-
Can someone shed some light on my post above this?
-
Yes ofcourse, or I couldn't log into this site I assume. But now that you mention it, I am using Opera Browser for Windows and it is causing the problem. I also tried in IE 6 and it has a similar problem. It is ok with localhost/index.php but not with localhost itself(doesn't show me logged in). Firefox is the only browser which interprets my code correctly. Another question, I haven't specified the type of HTML coding. ie. Transitional, Strict. I do not have the DOC TYPE header. Could this be tricking the browsers? PS: Firefox is too gangster.
-
My problem revolves around the setting of cookies. My sample website has a simple login with username and password fields. When I log in, the cookies are set. however when I return to Index.php(main page) or just type localhost (so the index part doesn't show up) it doesn't show me as logged in. The username and password fields should be replaced with the username and different user CP links. Only when I click on a link which uses the "?action=whatever" does the user CP show up. But every time I click on Home, it goes back to the empty fields. Why aren't my cookies being read at the Index.php? Here is my code. Yes there is some raw HTML above this code. But I don't think this should matter. I also tried the isset function which has the same behaviour. <?php $auth=$_COOKIE["auth"]; if($auth == "yes") { echo "// "."<B>".$_COOKIE["username"]." </B>"."//"; echo "<A HREF=\"javascript:void(0)\" onClick=\"window.open('stats.php','User Stats',config='width=400,height=200,scrollbars=yes')\"> Stats </A> // "; echo "<A HREF=\"javascript:void(0)\" onClick=\"window.open('memberlist.php','Members List',config='width=400,height=200,scrollbars=yes')\">Memberlist </A> // "; echo " profile //"; echo "<A HREF=\"logout.php\">[Log out]</A>"; } else { echo " <FORM method='post' action=\"logged.php\"><B>MEMBER LOGIN:</B> Username:<INPUT type='text' size='15' maxlength='30' name='username'> Password:<INPUT type='text' size='15' maxlength='30' name='password'> <INPUT type='Submit' VALUE='Go'> <A HREF=\"/?act=register\">register</A> <A HREF=\"/?act=forgotpassword\">forgot password?</A> </FORM> "; } Here is my code for placing the cookies from a different file(to avoid header errors). This is not the complete code. I omitted by database login information and SQL queries. <?php if ($num > 0) { setcookie("auth","yes",time()+3600); //USER AND PASS ARE CORRECT setcookie("username",$user,time()+3600); echo "you are logged in."; } else { echo "<B>Invalid Username or Password.</B>"; echo "you are not logged in"; } ?> Thank you for your time.
-
ooo thank you so much. yes it works now!
-
yea im new to javascript and i tried something similar, even a very simple php code inside of the script tags and the entire javascript disappears. I dont think this can be done like this. maybe this would work. <script language='javascript'> var menu5=new Array() </script> <? $linksx=mysql_query("SELECT * FROM links ORDER BY title"); while($links=mysql_fetch_array($linksx)) { $link_title = stripslashes($links['title']); ?> <script language="javascript" >menu5[</script> <?=$links['link_id']?><script language="javascript" >]='<a href="</script> <?=$links['link']?><script language="javascript> "></script> <?=$link_title?>[/url] <? } ?> so basically keep php and javascript as two different entities execute outside of one another. so probably you have to manipulate like that. check it out.
-
var options = new Array ("option1","option2", "option3","option4","option5", "option6","option7","option8","option9","option10"); for(var i=0; i<10; i++) { if(form.[b]options[i][/b].value == "") { ecount++; } } The above code is javascript. I have 10 input types with the names option1 to option10 which i generated using a for loop with PHP. My problem is that this part of my code is not working the way it should and the problem is the bold part. I want the for loop to generate those strings in the array in place of "options[i ]". but it doesnt seem to be proper syntax. i am new to js but have done C programming. If i test form.option1.value= "" it works perfectly. But i dont want to do that for all ten options and i am curious about why this doesnt work.
-
i think my problem is simple to solve but i am a beginner to javascript but not coding. <script type="text/javascript"> <!-- function validateanswer(form) { if (form.answer.value == "") { alert ("Please enter an answer!"); form.answer.focus(); return false; } return true; } //--> </script> So here is my javascript code between the head tags. this should alert me if my 'answer' field is empty. simple enough but it doesnt. onsubmit="return validateanswer(form);" I have this in my <form> tag before the >. so on submit the script should run. ok. my form action takes me to another page. does that matter? I dont think it does. What is wrong here? form.answer.value, the word 'form' here does this have to resemble my form name? I took this coding from a book but it doesnt seem to work. the alert doesnt execute. I have some php code in the file however it doesnt interfere. yes i do have js enabled. thanks in advance. help me debug.
-
Say I do this: <?php $test=3 ?> in a file called test.php, but I want it to carry the variable $test to another page called test2.php without sending $test to MySQL and retrieving it in test2.php. I am actually using forms and the number that is to be saved into $test is not a constant. How can I do this? is there a function such that retrieves a variable from a different page?
-
I think i have not configured PHP to MySQL. I am running windows. how can I configure it?
-
Ok i installed Apache 2.0, PHP 5.2.0 and MySQL 5.0 ok for functions in PHP to interact with MySQL like the mysql_connect(); function, what needs to be done to have this functionality? do i have to edit an .ini file or something? because here is what happens: <?php require($_SERVER['DOCUMENT_ROOT'] . '/config/ac_config.php'); mysql_connect($db_host, $db_user, $db_password) or die("poo"); echo "$db_host"; echo "connection made"; ?> I run this code. the require works. but when it gets to mysql_connect blanks out. Doesn't do anything. It wont get to the echo. However, if i place the echo before the mysql_connect(); it will echo, but will blank out at mysql_connect. What is wrong and why wont it execute the function? it wont even give me an error. just blank page. thanks.