
Ex1t
Members-
Posts
28 -
Joined
-
Last visited
Ex1t's Achievements

Member (2/5)
0
Reputation
-
Im using this query for login in standard PHP. $sql = 'SELECT * FROM admin WHERE username = "$username" AND password = "$password"'; $run_query = mysqli_query($con, $sql); $check_query = mysqli_num_rows($run_query); if(!$check_query) { echo 'Failed'; } else { echo 'Success'; } How should look that query in OOP? Im just started with OOP, I successfully created a connection with database in PDO, so now I have problem with this login query Im just missed category, sorry moderators, please move..
-
I have included now all required files from https://github.com/facebook/facebook-php-sdk-v4 But i still get some errors, i have fix it 1 by 1 but still and still getting new errors for including and others..
-
I fixed last error, but I got this error now Fatal error: Class 'Facebook\Facebook' not found in C:\wamp\www\fb_upload.php on line 223
-
Okay, so i dont know to work with API but im trying So this is my simple code <form action="" method="post"> <input type="file" name="fileToUpload"> <button>Upload</button> </form> <?php $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1; $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION); // Check if image file is a actual image or fake image if(isset($_POST["submit"])) { $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]); if($check !== false) { $fb = new Facebook\Facebook([ 'app_id' => 'myappid', 'app_secret' => 'myappsecret', 'default_graph_version' => 'v2.4', ]); $data = [ 'message' => 'My awesome photo upload example.', 'source' => $fb->fileToUpload($target_dir), ]; try { // Returns a `Facebook\FacebookResponse` object $response = $fb->post('/me/photos', $data, 'myaccesstoken'); } catch(Facebook\Exceptions\FacebookResponseException $e) { echo 'Graph returned an error: ' . $e->getMessage(); exit; } catch(Facebook\Exceptions\FacebookSDKException $e) { echo 'Facebook SDK returned an error: ' . $e->getMessage(); exit; } $graphNode = $response->getGraphNode(); echo 'Photo ID: ' . $graphNode['id']; echo "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { echo "File is not an image."; $uploadOk = 0; } } ?> I got this error message Notice: Undefined index: fileToUpload in C:\wamp\www\fb.php on line 10 What is wrong in code for upload? Btw. are code for facebook API good?
-
Because im using fancybox for zoom When someone click on image, image zooms and title attribute is description or in my way like and share buttons
-
Yeah i checked that, but i dont know how to implement that in my code..
-
<?php .... $sql="SELECT * FROM `images` ORDER BY `id` DESC LIMIT $start,$end"; $rdata=mysqli_query($conn, $sql); while($res=mysqli_fetch_array($rdata)) { $imgname=$res['image']; $path = 'img/'.$imgname; ?> <img src='<?php echo $path; ?>' height="500" width='500' alt='<?php echo $imgname; ?>' title='<div class="fb-like" data-href="http://site.com/<?php echo $path; ?>" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>'> <?php } ?>
-
Thanks for help I work on this project as exercise
-
This is my code for facebook like and share <img src='<?php echo $path; ?>' height="500" width='500' alt='<?php echo $imgname; ?>' title='<div class="fb-like" data-href="http://mysite.com/<?php echo $path; ?>" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>'"></iframe> Now $path is location to image, $imgname is name of image When I look image for first time I can see like and share button, but when i do it again, i cant see like and share button.. Why?
-
I have image upload script, now i want that when I upload new image to my site to share automatically on facebook page, can i make some simple script for that operation? Can someone give me simple code for that?
-
Im using md5 only for my projects on localhost.. For Everything else im using bcrypt
-
What is wrong in this code? $username = htmlspecialchars($_POST['username']); $password = md5($_POST['password']); $sql = "SELECT * FROM users WHERE username='$username' AND password='$password' "; if($conn->query($sql) === TRUE) { $_SESSION['username'] = $username; header('Location: panel.php'); } else { echo 'Wrong username or passsword!'.mysqli_error($conn); } I fixed it.. This is my code now: $username = htmlspecialchars($_POST['username']); $password = md5($_POST['password']); $sql = "SELECT * FROM users WHERE username='$username' AND password='$password'"; $query = mysqli_fetch_assoc($conn, $sql); $run_query = mysqli_query($conn, $sql); if(!$run_query) { echo 'Wrong username or password!'; } else { $_SESSION['username'] = $username; header('Location: panel.php'); }
-
Can you give me code for example?
-
I need progress bar in javascript for php cURL This is my code $url = 'www.site.com'; $list = array("ext.pdf", "ext_1.pdf", "ext_2.pdf", "ext_3.pdf", "ext_4.pdf"); foreach($list as $lists) { $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_URL, $url.$lists); $result = curl_exec($ch); curl_close($ch); if (preg_match("/200 OK/", $result)){ echo "<p>$url$lists</p>"; } else if (preg_match("/401 Unauthorized/", $result)) { echo "<p>$url$lists</p>"; } } Can someone help?