Hello everyone!
I allow users to submit a question, and they should be able to have single quotes in their title.
Currently, if a title contains a single quote, it will submit properly.
$question->values($post_data); $question->save();
Any ideas on how I can set Kohana to escape that single quote / escape my information automatically? ...
I have an MYSQL table with a large product list. In this product list table there are categories, a name, description, text, etc. I want to add a modifier for the industries that it can be used in (e.g. hospitals, schools, events, sport events, etc.)
I'm running this query through PHP/MYSQL right now:
public function GetIndustrySerie...
I have a MySQL database of addresses (my custom points of interest - not Googles) and their associated Lat/Long. What would be the simplest way for a user to my site (their lat/long is also stored in their user profile) to be shown a:
google map with their own lat/long as a starting (center) point
default radius of 10 Miles
all Points...
Hi,
I've been attempting to refactor a fairly simple three or four page site to use a very lightweight MVC setup (probably overkill - but I thought I'd try it out for fun).
The site uses an .htaccess file:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME...
I need to check if any strings follow the same format as these.
Val-Pak
*Client Referral*
Gift Certificate
It needs to be done in regular expression. I can't find how to include the * and -.
Thanks
...
I'm trying to find the index based on the value stored within it.
This would normally be easy, but the array I'm working with is highly nested. Each index 0,1,2 has fields f1,f2,f3 . I'm trying to find which index 0,1,2 has in its f2 field the value this stored in it. In this case, it's index 0. So that's the output I'm looking for. Is...
Hi guys.
I'm thinking of using PHP_SELF to grab the name of the page the user is currently visiting. I'm well aware of the dangers of using PHP_SELF in places like form actions, though I'm not sure where it would hurt to use in hrefs? But that's beside the main question . . . anyway.
Are there any dangers in using PHP_SELF to grab the ...
Okay. I have this code on my site:
<?php
session_start();
include "database.php";
include "bruger.php";
$bruger = new bruger();
if( $bruger->logget_ind() ){
$brugernavn = $_SESSION['brugernavn'];
$bruger_slash = addslashes($brugernavn);
$hnavnn = mysql_query(" SELECT hnavn FROM bruger WHERE brugernavn = '" . $bruger_slash . "'"...
How can I split a string at the first occurrence of - (minus sign) into two $vars with PHP?
I have found how to split on every "-" but, not only on the first occurrence.
example:
this - is - line - of whatever - is - relevant
$var1 = this
$var2 = is - line - of whatever - is - relevant
Note, also stripped the first "-" .
Thanks in ...
I've got a php script that sends a few emails and echoes a response back to my front end.
The problem is that the email handling is so slow, the front end is timing out. Here are the broad strokes for the email implementation.
The scenario kicks off when User A books an offer from User B. User A gets a confirmation email, User B gets a...
I have a text ($text) and an array of words ($tags). These words in the text should be replaced with links to other pages so they don't break the existing links in the text. In CakePHP there is a method in TextHelper for doing this but it is corrupted and it breaks the existing HTML links in the text. The method suppose to work like this...
Currently, my friend has a program that checks the users Windows CD-Key and then it goes through a one way encryption. He, then, adds that new generated number to the program for checking purposes and then he compiles it and then he sends it off to the client. Is there a better way to keep the program from being shared utilizing PHP som...
I am trying to learn mysql and having some problem with updating/adding data to the table
this is my code and after running this page when I go to phpmyadmin to see if the new data showed up, i dont see it there.
<?php
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(!$conn) { die("Could not connect"); }
$dbname = "test";
mys...
Say we have an array like this with 1 being two values and 2 being two values and 3, etc
$language = array
(
"1"=>array
(
"Hola",
"Spanish"
),
"2"=>array
(
"Fáilte",
"Irish"
),
"3"=>array
(
"Yasou",
"Greek"
)
);
How would I randomly select ONLY 1 of 3 arrays an...
Any comments/improvements on this process?
User Table:
id, username, password, salt
Storing a New User
Receive the username (plaintext) from $_POST
Receive the password (sha512'd using javascript) http://pajhome.org.uk/crypt/md5/sha512.html from $_POST
Generate a 128 character salt (alphanumeric with symbols) on the server and store ...
i was learning this PHP code from a tutorial to upload files
<form method="post" enctype="multipart/form-data">
<input name="userfile" type="file" id="userfile">
</form>
<?php
if (isset($_POST['upload']) && $_FILES['userfile']['size'] > 0) {
$fileName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_nam...
I have programed PHP a few days and found that It's not easy to debug the code(which I mean the PHP code itself, and especially the Javascript code).
I am using gvim as editor, firebug and the truthful alert as debugger. But I am not satisfied, I need some killer feature like setting breakpoints, step code etc.
Are there any developmen...
I'm parsing simplexml and normally my simple xml would look like this
$sig_size = (int)$xmlObject->sig->points;
which returns 24 in this example
<?xml version='1.0' standalone='yes'?>
<photo id='470'>
<artist>mg</artist>
<lines>
<points>22</points>
<angle>-5</angle>
<x>165</x>
<align>...
Site in question: http://tinyurl.com/23oar6z
You can look at the source for the javascript on the JQuery or the main part here:
// validate signup form on keyup and submit
var validator = $("#Register").validate({
rules: {
UserID: {
required: true,
minlength: 2,
remote: {
...
Hi guys,
I'm trying to add a new method to jQuery validation plugin with the codes below. My goal is to check whether the email address has already existed in the database(MySQL). If it is, it will inform the user to register for another email address. Somehow, the result that always returns is "Email is already taken".
These are the c...