emediastudios
-
Posts
418 -
Joined
-
Last visited
Posts posted by emediastudios
-
-
should use mysql_real_escape_string() should solve your problem
Thanks, i did read that on the internet, but don't know where to place it in the code, I'll keep looking,
Thanks again.
-
Hi everyone,
I have been building my first admin from scratch, and am going quite well.
But now i have a problem that i can't resolve.
The website is basically a library of quotes that users can submit, the admin then needs to approve and edit them before they are published on the site.
I have the admin built, and can display all the records and delete, but am having a problem with the update.
If the quote has a ' in the text it throws an error. If it doesn't it updates fine.
There needs to a cleaning function or something applied, and as i am still learning i am lost to how to do this,
I added the addslashes but it still throws the error.
Code below.
case 'updatequote'; $db_name = "auth"; $table_name = "quotes"; $connection = @mysql_connect("localhost", "root", "testing") or die(mysql_error()); $db = @mysql_select_db($db_name, $connection) or die(mysql_error()); foreach($_POST as $input) { $_POST['array_key'] = addslashes($input); } $sql = "UPDATE $table_name SET artist = '$artist',song = '$song',quote = '$quote' WHERE quoteid = ".$_REQUEST['quoteid'].""; $result = @mysql_query($sql,$connection) or die(mysql_error()); echo "Quote Edited Successfully"; break;
-
I changed it to this, but is still wrong, im hopeless.
<FORM ENCTYPE="multipart/form-data" ACTION="model_application.php" METHOD="POST"> <table width="66%" border="0" cellspacing="0" cellpadding="5"> <tr> <td width="26%" align="left" valign="top">First name</td> <td width="74%" align="left" valign="top"> <input name="first" type = "text" size="40" /> </td> </tr> <tr> <td align="left" valign="top">Last name:</td> <td align="left" valign="top"><input name="last" type = "text" size="40" id="last" /></td> </tr> <tr> <td align="left" valign="top">Age:</td> <td align="left" valign="top"><input name="age" type = "text" size="40" id="age" /></td> </tr> <tr> <td align="left" valign="top">Email:</td> <td align="left" valign="top"><input name="email" type = "text" size="40" id="email" /></td> </tr> <tr> <td align="left" valign="top">Phone:</td> <td align="left" valign="top"><input name="phone" type = "text" size="40" id="phone" /></td> </tr> <tr> <td align="left" valign="top">A bit about you:</td> <td align="left" valign="top"><textarea name="content" cols="60" rows="10"></textarea></td> </tr> <tr> <td align="left" valign="top">Image:</td> <td align="left" valign="top"> <input name="userfile" type="file" /> </td> </tr> <tr> <td align="left" valign="top">Image:</td> <td align="left" valign="top"><input name="userfile2" type="file" /></td> </tr> <tr> <td align="left" valign="top"> <input type="submit" value="submit" /> </td> <td align="left" valign="top"></td> </tr> <tr> <td align="left" valign="top"> </td> <td align="left" valign="top"> </td> </tr> </table> <br> </FORM> <?php if(isset($_POST['submit'])){ $add="uploaded/".$_FILES[userfile][name]; $add2="uploaded/".$_FILES[userfile2][name]; if(move_uploaded_file ($_FILES[userfile][tmp_name])){ $Q = mysql_query("INSERT INTO applicants (`first`,`last`,`age`,`email`,`phone`,`content`,`phone`,`content`,`file`,`file2`) VALUES ('$first','$last','$age','$email','$phone','$content','$add','$add2')"); echo "Added Successfully"; } else{ echo "Add Failed"; } } ?>
-
This what i have, i just need help getting the second image to upload.
I am unsure how to do it and have battled for hours. I am sure there is a problem with the mysql insert too.
<?php if($ps != "2"){ ?> <FORM ENCTYPE="multipart/form-data" ACTION="admin.php?p=addProductItem&ps=2" METHOD="POST"> <table width="66%" border="0" cellspacing="0" cellpadding="5"> <tr> <td width="26%" align="left" valign="top">First name</td> <td width="74%" align="left" valign="top"> <input name="first" type = "text" size="40" /> </td> </tr> <tr> <td align="left" valign="top">Last name:</td> <td align="left" valign="top"><input name="last" type = "text" size="40" id="last" /></td> </tr> <tr> <td align="left" valign="top">Age:</td> <td align="left" valign="top"><input name="age" type = "text" size="40" id="age" /></td> </tr> <tr> <td align="left" valign="top">Email:</td> <td align="left" valign="top"><input name="email" type = "text" size="40" id="email" /></td> </tr> <tr> <td align="left" valign="top">Phone:</td> <td align="left" valign="top"><input name="phone" type = "text" size="40" id="phone" /></td> </tr> <tr> <td align="left" valign="top">A bit about you:</td> <td align="left" valign="top"><textarea name="content" cols="60" rows="10"></textarea></td> </tr> <tr> <td align="left" valign="top">Image:</td> <td align="left" valign="top"> <input name="userfile" type="file" /> </td> </tr> <tr> <td align="left" valign="top">Image:</td> <td align="left" valign="top"><input name="userfile2" type="file" /></td> </tr> <tr> <td align="left" valign="top"> <input type="submit" value="submit" /> </td> <td align="left" valign="top"></td> </tr> <tr> <td align="left" valign="top"> </td> <td align="left" valign="top"> </td> </tr> </table> <br> </FORM> <?php } else{ $add="uploaded/".$_FILES[userfile][name]; $add2 = "../".$add; if(move_uploaded_file ($_FILES[userfile][tmp_name], $add2)){ $Q = mysql_query("INSERT INTO productitem (`first`,`last`,`age`,`email`,`phone`,`content`,`phone`,`content`,`file`,`file2`) VALUES ('$first','$last','$age','$email','$phone','$content','$add','$add')"); echo "Added Successfully"; } else{ echo "Add Failed"; } } ?>
-
Thanks, i read that.
Still didn't help, i kind of need one that will upload 2 images and a pdf, as well as put the record in the database, i have name, age, phone ect to go in the form too, thanks anyway
-
Hi Everyone.
I am in need of assistance,
I need a form that i will use on a model agency site i am making, the form i have only has the option to upload one image and records name, age etc... What i need is a form that will upload multiple images, 2 will do but if i had a option to add more that would be great, and a pdf resume, does anyone have a similar form i can have a look at that does this, any help be awesome, i am already over the deadline.
-
-
Hi All,
i want to show all the results from my services folder but want to limit the amount of characters displayed from the ".$a[content]."
My current code works fine, just need to implement the limit on the content.
I have a template setup that displays the entire content "view_service.php"
$q = mysql_query("SELECT * FROM services ORDER BY id DESC"); while($a = mysql_fetch_array($q)){ echo "<table width='350' border='0' cellpadding='5' cellspacing='0' class='servicesbg'> <tr> <td width='80' rowspan='2' valign='top'><a href='view_service.php?id=".$a[id]."'><img src='".$a[img]."' alt='".$a[title]."' width='110' height='80' border='0'></a></td> <td width='250' valign='top'>".$a[title]."</td> </tr> <tr> <td valign='top'>".$a[content]."</td> </tr> </table><br>"; }
-
Do you have a question?
How do i unlink the files in the tables usedboats and usedboatimages? under row "file" in both, the images reside in a directory back one level ../
-
I tried many times, but cant seem to get it right.
I am tired of adding test used boats and images as i keep deleting them and the file unlink has errors
The delete record function works finer, i just cant seem to work out the unlink file code.
-
Hey guys,
I have this code below, which works fine.
What i need to do is unlink the images from 2 tables, they are all in table rows called "file"
unlink [file] from usedboats where id = id and,
unlink [file] from usedboatimages where cat = id
All the files are in a directory back one, ../uploaded the file name in the table is similar to uploaded/45638.jpg
so there is no need to add ../uploaded in the script, just ../
if($secret == "3"){ if($id != ""){ if($q2 = mysql_query("DELETE FROM `usedboats` WHERE id = '$id'") && $q3 = mysql_query("DELETE FROM `usedboatimages` WHERE cat = '$id'")) echo "Used Boat Deleted<br><br>"; } $q = mysql_query("SELECT * FROM usedboats"); echo "<div class='PageTitle'><b>Warning!!!</b> This will delete the used boat and all related images<br><br></div><table>"; while($a = mysql_fetch_array($q)){ echo "<tr><td><a href='admin.php?p=deleteusedboat&id=".$a[id]."'>".$a[title]."</a></td></tr>"; } echo "</table>"; } else include("../../../admin/admin/err.php");
-
please anyone! certainly its not too difficult for some of you phpfreak masters!
This will put an end to my month long nightmare with this client.
-
i added you input to my code as follows.
Is an error still there, not working
<?php if(modApiFunc('Customer_Account','getCurrentSignedCustomer') !== null) { echo "<img src="http://localhost/extremehairextensions/shop/avactis-templates/catalog/product-info/default/%22images/add_to_cart_button.gif%22" alt="" onclick="ProductFormSubmit_36()" style="cursor: pointer;" width="96" border="0" height="18">"; }else{ echo"<A HREF=\""; PageURL('CustomerSignIn'); echo"\">Sign In</A> | <A HREF=\""; PageURL('CustomerSignIn'); echo"\">Register</A>"; } ?>
-
This is a snippet from the page code on server
<tr> <td> </td> <td style="padding-top: 20px; padding-bottom: 20px;" valign="top" align="right"> <table width="100%" border="0" cellpadding="3" cellspacing="0"> <tbody><tr> <!-- Quantity Select --> <td width="10%" align="left" nowrap="nowrap"> Quantity: <select name="quantity_in_cart"> <option value="1" selected="selected">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option> </select> </td> <!-- Add to Cart Button --> <td align="left"> javascript: ProductFormSubmit_36();<img src="http://localhost/extremehairextensions/shop/avactis-templates/catalog/product-info/default/%22images/add_to_cart_button.gif%22" alt="" onclick="" style="cursor: pointer;" width="96" border="0" height="18"> </td> </tr> </tbody></table> </td> </tr>
Thanks for all you help stephen
-
I altered you code a little
<?php if(modApiFunc('Customer_Account','getCurrentSignedCustomer') !== null) { echo "<IMG SRC=\"images/add_to_cart_button.gif\" WIDTH=\"96\" HEIGHT=\"18\" BORDER=0 ALT=\"\" onClick=\"".Local_ProductAddToCart()."\" style=\"cursor: pointer;\">"; }else{ echo"<A HREF=\""; PageURL('CustomerSignIn'); echo"\">Sign In</A> | <A HREF=\""; PageURL('CustomerSignIn'); echo"\">Register</A>"; } ?>
Does the right thing if not signed in, but shows this and no button if they are - javascript: ProductFormSubmit_36();
-
here is the site link
http://extremehairextensions.com.au/store/product-info.php?pid80.html
at the bottom is at to cart button.
The code half works, (on localhost testing, overwrite site file when workind), it shows the sign in - register if not signed in but shows $54.95
javascript: ProductFormSubmit_36(); if signed in, your getting there
-
I recently had someone fix this code up for me to show prices if logged in and not to if not logged in.
Works like a charm.
<?php
if(modApiFunc('Customer_Account','getCurrentSignedCustomer') !== null) {
ProductSalePrice();
}else{
echo"<A HREF=\""; PageURL('CustomerSignIn');
echo"\">Sign In</A> | <A HREF=\""; PageURL('CustomerSignIn');
echo"\">Register</A>";
}
?>
What i need now is to replace the ProductSalePrice(); to show the add to cart button if logged in and the the lower part of the code if not, register sign in.
the add to cart button is as follows.
<!-- Add to Cart Button -->
<TD align="left">
<IMG SRC="images/add_to_cart_button.gif" WIDTH="96" HEIGHT="18" BORDER=0 ALT="" onClick="<?php Local_ProductAddToCart(); ?>" style="cursor: pointer;">
</TD>
Thanks for any help, this has to be my last issue with this site.
-
Champion, solved, thanks so much.
-
The code before edit looks like this
<div class="ProductPrice" style="padding-bottom: 3px; padding-top: 3px;">
Price: <?php ProductSalePrice(); ?>
</div>
I was given this code and i need to somehow put the above code into it so it only shows price when they are logged in, it works by itself but doesn't when i start messing with it
<?php
if(modApiFunc('Customer_Account','getCurrentSignedCustomer') !== null)
{echo"<A HREF=\""; PageURL('CustomerSignIn'); echo "\">My Home</A> | "; echo"<A HREF=\""; CustomerSignOutURL(); echo "\">Sign Out</A>";}
else{echo"<A HREF=\""; PageURL('CustomerSignIn'); echo"\">Sign In</A> | <A HREF=\""; PageURL('CustomerSignIn'); echo"\">Register</A>"; }?>
-
Anyone please, this is the last fix i need to finish this nightmare site.
-
Something like this im guessing but it doesnt show the price, shows what i want to see when not logged in but not the price when they are. shows nothing. know im close.
<?php
if(modApiFunc('Customer_Account','getCurrentSignedCustomer') !== null)
{echo"<?php ProductSalePrice(); ?>";}
else{echo"<A HREF=\""; PageURL('CustomerSignIn'); echo"\">Sign In</A> | <A HREF=\""; PageURL('CustomerSignIn'); echo"\">Register</A>"; }?>
-
Thanks Stephen, but no joy, just shows all that code on the screen, something not right
-
I need this code to go into the following code so that if they are signed in it will show the price if not it will display login register.
<?php ProductSalePrice(); ?>
this into this
<?php
if(modApiFunc('Customer_Account','getCurrentSignedCustomer') !== null)
{echo"<A HREF=\""; PageURL('CustomerSignIn'); echo "\">My Home</A> | "; echo"<A HREF=\""; CustomerSignOutURL(); echo "\">Sign Out</A>";}
else{echo"<A HREF=\""; PageURL('CustomerSignIn'); echo"\">Sign In</A> | <A HREF=\""; PageURL('CustomerSignIn'); echo"\">Register</A>"; }?>
Thanks for any help
-
I wanted to add a php/sql gallery to my site.
I do have a script that uploads images to a dir and puts the record in a table in sql, but it doesnt resize the image, and i wanted to know if someone would be so kind to share a script with me if they did.
I need the thumbnail generation feature.
I am proficient in flash, maybe we could swap some work?
stripslashes problem
in PHP Coding Help
Posted
Awesome, Chintan, your the man! This works perfect.
Just one question though, because i am teaching myself php mysql, is this the right way to do it, by this i mean, can it be simplified as a function or in a different way so i don't have to type out so much code.
I just want to learn good practices from the start.
Thanks for your help.