-
Posts
159 -
Joined
-
Last visited
Everything posted by Tenaciousmug
-
Okay the reason I'm doing it this way is because I work locally and then transfer them to the production site. For some reason, this isn't working even though when I view the page source, it has the right URL, but when it's clicked it goes to a blank page, but when I copy and paste, it goes to the right page. Anywho, this is what I'm trying: <?php $homeURL = 'localhost:90/Elvonica'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Elvonica</title> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <link rel="stylesheet" type="text/css" href="<?php echo $homeURL; ?>/template/css/skySpirit.css" /> I didn't plug in the rest to ignore it since it's not part of the problem. It's printing: localhost:90/Elvonica/template/css/skySpirit.css, but when it's clicked, goes to blank page. When it is copied and pasted, it goes to the right page. I have a feeling you can't include PHP inside a link rel or any sort of that header information. If anyone could please help me how to do this, I would appreciate it. FYI: I did have just template/css/skySpirit.css and it worked until I go into a another directory like forums/index.php. Then it tries to go localhost:90/Elvonica/forums/template/css/skySpirit.css and it's not in there obviously. Thank you for anything that you can offer! I know how to do the includes with the dirname(__FILE__).
-
Ok I'm setting the error. I debugged my code and it's catching the phrase in the set_error() function. But it's returning NULL when I try to display it from the display_error() function. These functions are in the form class. I create a new instance of it on the register.php and I'm trying to grab the values. Here is my Form class (only showing the part you need to see): class Form { private $error; public function set_error($errmsg){ $this->error = $errmsg; return; } public function display_error() { $error = "<p style='color:red;'>".$this->error."</p>"; return $error; } } Then here is my register process: if(isset($_POST['submit'])) { if(isset($_POST['name']) && isset($_POST['username']) && isset($_POST['password']) && isset($_POST['password2']) && isset($_POST['email']) && isset($_POST['email2']) && isset($_POST['dob']) && isset($_POST['gender']) && isset($_POST['security'])) { if ($user->register_user($_POST['name'], $_POST['username'], $_POST['password'], $_POST['password2'], $_POST['email'], $_POST['email2'], $_POST['dob'], $_POST['gender'], $_POST['security'])) { $message = "User has been registered successfully."; } else { $message = $form->display_error(); } } else { $message = "Please fill out all parts of the form!"; } } It display the $message just fine when I call isset($message), but it won't display it when I assign it the form->display_error() value because it returns NULL. Thank you!
-
Why won't my code insert records into my MySQL Database?
Tenaciousmug replied to cooldood's topic in PHP Coding Help
$query = "INSERT INTO custpackage1000( id, FirstName, LastName, Country, State, City, ZipCode, Address, PayPalEmail, PhoneNumber, PrimaryEmail, WebsiteURL) VALUES ( '1', '$fname', '$lname', '$country', '$state', '$city', '$zcode', '$address', '$ppemail', '$pnumber', '$cemail', '$url')"; There. You forgot the address! Also, do not insert the id manually. thats what the auto increment is for. so delete the id and the $id from the insert statement. -
even if i change it to generate_hash in both places, it still gives me the error message: The capitalization isn't what's going on. Because in both places I had generateHash. But it just converted it to lowercase. Now I have lowercase, still same error. Anyone?
-
Ok this is my script so far: class User { function generateHash($password, &$saluti=null) { define('SALT_LENGTH', 15); $key = '!@#$%^&*()_+=-{}][;";/?<>.,'; if ($saluti=="") { $saluti = substr(hash('sha512', uniqid(rand(), true).$key.microtime()), 0, SALT_LENGTH); } else { $saluti = substr($saluti, 0, SALT_LENGTH); } return hash('sha512', $saluti . $key . $password); } function validate_user($username,$password) { $mysql = new Database(); $hashedPassword = generateHash($password,''); $ensure_credentials = $mysql->verify_username_and_password($username,$hashedPassword); if($ensure_credentials) { $_SESSION['auth'] == "yes"; header("Location: index.php"); } else return "That was not the correct username or password."; } } It gives me this error: Can anyone help me solve this?
-
Ah it's still not working, but I did fix that. Which is where the result variable is. So it's not returning anything, but when I put that in the sql statement in the phpmyadmin, it gives me the result I want. Of course, I change the LIKE '%{$searchSoftware}%' to LIKE '%hatch%'. EDIT Nvm. I'm dumb. xD I spelled ORDER BY wrong. Thank you!!!!
-
$sql = "SELECT softwareID,softwareName,softwareType,softwareDesc,softwarePath,ITOnly FROM software WHERE softwareName LIKE '%($searchSoftware)%' ORBER BY softwareName"; $result = mysqli_query($cxn,$sql) or die(mysqli_error()); There is something wrong with my LIKE statement because it's not pulling it since I'm either formatting it wrong or something. Can anyone catch it?
-
I've looked up many tutorials and still can't find an answer. D: I see this getting pushed down really far and just wanted to move it back up so maybe someone can still help me? It's only echoing "software/". It's not echoing the file i uploaded, but I checked the "name" attribute in the form and the name it's pulling and they both are the same..
-
Yeah you're right. It's only showing the target_path and not even the basename variable so it's obviously not grabbing it. Ok here is the HTML part for my file upload: <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Software Upload:<br /> <input name="softwarepath" type="file" /><br /> And the PHP: $target_path = "software/"; $basename = strtolower(basename($_FILES['softwarepath']['name'])); $target_path = $target_path . $basename; echo $target_path; It won't echo the target_path though..
-
Darn. I thought that would give me an error message, but it doesn't give me any error message in my error_log either. :/
-
Anyone have any help on this? I can't seem to find anything on Google.
-
Ok, I have this working on another page from a long time ago, but it's not working right here: It gets past the if($num == 0) part, but when it's seeing if the files has been uploaded, it's not getting past that and it won't give me my error message too. So I have a feeling it's getting past it, but it's not uploading it into the software/ directory and not inserting it into the database. I get no errors in my error_log or my default errors I have set up under the variable, $message. $target_path = "software/"; $basename = strtolower(basename($_FILES['softwarePath']['name'])); $target_path = $target_path . $basename; $sql = "SELECT softwarePath FROM software WHERE softwarePath='$target_path'"; $result = mysqli_query($cxn, $sql) or die(mysqli_error()); $num = mysqli_num_rows($result); if($num == 0) { if(move_uploaded_file($_FILES['softwarePath']['tmp_name'], $target_path)) { $sql = "INSERT INTO software(softwareName,softwareType,softwareDesc,softwarePath,ITOnly) VALUES('$softwareName','$softwareType','$softwareDesc','$target_path','$ITOnly')"; mysqli_query($cxn,$sql) or die(mysqli_error()); header("Location: search_software.php"); } } else { $message = "There is already a file with that name."; }
-
$(document).ready(function() { $(".alert").click(function() { { var id = $(this).attr("id"); alert(id); $(id).dialog(); return false; } }); }); Ok it's alerting the id AFTER it alerts an undefined.. so it alerts "undefined" and then "5" or whatever the number may be. What am I doing wrong?
-
Nevermind, PHP changed their way of showing errors. I'm looking at the error_log file. I should have been doing this the whole time. I just didn't know they didn't display them right in the browser anymore. Thanks! I was adding an extra ")" onto the variables I was creating in the while loop.
-
Oh wow... I can't believe I did that. I'm sorry. I never did that before. I'm so retarded. xD Here is my updated code: $sql = "SELECT alertID,alertName,alertMessage,activateSubj,activateBody,deactivateSubj,deactivateBody FROM alerts ORDER BY alertName"; $result = mysqli_query($cxn, $sql) or die(mysqli_error()); while ($row = mysqli_fetch_assoc($result)) { $alertID = $row['alertID']; $alertName = stripcslashes($row['alertName']); $alertMessage = stripcslashes($row['alertMessage'])); $activateSubj = stripcslashes($row['activateSubj'])); $activateBody = stripcslashes($row['activateBody'])); $deactivateSubj = stripcslashes($row['deactivateSubj'])); $deactivateBody = stripcslashes($row['deactivateBody'])); echo "<div class=\"alert\" style=\"border:1px solid #000;border-radius:5px;padding:12px;\">"; echo $alertID."<br />"; echo $alertName."<br />"; echo $alertMessage."<br />"; echo $activateSubj."<br />"; echo $activateBody."<br />"; echo $deactivateSubj."<br />"; echo $deactivateBody."<br />"; echo "</div>"; } Still giving me a blank screen. I don't understand why no parse errors or anything will pop up like they usually do. It's giving me a rough time debugging my scripts. Anyway, the stripcslashes() are there because I had to strip the \ from when I escaped the string when inputting it into the database with real_escape_string().
-
Ok, the sql seems to be working fine, but when I go into the while loop, it gives me an internal error 500 and doesn't load anything. It just shows me a blank white screen: $sql = "SELECT alertID,alertName,alertMessage,activateSubj,activateBody,deactivateSubj,deactivateBody FROM alerts ORDER BY alertName"; $result = mysqli_query($cxn, $sql) or die(mysqli_error()); while ($row = mysqli_fetch_assoc($result)) { $alertID = $row['alertID']; $alertName = stripcslashes($row['alertName']); $alertMessage = stripcslashes($row['alertMessage'])); $activateSubj = stripcslashes($row['activateSubj'])); $activateBody = stripcslashes($row['activateBody'])); $deactivateSubj = stripcslashes($row['deactivateSubj'])); $deactivateBody = stripcslashes($row['deactivateBody'])); <div class="alert" style="border:1px solid #000;border-radius:5px;padding:12px;"> echo $alertID."<br />"; echo $alertName."<br />"; echo $alertMessage."<br />"; echo $activateSubj."<br />"; echo $activateBody."<br />"; echo $deactivateSubj."<br />"; echo $deactivateBody."<br />"; </div> }
-
Ok I've been staring at this for the past 2 hours and I can't get it. I'm getting super frustrated. I'm trying to make a graphic go from image 1 to 2, then 1, then 0 and then back to 1 then 2, etc. So 1,2,1,0,1,2,1,0. I'm starting that process when they click a button called "Start Dancing".. It won't even start dancing at all when I click the button. I don't know what's not reading and what is... Here is my HTML: <p><img id="animation" src="fatcat1.gif" alt="Fat Cat Dancing" /></p> <form> <fieldset> <button type="button" name="run" onclick="startDancing();">Start Dancing</button> <button type="button" name="stop" onclick="clearInterval(begin);">Stop Dancing</button> </fieldset> </form> And here is my Javascript: /* <![CDATA[ */ var cats = new Array(3); var fatCat = 1; var begin; cats[0] = "fatcat0.gif"; cats[1] = "fatcat1.gif"; cats[2] = "fatcat2.gif"; function dance() { if (fatCat == 1){ ++fatCat; $("#animation").src = cats[fatCat]; } else if (fatCat == 2){ --fatCat; $("#animation").src = cats[fatCat]; --fatCat; } else if (fatCat == 0){ ++fatCat; } function startDancing() { if (begin){ clearInterval(begin); begin = setInterval("dance()",200); } } /* ]]> */ PLEASE help!
-
Here is my code: $sql = mysqli_prepare($cxn,'SELECT userId, salty, password FROM members WHERE userName=?'); mysqli_stmt_bind_param($sql,'s',$userName); mysqli_stmt_execute($sql); mysqli_stmt_bind_result($sql,$userId,$salty,$pass); echo $userName; echo $userId; echo $salty; echo $pass; What is happening is when I plug that query into the phpmyadmin, it pulls the data perfectly. But when I put it in my script and do the bind_result() function, it is getting a 0 userId and null salty and pass.... It acts like it's not grabbing any data. Am I doing this wrong or is the order I'm doing it wrong? Thanks for the help!
-
Those are parantheses. o.o And I know they mean something in PHP. That's why I'm using them 0.o I don't see your posts useful at all. They are just staying obvious things I already have. () - parantheses. {} - curly braces [] - brackets. Terminology helps when explaining something to people.
-
xyph, what the heck are you talking about? I'm not using brackets.. o.o
-
39. if(isset($_POST['submit'])) 40. { 41. if(!(empty($name) && empty($username) && empty($password) && empty($password2) && empty($email) && empty($email2) && empty($gender) && empty($security) && empty($adminpw))) 42. { 43. if($password == $password2) 44. { 45. if($email == $email2) 46. { That is line 39 - 46. There is no error message. But whenever I submit the form WHILE leaving $name blank, it still goes through and inserts it into the database leaving it blank D: And then if I put line 41, like this: 41. if(!empty($name) && !empty($username) && !empty($password) && !empty($password2) && !empty($email) && !empty($email2) && !empty($gender) && !empty($security) && !empty($adminpw)) It won't go through AT ALL and says "You left a lot of fields blank (my own echo message)".
-
But NOW, it's not posting the form at ALL. It keeps saying that error message over and over again. This is what I have: if(!empty($name) && !empty($username) && !empty($password) && !empty($password2) && !empty($email) && !empty($email2) && !empty($gender) && !empty($security) && !empty($adminpw))
-
Ohh I gotcha nethnet! I understand where you're coming from. And xyph... you need to read my first post o.o
-
This is the code I have: if(!empty($name)) || (!empty($username)) || (!empty($password)) || (!empty($password2)) || (!empty($email)) || (!empty($email2)) || (!empty($gender)) || (!empty($security)) || (!empty($adminpw)) I know it's wrong because it's giving me this error: But I searched everywhere on coding forums and guides and I can't... find the OR in an IF statement that works. I know it's that symbol, but I can't combine it with the !empty() function. Already tried this as well: if(!empty($name) || !empty($username) || !empty($password) || !empty($password2) || !empty($email) || !empty($email2) || !empty($gender) || !empty($security) || !empty($adminpw))
-
Wowww never new about Firebug. Figured out my problem immediately! Thanks for that. But I also have another question. You know how I'm using the onclick? Well I literally have to CLICK the button for it to work. When I press enter, it actually leads to validation.php?password=whatever... How do I make it so that even if I hit enter or click the button, it will make it work properly and not lead to the .php url?