Jump to content

dooper3

Members
  • Posts

    161
  • Joined

  • Last visited

    Never

Everything posted by dooper3

  1. The problem with doing this with the PHP script that you're making this ajax request to is that it's redirecting the ajax request, not the browser itself. You either need to perform the redirect with javascript after the ajax request by putting the following in the ajax callback: location.href = 'index.php'; Providing they've logged in correctly and you could do a different one if the login failed. Hope that helps
  2. Personally I would do as zeodragonzord suggests, however, if you want to leave your session intact as you've set it before, you could do as follows. You run a query like so: $result = mysql_query('SELECT * FROM users WHERE username = '.addslashes($_SESSION['username']).' LIMIT 1'); Then check if the result returned one row: if (mysql_num_rows($result) == 1) If so you get the data: $user_data = mysql_fetch_assoc($result); Then you do your if / else links: if ($user_data['usertypeid'] == 1) //do something else //do something else Overall it should look something like this: $result = mysql_query('SELECT * FROM users WHERE username = '.addslashes($_SESSION['username']).' LIMIT 1'); if (mysql_num_rows($result) == 1) $user_data = mysql_fetch_assoc($result); if (is_array($user_data) && $user_data['usertypeid'] == 1) //do something elseif (is_array($user_data) && $user_data['usertypeid'] == 2) //do something else else //do something for non-logged in users
  3. Well you could use a database table to store their last online date and time, then every time a webpage is loaded, check if that user is authorised, if they are then update the time they were last on to the current time. At the same time it checks whether they're registered it should also check whether the other people in the list have a time last online older than say, 5 minutes ago, and should remove those people, thus Only those around in the last 5 minutes will be in the table, and you can extract their usernames for your list of people online.
  4. Well assuming you're just wanting the one level of dynamic-ness (e.g. domain.com/page1, domain.com/page2 etc. not domain.com/page1/page2) you could use a .htaccess file and some simple PHP with a directory for the included files like so: .htaccess Options +FollowSymlinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . index.php [L] index.php //header goes here include('/pages/'.str_replace('/', '', $_SERVER['REQUEST_URI']).'.php'); //footer goes here Then you have a director called pages which has a file for each page (page1.php, page2.php etc). Easy. The htaccess sends all requests to the index.php file, which has the header and footer, and in between it includes the file from the pages directory that matches the bit of the url after the domain (minus the slash). Also, if you wanted it to do a 404 message for pages that weren't in the pages directory, you could adapt index.php to look like this: //header goes here $page = '/pages/'.str_replace('/', '', $_SERVER['REQUEST_URI']).'.php'; if (file_exists($page)) include($page); else print '<h1>Page not found</h1><p>The page you were looking for could not be found</p>'; //footer goes here
  5. Things to try: 1) How are you setting it? You should be using: set_time_limit(3000); or set_time_limit(0); 2) Is PHP running in safe mode? If so disable safe mode first otherwise there will be no effect. 3) I believe - though I may be wrong! - that you can only set this variable inside your php.ini file. Doing it in the script may not work. 4) Did you restart your web server (apache?!) after you modified php.ini (if you did)? If you didn't then the new settings may not be loaded.
  6. Are you actually displaying your table data to the public in an un-edited way like that? If so that is quite bad practice; especially if you have an incrementing unique index on the table (i.e. and ID field). Anyway. You can display the field contents as real hyperlinks if they are stored as real hyperlinks in the database. So that field would contain for example: <a href="/page/some-template" title="See Template">templates here</a> That way when you show the table contents, the data will be interpreted as HTML and a hyperlink will be shown.
  7. Thanks for the responses guys but no, I've no intention of putting the captcha code on each domain name (considering there's in excess of 150 of them, that would prove quite time consuming!), and I am aware of reCAPTCHA, but I do not want a third party CAPTCHA in this case, it has to be the php-based one I made. is there no other way of storing the hashed string generated by a CAPTCHA image other than using sessions?
  8. Hi, I am trying to set up a CAPTCHA Service to run across multiple domains, however with the traditional method of storing the hashed captcha string is by using HTTP sessions as I'm sure many of you know, but also, sessions do not work between domains, so I have no way of verifying the CAPTCHA (or indeed passing the information) from the CAPTCHA if I run it on another website. I must point out that it does work perfectly well on the website it's hosted on. Any ideas greatly appreciated. (Would cURL be an option?! I don't really understand cURL/never used it). Thanks.
  9. I'm not sure what that is, so I can't imagine I've done anything to affect how it works - as I say, it was working absolutely fine up until earlier today.
  10. For some reason my site has suddenly stopped working with the www in the url, it just doesn't communicate allegedly looking at the status bar in my browser. It was working fine until earlier today, and I'm stumped as to what's happened. The URL I prefer (which seems to have stopped working) is: http://www.fantasticode.com but the site is still working with: http://fantasticode.com Anyone got any ideas what's going on?! I'm truly stumped, I haven't changed the mod_rewrites or anything.
  11. Now it isn't really a class, just a function, but what would work and leave it much as before is taking the variables outside the quotes for the exec function, so just changing the exec line to the following: exec("ffmpeg -i -f {".$this->source."} {".$this->destination."}"); Oh, and leave off the () after "new convert" as we mentioned before.
  12. If you echo an array, it will just give you the word array, try using print_r() instead. You need to extract each row of data from the array using extract() If you show us a bit more code then we might understand the problem better.
  13. Forgive my ignorance, but surely "ORDER BY movieName" is an alphabetical sort...?
  14. 1 day, 8 hours and 58 minutes....
  15. What you want to do is mimic what would happen if a form was submitted using GET instead of POST, so to display the table of stuff you would do this: <?php $query="SELECT * FROM mytable ORDER BY id ASC"; echo("<table border=1> <tr><th>Column 1</th><th>Column 2</th><th>Delete?</th></tr>"); while ($row=mysql_fetch_array(mysql_query($query))) { extract($row); echo("<tr><td>$col1data</td><td>$col2data</td> <td><a href=\"$php_self?action=delete&id=$id\">Delete Entry</a></td></tr>"); } mysql_close(); ?> And at the top of your page, before the table is populated, have this... <?php if ($_GET['action']=="delete" && isset($_GET['id'])) { $query="DELETE FROM mytable WHERE id=$_GET['id'] LIMIT 1"; if (mysql_query($query)) { echo("Entry successfully deleted!"); } else { echo("Unable to delete entry!"); } } ?> That is of course a basic example and untested, but should give you a rough idea of what you need to do!
  16. As I said, I didn't test the javascript, it was merely to give you an idea... I think you haven't grasped that PHP is a server-side language, you CANNOT stop people submitting a search with less than 3 characters with PHP, as PHP has no control over the user's browser, however what you CAN do, which is what Joomla does, is look at what the user has submitted to search and THEN check if it's less than 3 characters and thus spit out an error or do what you want INSTEAD of going through and processing the search, but that won't stop them trying of course...
  17. Use quotes: $query = "UPDATE users SET high='$score' WHERE username='$username'"; mysql_query($query) or die('Error, query failed'); Other stuff to do... -check you are connected to the database -check the table columns "high" and "username" exist -check the variables $score and $username actually exist If all else fails, show us the actual error message
  18. Well if you manage to make the diary, the url will just be the link to the relevant page of the diary... I don't see the problem there.
  19. aha! Just realised what I did was wrong in the other board... try changing this line: $jf=new convert(); To this: $jf=new convert;
  20. They are right Jeeva, but I don't see the problem, surely you'll never have 10 values for n anyway, because very few people enter more than 3-5 words when performing a search, so there shouldn't be too much trouble...
  21. You can add an admin page that allows you to open and edit the .htaccess file... Look up fopen() and similar functions, as well as google searching mod_rewrite. You WILL still have to do some coding of the admin area to make this happen if you want to add it to your admin abilities.
  22. You are not declaring the variables inside the class, so I don't think it will work. Try this instead... <?php class convert { var $source; var $destination; function convert() { // this will create a .flv from .wmv // you can chnage the other parameters if you are an expert exec("ffmpeg -i -f {$this->source} {$this->destination}"); } } $jf=new convert(); $jf->source="cat.mpeg"; $jf->destination="cat.flv"; $jf->convert(); ?> That should work if it is loading the files correctly, but don't hold your breath, I haven't tested it. If not, there is an OOP forum, which may help a little more, as people in their are more familiar with classes and other OOP stuff.
  23. you could do something like set it as a hidden value in a form field, I don't know how you get the variable in javascript but you could do something like this: <script language="text/javascript"> function putinform(javascript_variable) { document.getElementById('hiddenformfield').value=javascript_variable; } </script> <form action="<?php $php_self ?>" method="post"> <input type="hidden" value="" id="hiddenformfield" /> </form> then just call the function when you are ready and put the js variable inside the function, then when you trigger the form to submit it will transfer the value of the variable through the hidden input field as $_POST['hiddenformfield']. Hope that helps.
  24. Look up the php mail function - http://www.php.net/mail There should be plenty of tutorials about it too if you google it, but php.net has some good examples usually.
×
×
  • 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.