php

how to set up curl in php?

i am trying to use some sms gateway and it require me to use curl to post a message to their server. How do i set up curl on windows and linux server? I guess curl is some php library? Which files do i need to include? Where will i get those files? ...

PHP: strtotime()... again.

How do I have to write "+3 days at 12:34:56" to make strtotime() parse it properly? ...

Error Handling in Model (MVC)

I was wondering what the excepted standard is for handling errors in the Model. Currently I have 'setError' and 'getError' methods that's in use by all my Models. This means I'm only concerned with whether a call to a method in my Model is true or false. If it's false then I would use $this->model->getError() in my Controller. Additio...

mysql_list_tables into foreach array?

Is it possible to list my tables into a foreach array? current code. $browsers = array ("site1", "site2", "site3"); foreach($browsers as $browser) { $domain = $browser; include ('code.php'); } ...

Should I use mod_rewrite for my site's URLs?

My site currently handles URL's like this... /?p=home /?p=profile&userid=1 /?p=users.online /?p=users.online&page=23 /?p=mail.inbox /?p=mail.inbox&page=12 ... and so on, there is probably at least 120-150 different pages, on my site a page is built like this, index.php includes a main config file which then includes func...

PHP swap month and day in timestamp

Hey Guys, Right. I was inserting a load of data into a MySQL DB and used the following to generate the timestamp: $stamp = mktime($t[0], $t[1], $t[2], $d[2], $d[1], $d[0]); Unfortunately, the day and month were mixed around, and below is the correct timestamp. $stamp = mktime($t[0], $t[1], $t[2], $d[1], $d[2], $d[0]); It is about ...

PHP regex matching recursively

Hi I'm trying to match a certain set of tags in a template file. I however want the tags to be able to be nested in itself. My regex is the following: (with /s) <!-- START (.*?) -->(.*?)<!-- END \\1 --> Tag example: <!-- START yList --> y:{yList:NUM} | <!-- START xList --> x:{xList:NUM} <!-- END xList --> <!-- CARET x...

Dynamic Query based on mulitple GET variables (Refine Search Form)

So im trying to find a script that can start me off with creating an 'refine search' panel which will be a form, hopefully something close to what Ebay have got at the moment. Whilst I know this is going to be a form and using the GET method, I cant find a script that can parse a url for multiple params and update the query all dynamica...

How can I make this backlink checker regex better, its missing some sites

<? $mysite = ('websiteurl');?> <? echo $mysite; ?> Links not found <? $time_limit = 3600; set_time_limit($time_limit); include_once("myconnect.php"); $sql0="select * from trade where 1 "; $sql0=$sql0." order by a1 asc"; $query=mysql_query($sql0); $cnt=1; while ( ($rs_query=mysql_fetch_array($query)) ) { if($cnt%2<...

Need help with associative arrays

Hi guys. My brain is fried after 10 hours of coding, so I need some help. I have used the following function to retrieve data from a form submission (before I process the data, verifying input etc): // All form fields are identified by '[id]_[name]', where 'id' is the // identifier of the form type. Eg. brand, store etc. // The...

How do I deal with an occassional 302 HTTP error

I have read that 302 HTTP errors are not supposed to appear frequently even if you do receive one of them. the problem is they appear one out of 10 times in a page redirect in my script. Have you had any experiences with this before? I am using a PHP framework called Kohana. ...

PHP 5 - decoupling important scripts using cURL/socket calls, good idea?

I have an IPN script for PayPal, and as I can only rely on a log file to debug it and it's hard to maintain a testing server (and to test even for I am a one-man team), I am considering using cURL to run other scripts which would handle sending of emails, logging into database and updating of logs. This way, if I have to send a new emai...

Why this PHP snippet not working?

$i = 'i'; $arr = array('hi' => 'test'); echo "$arr[h$i]";exit(); What's the right version to do it without {}? Say,I know can do it with "{$arr['h' . $i]}" EDIT 1.inside "" 2.with operation like ".",i.e,['h' . $i] 3.without {} ...

All possible ways to read a file from a remote server

Hello, i want to provide most possible flexibility for my script and so i need all possible ways in php and javascript to read the content(not sourcecode) of a php file from a remote server. so far i found curl, fopen and include for php and none for javascript, but i dont even know if this is possible with javascript. Thanks for any hin...

Is this efficient coding for anti-spam?

if(strpos($string, "PENIS") != false){ echo 'This word is not allowed'; } if(strpos($string, "VAGINA") != false){ echo 'This word is not allowed'; } Okay, so I am trying to check the submit data to see if there are inappropriate words. Instead of making 5 instances, is there a more efficient way? ...

How to Conditionally Retrieve Rows from the Database in PHP?

Ok, I have a database full of values with one field value for prospects and another for clients... I'd like to retrieve only the clients information... How do I write the function??? UPDATE Here is the script I tried to write: <?php try { $sql = "SELECT * FROM clients" // WHERE history" or die(mysql_error()); forea...

How to rapidly build a Web Application?

To build a Web Application, what kind of open source web application frameworks / technologies are currently present that would be: Faster to learn. Ease of use. Have widgets for rapid development(From a GUI perspective). Database integration. I would want this web app to communicate to a Java client. I am not bound to Java ...

How to convert multi-byte punctuations to single byte ones with PHP?

For example,both , and , are commas,but the first one takes 2 byte,while the second one only 1. How to convert the 2 byte one to 1 byte? ...

Where does the extra empty <option> come from?

<?php $salaries = array(1000,1500,2000,2500,3000,4000,5000,6000,7000,9000,12000,18000,30000); $str = ''; foreach($salaries as $salary) { $str .= "<option value=\"$salary\">$salary+</option>"; } function populateSalary() { $salaries = array(1000,1500,2000,2500,3000,4000,5000,6000,7000,9000,12000,18000,30000); $str = ''; f...

How to split a string by multiple delimiters in PHP?

"something here ; and there, oh,that's all!" I want to split it by ; and , so after processing should get: something here and there oh that's all! ...