AviNahum
-
Posts
170 -
Joined
-
Last visited
Posts posted by AviNahum
-
-
assume that the var $txt contain this:
<p> sad <{img_2}> asd </p>
i want the output will be 2
i want all the content that comes before and after the number 2 will removed...
and its important to me to replace the "<" and ">" with "<" and ">"
i tried this:
$img_id = preg_replace("/^(.+?)\<{img_(.+?)\}>(.+?)\$/", "\\2", $txt );
but its still wont work...
and thanks for trying to help!
-
i need some more help and i thought it's will be better if i post it here and dont open a new topic...
$img_id = preg_replace( "/<{img_(.+?)\}>/", "\\1", $txt );
this code works fine,
for example:
this:
<p> sad <{img_2}> asd </p>
will be replaced with:
<p> sad 2 asd </p>
i want to remove all characters thats comes before and after the number "2"
i tried this code:
$img_id = preg_replace( "/(.+?)\/ /<{img_(.+?)\ /(.+?)\/}>/", "\\2", $txt );
but its wont work and shows this error:
Warning: preg_replace() [function.preg-replace]: Unknown modifier '&' in C:\wamp\www\cms\functions.php on line 265
i tried a few another ways but still it's wont work...
thanks!
-
OK, thanks!
i solved it!
Thanks again!
-
thanks for trying to help,
but i already tried this tutorial and i cant make it to work
-
hey,
i'm trying to convert some special combination to images...
it's my first time i'm try to use regular expressions...
this is the function i using:
public function convert($txt) { global $DB; $txt = preg_replace( "<{img_(.+?)\}>", "<img src='\\1\.gif'>", $txt ); return $txt; }
in simple words, i want it to convert the combination <{img_1}> to <img src='1.gif'>
the number 1 (<{img_1}> ) can change to any number...
this function wont work and shows me an error:
Warning: preg_replace() [function.preg-replace]: Unknown modifier 'g' in C:\wamp\www\cms\functions.php on line 260
Thanks!
***sorry for poor english***
-
thanks!
but i found another script ready to use without any problems...
http://www.djs-consulting.com/linux/blog/2008/a-handy-php-backup-script
-
hey,
i'm trying to make an option on my CMS ACP to download a full backup of database (mysql)
and i have no idea how to start...
i'm not asking for a full code, i just need direction or algorithm...
Thanks!
***sorry for poor english***
-
thanks MrAdam.... its works!
and thank you too dzelenika....
-
i trying to get all files that exist in my "uploads" directory...
im using this code:
//+--------------------------------------------------- // Getting out all images from the images directory //+--------------------------------------------------- $dir = 'uploads'; $files = scandir($dir); foreach($files as $ind_file){ echo '<img src="'.$dir.'/'.$ind_file.'" width="120">'; }
this code works fine...
but there is a problem...
there are only pictures on this folder, and i insert the file name into "<img>" tag in the foreach loop...
its display all the pictuers but its always shows me 2 pics without a URL....
those 2 picstures does not exist in this folder!
***Sorry for very poor english***
-
correct me if i mistaken....
$_POST get some array...
and you want to check if some values of this array are exist in $glass array?
-
its fine...
-
try this code:
<p>Transfer resaults:</p> <?php //connect to base1 server $con = mysql_connect("localhost","MYSQL USER","MYSQL PASS"); if (!$con) { die('Could not connect: ' . mysql_error()); } //select the smf database mysql_select_db("MYSQL DB", $con); // Let's validate all the fields //validating credit password $select = "SELECT member_id FROM smf_themes WHERE member_id = '{$_POST['memberid']}' and credits = '{$_POST['creditpass']}'"; $result = mysql_query($select, $con); $row = mysql_fetch_array($result); if(mysql_num_rows($result) != 1); //if member id and creditpass didn't match do: { echo "An error occoured: <br /> Your member id and/or creditpassword didn't math. Please try again"; die(); } //Let's see if the user tries to cheat by inserting other stuff into the transfer amount other than positive numbers. //Let's see if the user tries to cheat by transfering more credits than he got //Make sure whmcs email exists //DONE!! Start the transfer! ?> [code]
-
try this:
<?php mysql_connect("localhost", "CENSORED", "CENSORED") or die(mysql_error()); echo "Connected to MySQL<br />"; mysql_select_db("runetyco_cms") or die(mysql_error()); echo "Connected to MySQL<br />"; $content = $_POST['content']; mysql_query("INSERT INTO cms (content) VALUES('$content' ) ") or die(mysql_error()); $result = mysql_query("SELECT * FROM cms") or die(mysql_error()); while ($row = mysql_fetch_array( $result )) { echo "Name: ".$row['content']; } ?>
-
if ( in_array($_POST['abc'] ,$glass) ) { // Something }
you even dont have to use a loop...
-
the basic protection its block html an javascript tags....
$txt = htmlspecialchars("$_POST['name']", ENT_QUOTES);
its simply protects you from things like JS alert...
-
im confused....
which file name you want to insert into DB...
explain me the best way you can i help...
-
thanks a lot!
its works great!
-
$_FILES['userfile']['name']
use this to get the original file name from the user computer
-
try this pagination script... i using that and its work great...
-
ummm i made an article application that allows to admin to put
one article in more than one category...
i use checkboxs to choose the categories and i just implode it and insert into DB...
but when i try to edit a article i want the checkbox of category already be checked (only categories that choosen)...
$DB->query("SELECT * FROM cms_articles WHERE id='$article_id'"); $article = $DB->fetch_row(); //+--------------------------- // Select all out categories //+--------------------------- $DB->query("SELECT * FROM cms_categories order by id"); $cats_number = $DB->get_num_rows(); $c .= '<table border="0" cellpadding="0" cellspacing="0" width="45%" bgcolor="#FFFFFF"><tr>'; // Set up cats counter $count = 1; // If we dont have any categories so show an error if ($cats_number == 0) $c .= '<td><b>לא קיימים קטגוריות<b></td>'; $a = explode(',', $article['cats']); $b = count($a); while ($cat = $DB->fetch_row()) { for ($i=0; $i<= $b; $i++) { if ($a[$i] == $cat['id']) { $checked .= 'checked="checked"'; } } $c .= '<td width="25%"><input type="checkbox" name="cats[]" value="'.$cat['id'].'" '.$checked.'> '.$cat['name'].'</td>'; $count++; // Every 4 cats we want to break a line if ($count == 4) { $c .= '</tr><tr>'; $count = 1; } } $c .= '</tr></table>';
there are some words in hebrew, sorry...
as you can see i just select the cats of the article and explode it....
and i using the FOR loop into the WHILE loop to make the boxes checked...
it's wont work... its make all categories checked...
i want it's checked only the categories that i choosed when i made the article...
***sorry for very poor english***
-
someone help please?
-
try to change this line to data without vars:
$sel = mysql_query("SELECT * FROM users WHERE$info") or die(mysql_error());
change this to:
$sel = mysql_query("SELECT * FROM users WHERE id=2") or die(mysql_error());
change it to your db details
-
yea, but i i wanna it's show some text in redirect,
i just want to clear all data the browser got...
-
it's my first time i using OOP, and it's my first time i working on system that i totally separator between the HTML and PHP codes.
so i trying to make a redirect screen that redirect the user to the index after registration (only for example)
but when i print the redirect i dont want that print other parts... for example, this is my HTML code:
<html> <body> some text </body> </html>
i want it clear this totally!
and print the redirect!
this is my function:
function redirect_screen($text, $url) { global $gvars, $skin_global, $DB; $htm = $skin_global->Redirect($text, $url); echo $htm; exit; }
and this is the "Redirect" function (the html):
function Redirect($Text, $Url) { global $gvars; return <<<HTML <html> <head> <meta http-equiv="content-type" content="text/html; charset=windows-1255" /> <meta http-equiv='refresh' content='2; url=$Url' /> </head> <body> <table width='30%' height='85%' align='center' dir="rtl" style="border:1px solid #dbdbdb;"> <tr> <td valign='middle' align="right"> <table border="0" cellpadding="0" cellspacing="0" width="100%" align="center" dir="rtl"> <tr><td> <table class="good_m_tile" align="right" width="100%" border="0" cellpadding="0" cellspacing="0" dir="rtl"><tr><td align="right" width="100%">thanks</td></tr></table> </td></tr> <tr><td> <table border="0" cellpadding="0" cellspacing="0" width="100%" align="center" dir="rtl"> <tr> <td align="right" class="linkt"> $Text<br /> you are transfor<br /><br /> (<a href='$Url'>some text</a>) </td> </tr> </table> </td></tr> </table> </td> </tr> </table> </body> </html> HTML; }
as you can see it's print the HTML tag again...
there is some function that totally clear all browser data?
[sorry for poor English, i'm not english speaker :|]
[SOLVED] get image width & height with php
in PHP Coding Help
Posted
is it possible to get image width & height?