-
Posts
275 -
Joined
-
Last visited
Never
Contact Methods
-
Website URL
http://www.speedtest.net/result/218606217.png
Profile Information
-
Gender
Not Telling
stelthius's Achievements
Regular Member (3/5)
0
Reputation
-
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.
-
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.
-
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.
-
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(); ?>
-
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>
-
I'd personally suggest speaking to the facebook dev team about this one.
-
Yeah sorry i meant i dont need it in there if i do it how you did in the example code, thanks Dan
-
Ahhh so i dont need my top query in there at all thanks dan.
-
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.
-
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
-
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.
-
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
-
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
-
Hello guys just a quick one, is it possible to create & edit a cron using php,
-
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!