hi, i want ajax to be called only once, but insted it calls everytime when i click on the button. my script: $(document).ready(function(){ $("#modal-launcher-user").click(function(){ $('#preloader_image_edit').show(); $.ajax({ url: "image_edit.php", cache: false, }) .done(function( html ) { $("#preloader_image_edit").hide(); $( "#results_image_edit" ).append( html ); }); }); });

Member Avatar
Member Avatar
+0 forum 3

hi, as the title says, i want to resize and preview image before i submit it to my server. it is because of reducing load to my server and also give the client ability to crop the image too. i am using `imgareaselect` for cropping. and also using a javascript to preview the image. until now this works well. i wanted to resize the image before crop and upload, so i search a bit and found that i can use `canvas` for resizing while maintaining the ratio. but after updated my code this does not works. i am new to …

Member Avatar
Member Avatar
+0 forum 3

hi want my user to upload images to my server. There is a lot of security risks i am aware of, like: 1. client side validation is not a good idea. 2. PHP code can be embedded into various other data types.(like embeded in a image file) 3. by using `$_FILES["file"]["type"]` for detecting file type is another risk. 4. user can use null byte. so how can i secure my uploads so that user can fake the extensions or embeded the image with php code. or prevent user from bypassing security checks. here is the code i found on the …

Member Avatar
Member Avatar
+0 forum 17

hi, i want to change the image class on click on the image, i am also using radio input, here is my fiddle, check out and tell me what is wrong? [http://jsfiddle.net/Avik/7aKY3/1/](http://jsfiddle.net/Avik/7aKY3/1/)

Member Avatar
Member Avatar
+0 forum 4

i am trying to get all the result from my databse table but this query is not working. <?php try { $pdo = new PDO('mysql:host=localhost;dbname=articles', 'Avik', ''); } catch (PDOException $e) { $output = 'Unable to connect to the database server.'; echo $output; exit(); } try { $sql = 'SELECT * FROM `post_series`'; $result = $pdo->query($sql); } catch(PDOException $e) { echo "something wrong"; exit(); } foreach ($result as $row) { $series_options[] = array( 'post_series_id_option' => $row['post_series_id'], 'post_series_name_option' => $row['post_series_name'] ); } echo $series_options['post_series_name_option']; ?> it gives me a error : `Notice: Undefined index: post_series_name_option in E:\wamp\www\test.php on line 30`

Member Avatar
Member Avatar
+0 forum 1

THIS IS A DISCUSSION THREAD NOT Q&A. PLEASE SHARE YOUR THOUGHTS AND IDEAS. I am planning on making a website which mainly will be driven by community users, mods, and admins. It will be a large project but i am ready for it, since community like stackoverflow and daniweb is always with me.... :) To be successful on creating a community driven site this six path, provided by stackoverflow is grest. 1.Discussion 2.Proposal 3.Commitment 4.Closed Beta 5.Open Beta 6.Full Citizenship as for discussion of ideas i want you guys help. If you are a experienced developer or a user write …

Member Avatar
Member Avatar
+0 forum 3

hi how can i fetch data from the database and stroe it into session variable. my code: $sql = "SELECT password, fullname, username, active FROM ".$mysql_table." WHERE (username = :username OR email = :username) AND password = :password"; $statement = $pdo->prepare($sql); $statement->bindValue(':username', $_POST['username']); $statement->bindValue(':password', md5($_POST['password'])); $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); if (count($result) == 1) { if (session_id() == "") { session_start(); } $_SESSION['username'] = ; $_SESSION['fullname'] = ; $_SESSION['expires_by'] = time() + $session_timeout; $_SESSION['expires_timeout'] = $session_timeout; $rememberme = isset($_POST['rememberme']) ? true : false; if ($rememberme) { setcookie('username', $_POST['username'], time() + 3600*24*30); } if(!isset($_COOKIE['redirect'])) { $redirect_page_no = './index.php'; header('Location: '.$redirect_page_no); exit; } …

Member Avatar
Member Avatar
+0 forum 2

hi, can anyone point out why is this script not working?? it does not inserting data into mysql.. here is the script: if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['form_name'] == 'signupform') { $newpassword = $_POST['password']; $confirmpassword = $_POST['confirmpassword']; $code = 'NA'; $active = '1'; if ($newpassword != $confirmpassword) { $error_message = 'Password and Confirm Password are not the same!'; } else if (isset($_POST['captcha'],$_SESSION['random_txt']) && md5($_POST['captcha']) == $_SESSION['random_txt']) { unset($_POST['captcha'],$_SESSION['random_txt']); } else { $error_message = 'The entered code was wrong.'; } if (empty($error_message)) { try { $pdo = new PDO('mysql:host=localhost;dbname=blog', 'Avik', ''); } catch (PDOException $e) { $output = 'Unable to connect …

Member Avatar
Member Avatar
+0 forum 23

hi, in the mysql we can fetch data and store them into variables, like the code below: if (mysql_num_rows($userquery) != 1) { die ("that member could not be found!"); while($row = mysql_fetch_array ($userquery, MYSQL_ASSOC)){ $first_name = $row['first_name']; $last_name = $row['last_name']; $email = $row['email']; $password = $row['password']; $sex = $row['sex']; $dbusername = $row['username']; } but how can i do the same with pdo??

Member Avatar
Member Avatar
+0 forum 1

i am having problem with converting my sign in script with pdo here is my script if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['form_name'] == 'loginform') { $success_page = $_COOKIE["redirect"]; $error_page = 'signup_error.php'; $indexlogcheck = 'home.php'; $mysql_table = 'users'; $crypt_pass = md5($_POST['password']); $found = false; $fullname = ''; $session_timeout = time()+60*60*24*30; try { $pdo = new PDO('mysql:host=localhost;dbname=blog', 'Avik', ''); } catch (PDOException $e) { $output = 'Unable to connect to the database server.'; echo $output; exit(); } try { $sql = "SELECT password, fullname, active FROM ".$mysql_table." WHERE username = '".$_POST['username']."'"; $statement = $pdo->prepare($sql); $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); if ($data = count($result) …

Member Avatar
Member Avatar
+0 forum 5

why is the code below is not working? $sql = "SELECT password, fullname, active FROM ".$mysql_table.""; $sql = $sql . "WHERE username = :username, password = :password"; $statement = $pdo->prepare($sql); $statement->bindValue(':username', $_POST['username']); $statement->bindValue(':password', md5($_POST['password'])); $statement->execute();

Member Avatar
Member Avatar
+0 forum 2

hi, i am building a cms, when a user(already logged in) post anything, the script will check if the user is already exist or not if not it will create a new account(only save username and useremail) for the cms, so i can keep track of users. ok, so i already managed to get this part. at first i used mysql extension but a daniweb member suggest me to use pdo, so i read some documents on pdo and write down the code below, but it is not working as expected, it do not save the data post by user. …

Member Avatar
Member Avatar
+0 forum 5

hi i am building a cms system for my website, i am able to put data into a mysql database with the following code(look below). i also have a login system for accessing the cms, everything worked so far. I am facing a problem now. Ok so user signup info is stored in a differant database, and i am using another database to store the cms content --blog |-author |-post so my blog databse contains two tables. on the post section i store the content of a post. the author section contains **author name** and **author email** columns. whenever someone …

Member Avatar
Member Avatar
+0 forum 7

hi, i am interested in php link redirect. lets say i have a website with a lot of links, and most of the time if i change one file name i have to update that on everypage, it's irritating, as for other website like microsoft, they use links like **go.microsoft.com/fwlink/id3242** or something like that. most of microsofts desktop app also contains this link. so even if microsoft move their website, or rename a file they redirect to that page. so that means they have a script that contains all the link and also contains where it should redirect. even the …

Member Avatar
Member Avatar
+0 forum 1

hi i am new to php and mysql, i am experimenting with a script for saving data to mysql database. and fetch the data on other page, i managed to get both of them without any trouble. But Here is the one problem. I added a additional input function to save the input data, but other input functions are working except the one i modified.!! i added the value through phpmyadmin and it works for fetching that data, but can not added value through this script.(see below, i have put down the code) i am using the latest wampserver.and the …

Member Avatar
Member Avatar
+0 forum 2

hi, i am new to mysql and also to php, i am trying to add a feature to a webpage, for showing some latest records from a mysql databse. i managed to show records from mysql database, but the problem is i only trying to show the first four records but it shows all the records i have in my databse. here is my script that shows the data from the database, so how do i managed to do that!! <?php $db = mysql_connect($mysql_server, $mysql_username, $mysql_password); if (!$db) { die('Failed to connect to database server!<br>'.mysql_error()); } mysql_select_db($mysql_database, $db) or die('Failed …

Member Avatar
Member Avatar
+0 forum 6

The End.