Jump to content

richarro1234

Members
  • Posts

    146
  • Joined

  • Last visited

Everything posted by richarro1234

  1. anybody know how to fix this?
  2. Hello, I have a problem with one of my pages. i have the multibox form for reporting something on my page, and i added the ajax delete with animation to delete comments and have them slide out and vanish. but for some reason when i have the code to call the jquery file it messes up the multibox and the form for the multibox shows up. heres a screenie how can i fix it so that the multibox (which i think might be mootools) and the comment deleting so that this form (see img) doesnt show up unless called from the link? Thanks Rich
  3. Hey, thanks for the help. i have managed to get it working now, i used your code and just played about with it abit and it inserted the numbers from the hash but that was it so i looked at the DB and turns i had the table set wrong, i changed it from varchar to int and forgot to change it back again. I changed it to varchar and it works fine now, thanks for the help Rich
  4. Hey, thanks for the quick reply, still didnt work though. its just inserting "0" into the database, but it emails the hash fine. (it emails a hash number to the given email address but doesnt insert into the DB) Rich
  5. Hey, i have a mysql query that is meant to insert an md5(). but when i look at the page i get this Unknown column 'e983f8ac2081bcce91dee92517c83b4c' in 'field list'. so i added a '' in the query but then it doesnt insert the md5. Here is the query: mysql_query("INSERT INTO richspri_social.invite (userid, useremail, inviteemail, hash, date) VALUES ($userid,'$useremail','$fromemail',$hash,NOW())") or exit( mysql_error() ); What am i missing? Thanks
  6. Hey, i have a bit of code that cycles the DB getting the amount of votes for a survey. <?$query2 = mysql_query("SELECT * from responses WHERE qid = $qid") OR die(mysql_error());//corrected while ($ans = mysql_fetch_array($query2)) {?><?php echo $ans['response']; ?> (votes:<?php echo $ans['votes']; ?>)<br><?}?> as you can see it uses <?php echo $ans['votes']; ?> to get the amount of votes for the selected ID, now how do i add up the out-putted votes to get the total amount of votes for that question? And also, how do i turn that output into a %'age for each vote? I.E: yes (25 votes) (X%) no (15 votes) (X%) Total votes: 40 Thanks Rich
  7. abit like that yea, basically theres 3 values at the end of the pagwe that need to be there before the page can be shown, but it also shows if there is nothing there, so at the moment index.php is shown but it needs to be index.php?userid=<id>&email=<email>&code=<code> so i need to check that all 3 are there before the page shows, but i was hoping to do it as described above. w3evolutions, im not that good at using mod_rewrite so have no idea how to do it that way.
  8. Hey, Im trying to make a page that can not be accessed directly. I.E. i need to block index.php but allow index.php?id=1. how do i go about doing this? Thanks Rich
  9. well im using php for the code. Here is the page i have so far, if someone wants to butcher it for me to SHOW me how to do it, as im not sure where to begin changing. <? include("data.php"); //include("funktioner.php"); mysql_connect($server,$dbuser,$dbpass); mysql_select_db($database); $query = mysql_query("SELECT * from users WHERE username = '".$_COOKIE["twusername"]."'") or die ('Error: '.mysql_error ()); while ($r = mysql_fetch_array($query)) { $userid = $r['userid']; } if ($_GET['action'] == 'post') { $month = date('n'); $day = date('d'); $year = date('Y'); $a1 = $_GET['a1']; $a2 = $_GET['a2']; $a3 = $_GET['a3']; $a4 = $_GET['a4']; $a5 = $_GET['a5']; $a6 = $_GET['a6']; $ownerid = $_GET['userid']; if ($_POST['question'] == '') { header ("Location: addpoll.php?error=1"); die(); } if ($_COOKIE['twusername'] == 'sk8nguitar') { $name = "JD"; } elseif ($_COOKIE['twusername'] == 'richarro123') { $name = "Rich"; } else { $name = "?"; } include("data.php"); mysql_connect($server,$dbuser,$dbpass); mysql_select_db($databas); mysql_query("INSERT INTO survey (squestion, publishdate, expdate, ownerid, active) VALUES ('" . $_POST['question']. "','$month/$day/$year','" . $_POST['expdate']. "','" . $_POST['userid']. "','yes')") or exit( mysql_error() ); mysql_query("INSERT INTO pchoices (a1, a2, a3, a4, a5, a6) VALUES ('" . $_POST['a1']. "','" . $_POST['a2']. "','" . $_POST['a3']. "','" . $_POST['a4']. "', '" . $_POST['a5']. "', '" . $_POST['a6']. "')") or exit( mysql_error() ); header ("Location: addpoll.php?note=1"); die(); } ?> <? // Error messages if ($_GET['error'] == '1') { $note = "<br><center> <table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='75%' id='AutoNumber1' bordercolor='red' bgcolor='#000000'> <tr> <td width='100%' align='center'><font color='red' size='2'><b>You have to enter a Subject!</b></font></td> </tr> </table> </center><br>"; } if ($_GET['error'] == '2') { $note = "<br><center> <table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='75%' id='AutoNumber1' bordercolor='red' bgcolor='#000000'> <tr> <td width='100%' align='center'><font color='red' size='2'><b>You have to enter a Message!</b></font></td> </tr> </table> </center><br>"; } // Note messages if ($_GET['note'] == '1') { $note = "<br><center> <table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='75%' id='AutoNumber1' bordercolor='red' bgcolor='#000000'> <tr> <td width='100%' align='center'><font color='red' size='2'><b>Your news has been posted successfully!</b></font></td> </tr> </table> </center><br>"; } ?> <div align="center"> <center> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="75%" id="AutoNumber2" bgcolor="#ffffff"> <form action="addpoll.php?action=post" method="post"> <tr> <td width="100%" bgcolor="#ffffff" align="center"><font size="2"><b>Post News On Homepage</b></font></td> </tr> <tr> <td width="100%" align="center"> </td> </tr> <tr> <td width="100%" align="center"><input type="hidden" name="userid" value="<?=$userid;?>"></td> </tr> <tr> <td width="100%" align="center"><b>Your Question:</b></td> </tr> <tr> <td width="100%" align="center"><input type="text" name="question" maxlength="255" size="30"></td> </tr> <tr> <td width="100%" align="center"> </td> </tr> <tr> <td width="100%" align="center"><b>Answers:</b></td> </tr> <tr> <td width="100%" align="center">1. <input type="text" name="a1" maxlength="50" size="32"></td> </tr> <tr> <td width="100%" align="center"> </td> </tr> <tr> <td width="100%" align="center">2. <input type="text" name="a2" maxlength="50" size="32"></td> </tr> <tr> <td width="100%" align="center"> </td> </tr> <tr> <td width="100%" align="center"><input type="submit" value="Post News" name="B1"></td> </tr> </div> </body> </html> </form> </table> </center> </div> Thanks Rich
  10. Hey there, im trying to code a "create a survey" page, where users can make surveys with at least one section. Each section must have at least 1 question, questions can have X amount of answers which the user can choose how many and the type of answers (i.e multiple choice, yes/no, likert scale, text box etc....) I have got as far as having a question input, but not sure how to enable the user to choose the different select options for the answers and the amount of answers and input the answers and publish the survey. Thanks Rich
  11. Thanks, that does work, but it also needs to check that its in the DB and that its correct.
  12. no thats not what i mean, i mean as the URL, its an invite system and dont want the form to show up if the info isnt all there, the link needs to be with the userid, useremail and hash ONLY not if there is nothing there (just signup.php [with nothing after it]) and because it works, not sure how to do unifying propaly so it still works
  13. Hey all, im having some trouble with this peice of code: <? if($_COOKIE["twstatus"]==TRUE) { header ("Location: main.php?note=account"); die(); } $id = $_GET['userid']; $useremail = $_GET['useremail']; $hash = $_GET['hash']; include("data.php"); //include("funktioner.php"); mysql_connect($server,$anvandare, $losen); mysql_select_db($databas); $query1 = mysql_query("SELECT * from richspri_social.invite where userid = '$id'") or exit( mysql_error() ); $inv = mysql_fetch_array($query1); $invuserid = $inv['userid']; if ($_GET['add'] == 'user') { if ((!isset($_POST['username'])) || ($_POST['username'] == '')) { header ("Location: signup.php?ref=".$_POST['ref']."&fel=username"); die(); } if ((!isset($_POST['username'])) || ($_POST['username'] == '')) { header ("Location: signup.php?ref=".$_POST['ref']."&fel=username"); die(); } if ((!isset($_POST['password'])) || ($_POST['password'] == '')) { header ("Location: signup.php?ref=".$_POST['ref']."&fel=password"); die(); } if ($_POST['password'] != $_POST['repassword']) { header ("Location: signup.php?ref=".$_POST['ref']."&fel=match"); die(); } if (!isset($_POST['name'])) { header ("Location: signup.php?ref=".$_POST['ref']."&fel=name"); die(); } if (!isset($_POST['email'])) { header ("Location: signup.php?ref=".$_POST['ref']."&fel=mail"); die(); } include("match.php"); if (!checkchr($_POST['username'])) { header ("Location: signup.php?ref=".$_POST['ref']."&fel=usernamesql"); die(); } include("data.php"); include "funktioner.php"; $db = mysql_connect($server,$anvandare, $losen); mysql_select_db($databas); $query = mysql_query("SELECT * from richspri_social.users where username = '".$_POST['username']."' or email = '".$_POST['email']."'") or exit( mysql_error() ); $r = mysql_fetch_array($query); if (isset($r['username'])) { //Användarnamnet existerar... det måste vi göra nåt åt header("Location: signup.php?ref=".$_POST['ref']."&fel=user"); die('Användaren existerar redan'); } // Har det kommit så här långt existerar inte användaren och vi kan lägga till den // End... // $password = md5($_POST['password']); mysql_query("INSERT INTO richspri_social.users (username, reggad, password, name, email, logins, lastlogin, status) VALUES ('" . $_POST['username'] . "','" . time() . "','" . $_POST['password'] . "','" . $_POST['name']. "','" . $_POST['email'] . "','0','" . time() ."','online')") or exit( mysql_error() ); header ("Location: index.php?note=accreated"); mysql_close($db); } ?> <?include("header.php");?> <? if ($_GET['fel'] == 'user') { $note = "<br><center> <table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='75%' id='AutoNumber1' bordercolor='red' bgcolor='#000000'> <tr> <td width='100%' align='center'><font color='red' size='2'><b>The username or Email already exists, choose another!</b></font></td> </tr> </table> </center><br>"; } if ($_GET['fel'] == 'usernamesql') { $note = "<br><center> <table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='75%' id='AutoNumber1' bordercolor='red' bgcolor='#000000'> <tr> <td width='100%' align='center'><font color='red' size='2'><b>You have invalid characters in your username, please choose another!</b></font></td> </tr> </table> </center><br>"; } if ($_GET['fel'] == 'password') { $note = "<br><center> <table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='75%' id='AutoNumber1' bordercolor='red' bgcolor='#000000'> <tr> <td width='100%' align='center'><font color='red' size='2'><b>You must choose a password!</b></font></td> </tr> </table> </center><br>"; } if ($_GET['fel'] == 'match') { $note = "<br><center> <table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='75%' id='AutoNumber1' bordercolor='red' bgcolor='#000000'> <tr> <td width='100%' align='center'><font color='red' size='2'><b>Your passwords did not match!</b></font></td> </tr> </table> </center><br>"; } if ($_GET['fel'] == 'username') { $note = "<br><center> <table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='75%' id='AutoNumber1' bordercolor='red' bgcolor='#000000'> <tr> <td width='100%' align='center'><font color='red' size='2'><b>You must choose a username!</b></font></td> </tr> </table> </center><br>"; } if ($_GET['fel'] == 'namn') { $note = "<br><center> <table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='75%' id='AutoNumber1' bordercolor='red' bgcolor='#000000'> <tr> <td width='100%' align='center'><font color='red' size='2'><b>You must fill in a name!</b></font></td> </tr> </table> </center><br>"; } if ($_GET['fel'] == 'mail') { $note = "<br><center> <table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' width='75%' id='AutoNumber1' bordercolor='red' bgcolor='#000000'> <tr> <td width='100%' align='center'><font color='red' size='2'><b>You must fill in a Email!</b></font></td> </tr> </table> </center><br>"; } ?> <center><?=$note?></center> <div id="signup"> <table align="center" class="signuptable"> <form action="signup.php?add=user" method="post"> <input type="hidden" name="ref" maxlength="30" size="20" value="<?=$_GET['ref'];?>"> <tr> <td class="maintitle" colspan="2">Register for Nosepad!</td> </tr> <? if ($id == $inv['userid'] && $useremail == $inv['useremail'] && $hash == $inv['hash']){ ?> <? require("inc/signup.php");?> <?} else { ?> <td class="four">Unable to signup at this stage. If you were given an invite then please follow the link provided in the email. <br/> Thanks</td> <?}?> </form> </table> </div> <?include("footer.php");?> basically, i have sorted out the display. so that it wont display if any of the variables are missing, but i overlooked one thing. if none of them exist then it will load the page. so the link reads: signup.php?id=1&useremail=<useremail>&hash=<hash> the page would load fine and show the signup form. but if it reads: signup.php the page also loads up showing the form aswell, which i dont want to happen as that defies the point. Can someone help me sort it out please. Thanks Rich
  14. for some reason my normal upload forms wont work now either. that upload script as posted above only seems to work if its bein called form ajax, either that or there is some settings somewhere that the upload pages requires and im just missing it. Rich
  15. Hey thanks for the reply, just tried it but it still doesnt work. it also no longer copys the files over either.
  16. Hey all, I have the upload script just as its meant to thanks to darsuperhero, but now for some reason the mysql qont add it to the database, so im asking for a fresh pair of eyes on this code. <?php if (!empty($_FILES)) { include("data.php"); mysql_connect($server,$anvandare, $losen); mysql_select_db($databas); $query = mysql_query("SELECT * from richspri_social.users WHERE username = '".$_COOKIE["twusername"]."'") or die ('Error: '.mysql_error ()); while ($r = mysql_fetch_array($query)) { $myid = $r['id']; $id = $r['id']; } $tempFile = $_FILES['Filedata']['tmp_name']; $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/'; $targetFile = str_replace('//','/',$targetPath) . time() . $_FILES['Filedata']['name']; // Uncomment the following line if you want to make the directory if it doesn't exist // mkdir(str_replace('//','/',$targetPath), 0755, true); $m_ip = mysql_real_escape_string($_SERVER['REMOTE_ADDR']); //$m_size = $filesize; $m_fname = mysql_real_escape_string($targetFile); //$sql = "insert into richspri_social._uploads_log (log_filename,log_size,log_ip) values ('$m_fname','$m_size','$m_ip')"; //$res = @mysql_query($sql); $sql1 = "insert into userimg (id,ownerid,file_name,filetype,description,albumid,display,imgtype,approved) values ('','$m_user','$m_fname','$file_ext','','','no','$file_type','no')"; $res1 = mysql_query($sql1); if (!$res) { $errors[] = "Could not run query."; break; } mysql_free_result($res); mysql_free_result($res1); mysql_close($link); move_uploaded_file($tempFile,$targetFile); } echo '1'; ?> IT all worked fine on another upload script, but that was single files only, i need this to work for multiple files. Can someone help me debug this please. Thanks Rich
  17. :D:D i actually think i almost love you lol. that seemed to work fine, all i need to do now is to get it to save in a mysql database, could i use $_FILES['Filedata']['size']; to get the size of the file aswell? Thanks Rich
  18. The upload code you are using sets $_FILES['Filedata'] by default unless you specify a value for fileDataName, so the code using $_FILES['filename'] would never work. As stated before, the upload works fine, its just when i try to randomly generate a name to avoid havin 2 with the same filename being uploaded. its only the random generate bit that doesnt work, if that worked the file would upload normally.
  19. well the above code is located in upload.php it works fine with this: <?php if (!empty($_FILES)) { $tempFile = $_FILES['Filedata']['tmp_name']; $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/'; $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name']; // Uncomment the following line if you want to make the directory if it doesn't exist // mkdir(str_replace('//','/',$targetPath), 0755, true); move_uploaded_file($tempFile,$targetFile); } echo '1'; ?> but that has the possibility of 2 files with the same name bein uploaded and one being over-written. this is the page that upload.php is called from: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Uploadify scriptData Sample</title> <link rel="stylesheet" href="uploadify/uploadify.css" type="text/css" /> <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="js/jquery.uploadify.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#fileUpload2").fileUpload({ 'uploader': 'uploadify/uploader.swf', 'cancelImg': 'uploadify/cancel.png', 'script': 'uploadify/upload.php', 'folder': 'files', 'multi': true, 'buttonText': 'Select Files', 'checkScript': 'uploadify/check.php', 'displayData': 'speed', 'simUploadLimit': 2 }); }); </script> </head> <body> <fieldset style="border: 1px solid #CDCDCD; padding: 8px; padding-bottom:0px; margin: 8px 0"> <p></p> <hr width=100% size="1" color="" align="center"> <h2>Multiple File Upload</h2> <p>checkScript, buttonText, simulataneous upload limit</p> <div id="fileUpload2">You have a problem with your javascript</div> <a href="javascript:$('#fileUpload2').fileUploadStart()">Start Upload</a> | <a href="javascript:$('#fileUpload2').fileUploadClearQueue()">Clear Queue</a> <p></p> </fieldset> </body> </html> Thanks Rich
  20. It doesnt upload the file, theres no errors, nothings showing up. its bein called from a diffirent page, its an ajax request so no errors show up anyway. With or without the @'s
  21. Hey, sorry to keep buggin everying. I have been staring at this peice of code for about the last 3 hours now and cant get my head around why its not working. Basically im trying to upload a file with a random name to avoid having an image with the same name bein uploaded and over written. here is the code im using: <?php if (!empty($_FILES)) { // Folder to upload files to. Must end with slash / define('DESTINATION_FOLDER','files/'); // rename file after upload? false - leave original, true - rename to some unique filename define('RENAME_FILE', true); // put a string to append to the uploaded file name (after extension); // this will reduce the risk of being hacked by uploading potentially unsafe files; // sample strings: aaa, my, etc. define('APPEND_STRING', ''); // get file name (not including path) $filename = @basename($_FILES['filename']['tmp_name']); // filename of temp uploaded file $tmp_filename = $_FILES['filename']['tmp_name']; $file_ext = @strtolower(@strrchr($filename,".")); if (@strpos($file_ext,'.') === false) { // no dot? strange $errors[] = "Suspicious file name or could not determine file extension."; break; } $file_ext = @substr($file_ext, 1); // remove dot // destination filename, rename if set to $dest_filename = md5(uniqid(rand(), true)) . '.' . $file_ext; // append predefined string for safety $dest_filename = $dest_filename . APPEND_STRING; // get size $filesize = intval($_FILES["filename"]["size"]); // filesize($tmp_filename); // make sure file size is ok if (MAX_FILE_SIZE > 0 && MAX_FILE_SIZE*1024 < $filesize) { $errors[] = "File is too big (3)."; break; } if (!@move_uploaded_file($tmp_filename , DESTINATION_FOLDER . $dest_filename)) { $errors[] = "Could not upload file (6)."; break; } } echo '1'; ?> That doesnt work. This does work: <?php if (!empty($_FILES)) { $tempFile = $_FILES['Filedata']['tmp_name']; $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/'; $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name']; // Uncomment the following line if you want to make the directory if it doesn't exist // mkdir(str_replace('//','/',$targetPath), 0755, true); move_uploaded_file($tempFile,$targetFile); } echo '1'; ?> Can someone help me fix this so that it will do what its meant to do. Thanks Rich
  22. could u send me a link to a website where i can get such information please so that i can use it for my site? Thanks Rich
  23. well mood is copied exactly the same as it is in status.php. here is the contents though: <?php $dbhost = "localhost"; $dbuser = "xxxxx"; $dbpass = "xxxxx"; $dbname = "social"; //Connect to MySQL Server mysql_connect($dbhost, $dbuser, $dbpass); //Select Database mysql_select_db($dbname) or die(mysql_error()); if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ClientIP = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ClientIP = $_SERVER['REMOTE_ADDR']; } //$ClientHost = gethostbyaddr($ClientIP); $ClientAgent = $_SERVER['HTTP_USER_AGENT']; $MyTimeStamp = time(); // Retrieve data from Query String $mood = $_GET['mood']; $id = $r['id']; // Escape User Input to help prevent SQL Injection $mood = mysql_real_escape_string($mood); //build query $query = "UPDATE richspri_social.users SET mood = '$mood' WHERE username = '".$_COOKIE["twusername"]."'"; //Execute query // Exit if calling directly the script file! if ($mood != "") { $qry_result = mysql_query($query) or die(mysql_error()); echo "<b><font color='#FF0000'>mood Updated Successfully</font></b>"; } else { echo '<b>Hacking Attempt!!</b><br><br>'; } ?> i was looking at jquery but couldnt see anything that looked like what i needed, all i saw was making things LOOK better rather then updating stuff. Thanks Rich
  24. oh man, cant beleive i missed that lol. thanks for pointing that out, but for some reason it doesnt update the database.
×
×
  • 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.