Jump to content

unidox

Members
  • Posts

    557
  • Joined

  • Last visited

    Never

Everything posted by unidox

  1. How do I make it, so it only refreshes once, instead of every 5 sec looping. This is my code: var page = "incs/files.inc.php?p=admin_users"; function ajax(url,target) { // native XMLHttpRequest object document.getElementById(target).innerHTML = ''; if (window.XMLHttpRequest) { req = new XMLHttpRequest(); req.onreadystatechange = function() {ajaxDone(target);}; req.open("GET", url, true); req.send(null); // IE/Windows ActiveX version } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); if (req) { req.onreadystatechange = function() {ajaxDone(target);}; req.open("GET", url, true); req.send(); } } setTimeout("ajax(page,'up_users_res')", 5000); } function ajaxDone(target) { // only if req is "loaded" if (req.readyState == 4) { // only if "OK" if (req.status == 200 || req.status == 304) { results = req.responseText; document.getElementById(target).innerHTML = results; } else { document.getElementById(target).innerHTML="ajax error:\n" + req.statusText; } } }
  2. They both do the same thing, its just what you prefer
  3. if using utf-8, i think it only supports url names, as in if you visit a site with an accent mark on a letter, it converts it to the original letter.
  4. instead of your die function, use "die (mysql_error())"
  5. unidox

    COTW

    I was just wondering how I would go about having a user upload a wmv/mp4/ect file to the server, and it will play in an flash box like youtube's. How would I go about doing that? Thanks in advance
  6. How would I go about making it so forms cant be sql injected, and have html submitted in them.
  7. unidox

    Update

    Yea, I am not really familair with ajax, how would I go about doing it. I googled it, but found nothing
  8. unidox

    Update

    well heres my issue I have a mysql query with a while statement, so it prints all the users in a db and I have a popup to add/edit a user. And when the popup closes u have to refresh the page to have it show the updates. Is there a way I can have it refresh just the div, or even just the sql every x seconds? I have a switch statement for $_GET['page'] so the refresh cant use GET otherwise it shows the default. How will I go about doing this?
  9. Manually, or a form that edits the db data
  10. unidox

    Update

    Is there anyway I can have a live update of sql. So when someone adds a new user to the db in a popup, after they press submit, it updates the sql info that is being printed, every x seconds. So its like a live feed.
  11. unidox

    Update

    Ok, I will post there. Unless someone can help me here?
  12. unidox

    Update

    Is there anyway I can have a live update of sql. So when someone adds a new user to the db in a popup, after they press submit, it updates the sql info that is being printed, every x seconds. So its like a live feed.
  13. Here, just generate an activation code, how ever long you want it. Then store it in a db, and have another row in the db for activation = 0. So then make an activation page, so when the username and code match, it changes the 0 to a 1. Then the user will be activated.
  14. I have this query: mysql_query("UPDATE `pcp_users` SET username = '$username', password = '$password', email = '$email', conf = '1', display = '$dname', name = '$name', description = '$info', age = '$age', dob = '$dob', country = '$country', location = '$location', interest = '$interests', website = '$website', aim = '$aim', msn = '$msn', yim = '$yim', icq = '$icq' games = '$games' WHERE user_id=$user") or die (mysql_error()); But I am getting this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'games = 'None' WHERE user_id=1' at line 1
  15. Whats the line for font.php on 5? try using include, it handles errors better
  16. = sets something like a variable, a == means equal to, like if(1 == 1) { it will output if 1 is equal to 1
  17. I am having a problem. Here is the code: admin.php: <div id="users"> <? include("" . $site_url . "incs/files.inc.php?p=admin_users"); ?> </div> files.inc.php: $admins = MYSQL_QUERY("SELECT * FROM `pcp_users` WHERE level = 1"); $staff = MYSQL_QUERY("SELECT * FROM `pcp_users` WHERE level = 2"); $users = MYSQL_QUERY("SELECT * FROM `pcp_users` WHERE level = 3"); $validated = MYSQL_QUERY("SELECT * FROM `pcp_users` WHERE conf = 1"); $notvalid = MYSQL_QUERY("SELECT * FROM `pcp_users` WHERE conf = 0"); echo "<table width='100%'>"; echo "<tr><td colspan='4'>Admins:<br /></td></tr>"; echo "<tr><td width='30%'><b>Username</b></td><td width='30%'><b>Name</b></td><td width='30%'><b>Email</b></td><td width='10%'>Edit/Delete</td></tr>"; while($admins2 = mysql_fetch_array($admins)) { echo "<tr><td width='30%'>" . $admins2['username'] . "</td><td width='30%'>" . $admins2['name'] . "</td><td width='30%'>" . $admins2['email'] . "</td><td width='10%'>.</td></tr><br />"; } echo "</table>"; Output html: <div style="margin: 0px;" id="users"> <br><br><br><br><br><br><br><br><br><table width="100%"><tbody><tr><td colspan="4">Admins:<br></td></tr><tr><td width="30%"><b>Username</b></td><td width="30%"><b>Name</b></td><td width="30%"><b>Email</b></td><td width="10%">Edit/Delete</td></tr><tr><td width="30%">... Why is it adding all those <br>'s?
  18. I have this include: <? include("" . $site_url . "incs/files.inc.php?p=admin_users"); ?> and this is admin_users: case "admin_users": if(($_SESSION['admin'] == 1) && ($_SESSION['level'] <= $level['users'])) { ?> Admin Users. <? } else { // Login Failed echo "You dont have access"; } break; with the include, it doesnt read the session, and it says I dont have access, but if I go to the page like http://site.com/?p=admin_users it works fine. Whats wrong
  19. Here: sql.inc.php: $db_user = ""; // Username $db_pass = ""; // Password $db_database = ""; // Database Name $db_host = ""; // Server Hostname // DO NOT EDIT ANYTHING AFTER THIS LINE! $db_connect = @mysql_connect ($db_host, $db_user, $db_pass); $db_select = @mysql_select_db ($db_database); page.php: include("sql.inc.php"); $q = mysql_query("SELECT * FROM `table` WHERE group = '1'") or die (mysql_error()); $r = mysql_fetch_array($q); if($r['group'] == COOKIE/SESSION) { // has access } else { // Doesnt have access } Make sure you change the db info and the sql info to your server info.
  20. In the query just use ASC/DESC and then pick out the last/first 2 numbers.
  21. You can also use www.mootools.net which is ajax and javascript framework. Very easy to implement.
  22. Well it depends what you want, do you want a random string with alphanum, with a certain ammt of digits, or do you just want to choose from SK,JQ,RP
  23. Use javascript or mootools, and this isint in the write section.
×
×
  • 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.