php

Why does my variable always seem to be 0?

Here is my code: if (isset($_POST['addmonths'])){ if (!empty($_POST['months'])){ if (is_numeric($_POST['months'])){ $monthtoadd = $_POST['months']; if ($monthstoadd == 0){ mysql_query("UPDATE users SET months='lifetime' WHERE username='$lookupuser'"); echo "Successfully...

PHP - creating multiple forms

I would like to create a dialog where I am asking the user about his language skills. the construction looks as follow: form input select language input select years of experiance button(add new language) {or} button(submit) /form the problem I have is that I only can pass my values to my db after I have collected all information. ...

How do I send a site user login information without being redirected to that site?

I have a form that collects a user's username and password for a third-party site. Only when the login information works do I want to proceed on my site. My problem is that I currently have it set up as a form with the action link the third-party and when they click on the button, it just redirects them to the other site. How can I only ...

How to make "textarea" in Form return paragraphs (PHP).

Beginner here. I have a form with a textarea to return comments. I got a PHP script from helpvid.net to send the form to. So, the form is being sent to a PHP file.The form then returns the information to me in an email. Problem is that the comments are sent as one large run-in paragraph. Even if the user hits Return in the field to mak...

Problem with uploading files on root linux server

I have a plesk panel and root dedicated server on 1and1. I'm using custom programed php script to upload the files and create the folders to server. I have the upload folder named upload_data_folder with the 777 permission. The scenario is the following: I want to create folder in my upload_data_folder and than upload files in that newl...

Adding Facebook Connect to a CodeIgniter website

I'm having problems trying to connect my website to Facebook. What I would like it to do is allow users to augment their accounts by connecting them to Facebook (I do not need people to be able to login with Facebook, I am using OpenID instead). My website runs in the CodeIgniter framework. What I will do is remove everything that I've ...

bit.ly API use issues (shorten,lookup,and clicks)

Hi, as part of my time is'nt dediacted to PHP dev, I'm having an issue wich is probably easy to solve, but having absolutely no logs (PHP logs, browser firebug logs...) I'm pretty stuck. Here's my code; as I'm testing stuff, it's pretty raw. The index.php file : <script type="text/javascript" src="http://www.google.com/jsapi"&gt;&lt;/...

Elegant way to count the number of lines that contain a string in a file

Hi, I have a quick question. As the title says, I'd like to find a way to count the number of lines that contain a specified string in a file, in PHP. I know I could simply open the file and loop through all the lines and see if anything matches, but that seems kind of cumbersome. Is there a better way? To further illustrate what I wa...

Problem running console app from php script

Hi, i start a linux console app from my php5 script, it starts ok but then termintates. I've tried using system(), shell_exec and tried starting as background process but to no avail it starts and then quits. What i am trying to achieve is from a remote browser start a console app using a php5 script and then it should remain running (...

Display collections on my website using Flickr API

Hello everyone, I have been looking for a long time where I could find a php script using phpflickr class (or not) in order to display collections (titles, images or both) on my website. I can't find any. If anyone has idea... Thanks in advance. Regards, Pico ...

Adjacency List Model Select by Path

I'm trying to select a node in my heirarchical system. I have the "/Path/To/Some/Node" (In exactly that form) and I am trying to figure out how I can get the children of "Node". Naturally "Node" is pseudo-unique, in that it is the only child called "Node" inside of Some, but there could be another "Node" inside of "Path" so you obvious...

Do PHP scripts work if htaccess url rewrite is implemented?

If I use mod-rewrite to change a url like this: http://www.mysite.com/page.php?title=my-name-is-john to http://www.mysite.com/page/my-name-is-john and if the page.php file contains a script that relies on parameters passed through the url like: $_GET['title']; Then will that script still work after the mod-rewrite has been imple...

How to get the current plugin directory in Wordpress?

I need to get the current plugin directory like [wordpress_install_dir]/wp-content/plugins/plugin_name (if getcwd() called from the plugin, it returns [wordpress_install_dir], the root of installation) thanks for help ...

MP4 plays when accessed directly, but not when read through PHP, on iOS

I use a PHP script to validate video requests before serving them. This script works as expected on the desktop, with Safari and Chrome. But on iOS, I get a broken play button. I'm sure the video is properly encoded for iPhone/iPad, because when I access it directly, it works as expected. The relevant PHP code: $file_name = 'test-vi...

Problems writing a module for phpBMS

I am trying to write a small, simple module for phpBMS. I am basically modifying and simplifying one that exists, and have gotten to the stage of creating the table and pages in phpBMS itself and making the module installable. I am now trying to create the php page that will allow for new records to be inserted into the table via phpBM...

PHP: replacing a specific char in a range with preg_replace

Hi everybody! Lets say I'm trying to replace every "A" character with a "B", inside two [lol] tags. For example: "[lol]It's greatA really isA[/lol]" will become "[lol]It's greatB really isB[/lol]" I was trying to work something myself but it was in vain. The closest i got is this: preg_replace("%(\[lol\])"."(.*?)([A]+?)(.*?)"."(\[/...

Problem with session_start(), ob_start() and security

In my web admin area I have using very simple logic: session_start(); ob_start(); if(!isset($_SESSION['user'])){ header("Location: login.php"); } contents... ob_end_flush(); Yes this is working perfect, redirect to login page. But the comic point is that I can see the content of index.php (that protected!!!) here What is wrong? T...

Does mysqli_stmt::result_metadata return false on insert, update, delete queries?

I'm a bit not understanding - on update, insert, delete queries result_metadata returns false? Because: $meta = $stmt->result_metadata(); if($meta === false){ throw new Exception(...)); } throws the exception when i try to run update, insert or delete query. But it should be false only on error. (from php manual) ...

PHP and Ethical Hacking

I know all the security issues. SQL injection, XSS issues, SSL, session hijacking , I have read security books etc. But yet, I feel that a backroom boy laugh me ! I want to hack my site ethically before backroom boy did this illegally?. From Where I can start? How can I make sure that I use security preventions correctly? Thanks ...

PHP Loginsystem: Remember Me

Hello, so I have my loginsystem for now. Now im coming to where i'd like to have a remember me that you can "check", before you log in. Now i know how to do this checkbox, but how store cookie to the user in the right way, secure and best way? I mean like facebook have their remember me checkbox, and when you have checked that once ever...