Jump to content

stelthius

Members
  • Posts

    275
  • Joined

  • Last visited

    Never

Everything posted by stelthius

  1. Alright so looking at this more, i thought about ways to use explode, but i really have no clue about using the explode function ive looked over on the manul but that didnt help me either i think its because ive been trying to figure it out that long im getting annoyed with it. Can anyone offer some support ? here is my full page so you can see everything its doing. <?php require_once("db.php"); define("DN_IMG_PATH", "IMG/"); define("DN_PDF_PATH", "PDF/"); function handle_upload($file_id, $path, $suffix) { $source = $file_id['tmp_name']; $dest = tempnam($path, "lamont-"); if ((isset($file_id['name'])) && ($file_id['name'] != "")) { copy($source, $dest); if ($suffix!="") { $new = $dest.$suffix; rename($dest, $new); $dest = $new; } chmod($dest, 0777); } else { $dest = ""; } return $dest; } $title=checkPostValue("ptitle", $_POST); $paddr1 = checkPostValue("paddr1", $_POST); $paddr2 = checkPostValue("paddr2", $_POST); $ptown = checkPostValue("ptown", $_POST); $pcounty = checkPostValue("pcounty", $_POST); $postcode = checkPostValue("postcode", $_POST); $ptype1 = checkPostValueNum("ptype1", $_POST); $ptype2 = checkPostValueNum("ptype2", $_POST); $ptype3 = checkPostValueNum("ptype3", $_POST); $ptype4 = checkPostValueNum("ptype4", $_POST); $pdescription = checkPostValue("pdescription", $_POST); $psize = checkPostValueNum("psize", $_POST); $psize2 = checkPostValueNum("psize2", $_POST); $pcategory1 = checkPostValueNum("pcategory1", $_POST); $pcategory2 = checkPostValueNum("pcategory2", $_POST); $pcategory3 = checkPostValueNum("pcategory3", $_POST); $pcategory4 = checkPostValueNum("pcategory4", $_POST); $pcategory5 = checkPostValueNum("pcategory5", $_POST); $pcategory6 = checkPostValueNum("pcategory6", $_POST); $published = checkPostValueNum("published", $_POST); $price = checkPostValue("price", $_POST); $prpID = checkPostValue("prpID", $_POST); if ($psize==false) { $psize=0; } if ($psize2==false) { $psize2=0; } if ($psize<0) { $psize=0; } if ($psize2<0) { $psize2=0; } if (($psize==0) && ($psize2!=0)) { $psize = $psize2; } if (($psize!=0) && ($psize2==0)) { $psize2 = $psize; } if ($psize>$psize2) { $x = $psize; $psize = $psize2; $psize2=$x; } if ($_FILES['pimage_file']['size']!=0) { if ($prpID) { delete_old_image($dbConn, $prpID); } $pimage_temp = handle_upload($_FILES['pimage_file'],DN_IMG_PATH, ".jpg"); $pimage_fname = $_FILES['pimage_file']['name']; } else { if ($prpID) { $result = getPropertyByID($dbConn, $prpID); $row = mysql_fetch_assoc($result); $pimage_temp = $row['prp_image_temp_name']; $pimage_fname = $row['prp_image_orig_name']; } } if ($_FILES['ppdf_file']['size']!=0) { if ($prpID) { delete_old_pdf($dbConn, $prpID); } $ppdf_temp = handle_upload($_FILES['ppdf_file'],DN_PDF_PATH, ".pdf"); $ppdf_fname = $_FILES['ppdf_file']['name']; } else { if ($prpID) { $result = getPropertyByID($dbConn, $prpID); $row = mysql_fetch_assoc($result); $ppdf_temp = $row['prp_pdf_temp_name']; $ppdf_fname = $row['prp_pdf_orig_name']; } } print $result_array = array ("title"=>$title, "addr1"=>$paddr1, "addr2"=>$paddr2, "addr3"=>"", "town"=>$ptown, "county"=>$pcounty, "postcode"=>$postcode, "ptype1"=>$ptype1, "ptype2"=>$ptype2, "ptype3"=>$ptype3, "ptype4"=>$ptype4, "pdescription"=>$pdescription, "psize"=>$psize, "psize2"=>$psize2, "pcategory1"=>$pcategory1, "pcategory2"=>$pcategory2, "pcategory3"=>$pcategory3, "pcategory4"=>$pcategory4, "pcategory5"=>$pcategory5, "pcategory6"=>$pcategory6, "published"=>$published, "pimage_name"=>$pimage_fname, "pdf_name"=>$ppdf_fname, "pimage_temp"=>$pimage_temp, "pdf_temp"=>$ppdf_temp, "price"=>$price); if (isset($_POST['prpID']) && $_POST['prpID']!="") { update_property($dbConn, $result_array, $_POST['prpID']); } else { insert_property($dbConn, $result_array); } printf("<script>location.href='index.php'</script>"); ?> With regards rick.
  2. After alot of fiddling and no luck ive begun to think its the way im uploading the file but i really cannot see anything wrong with it here is my uploading code.. 1'st part. define("DN_IMG_PATH", "IMG/"); define("DN_PDF_PATH", "PDF/"); function handle_upload($file_id,$path,$suffix){ $source = $file_id['tmp_name']; $dest = tempnam($path,"lamont-"); if( (isset($file_id['name'])) && ($file_id['name'] != "") ) { copy($source,$dest); if($suffix!=""){ $new = $dest.$suffix; rename($dest,$new); $dest = $new; } chmod($dest,0777); } else { $dest = ""; } return $dest; } And here is the 2'nd part if ($_FILES['pimage_file']['size']!=0) { if($prpID){ delete_old_image($dbConn,$prpID); } $pimage_temp = handle_upload($_FILES['pimage_file'],DN_IMG_PATH,".jpg"); $pimage_fname = $_FILES['pimage_file']['name']; } else { if($prpID){ $result = getPropertyByID($dbConn,$prpID); $row = mysql_fetch_assoc($result); $pimage_temp = $row['prp_image_temp_name']; $pimage_fname = $row['prp_image_orig_name']; } } if ($_FILES['ppdf_file']['size']!=0) { if($prpID){ delete_old_pdf($dbConn,$prpID); } $ppdf_temp = handle_upload($_FILES['ppdf_file'],DN_PDF_PATH,".pdf"); $ppdf_fname = $_FILES['ppdf_file']['name']; } *Edit* When it uploads the temp file its uploading it with the full path to the img such as, /home/php_work/public_html/Listings/admin/IMG/listings-Lgeu0U.jpg Any help is greatly appretiated Rick.
  3. Hello guys, Im using define("DN_IMG_PATH", "IMG/"); define("DN_PDF_PATH", "PDF/"); To define the url to my PDF & IMG Dir's but when i use it like that it gives me LINK/home/php_work/public_html/Listings/admin/PDF/listings-yKCZXf.pdf But when i do it like this define("DN_IMG_PATH", "/home/php_work/public_html/Listings/admin/IMG/"); define("DN_PDF_PATH", "/home/php_work/public_html/Listings/admin/PDF/"); It stores the upload image and pdf in the /temp/ DIR and then displays the image link as LINK/temp/listings-yKCZXf.pdf Can anyone see what im doing wrong here as this is confusing me now. Regards rick.
  4. This should work now, you need to be more carefull when writing code it really isnt a hard problem to resolve <?php $housequery=1; require_once("globals.php"); // you cant just require it print "<h2>General Information:</h2> <table><tr> <td><b>Name:</b> {$ir['username']}</td> <td><b>Knifes:</b> {$cm}</td></tr><tr> <td><b>Level:</b> {$ir['level']}</td> <td><b>Money:</b> $fm</td> <td><b>Hit Points:</b> {$ir['hp']}/{$ir['maxhp']}</td></tr><tr> <td><b>Property:</b> {$ir['hNAME']}</td></tr></table>"; print "<h2>Stats Information:</h2>"; // "; was missing $ts=$ir['strength']+$ir['agility']+$ir['guard']+$ir['labour']+$ir['IQ']; $ir['strank']=get_rank($ir['strength'],'strength'); $ir['agirank']=get_rank($ir['agility'],'agility'); $ir['guarank']=get_rank($ir['guard'],'guard'); $ir['labrank']=get_rank($ir['labour'],'labour'); $ir['IQrank']=get_rank($ir['IQ'],'IQ'); $tsrank=get_rank($ts,'strength+agility+guard+labour+IQ'); $ir['strength']=number_format($ir['strength']); $ir['agility']=number_format($ir['agility']); $ir['guard']=number_format($ir['guard']); $ir['labour']=number_format($ir['labour']); $ir['IQ']=number_format($ir['IQ']); $ts=number_format($ts); print "<table><tr> <td><b>Strength:</b> {$ir['strength']} [Ranked: {$ir['strank']}]</td> <td><b>Agility:</b> {$ir['agility']} [Ranked: {$ir['agirank']}]</td></tr><tr> <td><b>Guard:</b> {$ir['guard']} [Ranked: {$ir['guarank']}]</td> <td><b>Labour:</b> {$ir['labour']} [Ranked: {$ir['labrank']}]</td></tr><tr> <td><b>IQ: </b> {$ir['IQ']} [Ranked: {$ir['IQrank']}]</td> <td><b>Total stats:</b> {$ts} [Ranked: $tsrank]</td></tr></table>"; // "; was missing $h->endpage(); ?>
  5. Try this but givei t something to order by... <?php require_once("myConnectionInfo.php"); $query = "SELECT * FROM donor ORDER BY (What do you want to order it by ?) ASC") $result=mysql_query($query); echo '<select name="list">'; while($rec=mysql_fetch_array($result)) { echo '<option value="' . $rect['dlname'] . '">' . $rec['dfname'] . '</option>'; } echo '</select>'; ?> <html> <head></head> <body> <SELECT NAME=list><OPTION VALUE=0>Choose<?=$options?></SELECT> <body> </html>
  6. I'd personally suggest speaking to the facebook dev team about this one.
  7. Yeah sorry i meant i dont need it in there if i do it how you did in the example code, thanks Dan
  8. Ahhh so i dont need my top query in there at all thanks dan.
  9. So basicly i could do something like $query="SELECT * FROM users WHERE admin = '$admin'"; $result=mysql_query($query) or die ("Query failed"); // This is the part were im stuck how would i go about adding in the admin is there code if ( ) { // Do nothing carry on finishing the query executions } else { $admin_pass = md5($_POST['admin_pass']); $query18 = "INSERT INTO `users` (`user_id`, `username`, `password`, `session_id`, `login_ip`, `last_activity`, `user_level`, `email_address`) VALUES (1, '".$_POST['admin_user']."', '".$admin_pass."', 'NIL', 'NIL', 'NIL', '9', '".$_POST['admin_pass']."'); } Sorry for the messy code was just threw together to try get an idea.
  10. Ah i was curious if it would be wise to throw in a if statement to check to see if admin existed if not add him but if he does dont add him as the installer runs multiple queries, thanks Dan
  11. Hey guys, ive built my script installer, and then my script updater, im having a issue with the script updater, it always ads a second admin user is there anyway i could add in a check to see if there is already a username admin if so dont add a new username admin. $admin_pass = md5($_POST['admin_pass']); $query18 = "INSERT INTO `users` (`user_id`, `username`, `password`, `session_id`, `login_ip`, `last_activity`, `user_level`, `email_address`) VALUES (1, '".$_POST['admin_user']."', '".$admin_pass."', 'NIL', 'NIL', 'NIL', '9', '".$_POST['admin_pass']."');"; With regards.
  12. Hmmm i was thinking more along the lines of a basic editor, wich would allow me to write the cron, and save the cron with the specific title i chose so say i wanted to make script_update i could type that in and save it as that
  13. Ok basicly what i want to do is to be able to Create a cron via a php page, save and let the cron execute.. sorry for my poor question originally
  14. Hello guys just a quick one, is it possible to create & edit a cron using php,
  15. Alright after some fiddling im still not getting it to work here is my code... $query="SELECT username FROM vs_users WHERE password = '$new_pass'"; $newpass = $_POST['forcednewpass']; $newpassconf = $_POST['forcednewpass1']; if(!$newpass == $newpassconf){ printf("<script>location.href='login.php?op=nopwmatch'</script>"); } if($_POST['form'] == "userid"){ $userid = $_POST['userid']; $password = md5($newpass); mysql_query("UPDATE vs_users SET password='$password', flag='0' WHERE username='$userid'") or die(mysql_error()); printf("<script>location.href='login.php'</script>"); } } Any help is appretiated i think im just missing something simple!
  16. Alright guys im back again, sorry! for some reason my form isnt updating the DB but it is printing out done as it normally would do once updating the DB any suggestions or ideas guys ? $newpass = $_POST['forcednewpass']; } if($_POST['form'] == "userid"){ $userid = $_POST['userid']; $password = md5($newpass); mysql_query("UPDATE users SET password='$password', flag='0' WHERE username='$userid'") or die(mysql_error()); print"done"; }
  17. Thanks mate, thats exactly what i meant, i was doing that but i missed the { off the end and it was annoying me like mad lol thanks man.
  18. Basicly, i have a login form, with the login process done on the same page, now, my forgot password i want to have that code in login.php also, but only be called when i click the forgot password button and then it will change the table to the forgot password table with the email input area & send button... so say for instance i name the button login.php?=op=doforgotpass how would i start off my forgot password code so the button can call it, my explanations are pretty Shi**y so im sorry if its a bad en lol
  19. Thanks Pengue, i thought it may have been i just wasnt sure so i figured id ask for a second opinion ill try it now.
  20. Hello all, im using $passReset = mysql_query("UPDATE users SET password='$db_password' WHERE email_address='$email_address'"); To update the users password when they reset it but i also need to alter FLAG to 1 so it will bring up a alert for them to change there password from the one just sent to them, is it possible to do this ?
  21. No to say your method doesnt work but it wasnt that it was like one word and a colon
  22. Hello all, So the other day my friend used a tag to display all his php queries in raw data at the top of his page to see what the last query to run was so he could see were the issue was with his code, im pretty sure it was something to do with print, im desperately trying to find out what he used i cant ask him as he hasnt been online all day long can anyone help me out with this ?
  23. Hey ignance, the thing is i tried that but then that gives me a break before the table header which holds Forum | threads | Posts so would i in theory need two tables to acheive what im trying to do ? if so do you have any idea how ?
  24. Hellow guys, im just wondering if anyone can shed some light on my forum display issue, ive tried everything to get my forum to put a break like <br> before each new category but for the life of me cant figure it out any help is appretiated. <?php $contentOutput .= "<table width='500' height='100' cellpadding='0' cellspacing='0' align='center' summary='' border='1'> <tr> <td>Forum</td> <td>Threads</td> <td>Posts</td> </tr>"; $getCats = mysql_query("SELECT * FROM forum_cats ORDER BY sort_order"); while($cat = mysql_fetch_array($getCats)) { $getForums = mysql_query("SELECT * FROM forum_forums WHERE cat_id='".$cat['cat_id']."' ORDER BY sort_order"); $contentOutput .= "<tr> <td>".$cat['title']."</td> </tr>"; while($forum = mysql_fetch_array($getForums)) { $getThreads = mysql_query("SELECT * FROM forum_threads WHERE for_id='".$forum['for_id']."'"); $countThreads = mysql_num_rows($getThreads); $posts = mysql_fetch_array($getThreads); $getPosts = mysql_query("SELECT * FROM forum_posts WHERE thr_id='".$posts['thr_id']."'"); $countPosts = mysql_num_rows($getPosts); $contentOutput .= "<tr> <td><a href='index.php?page=community&option=threads&id=".$forum['for_id']."'>".$forum['title']."</a></td> <td>$countThreads</td> <td>$countPosts</td> </tr>"; } } $contentOutput .= "</table><br>"; ?>
  25. OK after thinking all day about how best to accomplish this im still banging my head against the wall, can anyone suggest anything ?
×
×
  • 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.