
mnewberry
Members-
Posts
11 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
mnewberry's Achievements

Newbie (1/5)
0
Reputation
-
Yes, I have tried that.
-
> Where are you setting the $cusurl variables? I don't see them being defined anywhere. Earlier in the file. The first portion is the checkuser.php file and the second is on the actual registration form. When I change #user { cmd: "check", user: $("#user").val() } I get different results back. I am thinking I have this labeled wrong? When set to #user it will return 'Invalid User Id' When set to #cusurl it will return 'Not Available' even though it is. Just not sure what it should be based off the current: <?php include 'database.php'; foreach($_GET as $key => $value) { $get[$key] = filter($value); } $user = mysql_real_escape_string($get['user']); if(isset($get['cmd']) && $get['cmd'] == 'check') { if(!isUserID($user)) { echo "Invalid User ID"; exit(); } if(empty($user) && strlen($user) <=3) { echo "Enter 5 chars or more"; exit(); } $rs_duplicate = mysql_query("SELECT count(*) AS total FROM `users` WHERE `cusurl` = '$cusurl' OR `cusurl2` = '$cusurl2' OR `cusurl3` = '$cusurl3' ") or die(mysql_error()); list($total) = mysql_fetch_row($rs_duplicate); if ($total > 0) { echo "Not Available"; } else { echo "Available"; } } ?>
-
It is still doing it. Could it be something from the other end? <a href="#" STYLE="text-decoration:none" class="addspeech" rel="#speechbubble8">User</a>:<span class="required"> <font color="#CC0000">*</font></span><br /> <input name="cusurl" type="text" id="cusurl" class="required username" minlength="5" > <span style="color:red; font: bold 12px verdana; " id="user" > <input name="btnAvailable" type="button" id="btnAvailable" onclick='$("#checkuser").html("Please wait..."); $.get("checkuser.php",{ cmd: "check", user: $("#user").val() } ,function(data){ $("#checkcusurl").html(data); });' value="Check Availability"> </span>
-
Everything whether or not it is or is not available shows to be unavailable. <?php include 'database.php'; foreach($_GET as $key => $value) { $get[$key] = filter($value); } $user = mysql_real_escape_string($get['user']); if(isset($get['cmd']) && $get['cmd'] == 'check') { if(!isUserID($user)) { echo "Invalid User ID"; exit(); } if(empty($user) && strlen($user) <=3) { echo "Enter 5 chars or more"; exit(); } $rs_duplicate = mysql_query("SELECT count(*) AS total FROM `users` WHERE `cusurl` = '$cusurl' OR `cusurl2` = '$cusurl2' OR `cusurl3` = '$cusurl3' ") or die(mysql_error()); list($total) = mysql_fetch_row($rs_duplicate); if ($total > 0) { echo "Not Available"; } else { echo "Available"; } } ?>
-
Checking user level now not showing value in fields.
mnewberry replied to mnewberry's topic in PHP Coding Help
No that is the error code. I just double checked. Hoping to work through it more tonight. -
Checking user level now not showing value in fields.
mnewberry replied to mnewberry's topic in PHP Coding Help
Sorry many things going on to where I have not replied yet. Thank you to all who have given input so far. Let me try to explain it better than the first time. This is a form where once a user is logged in they are able to edit their information. Some information is supplied to all users and others of a higher user level have more (see more on the page). So I am using: <?php } if (checkUser()) { ?> To get their user level and if they meet the user level they see: <tr> <td><input name="" type="text" id="" value="<?php echo $row_settings['num1']; ?>"> </tr> <tr> <td><input name="" type="text" id="" value="<?php echo $row_settings['num2']; ?>"> </tr> <tr> <td><input name="" type="text" id="" value="<?php echo $row_settings['num3']; ?>"> </tr> And if not that area is just of course blank. The actual issue is they are not seeing what they already put into those fields. Say a question is 'my favorite color' and they have already answered blue. They text field is blank while 'blue' (the previously submitted answer) is actually sitting in that field in the MySQL database. If they were to edit this with 'red' it would change in the database but once again they would never see the answer from this page. I do believe the problem is I am closing out all the previous request too much, far, or whatever it would be with the <?php } ?> but it has to be there for the userlevel to work and stop where it needs to. So again the issue actually is the previously entered data is not inputing via value="<?php echo $row_settings['num1']; ?>" into its field and remains blank. So in this area do I just need to ping the database again and call for the fields once again between the: <?php } if (checkUser()) { ?> <tr> <td><input name="" type="text" id="" value="<?php echo $row_settings['num1']; ?>"> </tr> <tr> <td><input name="" type="text" id="" value="<?php echo $row_settings['num2']; ?>"> </tr> <tr> <td><input name="" type="text" id="" value="<?php echo $row_settings['num3']; ?>"> </tr> <?php } ?> This is probably something simple but I am not claiming to be an expert at PHP and hence why I am here. Oh I did turn on error reporting after posting this question (not sure why I didn't before). Here is what I am getting: Notice: Undefined variable: num1 in /****/****/file.php on line 170 This repeats for each field not showing. Again thanks. -
Checking user level now not showing value in fields.
mnewberry replied to mnewberry's topic in PHP Coding Help
It will give a 500 error without. -
Thanks for the help!
-
Thanks for the reply but now I am thrown off more. I need to check $name, $name2, and $name3 and below is what I have but is obviously only checking one. $rs_duplicate = mysql_query("select count(*) as total from users where user_name='$name' ") or die(mysql_error()); list($total) = mysql_fetch_row($rs_duplicate); if ($total > 0) { echo "Taken"; } else { echo "Available"; } }
-
Below I am checking a user level and if they are level one they see some of the form, and if level two they see additional options. What they have already filled out is to show in the text field. Before I was doing the user level check it worked fine. Even now if something is put in a field it saves in the DB but it will not show in the fields on the form. // Everyone sees <tr> <td><input name="" type="text" id="" value="<?php echo $row_settings['FieldA']; ?>"> </tr> <tr> <td><input name="" type="text" id="" value="<?php echo $row_settings['FieldB']; ?>"> </tr> // Check if level two and display if they are. <?php } if (checkUser()) { ?> <tr> <td><input name="" type="text" id="" value="<?php echo $row_settings['num1']; ?>"> </tr> <tr> <td><input name="" type="text" id="" value="<?php echo $row_settings['num2']; ?>"> </tr> <tr> <td><input name="" type="text" id="" value="<?php echo $row_settings['num3']; ?>"> </tr> <?php } ?> // Additional things everyone sees even level one. <tr> <td><input name="" type="text" id="" value="<?php echo $row_settings['num4']; ?>"> </tr> <tr> So even <?php echo $row_settings['num4']; ?> will not show/work after the <?php } ?> Any thoughts? Thanks in advance everyone.
-
Similar issue I am trying to work around. $q = "select AccountName from Accounts where AccountName = '$Accn'"; How can i check more than one field? Example: '$1','$2''; will not work. Thanks in advance.