Jump to content

Praetorian

Members
  • Content Count

    72
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Praetorian

  • Rank
    Newbie
  1. There is no code in the database. The database is what your code connects to. You need to have at least one table in your database to store user information. Username, password, email, whatever else you want to keep. You need one script that will give the user a form where they can create their username and password, and you'll want to check the database to see if those already exist.The login script would then just see if the information they give when they log in is correct. If it is, it logs them in. If not, then it gives them an error.If you don't know how to write a script that will do that, I suggest reading some tutorials on php.
  2. Okay that actually didn't work the way I wanted. Using that returnsC:\xampp\www\cms.com\public_html\cms_libraryWhen what I need is C:\xampp\www\cms.com\cms_libraryjustsomeguys answer was mostly correct though, just needed an extra dirname, since the folder I want is above my root directory. So the solution is.. $path = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'include';
  3. Thanks justsomeguy! That worked perfectly.
  4. I'm trying to write a script that will install itself on someones server (like a forum script). But I want most of the class files to exist above the public_html folder. So I need the script to be able to add them to the include path. I'm having trouble making that work though. I can make it work when the files are in the same folder as the file setting the include paths, but when I have them in separate directories (IE, a header file in the public_html directory setting the include paths, but for directories above the header file). Also, (and this part isn't a requirement) I'd like it to be compatible with both windows and linux, since I'll be building this on my localhost, but it will eventually be running on a linux server (most likely).It may be that I just don't understand how to use the ini_set/set_include_path functions correctly. Does anyone have a quick example of something they're using on their own scripts that works?Thanks in advance.
  5. Nevermind. I'm just stupid. Forgot to turn the type=submit to a type=button.
  6. I'm trying to pass more than one $_GET to a page using a javascript redirect, but it's not working. Here's the javascript.. <script language="javascript"> function deleteMe(href,name) { var answer = confirm("Are you sure you wish to delete \"" + name + "\"?"); if(answer == true) { location.href = href; } }</script> This is the link I'm trying to send to the next page.. <input type="submit" onclick="deleteMe('manage_pages.php?delete=<?= $id ?>&delete_page=<?= $name ?>','<?= $name ?>');" value="Delete Page" /> And the php on the next page to catch it.. if(!empty($_GET['delete']) AND !empty($_GET['delete_page'])){ $delete_page = pdo_query($cxn,"DELETE FROM pages WHERE id = ?",array($_GET['delete'])); unlink('../'.$_GET['delete_page'].'.php'); header("Location: manage_pages.php?edit_pages");}
  7. I'm trying to build a query to get all the columns from two different tables. I don't want to do a join, I just want to get all the info from both tables. Just doing "SELECT * FROM table1, table2 WHERE field1 LIKE %" Is not working. The field I'm comparing the % to is the same in both tables.Help please.
  8. Well........ apparently ........ (and mind you I feel like putting my head through a wall after finding this out)I had set the age field as an integer. Rather than just a varchar. And pdo turns everything into a string. So I think it was dying because it was a string when it was expecting an integer.
  9. Okay. Thanks.Off the top of your head, any reason you can think of that this might be happening? that's part of what's so confusing. There aren't any errors, the fields are all there, the permissions are set... It's driving me insane.
  10. (Yea, added the field, but the problem is still there.)How can I check that with pdo though? I don't know how to debug pdo. How can I display what information it's sending to the sql server and what's coming back?
  11. Okay. I found it. There was apparently a missing field in the table. One of the fields I was trying to add didn't exist yet. Though I find it ridiculous that that didn't cause an error. Thanks for trying to help folks.
  12. Doesn't matter. That's what the NULL is in the values. ID is auto-incrementing.
  13. Not just that, but there really are no errors. Which is what makes no sense. There should at least be a connection error, or something. But.. nothing. It just doesn't insert.
  14. I'll do that, but that can't be the problem. If the $_SESSION wasn't right, it would redirect the page, which it doesn't. And if the REQUEST_METHOD wasn't post, it wouldn't evaluate the if statement there and say "done".Is there a debugging I can do for pdo? Something that would tell me what it's doing? The problem has to be somewhere in the query..
  15. This one is about to melt my brain. I'm trying to insert a row, the username has permissions, the table name is correct, and yet... nothing. No errors... it just reloads the page, and doesn't insert the row. <?php session_start(); include 'includes/class.php'; if($_SERVER['REQUEST_METHOD'] == "GET") { if(!empty($_SESSION['admin'])) {echo <<< HTML <form method="post" action="insert.php"> Username: <input type="text" name="insert_user_name" size="30" /><br /> Email: <input type="text" name="insert_email" size="30" /><br /> Link Name: <input type="text" name="insert_link_name" size="30" /><br /> Character Name: <input type="text" name="insert_character_name" size="30" /><br /> Pronounce: <input type="text" name="insert_pronounce" size="30" /><br /> Character Age: <input type="text" name="insert_character_age" size="30" /><br /> Character Gender: <input type="text" name="insert_character_gender" size="30" /><br /> Character Race: <input type="text" name="insert_character_race" size="30" /><br /> Character Class: <input type="text" name="insert_character_class" size="30" /><br /> Hair color: <input type="text" name="insert_hair_color" size="30" /><br /> Diseases: <input type="text" name="insert_diseases" size="30" /><br /><br /> Physical description<br /> <textarea name="insert_physical_description" cols="50" rows="20"></textarea><br /><br /> Personality<br /> <textarea name="insert_personality" cols="50" rows="20"></textarea><br /><br /> Languages<br /> <textarea name="insert_languages" cols="50" rows="20"></textarea><br /><br /> Deity<br /> <textarea name="insert_deity" cols="50" rows="20"></textarea><br /><br /> Arsenal<br /> <textarea name="insert_arsenal" cols="50" rows="20"></textarea><br /><br /> Armor<br /> <textarea name="insert_armor" cols="50" rows="20"></textarea><br /><br /> Skills<br /> <textarea name="insert_skills" cols="50" rows="20"></textarea><br /><br /> Faults<br /> <textarea name="insert_faults" cols="50" rows="20"></textarea><br /><br /> Power<br /> <textarea name="insert_power" cols="50" rows="20"></textarea><br /><br /> Weaknesses<br /> <textarea name="insert_weaknesses" cols="50" rows="20"></textarea><br /><br /> Crystals<br /> <textarea name="insert_crystals" cols="50" rows="20"></textarea><br /><br /> Items<br /> <textarea name="insert_items" cols="50" rows="20"></textarea><br /><br /> Notes<br /> <textarea name="insert_notes" cols="50" rows="20"></textarea><br /><br /> History<br /> <textarea name="insert_history" cols="50" rows="20"></textarea><br /><br /> Sample Post<br /> <textarea name="insert_sample_post" cols="50" rows="20"></textarea><br /><br /> Race: <input type="text" name="insert_race" size="30" /><br /> Character Type: <input type="text" name="insert_character_type" size="30" /><br /><br /> <input type="submit" name="submit_insert" value="done" /> </form>HTML; } else { header("Location: index.php"); } } elseif($_SERVER['REQUEST_METHOD'] == "POST") { foreach($_POST AS $key => $value) { $key = preg_replace("/insert_/","",$key); $$key = $value; } $insert_character = pdo_query($cxn,"INSERT INTO census ( 'id', 'user_name', 'email', 'link_name', 'character_name', 'pronounce', 'character_age', 'character_gender', 'character_race', 'character_class', 'hair_color', 'diseases', 'physical_description', 'personality', 'languages', 'deity', 'arsenal', 'armor', 'skills', 'faults', 'power', 'weaknesses', 'crystals', 'items', 'notes', 'history', 'sample_post', 'race', 'character_type' ) VALUES (NULL,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", array($user_name,$email,$link_name,$character_name,$pronounce,$character_age,$character_gender,$character_race,$character_class,$hair_color,$diseases,$physical_description,$personality,$languages,$deity,$arsenal,$armor,$skills,$faults,$power,$weaknesses,$crystals,$items,$notes,$history,$sample_post,$race,$character_type)); if($insert_character) { echo "Done!"; } else { "Error"; } }?>
×
×
  • Create New...