-
Posts
39 -
Joined
-
Last visited
Never
About nbbcj
- Birthday 03/24/1984
Contact Methods
-
Website URL
https://www.laatuhosting.com
Profile Information
-
Gender
Male
nbbcj's Achievements

Member (2/5)
0
Reputation
-
Hi thank you for your reply and sorry about the delay in getting back to you. im new to smarty i am going to split the code in to 2 tpl's, just for ease of coding i stuck it all in. so im thinking file1.tpl has this {include file="$template/inc/$pagetitle.tpl"} <<< this is smarty tag and file2.tpl has this {php} $q1= strpos($_GET['action'], "products"); if($q1!== false) { echo '<h2>My Products & Services</h2><p> These are all the services you have registered in this account.</p>'; } $q1 = strpos($_GET['action'], "domains"); if($q1!== false) { echo '<h2>My Domains</h2><p> View & manage all the domains you have registered with us from here...</p>'; } {/php} then in the main tpl file that did hold the above code will now have some thing like this {php} if($_GET['action'] !== false) { {include file="$template/inc/file1.tpl"} } else{ {include file="$template/inc/file2.tpl"} } {/php} Sub question does if($_GET['action'] !== false) mean if action is not in the url then run {include file="$template/inc/file1.tpl"} or will it just look for ?action=false in the url. im a bit noobish and have jumped in right at the deep end trying to custom a WHMCS script. thanks for any help you can provide
-
hay all, im not sure if im right to post here as this is a smarty and php question, but here goes. i have this bit of code in a .tpl file {include file="$template/inc/$pagetitle.tpl"} <<< this is smarty tag {php} $q1= strpos($_GET['action'], "products"); if($q1!== false) { echo '<h2>My Products & Services</h2><p> These are all the services you have registered in this account.</p>'; } $pos = strpos($_GET['action'], "domains"); if($q1!== false) { echo '<h2>My Domains</h2><p> View & manage all the domains you have registered with us from here...</p>'; } {/php} what im trying to do is if the url is somefile.php then include the smarty tag but if the url is somefile.php?action=products then run the if code. at the min if the url is somefile.php?action=products the page shows the include and the if code any help please thanks in advance kaine
-
sorted it silly me i had the db config setup wrong lol my bad thanks for the help tho nbbcj
-
Ow yer for got bout that one ill give it a go c what error i get thx
-
Yer have a db called dragdrop :S Thanks
-
Hi all i downloaded and read the how to from this site http://www.webresourcesdepot.com/dynamic-dragn-drop-with-jquery-and-php/ seems it the main one that comes up on google and its what i need for a backend project iv been working on for about a year now learning as i go but dont get much time now a days, but any way.. lol i cant get it to work get this Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/sites/nbbcj.co.uk/public_html/4291/dnd/index.php on line 67 and im stumped this is the part of the code <div id="container"> <div id="list"> <div id="response"> </div> <ul> <?php error_reporting(E_ALL); ini_set('display_errors', '1'); include("connect.php"); $query = "SELECT id, text FROM dragdrop ORDER BY listorder ASC"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $id = stripslashes($row['id']); $text = stripslashes($row['text']); ?> <li id="arrayorder_<?php echo $id ?>"><?php echo $id?> <?php echo $text; ?> <div class="clear"></div> </li> <?php } ?> </ul> </div> </div>
-
hi all im a noob and still learning but this sql inject rattles my brain lol will this protect me $add_pn = mysql_real_escape_string($_POST['pro_name']); and what do i use with this $id=mysql_result($result,$i,"id");
-
got it working by removing the mysql_close($con) at the end if script now got a new problem lol but il save that for a diff post lol thanks all
-
HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfil the request.
-
Hi all, i have been working on a form preview be for submit the info to the db iv got the preview but to work but when i add me sql insert i get page errors can any one help. Iv been racking my brain for days now i am using this to error report but am just getting the server error msg and no more info ini_set('display_errors',1); error_reporting(E_ALL); here is my form code <form method='POST' action='add_form.php' enctype="multipart/form-data" name="form1" id="form1"> <p>Project Name: <input class="addp" name="pro_name" type="text" size="40" maxlength="40" /> Category: Brand Identity: <input name="bi" type="checkbox" value="1" checked /> Print: <input name="print" type="checkbox" value="1" checked /> Online: <input name="online" type="checkbox" value="1" checked /> </p> <p>Short Details: <input class="addp" name="short_details" type="text" size="100" maxlength="100"/> </p> <p>Full Details: <textarea class="tinymce" name="full_details" cols="100" rows="1"></textarea> </p> <p>Thumbnail: <input type="hidden" name="MAX_FILE_SIZE" value="1029120"/> <input class="addp" name="ufile[]" type="file" id="ufile[]" size="50" /> </p> <p> Image 1: <input type="hidden" name="MAX_FILE_SIZE" value="1029120"/> <input class="addp" name="ufile[]" type="file" id="ufile[]" size="30" /> Image 2: <input type="hidden" name="MAX_FILE_SIZE" value="1029120"/> <input class="addp" name="ufile[]" type="file" id="ufile[]" size="30" /> </p> <p>Image 3: <input type="hidden" name="MAX_FILE_SIZE" value="1029120"/> <input class="addp" name="ufile[]" type="file" id="ufile[]" size="30" /> Image 4: <input type="hidden" name="MAX_FILE_SIZE" value="1029120"/> <input class="addp" name="ufile[]" type="file" id="ufile[]" size="30" /> <input name="submit" type="submit" value="Submit""> <input name="preview" type="submit" value="Preview""> </p> </form> here is my php ////////////this code works if(isset($_POST['preview'])) { $path1= "../thumbnails/".$_FILES['ufile']['name'][0]; $path2= "../images/".$_FILES['ufile']['name'][1]; $path3= "../images/".$_FILES['ufile']['name'][2]; $path4= "../images/".$_FILES['ufile']['name'][3]; $path5= "../images/".$_FILES['ufile']['name'][4]; $add_pn=$_POST['pro_name']; $add_sd=$_POST['short_details']; $add_fd=$_POST['full_details']; $add_bi=$_POST['bi']; $add_print=$_POST['print']; $add_online=$_POST['online']; //copy file to where you want to store file if(!($_FILES['ufile']['tmp_name'][0] == NULL)) { copy($_FILES['ufile']['tmp_name'][0], $path1); } if(!($_FILES['ufile']['tmp_name'][1] == NULL)) { copy($_FILES['ufile']['tmp_name'][1], $path2); } if(!($_FILES['ufile']['tmp_name'][2] == NULL)) { copy($_FILES['ufile']['tmp_name'][2], $path3); } if(!($_FILES['ufile']['tmp_name'][3] == NULL)) { copy($_FILES['ufile']['tmp_name'][3], $path4); } if(!($_FILES['ufile']['tmp_name'][4] == NULL)) { copy($_FILES['ufile']['tmp_name'][4], $path5); } print "<pre>"; print "Preview button pressed.."; print_r($_REQUEST); print "$add_pn $add_sd $add_fd $add_bi $add_print $add_online"; print "</pre>"; if(!($_FILES['ufile']['tmp_name'][0] == NULL)) { print "<img src=\"$path1\" width=\"100\" height=\"100\" align=\"textop\">"; } if(!($_FILES['ufile']['tmp_name'][1] == NULL)) { print "<img src=\"$path2\" width=\"100\" height=\"100\" align=\"textop\">"; } if(!($_FILES['ufile']['tmp_name'][2] == NULL)) { print "<img src=\"$path3\" width=\"100\" height=\"100\" align=\"textop\">"; } if(!($_FILES['ufile']['tmp_name'][3] == NULL)) { print "<img src=\"$path4\" width=\"100\" height=\"100\" align=\"textop\">"; } if(!($_FILES['ufile']['tmp_name'][4] == NULL)) { print "<img src=\"$path5\" width=\"100\" height=\"100\" align=\"textop\">"; } } ///////////////// this bit errors if(isset($_POST['submit'])) { print "<pre>"; print "Submit button pressed.."; print_r($_REQUEST); print "</pre>"; include ("../includes/db_config.php");//////////////////try'd this bit of code at the start of the page $con = mysql_connect($db_hostname,$db_username,$db_password);//////////////////try'd this bit of code at the start of the page @mysql_select_db($db_database) or die( "Unable to select database");//////////////////try'd this bit of code at the start of the page ////////////////// im not sure if this is needed again ????? $add_pn=$_POST['pro_name']; $add_sd=$_POST['short_details']; $add_fd=$_POST['full_details']; $add_bi=$_POST['bi']; $add_print=$_POST['print']; $add_online=$_POST['online']; ////////i have used this insert code on other pages and it works so not sure why its not now $sql="INSERT INTO $db_table (pro_name, thumbnail, short_details, full_details, bi, print, online, image1, image2, image3, image4) VALUES ('$add_pn','".$_FILES['ufile']['name'][0]."','$add_sd','$add_fd','$add_bi','$add_print','$add_online','".$_FILES['ufile']['name'][1]."','".$_FILES['ufile']['name'][2]."','".$_FILES['ufile']['name'][3]."','".$_FILES['ufile']['name'][4]."')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con) }
-
hi all i have a problem here, Iv got a form that uploads images to a folder and updates the db with the name of that image, that work ok but if one of the upload field are left blank then the script updates the db with empty values how can i get it to only update the db with only submitted form field data???? here is the form <?php if (isset($_GET['id'])) { $id = $_GET['id']; } ?> <form action="ud_image.php?id=<? echo "$id"?>" method="post" enctype="multipart/form-data" name="form1" id="form1"> <table class="udp"> <tr> <th>Thumbnail:</th> <td><input type="hidden" name="MAX_FILE_SIZE" value="1029120" /> <input name="ufile[]" type="file" id="ufile[]" size="50" /></td> </tr> <tr> <th>Image 1:</th> <td><input type="hidden" name="MAX_FILE_SIZE" value="1029120" /> <input name="ufile[]" type="file" id="ufile[]" size="50" /></td> </tr> <tr> <th>Image 2:</th> <td><input type="hidden" name="MAX_FILE_SIZE" value="1029120" /> <input name="ufile[]" type="file" id="ufile[]" size="50" /></td> </tr> <tr> <th>Image 3:</th> <td><input type="hidden" name="MAX_FILE_SIZE" value="1029120" /> <input name="ufile[]" type="file" id="ufile[]" size="50" /></td> </tr> <tr> <th>Image 4:</th> <td><input type="hidden" name="MAX_FILE_SIZE" value="1029120" /> <input name="ufile[]" type="file" id="ufile[]" size="50" /><input type="submit" name="Submit" value="Upload" /></td> </tr> </table> </form> and here is the processing page <?php include("protect/password_protect.php"); error_reporting(E_ALL); include ("../includes/db_config.php"); $con = mysql_connect($db_hostname,$db_username,$db_password); @mysql_select_db($db_database) or die( "Unable to select database"); $path1= "../thumbnails/".$_FILES['ufile']['name'][0]; $path2= "../images/".$_FILES['ufile']['name'][1]; $path3= "../images/".$_FILES['ufile']['name'][2]; $path4= "../images/".$_FILES['ufile']['name'][3]; $path5= "../images/".$_FILES['ufile']['name'][4]; //copy file to where you want to store file copy($_FILES['ufile']['tmp_name'][0], $path1); copy($_FILES['ufile']['tmp_name'][1], $path2); copy($_FILES['ufile']['tmp_name'][2], $path3); copy($_FILES['ufile']['tmp_name'][3], $path4); copy($_FILES['ufile']['tmp_name'][4], $path5); ?> <html> <head> <title>Update Project Images</title> <link rel="stylesheet" type="text/css" href="../../project/backend/style.css" /> </head> <body> <table class="udip"> <tr> <th><? echo "<img src=\"$path1\" width=\"150\" height=\"150\">";?></th> <th><? echo "<img src=\"$path2\" width=\"150\" height=\"150\">";?></th> <th><? echo "<img src=\"$path3\" width=\"150\" height=\"150\">";?></th> <th><? echo "<img src=\"$path4\" width=\"150\" height=\"150\">";?></th> <th><? echo "<img src=\"$path5\" width=\"150\" height=\"150\">";?></th> </tr> <tr> <td><? echo "File Name :".$_FILES['ufile']['name'][0]."<BR/>";?></td> <td><? echo "File Name :".$_FILES['ufile']['name'][1]."<BR/>";?></td> <td><? echo "File Name :".$_FILES['ufile']['name'][2]."<BR/>";?></td> <td><? echo "File Name :".$_FILES['ufile']['name'][3]."<BR/>";?></td> <td><? echo "File Name :".$_FILES['ufile']['name'][4]."<BR/>";?></td> </tr> <tr> <td><?echo "File Size :".$_FILES['ufile']['size'][0]."<BR/>";?></td> <td><?echo "File Size :".$_FILES['ufile']['size'][1]."<BR/>";?></td> <td><?echo "File Size :".$_FILES['ufile']['size'][2]."<BR/>";?></td> <td><?echo "File Size :".$_FILES['ufile']['size'][3]."<BR/>";?></td> <td><?echo "File Size :".$_FILES['ufile']['size'][4]."<BR/>";?></td> </tr> <tr> <td><? echo "File Type :".$_FILES['ufile']['type'][0]."<BR/>";?></td> <td><? echo "File Type :".$_FILES['ufile']['type'][1]."<BR/>";?></td> <td><? echo "File Type :".$_FILES['ufile']['type'][2]."<BR/>";?></td> <td><? echo "File Type :".$_FILES['ufile']['type'][3]."<BR/>";?></td> <td><? echo "File Type :".$_FILES['ufile']['type'][4]."<BR/>";?></td> </tr> </table> </body> </html> <? $filesize1=$_FILES['ufile']['size'][0]; $filesize2=$_FILES['ufile']['size'][1]; $filesize3=$_FILES['ufile']['size'][2]; $filesize4=$_FILES['ufile']['size'][3]; $filesize5=$_FILES['ufile']['size'][4]; if($filesize1 && $filesize2 && $filesize3 && $filesize4 && $filesize5 != 0) { echo "We have recieved your files<p>"; } else { echo "Error in you images check and try again Database has been updated to blank images so no images will be shown on details page."; } $query = "UPDATE $db_table SET thumbnail = '".$_FILES['ufile']['name'][0]."', image1 = '".$_FILES['ufile']['name'][1]."', image2 = '".$_FILES['ufile']['name'][2]."', image3 = '".$_FILES['ufile']['name'][3]."', image4 = '".$_FILES['ufile']['name'][4]."' WHERE id = '".$_GET['id']."'"; if (!mysql_query($query,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con) ?>
-
how to AUTO_INCREMENT 2 colloums not sure if this php or sql
nbbcj replied to nbbcj's topic in PHP Coding Help
hay all thanks for you input iv moved on now and have a other problem lol can only c 2 more problems till this project is done thanks again -
Cool the for that iv changed :D col name now n it works
-
how to AUTO_INCREMENT 2 colloums not sure if this php or sql
nbbcj replied to nbbcj's topic in PHP Coding Help
It's to set the order of displaying my projects on the work page its so project 2 can be shown 1st or 5th or last