
PHP5000
Members-
Posts
31 -
Joined
-
Last visited
Everything posted by PHP5000
-
1. the fact that you removed my post and added a long and dull answer to a comment that you did not have th eballs to face proves you are full of sh.. 2. d umb a ss, just because somebody wants to see an example of a functioning code it does not mean he wants to copy and paste it you num bskull. Old windbags like you may make replies and say things that are wrong or not working. A working example proves that the answer is not waste of time. This is the last time I am wasting time in this idiotic gathering of knowitall windbags so save your answer for your fat as s you insufferable bore.
-
Frankly this site has broken the record of both these sites for useless and vague answers. In your last reply to another question you even had the nerve to say I do not have sense. For your information, just not agreeing with you and your way of doing things does not make a person "Not have sense". As you see in this useless reply your answers are incomplete. My question clearly says "FUNCTIONAL EXAMPLE". And what is this with MODERN way? If you are trying to answer a question stop being vague. If I needed such pretentious full of oneself answers I would listen to jordan peterson. And it seems like there are 3 people on this site to answer. How do I delete this useless account?
-
Hello I want to show an alert or confirmation when somebody click on "delete" button. There are many examples on line and I have read at least 10 posts on some exchange website which sadly has never worked for me (those of you who are old users of internet probably remember a stupid website called expertvillage. This expertexchange sites must be related). The code is pretty straight forward and it actually generate a confirm alert but no matter which option the viewer clicks it goes ahead and deletes (send the viewer to a page that deletes). Just as if there was no confirmation alert at all. I do not know JS and frankly never liked it, but I think it not working has more to do than just me not liking the language. Here is a code, any idea or suggestions is highly appreciated: <form action=deletetest.php method=POST> <input type=submit value=\"Delete records\" onclick=\"ConfirmDelete()\"> </form> <script> function ConfirmDelete() { return confirm("Are you sure you want to delete?"); } </script>
-
Many thanks to both of you. It worked like a charm.
-
Brand this would only work if I had a column saving the dates (date_created), which I do not. Also supposing I wanted to delete the records. Any idea how to adopt this notion to DELETE, specially without date ? Thanks in advance
-
Hi Any idea what is SQL command to select the oldest 20 records in a Mysql table? I know it can be done with reading the number of records and recording the oldest id and newest id and setting a range, but I am trying to find a more efficient and quicker way to do this. (In a single SQL command). Thanks in advance
-
Hi I have a simple form which contain a drop down menu for quantity. After quantity is selected a script does a cost calculation and value is shown. However the user should not be able to proceed without selecting quantity. I am getting all sorts of illogical outcomes after each change or correction I make. Initially the validation would just ignore the Quantity and check the second item. Then after some changes to the code, now it keeps asking for Quantity even after the user has selected from the list. Here is the code, do you see any errors? Thanks in advance. print "<script> function validateForm() { let xss = document.forms[\"frmCustomize\"][\"SQty\"].value; if (xss == \"0\") { alert(\"Please select quantity\"); return false; } var fffnnn = document.forms[\"frmCustomize\"][\"CCnumber\"].value; if (fffnnn == null || fffnnn == \"\") { alert(\"Please enter your card number.\"); return false; } </script>"; the form : print "<form action=M1.php method=POST id=C4 onsubmit=\"return validateForm()\" name=frmCustomize>"; // **************** QUANTITY ******************* print "<tr><td valign=top><b>Quantity:</td> <td valign=top> <select name=SQty id=SQty onchange=\"CalculateTotal()\"> <option value=0>Please select quantity</option> <option value=1>1</option> <option value=2>2</option> <option value=3>3</option> <option value=4>4</option> <option value=5>5</option></select></td></tr>";
-
Getting to the support people seem to be the bigger problem. I finally solved the problem with a lot of trial and errors.
-
Hello everybody I had posted a question about problems I had with setting session variables and received some answers which although did not solve the problem they were educational and useful. Session variables worked sometimes and did not work some other times without any changes to the code. Two days ago I changed the hosting company and moved all my files without any changes from the old host to the new one (IONIS). Now no session work at all! No log in, no shopping cart, no counter, nothing! The code is exactly as what it was before. So it must be the server. I am sure their tech support is going to know about PHP problem so I am asking here. What could be different from this server to the old one that stops all sessions and session variables? Thanks in advance
-
Thanks Barand
-
Hi Thanks for the replies. The printer is a small label printer assigned as default printer to the computer the viewer will use to see the page. Alternatively it could be put on the network with an IP. Pill the thread you linked shows how to generate a separate document, which could be done for each shipping label and then printing the label. I was trying to avoid having to go two steps for the users, which I guess you mean it is not possible with php. I will read more on print related commands of PHP and JS, meanwhile if you guys can think of a solution let me know. Thanks.
-
Hello everybody. What I am trying to do is add a button on a web page that clicking on it will send 3 lines of text (an address) directly to an assigned printer that prints labels. I recall from old days of using VB this was an easy task with that language. However I can not find any information about PHP or JS to do the same thing. Any ideas or examples would be highly appreciated.
-
Since I can not get each of you lovely people a beer let me share with you this:
-
jodunno thanks for your reply and being persistent in solving the problem. I corrected the redirect problem by removing all outputs and spaces. That solved one problem very well. The problem of sessions getting terminated by themselves still exist. (So redirect was not the cause of it.) I tested my pages at 9:15 this morning and everything was ok. At 9:20 I repeated the exact same tests with the same data and session does not work. In all years of my programming I have never seen such a thing. I am stating to think some crazy person in the hosting company is screwing with my code. I did not change anything from 9:15 to 9:20 so why is it not working now! Could disconnection from internet kill the sessions? A momentary disconnection is the only thing I can think of, although technically it shouldn't. Not only the session in progress is no longer working, I can not even create a new one while I can see Internet connection is working. So to summarize: what could prevent setting a new session if nothing is changed in code, browser, OS, username and password or anything else?
-
10000 Dank, lieber Freund. Ihre Hilfe ist von unschätzbarem Wert. Ich habe ein paar Probleme gelöst, nachdem ich Ihren Code gesehen hatte. Außerdem wird die Sitzung anscheinend beendet, wenn auf eine URL umgeleitet wird, die mit http:// beginnt. Nochmals vielen Dank.
-
form.php does start with <? Just above the session_start(); The only person who has access to this test page is me so the input will be correct This is made only to test. Which suggestion are you talking about? I think I have found the root of my problems. Every time a redirect is done the session goes off. I have no idea why or how, but this statement is based on many many tests. Maybe this point to something?!
-
Yes it does. My mistake when typing here. In the actual code it is correct. Here is example of two pages on my site which should work and doesn't. It requires session variable to work. I do not have access to a second hosting so I appreciate if somebody actually try and see if this works on their server or not. I am beginning to think we have server problems with my current host company (WHC.ca - avoid them at all cost). Theses are two pages. The first has a simple form that sends the value selected to the second page (Cart1.php) . The second page receives the value and generate a session variable with it. Then redirect back to the first page. We should see this session variable now but we don't. // ---- first page called form.php sends the variable to page called Cart1.php ---- <? session_start(); print "<html><body> <form method=POST action=Cart1.php> <select name=PQty1> <option value=->Please select quantity</option>"; for ($i=1;$i<=20;$i++) { print "<option value=$i>$i</option>"; } print "</select><input type=submit value=Add></form><br><br>"; print $_SESSION["PQty1"]; print "<br><br></body></html>"; ?> // ---- second page called Cart1.php registers the session variables and redirect back to form.php ---- <?php session_start(); print "<html><body>"; $PQty1 = $_POST["PQty1"]; $_SESSION["PQty1"] = $PQty1; print "</body></html>"; header("Location: form.php"); // complete the link to loction of page form.php or die(); exit(); ?> Do you see any errors?
-
Yes of course without it security would not work on any page.
-
Thank you for your replies. Let me give you an update: 1. I have been using the same techniques and similar codes for the past few years and this is the first time I am experiencing these problems with sessions. The major difference is that the laptop I am working on has dual boots (Win11 and Ubuntu). I am sure of the code. Something else must be the problem. There are known problems with dual boot computers (for example Win11 clock is always wrong) 2. I have done extensive (over 100) tests under different conditions. The problem is not limited to Firefox. When I use Librewolf (which is in the same family of firefox I must admit) the same problem happens too, under windows and Ubuntu both. 3. The reason I say it can't be the code is that sometimes the system works perfectly, then for no reason at all it does not. I am logged in as admin and can view different pages then suddenly I click on another page in admin menu and I get access denied which is an indication of session having been terminated. (Not the same page all the time. In fact the same page that I could see before now does not give access). To test I open another browser and log in and go to the same page (without touching the code) and everything works. This is driving me batty. I find no logic to it. Since requinix asked for it I will include the code maybe you guys can see something I am missing: I set the session variables in logging in page with: $_SESSION["AdmKeyy"] = "T54"; $_SESSION["AdmUserr"] = $Usrc; << username that just logged in. $_SESSION["Admlevell"] = B; << determines the level of access Then to check (on top of every protected page:) if ($_SESSION["AdmKeyy"] != "T54") { print "<font color=red><b>You are not authorized to view this section." ; exit(); } There is a log out page with the following code: session_unset(); session_destroy(); I am certain at some point session gets terminated (there are other session-dependent functions which stop working as well). I have checked my pages one by one to see what could cause it. (for example starting another session by mistake) There is none. I thank you in advance for taking the time to look into this. If you figure it out, and pass by Canada at some point, beer is on me.
-
Since you are asking let me explain. The answer I got was like somebody explaining the problems with his car, and ask if anybody had a solution, and somebody else telling him to get a book on car mechanics. Although this was a valid suggestion, it is not a solution, which is what I was hoping for. None the less thanks for offering it. I have been looking into the developer tools on the browsers (most online articles and videos are about Chrome for some reason.) Meanwhile problem is still there. I did some tests and it turns out that Firefox has this problem no matter what operating system I use. There are posts by other people on different forums and sites asking about it. It is not a cookie setting or coding problem, because the exact same code sometimes work and sometimes does not work on the same browser on the same OS. I have devised a solution to get around this problem for the code I am working on, but I like to find out why this is happening on Firefox. In case you are interested to know what I am trying to do: In a website there is an admin section and a person get access after logging in. This is supposed to set a session variable and a code on top of every page will check if this variable is set or not. If not access is denied. Without ability to set session variables the admin logging I am making is screwed.
-
Anybody else has any suggestions or solutions?
-
ok thanks
-
Thanks for the quick response. I have three questions now How x 3.
-
Good to see people are so cheerful and friendly. Gizmola thanks for the info. Generally speaking I code like an old craftsman building wooden toys. In this there is no right or wrong (and no sense is needed). Sometimes they work out fine and sometimes they need more tweaking, which makes the process more fun. Fortunately I only code for myself and I am a very good client
-
Hi In my php codes I start a session and set session variables for different things. They work perfectly well when I am viewing the page on a Windows computer. However when I use ubuntu on the same computer to see the same page not only none of variables are set but also the session does not exist. I noticed this by chance and it is quite puzzling because I always thought sessions ae set on the server. Any idea what the problem is and how to fix it? tx