Jump to content

Arbu

Members
  • Posts

    45
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Arbu's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. I've got a database of files which is kept on a server and for which I use MySQL. Each entry includes a user ID, a unique reference, and file data. I would like to now allow users to share files, in a similar fashion to how it's done on Dropbox. I'm trying to figure out what the format of the amended database will be. I have a separate database with the details of all users. I think: 1. The user ID should be removed from the files database. 2. The users database should have extra columns listing, by ID, (a) all files created by the relevant user (who remains the "owner" of the files, and is the only person who can delete them or invite other people to access them), (b) all files which the relevant user can view, and (c) all files which the relevant user can view and edit. I think each file should only appear in one of a, b and c. 3. To populate the list of files which are available for the active user I need to loop through each of a, b and c. I will also have to display who else can use the relevant file, so to do that I will also have to loop through the whole user database, not just the active user's entry in it. It will be fairly complicated to display, but Dropbox is my guide. I guess that's the thrust of it, but if anyone has any comments, I'd be pleased to hear them. Thanks.
  2. I have a web application which allows the user to have an account and store files under it. I'd like him to be able to share those files with other registered users, in a similar fashion to that done in Dropbox, except that he would never have to upload anything - the files are just created in the application. Can anyone give me any pointers as to how to do this? I guess it may not only be Dropbox that does this, so there may be a library or existing code that I can use. Thanks.
  3. Well, if a desktop browser is resized, the application won't work on that either. So the test is for the screen width. Anyway, my code seems to be working OK now: if (screen.width < 1150) { var amv2 = sessionStorage.getItem("amv"); if (amv2 !== 'true') { window.location = 'sorry.html';} }; It's in a script and I wanted to call it from other pages that don't include the whole script, but my function idea wouldn't work. Also the test for the variable amv2 being true required inverted commas around true to work. I don't know why. I set it to true, not 'true' after all. And for debugging the script I can just add a line to throw an error, and get the Chrome console to break on all errors.
  4. But the issue is the screen size, not whether it supports touchscreen. Tablets typically support touchscreen.
  5. I've got a web application which isn't optimised for mobile phone usage and I don't think it would every be practical to do it. But when I tell people about the application they always go and look it up on their phones. So I was thinking that I would have a page that explains, when they look on their phones, that it really isn't designed for use on a phone, but, if they really want, they can access it on their phone to get an idea of what the product looks like. This is proving a lot harder than I expected. I have some code which redirects from the main page to a warning page. But I can't debug it in the Chrome console because it only ever appears for a fraction of a second. When the user clicks on a link on the warning page, that is supposed to set a variable so that the phone knows not to redirect to the warning page next time the main page is shown. But every time it does redirect to the warning page, and I can't tell why it keeps doing this. I'm trying to debug it, but the console messages that I have inserted never seem to appear. Maybe they are there for such a short time that I can't see them. Anyway my code is below. Can anyone help? Thanks In init.js: redirectformobile(); function redirectformobile() { if (screen.width < 1150) { var amv = sessionStorage.getItem("amv"); console.log (amv); if (amv !== true) { console.log ("redirected"); window.location = 'sorry.html';} } } In the warning page: <body> <div class="outer"> <span> Sorry, this is a web application and it requires too much screen space to be displayed well on your device.<br><br> <span>Please use a pc instead to view it.<a href="javascript:history.back()"> Go back.</a></span><br><br> <span>If you would nonetheless like to view the application on your device, please click here. Operation will be difficult!<a onclick="allowmobileview()" href="index.php"> Take me to the site anyway.</a></span> </span> </div> </div> <script> function allowmobileview(){ sessionStorage.setItem("amv", true); } </script>
  6. I've got a few bits of php in my javascript. I understand it's better to minify my code. But if I use a javascript minifier for the whole lot I get "// Error : Unexpected token: operator (<)" where the php is. So what to do? Should I minify the php and javascript separately? Could take quite a while to go through it all. Thanks.
  7. Slightly disconcertingly, though, I find that Notepad++, which I use, doesn't show the code formatting colours when I put the inverted commas around the php. This makes it look as if the code won't work, although clearly it does.
  8. If you want to write a program on your own PC I don't understand why you wouldn't use vb.net or the like. Do people just want the program to operate through their browser? Anyway thanks for the link, I'll have a look. Actually I guess I can just use php instead. All I'm trying to do is make a cURL command so php ought to be adequate. Maybe Python is for full blown applications that run on the server. There's a handy converter here https://reqbin.com/req/java/c-w7oitglz/convert-curl-to-http-request
  9. OK, thanks. But then how do I actually use it? Presumably I have to put something in my file like I do with php: <?php.....?> I have looked over the Python tutorial and I can't see where it tells me this fundamental piece of information. It only seems to talk about using it on my own PC. Maybe I have to use a module and have my Python code separate from my other code? Edit: No it's not that. When I try that I get the message "non-JS module files deprecated".
  10. Arbu

    node.js

    You say that "Node.js uses JavaScript on the server". But your tutorial relates to setting up my own computer as a server and running node on that. I need to use the server from my hosting company. When I try to use node on my website I fall at the first hurdle. I get the error: "Uncaught ReferenceError: require is not defined". How do I ensure that node is running on my hosting provider?
  11. I have some data in the form "I-AHUSH" (it's a Paypal subscription reference). I'm saving it as a $_SESSION variable on the server. When I recover it and do the following, javascript insists on treating it as something to be evaluated. This causes an error. How do I stop it from doing so? You can see that I've tried forcing it to be a string. But that doesn't help. var s = String(<?php echo $_SESSION['subscriptionid'] ?>); Thanks
  12. I think I've got it. You have to specify type="button" for the button. Otherwise it's treated as if the type were "submit".
  13. Er, that's not so good because then none of the data is set to the server. But if I don't have it, the form seems to get submitted before the Paypal instructions are completed. I'd really like to understand what the trigger is for submitting the form. I had thought that it would be done by the user clicking a button with type="submit". But my button doesn't have this type. So what on earth is the trigger? Is it just the fact of hiding the form?
  14. The instructions I was using to do this are now in "quality review" (https://www.wikihow.com/Create-a-Secure-Login-Script-in-PHP-and-MySQL) so I guess I'll have to start again with another set of instructions. It seems incredibly complicated for something that many websites seem to do without any problems.
×
×
  • Create New...