Jump to content

jdock1

Members
  • Posts

    210
  • Joined

  • Last visited

    Never

Everything posted by jdock1

  1. Oh okay I see. Im about to upload it and test it out,but you said its hiding all the digits ill try to tweak it and see if I can come up with anything. Im pretty amazed that I found something that PHP just doesnt seem it can do. Ive been working on this for three days now searching and reading and coding and uploading and editing and reuploading and refreshing and overwriting god im getting so damn frustrated! This is something Im not going to give up on. This is an important part of my app that ive been writing for the past 8 months!!!
  2. Ok so Im about to test this. I have a few questions to better understand the code. $amt_type, can you explain that a little more? What if the string is not a percentage? What Im trying to do is get a value from a database. Each user has a random generated number from 100-300. I need one digit to be displayed. I love that you put a variable to set the characters that are obscured haha thats pretty cool. But yeah thats what im trying to do. Substr itself just doesnt work, I tried everything. It looks like this code will work great. So for line 1, $string would look something like this? <?php $fetchdata= mysql_fetch_array($result) $num= $fetchdata['fixednum']; # # // function obscure($num, $amt = 2, $amt_type = 'number', $obscure_char = '*') ?> Im really interested in this code and am determined to make it work! Thanks for all your help I really appreciate it.
  3. Sweet bro! Thanks. Looks like itll work. I havent testedd it yet, Im so tired just got off work Im going to test it in the morning Ill post here the results.
  4. Thanks! Thats what I was looking for. Im trying to use the php substr, but nothing is being echod. Idk. I probablyneed to use mysql substring, havent looked at it yet. But heres my code: <?php include_once('admin/includes/linkmysql.php'); $query= "SELECT * FROM userinfo WHERE USERNAME = '$uname'"; $result= mysql_query($query,$link); $fetchdata= mysql_fetch_array($result); $num= $fetchdata['fixednum']; ?> <fieldset><legend><b>Get Hint</b></legend> <form action="" method="post" /> <br> <br> <input type="submit" name="RequestSubstr" value="Get Hint" /> <?php if ($_POST['RequestSubstr'] == "Get Hint") { echo $num[strlen($num)-1]; } ?>
  5. Heres the complete code; <div class="content"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <b></b></font> <br/> <font style="font-size: 18px"> <br></br> <b>Cashout Requests</b><br/> </font> <font style="font-size: 16px"> <br> <br> </br></br> </font> <form action="" method="post" name="winners"> <?php $hostname2="localhost"; $username2="**********"; $password2="**********"; $databasename2="**********"; $link2 = mysql_connect($hostname2, $username2, $password2); mysql_select_db("$databasename2"); $query="select * from requests"; $result=mysql_query($query,$link2); $num_rows = mysql_num_rows($result); echo "<font style='font-size:20px'>Current unproccessed cashout requests: $num_rows \n</font><br><br>"; while ($row = mysql_fetch_array($result)){ echo "<font style='font-size: 16px'><b><u>User ID:</font></u></b><br>"; echo $row['user']; echo "<br><br>"; echo "<font style='font-size: 16px'><b><u>Date:</font></b></u><br>"; echo $row['date']; echo "<br><br>"; echo "<font style='font-size: 16px'><b><u>PayPal Email:</u></font></b><br>"; echo $row['paymail']; echo "<br><br>"; echo "<font style='font-size: 16px'><b><u>Comments:</u></font></b><br>"; echo $row['comments']; echo "<form action='' method='post'><br><br> <input type='submit' name='delete' value='User ID ".$row['id']." Paid' </form><br><br>"; echo "<img src='imgs/hr.png' alt='hr' />"; echo "<br>"; if(!empty($_POST['delete'])) { $delquery = "DELETE FROM requests WHERE id='".$row['id']."'"; if(mysql_query($delquery, $link2)) { echo "<font size='19px' color='#009933'>User deleted from request database.</font><br>"; } else { echo "<font size='19px' color='#009933'>Failed to delete user from request database.</font><br>"; } } } ?> </form> </table> <br /> <br /><br /><br /><br /><br /><br /><br /><br /><br /> </font> <div class="clear"></div> </div>
  6. I want to make a "hint" feature for an app ive been working on. Its a guessing game, and I want to be able to give out hints. Ok so say there is an answer in the database. Say the value is "firetruck". I want to retrieve that value, and obscure it, displaying only one or two letters that are in the word. Or, for a number, say 178, I want to display only one digit from it. Is this possible? Im sure it is, anything seems possible with PHP & Mysql. If so, how could I implement this? Trust me, I read the manuals. The manuals for both PHP and Mysql are so vast and a little advanced for my level.. then again im not complete novice and know the basics plus more of both.
  7. Actually, I just tried it, same thing happened. Echod the success message on every entry, and didint delete nothing. So I changed the query to instead of delete from requests where id =$_POST['delete'] to delete from requests where id = $row['id']... same thing, echod success message in every entry on the page, so i refreshed the page and it deleted everthing in the database. Ughhhhhhhhh now what!?
  8. Sorry, thought that was for php code. Heres the code in a better code view: $query="select * from requests"; $delquery="DELETE FROM requests WHERE id = '".$row['id']."'"; $result=mysql_query($query,$link2); $num_rows = mysql_num_rows($result); echo "<font style='font-size:20px'>Current unproccessed cashout requests: $num_rows \n</font><br><br>"; while ($row = mysql_fetch_array($result)){ echo "<font style='font-size: 16px'><b><u>User ID:</font></u></b><br>"; echo $row['user']; echo "<br><br>"; echo "<font style='font-size: 16px'><b><u>Date:</font></b></u><br>"; echo $row['date']; echo "<br><br>"; echo "<font style='font-size: 16px'><b><u>PayPal Email:</u></font></b><br>"; echo $row['paymail']; echo "<br><br>"; echo "<font style='font-size: 16px'><b><u>Comments:</u></font></b><br>"; echo $row['comments']; echo "<form action='' method='post'><br><br> <input type='submit' name='delete' value='User Paid' /> </form>"; if ($_POST['delete'] == "User Paid") { mysql_query($delquery,$link2); echo "<font size='19px' color='#009933'>User deleted from request database.</font><br>"; } echo "<img src='imgs/hr.png' alt='hr' />"; echo "<br>"; }
  9. Heres the code, I know its really messy but thats what Im most comfortable with. The deal is, I need to delete that entry only when I click the button. Im using that query to delete by id. $query="select * from requests"; $delquery="DELETE FROM requests WHERE id = '".$row['id']."'"; $result=mysql_query($query,$link2); $num_rows = mysql_num_rows($result); echo "<font style='font-size:20px'>Current unproccessed cashout requests: $num_rows \n</font><br><br>"; while ($row = mysql_fetch_array($result)){ echo "<font style='font-size: 16px'><b><u>User ID:</font></u></b><br>"; echo $row['user']; echo "<br><br>"; echo "<font style='font-size: 16px'><b><u>Date:</font></b></u><br>"; echo $row['date']; echo "<br><br>"; echo "<font style='font-size: 16px'><b><u>PayPal Email:</u></font></b><br>"; echo $row['paymail']; echo "<br><br>"; echo "<font style='font-size: 16px'><b><u>Comments:</u></font></b><br>"; echo $row['comments']; echo "<form action='' method='post'><br><br> <input type='submit' name='delete' value='User Paid' /> </form>"; if ($_POST['delete'] == "User Paid") { mysql_query($delquery,$link2); echo "<font size='19px' color='#009933'>User deleted from request database.</font><br>"; } echo "<img src='imgs/hr.png' alt='hr' />"; echo "<br>"; } That query doesnt work still, using the ID. It echos the message on each entry, and nothing is being deleted. How can I do this?? So stumped.
  10. Disregard that last post, I used NULL and its assigning ids now. Now, this should work just using $delquery="DELETE FROM requests WHERE user = '".$row['id']."'"; that way, it will only delete the entry with that ID? IDK, let me post the code....
  11. Your right, I quit coding for a few months and just started back up. Forgot all about that. I created id MEDIUMINT NOT NULL AUTO_INCREMENT but now I do not know how to insert an actual ID into the database. Its supposed to automatically insert and ID into the table during a query, but its not working. I do not know what to put the value as for that field?
  12. I have a bad way with words, so if the title doesnt make much sense nor my post, I apolagize! But I am using a while loop and mysql_fetch_array to echo all information in a table in mysql. With each entry, I have included a button that executes a delete query for that entry. $delquery="DELETE FROM requests WHERE user = '".$row['user']."'"; mysql_query($delquery,$link2); echo "<font size='19px' color='#009933'>User deleted from request database. When I click the button, the message is echod in every entry listed on the page, and nothing happens. I figured Id use delete from the username, so that way mysql will know which one to delete... but Idk when I think about it thats dumb and makes no sense. Im stuck. This side of the application im trying to make is the admin side where I can process requests. After I process the request I delete it from the database so I know I processed it. I have no idea what query to use for this. Anybody know how I could do this? Thanks
  13. i also tried $query2="update userdata set creditleft = creditleft - 15 where username = '".$_SESSION['login_name']."'"; mysql_query($query2, $link);
  14. Im trying to execute an update sql query, but its not working. IDK if I got the right query tho what i want to do is, when the form is submitted, subtract 15 from the value 'creditleft'. So say the value is 20 , i want to subtract 15 and get 5. Here is the sql query im using; $query2="update userdata set creditleft = - 15 where username = '".$_SESSION['login_name']."'"; mysql_query($query2, $link); I dont get any errors, just no output
  15. Ok, so there are two functions, one encrypts data, the other one must decrypt. But I do not know how to implement it to decrypt. I need to know how to use the second function (number_decrypt). I need it so I enter the encrypted string into a text field and it outputs the decypted string. I dont need the html, I just dont understand how to implement it. Can someone look at this for me and possibly tell me how I could achieve this? Heres the code: function number_encrypt($plain) { mt_srand ((double) microtime() * 1000000); $password = ''; for ($i=0; $i<10; $i++) { $password .= rand(1,1000); } $salt = substr(md5($password), 0, 2); $password = md5($salt . $plain) . ':' . $salt; return $password; } function number_decrypt($encrypted,$plain) { $stack = explode(':', $encrypted); if (sizeof($stack) != 2) return false; if (md5($stack[1] . $plain) == $stack[0]) { return true; } return false; } Thanks!
  16. Sorry, I meant in one row there are two values request_id and msg
  17. No.. I no all of that, I just dont know the SQL to use a search with mysql and displaying a row of data by entering the ID which is a value in the row. Say there are two rows, request_id & msg. The request ID is 28fj3k2. I enter that into a text field, I want to display the other value in the row of that table in the database. I jsut do not know the correct query for that. Anybody?
  18. Say a user puts in a support request, and for every request it generates a unqiue string, and enters it into the database. Ok, now say there is a text field, when the user enters their unique string and it finds a match, it displays the data along with it. How can I accomplish this? Im kind of new to mysql, but I know basic SQL. Would be great if somebody could point me in the right direction! Thanks
  19. I have no idea and there is no reason why this should not be working. im simply trying to add three variables into a database, and only one works. the other two do not work for any reason i can find. can someone point out my error, if any? code: <?php $date = date("Y-m-d"); $dbc = mysqli_connect('localhost', 'root', '', 'timer') or die('Error connecting to DB'); $query = @"INSERT INTO sessions (date, user, sessiontime) VALUES ('$date', '$user', '$sessiontime')"; $user = @$_GET['user']; $sessiontime = @$_GET['clock']; if (@$_GET['addDB'] == "Session Complete") { mysqli_query($dbc, $query) or die( '<br>Query string: ' . $query . '<br>Produced error: ' . mysqli_error($dbc) ); } ?> Form: <label for="user"><b><em>Your name: </b></em></label><br /><input type="text" name="user" value="Admin/User" /> <input id="clock" name="clock" type="text" value="00:00:0" readonly><br> <input id="startstopbutton" type="button" value="S t a r t" onClick="startstop();" style="font-weight:bold"><br> <input type="submit" name="addDB" value="Session Complete" /> See, all the variables match up!? I dont get what im doing wrong?
  20. depending on what the iframe is used for an AJAX repopulation of the innerhtml may be a better solution. Im not very familiar with AJAX, but so innerhtml would be an AJAX function? This function may be able to achieve this? Were could I find documentation or some kind of manual for ajax? Thanks for your reply
  21. I was thinking of ways I could use use PHP to make an iframe dissapear when the user has clicked the submit button in the iframe. I was thinking there is probably no way to tell if the user has submitted the form in the iframe? I tried using unset(), with the iframe code being a variable. I echoed the iframed form, and placed a submit button below the iframe. When the user is done with the iframe form, they click the submit button below it and it will dissapear. Ive done that, but I was wondering would it be possible at all to make the frame dissapear once the user has clicked the submit button IN the iframe? If not possible with PHP maybe javascript? IDK, suggestions would be appreciated. Thanks
  22. I spent the last hour or so typing this code up, and for some reason I am getting a query error. I have reviewed & revised the code up and down for the past half hour and can't seem to figure out the problem. Can someone look after this for me and tell me what I could be doing wrong? Yes, I know my code is a bit sloppy and may use bad practice techniques, but it works for me. Its a survey that I coded so I could collect data and place it on CPA ad listings. So I need this so work at some point soon. My code: <?php $user = $_POST['user']; $email = $_POST['email']; $password = $_POST['pass']; $paypal = $_POST['paypal']; $q1 = $_POST['q1[favsite]']; $q2 = $_POST['q2[isp]']; $q21 = $_POST['q2.1[bill]']; $email_services = $_POST['email_services']; $ebay = $_POST['ebay']; $amazon = $_POST['amazon']; $q6 = $_POST['q6[purchase]']; $q7 = $_POST['q7[social]']; $q8 = $_POST['q8[bookmarks]']; $q9 = $_POST['q9[search]']; $q10 = $_POST['q10[homepage]']; $q11 = $_POST['q11[5topsites]']; $q12 = $_POST['q12[state]']; if ($_POST['fin'] == "complete") { $dbc = mysqli_connect('localhost', 'root', 'password', 'database') or die('Could not connect'); $query = "INSERT INTO user_data (id, user, email, password, paypal, q1[favsite], q2[isp], q21[bill], email_services, ebay, amazon, q6[purchase], q7[social], q8[bookmarks], q9[search], q10[homepage], q11[5topsites], q12[state]) VALUES ('$user', '$email', '$password', '$paypal', '$q1', '$q2', '$q21', '$email_services', '$ebay', '$amazon', '$q6', '$q7', '$q8', '$q9', '$q10', '$q11', '$q12')"; mysqli_query($dbc,$query) or die('Error querying database'); include_once("../phpmailer/class.phpmailer.php"); $mail = new PHPMailer; $mail->ClearAddresses(); $mail->AddAddress('', ''); $mail->From = ''; $mail->FromName = ''; $mail->Subject = 'Thanks for finishing the survey!'; $mail->Body = "Hello, $user. This is a reminder that you have finished the survey and your credit is currently being processed. Please login to your account at ../../ to view the status of your credit & cash out. "; if ($mail->Send()) { echo "<center>Mail Sent.</center>"; } else { echo $mail->ErrorInfo; } echo "<center><h2>Thanks for completing the survey! Please <a href='login.php'>login</a> to your account to view the status of your credit & cash out.</h2></center>"; } ?> It has nothing to do with PHPMailer, I of course edited the variables just now so all my info wouldnt be public, but everything is fine untill you press submit & I get the or die() error message "Error querying database". What the hell did I do wrong? Is it possible that I cant name variables in the format I used with most of them ($var1 = $_POST['var[desc]']; ?
×
×
  • 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.