Jump to content

Ch0cu3r

Staff Alumni
  • Posts

    3,404
  • Joined

  • Last visited

  • Days Won

    55

Everything posted by Ch0cu3r

  1. The rewrite will only match urls like site.com/<id-here>-<page-title-here> Your urls appear to be the reverse of that format
  2. Whoops, my bad. $images[] = array() bit should be // add the image data to the array $images[] = array( 'url' => $photo->images->{$display_size}, 'link' => $photo->link );
  3. On debian all Apache modules are installed in /usr/lib/apache2/modules/ this is where you should find libphp5.so (it comes with the libapache2-mod-php5 package). The configuration for this module is located in /etc/apache2/mods-available. When you enable the module via a2enmod* its configuration is linked in /etc/apache2/mods-enabled. When Apache is (re)started it loads all modules from this directory. * a2enmod is called during package installation
  4. You can enable basic HTML code in posts such as <a> and <img> within the AdminCP. Go to Admin Control Panel -> Post and Topics -> Bulletin Board Code tab and check "Enable basic HTML in posts" http://wiki.simplemachines.org/smf/Posts_and_Topics#Post_Settings
  5. If you have install php and the apache php module via the repositories (apt-get intsall command) then it should already be enabled. All you need to do is restart apache after installation. sudo apachectl restart If the php module is not enabled, run sudo a2enmod php5 && sudo apachectl restart To enable the php apache module. Apache on Debian loads all (enabled) modules (and their configuration) into the mods-enabled directory. When I started using Debain/Ubuntu with Apache this guide help me understand how Apache's config was setup.
  6. You mean you want to allow bbcode to be used in your SMF forum? SMF supports bbcodes and it should already be enabled by default.. What is your question? You maybe better of posting over at SMF support forum or see if there is a mod for you to use.
  7. Change your forms submit method to post. <?php if(isset($_POST['submit'])) { echo 'You entered: '; echo '<pre> ' . print_r($_POST, true) . '</pre>'; } ?> <form method="post"> Username <input type="text" name="username" /><br /> Password <input type="password" name="password" /><br /> <input type="submit" name="submit" value="Login" /> </form> If you dont state the method then the form will default to GET. Information on how PHP deals with forms. http://us2.php.net/manual/en/language.variables.external.php http://us2.php.net/manual/en/tutorial.forms.php Best place is the PHP manual over at php.net/manual/
  8. Move session_start so it is before any output <?php session_start(); ?> <html> <?php require_once('index.php'); ?> <head> <title>login page</title> </head> <body bgcolor="black" style="color:gray"> <h1 align="center" style="color:gray" >Welcome to this simple application</h1> <form action="index.php" method=get> <?php if( $_SESSION["logging"]&& $_SESSION["logged"]) { print_secure_content(); } else { if(!$_SESSION["logging"]) { $_SESSION["logging"]=true; loginform(); } else if($_SESSION["logging"]) { $number_of_rows=checkpass(); if($number_of_rows==1) { $_SESSION[user]=$_GET[userlogin]; $_SESSION[logged]=true; print"<h1>you have loged in successfully</h1>"; print_secure_content(); } else{ print "wrong pawssword or username, please try again"; loginform(); } } } function loginform() { print "please enter your login information to proceed with our site"; print ("<table border='2'><tr><td>username</td><td><input type='text' name='userlogin' size'20'></td></tr><tr><td>password</td><td><input type='password' name='password' size'20'></td></tr></table>"); print "<input type='submit' >"; print "<h3><a href='registerform.php'>register now!</a></h3>"; } function checkpass() { $servername="localhost"; $username="username"; $db_pass = "dbpass"; $db_name = 'db_name'; $conn= mysql_connect($servername,$username,$db_pass)or die(mysql_error()); mysql_select_db($db_name,$conn); $sql="select * from users where name='$_GET[userlogin]' and password='$_GET[password]'"; $result=mysql_query($sql,$conn) or die(mysql_error()); return mysql_num_rows($result); } function print_secure_content() { print("<b><h1>hi mr.$_SESSION[user]</h1>"); print "<br><h2>only a logged in user can see this</h2><br><a href='logout.php'>Logout</a><br>"; } ?> </form> </body> </html>
  9. Output is considered anything that is echo'd or outside of the php tags. The code in red is output. <html> <?php require_once('index.php'); ?> <head> <title>login page</title> </head> <body bgcolor="black" style="color:gray"> <h1 align="center" style="color:gray" >Welcome to this simple application</h1> <form action="index.php" method=get> <?php session_start();
  10. You can write text to an image using gettextttftext. You can pass any ttf font to that function http://papermashup.com/php-gd-generate-an-image-with-text-and-font-embedding/
  11. This code here in GetTaggedBlogPosts is wrong $stmt = $DBH->prepare("SELECT blog_post_id FROM blog_post_tags WHERE tag_id = :postTagId"); $stmt->bindParam(":postTagId", $postTags, PDO::PARAM_INT); $stmt->execute(); if(!empty($stmt)) { $blogstmt = $DBH->prepare("SELECT * FROM blog_post WHERE id = :blog_id ORDER BY id DESC"); $blogstmt->bindParam(":blog_id", $stmt, PDO::PARAM_INT); $blogstmt->execute(); } else { echo "Something went wrong....Please contact the administrator so that we can fix this issue."; } Your are passing in $stmt object as the bindParam. You should be passing in the blog_post_id that was returned from the previous query. However, having two queries for this is not necessary you can do it all in one query using joins. So you can replace the code above with $stmt = $DBH->prepare(" SELECT p.id, p.title, p.post, p.author_id, p.date_posted FROM blog_post_tags pt LEFT JOIN blog_post p ON p.id = pt.blog_id WHERE pt.tag_id = :postTagId"); $stmt->bindParam(":postTagId", $postTags, PDO::PARAM_INT); $stmt->execute(); $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
  12. If the ?count parameter allows you to grab multiple images, for example ?count=7 returns seven images then your code would be <?php function fetch_data($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 20); $result = curl_exec($ch); curl_close($ch); return $result; } $access_token = "token goes here"; $display_size = "standard_resolution"; $number_of_images = 7; // get seven images $result = fetch_data("https://api.instagram.com/v1/users/[user account]/media/recent/?count={$number_of_images}&access_token={$access_token}"); $result = json_decode($result); // place images into an array $images = array(); foreach($result->data as $photo) { // add the image data to the array $images[] = array( 'url' = $photo->images->{$display_size}, 'link' = $photo->link, ); } ?> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td valign="top"> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="center"> <a href="<?php echo $images[0]['link'] ?>" target="new"><img src="<?php echo $images[0]['url']; ?>" border="0" height="200" width="200" /></a> </td> </tr> <tr> <td align="center"> <a href="<?php echo $images[1]['link'] ?>" target="new"><img src="<?php echo $images[1]['url']; ?>" border="0" height="200" width="200" /></a> </td> </tr> <tr> </table> </td> <td align="center"> <a href="<?php echo $images[2]['link'] ?>" target="new"><img src="<?php echo $images[2]['url']; ?>" border="0" height="400" width="400" /></a> </td> <td valign="top"> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="center"> <a href="<?php echo $images[3]['link'] ?>" target="new"><img src="<?php echo $images[3]['url']; ?>" border="0" height="200" width="200" /></a> </td> </tr> <tr> <td align="center"> <a href="<?php echo $images[4]['link'] ?>" target="new"><img src="<?php echo $images[4]['url']; ?>" border="0" height="200" width="200" /></a> </td> </tr> <tr> </table> </td> <td valign="top"> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="center"> <a href="<?php echo $images[5]['link'] ?>" target="new"><img src="<?php echo $images[5]['url']; ?>" border="0" height="200" width="200" /></a> </td> </tr> <tr> <td align="center"> <a href="<?php echo $images[6]['link'] ?>" target="new"><img src="<?php echo $images[6]['url']; ?>" border="0" height="200" width="200" /></a> </td> </tr> <tr> </table> </td> </tr> </table> Your could shorten it further by outputting the table dynamically by looping over the $images array. Rather than hard coding the HTML table.
  13. Then output the images in the foreach loop <table> <?php foreach ($result->data as $photo) { $img = $photo->images->{$display_size}; echo "<tr><td>"; // output new table row echo "<p align=center><a href='{$photo->link}' target=new><img src='{$img->url}' border=0 height=200 width=200/></a></p>"; // output image echo "</tr></td>"; // close table row ?> </table>
  14. Are getting one image at a time? if so then you dont need to use foreach. You'd use $img = $result->data->images->{$display_size}; to get the image.
  15. Yes it is possible. I have a look at this thread. I helped someone with a similar question to yours. http://forums.phpfreaks.com/topic/283442-how-would-you-query-a-post-in-database-by-title-only/
  16. Yes. $SLevels = array(); foreach ($xml->Type->Company as $item) { $companyName = (string) $item->Name; // get the company name $tmp = (array) $item->SLevel; if($tmp[0] != '-') $SLevels[] = array($tmp[0], $companyName); // add SLevel and company name to array } $minSLevel = min($SLevels); // get minimum value echo $minSLevel[1] .' has the minimum SLevel value of ' . $minSLevel[0];
  17. Ok I tested the code. I found a few issues with it. try this instead $SLevels = array(); foreach ($xml->Type->Company as $item) { $tmp = (array) $item->SLevel; if($tmp[0] != '-') // ignore SLevels set to a dash $SLevels[] = $tmp[0]; // add SLevel to array } $minSLevel = min($SLevels); // get minimum value echo 'The minimum SLevel value is ' . $minSLevel;
  18. My bad, change $SLevels[] = array(); to $SLevels = array();
  19. This is not PHP GD or a PHP version problem. The code you posted is using exec to run a an ImageMagick command to convert the images. For this code to work you need to have ImageMagick installed on the server. If you cant do this then you need to recode it to use the PHP GD image library instead.
  20. You'd loop through the xml storing the SLevel into an array. Then you'd use min $SLevels[] = array(); foreach ($xml->Type->Company as $item) { $SLevels[] = $item->SLevel; // add SLevel to array } $minSLevel = min($SLevels); // get minimum value echo 'The minimum SLevel value is ' . $minSLevel;
  21. Your form code should be <form action="/gdform.php" method="post" enctype="multipart/form-data"> <h1>Your Information</h1> <input type="hidden" name="subject" value="Form Submission" /> <input type="hidden" name="redirect" value="thankyou.html" /> <a href="https://cid-31240a34...d1a7/index.html" target="_blank" >View Appointment Calendar</a><br> <img src="kelly3.jpg" alt="lace front wig" class="kelly3"> <p>First Name <input type="text" name="first_name" size="40" maxlength="35" /></br</p> <p>Last Name <input type="text" name="last_name" size="40" maxlength="35" /></br></p> <p>Email <input type="email" name="email" size="40" maxlength="35" required /></br></p> <p>Telephone<input type="tel" name="tel" size="40" maxlength="35"/></br></p> <p>Please provide information on the hair services you are interested in.</p> <textarea name="info" cols="40" rows="10"> </textarea><br> <p>Please upload your hair style photos</p><input type="file" name="file" accept="image/jpg,image/gif,image/png"> <input type="submit" name="submit" value="submit" style="background-color: #f00;font-size:24px; margin-top: 60px; margin-left: 415px; "/> </form>
  22. The urls for loading the various javascript files is pointing to http://localhost/ This is what is displayed in my browser console GET http://localhost/regenesys-rebuild/wp-content/plugins/nextgen-gallery/produ…xtgen/modules/lightbox/static/fancybox/jquery.fancybox-1.3.4.css?ver=3.7.1 404 (Not Found) (index):153 GET http://localhost/regenesys-rebuild/wp-content/plugins/nextgen-gallery/produ…xtgen/modules/lightbox/static/fancybox/jquery.easing-1.3.pack.js?ver=3.7.1 404 (Not Found) (index):527 GET http://localhost/regenesys-rebuild/wp-content/plugins/nextgen-gallery/produ…extgen/modules/lightbox/static/fancybox/nextgen_fancybox_init.js?ver=3.7.1 404 (Not Found) (index):529 GET http://localhost/regenesys-rebuild/wp-content/plugins/nextgen-gallery/produ…n/modules/lightbox/static/fancybox/jquery.fancybox-1.3.4.pack.js?ver=3.7.1 404 (Not Found) (index):528 event.returnValue is deprecated. Please use the standard event.preventDefault() instead. These four JavaScript files need to be loaded from regenesys.co.za not localhost. Perhaps this is the issue?
  23. So you have not learnt how to get data from a database yet? You do know it takes more than just copy and paste skills to learn how to program right? (Didn't mean to sound like an ass) The three steps I have given you should only require about 8 lines of code (4 of which you already have for salting the password).
  24. Better of splitting the names into multiple fields. Such as First name, Middle name(s) and Last name fields. Then validate each field separately.
  25. In step4 of the reset script rather than use an md5 hash. You need to get the salt from the database first (similar to how the login code gets the salt) Then hash their password with the salt. (refer to the login code to see how this is done) You then update the users password with the new salted password hash (replace md5($pass) with the salted password hash)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.